@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
|
@@ -119,11 +119,12 @@ export class IncrementalModuleIndexer extends Plugin {
|
|
|
119
119
|
return imports;
|
|
120
120
|
}
|
|
121
121
|
catch (err) {
|
|
122
|
-
|
|
122
|
+
// Parse error will be logged by execute() when it needs logger context
|
|
123
123
|
return [];
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
async execute(context) {
|
|
127
|
+
const logger = this.log(context);
|
|
127
128
|
try {
|
|
128
129
|
const { manifest, graph } = context;
|
|
129
130
|
// Cast manifest to expected shape
|
|
@@ -139,17 +140,18 @@ export class IncrementalModuleIndexer extends Plugin {
|
|
|
139
140
|
let edgesCreated = 0;
|
|
140
141
|
let totalImportsParsed = 0;
|
|
141
142
|
let unresolvedImports = 0;
|
|
142
|
-
|
|
143
|
+
logger.info('Starting incremental indexing', { entryFile: relative(projectPath, entryFile) });
|
|
143
144
|
while (queue.length > 0) {
|
|
144
145
|
const file = queue.shift();
|
|
145
146
|
if (processed.has(file))
|
|
146
147
|
continue;
|
|
147
148
|
processed.add(file);
|
|
148
|
-
// Create MODULE node
|
|
149
|
+
// Create MODULE node with semantic ID
|
|
149
150
|
const fileHash = this.calculateFileHash(file);
|
|
150
151
|
const relativePath = relative(projectPath, file);
|
|
152
|
+
const semanticId = `${relativePath}->global->MODULE->module`;
|
|
151
153
|
const moduleNode = {
|
|
152
|
-
id:
|
|
154
|
+
id: semanticId,
|
|
153
155
|
type: 'MODULE',
|
|
154
156
|
name: relativePath,
|
|
155
157
|
file: file,
|
|
@@ -169,10 +171,12 @@ export class IncrementalModuleIndexer extends Plugin {
|
|
|
169
171
|
const imports = this.parseImports(file, projectPath);
|
|
170
172
|
totalImportsParsed += imports.length;
|
|
171
173
|
for (const importFile of imports) {
|
|
172
|
-
// Store for later edge creation
|
|
174
|
+
// Store for later edge creation with semantic ID format
|
|
175
|
+
const importRelativePath = relative(projectPath, importFile);
|
|
176
|
+
const importSemanticId = `${importRelativePath}->global->MODULE->module`;
|
|
173
177
|
pendingImports.push({
|
|
174
178
|
src: moduleNode.id,
|
|
175
|
-
dst:
|
|
179
|
+
dst: importSemanticId
|
|
176
180
|
});
|
|
177
181
|
if (!processed.has(importFile)) {
|
|
178
182
|
queue.push(importFile);
|
|
@@ -209,13 +213,15 @@ export class IncrementalModuleIndexer extends Plugin {
|
|
|
209
213
|
// Ignore parse errors for unresolved count
|
|
210
214
|
}
|
|
211
215
|
if (processed.size % 10 === 0) {
|
|
212
|
-
|
|
216
|
+
logger.debug('Indexing progress', { indexed: processed.size, queueLength: queue.length });
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
+
logger.info('Modules indexed', { count: processed.size });
|
|
220
|
+
logger.debug('Import statistics', {
|
|
221
|
+
totalImportsParsed,
|
|
222
|
+
unresolvedImports,
|
|
223
|
+
pendingEdges: pendingImports.length
|
|
224
|
+
});
|
|
219
225
|
// Now create all IMPORTS edges after all MODULE nodes exist
|
|
220
226
|
for (const { src, dst } of pendingImports) {
|
|
221
227
|
await graph.addEdge({
|
|
@@ -226,12 +232,15 @@ export class IncrementalModuleIndexer extends Plugin {
|
|
|
226
232
|
});
|
|
227
233
|
edgesCreated++;
|
|
228
234
|
}
|
|
229
|
-
|
|
230
|
-
|
|
235
|
+
logger.info('Indexing complete', {
|
|
236
|
+
nodesCreated,
|
|
237
|
+
edgesCreated,
|
|
238
|
+
importsEdgesCreated: pendingImports.length
|
|
239
|
+
});
|
|
231
240
|
return createSuccessResult({ nodes: nodesCreated, edges: edgesCreated }, { filesScanned: processed.size });
|
|
232
241
|
}
|
|
233
242
|
catch (error) {
|
|
234
|
-
|
|
243
|
+
logger.error('Indexing failed', { error });
|
|
235
244
|
return createErrorResult(error);
|
|
236
245
|
}
|
|
237
246
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSModuleIndexer.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/JSModuleIndexer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"JSModuleIndexer.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/JSModuleIndexer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAgEhF,qBAAa,eAAgB,SAAQ,MAAM;IACzC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,YAAY,CAAW;IAC/B,OAAO,CAAC,aAAa,CAAU;;IAY/B;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAED,OAAO,CAAC,iBAAiB;IASzB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAuEnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBnB,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CAqM7D"}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Строит дерево зависимостей от entrypoint через DFS (как в file2host.js)
|
|
4
4
|
*/
|
|
5
5
|
import { readFileSync, existsSync } from 'fs';
|
|
6
|
-
import { join, resolve, dirname } from 'path';
|
|
6
|
+
import { join, resolve, dirname, relative, basename } from 'path';
|
|
7
7
|
import { createHash } from 'crypto';
|
|
8
|
-
import { Plugin,
|
|
8
|
+
import { Plugin, createErrorResult } from '../Plugin.js';
|
|
9
9
|
// @ts-expect-error - no type declarations for node-source-walk
|
|
10
10
|
import Walker from 'node-source-walk';
|
|
11
|
-
import {
|
|
11
|
+
import { LanguageError } from '../../errors/GrafemaError.js';
|
|
12
12
|
// Test file patterns (can be overridden in config)
|
|
13
13
|
const DEFAULT_TEST_PATTERNS = [
|
|
14
14
|
/[/\\]test[/\\]/, // /test/
|
|
@@ -27,7 +27,9 @@ export class JSModuleIndexer extends Plugin {
|
|
|
27
27
|
markTestFiles;
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
this.walker = new Walker(
|
|
30
|
+
this.walker = new Walker({
|
|
31
|
+
plugins: ['jsx', 'typescript']
|
|
32
|
+
});
|
|
31
33
|
this.cache = new Map(); // Кеш зависимостей файла
|
|
32
34
|
this.testPatterns = DEFAULT_TEST_PATTERNS;
|
|
33
35
|
this.markTestFiles = true; // Default: enabled
|
|
@@ -161,22 +163,25 @@ export class JSModuleIndexer extends Plugin {
|
|
|
161
163
|
return path;
|
|
162
164
|
}
|
|
163
165
|
async execute(context) {
|
|
166
|
+
const logger = this.log(context);
|
|
164
167
|
try {
|
|
165
168
|
const { graph, onProgress, config } = context;
|
|
166
169
|
const manifest = context.manifest;
|
|
167
170
|
const projectPath = manifest?.projectPath ?? '';
|
|
168
171
|
const service = manifest?.service ?? { id: '', name: '', path: '' };
|
|
172
|
+
// Collect parse errors to report (REG-147)
|
|
173
|
+
const parseErrors = [];
|
|
169
174
|
// Check config for test file marking
|
|
170
175
|
if (config?.analysis?.tests?.markTestFiles === false) {
|
|
171
176
|
this.markTestFiles = false;
|
|
172
177
|
}
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
// Use metadata.entrypoint if available (from config services), otherwise fall back to path
|
|
179
|
+
const entrypoint = service.metadata?.entrypoint || service.path;
|
|
175
180
|
// Резолвим entrypoint относительно projectPath
|
|
176
181
|
const absoluteEntrypoint = entrypoint.startsWith('/')
|
|
177
182
|
? entrypoint
|
|
178
183
|
: join(projectPath, entrypoint);
|
|
179
|
-
|
|
184
|
+
logger.info('Building dependency tree', { service: service.name });
|
|
180
185
|
// DFS через стек (как в file2host.js)
|
|
181
186
|
const visited = new Set();
|
|
182
187
|
const stack = [{ file: absoluteEntrypoint, depth: 0 }];
|
|
@@ -203,31 +208,44 @@ export class JSModuleIndexer extends Plugin {
|
|
|
203
208
|
});
|
|
204
209
|
lastProgressReport = visited.size;
|
|
205
210
|
}
|
|
206
|
-
|
|
211
|
+
logger.debug('Processing file', { file: currentFile.replace(projectPath, ''), depth });
|
|
207
212
|
if (depth > MAX_DEPTH) {
|
|
208
|
-
|
|
213
|
+
logger.warn('Max depth reached', { maxDepth: MAX_DEPTH, file: currentFile });
|
|
209
214
|
continue;
|
|
210
215
|
}
|
|
211
216
|
// Парсим зависимости
|
|
212
217
|
const deps = this.processFile(currentFile, projectPath);
|
|
213
|
-
|
|
218
|
+
logger.debug('Found dependencies', { file: currentFile.replace(projectPath, ''), count: deps instanceof Error ? 0 : deps.length });
|
|
214
219
|
if (deps instanceof Error) {
|
|
215
220
|
if (!deps.message.includes('ENOENT')) {
|
|
216
|
-
|
|
221
|
+
const relativePath = relative(projectPath, currentFile) || basename(currentFile);
|
|
222
|
+
const error = new LanguageError(`Failed to parse ${relativePath}: ${deps.message}`, 'ERR_PARSE_FAILURE', {
|
|
223
|
+
filePath: currentFile,
|
|
224
|
+
phase: 'INDEXING',
|
|
225
|
+
plugin: 'JSModuleIndexer',
|
|
226
|
+
}, 'Check file syntax or ensure the file is a supported JavaScript/TypeScript file');
|
|
227
|
+
parseErrors.push(error);
|
|
228
|
+
logger.debug('Parse error', { file: currentFile, error: deps.message });
|
|
217
229
|
}
|
|
218
230
|
continue;
|
|
219
231
|
}
|
|
220
|
-
// Создаём MODULE ноду для текущего файла
|
|
232
|
+
// Создаём MODULE ноду для текущего файла с semantic ID
|
|
221
233
|
const fileHash = this.calculateFileHash(currentFile);
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
//
|
|
234
|
+
const relativePath = relative(projectPath, currentFile) || basename(currentFile);
|
|
235
|
+
const semanticId = `${relativePath}->global->MODULE->module`;
|
|
236
|
+
// Construct MODULE node manually to preserve absolute file path for analyzers
|
|
225
237
|
const isTest = this.isTestFile(currentFile);
|
|
226
|
-
const moduleNode =
|
|
227
|
-
|
|
238
|
+
const moduleNode = {
|
|
239
|
+
id: semanticId,
|
|
240
|
+
type: 'MODULE',
|
|
241
|
+
name: relativePath,
|
|
242
|
+
file: currentFile, // Keep absolute path for file reading in analyzers
|
|
243
|
+
line: 0,
|
|
244
|
+
contentHash: fileHash || '',
|
|
228
245
|
isTest
|
|
229
|
-
}
|
|
230
|
-
|
|
246
|
+
};
|
|
247
|
+
const moduleId = moduleNode.id;
|
|
248
|
+
logger.debug('Creating MODULE node', { moduleId: moduleNode.id });
|
|
231
249
|
await graph.addNode(moduleNode);
|
|
232
250
|
nodesCreated++;
|
|
233
251
|
// Always create SERVICE -> CONTAINS -> MODULE edge (even if module exists)
|
|
@@ -241,23 +259,24 @@ export class JSModuleIndexer extends Plugin {
|
|
|
241
259
|
for (const dep of deps) {
|
|
242
260
|
if (dep.startsWith('package::')) {
|
|
243
261
|
// npm пакет - игнорируем пока
|
|
244
|
-
|
|
262
|
+
logger.debug('Skipping npm package', { package: dep });
|
|
245
263
|
continue;
|
|
246
264
|
}
|
|
247
265
|
const resolvedDep = this.resolveModulePath(dep);
|
|
248
|
-
|
|
266
|
+
logger.debug('Resolved dependency', { from: dep, to: resolvedDep.replace(projectPath, '') });
|
|
249
267
|
// Добавляем в стек если ещё не посещали
|
|
250
268
|
if (!visited.has(resolvedDep)) {
|
|
251
269
|
visited.add(resolvedDep);
|
|
252
270
|
stack.push({ file: resolvedDep, depth: depth + 1 });
|
|
253
|
-
|
|
271
|
+
logger.debug('Added to stack', { depth: depth + 1 });
|
|
254
272
|
}
|
|
255
273
|
else {
|
|
256
|
-
|
|
274
|
+
logger.debug('Already visited, skipping', { file: resolvedDep });
|
|
257
275
|
}
|
|
258
276
|
// Queue DEPENDS_ON edges for later (after all nodes exist)
|
|
259
|
-
|
|
260
|
-
const
|
|
277
|
+
// Use semantic ID format for dependency reference
|
|
278
|
+
const depRelativePath = relative(projectPath, resolvedDep) || basename(resolvedDep);
|
|
279
|
+
const depModuleId = `${depRelativePath}->global->MODULE->module`;
|
|
261
280
|
pendingDependsOnEdges.push({
|
|
262
281
|
src: moduleId,
|
|
263
282
|
dst: depModuleId,
|
|
@@ -273,9 +292,11 @@ export class JSModuleIndexer extends Plugin {
|
|
|
273
292
|
}
|
|
274
293
|
// Warning if hit MAX_MODULES limit
|
|
275
294
|
if (visited.size >= MAX_MODULES) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
295
|
+
logger.warn('Hit MAX_MODULES limit', {
|
|
296
|
+
service: service.name,
|
|
297
|
+
limit: MAX_MODULES,
|
|
298
|
+
unprocessedInStack: stack.length
|
|
299
|
+
});
|
|
279
300
|
}
|
|
280
301
|
// Final progress report
|
|
281
302
|
if (onProgress) {
|
|
@@ -288,11 +309,22 @@ export class JSModuleIndexer extends Plugin {
|
|
|
288
309
|
currentService: service.name
|
|
289
310
|
});
|
|
290
311
|
}
|
|
291
|
-
|
|
292
|
-
|
|
312
|
+
logger.info('Indexing complete', {
|
|
313
|
+
service: service.name,
|
|
314
|
+
modulesCreated: nodesCreated,
|
|
315
|
+
totalInTree: visited.size
|
|
316
|
+
});
|
|
317
|
+
// Return result with parse errors (REG-147)
|
|
318
|
+
return {
|
|
319
|
+
success: true,
|
|
320
|
+
created: { nodes: nodesCreated, edges: edgesCreated },
|
|
321
|
+
errors: parseErrors,
|
|
322
|
+
warnings: [],
|
|
323
|
+
metadata: { totalModules: visited.size },
|
|
324
|
+
};
|
|
293
325
|
}
|
|
294
326
|
catch (error) {
|
|
295
|
-
|
|
327
|
+
logger.error('Indexing failed', { error });
|
|
296
328
|
return createErrorResult(error);
|
|
297
329
|
}
|
|
298
330
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RustModuleIndexer.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/RustModuleIndexer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUhF,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,OAAO,CAAC,YAAY,CAAW;;IAO/B,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAED;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAyBrB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAclB,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"RustModuleIndexer.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/RustModuleIndexer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUhF,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,OAAO,CAAC,YAAY,CAAW;;IAO/B,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAED;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,OAAO,CAAC,aAAa;IAyBrB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAclB,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CAkE7D"}
|
|
@@ -84,6 +84,7 @@ export class RustModuleIndexer extends Plugin {
|
|
|
84
84
|
return name;
|
|
85
85
|
}
|
|
86
86
|
async execute(context) {
|
|
87
|
+
const logger = this.log(context);
|
|
87
88
|
const { manifest, graph, onProgress } = context;
|
|
88
89
|
// Cast manifest to expected shape
|
|
89
90
|
const typedManifest = manifest;
|
|
@@ -91,12 +92,12 @@ export class RustModuleIndexer extends Plugin {
|
|
|
91
92
|
// Find rust-engine/src directory
|
|
92
93
|
const rustRoot = resolve(projectPath, 'rust-engine/src');
|
|
93
94
|
if (!existsSync(rustRoot)) {
|
|
94
|
-
|
|
95
|
+
logger.info('rust-engine/src not found, skipping');
|
|
95
96
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true });
|
|
96
97
|
}
|
|
97
98
|
// Discover all .rs files recursively
|
|
98
99
|
const rsFiles = this.findRustFiles(rustRoot);
|
|
99
|
-
|
|
100
|
+
logger.info('Found Rust files', { count: rsFiles.length });
|
|
100
101
|
let nodesCreated = 0;
|
|
101
102
|
const errors = [];
|
|
102
103
|
for (const filePath of rsFiles) {
|
|
@@ -132,9 +133,9 @@ export class RustModuleIndexer extends Plugin {
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
if (errors.length > 0) {
|
|
135
|
-
|
|
136
|
+
logger.warn('Errors during indexing', { errorCount: errors.length });
|
|
136
137
|
}
|
|
137
|
-
|
|
138
|
+
logger.info('Rust modules indexed', { count: nodesCreated });
|
|
138
139
|
return createSuccessResult({ nodes: nodesCreated, edges: 0 }, { errors: errors.length });
|
|
139
140
|
}
|
|
140
141
|
}
|
|
@@ -15,6 +15,11 @@ interface DetectorContext {
|
|
|
15
15
|
graph: {
|
|
16
16
|
addNode(node: NodeRecord): Promise<void>;
|
|
17
17
|
};
|
|
18
|
+
logger?: {
|
|
19
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
20
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
21
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
22
|
+
};
|
|
18
23
|
}
|
|
19
24
|
export declare class ServiceDetector {
|
|
20
25
|
name: string;
|
|
@@ -39,6 +44,11 @@ export declare class ServiceDetector {
|
|
|
39
44
|
private createServiceFromDir;
|
|
40
45
|
/**
|
|
41
46
|
* Находит entry point сервиса
|
|
47
|
+
*
|
|
48
|
+
* Resolution priority:
|
|
49
|
+
* 1. TypeScript source (via resolveSourceEntrypoint)
|
|
50
|
+
* 2. package.json main field
|
|
51
|
+
* 3. Standard fallback candidates
|
|
42
52
|
*/
|
|
43
53
|
private findEntryPoint;
|
|
44
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceDetector.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/ServiceDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ServiceDetector.d.ts","sourceRoot":"","sources":["../../../src/plugins/indexing/ServiceDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,UAAU,eAAe;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QACL,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KAC1C,CAAC;IACF,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;KAC7D,CAAC;CACH;AAwBD,qBAAa,eAAe;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;;IAQjB;;OAEG;IACG,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IA+CjE;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgC3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwC5B;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;CAsCvB"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { readFileSync, existsSync, readdirSync, statSync } from 'fs';
|
|
10
10
|
import { join, basename } from 'path';
|
|
11
|
+
import { resolveSourceEntrypoint } from '../discovery/resolveSourceEntrypoint.js';
|
|
11
12
|
export class ServiceDetector {
|
|
12
13
|
name;
|
|
13
14
|
phase;
|
|
@@ -21,21 +22,21 @@ export class ServiceDetector {
|
|
|
21
22
|
* Анализирует проект и создаёт SERVICE ноды
|
|
22
23
|
*/
|
|
23
24
|
async analyze(context) {
|
|
24
|
-
const { projectPath, graph } = context;
|
|
25
|
+
const { projectPath, graph, logger } = context;
|
|
25
26
|
const services = [];
|
|
26
|
-
|
|
27
|
+
logger?.info('Detecting services', { projectPath });
|
|
27
28
|
// Паттерн 1: Монорепо структура (apps/, packages/, services/)
|
|
28
29
|
const monorepoPatterns = ['apps', 'packages', 'services'];
|
|
29
30
|
for (const pattern of monorepoPatterns) {
|
|
30
31
|
const monorepoDir = join(projectPath, pattern);
|
|
31
32
|
if (existsSync(monorepoDir)) {
|
|
32
|
-
const detected = this.detectServicesInDir(monorepoDir, projectPath);
|
|
33
|
+
const detected = this.detectServicesInDir(monorepoDir, projectPath, logger);
|
|
33
34
|
services.push(...detected);
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
// Паттерн 2: Корневой проект (если нет монорепо)
|
|
37
38
|
if (services.length === 0) {
|
|
38
|
-
const rootService = this.detectRootService(projectPath);
|
|
39
|
+
const rootService = this.detectRootService(projectPath, logger);
|
|
39
40
|
if (rootService) {
|
|
40
41
|
services.push(rootService);
|
|
41
42
|
}
|
|
@@ -54,14 +55,14 @@ export class ServiceDetector {
|
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
services.forEach(s =>
|
|
58
|
+
logger?.info('Services detected', { count: services.length });
|
|
59
|
+
services.forEach(s => logger?.debug('Service found', { name: s.name, path: s.path }));
|
|
59
60
|
return context;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Обнаруживает сервисы в директории монорепо
|
|
63
64
|
*/
|
|
64
|
-
detectServicesInDir(dir, projectPath) {
|
|
65
|
+
detectServicesInDir(dir, projectPath, logger) {
|
|
65
66
|
const services = [];
|
|
66
67
|
try {
|
|
67
68
|
const entries = readdirSync(dir);
|
|
@@ -75,7 +76,7 @@ export class ServiceDetector {
|
|
|
75
76
|
const packageJsonPath = join(fullPath, 'package.json');
|
|
76
77
|
const hasPackageJson = existsSync(packageJsonPath);
|
|
77
78
|
if (hasPackageJson) {
|
|
78
|
-
const service = this.createServiceFromDir(fullPath, entry, projectPath);
|
|
79
|
+
const service = this.createServiceFromDir(fullPath, entry, projectPath, logger);
|
|
79
80
|
if (service) {
|
|
80
81
|
services.push(service);
|
|
81
82
|
}
|
|
@@ -83,25 +84,25 @@ export class ServiceDetector {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
catch (error) {
|
|
86
|
-
|
|
87
|
+
logger?.warn('Error scanning directory', { dir, error: error.message });
|
|
87
88
|
}
|
|
88
89
|
return services;
|
|
89
90
|
}
|
|
90
91
|
/**
|
|
91
92
|
* Обнаруживает корневой сервис (не монорепо)
|
|
92
93
|
*/
|
|
93
|
-
detectRootService(projectPath) {
|
|
94
|
+
detectRootService(projectPath, logger) {
|
|
94
95
|
const packageJsonPath = join(projectPath, 'package.json');
|
|
95
96
|
if (!existsSync(packageJsonPath)) {
|
|
96
97
|
return null;
|
|
97
98
|
}
|
|
98
99
|
const projectName = basename(projectPath);
|
|
99
|
-
return this.createServiceFromDir(projectPath, projectName, projectPath);
|
|
100
|
+
return this.createServiceFromDir(projectPath, projectName, projectPath, logger);
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
102
103
|
* Создаёт объект сервиса из директории
|
|
103
104
|
*/
|
|
104
|
-
createServiceFromDir(servicePath, serviceName, projectPath) {
|
|
105
|
+
createServiceFromDir(servicePath, serviceName, projectPath, logger) {
|
|
105
106
|
try {
|
|
106
107
|
const packageJsonPath = join(servicePath, 'package.json');
|
|
107
108
|
let packageJson = null;
|
|
@@ -127,19 +128,31 @@ export class ServiceDetector {
|
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
catch (error) {
|
|
130
|
-
|
|
131
|
+
logger?.warn('Error creating service', { servicePath, error: error.message });
|
|
131
132
|
return null;
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
/**
|
|
135
136
|
* Находит entry point сервиса
|
|
137
|
+
*
|
|
138
|
+
* Resolution priority:
|
|
139
|
+
* 1. TypeScript source (via resolveSourceEntrypoint)
|
|
140
|
+
* 2. package.json main field
|
|
141
|
+
* 3. Standard fallback candidates
|
|
136
142
|
*/
|
|
137
143
|
findEntryPoint(servicePath, packageJson) {
|
|
138
|
-
// 1.
|
|
144
|
+
// 1. Try TypeScript source first (prefers src/ over dist/)
|
|
145
|
+
if (packageJson) {
|
|
146
|
+
const tsSource = resolveSourceEntrypoint(servicePath, packageJson);
|
|
147
|
+
if (tsSource) {
|
|
148
|
+
return tsSource;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// 2. Fallback to package.json main (for JS projects or when source not found)
|
|
139
152
|
if (packageJson?.main) {
|
|
140
153
|
return packageJson.main;
|
|
141
154
|
}
|
|
142
|
-
//
|
|
155
|
+
// 3. Standard fallback candidates
|
|
143
156
|
const candidates = [
|
|
144
157
|
'src/index.js',
|
|
145
158
|
'src/index.ts',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallResolverValidator.d.ts","sourceRoot":"","sources":["../../../src/plugins/validation/CallResolverValidator.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;AA2ChF,qBAAa,qBAAsB,SAAQ,MAAM;IAC/C,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"CallResolverValidator.d.ts","sourceRoot":"","sources":["../../../src/plugins/validation/CallResolverValidator.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;AA2ChF,qBAAa,qBAAsB,SAAQ,MAAM;IAC/C,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAwE5D;;OAEG;YACW,gBAAgB;CAyB/B"}
|
|
@@ -25,10 +25,11 @@ export class CallResolverValidator extends Plugin {
|
|
|
25
25
|
}
|
|
26
26
|
async execute(context) {
|
|
27
27
|
const { graph } = context;
|
|
28
|
-
|
|
28
|
+
const logger = this.log(context);
|
|
29
|
+
logger.info('Starting call resolution validation using Datalog');
|
|
29
30
|
// Check if graph supports checkGuarantee
|
|
30
31
|
if (!graph.checkGuarantee) {
|
|
31
|
-
|
|
32
|
+
logger.debug('Graph does not support checkGuarantee, skipping validation');
|
|
32
33
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true });
|
|
33
34
|
}
|
|
34
35
|
// Datalog гарантия:
|
|
@@ -38,7 +39,7 @@ export class CallResolverValidator extends Plugin {
|
|
|
38
39
|
`);
|
|
39
40
|
const issues = [];
|
|
40
41
|
if (violations.length > 0) {
|
|
41
|
-
|
|
42
|
+
logger.debug('Unresolved function calls found', { count: violations.length });
|
|
42
43
|
for (const v of violations) {
|
|
43
44
|
const nodeId = v.bindings.find(b => b.name === 'X')?.value;
|
|
44
45
|
if (nodeId) {
|
|
@@ -67,14 +68,14 @@ export class CallResolverValidator extends Plugin {
|
|
|
67
68
|
externalMethodCalls: methodCallStats.external,
|
|
68
69
|
issues: issues.length
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
+
logger.info('Validation complete', { ...summary });
|
|
71
72
|
if (issues.length > 0) {
|
|
72
|
-
|
|
73
|
+
logger.warn('Unresolved calls detected', { count: issues.length });
|
|
73
74
|
for (const issue of issues.slice(0, 10)) { // Show first 10
|
|
74
|
-
|
|
75
|
+
logger.warn(issue.message);
|
|
75
76
|
}
|
|
76
77
|
if (issues.length > 10) {
|
|
77
|
-
|
|
78
|
+
logger.debug(`... and ${issues.length - 10} more`);
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
return createSuccessResult({ nodes: 0, edges: 0 }, { summary, issues });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataFlowValidator.d.ts","sourceRoot":"","sources":["../../../src/plugins/validation/DataFlowValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA4ChF,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"DataFlowValidator.d.ts","sourceRoot":"","sources":["../../../src/plugins/validation/DataFlowValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA4ChF,qBAAa,iBAAkB,SAAQ,MAAM;IAC3C,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAsH5D;;OAEG;IACH,OAAO,CAAC,cAAc;CA2CvB"}
|
|
@@ -26,25 +26,26 @@ export class DataFlowValidator extends Plugin {
|
|
|
26
26
|
}
|
|
27
27
|
async execute(context) {
|
|
28
28
|
const { graph } = context;
|
|
29
|
-
|
|
29
|
+
const logger = this.log(context);
|
|
30
|
+
logger.info('Starting data flow validation');
|
|
30
31
|
// Check if graph supports getAllEdges
|
|
31
32
|
if (!graph.getAllEdges) {
|
|
32
|
-
|
|
33
|
+
logger.debug('Graph does not support getAllEdges, skipping validation');
|
|
33
34
|
return createSuccessResult({ nodes: 0, edges: 0 }, { skipped: true });
|
|
34
35
|
}
|
|
35
36
|
// Получаем все переменные
|
|
36
37
|
const allNodes = await graph.getAllNodes();
|
|
37
38
|
const allEdges = await graph.getAllEdges();
|
|
38
39
|
const variables = allNodes.filter(n => n.type === 'VARIABLE_DECLARATION' || n.type === 'CONSTANT');
|
|
39
|
-
|
|
40
|
+
logger.debug('Variables collected', { count: variables.length });
|
|
40
41
|
const issues = [];
|
|
41
42
|
const leafTypes = new Set([
|
|
42
43
|
'LITERAL',
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
44
|
+
'net:stdio',
|
|
45
|
+
'db:query',
|
|
46
|
+
'net:request',
|
|
47
|
+
'fs:operation',
|
|
48
|
+
'event:listener',
|
|
48
49
|
'CLASS', // NewExpression - конструкторы классов
|
|
49
50
|
'FUNCTION', // Arrow functions и function expressions
|
|
50
51
|
'METHOD_CALL', // Вызовы методов (промежуточные узлы)
|
|
@@ -104,13 +105,17 @@ export class DataFlowValidator extends Plugin {
|
|
|
104
105
|
}
|
|
105
106
|
summary.byType[issue.type]++;
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
+
logger.info('Validation complete', { ...summary });
|
|
108
109
|
// Выводим issues
|
|
109
110
|
if (issues.length > 0) {
|
|
110
|
-
|
|
111
|
+
logger.warn('Data flow issues found', { count: issues.length });
|
|
111
112
|
for (const issue of issues) {
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
if (issue.severity === 'ERROR') {
|
|
114
|
+
logger.error(`[${issue.type}] ${issue.message}`);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
logger.warn(`[${issue.type}] ${issue.message}`);
|
|
118
|
+
}
|
|
114
119
|
}
|
|
115
120
|
}
|
|
116
121
|
return createSuccessResult({ nodes: 0, edges: 0 }, { summary, issues });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EvalBanValidator.d.ts","sourceRoot":"","sources":["../../../src/plugins/validation/EvalBanValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoChF,qBAAa,gBAAiB,SAAQ,MAAM;IAC1C,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"EvalBanValidator.d.ts","sourceRoot":"","sources":["../../../src/plugins/validation/EvalBanValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAoChF,qBAAa,gBAAiB,SAAQ,MAAM;IAC1C,IAAI,QAAQ,IAAI,cAAc,CAU7B;IAEK,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;CA0G7D"}
|