@optave/codegraph 3.13.0 → 3.15.0
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 +35 -34
- package/dist/ast-analysis/engine.d.ts.map +1 -1
- package/dist/ast-analysis/engine.js +38 -40
- package/dist/ast-analysis/engine.js.map +1 -1
- package/dist/ast-analysis/rules/b2.d.ts +7 -0
- package/dist/ast-analysis/rules/b2.d.ts.map +1 -0
- package/dist/ast-analysis/rules/b2.js +240 -0
- package/dist/ast-analysis/rules/b2.js.map +1 -0
- package/dist/ast-analysis/rules/b3.d.ts +6 -0
- package/dist/ast-analysis/rules/b3.d.ts.map +1 -0
- package/dist/ast-analysis/rules/b3.js +105 -0
- package/dist/ast-analysis/rules/b3.js.map +1 -0
- package/dist/ast-analysis/rules/b4.d.ts +9 -0
- package/dist/ast-analysis/rules/b4.d.ts.map +1 -0
- package/dist/ast-analysis/rules/b4.js +361 -0
- package/dist/ast-analysis/rules/b4.js.map +1 -0
- package/dist/ast-analysis/rules/b5.d.ts +4 -0
- package/dist/ast-analysis/rules/b5.d.ts.map +1 -0
- package/dist/ast-analysis/rules/b5.js +52 -0
- package/dist/ast-analysis/rules/b5.js.map +1 -0
- package/dist/ast-analysis/rules/c.d.ts +4 -0
- package/dist/ast-analysis/rules/c.d.ts.map +1 -0
- package/dist/ast-analysis/rules/c.js +143 -0
- package/dist/ast-analysis/rules/c.js.map +1 -0
- package/dist/ast-analysis/rules/index.d.ts.map +1 -1
- package/dist/ast-analysis/rules/index.js +34 -0
- package/dist/ast-analysis/rules/index.js.map +1 -1
- package/dist/ast-analysis/rules/javascript.d.ts.map +1 -1
- package/dist/ast-analysis/rules/javascript.js +3 -0
- package/dist/ast-analysis/rules/javascript.js.map +1 -1
- package/dist/ast-analysis/shared.d.ts.map +1 -1
- package/dist/ast-analysis/shared.js +2 -0
- package/dist/ast-analysis/shared.js.map +1 -1
- package/dist/ast-analysis/visitor-utils.d.ts +1 -0
- package/dist/ast-analysis/visitor-utils.d.ts.map +1 -1
- package/dist/ast-analysis/visitor-utils.js +5 -0
- package/dist/ast-analysis/visitor-utils.js.map +1 -1
- package/dist/ast-analysis/visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitor.js +60 -47
- package/dist/ast-analysis/visitor.js.map +1 -1
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/cfg-visitor.js +126 -76
- package/dist/ast-analysis/visitors/cfg-visitor.js.map +1 -1
- package/dist/ast-analysis/visitors/complexity-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/complexity-visitor.js +27 -15
- package/dist/ast-analysis/visitors/complexity-visitor.js.map +1 -1
- package/dist/ast-analysis/visitors/dataflow-visitor.d.ts.map +1 -1
- package/dist/ast-analysis/visitors/dataflow-visitor.js +54 -21
- package/dist/ast-analysis/visitors/dataflow-visitor.js.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +137 -134
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/roles.d.ts.map +1 -1
- package/dist/cli/commands/roles.js +6 -1
- package/dist/cli/commands/roles.js.map +1 -1
- package/dist/db/better-sqlite3.d.ts +2 -1
- package/dist/db/better-sqlite3.d.ts.map +1 -1
- package/dist/db/better-sqlite3.js.map +1 -1
- package/dist/db/connection.d.ts +7 -1
- package/dist/db/connection.d.ts.map +1 -1
- package/dist/db/connection.js +20 -5
- package/dist/db/connection.js.map +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +68 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/repository/build-stmts.d.ts.map +1 -1
- package/dist/db/repository/build-stmts.js +18 -0
- package/dist/db/repository/build-stmts.js.map +1 -1
- package/dist/db/repository/dataflow.d.ts +5 -0
- package/dist/db/repository/dataflow.d.ts.map +1 -1
- package/dist/db/repository/dataflow.js +14 -0
- package/dist/db/repository/dataflow.js.map +1 -1
- package/dist/db/repository/index.d.ts +1 -1
- package/dist/db/repository/index.d.ts.map +1 -1
- package/dist/db/repository/index.js +1 -1
- package/dist/db/repository/index.js.map +1 -1
- package/dist/db/repository/native-repository.d.ts.map +1 -1
- package/dist/db/repository/native-repository.js +47 -34
- package/dist/db/repository/native-repository.js.map +1 -1
- package/dist/domain/analysis/context.d.ts +2 -2
- package/dist/domain/analysis/dependencies.d.ts +2 -2
- package/dist/domain/analysis/diff-impact.d.ts +2 -2
- package/dist/domain/analysis/fn-impact.d.ts +3 -1
- package/dist/domain/analysis/fn-impact.d.ts.map +1 -1
- package/dist/domain/analysis/fn-impact.js +4 -0
- package/dist/domain/analysis/fn-impact.js.map +1 -1
- package/dist/domain/analysis/implementations.d.ts +2 -2
- package/dist/domain/analysis/module-map.d.ts.map +1 -1
- package/dist/domain/analysis/module-map.js +32 -5
- package/dist/domain/analysis/module-map.js.map +1 -1
- package/dist/domain/analysis/roles.d.ts +7 -1
- package/dist/domain/analysis/roles.d.ts.map +1 -1
- package/dist/domain/analysis/roles.js +16 -0
- package/dist/domain/analysis/roles.js.map +1 -1
- package/dist/domain/analysis/symbol-lookup.d.ts +4 -4
- package/dist/domain/graph/builder/call-resolver.d.ts +17 -5
- package/dist/domain/graph/builder/call-resolver.d.ts.map +1 -1
- package/dist/domain/graph/builder/call-resolver.js +85 -220
- package/dist/domain/graph/builder/call-resolver.js.map +1 -1
- package/dist/domain/graph/builder/context.d.ts +1 -0
- package/dist/domain/graph/builder/context.d.ts.map +1 -1
- package/dist/domain/graph/builder/context.js.map +1 -1
- package/dist/domain/graph/builder/helpers.d.ts +16 -1
- package/dist/domain/graph/builder/helpers.d.ts.map +1 -1
- package/dist/domain/graph/builder/helpers.js +162 -72
- package/dist/domain/graph/builder/helpers.js.map +1 -1
- package/dist/domain/graph/builder/incremental.d.ts.map +1 -1
- package/dist/domain/graph/builder/incremental.js +166 -97
- package/dist/domain/graph/builder/incremental.js.map +1 -1
- package/dist/domain/graph/builder/pipeline.d.ts.map +1 -1
- package/dist/domain/graph/builder/pipeline.js +10 -4
- package/dist/domain/graph/builder/pipeline.js.map +1 -1
- package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/build-edges.js +496 -250
- package/dist/domain/graph/builder/stages/build-edges.js.map +1 -1
- package/dist/domain/graph/builder/stages/collect-files.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/collect-files.js +10 -7
- package/dist/domain/graph/builder/stages/collect-files.js.map +1 -1
- package/dist/domain/graph/builder/stages/detect-changes.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/detect-changes.js +2 -1
- package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -1
- package/dist/domain/graph/builder/stages/native-orchestrator.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/native-orchestrator.js +895 -545
- package/dist/domain/graph/builder/stages/native-orchestrator.js.map +1 -1
- package/dist/domain/graph/resolver/points-to.d.ts.map +1 -1
- package/dist/domain/graph/resolver/points-to.js +105 -57
- package/dist/domain/graph/resolver/points-to.js.map +1 -1
- package/dist/domain/graph/resolver/strategy.d.ts +61 -0
- package/dist/domain/graph/resolver/strategy.d.ts.map +1 -0
- package/dist/domain/graph/resolver/strategy.js +222 -0
- package/dist/domain/graph/resolver/strategy.js.map +1 -0
- package/dist/domain/graph/watcher.d.ts.map +1 -1
- package/dist/domain/graph/watcher.js +16 -9
- package/dist/domain/graph/watcher.js.map +1 -1
- package/dist/domain/parser.d.ts +12 -0
- package/dist/domain/parser.d.ts.map +1 -1
- package/dist/domain/parser.js +12 -2
- package/dist/domain/parser.js.map +1 -1
- package/dist/domain/queries.d.ts +1 -1
- package/dist/domain/queries.d.ts.map +1 -1
- package/dist/domain/queries.js +1 -1
- package/dist/domain/queries.js.map +1 -1
- package/dist/domain/wasm-worker-entry.js +3 -0
- package/dist/domain/wasm-worker-entry.js.map +1 -1
- package/dist/domain/wasm-worker-pool.d.ts.map +1 -1
- package/dist/domain/wasm-worker-pool.js +24 -5
- package/dist/domain/wasm-worker-pool.js.map +1 -1
- package/dist/domain/wasm-worker-protocol.d.ts +7 -0
- package/dist/domain/wasm-worker-protocol.d.ts.map +1 -1
- package/dist/extractors/dart.js +48 -3
- package/dist/extractors/dart.js.map +1 -1
- package/dist/extractors/groovy.js +62 -3
- package/dist/extractors/groovy.js.map +1 -1
- package/dist/extractors/helpers.d.ts +4 -2
- package/dist/extractors/helpers.d.ts.map +1 -1
- package/dist/extractors/helpers.js +5 -1
- package/dist/extractors/helpers.js.map +1 -1
- package/dist/extractors/java.js +77 -1
- package/dist/extractors/java.js.map +1 -1
- package/dist/extractors/javascript.d.ts.map +1 -1
- package/dist/extractors/javascript.js +549 -163
- package/dist/extractors/javascript.js.map +1 -1
- package/dist/extractors/kotlin.js +58 -3
- package/dist/extractors/kotlin.js.map +1 -1
- package/dist/extractors/objc.js +25 -2
- package/dist/extractors/objc.js.map +1 -1
- package/dist/extractors/scala.js +62 -2
- package/dist/extractors/scala.js.map +1 -1
- package/dist/extractors/swift.js +52 -3
- package/dist/extractors/swift.js.map +1 -1
- package/dist/features/audit.js +26 -23
- package/dist/features/audit.js.map +1 -1
- package/dist/features/boundaries.d.ts.map +1 -1
- package/dist/features/boundaries.js +12 -9
- package/dist/features/boundaries.js.map +1 -1
- package/dist/features/cfg.d.ts.map +1 -1
- package/dist/features/cfg.js +25 -18
- package/dist/features/cfg.js.map +1 -1
- package/dist/features/check.d.ts.map +1 -1
- package/dist/features/check.js +18 -5
- package/dist/features/check.js.map +1 -1
- package/dist/features/communities.d.ts +4 -2
- package/dist/features/communities.d.ts.map +1 -1
- package/dist/features/communities.js +6 -4
- package/dist/features/communities.js.map +1 -1
- package/dist/features/dataflow.d.ts +60 -0
- package/dist/features/dataflow.d.ts.map +1 -1
- package/dist/features/dataflow.js +530 -6
- package/dist/features/dataflow.js.map +1 -1
- package/dist/features/manifesto.d.ts.map +1 -1
- package/dist/features/manifesto.js +59 -72
- package/dist/features/manifesto.js.map +1 -1
- package/dist/features/sequence.d.ts.map +1 -1
- package/dist/features/sequence.js +27 -22
- package/dist/features/sequence.js.map +1 -1
- package/dist/features/snapshot.d.ts.map +1 -1
- package/dist/features/snapshot.js +36 -28
- package/dist/features/snapshot.js.map +1 -1
- package/dist/features/structure.d.ts.map +1 -1
- package/dist/features/structure.js +150 -62
- package/dist/features/structure.js.map +1 -1
- package/dist/features/triage.d.ts.map +1 -1
- package/dist/features/triage.js +18 -11
- package/dist/features/triage.js.map +1 -1
- package/dist/graph/algorithms/bfs.d.ts +1 -1
- package/dist/graph/algorithms/bfs.d.ts.map +1 -1
- package/dist/graph/algorithms/bfs.js +14 -13
- package/dist/graph/algorithms/bfs.js.map +1 -1
- package/dist/graph/algorithms/tarjan.d.ts.map +1 -1
- package/dist/graph/algorithms/tarjan.js +5 -0
- package/dist/graph/algorithms/tarjan.js.map +1 -1
- package/dist/graph/builders/dependency.js +28 -22
- package/dist/graph/builders/dependency.js.map +1 -1
- package/dist/graph/classifiers/roles.d.ts +10 -1
- package/dist/graph/classifiers/roles.d.ts.map +1 -1
- package/dist/graph/classifiers/roles.js +60 -6
- package/dist/graph/classifiers/roles.js.map +1 -1
- package/dist/infrastructure/config.d.ts +10 -0
- package/dist/infrastructure/config.d.ts.map +1 -1
- package/dist/infrastructure/config.js +31 -3
- package/dist/infrastructure/config.js.map +1 -1
- package/dist/infrastructure/registry.d.ts +0 -7
- package/dist/infrastructure/registry.d.ts.map +1 -1
- package/dist/infrastructure/registry.js +29 -13
- package/dist/infrastructure/registry.js.map +1 -1
- package/dist/infrastructure/update-check.d.ts.map +1 -1
- package/dist/infrastructure/update-check.js +49 -31
- package/dist/infrastructure/update-check.js.map +1 -1
- package/dist/mcp/server.d.ts +2 -10
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/ast-query.d.ts +1 -1
- package/dist/mcp/tools/ast-query.d.ts.map +1 -1
- package/dist/mcp/tools/audit.d.ts +1 -1
- package/dist/mcp/tools/audit.d.ts.map +1 -1
- package/dist/mcp/tools/batch-query.d.ts +1 -1
- package/dist/mcp/tools/batch-query.d.ts.map +1 -1
- package/dist/mcp/tools/branch-compare.d.ts +1 -1
- package/dist/mcp/tools/branch-compare.d.ts.map +1 -1
- package/dist/mcp/tools/brief.d.ts +1 -1
- package/dist/mcp/tools/brief.d.ts.map +1 -1
- package/dist/mcp/tools/cfg.d.ts +1 -1
- package/dist/mcp/tools/cfg.d.ts.map +1 -1
- package/dist/mcp/tools/check.d.ts +1 -1
- package/dist/mcp/tools/check.d.ts.map +1 -1
- package/dist/mcp/tools/co-changes.d.ts +1 -1
- package/dist/mcp/tools/co-changes.d.ts.map +1 -1
- package/dist/mcp/tools/code-owners.d.ts +1 -1
- package/dist/mcp/tools/code-owners.d.ts.map +1 -1
- package/dist/mcp/tools/communities.d.ts +1 -1
- package/dist/mcp/tools/communities.d.ts.map +1 -1
- package/dist/mcp/tools/complexity.d.ts +1 -1
- package/dist/mcp/tools/complexity.d.ts.map +1 -1
- package/dist/mcp/tools/context.d.ts +1 -1
- package/dist/mcp/tools/context.d.ts.map +1 -1
- package/dist/mcp/tools/dataflow.d.ts +1 -1
- package/dist/mcp/tools/dataflow.d.ts.map +1 -1
- package/dist/mcp/tools/diff-impact.d.ts +1 -1
- package/dist/mcp/tools/diff-impact.d.ts.map +1 -1
- package/dist/mcp/tools/execution-flow.d.ts +1 -1
- package/dist/mcp/tools/execution-flow.d.ts.map +1 -1
- package/dist/mcp/tools/export-graph.d.ts +1 -1
- package/dist/mcp/tools/export-graph.d.ts.map +1 -1
- package/dist/mcp/tools/file-deps.d.ts +1 -1
- package/dist/mcp/tools/file-deps.d.ts.map +1 -1
- package/dist/mcp/tools/file-exports.d.ts +1 -1
- package/dist/mcp/tools/file-exports.d.ts.map +1 -1
- package/dist/mcp/tools/find-cycles.d.ts +1 -1
- package/dist/mcp/tools/find-cycles.d.ts.map +1 -1
- package/dist/mcp/tools/fn-impact.d.ts +1 -1
- package/dist/mcp/tools/fn-impact.d.ts.map +1 -1
- package/dist/mcp/tools/impact-analysis.d.ts +1 -1
- package/dist/mcp/tools/impact-analysis.d.ts.map +1 -1
- package/dist/mcp/tools/implementations.d.ts +1 -1
- package/dist/mcp/tools/implementations.d.ts.map +1 -1
- package/dist/mcp/tools/index.d.ts +2 -5
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/interfaces.d.ts +1 -1
- package/dist/mcp/tools/interfaces.d.ts.map +1 -1
- package/dist/mcp/tools/list-functions.d.ts +1 -1
- package/dist/mcp/tools/list-functions.d.ts.map +1 -1
- package/dist/mcp/tools/list-repos.d.ts +1 -1
- package/dist/mcp/tools/list-repos.d.ts.map +1 -1
- package/dist/mcp/tools/module-map.d.ts +1 -1
- package/dist/mcp/tools/module-map.d.ts.map +1 -1
- package/dist/mcp/tools/node-roles.d.ts +1 -1
- package/dist/mcp/tools/node-roles.d.ts.map +1 -1
- package/dist/mcp/tools/path.d.ts +1 -1
- package/dist/mcp/tools/path.d.ts.map +1 -1
- package/dist/mcp/tools/query.d.ts +1 -1
- package/dist/mcp/tools/query.d.ts.map +1 -1
- package/dist/mcp/tools/semantic-search.d.ts +1 -1
- package/dist/mcp/tools/semantic-search.d.ts.map +1 -1
- package/dist/mcp/tools/sequence.d.ts +1 -1
- package/dist/mcp/tools/sequence.d.ts.map +1 -1
- package/dist/mcp/tools/structure.d.ts +1 -1
- package/dist/mcp/tools/structure.d.ts.map +1 -1
- package/dist/mcp/tools/symbol-children.d.ts +1 -1
- package/dist/mcp/tools/symbol-children.d.ts.map +1 -1
- package/dist/mcp/tools/triage.d.ts +1 -1
- package/dist/mcp/tools/triage.d.ts.map +1 -1
- package/dist/mcp/tools/where.d.ts +1 -1
- package/dist/mcp/tools/where.d.ts.map +1 -1
- package/dist/mcp/types.d.ts +19 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +6 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/presentation/queries-cli/index.d.ts +1 -1
- package/dist/presentation/queries-cli/index.d.ts.map +1 -1
- package/dist/presentation/queries-cli/index.js +1 -1
- package/dist/presentation/queries-cli/index.js.map +1 -1
- package/dist/presentation/queries-cli/overview.d.ts +1 -0
- package/dist/presentation/queries-cli/overview.d.ts.map +1 -1
- package/dist/presentation/queries-cli/overview.js +20 -1
- package/dist/presentation/queries-cli/overview.js.map +1 -1
- package/dist/presentation/queries-cli.d.ts +1 -1
- package/dist/presentation/queries-cli.d.ts.map +1 -1
- package/dist/presentation/queries-cli.js +1 -1
- package/dist/presentation/queries-cli.js.map +1 -1
- package/dist/presentation/viewer.d.ts.map +1 -1
- package/dist/presentation/viewer.js +45 -32
- package/dist/presentation/viewer.js.map +1 -1
- package/dist/shared/constants.d.ts +21 -0
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js +25 -0
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/normalize.d.ts.map +1 -1
- package/dist/shared/normalize.js +12 -22
- package/dist/shared/normalize.js.map +1 -1
- package/dist/shared/paginate.d.ts +4 -17
- package/dist/shared/paginate.d.ts.map +1 -1
- package/dist/shared/paginate.js.map +1 -1
- package/dist/types.d.ts +76 -1
- package/dist/types.d.ts.map +1 -1
- package/grammars/tree-sitter-erlang.wasm +0 -0
- package/package.json +7 -7
- package/src/ast-analysis/engine.ts +43 -63
- package/src/ast-analysis/rules/b2.ts +263 -0
- package/src/ast-analysis/rules/b3.ts +127 -0
- package/src/ast-analysis/rules/b4.ts +378 -0
- package/src/ast-analysis/rules/b5.ts +65 -0
- package/src/ast-analysis/rules/c.ts +157 -0
- package/src/ast-analysis/rules/index.ts +34 -0
- package/src/ast-analysis/rules/javascript.ts +3 -0
- package/src/ast-analysis/shared.ts +2 -0
- package/src/ast-analysis/visitor-utils.ts +5 -0
- package/src/ast-analysis/visitor.ts +82 -52
- package/src/ast-analysis/visitors/cfg-visitor.ts +198 -84
- package/src/ast-analysis/visitors/complexity-visitor.ts +44 -16
- package/src/ast-analysis/visitors/dataflow-visitor.ts +68 -29
- package/src/cli/commands/config.ts +184 -184
- package/src/cli/commands/roles.ts +6 -1
- package/src/db/better-sqlite3.ts +5 -4
- package/src/db/connection.ts +23 -5
- package/src/db/index.ts +1 -0
- package/src/db/migrations.ts +68 -0
- package/src/db/repository/build-stmts.ts +30 -0
- package/src/db/repository/dataflow.ts +16 -0
- package/src/db/repository/index.ts +1 -1
- package/src/db/repository/native-repository.ts +56 -40
- package/src/domain/analysis/fn-impact.ts +4 -0
- package/src/domain/analysis/module-map.ts +38 -6
- package/src/domain/analysis/roles.ts +23 -0
- package/src/domain/graph/builder/call-resolver.ts +112 -232
- package/src/domain/graph/builder/context.ts +1 -0
- package/src/domain/graph/builder/helpers.ts +190 -72
- package/src/domain/graph/builder/incremental.ts +249 -120
- package/src/domain/graph/builder/pipeline.ts +11 -5
- package/src/domain/graph/builder/stages/build-edges.ts +696 -296
- package/src/domain/graph/builder/stages/collect-files.ts +12 -6
- package/src/domain/graph/builder/stages/detect-changes.ts +3 -1
- package/src/domain/graph/builder/stages/native-orchestrator.ts +1102 -590
- package/src/domain/graph/resolver/points-to.ts +182 -59
- package/src/domain/graph/resolver/strategy.ts +265 -0
- package/src/domain/graph/watcher.ts +19 -9
- package/src/domain/parser.ts +12 -2
- package/src/domain/queries.ts +1 -1
- package/src/domain/wasm-worker-entry.ts +3 -0
- package/src/domain/wasm-worker-pool.ts +28 -4
- package/src/domain/wasm-worker-protocol.ts +4 -0
- package/src/extractors/dart.ts +48 -3
- package/src/extractors/groovy.ts +62 -2
- package/src/extractors/helpers.ts +5 -2
- package/src/extractors/java.ts +80 -1
- package/src/extractors/javascript.ts +566 -161
- package/src/extractors/kotlin.ts +57 -3
- package/src/extractors/objc.ts +25 -1
- package/src/extractors/scala.ts +63 -1
- package/src/extractors/swift.ts +46 -3
- package/src/features/audit.ts +43 -34
- package/src/features/boundaries.ts +17 -9
- package/src/features/cfg.ts +31 -22
- package/src/features/check.ts +21 -5
- package/src/features/communities.ts +28 -19
- package/src/features/dataflow.ts +755 -6
- package/src/features/manifesto.ts +76 -75
- package/src/features/sequence.ts +29 -23
- package/src/features/snapshot.ts +36 -25
- package/src/features/structure.ts +185 -55
- package/src/features/triage.ts +28 -15
- package/src/graph/algorithms/bfs.ts +13 -12
- package/src/graph/algorithms/tarjan.ts +5 -0
- package/src/graph/builders/dependency.ts +35 -23
- package/src/graph/classifiers/roles.ts +74 -7
- package/src/infrastructure/config.ts +32 -3
- package/src/infrastructure/registry.ts +44 -20
- package/src/infrastructure/update-check.ts +55 -33
- package/src/mcp/server.ts +2 -8
- package/src/mcp/tools/ast-query.ts +1 -1
- package/src/mcp/tools/audit.ts +1 -1
- package/src/mcp/tools/batch-query.ts +1 -1
- package/src/mcp/tools/branch-compare.ts +1 -1
- package/src/mcp/tools/brief.ts +1 -1
- package/src/mcp/tools/cfg.ts +1 -1
- package/src/mcp/tools/check.ts +1 -1
- package/src/mcp/tools/co-changes.ts +1 -1
- package/src/mcp/tools/code-owners.ts +1 -1
- package/src/mcp/tools/communities.ts +1 -1
- package/src/mcp/tools/complexity.ts +1 -1
- package/src/mcp/tools/context.ts +1 -1
- package/src/mcp/tools/dataflow.ts +1 -1
- package/src/mcp/tools/diff-impact.ts +1 -1
- package/src/mcp/tools/execution-flow.ts +1 -1
- package/src/mcp/tools/export-graph.ts +1 -1
- package/src/mcp/tools/file-deps.ts +1 -1
- package/src/mcp/tools/file-exports.ts +1 -1
- package/src/mcp/tools/find-cycles.ts +1 -1
- package/src/mcp/tools/fn-impact.ts +1 -1
- package/src/mcp/tools/impact-analysis.ts +1 -1
- package/src/mcp/tools/implementations.ts +1 -1
- package/src/mcp/tools/index.ts +2 -5
- package/src/mcp/tools/interfaces.ts +1 -1
- package/src/mcp/tools/list-functions.ts +1 -1
- package/src/mcp/tools/list-repos.ts +1 -1
- package/src/mcp/tools/module-map.ts +1 -1
- package/src/mcp/tools/node-roles.ts +1 -1
- package/src/mcp/tools/path.ts +1 -1
- package/src/mcp/tools/query.ts +1 -1
- package/src/mcp/tools/semantic-search.ts +1 -1
- package/src/mcp/tools/sequence.ts +1 -1
- package/src/mcp/tools/structure.ts +1 -1
- package/src/mcp/tools/symbol-children.ts +1 -1
- package/src/mcp/tools/triage.ts +1 -1
- package/src/mcp/tools/where.ts +1 -1
- package/src/mcp/types.ts +21 -0
- package/src/presentation/queries-cli/index.ts +1 -1
- package/src/presentation/queries-cli/overview.ts +35 -1
- package/src/presentation/queries-cli.ts +1 -0
- package/src/presentation/viewer.ts +98 -87
- package/src/shared/constants.ts +26 -0
- package/src/shared/normalize.ts +13 -22
- package/src/shared/paginate.ts +4 -18
- package/src/types.ts +86 -1
|
@@ -8,8 +8,8 @@ import fs from 'node:fs';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { purgeFilesData } from '../../../db/index.js';
|
|
10
10
|
import { debug, warn } from '../../../infrastructure/logger.js';
|
|
11
|
-
import {
|
|
12
|
-
import { compileGlobs, matchesAny } from '../../../shared/globs.js';
|
|
11
|
+
import { buildIgnoreSet, EXTENSIONS, normalizePath } from '../../../shared/constants.js';
|
|
12
|
+
import { compileGlobs, globToRegex, matchesAny } from '../../../shared/globs.js';
|
|
13
13
|
import type {
|
|
14
14
|
BetterSqlite3Database,
|
|
15
15
|
CodegraphConfig,
|
|
@@ -56,13 +56,12 @@ export const CHA_DISPATCH_PENALTY = 0.1;
|
|
|
56
56
|
export const CHA_TYPED_DISPATCH_CONFIDENCE = 0.8;
|
|
57
57
|
|
|
58
58
|
/** Check if a directory entry should be skipped (ignored dirs, dotfiles). */
|
|
59
|
-
function shouldSkipEntry(entry: fs.Dirent,
|
|
59
|
+
function shouldSkipEntry(entry: fs.Dirent, ignoreSet: ReadonlySet<string>): boolean {
|
|
60
60
|
if (entry.name.startsWith('.') && entry.name !== '.') {
|
|
61
|
-
if (
|
|
61
|
+
if (ignoreSet.has(entry.name)) return true;
|
|
62
62
|
if (entry.isDirectory()) return true;
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
if (extraIgnore?.has(entry.name)) return true;
|
|
64
|
+
if (ignoreSet.has(entry.name)) return true;
|
|
66
65
|
return false;
|
|
67
66
|
}
|
|
68
67
|
|
|
@@ -83,13 +82,65 @@ export function passesIncludeExclude(
|
|
|
83
82
|
return true;
|
|
84
83
|
}
|
|
85
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Parse the `.gitignore` file at the project root and return compiled regexes
|
|
87
|
+
* for each non-negated, non-comment pattern.
|
|
88
|
+
*
|
|
89
|
+
* Only the root-level `.gitignore` is read — nested `.gitignore` files and
|
|
90
|
+
* global gitignore are not consulted. This gives the WASM file-collection
|
|
91
|
+
* walker the same coarse gitignore respect that the Rust engine gets from the
|
|
92
|
+
* `ignore` crate's `git_ignore(true)` option, without requiring an additional
|
|
93
|
+
* npm dependency.
|
|
94
|
+
*
|
|
95
|
+
* Negation patterns (`!pattern`) are intentionally skipped — honoring them
|
|
96
|
+
* correctly requires ordered evaluation which is outside scope here. The Rust
|
|
97
|
+
* engine's `ignore` crate handles negation natively.
|
|
98
|
+
*/
|
|
99
|
+
export function readGitignorePatterns(rootDir: string): readonly RegExp[] {
|
|
100
|
+
const gitignorePath = path.join(rootDir, '.gitignore');
|
|
101
|
+
let contents: string;
|
|
102
|
+
try {
|
|
103
|
+
contents = fs.readFileSync(gitignorePath, 'utf-8');
|
|
104
|
+
} catch {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const regexes: RegExp[] = [];
|
|
109
|
+
for (const rawLine of contents.split(/\r?\n/)) {
|
|
110
|
+
const line = rawLine.trim();
|
|
111
|
+
// Skip empty lines, comments, and negation patterns
|
|
112
|
+
if (!line || line.startsWith('#') || line.startsWith('!')) continue;
|
|
113
|
+
// Strip trailing slash (directory indicator) — we match files by path regardless
|
|
114
|
+
const pattern = line.endsWith('/') ? line.slice(0, -1) : line;
|
|
115
|
+
try {
|
|
116
|
+
// If pattern contains no '/', it should match at any depth — prefix with `**/`.
|
|
117
|
+
// If pattern starts with '/', it is anchored to root — strip the leading slash.
|
|
118
|
+
// Otherwise use as-is (e.g. `crates/codegraph-core/index.js`).
|
|
119
|
+
let normalized: string;
|
|
120
|
+
if (pattern.startsWith('/')) {
|
|
121
|
+
normalized = pattern.slice(1);
|
|
122
|
+
} else if (!pattern.includes('/')) {
|
|
123
|
+
normalized = `**/${pattern}`;
|
|
124
|
+
} else {
|
|
125
|
+
normalized = pattern;
|
|
126
|
+
}
|
|
127
|
+
regexes.push(globToRegex(normalized));
|
|
128
|
+
} catch {
|
|
129
|
+
// Ignore patterns that don't compile (e.g. those with unsupported syntax)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return Object.freeze(regexes);
|
|
133
|
+
}
|
|
134
|
+
|
|
86
135
|
/** Per-walk state computed once at the top-level invocation. */
|
|
87
136
|
interface CollectContext {
|
|
88
137
|
readonly rootDir: string;
|
|
89
138
|
readonly includeRegexes: readonly RegExp[];
|
|
90
139
|
readonly excludeRegexes: readonly RegExp[];
|
|
140
|
+
readonly gitignoreRegexes: readonly RegExp[];
|
|
91
141
|
readonly hasGlobFilters: boolean;
|
|
92
|
-
|
|
142
|
+
/** Merged set of IGNORE_DIRS + config.ignoreDirs + config.ignoreAdditionalDirs. */
|
|
143
|
+
readonly ignoreSet: ReadonlySet<string>;
|
|
93
144
|
readonly visited: Set<string>;
|
|
94
145
|
}
|
|
95
146
|
|
|
@@ -122,8 +173,10 @@ function readDirSafe(dir: string): fs.Dirent[] | null {
|
|
|
122
173
|
/** True if `entry` is a source file we should collect under `ctx`. */
|
|
123
174
|
function isCollectableSourceFile(full: string, entry: fs.Dirent, ctx: CollectContext): boolean {
|
|
124
175
|
if (!EXTENSIONS.has(path.extname(entry.name))) return false;
|
|
125
|
-
if (!ctx.hasGlobFilters) return true;
|
|
126
176
|
const rel = normalizePath(path.relative(ctx.rootDir, full));
|
|
177
|
+
// Respect .gitignore patterns before applying include/exclude globs
|
|
178
|
+
if (ctx.gitignoreRegexes.length > 0 && matchesAny(ctx.gitignoreRegexes, rel)) return false;
|
|
179
|
+
if (!ctx.hasGlobFilters) return true;
|
|
127
180
|
return passesIncludeExclude(rel, ctx.includeRegexes, ctx.excludeRegexes);
|
|
128
181
|
}
|
|
129
182
|
|
|
@@ -140,7 +193,7 @@ function walkCollect(
|
|
|
140
193
|
|
|
141
194
|
let hasFiles = false;
|
|
142
195
|
for (const entry of entries) {
|
|
143
|
-
if (shouldSkipEntry(entry, ctx.
|
|
196
|
+
if (shouldSkipEntry(entry, ctx.ignoreSet)) continue;
|
|
144
197
|
|
|
145
198
|
const full = path.join(dir, entry.name);
|
|
146
199
|
if (entry.isDirectory()) {
|
|
@@ -183,12 +236,19 @@ export function collectFiles(
|
|
|
183
236
|
const trackDirs = directories instanceof Set;
|
|
184
237
|
const includeRegexes = compileGlobs(config.include);
|
|
185
238
|
const excludeRegexes = compileGlobs(config.exclude);
|
|
239
|
+
const gitignoreRegexes = readGitignorePatterns(dir);
|
|
240
|
+
// Build the merged ignore set:
|
|
241
|
+
// - config.ignoreDirs are appended to IGNORE_DIRS (existing behaviour: per-repo overrides)
|
|
242
|
+
// - config.ignoreAdditionalDirs are also merged in on top of IGNORE_DIRS (new feature)
|
|
243
|
+
const extraDirs = [...(config.ignoreDirs ?? []), ...(config.ignoreAdditionalDirs ?? [])];
|
|
244
|
+
const ignoreSet = buildIgnoreSet(extraDirs.length ? extraDirs : undefined);
|
|
186
245
|
const ctx: CollectContext = {
|
|
187
246
|
rootDir: dir,
|
|
188
247
|
includeRegexes,
|
|
189
248
|
excludeRegexes,
|
|
249
|
+
gitignoreRegexes,
|
|
190
250
|
hasGlobFilters: includeRegexes.length > 0 || excludeRegexes.length > 0,
|
|
191
|
-
|
|
251
|
+
ignoreSet,
|
|
192
252
|
visited: new Set(),
|
|
193
253
|
};
|
|
194
254
|
|
|
@@ -320,9 +380,9 @@ function getEdgeStmt(db: BetterSqlite3Database, chunkSize: number): SqliteStatem
|
|
|
320
380
|
}
|
|
321
381
|
let stmt = cache.get(chunkSize);
|
|
322
382
|
if (!stmt) {
|
|
323
|
-
const ph = '(
|
|
383
|
+
const ph = '(?,?,?,?,?,?,?)';
|
|
324
384
|
stmt = db.prepare(
|
|
325
|
-
'INSERT INTO edges (source_id,target_id,kind,confidence,dynamic,technique) VALUES ' +
|
|
385
|
+
'INSERT INTO edges (source_id,target_id,kind,confidence,dynamic,technique,dynamic_kind) VALUES ' +
|
|
326
386
|
Array.from({ length: chunkSize }, () => ph).join(','),
|
|
327
387
|
);
|
|
328
388
|
cache.set(chunkSize, stmt);
|
|
@@ -351,7 +411,7 @@ export function batchInsertNodes(db: BetterSqlite3Database, rows: unknown[][]):
|
|
|
351
411
|
|
|
352
412
|
/**
|
|
353
413
|
* Batch-insert edge rows via multi-value INSERT statements.
|
|
354
|
-
* Each row: [source_id, target_id, kind, confidence, dynamic, technique]
|
|
414
|
+
* Each row: [source_id, target_id, kind, confidence, dynamic, technique, dynamic_kind]
|
|
355
415
|
*/
|
|
356
416
|
export function batchInsertEdges(db: BetterSqlite3Database, rows: unknown[][]): void {
|
|
357
417
|
if (!rows.length) return;
|
|
@@ -362,7 +422,7 @@ export function batchInsertEdges(db: BetterSqlite3Database, rows: unknown[][]):
|
|
|
362
422
|
const vals: unknown[] = [];
|
|
363
423
|
for (let j = i; j < end; j++) {
|
|
364
424
|
const r = rows[j] as unknown[];
|
|
365
|
-
vals.push(r[0], r[1], r[2], r[3], r[4], r[5] ?? null);
|
|
425
|
+
vals.push(r[0], r[1], r[2], r[3], r[4], r[5] ?? null, r[6] ?? null);
|
|
366
426
|
}
|
|
367
427
|
stmt.run(...vals);
|
|
368
428
|
}
|
|
@@ -372,25 +432,16 @@ export function batchInsertEdges(db: BetterSqlite3Database, rows: unknown[][]):
|
|
|
372
432
|
export const CHA_DISPATCH_CONFIDENCE = 0.8;
|
|
373
433
|
|
|
374
434
|
/**
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
* Expands virtual-dispatch call edges for class hierarchies and interface
|
|
378
|
-
* implementations already present in the DB:
|
|
379
|
-
*
|
|
380
|
-
* 1. Build implementors map: parent/interface → [child/implementing class] from
|
|
381
|
-
* `extends` and `implements` edges.
|
|
382
|
-
* 2. Collect RTA evidence: class nodes that appear as `calls` targets (new X()).
|
|
383
|
-
* 3. Find all `calls` edges to qualified method nodes (name contains '.').
|
|
384
|
-
* 4. For each such call, expand to concrete overrides via the implementors map,
|
|
385
|
-
* filtered by RTA when evidence exists.
|
|
386
|
-
*
|
|
387
|
-
* Used by both the native orchestrator post-pass and the WASM build-edges pass.
|
|
435
|
+
* Build the parent→children implementor map from `extends`/`implements` edges.
|
|
436
|
+
* Returns null if no hierarchy edges exist.
|
|
388
437
|
*/
|
|
389
|
-
|
|
438
|
+
function buildImplementorMap(
|
|
439
|
+
db: BetterSqlite3Database,
|
|
440
|
+
): { implementors: Map<string, string[]>; implementorSets: Map<string, Set<string>> } | null {
|
|
390
441
|
const hasHierarchy = db
|
|
391
442
|
.prepare(`SELECT 1 FROM edges WHERE kind IN ('extends', 'implements') LIMIT 1`)
|
|
392
443
|
.get();
|
|
393
|
-
if (!hasHierarchy) return
|
|
444
|
+
if (!hasHierarchy) return null;
|
|
394
445
|
|
|
395
446
|
const hierarchyRows = db
|
|
396
447
|
.prepare(
|
|
@@ -411,11 +462,22 @@ export function runChaPostPass(db: BetterSqlite3Database): number {
|
|
|
411
462
|
}
|
|
412
463
|
set.add(row.child_name);
|
|
413
464
|
}
|
|
414
|
-
if (implementorSets.size === 0) return
|
|
415
|
-
|
|
465
|
+
if (implementorSets.size === 0) return null;
|
|
466
|
+
|
|
467
|
+
// Convert to arrays for iteration compatibility
|
|
416
468
|
const implementors = new Map([...implementorSets.entries()].map(([k, v]) => [k, [...v]]));
|
|
469
|
+
return { implementors, implementorSets };
|
|
470
|
+
}
|
|
417
471
|
|
|
418
|
-
|
|
472
|
+
/**
|
|
473
|
+
* Collect RTA (Rapid Type Analysis) evidence: class names instantiated via
|
|
474
|
+
* constructor calls (`new X()`). Falls back to constructor/function-kind nodes
|
|
475
|
+
* for languages that record constructor calls differently (e.g. TS via WASM).
|
|
476
|
+
*/
|
|
477
|
+
function collectRtaInstantiated(
|
|
478
|
+
db: BetterSqlite3Database,
|
|
479
|
+
implementorSets: Map<string, Set<string>>,
|
|
480
|
+
): Set<string> {
|
|
419
481
|
let rtaRows = db
|
|
420
482
|
.prepare(
|
|
421
483
|
`SELECT DISTINCT tgt.name
|
|
@@ -424,6 +486,7 @@ export function runChaPostPass(db: BetterSqlite3Database): number {
|
|
|
424
486
|
WHERE e.kind = 'calls' AND tgt.kind = 'class'`,
|
|
425
487
|
)
|
|
426
488
|
.all() as Array<{ name: string }>;
|
|
489
|
+
|
|
427
490
|
if (rtaRows.length === 0) {
|
|
428
491
|
// Fallback: some languages (e.g. TypeScript via WASM) record constructor calls as
|
|
429
492
|
// 'function' or 'constructor' kind rather than 'class'. Restrict to names that are
|
|
@@ -456,7 +519,89 @@ export function runChaPostPass(db: BetterSqlite3Database): number {
|
|
|
456
519
|
}
|
|
457
520
|
}
|
|
458
521
|
}
|
|
459
|
-
|
|
522
|
+
|
|
523
|
+
return new Set(rtaRows.map((r) => r.name));
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* BFS-expand a single call-to-qualified-method into CHA dispatch edges.
|
|
528
|
+
*
|
|
529
|
+
* For `source_id` calling `typeName.methodSuffix`, walks the implementors
|
|
530
|
+
* map (BFS) and emits an edge for each concrete override that passes the
|
|
531
|
+
* RTA filter. New edges are appended to `newEdges`; `seen` is updated in
|
|
532
|
+
* place to prevent duplicate insertions within the same pass.
|
|
533
|
+
*/
|
|
534
|
+
function expandChaCall(
|
|
535
|
+
sourceId: number,
|
|
536
|
+
typeName: string,
|
|
537
|
+
methodSuffix: string,
|
|
538
|
+
implementors: Map<string, string[]>,
|
|
539
|
+
instantiated: Set<string>,
|
|
540
|
+
noRtaEvidence: boolean,
|
|
541
|
+
findMethodStmt: { all(name: string): unknown[] },
|
|
542
|
+
seen: Set<string>,
|
|
543
|
+
newEdges: Array<[number, number, string, number, number, string]>,
|
|
544
|
+
): void {
|
|
545
|
+
// BFS over the implementors map — handles multi-level hierarchies where
|
|
546
|
+
// abstract/non-instantiated classes sit between the call-site type and
|
|
547
|
+
// the concrete leaf implementations (matches runPostNativeCha, issue #1311).
|
|
548
|
+
const bfsQueue: string[] = [typeName];
|
|
549
|
+
const bfsVisited = new Set<string>([typeName]);
|
|
550
|
+
while (bfsQueue.length > 0) {
|
|
551
|
+
const current = bfsQueue.shift()!;
|
|
552
|
+
const children = implementors.get(current);
|
|
553
|
+
if (!children?.length) continue;
|
|
554
|
+
|
|
555
|
+
for (const cls of children) {
|
|
556
|
+
if (bfsVisited.has(cls)) continue;
|
|
557
|
+
bfsVisited.add(cls);
|
|
558
|
+
|
|
559
|
+
if (noRtaEvidence || instantiated.has(cls)) {
|
|
560
|
+
const qualifiedName = `${cls}.${methodSuffix}`;
|
|
561
|
+
const methodNodes = findMethodStmt.all(qualifiedName) as Array<{ id: number }>;
|
|
562
|
+
for (const methodNode of methodNodes) {
|
|
563
|
+
if (methodNode.id === sourceId) continue; // skip self-loops
|
|
564
|
+
const key = `${sourceId}|${methodNode.id}`;
|
|
565
|
+
if (seen.has(key)) continue;
|
|
566
|
+
seen.add(key);
|
|
567
|
+
newEdges.push([
|
|
568
|
+
sourceId,
|
|
569
|
+
methodNode.id,
|
|
570
|
+
'calls',
|
|
571
|
+
CHA_TYPED_DISPATCH_CONFIDENCE,
|
|
572
|
+
0,
|
|
573
|
+
'cha-expanded',
|
|
574
|
+
]);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// Always traverse children — non-instantiated classes may have instantiated subclasses.
|
|
579
|
+
bfsQueue.push(cls);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* CHA (Class Hierarchy Analysis) post-pass.
|
|
586
|
+
*
|
|
587
|
+
* Expands virtual-dispatch call edges for class hierarchies and interface
|
|
588
|
+
* implementations already present in the DB:
|
|
589
|
+
*
|
|
590
|
+
* 1. Build implementors map: parent/interface → [child/implementing class] from
|
|
591
|
+
* `extends` and `implements` edges.
|
|
592
|
+
* 2. Collect RTA evidence: class nodes that appear as `calls` targets (new X()).
|
|
593
|
+
* 3. Find all `calls` edges to qualified method nodes (name contains '.').
|
|
594
|
+
* 4. For each such call, expand to concrete overrides via the implementors map,
|
|
595
|
+
* filtered by RTA when evidence exists.
|
|
596
|
+
*
|
|
597
|
+
* Used by both the native orchestrator post-pass and the WASM build-edges pass.
|
|
598
|
+
*/
|
|
599
|
+
export function runChaPostPass(db: BetterSqlite3Database): number {
|
|
600
|
+
const hierarchy = buildImplementorMap(db);
|
|
601
|
+
if (!hierarchy) return 0;
|
|
602
|
+
const { implementors, implementorSets } = hierarchy;
|
|
603
|
+
|
|
604
|
+
const instantiated = collectRtaInstantiated(db, implementorSets);
|
|
460
605
|
const noRtaEvidence = instantiated.size === 0;
|
|
461
606
|
if (noRtaEvidence) {
|
|
462
607
|
debug('runChaPostPass: no constructor-call evidence — proceeding without RTA filter');
|
|
@@ -474,11 +619,11 @@ export function runChaPostPass(db: BetterSqlite3Database): number {
|
|
|
474
619
|
)
|
|
475
620
|
.all() as Array<{ source_id: number; caller_name: string; method_name: string }>;
|
|
476
621
|
|
|
477
|
-
const seen = new Set<string>();
|
|
478
622
|
// Scope deduplication to only the source_ids we are about to expand, avoiding
|
|
479
623
|
// a full-table scan. CHA only inserts edges FROM callers that already call a
|
|
480
624
|
// qualified method (the source_ids in callToMethods), so we only need to
|
|
481
625
|
// check existing edges for those specific callers.
|
|
626
|
+
const seen = new Set<string>();
|
|
482
627
|
const callerIds = [...new Set(callToMethods.map((r) => r.source_id))];
|
|
483
628
|
if (callerIds.length > 0) {
|
|
484
629
|
// Chunk to stay within SQLite SQLITE_MAX_VARIABLE_NUMBER (999 in many builds).
|
|
@@ -504,44 +649,17 @@ export function runChaPostPass(db: BetterSqlite3Database): number {
|
|
|
504
649
|
if (dotIdx === -1) continue;
|
|
505
650
|
const typeName = method_name.slice(0, dotIdx);
|
|
506
651
|
const methodSuffix = method_name.slice(dotIdx + 1);
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
for (const cls of children) {
|
|
519
|
-
if (bfsVisited.has(cls)) continue;
|
|
520
|
-
bfsVisited.add(cls);
|
|
521
|
-
|
|
522
|
-
if (noRtaEvidence || instantiated.has(cls)) {
|
|
523
|
-
const qualifiedName = `${cls}.${methodSuffix}`;
|
|
524
|
-
const methodNodes = findMethodStmt.all(qualifiedName) as Array<{ id: number }>;
|
|
525
|
-
for (const methodNode of methodNodes) {
|
|
526
|
-
if (methodNode.id === source_id) continue; // skip self-loops
|
|
527
|
-
const key = `${source_id}|${methodNode.id}`;
|
|
528
|
-
if (seen.has(key)) continue;
|
|
529
|
-
seen.add(key);
|
|
530
|
-
newEdges.push([
|
|
531
|
-
source_id,
|
|
532
|
-
methodNode.id,
|
|
533
|
-
'calls',
|
|
534
|
-
CHA_TYPED_DISPATCH_CONFIDENCE,
|
|
535
|
-
0,
|
|
536
|
-
'cha-expanded',
|
|
537
|
-
]);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// Always traverse children — non-instantiated classes may have instantiated subclasses.
|
|
542
|
-
bfsQueue.push(cls);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
652
|
+
expandChaCall(
|
|
653
|
+
source_id,
|
|
654
|
+
typeName,
|
|
655
|
+
methodSuffix,
|
|
656
|
+
implementors,
|
|
657
|
+
instantiated,
|
|
658
|
+
noRtaEvidence,
|
|
659
|
+
findMethodStmt,
|
|
660
|
+
seen,
|
|
661
|
+
newEdges,
|
|
662
|
+
);
|
|
545
663
|
}
|
|
546
664
|
|
|
547
665
|
if (newEdges.length > 0) {
|