@optave/codegraph 3.12.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 +83 -46
- 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/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +2 -1
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/batch.d.ts.map +1 -1
- package/dist/cli/commands/batch.js +1 -0
- package/dist/cli/commands/batch.js.map +1 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +6 -1
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +275 -0
- package/dist/cli/commands/config.js.map +1 -0
- 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/cli/commands/triage.js +1 -1
- package/dist/cli/commands/triage.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +10 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/shared/options.d.ts +2 -1
- package/dist/cli/shared/options.d.ts.map +1 -1
- package/dist/cli/shared/options.js +11 -1
- package/dist/cli/shared/options.js.map +1 -1
- package/dist/cli/types.d.ts +2 -0
- package/dist/cli/types.d.ts.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 +69 -1
- 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 +29 -13
- package/dist/domain/graph/builder/call-resolver.d.ts.map +1 -1
- package/dist/domain/graph/builder/call-resolver.js +125 -205
- package/dist/domain/graph/builder/call-resolver.js.map +1 -1
- package/dist/domain/graph/builder/cha.d.ts +9 -1
- package/dist/domain/graph/builder/cha.d.ts.map +1 -1
- package/dist/domain/graph/builder/cha.js +17 -2
- package/dist/domain/graph/builder/cha.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 +24 -1
- package/dist/domain/graph/builder/helpers.d.ts.map +1 -1
- package/dist/domain/graph/builder/helpers.js +174 -65
- 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 +46 -5
- package/dist/domain/graph/builder/pipeline.js.map +1 -1
- package/dist/domain/graph/builder/stages/build-edges.d.ts +0 -2
- package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/build-edges.js +554 -538
- 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 +3 -2
- package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -1
- package/dist/domain/graph/builder/stages/finalize.d.ts.map +1 -1
- package/dist/domain/graph/builder/stages/finalize.js +4 -0
- package/dist/domain/graph/builder/stages/finalize.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 +952 -343
- package/dist/domain/graph/builder/stages/native-orchestrator.js.map +1 -1
- package/dist/domain/graph/builder/stages/resolve-imports.js +1 -1
- package/dist/domain/graph/builder/stages/resolve-imports.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 +16 -5
- package/dist/domain/parser.d.ts.map +1 -1
- package/dist/domain/parser.js +58 -17
- 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 +13 -2
- 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 +26 -5
- package/dist/domain/wasm-worker-pool.js.map +1 -1
- package/dist/domain/wasm-worker-protocol.d.ts +8 -0
- package/dist/domain/wasm-worker-protocol.d.ts.map +1 -1
- package/dist/extractors/cpp.d.ts.map +1 -1
- package/dist/extractors/cpp.js +42 -1
- package/dist/extractors/cpp.js.map +1 -1
- package/dist/extractors/cuda.d.ts.map +1 -1
- package/dist/extractors/cuda.js +42 -1
- package/dist/extractors/cuda.js.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 +15 -2
- package/dist/extractors/helpers.d.ts.map +1 -1
- package/dist/extractors/helpers.js +45 -1
- package/dist/extractors/helpers.js.map +1 -1
- package/dist/extractors/java.d.ts.map +1 -1
- package/dist/extractors/java.js +85 -8
- package/dist/extractors/java.js.map +1 -1
- package/dist/extractors/javascript.d.ts.map +1 -1
- package/dist/extractors/javascript.js +686 -169
- 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-query.d.ts +1 -1
- package/dist/features/structure-query.d.ts.map +1 -1
- package/dist/features/structure-query.js +6 -6
- package/dist/features/structure-query.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/config.d.ts +87 -4
- package/dist/infrastructure/config.d.ts.map +1 -1
- package/dist/infrastructure/config.js +424 -22
- package/dist/infrastructure/config.js.map +1 -1
- package/dist/infrastructure/registry.d.ts +27 -7
- package/dist/infrastructure/registry.d.ts.map +1 -1
- package/dist/infrastructure/registry.js +79 -5
- 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/structure.d.ts +1 -1
- package/dist/presentation/structure.d.ts.map +1 -1
- package/dist/presentation/structure.js +2 -2
- package/dist/presentation/structure.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 +113 -1
- package/dist/types.d.ts.map +1 -1
- package/grammars/tree-sitter-erlang.wasm +0 -0
- package/grammars/tree-sitter-gleam.wasm +0 -0
- package/package.json +7 -8
- 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/audit.ts +2 -1
- package/src/cli/commands/batch.ts +1 -0
- package/src/cli/commands/build.ts +6 -1
- package/src/cli/commands/config.ts +353 -0
- package/src/cli/commands/roles.ts +6 -1
- package/src/cli/commands/triage.ts +1 -1
- package/src/cli/index.ts +10 -0
- package/src/cli/shared/options.ts +11 -1
- package/src/cli/types.ts +2 -0
- 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 +69 -1
- 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 +156 -218
- package/src/domain/graph/builder/cha.ts +18 -1
- package/src/domain/graph/builder/context.ts +1 -0
- package/src/domain/graph/builder/helpers.ts +205 -67
- package/src/domain/graph/builder/incremental.ts +249 -119
- package/src/domain/graph/builder/pipeline.ts +59 -6
- package/src/domain/graph/builder/stages/build-edges.ts +783 -652
- package/src/domain/graph/builder/stages/collect-files.ts +12 -6
- package/src/domain/graph/builder/stages/detect-changes.ts +4 -2
- package/src/domain/graph/builder/stages/finalize.ts +4 -0
- package/src/domain/graph/builder/stages/native-orchestrator.ts +1214 -398
- package/src/domain/graph/builder/stages/resolve-imports.ts +1 -1
- 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 +57 -16
- package/src/domain/queries.ts +1 -1
- package/src/domain/wasm-worker-entry.ts +13 -2
- package/src/domain/wasm-worker-pool.ts +29 -4
- package/src/domain/wasm-worker-protocol.ts +5 -0
- package/src/extractors/cpp.ts +44 -1
- package/src/extractors/cuda.ts +44 -1
- package/src/extractors/dart.ts +48 -3
- package/src/extractors/groovy.ts +62 -2
- package/src/extractors/helpers.ts +48 -2
- package/src/extractors/java.ts +88 -8
- package/src/extractors/javascript.ts +693 -167
- 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-query.ts +7 -7
- 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/index.ts +5 -1
- package/src/infrastructure/config.ts +511 -23
- package/src/infrastructure/registry.ts +117 -12
- 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/structure.ts +3 -3
- 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 +127 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
dynamicCallsData,
|
|
4
|
+
kindIcon,
|
|
5
|
+
moduleMapData,
|
|
6
|
+
rolesData,
|
|
7
|
+
statsData,
|
|
8
|
+
} from '../../domain/queries.js';
|
|
3
9
|
import { debug } from '../../infrastructure/logger.js';
|
|
4
10
|
import { outputResult } from '../../infrastructure/result-formatter.js';
|
|
5
11
|
import { toErrorMessage } from '../../shared/errors.js';
|
|
@@ -317,6 +323,34 @@ function printRoleGroup(role: string, symbols: RoleSymbol[]): void {
|
|
|
317
323
|
console.log();
|
|
318
324
|
}
|
|
319
325
|
|
|
326
|
+
export function dynamicCalls(customDbPath: string, opts: OutputOpts = {}): void {
|
|
327
|
+
const rows = dynamicCallsData(customDbPath);
|
|
328
|
+
if (opts.json || opts.ndjson) {
|
|
329
|
+
outputResult(
|
|
330
|
+
{ dynamic_calls: rows } as unknown as Record<string, unknown>,
|
|
331
|
+
'dynamic_calls',
|
|
332
|
+
opts,
|
|
333
|
+
);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (rows.length === 0) {
|
|
337
|
+
console.log(
|
|
338
|
+
'No flagged dynamic calls found. Run "codegraph build" first, or add JavaScript files with eval/computed-key patterns.',
|
|
339
|
+
);
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
console.log('\nFlagged dynamic calls (confidence=0.0 sink edges):\n');
|
|
343
|
+
const total = rows.reduce((s, r) => s + r.count, 0);
|
|
344
|
+
for (const { dynamic_kind, count } of rows) {
|
|
345
|
+
const bar = '█'.repeat(Math.min(30, Math.round((count / total) * 30)));
|
|
346
|
+
console.log(` ${dynamic_kind.padEnd(20)} ${String(count).padStart(5)} ${bar}`);
|
|
347
|
+
}
|
|
348
|
+
console.log(`\n Total flagged: ${total}\n`);
|
|
349
|
+
console.log(
|
|
350
|
+
' Kinds: eval — undecidable; computed-key — obj[var](); unresolved-dynamic — other\n',
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
320
354
|
export function roles(customDbPath: string, opts: OutputOpts = {}): void {
|
|
321
355
|
const data = rolesData(customDbPath, opts) as RolesData;
|
|
322
356
|
if (outputResult(data as unknown as Record<string, unknown>, 'symbols', opts)) return;
|
|
@@ -53,15 +53,15 @@ interface HotspotsResult {
|
|
|
53
53
|
metric: string;
|
|
54
54
|
level: string;
|
|
55
55
|
limit: number;
|
|
56
|
-
|
|
56
|
+
items: any[];
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function formatHotspots(data: HotspotsResult): string {
|
|
60
|
-
if (data.
|
|
60
|
+
if (data.items.length === 0) return 'No hotspots found. Run "codegraph build" first.';
|
|
61
61
|
|
|
62
62
|
const lines = [`\nHotspots by ${data.metric} (${data.level}-level, top ${data.limit}):\n`];
|
|
63
63
|
let rank = 1;
|
|
64
|
-
for (const h of data.
|
|
64
|
+
for (const h of data.items) {
|
|
65
65
|
const extra =
|
|
66
66
|
h.kind === 'directory'
|
|
67
67
|
? `${h.fileCount} files, cohesion=${h.cohesion !== null ? h.cohesion!.toFixed(2) : 'n/a'}`
|
|
@@ -150,80 +150,10 @@ export function buildLayoutOptions(cfg: PlotConfig): LayoutOptions {
|
|
|
150
150
|
return opts;
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
// ─── HTML
|
|
154
|
-
|
|
155
|
-
export interface ViewerNode {
|
|
156
|
-
id: number | string;
|
|
157
|
-
label: string;
|
|
158
|
-
kind: string;
|
|
159
|
-
file: string;
|
|
160
|
-
line: number;
|
|
161
|
-
role: string | null;
|
|
162
|
-
fanIn: number;
|
|
163
|
-
fanOut: number;
|
|
164
|
-
cognitive: number | null;
|
|
165
|
-
cyclomatic: number | null;
|
|
166
|
-
maintainabilityIndex: number | null;
|
|
167
|
-
community: number | null;
|
|
168
|
-
directory: string | null;
|
|
169
|
-
risk: string[];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface ViewerEdge {
|
|
173
|
-
id: number | string;
|
|
174
|
-
from: number | string;
|
|
175
|
-
to: number | string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface ViewerData {
|
|
179
|
-
nodes: ViewerNode[];
|
|
180
|
-
edges: ViewerEdge[];
|
|
181
|
-
seedNodeIds: (number | string)[];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
interface ResolvedPlotConfig {
|
|
185
|
-
layoutOpts: LayoutOptions;
|
|
186
|
-
title: string;
|
|
187
|
-
layoutAlgorithm: string;
|
|
188
|
-
layoutDirection: string;
|
|
189
|
-
physicsEnabled: boolean;
|
|
190
|
-
sizeBy: string;
|
|
191
|
-
clusterBy: string;
|
|
192
|
-
effectiveColorBy: string;
|
|
193
|
-
effectiveRisk: boolean;
|
|
194
|
-
}
|
|
153
|
+
// ─── HTML Section Renderers ──────────────────────────────────────────
|
|
195
154
|
|
|
196
|
-
function
|
|
197
|
-
return
|
|
198
|
-
layoutOpts: buildLayoutOptions(cfg),
|
|
199
|
-
title: cfg.title || 'Codegraph',
|
|
200
|
-
layoutAlgorithm: cfg.layout?.algorithm || 'hierarchical',
|
|
201
|
-
layoutDirection: cfg.layout?.direction || 'LR',
|
|
202
|
-
physicsEnabled: cfg.physics?.enabled !== false,
|
|
203
|
-
sizeBy: cfg.sizeBy || 'uniform',
|
|
204
|
-
clusterBy: cfg.clusterBy || 'none',
|
|
205
|
-
effectiveColorBy:
|
|
206
|
-
cfg.overlays?.complexity && cfg.colorBy === 'kind' ? 'complexity' : cfg.colorBy || 'kind',
|
|
207
|
-
effectiveRisk: cfg.overlays?.risk || false,
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export function renderPlotHTML(data: ViewerData, cfg: PlotConfig): string {
|
|
212
|
-
const {
|
|
213
|
-
layoutOpts,
|
|
214
|
-
title,
|
|
215
|
-
layoutAlgorithm,
|
|
216
|
-
layoutDirection,
|
|
217
|
-
physicsEnabled,
|
|
218
|
-
sizeBy,
|
|
219
|
-
clusterBy,
|
|
220
|
-
effectiveColorBy,
|
|
221
|
-
effectiveRisk,
|
|
222
|
-
} = resolvePlotConfig(cfg);
|
|
223
|
-
|
|
224
|
-
return `<!DOCTYPE html>
|
|
225
|
-
<html lang="en">
|
|
226
|
-
<head>
|
|
155
|
+
function renderViewerHead(title: string): string {
|
|
156
|
+
return `<head>
|
|
227
157
|
<meta charset="UTF-8">
|
|
228
158
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
229
159
|
<title>${escapeHtml(title)}</title>
|
|
@@ -257,9 +187,13 @@ export function renderPlotHTML(data: ViewerData, cfg: PlotConfig): string {
|
|
|
257
187
|
#legend div { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
|
|
258
188
|
#legend span.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
|
|
259
189
|
</style>
|
|
260
|
-
</head
|
|
261
|
-
|
|
262
|
-
|
|
190
|
+
</head>`;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function renderViewerControls(resolved: ResolvedPlotConfig): string {
|
|
194
|
+
const { layoutAlgorithm, physicsEnabled, effectiveColorBy, sizeBy, clusterBy, effectiveRisk } =
|
|
195
|
+
resolved;
|
|
196
|
+
return `<div id="controls">
|
|
263
197
|
<label>Layout:
|
|
264
198
|
<select id="layoutSelect">
|
|
265
199
|
<option value="hierarchical"${layoutAlgorithm === 'hierarchical' ? ' selected' : ''}>Hierarchical</option>
|
|
@@ -293,16 +227,16 @@ export function renderPlotHTML(data: ViewerData, cfg: PlotConfig): string {
|
|
|
293
227
|
</select>
|
|
294
228
|
</label>
|
|
295
229
|
<label>Risk: <input type="checkbox" id="riskToggle"${effectiveRisk ? ' checked' : ''}></label>
|
|
296
|
-
</div
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
230
|
+
</div>`;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function renderViewerScript(
|
|
234
|
+
data: ViewerData,
|
|
235
|
+
cfg: PlotConfig,
|
|
236
|
+
resolved: ResolvedPlotConfig,
|
|
237
|
+
): string {
|
|
238
|
+
const { layoutOpts, layoutDirection, clusterBy, effectiveColorBy } = resolved;
|
|
239
|
+
return `<script>
|
|
306
240
|
/* ── Data ──────────────────────────────────────────────────────────── */
|
|
307
241
|
var allNodes = ${JSON.stringify(data.nodes)};
|
|
308
242
|
var allEdges = ${JSON.stringify(data.edges)};
|
|
@@ -698,7 +632,84 @@ document.getElementById('detailClose').addEventListener('click', hideDetail);
|
|
|
698
632
|
refreshNodeAppearance();
|
|
699
633
|
updateLegend(${JSON.stringify(effectiveColorBy)});
|
|
700
634
|
${clusterBy !== 'none' ? `applyClusterBy(${JSON.stringify(clusterBy)});` : ''}
|
|
701
|
-
</script
|
|
635
|
+
</script>`;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// ─── HTML Renderer ───────────────────────────────────────────────────
|
|
639
|
+
|
|
640
|
+
export interface ViewerNode {
|
|
641
|
+
id: number | string;
|
|
642
|
+
label: string;
|
|
643
|
+
kind: string;
|
|
644
|
+
file: string;
|
|
645
|
+
line: number;
|
|
646
|
+
role: string | null;
|
|
647
|
+
fanIn: number;
|
|
648
|
+
fanOut: number;
|
|
649
|
+
cognitive: number | null;
|
|
650
|
+
cyclomatic: number | null;
|
|
651
|
+
maintainabilityIndex: number | null;
|
|
652
|
+
community: number | null;
|
|
653
|
+
directory: string | null;
|
|
654
|
+
risk: string[];
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export interface ViewerEdge {
|
|
658
|
+
id: number | string;
|
|
659
|
+
from: number | string;
|
|
660
|
+
to: number | string;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
export interface ViewerData {
|
|
664
|
+
nodes: ViewerNode[];
|
|
665
|
+
edges: ViewerEdge[];
|
|
666
|
+
seedNodeIds: (number | string)[];
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
interface ResolvedPlotConfig {
|
|
670
|
+
layoutOpts: LayoutOptions;
|
|
671
|
+
title: string;
|
|
672
|
+
layoutAlgorithm: string;
|
|
673
|
+
layoutDirection: string;
|
|
674
|
+
physicsEnabled: boolean;
|
|
675
|
+
sizeBy: string;
|
|
676
|
+
clusterBy: string;
|
|
677
|
+
effectiveColorBy: string;
|
|
678
|
+
effectiveRisk: boolean;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
function resolvePlotConfig(cfg: PlotConfig): ResolvedPlotConfig {
|
|
682
|
+
return {
|
|
683
|
+
layoutOpts: buildLayoutOptions(cfg),
|
|
684
|
+
title: cfg.title || 'Codegraph',
|
|
685
|
+
layoutAlgorithm: cfg.layout?.algorithm || 'hierarchical',
|
|
686
|
+
layoutDirection: cfg.layout?.direction || 'LR',
|
|
687
|
+
physicsEnabled: cfg.physics?.enabled !== false,
|
|
688
|
+
sizeBy: cfg.sizeBy || 'uniform',
|
|
689
|
+
clusterBy: cfg.clusterBy || 'none',
|
|
690
|
+
effectiveColorBy:
|
|
691
|
+
cfg.overlays?.complexity && cfg.colorBy === 'kind' ? 'complexity' : cfg.colorBy || 'kind',
|
|
692
|
+
effectiveRisk: cfg.overlays?.risk || false,
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
export function renderPlotHTML(data: ViewerData, cfg: PlotConfig): string {
|
|
697
|
+
const resolved = resolvePlotConfig(cfg);
|
|
698
|
+
const { title } = resolved;
|
|
699
|
+
return `<!DOCTYPE html>
|
|
700
|
+
<html lang="en">
|
|
701
|
+
${renderViewerHead(title)}
|
|
702
|
+
<body>
|
|
703
|
+
${renderViewerControls(resolved)}
|
|
704
|
+
<div id="main">
|
|
705
|
+
<div id="graph"></div>
|
|
706
|
+
<div id="detail">
|
|
707
|
+
<span id="detailClose">×</span>
|
|
708
|
+
<div id="detailContent"></div>
|
|
709
|
+
</div>
|
|
710
|
+
</div>
|
|
711
|
+
<div id="legend"></div>
|
|
712
|
+
${renderViewerScript(data, cfg, resolved)}
|
|
702
713
|
</body>
|
|
703
714
|
</html>`;
|
|
704
715
|
}
|
package/src/shared/constants.ts
CHANGED
|
@@ -34,8 +34,34 @@ export const IGNORE_DIRS: ArrayCompatSet<string> = withArrayCompat(
|
|
|
34
34
|
]),
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Merge the global IGNORE_DIRS set with a per-repo additional list from config.
|
|
39
|
+
* Returns a new Set — does not mutate IGNORE_DIRS.
|
|
40
|
+
*/
|
|
41
|
+
export function buildIgnoreSet(additionalDirs?: string[]): ReadonlySet<string> {
|
|
42
|
+
if (!additionalDirs || additionalDirs.length === 0) return IGNORE_DIRS;
|
|
43
|
+
return new Set([...IGNORE_DIRS, ...additionalDirs]);
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
export const EXTENSIONS: ArrayCompatSet<string> = withArrayCompat(new Set(SUPPORTED_EXTENSIONS));
|
|
38
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Minimum confidence assigned to resolved `ts-native` call edges.
|
|
50
|
+
*
|
|
51
|
+
* The native engine's proximity heuristic returns 0.3 for cross-module calls
|
|
52
|
+
* where no import-path evidence is available. For ts-native edges the engine
|
|
53
|
+
* performed actual name-based symbol lookup, which is stronger evidence than
|
|
54
|
+
* pure file-proximity. Clamping to 0.5 (same-parent-directory level) avoids
|
|
55
|
+
* unfairly dragging down the call-confidence metric. Sink edges
|
|
56
|
+
* (confidence = 0.0) are intentionally excluded and must remain at 0.0 so
|
|
57
|
+
* they stay below DEFAULT_MIN_CONFIDENCE and never surface in normal queries.
|
|
58
|
+
*
|
|
59
|
+
* Used in `build-edges.ts` (in-memory + `applyEdgeTechniquesAfterNativeInsert`)
|
|
60
|
+
* and `native-orchestrator.ts` (`backfillEdgeTechniquesAfterNativeOrchestrator`).
|
|
61
|
+
* Centralised here so all three insertion paths apply the same value.
|
|
62
|
+
*/
|
|
63
|
+
export const TS_NATIVE_CONFIDENCE_FLOOR = 0.5;
|
|
64
|
+
|
|
39
65
|
export function shouldIgnore(dirName: string): boolean {
|
|
40
66
|
return IGNORE_DIRS.has(dirName) || dirName.startsWith('.');
|
|
41
67
|
}
|
package/src/shared/normalize.ts
CHANGED
|
@@ -29,29 +29,20 @@ export function toSymbolRef(row: { name: string; kind: string; file: string; lin
|
|
|
29
29
|
return { name: row.name, kind: row.kind, file: row.file, line: row.line };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
const KIND_ICONS: Readonly<Record<string, string>> = {
|
|
33
|
+
function: 'f',
|
|
34
|
+
class: '*',
|
|
35
|
+
method: 'o',
|
|
36
|
+
file: '#',
|
|
37
|
+
interface: 'I',
|
|
38
|
+
type: 'T',
|
|
39
|
+
parameter: 'p',
|
|
40
|
+
property: '.',
|
|
41
|
+
constant: 'C',
|
|
42
|
+
};
|
|
43
|
+
|
|
32
44
|
export function kindIcon(kind: string): string {
|
|
33
|
-
|
|
34
|
-
case 'function':
|
|
35
|
-
return 'f';
|
|
36
|
-
case 'class':
|
|
37
|
-
return '*';
|
|
38
|
-
case 'method':
|
|
39
|
-
return 'o';
|
|
40
|
-
case 'file':
|
|
41
|
-
return '#';
|
|
42
|
-
case 'interface':
|
|
43
|
-
return 'I';
|
|
44
|
-
case 'type':
|
|
45
|
-
return 'T';
|
|
46
|
-
case 'parameter':
|
|
47
|
-
return 'p';
|
|
48
|
-
case 'property':
|
|
49
|
-
return '.';
|
|
50
|
-
case 'constant':
|
|
51
|
-
return 'C';
|
|
52
|
-
default:
|
|
53
|
-
return '-';
|
|
54
|
-
}
|
|
45
|
+
return KIND_ICONS[kind] ?? '-';
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
export interface NormalizedSymbol {
|
package/src/shared/paginate.ts
CHANGED
|
@@ -5,23 +5,9 @@
|
|
|
5
5
|
* change between pages; offset/limit is simpler and maps directly to SQL.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
total: number;
|
|
10
|
-
offset: number;
|
|
11
|
-
limit: number;
|
|
12
|
-
hasMore: boolean;
|
|
13
|
-
returned: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface PaginatedResult<T> {
|
|
17
|
-
items: T[];
|
|
18
|
-
pagination?: PaginationMeta;
|
|
19
|
-
}
|
|
8
|
+
import type { PaginatedItems, PaginationMeta, PaginationOpts } from '../types.js';
|
|
20
9
|
|
|
21
|
-
export
|
|
22
|
-
limit?: number;
|
|
23
|
-
offset?: number;
|
|
24
|
-
}
|
|
10
|
+
export type { PaginatedItems as PaginatedResult, PaginationMeta, PaginationOpts as PaginateOpts };
|
|
25
11
|
|
|
26
12
|
/** Default limits applied by MCP tool handlers (not by the programmatic API). */
|
|
27
13
|
export const MCP_DEFAULTS: Record<string, number> = {
|
|
@@ -65,7 +51,7 @@ export const MCP_MAX_LIMIT = 1000;
|
|
|
65
51
|
*
|
|
66
52
|
* When `limit` is undefined the input is returned unchanged (no-op).
|
|
67
53
|
*/
|
|
68
|
-
export function paginate<T>(items: T[], { limit, offset }:
|
|
54
|
+
export function paginate<T>(items: T[], { limit, offset }: PaginationOpts = {}): PaginatedItems<T> {
|
|
69
55
|
if (limit === undefined) {
|
|
70
56
|
return { items };
|
|
71
57
|
}
|
|
@@ -94,7 +80,7 @@ export function paginate<T>(items: T[], { limit, offset }: PaginateOpts = {}): P
|
|
|
94
80
|
export function paginateResult<T extends Record<string, unknown>>(
|
|
95
81
|
result: T,
|
|
96
82
|
field: string,
|
|
97
|
-
{ limit, offset }:
|
|
83
|
+
{ limit, offset }: PaginationOpts = {},
|
|
98
84
|
): T & { _pagination?: PaginationMeta } {
|
|
99
85
|
if (limit === undefined) {
|
|
100
86
|
return result;
|
package/src/types.ts
CHANGED
|
@@ -52,7 +52,13 @@ export type CoreEdgeKind =
|
|
|
52
52
|
export type StructuralEdgeKind = 'parameter_of' | 'receiver';
|
|
53
53
|
|
|
54
54
|
/** Dataflow-specific edge kinds. */
|
|
55
|
-
export type DataflowEdgeKind =
|
|
55
|
+
export type DataflowEdgeKind =
|
|
56
|
+
| 'flows_to'
|
|
57
|
+
| 'returns'
|
|
58
|
+
| 'mutates'
|
|
59
|
+
| 'def_use'
|
|
60
|
+
| 'arg_in'
|
|
61
|
+
| 'return_out';
|
|
56
62
|
|
|
57
63
|
/** All edge kinds that can appear in the graph. */
|
|
58
64
|
export type EdgeKind = CoreEdgeKind | StructuralEdgeKind;
|
|
@@ -180,6 +186,7 @@ export interface EdgeRow {
|
|
|
180
186
|
kind: EdgeKind;
|
|
181
187
|
confidence: number | null;
|
|
182
188
|
dynamic: 0 | 1;
|
|
189
|
+
dynamic_kind?: string | null;
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
/** Callee/caller node shape (from findCallees / findCallers). */
|
|
@@ -469,12 +476,27 @@ export interface LOCMetrics {
|
|
|
469
476
|
commentLines: number;
|
|
470
477
|
}
|
|
471
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Taxonomy for dynamic/computed call sites — distinguishes resolvable kinds
|
|
481
|
+
* (computed-literal, reflection) from flag-only kinds (eval, computed-key,
|
|
482
|
+
* unresolved-dynamic) that cannot be resolved statically.
|
|
483
|
+
*/
|
|
484
|
+
export type DynamicKind =
|
|
485
|
+
| 'computed-literal' // obj["foo"]() — resolvable; already emitted as normal edge
|
|
486
|
+
| 'computed-key' // obj[k]() — potentially resolvable via pts; else flagged
|
|
487
|
+
| 'reflection' // .call/.apply/.bind / Reflect.* / callable-ref — resolved when target is in codebase; sink edge emitted if unresolved
|
|
488
|
+
| 'eval' // eval() / new Function() — undecidable; always flagged
|
|
489
|
+
| 'unresolved-dynamic'; // any other detected dynamic pattern; flagged
|
|
490
|
+
|
|
472
491
|
/** A function/method call detected by an extractor. */
|
|
473
492
|
export interface Call {
|
|
474
493
|
name: string;
|
|
475
494
|
line: number;
|
|
476
495
|
receiver?: string;
|
|
477
496
|
dynamic?: boolean;
|
|
497
|
+
dynamicKind?: DynamicKind;
|
|
498
|
+
/** Raw key/arg text — used for diagnostics and future RES-1 const-string resolution. */
|
|
499
|
+
keyExpr?: string;
|
|
478
500
|
}
|
|
479
501
|
|
|
480
502
|
/** An import statement detected by an extractor. */
|
|
@@ -707,6 +729,14 @@ export interface ExtractorOutput {
|
|
|
707
729
|
* `definePropertyReceivers.set("getter", "obj")`.
|
|
708
730
|
*/
|
|
709
731
|
definePropertyReceivers?: Map<string, string>;
|
|
732
|
+
/**
|
|
733
|
+
* CJS require bindings from `const { X, Y } = require('./path')` patterns.
|
|
734
|
+
* Used by buildImportedNamesMap to classify X and Y as import artifacts so
|
|
735
|
+
* receiver-edge resolution falls back to the global class lookup rather than
|
|
736
|
+
* treating the destructured-binding function node as a local definition (#1661).
|
|
737
|
+
* Does NOT cause DB import edges — use `imports` for that.
|
|
738
|
+
*/
|
|
739
|
+
cjsRequireBindings?: Array<{ names: string[]; source: string }>;
|
|
710
740
|
/** WASM tree retained for downstream analysis (complexity, CFG, dataflow). */
|
|
711
741
|
_tree?: TreeSitterTree;
|
|
712
742
|
/** Language identifier. */
|
|
@@ -954,10 +984,14 @@ export interface CfgRulesConfig {
|
|
|
954
984
|
export interface DataflowRulesConfig {
|
|
955
985
|
functionNodes: Set<string>;
|
|
956
986
|
nameField: string;
|
|
987
|
+
/** Override for languages with nested function name structures (e.g. C/C++). */
|
|
988
|
+
nameExtractor: ((node: TreeSitterNode) => string | null) | null;
|
|
957
989
|
varAssignedFnParent: string | null;
|
|
958
990
|
assignmentFnParent: string | null;
|
|
959
991
|
pairFnParent: string | null;
|
|
960
992
|
paramListField: string;
|
|
993
|
+
/** Override for languages where the param list is nested (e.g. C: function_definition → declarator → parameters). */
|
|
994
|
+
getParamListNode: ((funcNode: TreeSitterNode) => TreeSitterNode | null) | null;
|
|
961
995
|
paramIdentifier: string;
|
|
962
996
|
paramWrapperTypes: Set<string>;
|
|
963
997
|
defaultParamType: string | null;
|
|
@@ -1018,6 +1052,20 @@ export interface CfgEdge {
|
|
|
1018
1052
|
label?: string;
|
|
1019
1053
|
}
|
|
1020
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* A dataflow vertex: an addressable data location within a function.
|
|
1057
|
+
* Populated during extraction (P1+); persisted to `dataflow_vertices`.
|
|
1058
|
+
*/
|
|
1059
|
+
export interface DataflowVertex {
|
|
1060
|
+
/** Name of the enclosing function (used to resolve func_id at insert time). */
|
|
1061
|
+
funcName: string;
|
|
1062
|
+
/** Vertex kind: 'param' | 'local' | 'return' | 'receiver'. */
|
|
1063
|
+
kind: 'param' | 'local' | 'return' | 'receiver';
|
|
1064
|
+
name?: string;
|
|
1065
|
+
paramIndex?: number;
|
|
1066
|
+
line?: number;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1021
1069
|
/** Dataflow extraction result. */
|
|
1022
1070
|
export interface DataflowResult {
|
|
1023
1071
|
parameters: DataflowParam[];
|
|
@@ -1254,6 +1302,20 @@ export interface BuildGraphOpts {
|
|
|
1254
1302
|
* `findDbPath` for every other DB-scoped command.
|
|
1255
1303
|
*/
|
|
1256
1304
|
dbPath?: string;
|
|
1305
|
+
/**
|
|
1306
|
+
* User-config override for this build (from --user-config / --no-user-config).
|
|
1307
|
+
* - false → --no-user-config: skip global layer for this run
|
|
1308
|
+
* - string → --user-config <path>: apply the given file
|
|
1309
|
+
* - true → --user-config (bare): apply the default global file
|
|
1310
|
+
* - undefined → honour per-repo consent from the registry (normal)
|
|
1311
|
+
*/
|
|
1312
|
+
userConfig?: string | boolean;
|
|
1313
|
+
/**
|
|
1314
|
+
* When true, an interactive consent prompt may fire on first build for
|
|
1315
|
+
* repos whose global-config consent is undecided. Only set by the CLI
|
|
1316
|
+
* build command when stdin/stdout are TTYs and CI is not set.
|
|
1317
|
+
*/
|
|
1318
|
+
promptForConsent?: boolean;
|
|
1257
1319
|
}
|
|
1258
1320
|
|
|
1259
1321
|
/** Build timing result from buildGraph. */
|
|
@@ -1268,8 +1330,16 @@ export interface BuildResult {
|
|
|
1268
1330
|
edgesMs: number;
|
|
1269
1331
|
structureMs: number;
|
|
1270
1332
|
rolesMs: number;
|
|
1333
|
+
/** Wall-clock time for the CHA expansion post-pass (native path only). */
|
|
1334
|
+
chaMs?: number;
|
|
1271
1335
|
/** Wall-clock time for the this/super dispatch WASM post-pass (native path only). */
|
|
1272
1336
|
thisDispatchMs?: number;
|
|
1337
|
+
/** Wall-clock time for the dropped-language gap detection + backfill (native path only). */
|
|
1338
|
+
gapDetectMs?: number;
|
|
1339
|
+
/** Wall-clock time for role re-classification after JS edge-writing post-passes (native path only). */
|
|
1340
|
+
reclassifyMs?: number;
|
|
1341
|
+
/** Wall-clock time for the technique-column backfill on native-written edges (native path only). */
|
|
1342
|
+
techniqueBackfillMs?: number;
|
|
1273
1343
|
astMs: number;
|
|
1274
1344
|
complexityMs: number;
|
|
1275
1345
|
cfgMs: number;
|
|
@@ -1289,6 +1359,8 @@ export interface CodegraphConfig {
|
|
|
1289
1359
|
include: string[];
|
|
1290
1360
|
exclude: string[];
|
|
1291
1361
|
ignoreDirs: string[];
|
|
1362
|
+
/** Additional directory names to ignore on top of the built-in IGNORE_DIRS set. */
|
|
1363
|
+
ignoreAdditionalDirs: string[];
|
|
1292
1364
|
extensions: string[];
|
|
1293
1365
|
aliases: Record<string, unknown>;
|
|
1294
1366
|
|
|
@@ -1305,6 +1377,26 @@ export interface CodegraphConfig {
|
|
|
1305
1377
|
* Default: false.
|
|
1306
1378
|
*/
|
|
1307
1379
|
typescriptResolver: boolean;
|
|
1380
|
+
/**
|
|
1381
|
+
* Engine selection override. Values: `'auto'` (default), `'native'`, `'wasm'`.
|
|
1382
|
+
*
|
|
1383
|
+
* **Current wiring (partial):** This field is populated by `applyEnvOverrides`
|
|
1384
|
+
* from `CODEGRAPH_ENGINE` env var — env var → `config.build.engine`. The
|
|
1385
|
+
* `--engine` CLI flag is also forwarded. However, `connection.ts` and
|
|
1386
|
+
* `pipeline.ts` still read `process.env.CODEGRAPH_ENGINE` / `ctx.opts.engine`
|
|
1387
|
+
* directly, so a value set only in `.codegraphrc.json` (not via env var or CLI)
|
|
1388
|
+
* is silently ignored by the pipeline.
|
|
1389
|
+
*
|
|
1390
|
+
* Full config-file wiring is tracked in issue #1596.
|
|
1391
|
+
*/
|
|
1392
|
+
engine: 'auto' | 'native' | 'wasm';
|
|
1393
|
+
/**
|
|
1394
|
+
* Enable diagnostic logging for the native fast-skip pre-flight check.
|
|
1395
|
+
* Equivalent to `CODEGRAPH_FAST_SKIP_DIAG=1`. When true, logs why the
|
|
1396
|
+
* fast-skip gate was skipped (e.g. forceFullRebuild, engineName mismatch).
|
|
1397
|
+
* Default: false.
|
|
1398
|
+
*/
|
|
1399
|
+
fastSkipDiag: boolean;
|
|
1308
1400
|
};
|
|
1309
1401
|
|
|
1310
1402
|
query: {
|
|
@@ -1383,6 +1475,13 @@ export interface CodegraphConfig {
|
|
|
1383
1475
|
* constant of 50. See TODO in `src/infrastructure/config.ts`.
|
|
1384
1476
|
*/
|
|
1385
1477
|
pointsToMaxIterations: number;
|
|
1478
|
+
/**
|
|
1479
|
+
* Confidence score for a return type inferred from `return new Constructor()`
|
|
1480
|
+
* with no explicit TypeScript annotation.
|
|
1481
|
+
* Mirrors `INFERRED_RETURN_TYPE_CONFIDENCE` in `src/extractors/javascript.ts`.
|
|
1482
|
+
* @reserved — not yet wired; see TODO in `src/infrastructure/config.ts`.
|
|
1483
|
+
*/
|
|
1484
|
+
typeInferenceConfidence: number;
|
|
1386
1485
|
};
|
|
1387
1486
|
|
|
1388
1487
|
community: {
|
|
@@ -1469,6 +1568,25 @@ export interface McpDefaults {
|
|
|
1469
1568
|
interfaces: number;
|
|
1470
1569
|
}
|
|
1471
1570
|
|
|
1571
|
+
/** Per-repo consent decision for the user-level global config. */
|
|
1572
|
+
export type ConsentDecision = 'enabled' | 'disabled';
|
|
1573
|
+
|
|
1574
|
+
/** Which layer contributed a resolved config value. */
|
|
1575
|
+
export type ConfigSource = 'default' | 'user' | 'project' | 'env';
|
|
1576
|
+
|
|
1577
|
+
/** Maps config key paths (dot notation) to the layer that supplied the value. */
|
|
1578
|
+
export type ConfigProvenance = Record<string, ConfigSource>;
|
|
1579
|
+
|
|
1580
|
+
/** Result of loadConfigWithProvenance. */
|
|
1581
|
+
export interface ConfigWithProvenance {
|
|
1582
|
+
config: CodegraphConfig;
|
|
1583
|
+
provenance: ConfigProvenance;
|
|
1584
|
+
/** Absolute path of the applied global file, or null if none was applied. */
|
|
1585
|
+
appliedGlobalPath: string | null;
|
|
1586
|
+
/** This repo's recorded consent decision (may be undefined if undecided). */
|
|
1587
|
+
consentDecision: ConsentDecision | undefined;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1472
1590
|
// ════════════════════════════════════════════════════════════════════════
|
|
1473
1591
|
// §12 Pagination
|
|
1474
1592
|
// ════════════════════════════════════════════════════════════════════════
|
|
@@ -2168,6 +2286,14 @@ export interface NativeAddon {
|
|
|
2168
2286
|
filePath: string,
|
|
2169
2287
|
langId?: string | null,
|
|
2170
2288
|
): DataflowResult | null;
|
|
2289
|
+
/**
|
|
2290
|
+
* Batch counterpart to {@link extractDataflowAnalysis}: read and analyse many
|
|
2291
|
+
* files in parallel (rayon) in a single NAPI call. Results are positional —
|
|
2292
|
+
* `null` where the file could not be read or has no dataflow rules. Optional:
|
|
2293
|
+
* older published addons predate this export, so callers must feature-detect
|
|
2294
|
+
* and fall back to per-file `extractDataflowAnalysis`.
|
|
2295
|
+
*/
|
|
2296
|
+
extractDataflowAnalysisBatch?(filePaths: string[]): (DataflowResult | null)[];
|
|
2171
2297
|
ParseTreeCache: new () => NativeParseTreeCache;
|
|
2172
2298
|
NativeDatabase: {
|
|
2173
2299
|
openReadWrite(dbPath: string): NativeDatabase;
|