@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.
- package/README.md +0 -1
- package/dist/Orchestrator.d.ts +24 -2
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +197 -24
- package/dist/config/ConfigLoader.d.ts +72 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -0
- package/dist/config/ConfigLoader.js +187 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +4 -0
- package/dist/core/ASTWorker.d.ts +11 -36
- package/dist/core/ASTWorker.d.ts.map +1 -1
- package/dist/core/ASTWorker.js +93 -99
- package/dist/core/CoverageAnalyzer.d.ts +65 -0
- package/dist/core/CoverageAnalyzer.d.ts.map +1 -0
- package/dist/core/CoverageAnalyzer.js +198 -0
- package/dist/core/FileNodeManager.d.ts +40 -0
- package/dist/core/FileNodeManager.d.ts.map +1 -0
- package/dist/core/FileNodeManager.js +84 -0
- package/dist/core/GraphFreshnessChecker.d.ts +33 -0
- package/dist/core/GraphFreshnessChecker.d.ts.map +1 -0
- package/dist/core/GraphFreshnessChecker.js +101 -0
- package/dist/core/HashUtils.d.ts +24 -0
- package/dist/core/HashUtils.d.ts.map +1 -0
- package/dist/core/HashUtils.js +45 -0
- package/dist/core/IncrementalReanalyzer.d.ts +36 -0
- package/dist/core/IncrementalReanalyzer.d.ts.map +1 -0
- package/dist/core/IncrementalReanalyzer.js +132 -0
- package/dist/core/NodeFactory.d.ts +225 -17
- package/dist/core/NodeFactory.d.ts.map +1 -1
- package/dist/core/NodeFactory.js +208 -18
- package/dist/core/ScopeTracker.d.ts +84 -0
- package/dist/core/ScopeTracker.d.ts.map +1 -0
- package/dist/core/ScopeTracker.js +116 -0
- package/dist/core/SemanticId.d.ts +90 -0
- package/dist/core/SemanticId.d.ts.map +1 -0
- package/dist/core/SemanticId.js +115 -0
- package/dist/core/VersionManager.d.ts.map +1 -1
- package/dist/core/VersionManager.js +3 -2
- package/dist/core/nodes/ArgumentExpressionNode.d.ts +43 -0
- package/dist/core/nodes/ArgumentExpressionNode.d.ts.map +1 -0
- package/dist/core/nodes/ArgumentExpressionNode.js +60 -0
- package/dist/core/nodes/ArrayLiteralNode.d.ts +27 -0
- package/dist/core/nodes/ArrayLiteralNode.d.ts.map +1 -0
- package/dist/core/nodes/ArrayLiteralNode.js +41 -0
- package/dist/core/nodes/CallSiteNode.d.ts +28 -0
- package/dist/core/nodes/CallSiteNode.d.ts.map +1 -1
- package/dist/core/nodes/CallSiteNode.js +46 -0
- package/dist/core/nodes/ClassNode.d.ts +33 -1
- package/dist/core/nodes/ClassNode.d.ts.map +1 -1
- package/dist/core/nodes/ClassNode.js +46 -2
- package/dist/core/nodes/DecoratorNode.d.ts +42 -0
- package/dist/core/nodes/DecoratorNode.d.ts.map +1 -0
- package/dist/core/nodes/DecoratorNode.js +62 -0
- package/dist/core/nodes/EnumNode.d.ts +42 -0
- package/dist/core/nodes/EnumNode.d.ts.map +1 -0
- package/dist/core/nodes/EnumNode.js +54 -0
- package/dist/core/nodes/ExportNode.d.ts +37 -1
- package/dist/core/nodes/ExportNode.d.ts.map +1 -1
- package/dist/core/nodes/ExportNode.js +48 -2
- package/dist/core/nodes/ExpressionNode.d.ts +97 -0
- package/dist/core/nodes/ExpressionNode.d.ts.map +1 -0
- package/dist/core/nodes/ExpressionNode.js +178 -0
- package/dist/core/nodes/ExternalModuleNode.d.ts +28 -0
- package/dist/core/nodes/ExternalModuleNode.d.ts.map +1 -0
- package/dist/core/nodes/ExternalModuleNode.js +41 -0
- package/dist/core/nodes/ExternalStdioNode.d.ts +13 -6
- package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -1
- package/dist/core/nodes/ExternalStdioNode.js +15 -8
- package/dist/core/nodes/FunctionNode.d.ts +36 -0
- package/dist/core/nodes/FunctionNode.d.ts.map +1 -1
- package/dist/core/nodes/FunctionNode.js +80 -1
- package/dist/core/nodes/ImportNode.d.ts +19 -5
- package/dist/core/nodes/ImportNode.d.ts.map +1 -1
- package/dist/core/nodes/ImportNode.js +23 -5
- package/dist/core/nodes/InterfaceNode.d.ts +46 -0
- package/dist/core/nodes/InterfaceNode.d.ts.map +1 -0
- package/dist/core/nodes/InterfaceNode.js +55 -0
- package/dist/core/nodes/IssueNode.d.ts +73 -0
- package/dist/core/nodes/IssueNode.d.ts.map +1 -0
- package/dist/core/nodes/IssueNode.js +129 -0
- package/dist/core/nodes/MethodCallNode.d.ts +30 -0
- package/dist/core/nodes/MethodCallNode.d.ts.map +1 -1
- package/dist/core/nodes/MethodCallNode.js +49 -0
- package/dist/core/nodes/MethodNode.d.ts +32 -0
- package/dist/core/nodes/MethodNode.d.ts.map +1 -1
- package/dist/core/nodes/MethodNode.js +48 -0
- package/dist/core/nodes/ModuleNode.d.ts +31 -0
- package/dist/core/nodes/ModuleNode.d.ts.map +1 -1
- package/dist/core/nodes/ModuleNode.js +37 -0
- package/dist/core/nodes/NetworkRequestNode.d.ts +54 -0
- package/dist/core/nodes/NetworkRequestNode.d.ts.map +1 -0
- package/dist/core/nodes/NetworkRequestNode.js +65 -0
- package/dist/core/nodes/ObjectLiteralNode.d.ts +27 -0
- package/dist/core/nodes/ObjectLiteralNode.d.ts.map +1 -0
- package/dist/core/nodes/ObjectLiteralNode.js +41 -0
- package/dist/core/nodes/ScopeNode.d.ts +31 -0
- package/dist/core/nodes/ScopeNode.d.ts.map +1 -1
- package/dist/core/nodes/ScopeNode.js +49 -0
- package/dist/core/nodes/TypeNode.d.ts +36 -0
- package/dist/core/nodes/TypeNode.d.ts.map +1 -0
- package/dist/core/nodes/TypeNode.js +53 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts +27 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -1
- package/dist/core/nodes/VariableDeclarationNode.js +40 -0
- package/dist/core/nodes/index.d.ts +12 -1
- package/dist/core/nodes/index.d.ts.map +1 -1
- package/dist/core/nodes/index.js +14 -0
- package/dist/diagnostics/DiagnosticCollector.d.ts +98 -0
- package/dist/diagnostics/DiagnosticCollector.d.ts.map +1 -0
- package/dist/diagnostics/DiagnosticCollector.js +129 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts +77 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts.map +1 -0
- package/dist/diagnostics/DiagnosticReporter.js +159 -0
- package/dist/diagnostics/DiagnosticWriter.d.ts +31 -0
- package/dist/diagnostics/DiagnosticWriter.d.ts.map +1 -0
- package/dist/diagnostics/DiagnosticWriter.js +43 -0
- package/dist/diagnostics/index.d.ts +14 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +11 -0
- package/dist/errors/GrafemaError.d.ts +118 -0
- package/dist/errors/GrafemaError.d.ts.map +1 -0
- package/dist/errors/GrafemaError.js +131 -0
- package/dist/index.d.ts +57 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -1
- package/dist/logging/Logger.d.ts +48 -0
- package/dist/logging/Logger.d.ts.map +1 -0
- package/dist/logging/Logger.js +134 -0
- package/dist/plugins/Plugin.d.ts +5 -1
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/Plugin.js +33 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/DatabaseAnalyzer.js +13 -6
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressAnalyzer.js +27 -19
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +21 -14
- package/dist/plugins/analysis/FetchAnalyzer.d.ts +1 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/FetchAnalyzer.js +34 -14
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +6 -3
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -1
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +76 -80
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +180 -17
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/JSASTAnalyzer.js +1171 -471
- package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ReactAnalyzer.js +56 -57
- package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/RustAnalyzer.js +15 -10
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SQLiteAnalyzer.js +9 -7
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js +21 -9
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SocketIOAnalyzer.js +27 -15
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SystemDbAnalyzer.js +15 -5
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +34 -4
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/GraphBuilder.js +318 -298
- package/dist/plugins/analysis/ast/IdGenerator.d.ts +105 -0
- package/dist/plugins/analysis/ast/IdGenerator.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/IdGenerator.js +116 -0
- package/dist/plugins/analysis/ast/types.d.ts +176 -5
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts +33 -0
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/createParameterNodes.js +89 -0
- package/dist/plugins/analysis/ast/utils/index.d.ts +6 -0
- package/dist/plugins/analysis/ast/utils/index.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/index.js +5 -0
- package/dist/plugins/analysis/ast/utils/location.d.ts +87 -0
- package/dist/plugins/analysis/ast/utils/location.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/location.js +78 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +9 -4
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +6 -5
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +99 -9
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +663 -125
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +4 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +72 -32
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +4 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +128 -63
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +11 -8
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +12 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +36 -14
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +4 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +17 -13
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js +3 -2
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/SimpleProjectDiscovery.js +5 -1
- package/dist/plugins/discovery/WorkspaceDiscovery.d.ts +22 -0
- package/dist/plugins/discovery/WorkspaceDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/WorkspaceDiscovery.js +136 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.d.ts +46 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.d.ts.map +1 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.js +86 -0
- package/dist/plugins/discovery/workspaces/detector.d.ts +21 -0
- package/dist/plugins/discovery/workspaces/detector.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/detector.js +49 -0
- package/dist/plugins/discovery/workspaces/globResolver.d.ts +35 -0
- package/dist/plugins/discovery/workspaces/globResolver.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/globResolver.js +184 -0
- package/dist/plugins/discovery/workspaces/index.d.ts +9 -0
- package/dist/plugins/discovery/workspaces/index.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/index.js +8 -0
- package/dist/plugins/discovery/workspaces/parsers.d.ts +38 -0
- package/dist/plugins/discovery/workspaces/parsers.d.ts.map +1 -0
- package/dist/plugins/discovery/workspaces/parsers.js +80 -0
- package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -1
- package/dist/plugins/enrichment/AliasTracker.js +14 -8
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +14 -7
- package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ImportExportLinker.js +23 -6
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MethodCallResolver.js +18 -12
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MountPointResolver.js +8 -3
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -1
- package/dist/plugins/enrichment/PrefixEvaluator.js +16 -7
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/RustFFIEnricher.js +6 -5
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +17 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +129 -10
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/IncrementalModuleIndexer.js +23 -14
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/JSModuleIndexer.js +63 -31
- package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/RustModuleIndexer.js +5 -4
- package/dist/plugins/indexing/ServiceDetector.d.ts +10 -0
- package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -1
- package/dist/plugins/indexing/ServiceDetector.js +28 -15
- package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -1
- package/dist/plugins/validation/CallResolverValidator.js +8 -7
- package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -1
- package/dist/plugins/validation/DataFlowValidator.js +17 -12
- package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -1
- package/dist/plugins/validation/EvalBanValidator.js +17 -16
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -1
- package/dist/plugins/validation/GraphConnectivityValidator.js +19 -23
- package/dist/plugins/validation/NodeCreationValidator.d.ts +85 -0
- package/dist/plugins/validation/NodeCreationValidator.d.ts.map +1 -0
- package/dist/plugins/validation/NodeCreationValidator.js +415 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -1
- package/dist/plugins/validation/SQLInjectionValidator.js +59 -16
- package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -1
- package/dist/plugins/validation/ShadowingDetector.js +6 -5
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -1
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +12 -11
- package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -1
- package/dist/plugins/vcs/GitPlugin.js +10 -12
- package/dist/plugins/vcs/VCSPlugin.d.ts +3 -2
- package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -1
- package/dist/plugins/vcs/VCSPlugin.js +5 -5
- package/dist/storage/backends/RFDBServerBackend.d.ts +10 -17
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
- package/dist/storage/backends/RFDBServerBackend.js +31 -10
- package/dist/validation/PathValidator.d.ts +1 -2
- package/dist/validation/PathValidator.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/Orchestrator.ts +237 -24
- package/src/config/ConfigLoader.ts +263 -0
- package/src/config/index.ts +5 -0
- package/src/core/ASTWorker.ts +143 -139
- package/src/core/CoverageAnalyzer.ts +243 -0
- package/src/core/FileNodeManager.ts +100 -0
- package/src/core/GraphFreshnessChecker.ts +143 -0
- package/src/core/HashUtils.ts +48 -0
- package/src/core/IncrementalReanalyzer.ts +192 -0
- package/src/core/NodeFactory.ts +401 -18
- package/src/core/ScopeTracker.ts +154 -0
- package/src/core/SemanticId.ts +192 -0
- package/src/core/VersionManager.ts +3 -2
- package/src/core/nodes/ArgumentExpressionNode.ts +89 -0
- package/src/core/nodes/ArrayLiteralNode.ts +65 -0
- package/src/core/nodes/CallSiteNode.ts +58 -0
- package/src/core/nodes/ClassNode.ts +63 -2
- package/src/core/nodes/DecoratorNode.ts +91 -0
- package/src/core/nodes/EnumNode.ts +86 -0
- package/src/core/nodes/ExportNode.ts +70 -2
- package/src/core/nodes/ExpressionNode.ts +231 -0
- package/src/core/nodes/ExternalModuleNode.ts +56 -0
- package/src/core/nodes/ExternalStdioNode.ts +17 -9
- package/src/core/nodes/FunctionNode.ts +101 -1
- package/src/core/nodes/ImportNode.ts +32 -10
- package/src/core/nodes/InterfaceNode.ts +91 -0
- package/src/core/nodes/IssueNode.ts +177 -0
- package/src/core/nodes/MethodCallNode.ts +64 -0
- package/src/core/nodes/MethodNode.ts +63 -0
- package/src/core/nodes/ModuleNode.ts +50 -0
- package/src/core/nodes/NetworkRequestNode.ts +77 -0
- package/src/core/nodes/ObjectLiteralNode.ts +65 -0
- package/src/core/nodes/ScopeNode.ts +65 -0
- package/src/core/nodes/TypeNode.ts +78 -0
- package/src/core/nodes/VariableDeclarationNode.ts +52 -0
- package/src/core/nodes/index.ts +18 -1
- package/src/diagnostics/DiagnosticCollector.ts +163 -0
- package/src/diagnostics/DiagnosticReporter.ts +204 -0
- package/src/diagnostics/DiagnosticWriter.ts +50 -0
- package/src/diagnostics/index.ts +16 -0
- package/src/errors/GrafemaError.ts +174 -0
- package/src/index.ts +148 -1
- package/src/logging/Logger.ts +152 -0
- package/src/plugins/Plugin.ts +42 -0
- package/src/plugins/analysis/DatabaseAnalyzer.ts +14 -8
- package/src/plugins/analysis/ExpressAnalyzer.ts +29 -19
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +22 -21
- package/src/plugins/analysis/FetchAnalyzer.ts +39 -16
- package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +84 -101
- package/src/plugins/analysis/JSASTAnalyzer.ts +1483 -503
- package/src/plugins/analysis/ReactAnalyzer.ts +57 -57
- package/src/plugins/analysis/RustAnalyzer.ts +15 -10
- package/src/plugins/analysis/SQLiteAnalyzer.ts +10 -7
- package/src/plugins/analysis/ServiceLayerAnalyzer.ts +22 -16
- package/src/plugins/analysis/SocketIOAnalyzer.ts +31 -22
- package/src/plugins/analysis/SystemDbAnalyzer.ts +16 -11
- package/src/plugins/analysis/ast/GraphBuilder.ts +439 -327
- package/src/plugins/analysis/ast/IdGenerator.ts +177 -0
- package/src/plugins/analysis/ast/types.ts +209 -6
- package/src/plugins/analysis/ast/utils/createParameterNodes.ts +104 -0
- package/src/plugins/analysis/ast/utils/index.ts +12 -0
- package/src/plugins/analysis/ast/utils/location.ts +103 -0
- package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +11 -8
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +909 -83
- package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +97 -44
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +159 -93
- package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +12 -8
- package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +41 -14
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +37 -17
- package/src/plugins/discovery/MonorepoServiceDiscovery.ts +3 -2
- package/src/plugins/discovery/SimpleProjectDiscovery.ts +6 -1
- package/src/plugins/discovery/WorkspaceDiscovery.ts +177 -0
- package/src/plugins/discovery/resolveSourceEntrypoint.ts +103 -0
- package/src/plugins/discovery/workspaces/detector.ts +63 -0
- package/src/plugins/discovery/workspaces/globResolver.ts +229 -0
- package/src/plugins/discovery/workspaces/index.ts +23 -0
- package/src/plugins/discovery/workspaces/parsers.ts +99 -0
- package/src/plugins/enrichment/AliasTracker.ts +14 -8
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +14 -7
- package/src/plugins/enrichment/ImportExportLinker.ts +24 -6
- package/src/plugins/enrichment/MethodCallResolver.ts +18 -12
- package/src/plugins/enrichment/MountPointResolver.ts +8 -3
- package/src/plugins/enrichment/PrefixEvaluator.ts +16 -7
- package/src/plugins/enrichment/RustFFIEnricher.ts +6 -5
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +149 -12
- package/src/plugins/indexing/IncrementalModuleIndexer.ts +23 -14
- package/src/plugins/indexing/JSModuleIndexer.ts +74 -34
- package/src/plugins/indexing/RustModuleIndexer.ts +5 -4
- package/src/plugins/validation/CallResolverValidator.ts +8 -7
- package/src/plugins/validation/DataFlowValidator.ts +16 -12
- package/src/plugins/validation/EvalBanValidator.ts +17 -16
- package/src/plugins/validation/GraphConnectivityValidator.ts +19 -23
- package/src/plugins/validation/NodeCreationValidator.ts +554 -0
- package/src/plugins/validation/SQLInjectionValidator.ts +61 -15
- package/src/plugins/validation/ShadowingDetector.ts +6 -5
- package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +12 -11
- package/src/plugins/vcs/GitPlugin.ts +40 -12
- package/src/plugins/vcs/VCSPlugin.ts +7 -5
- package/src/storage/backends/RFDBServerBackend.ts +43 -29
- package/src/validation/PathValidator.ts +1 -1
- package/dist/core/AnalysisWorker.d.ts +0 -14
- package/dist/core/AnalysisWorker.d.ts.map +0 -1
- package/dist/core/AnalysisWorker.js +0 -307
- package/dist/core/ParallelAnalyzer.d.ts +0 -120
- package/dist/core/ParallelAnalyzer.d.ts.map +0 -1
- package/dist/core/ParallelAnalyzer.js +0 -331
- package/dist/core/QueueWorker.d.ts +0 -12
- package/dist/core/QueueWorker.d.ts.map +0 -1
- package/dist/core/QueueWorker.js +0 -567
- package/dist/core/RFDBClient.d.ts +0 -179
- package/dist/core/RFDBClient.d.ts.map +0 -1
- package/dist/core/RFDBClient.js +0 -429
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +0 -19
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +0 -1
- package/dist/plugins/discovery/ZonServiceDiscovery.js +0 -204
- package/src/core/AnalysisWorker.ts +0 -410
- package/src/core/ParallelAnalyzer.ts +0 -476
- package/src/core/QueueWorker.ts +0 -780
- package/src/plugins/indexing/ServiceDetector.ts +0 -230
|
@@ -22,28 +22,29 @@ export class ImportExportLinker extends Plugin {
|
|
|
22
22
|
priority: 90, // Run early in enrichment, after analysis
|
|
23
23
|
creates: {
|
|
24
24
|
nodes: [],
|
|
25
|
-
edges: ['IMPORTS_FROM']
|
|
25
|
+
edges: ['IMPORTS', 'IMPORTS_FROM']
|
|
26
26
|
},
|
|
27
27
|
dependencies: ['JSASTAnalyzer'] // Requires IMPORT and EXPORT nodes
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
async execute(context) {
|
|
31
31
|
const { graph, onProgress } = context;
|
|
32
|
-
|
|
32
|
+
const logger = this.log(context);
|
|
33
|
+
logger.info('Starting import-export linking');
|
|
33
34
|
const startTime = Date.now();
|
|
34
35
|
// Step 1: Build EXPORT index - Map<file, Map<exportKey, exportNode>>
|
|
35
36
|
const exportIndex = await this.buildExportIndex(graph);
|
|
36
37
|
const indexTime = Date.now() - startTime;
|
|
37
|
-
|
|
38
|
+
logger.debug('Indexed exports', { files: exportIndex.size, time: `${indexTime}ms` });
|
|
38
39
|
// Step 2: Build MODULE lookup - Map<file, moduleNode>
|
|
39
40
|
const modulesByFile = await this.buildModuleLookup(graph);
|
|
40
|
-
|
|
41
|
+
logger.debug('Indexed modules', { count: modulesByFile.size });
|
|
41
42
|
// Step 3: Process all IMPORT nodes
|
|
42
43
|
const imports = [];
|
|
43
44
|
for await (const node of graph.queryNodes({ nodeType: 'IMPORT' })) {
|
|
44
45
|
imports.push(node);
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
logger.info('Found imports to link', { count: imports.length });
|
|
47
48
|
let edgesCreated = 0;
|
|
48
49
|
let skipped = 0;
|
|
49
50
|
let notFound = 0;
|
|
@@ -90,6 +91,17 @@ export class ImportExportLinker extends Plugin {
|
|
|
90
91
|
notFound++;
|
|
91
92
|
continue;
|
|
92
93
|
}
|
|
94
|
+
// Create MODULE -> IMPORTS -> MODULE edge for relative imports
|
|
95
|
+
const sourceModule = modulesByFile.get(imp.file);
|
|
96
|
+
const targetModule = modulesByFile.get(targetFile);
|
|
97
|
+
if (sourceModule && targetModule) {
|
|
98
|
+
await graph.addEdge({
|
|
99
|
+
type: 'IMPORTS',
|
|
100
|
+
src: sourceModule.id,
|
|
101
|
+
dst: targetModule.id
|
|
102
|
+
});
|
|
103
|
+
edgesCreated++;
|
|
104
|
+
}
|
|
93
105
|
// Find matching export based on import type
|
|
94
106
|
const importType = imp.importType; // 'default', 'named', or 'namespace'
|
|
95
107
|
let targetExport;
|
|
@@ -120,7 +132,12 @@ export class ImportExportLinker extends Plugin {
|
|
|
120
132
|
}
|
|
121
133
|
}
|
|
122
134
|
const totalTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
123
|
-
|
|
135
|
+
logger.info('Complete', {
|
|
136
|
+
edgesCreated,
|
|
137
|
+
skipped,
|
|
138
|
+
notFound,
|
|
139
|
+
time: `${totalTime}s`
|
|
140
|
+
});
|
|
124
141
|
return createSuccessResult({ nodes: 0, edges: edgesCreated }, {
|
|
125
142
|
importsProcessed: imports.length,
|
|
126
143
|
edgesCreated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodCallResolver.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/MethodCallResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAmBhF,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C,OAAO,CAAC,qBAAqB,CAAC,CAAqC;IAEnE,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"MethodCallResolver.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/MethodCallResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAmBhF,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C,OAAO,CAAC,qBAAqB,CAAC,CAAqC;IAEnE,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAoG5D;;OAEG;YACW,qBAAqB;IA0CnC;;OAEG;YACW,sBAAsB;IAkBpC;;OAEG;YACW,iBAAiB;IA0D/B;;OAEG;YACW,mBAAmB;YAqBnB,4BAA4B;IAyB1C;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAWzB"}
|
|
@@ -26,7 +26,8 @@ export class MethodCallResolver extends Plugin {
|
|
|
26
26
|
}
|
|
27
27
|
async execute(context) {
|
|
28
28
|
const { graph, onProgress } = context;
|
|
29
|
-
|
|
29
|
+
const logger = this.log(context);
|
|
30
|
+
logger.info('Starting method call resolution');
|
|
30
31
|
let methodCallsProcessed = 0;
|
|
31
32
|
let edgesCreated = 0;
|
|
32
33
|
let unresolved = 0;
|
|
@@ -38,12 +39,12 @@ export class MethodCallResolver extends Plugin {
|
|
|
38
39
|
methodCalls.push(callNode);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
+
logger.info('Found method calls to resolve', { count: methodCalls.length });
|
|
42
43
|
// Собираем все классы и их методы для быстрого поиска
|
|
43
|
-
const classMethodIndex = await this.buildClassMethodIndex(graph);
|
|
44
|
-
|
|
44
|
+
const classMethodIndex = await this.buildClassMethodIndex(graph, logger);
|
|
45
|
+
logger.info('Indexed classes', { count: classMethodIndex.size });
|
|
45
46
|
// Собираем переменные и их типы (если известны)
|
|
46
|
-
const variableTypes = await this.buildVariableTypeIndex(graph);
|
|
47
|
+
const variableTypes = await this.buildVariableTypeIndex(graph, logger);
|
|
47
48
|
const startTime = Date.now();
|
|
48
49
|
for (const methodCall of methodCalls) {
|
|
49
50
|
methodCallsProcessed++;
|
|
@@ -62,7 +63,12 @@ export class MethodCallResolver extends Plugin {
|
|
|
62
63
|
if (methodCallsProcessed % 10 === 0) {
|
|
63
64
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
64
65
|
const avgTime = ((Date.now() - startTime) / methodCallsProcessed).toFixed(0);
|
|
65
|
-
|
|
66
|
+
logger.debug('Progress', {
|
|
67
|
+
processed: methodCallsProcessed,
|
|
68
|
+
total: methodCalls.length,
|
|
69
|
+
elapsed: `${elapsed}s`,
|
|
70
|
+
avgTime: `${avgTime}ms/call`
|
|
71
|
+
});
|
|
66
72
|
}
|
|
67
73
|
// Пропускаем внешние методы (console, Array.prototype, etc.)
|
|
68
74
|
if (this.isExternalMethod(methodCall.object, methodCall.method)) {
|
|
@@ -93,20 +99,20 @@ export class MethodCallResolver extends Plugin {
|
|
|
93
99
|
unresolved,
|
|
94
100
|
classesIndexed: classMethodIndex.size
|
|
95
101
|
};
|
|
96
|
-
|
|
102
|
+
logger.info('Summary', summary);
|
|
97
103
|
return createSuccessResult({ nodes: 0, edges: edgesCreated }, summary);
|
|
98
104
|
}
|
|
99
105
|
/**
|
|
100
106
|
* Строит индекс классов и их методов
|
|
101
107
|
*/
|
|
102
|
-
async buildClassMethodIndex(graph) {
|
|
108
|
+
async buildClassMethodIndex(graph, logger) {
|
|
103
109
|
const index = new Map();
|
|
104
110
|
const startTime = Date.now();
|
|
105
111
|
let classCount = 0;
|
|
106
112
|
for await (const classNode of graph.queryNodes({ nodeType: 'CLASS' })) {
|
|
107
113
|
classCount++;
|
|
108
114
|
if (classCount % 50 === 0) {
|
|
109
|
-
|
|
115
|
+
logger.debug('Indexing classes', { count: classCount });
|
|
110
116
|
}
|
|
111
117
|
const className = classNode.name;
|
|
112
118
|
if (!className)
|
|
@@ -130,13 +136,13 @@ export class MethodCallResolver extends Plugin {
|
|
|
130
136
|
index.set(fileKey, classEntry);
|
|
131
137
|
}
|
|
132
138
|
const totalTime = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
133
|
-
|
|
139
|
+
logger.debug('Indexed class entries', { count: index.size, time: `${totalTime}s` });
|
|
134
140
|
return index;
|
|
135
141
|
}
|
|
136
142
|
/**
|
|
137
143
|
* Строит индекс переменных и их типов (из INSTANCE_OF рёбер)
|
|
138
144
|
*/
|
|
139
|
-
async buildVariableTypeIndex(graph) {
|
|
145
|
+
async buildVariableTypeIndex(graph, logger) {
|
|
140
146
|
const startTime = Date.now();
|
|
141
147
|
const index = new Map();
|
|
142
148
|
for await (const classNode of graph.queryNodes({ nodeType: 'CLASS' })) {
|
|
@@ -148,7 +154,7 @@ export class MethodCallResolver extends Plugin {
|
|
|
148
154
|
}
|
|
149
155
|
}
|
|
150
156
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
151
|
-
|
|
157
|
+
logger.debug('Built variable type index', { entries: index.size, time: `${elapsed}s` });
|
|
152
158
|
return index;
|
|
153
159
|
}
|
|
154
160
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MountPointResolver.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/MountPointResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAuBhG,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"MountPointResolver.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/MountPointResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAuBhG,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAkG5D;;OAEG;YACW,iBAAiB;IAsF/B;;OAEG;YACW,SAAS;CA2BxB"}
|
|
@@ -27,12 +27,13 @@ export class MountPointResolver extends Plugin {
|
|
|
27
27
|
async execute(context) {
|
|
28
28
|
try {
|
|
29
29
|
const { graph } = context;
|
|
30
|
+
const logger = this.log(context);
|
|
30
31
|
let endpointsUpdated = 0;
|
|
31
32
|
let mountPointsProcessed = 0;
|
|
32
33
|
// Find all MOUNT_POINT nodes
|
|
33
34
|
const allNodes = await graph.getAllNodes();
|
|
34
35
|
const mountPoints = allNodes.filter(node => node.type === 'MOUNT_POINT');
|
|
35
|
-
|
|
36
|
+
logger.info('Found mount points', { count: mountPoints.length });
|
|
36
37
|
// For each top-level mount point (from app.use in index.js)
|
|
37
38
|
// apply recursive resolver
|
|
38
39
|
const processedMountPoints = new Set();
|
|
@@ -89,11 +90,15 @@ export class MountPointResolver extends Plugin {
|
|
|
89
90
|
}
|
|
90
91
|
mountPointsProcessed++;
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
logger.info('Updated endpoints', {
|
|
94
|
+
endpoints: endpointsUpdated,
|
|
95
|
+
mountPoints: mountPointsProcessed
|
|
96
|
+
});
|
|
93
97
|
return createSuccessResult({ nodes: 0, edges: 0 }, { endpointsUpdated, mountPointsProcessed });
|
|
94
98
|
}
|
|
95
99
|
catch (error) {
|
|
96
|
-
|
|
100
|
+
const logger = this.log(context);
|
|
101
|
+
logger.error('Error in MountPointResolver', { error });
|
|
97
102
|
return createErrorResult(error);
|
|
98
103
|
}
|
|
99
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrefixEvaluator.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/PrefixEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAC;AAE/D,OAAO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-32,6 +32,7 @@ export class PrefixEvaluator extends Plugin {
|
|
|
32
32
|
async execute(context) {
|
|
33
33
|
try {
|
|
34
34
|
const { graph } = context;
|
|
35
|
+
const logger = this.log(context);
|
|
35
36
|
const graphTyped = graph;
|
|
36
37
|
let mountPointsEvaluated = 0;
|
|
37
38
|
let successfulEvaluations = 0;
|
|
@@ -47,7 +48,7 @@ export class PrefixEvaluator extends Plugin {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
+
logger.info('Found mount points with placeholders', { count: mountPoints.length });
|
|
51
52
|
// For each mount point try to evaluate prefix
|
|
52
53
|
for (const mountPoint of mountPoints) {
|
|
53
54
|
mountPointsEvaluated++;
|
|
@@ -57,13 +58,13 @@ export class PrefixEvaluator extends Plugin {
|
|
|
57
58
|
dst: mountPoint.id
|
|
58
59
|
});
|
|
59
60
|
if (definesEdges.length === 0) {
|
|
60
|
-
|
|
61
|
+
logger.debug('No DEFINES edge for mount point', { mountPointId: mountPoint.id });
|
|
61
62
|
continue;
|
|
62
63
|
}
|
|
63
64
|
const moduleId = definesEdges[0].fromId;
|
|
64
65
|
const module = graphTyped.nodes.get(moduleId);
|
|
65
66
|
if (!module || module.type !== 'MODULE') {
|
|
66
|
-
|
|
67
|
+
logger.debug('Module not found for mount point', { mountPointId: mountPoint.id });
|
|
67
68
|
continue;
|
|
68
69
|
}
|
|
69
70
|
// Parse module AST
|
|
@@ -77,7 +78,7 @@ export class PrefixEvaluator extends Plugin {
|
|
|
77
78
|
}
|
|
78
79
|
catch (error) {
|
|
79
80
|
const err = error;
|
|
80
|
-
|
|
81
|
+
logger.debug('Failed to parse file', { file: module.file, error: err.message });
|
|
81
82
|
continue;
|
|
82
83
|
}
|
|
83
84
|
// Try to evaluate prefix based on placeholder type
|
|
@@ -86,14 +87,22 @@ export class PrefixEvaluator extends Plugin {
|
|
|
86
87
|
mountPoint.prefix = evaluatedPrefix;
|
|
87
88
|
mountPoint.evaluated = true;
|
|
88
89
|
successfulEvaluations++;
|
|
89
|
-
|
|
90
|
+
logger.debug('Resolved prefix', {
|
|
91
|
+
file: mountPoint.file,
|
|
92
|
+
line: mountPoint.line,
|
|
93
|
+
prefix: evaluatedPrefix
|
|
94
|
+
});
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
|
-
|
|
97
|
+
logger.info('Evaluated mount points', {
|
|
98
|
+
successful: successfulEvaluations,
|
|
99
|
+
total: mountPointsEvaluated
|
|
100
|
+
});
|
|
93
101
|
return createSuccessResult({ nodes: 0, edges: 0 }, { mountPointsEvaluated, successfulEvaluations });
|
|
94
102
|
}
|
|
95
103
|
catch (error) {
|
|
96
|
-
|
|
104
|
+
const logger = this.log(context);
|
|
105
|
+
logger.error('Error in PrefixEvaluator', { error });
|
|
97
106
|
return createErrorResult(error);
|
|
98
107
|
}
|
|
99
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RustFFIEnricher.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/RustFFIEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoBhF,qBAAa,eAAgB,SAAQ,MAAM;IACzC,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"RustFFIEnricher.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/RustFFIEnricher.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoBhF,qBAAa,eAAgB,SAAQ,MAAM;IACzC,IAAI,QAAQ,IAAI,cAAc,CAW7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;YAgD9C,cAAc;YAiCd,sBAAsB;IAuCpC,OAAO,CAAC,iBAAiB;IAyCzB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -18,16 +18,17 @@ export class RustFFIEnricher extends Plugin {
|
|
|
18
18
|
}
|
|
19
19
|
async execute(context) {
|
|
20
20
|
const { graph } = context;
|
|
21
|
+
const logger = this.log(context);
|
|
21
22
|
// 1. Build index of NAPI-exported Rust functions/methods
|
|
22
23
|
const napiIndex = await this.buildNapiIndex(graph);
|
|
23
24
|
if (napiIndex.size === 0) {
|
|
24
|
-
|
|
25
|
+
logger.info('No NAPI exports found, skipping');
|
|
25
26
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true, reason: 'No NAPI exports' });
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
logger.debug('Indexed NAPI exports', { count: napiIndex.size });
|
|
28
29
|
// 2. Find JS CALL nodes that target Rust
|
|
29
30
|
const jsCalls = await this.findRustCallingJsCalls(graph);
|
|
30
|
-
|
|
31
|
+
logger.debug('Found candidate JS calls', { count: jsCalls.length });
|
|
31
32
|
// 3. Match and create FFI_CALLS edges
|
|
32
33
|
let edgesCreated = 0;
|
|
33
34
|
const unmatched = [];
|
|
@@ -49,9 +50,9 @@ export class RustFFIEnricher extends Plugin {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
if (unmatched.length > 0 && unmatched.length <= 20) {
|
|
52
|
-
|
|
53
|
+
logger.debug('Unmatched calls', { calls: unmatched.slice(0, 10) });
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
+
logger.info('Created FFI_CALLS edges', { count: edgesCreated, unmatched: unmatched.length });
|
|
55
56
|
return createSuccessResult({ nodes: 0, edges: edgesCreated }, { unmatched: unmatched.length });
|
|
56
57
|
}
|
|
57
58
|
async buildNapiIndex(graph) {
|
|
@@ -65,6 +65,7 @@ interface Graph {
|
|
|
65
65
|
type: string;
|
|
66
66
|
metadata?: Record<string, unknown>;
|
|
67
67
|
}): Promise<void> | void;
|
|
68
|
+
deleteEdge?(src: string, dst: string, type: string): Promise<void>;
|
|
68
69
|
}
|
|
69
70
|
export declare class ValueDomainAnalyzer extends Plugin {
|
|
70
71
|
static MAX_DEPTH: number;
|
|
@@ -109,6 +110,22 @@ export declare class ValueDomainAnalyzer extends Plugin {
|
|
|
109
110
|
* Find method by object name and method name
|
|
110
111
|
*/
|
|
111
112
|
findMethod(objectName: string, methodName: string, file: string, graph: Graph): Promise<NodeRecord | null>;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve computed property names for object mutations.
|
|
115
|
+
* Finds FLOWS_INTO edges with mutationType: 'computed' and resolves
|
|
116
|
+
* the property name using value set tracing.
|
|
117
|
+
*
|
|
118
|
+
* @param graph - Graph backend with edge operations
|
|
119
|
+
* @returns Statistics about resolution
|
|
120
|
+
*/
|
|
121
|
+
resolveComputedMutations(graph: Graph, logger: ReturnType<typeof this.log>): Promise<{
|
|
122
|
+
resolved: number;
|
|
123
|
+
conditional: number;
|
|
124
|
+
unknownParameter: number;
|
|
125
|
+
unknownRuntime: number;
|
|
126
|
+
deferredCrossFile: number;
|
|
127
|
+
total: number;
|
|
128
|
+
}>;
|
|
112
129
|
}
|
|
113
130
|
export default ValueDomainAnalyzer;
|
|
114
131
|
//# sourceMappingURL=ValueDomainAnalyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueDomainAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/plugins/enrichment/ValueDomainAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa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B,YAAY,EAAE,MAAM,GACnB,cAAc;IA2EjB;;OAEG;IACH,4BAA4B,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO;IA+B3D;;OAEG;IACG,aAAa,CACjB,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,CAAC;IA0F1B;;OAEG;IACG,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAkC7B;;;;;;;OAOG;IACG,wBAAwB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QACzF,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CAsHH;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -51,15 +51,16 @@ export class ValueDomainAnalyzer extends Plugin {
|
|
|
51
51
|
priority: 65, // After AliasTracker (60)
|
|
52
52
|
creates: {
|
|
53
53
|
nodes: [],
|
|
54
|
-
edges: ['CALLS']
|
|
54
|
+
edges: ['CALLS', 'FLOWS_INTO'] // Added FLOWS_INTO (modifies existing)
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
async execute(context) {
|
|
59
59
|
const { graph } = context;
|
|
60
|
+
const logger = this.log(context);
|
|
60
61
|
const onProgress = context.onProgress;
|
|
61
62
|
const graphTyped = graph;
|
|
62
|
-
|
|
63
|
+
logger.info('Starting value domain analysis');
|
|
63
64
|
let callsProcessed = 0;
|
|
64
65
|
let callsResolved = 0;
|
|
65
66
|
let edgesCreated = 0;
|
|
@@ -74,7 +75,7 @@ export class ValueDomainAnalyzer extends Plugin {
|
|
|
74
75
|
computedCalls.push(callNode);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
logger.info('Found computed member calls', { count: computedCalls.length });
|
|
78
79
|
// 2. For each computed call get value set
|
|
79
80
|
for (const call of computedCalls) {
|
|
80
81
|
callsProcessed++;
|
|
@@ -130,15 +131,20 @@ export class ValueDomainAnalyzer extends Plugin {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
}
|
|
134
|
+
// 5. Resolve computed property mutations in FLOWS_INTO edges
|
|
135
|
+
logger.debug('Resolving computed property mutations');
|
|
136
|
+
const mutationStats = await this.resolveComputedMutations(graphTyped, logger);
|
|
137
|
+
logger.debug('Mutation resolution stats', mutationStats);
|
|
133
138
|
const summary = {
|
|
134
139
|
callsProcessed,
|
|
135
140
|
callsResolved,
|
|
136
141
|
edgesCreated,
|
|
137
142
|
conditionalCalls,
|
|
138
|
-
partialCalls
|
|
143
|
+
partialCalls,
|
|
144
|
+
computedMutations: mutationStats
|
|
139
145
|
};
|
|
140
|
-
|
|
141
|
-
return createSuccessResult({ nodes: 0, edges: edgesCreated }, summary);
|
|
146
|
+
logger.info('Summary', summary);
|
|
147
|
+
return createSuccessResult({ nodes: 0, edges: edgesCreated + mutationStats.resolved + mutationStats.conditional }, summary);
|
|
142
148
|
}
|
|
143
149
|
/**
|
|
144
150
|
* Get set of possible values for a variable
|
|
@@ -167,11 +173,9 @@ export class ValueDomainAnalyzer extends Plugin {
|
|
|
167
173
|
}
|
|
168
174
|
}
|
|
169
175
|
if (variables.length === 0) {
|
|
170
|
-
console.log(`[ValueDomainAnalyzer] No variable found for ${variableName} in ${file}`);
|
|
171
176
|
result.hasUnknown = true;
|
|
172
177
|
return result;
|
|
173
178
|
}
|
|
174
|
-
console.log(`[ValueDomainAnalyzer] Found ${variables.length} variable(s) for ${variableName}`);
|
|
175
179
|
// Trace ASSIGNED_FROM to LITERAL or nondeterministic sources
|
|
176
180
|
const visited = new Set();
|
|
177
181
|
const valueSet = new Set();
|
|
@@ -223,8 +227,7 @@ export class ValueDomainAnalyzer extends Plugin {
|
|
|
223
227
|
for await (const s of graph.queryNodes({ nodeType: 'SCOPE' })) {
|
|
224
228
|
const scopeNode = s;
|
|
225
229
|
if (scopeNode.id === currentScopeId ||
|
|
226
|
-
scopeNode.originalId === currentScopeId
|
|
227
|
-
scopeNode.stableId === currentScopeId) {
|
|
230
|
+
scopeNode.originalId === currentScopeId) {
|
|
228
231
|
scope = scopeNode;
|
|
229
232
|
break;
|
|
230
233
|
}
|
|
@@ -460,5 +463,121 @@ export class ValueDomainAnalyzer extends Plugin {
|
|
|
460
463
|
}
|
|
461
464
|
return null;
|
|
462
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* Resolve computed property names for object mutations.
|
|
468
|
+
* Finds FLOWS_INTO edges with mutationType: 'computed' and resolves
|
|
469
|
+
* the property name using value set tracing.
|
|
470
|
+
*
|
|
471
|
+
* @param graph - Graph backend with edge operations
|
|
472
|
+
* @returns Statistics about resolution
|
|
473
|
+
*/
|
|
474
|
+
async resolveComputedMutations(graph, logger) {
|
|
475
|
+
const stats = {
|
|
476
|
+
resolved: 0,
|
|
477
|
+
conditional: 0,
|
|
478
|
+
unknownParameter: 0,
|
|
479
|
+
unknownRuntime: 0,
|
|
480
|
+
deferredCrossFile: 0,
|
|
481
|
+
total: 0
|
|
482
|
+
};
|
|
483
|
+
// Process edges by finding all VARIABLE and CONSTANT nodes and checking their outgoing edges
|
|
484
|
+
const processedEdges = new Set();
|
|
485
|
+
// Helper to process a node's outgoing edges
|
|
486
|
+
const processNodeEdges = async (node) => {
|
|
487
|
+
const outgoing = await graph.getOutgoingEdges(node.id);
|
|
488
|
+
for (const edge of outgoing) {
|
|
489
|
+
const edgeType = edge.edgeType ||
|
|
490
|
+
edge.edge_type ||
|
|
491
|
+
edge.type;
|
|
492
|
+
if (edgeType !== 'FLOWS_INTO')
|
|
493
|
+
continue;
|
|
494
|
+
const edgeKey = `${edge.src}->${edge.dst}:FLOWS_INTO`;
|
|
495
|
+
if (processedEdges.has(edgeKey))
|
|
496
|
+
continue;
|
|
497
|
+
processedEdges.add(edgeKey);
|
|
498
|
+
const mutationType = edge.mutationType;
|
|
499
|
+
const computedPropertyVar = edge.computedPropertyVar;
|
|
500
|
+
if (mutationType !== 'computed' || !computedPropertyVar)
|
|
501
|
+
continue;
|
|
502
|
+
stats.total++;
|
|
503
|
+
// Get file from source node
|
|
504
|
+
const sourceNode = await graph.getNode(edge.src);
|
|
505
|
+
const file = sourceNode?.file;
|
|
506
|
+
if (!file)
|
|
507
|
+
continue;
|
|
508
|
+
// Resolve the computed property variable using existing getValueSet
|
|
509
|
+
const valueSet = await this.getValueSet(computedPropertyVar, file, graph);
|
|
510
|
+
// Check if the variable is a PARAMETER node
|
|
511
|
+
let isParameter = false;
|
|
512
|
+
for await (const node of graph.queryNodes({ nodeType: 'PARAMETER' })) {
|
|
513
|
+
const paramNode = node;
|
|
514
|
+
const nodeName = paramNode.name || paramNode.attrs?.name;
|
|
515
|
+
const nodeFile = paramNode.file || paramNode.attrs?.file;
|
|
516
|
+
if (nodeName === computedPropertyVar && nodeFile === file) {
|
|
517
|
+
isParameter = true;
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
// Determine resolution status based on value set
|
|
522
|
+
let resolutionStatus;
|
|
523
|
+
let resolvedPropertyNames = [];
|
|
524
|
+
if (valueSet.values.length === 0 && isParameter) {
|
|
525
|
+
// Variable is a function parameter - cannot be statically resolved
|
|
526
|
+
resolutionStatus = 'UNKNOWN_PARAMETER';
|
|
527
|
+
stats.unknownParameter++;
|
|
528
|
+
}
|
|
529
|
+
else if (valueSet.values.length === 0 && valueSet.hasUnknown) {
|
|
530
|
+
// Completely nondeterministic - runtime value (function call result, etc.)
|
|
531
|
+
resolutionStatus = 'UNKNOWN_RUNTIME';
|
|
532
|
+
stats.unknownRuntime++;
|
|
533
|
+
}
|
|
534
|
+
else if (valueSet.values.length === 0) {
|
|
535
|
+
// No values found at all - treat as unknown
|
|
536
|
+
resolutionStatus = 'UNKNOWN_RUNTIME';
|
|
537
|
+
stats.unknownRuntime++;
|
|
538
|
+
}
|
|
539
|
+
else if (valueSet.values.length === 1 && !valueSet.hasUnknown) {
|
|
540
|
+
// Single deterministic value
|
|
541
|
+
resolutionStatus = 'RESOLVED';
|
|
542
|
+
resolvedPropertyNames = valueSet.values.map(v => String(v));
|
|
543
|
+
stats.resolved++;
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
// Multiple values (conditional) or partial resolution
|
|
547
|
+
resolutionStatus = 'RESOLVED_CONDITIONAL';
|
|
548
|
+
resolvedPropertyNames = valueSet.values.map(v => String(v));
|
|
549
|
+
stats.conditional++;
|
|
550
|
+
}
|
|
551
|
+
// Update edge: delete old, create new with resolved data
|
|
552
|
+
// Following the same pattern as InstanceOfResolver
|
|
553
|
+
if (graph.deleteEdge) {
|
|
554
|
+
await graph.deleteEdge(edge.src, edge.dst, 'FLOWS_INTO');
|
|
555
|
+
}
|
|
556
|
+
// Preserve original edge data and add resolution info
|
|
557
|
+
// For UNKNOWN cases, keep propertyName as '<computed>' and resolvedPropertyNames empty
|
|
558
|
+
await graph.addEdge({
|
|
559
|
+
src: edge.src,
|
|
560
|
+
dst: edge.dst,
|
|
561
|
+
type: 'FLOWS_INTO',
|
|
562
|
+
metadata: {
|
|
563
|
+
mutationType,
|
|
564
|
+
propertyName: resolvedPropertyNames[0] || '<computed>',
|
|
565
|
+
computedPropertyVar,
|
|
566
|
+
resolvedPropertyNames,
|
|
567
|
+
resolutionStatus
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
// Process VARIABLE nodes
|
|
573
|
+
for await (const node of graph.queryNodes({ nodeType: 'VARIABLE' })) {
|
|
574
|
+
await processNodeEdges(node);
|
|
575
|
+
}
|
|
576
|
+
// Process CONSTANT nodes
|
|
577
|
+
for await (const node of graph.queryNodes({ nodeType: 'CONSTANT' })) {
|
|
578
|
+
await processNodeEdges(node);
|
|
579
|
+
}
|
|
580
|
+
return stats;
|
|
581
|
+
}
|
|
463
582
|
}
|
|
464
583
|
export default ValueDomainAnalyzer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncrementalModuleIndexer.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/IncrementalModuleIndexer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyBhF,qBAAa,wBAAyB,SAAQ,MAAM;IAClD,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IA0BrB;;OAEG;IACH,OAAO,CAAC,UAAU;IAuBlB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAqCd,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"IncrementalModuleIndexer.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/IncrementalModuleIndexer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,MAAM,EAA0C,MAAM,cAAc,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyBhF,qBAAa,wBAAyB,SAAQ,MAAM;IAClD,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IA0BrB;;OAEG;IACH,OAAO,CAAC,UAAU;IAuBlB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB;;OAEG;IACH,OAAO,CAAC,YAAY;IAqCd,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CAyI7D"}
|