optave-codegraph 3.13.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/LICENSE +190 -0
- package/README.md +984 -0
- package/dist/ast-analysis/engine.d.ts +19 -0
- package/dist/ast-analysis/engine.d.ts.map +1 -0
- package/dist/ast-analysis/engine.js +660 -0
- package/dist/ast-analysis/engine.js.map +1 -0
- package/dist/ast-analysis/metrics.d.ts +34 -0
- package/dist/ast-analysis/metrics.d.ts.map +1 -0
- package/dist/ast-analysis/metrics.js +123 -0
- package/dist/ast-analysis/metrics.js.map +1 -0
- 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/csharp.d.ts +7 -0
- package/dist/ast-analysis/rules/csharp.d.ts.map +1 -0
- package/dist/ast-analysis/rules/csharp.js +196 -0
- package/dist/ast-analysis/rules/csharp.js.map +1 -0
- package/dist/ast-analysis/rules/go.d.ts +7 -0
- package/dist/ast-analysis/rules/go.d.ts.map +1 -0
- package/dist/ast-analysis/rules/go.js +173 -0
- package/dist/ast-analysis/rules/go.js.map +1 -0
- package/dist/ast-analysis/rules/index.d.ts +13 -0
- package/dist/ast-analysis/rules/index.d.ts.map +1 -0
- package/dist/ast-analysis/rules/index.js +325 -0
- package/dist/ast-analysis/rules/index.js.map +1 -0
- package/dist/ast-analysis/rules/java.d.ts +7 -0
- package/dist/ast-analysis/rules/java.d.ts.map +1 -0
- package/dist/ast-analysis/rules/java.js +167 -0
- package/dist/ast-analysis/rules/java.js.map +1 -0
- package/dist/ast-analysis/rules/javascript.d.ts +7 -0
- package/dist/ast-analysis/rules/javascript.d.ts.map +1 -0
- package/dist/ast-analysis/rules/javascript.js +233 -0
- package/dist/ast-analysis/rules/javascript.js.map +1 -0
- package/dist/ast-analysis/rules/php.d.ts +7 -0
- package/dist/ast-analysis/rules/php.d.ts.map +1 -0
- package/dist/ast-analysis/rules/php.js +212 -0
- package/dist/ast-analysis/rules/php.js.map +1 -0
- package/dist/ast-analysis/rules/python.d.ts +7 -0
- package/dist/ast-analysis/rules/python.d.ts.map +1 -0
- package/dist/ast-analysis/rules/python.js +189 -0
- package/dist/ast-analysis/rules/python.js.map +1 -0
- package/dist/ast-analysis/rules/ruby.d.ts +7 -0
- package/dist/ast-analysis/rules/ruby.d.ts.map +1 -0
- package/dist/ast-analysis/rules/ruby.js +193 -0
- package/dist/ast-analysis/rules/ruby.js.map +1 -0
- package/dist/ast-analysis/rules/rust.d.ts +7 -0
- package/dist/ast-analysis/rules/rust.d.ts.map +1 -0
- package/dist/ast-analysis/rules/rust.js +166 -0
- package/dist/ast-analysis/rules/rust.js.map +1 -0
- package/dist/ast-analysis/shared.d.ts +12 -0
- package/dist/ast-analysis/shared.d.ts.map +1 -0
- package/dist/ast-analysis/shared.js +166 -0
- package/dist/ast-analysis/shared.js.map +1 -0
- package/dist/ast-analysis/visitor-utils.d.ts +70 -0
- package/dist/ast-analysis/visitor-utils.d.ts.map +1 -0
- package/dist/ast-analysis/visitor-utils.js +235 -0
- package/dist/ast-analysis/visitor-utils.js.map +1 -0
- package/dist/ast-analysis/visitor.d.ts +27 -0
- package/dist/ast-analysis/visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitor.js +178 -0
- package/dist/ast-analysis/visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.d.ts +4 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.js +288 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.d.ts +5 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.js +166 -0
- package/dist/ast-analysis/visitors/cfg-conditionals.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-loops.d.ts +7 -0
- package/dist/ast-analysis/visitors/cfg-loops.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-loops.js +73 -0
- package/dist/ast-analysis/visitors/cfg-loops.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-shared.d.ts +56 -0
- package/dist/ast-analysis/visitors/cfg-shared.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-shared.js +107 -0
- package/dist/ast-analysis/visitors/cfg-shared.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.d.ts +4 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.js +100 -0
- package/dist/ast-analysis/visitors/cfg-try-catch.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts +5 -0
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-visitor.js +231 -0
- package/dist/ast-analysis/visitors/cfg-visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/complexity-visitor.d.ts +8 -0
- package/dist/ast-analysis/visitors/complexity-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/complexity-visitor.js +233 -0
- package/dist/ast-analysis/visitors/complexity-visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.d.ts +5 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.js +378 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.js.map +1 -0
- package/dist/cli/commands/ast.d.ts +3 -0
- package/dist/cli/commands/ast.d.ts.map +1 -0
- package/dist/cli/commands/ast.js +23 -0
- package/dist/cli/commands/ast.js.map +1 -0
- package/dist/cli/commands/audit.d.ts +3 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +47 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/batch.d.ts +3 -0
- package/dist/cli/commands/batch.d.ts.map +1 -0
- package/dist/cli/commands/batch.js +66 -0
- package/dist/cli/commands/batch.js.map +1 -0
- package/dist/cli/commands/branch-compare.d.ts +3 -0
- package/dist/cli/commands/branch-compare.d.ts.map +1 -0
- package/dist/cli/commands/branch-compare.js +26 -0
- package/dist/cli/commands/branch-compare.js.map +1 -0
- package/dist/cli/commands/brief.d.ts +3 -0
- package/dist/cli/commands/brief.d.ts.map +1 -0
- package/dist/cli/commands/brief.js +12 -0
- package/dist/cli/commands/brief.js.map +1 -0
- package/dist/cli/commands/build.d.ts +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +33 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/cfg.d.ts +3 -0
- package/dist/cli/commands/cfg.d.ts.map +1 -0
- package/dist/cli/commands/cfg.js +27 -0
- package/dist/cli/commands/cfg.js.map +1 -0
- package/dist/cli/commands/check.d.ts +3 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +65 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/children.d.ts +3 -0
- package/dist/cli/commands/children.d.ts.map +1 -0
- package/dist/cli/commands/children.js +33 -0
- package/dist/cli/commands/children.js.map +1 -0
- package/dist/cli/commands/co-change.d.ts +3 -0
- package/dist/cli/commands/co-change.d.ts.map +1 -0
- package/dist/cli/commands/co-change.js +66 -0
- package/dist/cli/commands/co-change.js.map +1 -0
- package/dist/cli/commands/communities.d.ts +3 -0
- package/dist/cli/commands/communities.d.ts.map +1 -0
- package/dist/cli/commands/communities.js +20 -0
- package/dist/cli/commands/communities.js.map +1 -0
- package/dist/cli/commands/complexity.d.ts +3 -0
- package/dist/cli/commands/complexity.d.ts.map +1 -0
- package/dist/cli/commands/complexity.js +47 -0
- package/dist/cli/commands/complexity.js.map +1 -0
- 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/context.d.ts +3 -0
- package/dist/cli/commands/context.d.ts.map +1 -0
- package/dist/cli/commands/context.js +35 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/cycles.d.ts +3 -0
- package/dist/cli/commands/cycles.d.ts.map +1 -0
- package/dist/cli/commands/cycles.js +33 -0
- package/dist/cli/commands/cycles.js.map +1 -0
- package/dist/cli/commands/dataflow.d.ts +3 -0
- package/dist/cli/commands/dataflow.d.ts.map +1 -0
- package/dist/cli/commands/dataflow.js +29 -0
- package/dist/cli/commands/dataflow.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +3 -0
- package/dist/cli/commands/deps.d.ts.map +1 -0
- package/dist/cli/commands/deps.js +18 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/diff-impact.d.ts +3 -0
- package/dist/cli/commands/diff-impact.d.ts.map +1 -0
- package/dist/cli/commands/diff-impact.js +29 -0
- package/dist/cli/commands/diff-impact.js.map +1 -0
- package/dist/cli/commands/embed.d.ts +3 -0
- package/dist/cli/commands/embed.d.ts.map +1 -0
- package/dist/cli/commands/embed.js +75 -0
- package/dist/cli/commands/embed.js.map +1 -0
- package/dist/cli/commands/export.d.ts +3 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +72 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/exports.d.ts +3 -0
- package/dist/cli/commands/exports.d.ts.map +1 -0
- package/dist/cli/commands/exports.js +14 -0
- package/dist/cli/commands/exports.js.map +1 -0
- package/dist/cli/commands/flow.d.ts +3 -0
- package/dist/cli/commands/flow.d.ts.map +1 -0
- package/dist/cli/commands/flow.js +32 -0
- package/dist/cli/commands/flow.js.map +1 -0
- package/dist/cli/commands/fn-impact.d.ts +3 -0
- package/dist/cli/commands/fn-impact.d.ts.map +1 -0
- package/dist/cli/commands/fn-impact.js +33 -0
- package/dist/cli/commands/fn-impact.js.map +1 -0
- package/dist/cli/commands/impact.d.ts +3 -0
- package/dist/cli/commands/impact.d.ts.map +1 -0
- package/dist/cli/commands/impact.js +12 -0
- package/dist/cli/commands/impact.js.map +1 -0
- package/dist/cli/commands/implementations.d.ts +3 -0
- package/dist/cli/commands/implementations.d.ts.map +1 -0
- package/dist/cli/commands/implementations.js +29 -0
- package/dist/cli/commands/implementations.js.map +1 -0
- package/dist/cli/commands/info.d.ts +3 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +67 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/interfaces.d.ts +3 -0
- package/dist/cli/commands/interfaces.d.ts.map +1 -0
- package/dist/cli/commands/interfaces.js +29 -0
- package/dist/cli/commands/interfaces.js.map +1 -0
- package/dist/cli/commands/map.d.ts +3 -0
- package/dist/cli/commands/map.d.ts.map +1 -0
- package/dist/cli/commands/map.js +19 -0
- package/dist/cli/commands/map.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +3 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +18 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/models.d.ts +3 -0
- package/dist/cli/commands/models.d.ts.map +1 -0
- package/dist/cli/commands/models.js +19 -0
- package/dist/cli/commands/models.js.map +1 -0
- package/dist/cli/commands/owners.d.ts +3 -0
- package/dist/cli/commands/owners.d.ts.map +1 -0
- package/dist/cli/commands/owners.js +27 -0
- package/dist/cli/commands/owners.js.map +1 -0
- package/dist/cli/commands/path.d.ts +3 -0
- package/dist/cli/commands/path.d.ts.map +1 -0
- package/dist/cli/commands/path.js +41 -0
- package/dist/cli/commands/path.js.map +1 -0
- package/dist/cli/commands/plot.d.ts +3 -0
- package/dist/cli/commands/plot.d.ts.map +1 -0
- package/dist/cli/commands/plot.js +96 -0
- package/dist/cli/commands/plot.js.map +1 -0
- package/dist/cli/commands/query.d.ts +3 -0
- package/dist/cli/commands/query.d.ts.map +1 -0
- package/dist/cli/commands/query.js +51 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/commands/registry.d.ts +3 -0
- package/dist/cli/commands/registry.d.ts.map +1 -0
- package/dist/cli/commands/registry.js +95 -0
- package/dist/cli/commands/registry.js.map +1 -0
- package/dist/cli/commands/roles.d.ts +3 -0
- package/dist/cli/commands/roles.d.ts.map +1 -0
- package/dist/cli/commands/roles.js +36 -0
- package/dist/cli/commands/roles.js.map +1 -0
- package/dist/cli/commands/search.d.ts +3 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +43 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/sequence.d.ts +3 -0
- package/dist/cli/commands/sequence.d.ts.map +1 -0
- package/dist/cli/commands/sequence.js +29 -0
- package/dist/cli/commands/sequence.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +3 -0
- package/dist/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/snapshot.js +61 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +3 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +15 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/commands/structure.d.ts +3 -0
- package/dist/cli/commands/structure.d.ts.map +1 -0
- package/dist/cli/commands/structure.js +50 -0
- package/dist/cli/commands/structure.js.map +1 -0
- package/dist/cli/commands/triage.d.ts +3 -0
- package/dist/cli/commands/triage.d.ts.map +1 -0
- package/dist/cli/commands/triage.js +89 -0
- package/dist/cli/commands/triage.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +3 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +28 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/commands/where.d.ts +3 -0
- package/dist/cli/commands/where.d.ts.map +1 -0
- package/dist/cli/commands/where.js +20 -0
- package/dist/cli/commands/where.js.map +1 -0
- package/dist/cli/index.d.ts +22 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +139 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/shared/open-graph.d.ts +11 -0
- package/dist/cli/shared/open-graph.d.ts.map +1 -0
- package/dist/cli/shared/open-graph.js +9 -0
- package/dist/cli/shared/open-graph.js.map +1 -0
- package/dist/cli/shared/options.d.ts +25 -0
- package/dist/cli/shared/options.d.ts.map +1 -0
- package/dist/cli/shared/options.js +66 -0
- package/dist/cli/shared/options.js.map +1 -0
- package/dist/cli/shared/output.d.ts +2 -0
- package/dist/cli/shared/output.d.ts.map +1 -0
- package/dist/cli/shared/output.js +2 -0
- package/dist/cli/shared/output.js.map +1 -0
- package/dist/cli/types.d.ts +32 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +38 -0
- package/dist/cli.js.map +1 -0
- package/dist/db/better-sqlite3.d.ts +4 -0
- package/dist/db/better-sqlite3.d.ts.map +1 -0
- package/dist/db/better-sqlite3.js +19 -0
- package/dist/db/better-sqlite3.js.map +1 -0
- package/dist/db/connection.d.ts +82 -0
- package/dist/db/connection.d.ts.map +1 -0
- package/dist/db/connection.js +444 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +6 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations.d.ts +11 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +416 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/query-builder.d.ts +88 -0
- package/dist/db/query-builder.d.ts.map +1 -0
- package/dist/db/query-builder.js +321 -0
- package/dist/db/query-builder.js.map +1 -0
- package/dist/db/repository/base.d.ts +103 -0
- package/dist/db/repository/base.d.ts.map +1 -0
- package/dist/db/repository/base.js +172 -0
- package/dist/db/repository/base.js.map +1 -0
- package/dist/db/repository/build-stmts.d.ts +16 -0
- package/dist/db/repository/build-stmts.d.ts.map +1 -0
- package/dist/db/repository/build-stmts.js +76 -0
- package/dist/db/repository/build-stmts.js.map +1 -0
- package/dist/db/repository/cached-stmt.d.ts +9 -0
- package/dist/db/repository/cached-stmt.d.ts.map +1 -0
- package/dist/db/repository/cached-stmt.js +15 -0
- package/dist/db/repository/cached-stmt.js.map +1 -0
- package/dist/db/repository/cfg.d.ts +34 -0
- package/dist/db/repository/cfg.d.ts.map +1 -0
- package/dist/db/repository/cfg.js +46 -0
- package/dist/db/repository/cfg.js.map +1 -0
- package/dist/db/repository/cochange.d.ts +14 -0
- package/dist/db/repository/cochange.d.ts.map +1 -0
- package/dist/db/repository/cochange.js +38 -0
- package/dist/db/repository/cochange.js.map +1 -0
- package/dist/db/repository/complexity.d.ts +7 -0
- package/dist/db/repository/complexity.d.ts.map +1 -0
- package/dist/db/repository/complexity.js +12 -0
- package/dist/db/repository/complexity.js.map +1 -0
- package/dist/db/repository/dataflow.d.ts +11 -0
- package/dist/db/repository/dataflow.d.ts.map +1 -0
- package/dist/db/repository/dataflow.js +30 -0
- package/dist/db/repository/dataflow.js.map +1 -0
- package/dist/db/repository/edges.d.ts +66 -0
- package/dist/db/repository/edges.d.ts.map +1 -0
- package/dist/db/repository/edges.js +175 -0
- package/dist/db/repository/edges.js.map +1 -0
- package/dist/db/repository/embeddings.d.ts +14 -0
- package/dist/db/repository/embeddings.d.ts.map +1 -0
- package/dist/db/repository/embeddings.js +40 -0
- package/dist/db/repository/embeddings.js.map +1 -0
- package/dist/db/repository/graph-read.d.ts +18 -0
- package/dist/db/repository/graph-read.d.ts.map +1 -0
- package/dist/db/repository/graph-read.js +33 -0
- package/dist/db/repository/graph-read.js.map +1 -0
- package/dist/db/repository/in-memory-repository.d.ts +88 -0
- package/dist/db/repository/in-memory-repository.d.ts.map +1 -0
- package/dist/db/repository/in-memory-repository.js +541 -0
- package/dist/db/repository/in-memory-repository.js.map +1 -0
- package/dist/db/repository/index.d.ts +16 -0
- package/dist/db/repository/index.d.ts.map +1 -0
- package/dist/db/repository/index.js +16 -0
- package/dist/db/repository/index.js.map +1 -0
- package/dist/db/repository/native-repository.d.ts +70 -0
- package/dist/db/repository/native-repository.d.ts.map +1 -0
- package/dist/db/repository/native-repository.js +418 -0
- package/dist/db/repository/native-repository.js.map +1 -0
- package/dist/db/repository/nodes.d.ts +86 -0
- package/dist/db/repository/nodes.d.ts.map +1 -0
- package/dist/db/repository/nodes.js +203 -0
- package/dist/db/repository/nodes.js.map +1 -0
- package/dist/db/repository/sqlite-repository.d.ts +59 -0
- package/dist/db/repository/sqlite-repository.d.ts.map +1 -0
- package/dist/db/repository/sqlite-repository.js +199 -0
- package/dist/db/repository/sqlite-repository.js.map +1 -0
- package/dist/domain/analysis/brief.d.ts +25 -0
- package/dist/domain/analysis/brief.d.ts.map +1 -0
- package/dist/domain/analysis/brief.js +136 -0
- package/dist/domain/analysis/brief.js.map +1 -0
- package/dist/domain/analysis/context.d.ts +241 -0
- package/dist/domain/analysis/context.d.ts.map +1 -0
- package/dist/domain/analysis/context.js +361 -0
- package/dist/domain/analysis/context.js.map +1 -0
- package/dist/domain/analysis/dependencies.d.ts +158 -0
- package/dist/domain/analysis/dependencies.d.ts.map +1 -0
- package/dist/domain/analysis/dependencies.js +522 -0
- package/dist/domain/analysis/dependencies.js.map +1 -0
- package/dist/domain/analysis/diff-impact.d.ts +90 -0
- package/dist/domain/analysis/diff-impact.d.ts.map +1 -0
- package/dist/domain/analysis/diff-impact.js +301 -0
- package/dist/domain/analysis/diff-impact.js.map +1 -0
- package/dist/domain/analysis/exports.d.ts +8 -0
- package/dist/domain/analysis/exports.d.ts.map +1 -0
- package/dist/domain/analysis/exports.js +178 -0
- package/dist/domain/analysis/exports.js.map +1 -0
- package/dist/domain/analysis/fn-impact.d.ts +61 -0
- package/dist/domain/analysis/fn-impact.d.ts.map +1 -0
- package/dist/domain/analysis/fn-impact.js +190 -0
- package/dist/domain/analysis/fn-impact.js.map +1 -0
- package/dist/domain/analysis/impact.d.ts +11 -0
- package/dist/domain/analysis/impact.d.ts.map +1 -0
- package/dist/domain/analysis/impact.js +11 -0
- package/dist/domain/analysis/impact.js.map +1 -0
- package/dist/domain/analysis/implementations.d.ts +59 -0
- package/dist/domain/analysis/implementations.d.ts.map +1 -0
- package/dist/domain/analysis/implementations.js +65 -0
- package/dist/domain/analysis/implementations.js.map +1 -0
- package/dist/domain/analysis/module-map.d.ts +86 -0
- package/dist/domain/analysis/module-map.d.ts.map +1 -0
- package/dist/domain/analysis/module-map.js +468 -0
- package/dist/domain/analysis/module-map.js.map +1 -0
- package/dist/domain/analysis/query-helpers.d.ts +27 -0
- package/dist/domain/analysis/query-helpers.d.ts.map +1 -0
- package/dist/domain/analysis/query-helpers.js +41 -0
- package/dist/domain/analysis/query-helpers.js.map +1 -0
- package/dist/domain/analysis/roles.d.ts +20 -0
- package/dist/domain/analysis/roles.d.ts.map +1 -0
- package/dist/domain/analysis/roles.js +74 -0
- package/dist/domain/analysis/roles.js.map +1 -0
- package/dist/domain/analysis/symbol-lookup.d.ts +125 -0
- package/dist/domain/analysis/symbol-lookup.d.ts.map +1 -0
- package/dist/domain/analysis/symbol-lookup.js +206 -0
- package/dist/domain/analysis/symbol-lookup.js.map +1 -0
- package/dist/domain/graph/builder/call-resolver.d.ts +89 -0
- package/dist/domain/graph/builder/call-resolver.d.ts.map +1 -0
- package/dist/domain/graph/builder/call-resolver.js +212 -0
- package/dist/domain/graph/builder/call-resolver.js.map +1 -0
- package/dist/domain/graph/builder/cha.d.ts +69 -0
- package/dist/domain/graph/builder/cha.d.ts.map +1 -0
- package/dist/domain/graph/builder/cha.js +158 -0
- package/dist/domain/graph/builder/cha.js.map +1 -0
- package/dist/domain/graph/builder/context.d.ts +91 -0
- package/dist/domain/graph/builder/context.d.ts.map +1 -0
- package/dist/domain/graph/builder/context.js +66 -0
- package/dist/domain/graph/builder/context.js.map +1 -0
- package/dist/domain/graph/builder/helpers.d.ts +97 -0
- package/dist/domain/graph/builder/helpers.d.ts.map +1 -0
- package/dist/domain/graph/builder/helpers.js +558 -0
- package/dist/domain/graph/builder/helpers.js.map +1 -0
- package/dist/domain/graph/builder/incremental.d.ts +53 -0
- package/dist/domain/graph/builder/incremental.d.ts.map +1 -0
- package/dist/domain/graph/builder/incremental.js +647 -0
- package/dist/domain/graph/builder/incremental.js.map +1 -0
- package/dist/domain/graph/builder/native-db-proxy.d.ts +24 -0
- package/dist/domain/graph/builder/native-db-proxy.d.ts.map +1 -0
- package/dist/domain/graph/builder/native-db-proxy.js +91 -0
- package/dist/domain/graph/builder/native-db-proxy.js.map +1 -0
- package/dist/domain/graph/builder/pipeline.d.ts +9 -0
- package/dist/domain/graph/builder/pipeline.d.ts.map +1 -0
- package/dist/domain/graph/builder/pipeline.js +448 -0
- package/dist/domain/graph/builder/pipeline.js.map +1 -0
- package/dist/domain/graph/builder/stages/build-edges.d.ts +3 -0
- package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/build-edges.js +1425 -0
- package/dist/domain/graph/builder/stages/build-edges.js.map +1 -0
- package/dist/domain/graph/builder/stages/build-structure.d.ts +3 -0
- package/dist/domain/graph/builder/stages/build-structure.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/build-structure.js +250 -0
- package/dist/domain/graph/builder/stages/build-structure.js.map +1 -0
- package/dist/domain/graph/builder/stages/collect-files.d.ts +3 -0
- package/dist/domain/graph/builder/stages/collect-files.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/collect-files.js +161 -0
- package/dist/domain/graph/builder/stages/collect-files.js.map +1 -0
- package/dist/domain/graph/builder/stages/detect-changes.d.ts +27 -0
- package/dist/domain/graph/builder/stages/detect-changes.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/detect-changes.js +593 -0
- package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -0
- package/dist/domain/graph/builder/stages/finalize.d.ts +3 -0
- package/dist/domain/graph/builder/stages/finalize.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/finalize.js +274 -0
- package/dist/domain/graph/builder/stages/finalize.js.map +1 -0
- package/dist/domain/graph/builder/stages/insert-nodes.d.ts +35 -0
- package/dist/domain/graph/builder/stages/insert-nodes.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/insert-nodes.js +351 -0
- package/dist/domain/graph/builder/stages/insert-nodes.js.map +1 -0
- package/dist/domain/graph/builder/stages/native-db-lifecycle.d.ts +14 -0
- package/dist/domain/graph/builder/stages/native-db-lifecycle.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/native-db-lifecycle.js +77 -0
- package/dist/domain/graph/builder/stages/native-db-lifecycle.js.map +1 -0
- package/dist/domain/graph/builder/stages/native-orchestrator.d.ts +62 -0
- package/dist/domain/graph/builder/stages/native-orchestrator.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/native-orchestrator.js +1763 -0
- package/dist/domain/graph/builder/stages/native-orchestrator.js.map +1 -0
- package/dist/domain/graph/builder/stages/parse-files.d.ts +3 -0
- package/dist/domain/graph/builder/stages/parse-files.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/parse-files.js +22 -0
- package/dist/domain/graph/builder/stages/parse-files.js.map +1 -0
- package/dist/domain/graph/builder/stages/resolve-imports.d.ts +7 -0
- package/dist/domain/graph/builder/stages/resolve-imports.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/resolve-imports.js +231 -0
- package/dist/domain/graph/builder/stages/resolve-imports.js.map +1 -0
- package/dist/domain/graph/builder/stages/run-analyses.d.ts +3 -0
- package/dist/domain/graph/builder/stages/run-analyses.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/run-analyses.js +23 -0
- package/dist/domain/graph/builder/stages/run-analyses.js.map +1 -0
- package/dist/domain/graph/builder.d.ts +4 -0
- package/dist/domain/graph/builder.d.ts.map +1 -0
- package/dist/domain/graph/builder.js +6 -0
- package/dist/domain/graph/builder.js.map +1 -0
- package/dist/domain/graph/change-journal.d.ts +50 -0
- package/dist/domain/graph/change-journal.d.ts.map +1 -0
- package/dist/domain/graph/change-journal.js +97 -0
- package/dist/domain/graph/change-journal.js.map +1 -0
- package/dist/domain/graph/cycles.d.ts +19 -0
- package/dist/domain/graph/cycles.d.ts.map +1 -0
- package/dist/domain/graph/cycles.js +142 -0
- package/dist/domain/graph/cycles.js.map +1 -0
- package/dist/domain/graph/journal.d.ts +30 -0
- package/dist/domain/graph/journal.d.ts.map +1 -0
- package/dist/domain/graph/journal.js +360 -0
- package/dist/domain/graph/journal.js.map +1 -0
- package/dist/domain/graph/resolve.d.ts +67 -0
- package/dist/domain/graph/resolve.d.ts.map +1 -0
- package/dist/domain/graph/resolve.js +521 -0
- package/dist/domain/graph/resolve.js.map +1 -0
- package/dist/domain/graph/resolver/points-to.d.ts +53 -0
- package/dist/domain/graph/resolver/points-to.d.ts.map +1 -0
- package/dist/domain/graph/resolver/points-to.js +261 -0
- package/dist/domain/graph/resolver/points-to.js.map +1 -0
- 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/resolver/ts-resolver.d.ts +9 -0
- package/dist/domain/graph/resolver/ts-resolver.d.ts.map +1 -0
- package/dist/domain/graph/resolver/ts-resolver.js +476 -0
- package/dist/domain/graph/resolver/ts-resolver.js.map +1 -0
- package/dist/domain/graph/watcher.d.ts +23 -0
- package/dist/domain/graph/watcher.d.ts.map +1 -0
- package/dist/domain/graph/watcher.js +272 -0
- package/dist/domain/graph/watcher.js.map +1 -0
- package/dist/domain/parser.d.ts +128 -0
- package/dist/domain/parser.d.ts.map +1 -0
- package/dist/domain/parser.js +1246 -0
- package/dist/domain/parser.js.map +1 -0
- package/dist/domain/queries.d.ts +22 -0
- package/dist/domain/queries.d.ts.map +1 -0
- package/dist/domain/queries.js +26 -0
- package/dist/domain/queries.js.map +1 -0
- package/dist/domain/search/generator.d.ts +16 -0
- package/dist/domain/search/generator.d.ts.map +1 -0
- package/dist/domain/search/generator.js +181 -0
- package/dist/domain/search/generator.js.map +1 -0
- package/dist/domain/search/index.d.ts +15 -0
- package/dist/domain/search/index.d.ts.map +1 -0
- package/dist/domain/search/index.js +13 -0
- package/dist/domain/search/index.js.map +1 -0
- package/dist/domain/search/models.d.ts +63 -0
- package/dist/domain/search/models.d.ts.map +1 -0
- package/dist/domain/search/models.js +303 -0
- package/dist/domain/search/models.js.map +1 -0
- package/dist/domain/search/search/cli-formatter.d.ts +10 -0
- package/dist/domain/search/search/cli-formatter.d.ts.map +1 -0
- package/dist/domain/search/search/cli-formatter.js +134 -0
- package/dist/domain/search/search/cli-formatter.js.map +1 -0
- package/dist/domain/search/search/filters.d.ts +9 -0
- package/dist/domain/search/search/filters.d.ts.map +1 -0
- package/dist/domain/search/search/filters.js +31 -0
- package/dist/domain/search/search/filters.js.map +1 -0
- package/dist/domain/search/search/hybrid.d.ts +21 -0
- package/dist/domain/search/search/hybrid.d.ts.map +1 -0
- package/dist/domain/search/search/hybrid.js +122 -0
- package/dist/domain/search/search/hybrid.js.map +1 -0
- package/dist/domain/search/search/keyword.d.ts +18 -0
- package/dist/domain/search/search/keyword.d.ts.map +1 -0
- package/dist/domain/search/search/keyword.js +58 -0
- package/dist/domain/search/search/keyword.js.map +1 -0
- package/dist/domain/search/search/prepare.d.ts +25 -0
- package/dist/domain/search/search/prepare.d.ts.map +1 -0
- package/dist/domain/search/search/prepare.js +63 -0
- package/dist/domain/search/search/prepare.js.map +1 -0
- package/dist/domain/search/search/semantic.d.ts +41 -0
- package/dist/domain/search/search/semantic.d.ts.map +1 -0
- package/dist/domain/search/search/semantic.js +135 -0
- package/dist/domain/search/search/semantic.js.map +1 -0
- package/dist/domain/search/stores/fts5.d.ts +10 -0
- package/dist/domain/search/stores/fts5.d.ts.map +1 -0
- package/dist/domain/search/stores/fts5.js +27 -0
- package/dist/domain/search/stores/fts5.js.map +1 -0
- package/dist/domain/search/stores/sqlite-blob.d.ts +5 -0
- package/dist/domain/search/stores/sqlite-blob.d.ts.map +1 -0
- package/dist/domain/search/stores/sqlite-blob.js +16 -0
- package/dist/domain/search/stores/sqlite-blob.js.map +1 -0
- package/dist/domain/search/strategies/source.d.ts +6 -0
- package/dist/domain/search/strategies/source.d.ts.map +1 -0
- package/dist/domain/search/strategies/source.js +14 -0
- package/dist/domain/search/strategies/source.js.map +1 -0
- package/dist/domain/search/strategies/structured.d.ts +10 -0
- package/dist/domain/search/strategies/structured.d.ts.map +1 -0
- package/dist/domain/search/strategies/structured.js +35 -0
- package/dist/domain/search/strategies/structured.js.map +1 -0
- package/dist/domain/search/strategies/text-utils.d.ts +9 -0
- package/dist/domain/search/strategies/text-utils.d.ts.map +1 -0
- package/dist/domain/search/strategies/text-utils.js +45 -0
- package/dist/domain/search/strategies/text-utils.js.map +1 -0
- package/dist/domain/wasm-worker-entry.d.ts +24 -0
- package/dist/domain/wasm-worker-entry.d.ts.map +1 -0
- package/dist/domain/wasm-worker-entry.js +749 -0
- package/dist/domain/wasm-worker-entry.js.map +1 -0
- package/dist/domain/wasm-worker-pool.d.ts +59 -0
- package/dist/domain/wasm-worker-pool.d.ts.map +1 -0
- package/dist/domain/wasm-worker-pool.js +363 -0
- package/dist/domain/wasm-worker-pool.js.map +1 -0
- package/dist/domain/wasm-worker-protocol.d.ts +81 -0
- package/dist/domain/wasm-worker-protocol.d.ts.map +1 -0
- package/dist/domain/wasm-worker-protocol.js +13 -0
- package/dist/domain/wasm-worker-protocol.js.map +1 -0
- package/dist/extractors/bash.d.ts +6 -0
- package/dist/extractors/bash.d.ts.map +1 -0
- package/dist/extractors/bash.js +91 -0
- package/dist/extractors/bash.js.map +1 -0
- package/dist/extractors/c.d.ts +6 -0
- package/dist/extractors/c.d.ts.map +1 -0
- package/dist/extractors/c.js +223 -0
- package/dist/extractors/c.js.map +1 -0
- package/dist/extractors/clojure.d.ts +12 -0
- package/dist/extractors/clojure.d.ts.map +1 -0
- package/dist/extractors/clojure.js +245 -0
- package/dist/extractors/clojure.js.map +1 -0
- package/dist/extractors/cpp.d.ts +6 -0
- package/dist/extractors/cpp.d.ts.map +1 -0
- package/dist/extractors/cpp.js +365 -0
- package/dist/extractors/cpp.js.map +1 -0
- package/dist/extractors/csharp.d.ts +6 -0
- package/dist/extractors/csharp.d.ts.map +1 -0
- package/dist/extractors/csharp.js +430 -0
- package/dist/extractors/csharp.js.map +1 -0
- package/dist/extractors/cuda.d.ts +11 -0
- package/dist/extractors/cuda.d.ts.map +1 -0
- package/dist/extractors/cuda.js +419 -0
- package/dist/extractors/cuda.js.map +1 -0
- package/dist/extractors/dart.d.ts +6 -0
- package/dist/extractors/dart.d.ts.map +1 -0
- package/dist/extractors/dart.js +277 -0
- package/dist/extractors/dart.js.map +1 -0
- package/dist/extractors/elixir.d.ts +9 -0
- package/dist/extractors/elixir.d.ts.map +1 -0
- package/dist/extractors/elixir.js +327 -0
- package/dist/extractors/elixir.js.map +1 -0
- package/dist/extractors/erlang.d.ts +14 -0
- package/dist/extractors/erlang.d.ts.map +1 -0
- package/dist/extractors/erlang.js +275 -0
- package/dist/extractors/erlang.js.map +1 -0
- package/dist/extractors/fsharp.d.ts +20 -0
- package/dist/extractors/fsharp.d.ts.map +1 -0
- package/dist/extractors/fsharp.js +312 -0
- package/dist/extractors/fsharp.js.map +1 -0
- package/dist/extractors/gleam.d.ts +14 -0
- package/dist/extractors/gleam.d.ts.map +1 -0
- package/dist/extractors/gleam.js +225 -0
- package/dist/extractors/gleam.js.map +1 -0
- package/dist/extractors/go.d.ts +6 -0
- package/dist/extractors/go.d.ts.map +1 -0
- package/dist/extractors/go.js +460 -0
- package/dist/extractors/go.js.map +1 -0
- package/dist/extractors/groovy.d.ts +10 -0
- package/dist/extractors/groovy.d.ts.map +1 -0
- package/dist/extractors/groovy.js +403 -0
- package/dist/extractors/groovy.js.map +1 -0
- package/dist/extractors/haskell.d.ts +8 -0
- package/dist/extractors/haskell.d.ts.map +1 -0
- package/dist/extractors/haskell.js +261 -0
- package/dist/extractors/haskell.js.map +1 -0
- package/dist/extractors/hcl.d.ts +6 -0
- package/dist/extractors/hcl.d.ts.map +1 -0
- package/dist/extractors/hcl.js +114 -0
- package/dist/extractors/hcl.js.map +1 -0
- package/dist/extractors/helpers.d.ts +144 -0
- package/dist/extractors/helpers.d.ts.map +1 -0
- package/dist/extractors/helpers.js +360 -0
- package/dist/extractors/helpers.js.map +1 -0
- package/dist/extractors/index.d.ts +33 -0
- package/dist/extractors/index.d.ts.map +1 -0
- package/dist/extractors/index.js +33 -0
- package/dist/extractors/index.js.map +1 -0
- package/dist/extractors/java.d.ts +6 -0
- package/dist/extractors/java.d.ts.map +1 -0
- package/dist/extractors/java.js +390 -0
- package/dist/extractors/java.js.map +1 -0
- package/dist/extractors/javascript.d.ts +10 -0
- package/dist/extractors/javascript.d.ts.map +1 -0
- package/dist/extractors/javascript.js +3618 -0
- package/dist/extractors/javascript.js.map +1 -0
- package/dist/extractors/julia.d.ts +16 -0
- package/dist/extractors/julia.d.ts.map +1 -0
- package/dist/extractors/julia.js +411 -0
- package/dist/extractors/julia.js.map +1 -0
- package/dist/extractors/kotlin.d.ts +6 -0
- package/dist/extractors/kotlin.d.ts.map +1 -0
- package/dist/extractors/kotlin.js +340 -0
- package/dist/extractors/kotlin.js.map +1 -0
- package/dist/extractors/lua.d.ts +6 -0
- package/dist/extractors/lua.d.ts.map +1 -0
- package/dist/extractors/lua.js +162 -0
- package/dist/extractors/lua.js.map +1 -0
- package/dist/extractors/objc.d.ts +9 -0
- package/dist/extractors/objc.d.ts.map +1 -0
- package/dist/extractors/objc.js +543 -0
- package/dist/extractors/objc.js.map +1 -0
- package/dist/extractors/ocaml.d.ts +6 -0
- package/dist/extractors/ocaml.d.ts.map +1 -0
- package/dist/extractors/ocaml.js +310 -0
- package/dist/extractors/ocaml.js.map +1 -0
- package/dist/extractors/php.d.ts +6 -0
- package/dist/extractors/php.d.ts.map +1 -0
- package/dist/extractors/php.js +381 -0
- package/dist/extractors/php.js.map +1 -0
- package/dist/extractors/python.d.ts +6 -0
- package/dist/extractors/python.d.ts.map +1 -0
- package/dist/extractors/python.js +428 -0
- package/dist/extractors/python.js.map +1 -0
- package/dist/extractors/r.d.ts +13 -0
- package/dist/extractors/r.d.ts.map +1 -0
- package/dist/extractors/r.js +267 -0
- package/dist/extractors/r.js.map +1 -0
- package/dist/extractors/ruby.d.ts +6 -0
- package/dist/extractors/ruby.d.ts.map +1 -0
- package/dist/extractors/ruby.js +281 -0
- package/dist/extractors/ruby.js.map +1 -0
- package/dist/extractors/rust.d.ts +6 -0
- package/dist/extractors/rust.d.ts.map +1 -0
- package/dist/extractors/rust.js +354 -0
- package/dist/extractors/rust.js.map +1 -0
- package/dist/extractors/scala.d.ts +6 -0
- package/dist/extractors/scala.d.ts.map +1 -0
- package/dist/extractors/scala.js +315 -0
- package/dist/extractors/scala.js.map +1 -0
- package/dist/extractors/solidity.d.ts +9 -0
- package/dist/extractors/solidity.d.ts.map +1 -0
- package/dist/extractors/solidity.js +351 -0
- package/dist/extractors/solidity.js.map +1 -0
- package/dist/extractors/swift.d.ts +6 -0
- package/dist/extractors/swift.d.ts.map +1 -0
- package/dist/extractors/swift.js +326 -0
- package/dist/extractors/swift.js.map +1 -0
- package/dist/extractors/verilog.d.ts +9 -0
- package/dist/extractors/verilog.d.ts.map +1 -0
- package/dist/extractors/verilog.js +351 -0
- package/dist/extractors/verilog.js.map +1 -0
- package/dist/extractors/zig.d.ts +9 -0
- package/dist/extractors/zig.d.ts.map +1 -0
- package/dist/extractors/zig.js +274 -0
- package/dist/extractors/zig.js.map +1 -0
- package/dist/features/ast.d.ts +78 -0
- package/dist/features/ast.d.ts.map +1 -0
- package/dist/features/ast.js +228 -0
- package/dist/features/ast.js.map +1 -0
- package/dist/features/audit.d.ts +15 -0
- package/dist/features/audit.d.ts.map +1 -0
- package/dist/features/audit.js +275 -0
- package/dist/features/audit.js.map +1 -0
- package/dist/features/batch.d.ts +54 -0
- package/dist/features/batch.d.ts.map +1 -0
- package/dist/features/batch.js +97 -0
- package/dist/features/batch.js.map +1 -0
- package/dist/features/boundaries.d.ts +51 -0
- package/dist/features/boundaries.d.ts.map +1 -0
- package/dist/features/boundaries.js +248 -0
- package/dist/features/boundaries.js.map +1 -0
- package/dist/features/branch-compare.d.ts +71 -0
- package/dist/features/branch-compare.d.ts.map +1 -0
- package/dist/features/branch-compare.js +444 -0
- package/dist/features/branch-compare.js.map +1 -0
- package/dist/features/cfg.d.ts +79 -0
- package/dist/features/cfg.d.ts.map +1 -0
- package/dist/features/cfg.js +483 -0
- package/dist/features/cfg.js.map +1 -0
- package/dist/features/check.d.ts +84 -0
- package/dist/features/check.d.ts.map +1 -0
- package/dist/features/check.js +290 -0
- package/dist/features/check.js.map +1 -0
- package/dist/features/cochange.d.ts +68 -0
- package/dist/features/cochange.d.ts.map +1 -0
- package/dist/features/cochange.js +384 -0
- package/dist/features/cochange.js.map +1 -0
- package/dist/features/communities.d.ts +26 -0
- package/dist/features/communities.d.ts.map +1 -0
- package/dist/features/communities.js +149 -0
- package/dist/features/communities.js.map +1 -0
- package/dist/features/complexity-query.d.ts +37 -0
- package/dist/features/complexity-query.d.ts.map +1 -0
- package/dist/features/complexity-query.js +268 -0
- package/dist/features/complexity-query.js.map +1 -0
- package/dist/features/complexity.d.ts +52 -0
- package/dist/features/complexity.d.ts.map +1 -0
- package/dist/features/complexity.js +490 -0
- package/dist/features/complexity.js.map +1 -0
- package/dist/features/dataflow.d.ts +129 -0
- package/dist/features/dataflow.d.ts.map +1 -0
- package/dist/features/dataflow.js +1079 -0
- package/dist/features/dataflow.js.map +1 -0
- package/dist/features/export.d.ts +35 -0
- package/dist/features/export.d.ts.map +1 -0
- package/dist/features/export.js +340 -0
- package/dist/features/export.js.map +1 -0
- package/dist/features/flow.d.ts +21 -0
- package/dist/features/flow.d.ts.map +1 -0
- package/dist/features/flow.js +195 -0
- package/dist/features/flow.js.map +1 -0
- package/dist/features/graph-enrichment.d.ts +44 -0
- package/dist/features/graph-enrichment.d.ts.map +1 -0
- package/dist/features/graph-enrichment.js +312 -0
- package/dist/features/graph-enrichment.js.map +1 -0
- package/dist/features/manifesto.d.ts +23 -0
- package/dist/features/manifesto.d.ts.map +1 -0
- package/dist/features/manifesto.js +382 -0
- package/dist/features/manifesto.js.map +1 -0
- package/dist/features/owners.d.ts +60 -0
- package/dist/features/owners.d.ts.map +1 -0
- package/dist/features/owners.js +248 -0
- package/dist/features/owners.js.map +1 -0
- package/dist/features/sequence.d.ts +42 -0
- package/dist/features/sequence.d.ts.map +1 -0
- package/dist/features/sequence.js +271 -0
- package/dist/features/sequence.js.map +1 -0
- package/dist/features/shared/find-nodes.d.ts +7 -0
- package/dist/features/shared/find-nodes.d.ts.map +1 -0
- package/dist/features/shared/find-nodes.js +18 -0
- package/dist/features/shared/find-nodes.js.map +1 -0
- package/dist/features/snapshot.d.ts +25 -0
- package/dist/features/snapshot.d.ts.map +1 -0
- package/dist/features/snapshot.js +188 -0
- package/dist/features/snapshot.js.map +1 -0
- package/dist/features/structure-query.d.ts +76 -0
- package/dist/features/structure-query.d.ts.map +1 -0
- package/dist/features/structure-query.js +274 -0
- package/dist/features/structure-query.js.map +1 -0
- package/dist/features/structure.d.ts +39 -0
- package/dist/features/structure.d.ts.map +1 -0
- package/dist/features/structure.js +796 -0
- package/dist/features/structure.js.map +1 -0
- package/dist/features/triage.d.ts +47 -0
- package/dist/features/triage.d.ts.map +1 -0
- package/dist/features/triage.js +123 -0
- package/dist/features/triage.js.map +1 -0
- package/dist/graph/algorithms/bfs.d.ts +14 -0
- package/dist/graph/algorithms/bfs.d.ts.map +1 -0
- package/dist/graph/algorithms/bfs.js +72 -0
- package/dist/graph/algorithms/bfs.js.map +1 -0
- package/dist/graph/algorithms/centrality.d.ts +12 -0
- package/dist/graph/algorithms/centrality.d.ts.map +1 -0
- package/dist/graph/algorithms/centrality.js +42 -0
- package/dist/graph/algorithms/centrality.js.map +1 -0
- package/dist/graph/algorithms/index.d.ts +7 -0
- package/dist/graph/algorithms/index.d.ts.map +1 -0
- package/dist/graph/algorithms/index.js +7 -0
- package/dist/graph/algorithms/index.js.map +1 -0
- package/dist/graph/algorithms/leiden/adapter.d.ts +37 -0
- package/dist/graph/algorithms/leiden/adapter.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/adapter.js +173 -0
- package/dist/graph/algorithms/leiden/adapter.js.map +1 -0
- package/dist/graph/algorithms/leiden/cpm.d.ts +28 -0
- package/dist/graph/algorithms/leiden/cpm.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/cpm.js +48 -0
- package/dist/graph/algorithms/leiden/cpm.js.map +1 -0
- package/dist/graph/algorithms/leiden/index.d.ts +37 -0
- package/dist/graph/algorithms/leiden/index.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/index.js +157 -0
- package/dist/graph/algorithms/leiden/index.js.map +1 -0
- package/dist/graph/algorithms/leiden/modularity.d.ts +33 -0
- package/dist/graph/algorithms/leiden/modularity.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/modularity.js +80 -0
- package/dist/graph/algorithms/leiden/modularity.js.map +1 -0
- package/dist/graph/algorithms/leiden/optimiser.d.ts +62 -0
- package/dist/graph/algorithms/leiden/optimiser.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/optimiser.js +530 -0
- package/dist/graph/algorithms/leiden/optimiser.js.map +1 -0
- package/dist/graph/algorithms/leiden/partition.d.ts +44 -0
- package/dist/graph/algorithms/leiden/partition.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/partition.js +438 -0
- package/dist/graph/algorithms/leiden/partition.js.map +1 -0
- package/dist/graph/algorithms/leiden/rng.d.ts +9 -0
- package/dist/graph/algorithms/leiden/rng.d.ts.map +1 -0
- package/dist/graph/algorithms/leiden/rng.js +17 -0
- package/dist/graph/algorithms/leiden/rng.js.map +1 -0
- package/dist/graph/algorithms/louvain.d.ts +20 -0
- package/dist/graph/algorithms/louvain.d.ts.map +1 -0
- package/dist/graph/algorithms/louvain.js +52 -0
- package/dist/graph/algorithms/louvain.js.map +1 -0
- package/dist/graph/algorithms/shortest-path.d.ts +10 -0
- package/dist/graph/algorithms/shortest-path.d.ts.map +1 -0
- package/dist/graph/algorithms/shortest-path.js +55 -0
- package/dist/graph/algorithms/shortest-path.js.map +1 -0
- package/dist/graph/algorithms/tarjan.d.ts +9 -0
- package/dist/graph/algorithms/tarjan.d.ts.map +1 -0
- package/dist/graph/algorithms/tarjan.js +52 -0
- package/dist/graph/algorithms/tarjan.js.map +1 -0
- package/dist/graph/builders/dependency.d.ts +18 -0
- package/dist/graph/builders/dependency.d.ts.map +1 -0
- package/dist/graph/builders/dependency.js +101 -0
- package/dist/graph/builders/dependency.js.map +1 -0
- package/dist/graph/builders/index.d.ts +4 -0
- package/dist/graph/builders/index.d.ts.map +1 -0
- package/dist/graph/builders/index.js +4 -0
- package/dist/graph/builders/index.js.map +1 -0
- package/dist/graph/builders/structure.d.ts +10 -0
- package/dist/graph/builders/structure.d.ts.map +1 -0
- package/dist/graph/builders/structure.js +33 -0
- package/dist/graph/builders/structure.js.map +1 -0
- package/dist/graph/builders/temporal.d.ts +13 -0
- package/dist/graph/builders/temporal.d.ts.map +1 -0
- package/dist/graph/builders/temporal.js +29 -0
- package/dist/graph/builders/temporal.js.map +1 -0
- package/dist/graph/classifiers/index.d.ts +3 -0
- package/dist/graph/classifiers/index.d.ts.map +1 -0
- package/dist/graph/classifiers/index.js +3 -0
- package/dist/graph/classifiers/index.js.map +1 -0
- package/dist/graph/classifiers/risk.d.ts +39 -0
- package/dist/graph/classifiers/risk.d.ts.map +1 -0
- package/dist/graph/classifiers/risk.js +78 -0
- package/dist/graph/classifiers/risk.js.map +1 -0
- package/dist/graph/classifiers/roles.d.ts +48 -0
- package/dist/graph/classifiers/roles.d.ts.map +1 -0
- package/dist/graph/classifiers/roles.js +180 -0
- package/dist/graph/classifiers/roles.js.map +1 -0
- package/dist/graph/index.d.ts +5 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +6 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/model.d.ts +57 -0
- package/dist/graph/model.d.ts.map +1 -0
- package/dist/graph/model.js +205 -0
- package/dist/graph/model.js.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/config.d.ts +281 -0
- package/dist/infrastructure/config.d.ts.map +1 -0
- package/dist/infrastructure/config.js +857 -0
- package/dist/infrastructure/config.js.map +1 -0
- package/dist/infrastructure/logger.d.ts +7 -0
- package/dist/infrastructure/logger.d.ts.map +1 -0
- package/dist/infrastructure/logger.js +21 -0
- package/dist/infrastructure/logger.js.map +1 -0
- package/dist/infrastructure/native.d.ts +38 -0
- package/dist/infrastructure/native.d.ts.map +1 -0
- package/dist/infrastructure/native.js +182 -0
- package/dist/infrastructure/native.js.map +1 -0
- package/dist/infrastructure/registry.d.ts +81 -0
- package/dist/infrastructure/registry.d.ts.map +1 -0
- package/dist/infrastructure/registry.js +229 -0
- package/dist/infrastructure/registry.js.map +1 -0
- package/dist/infrastructure/result-formatter.d.ts +2 -0
- package/dist/infrastructure/result-formatter.d.ts.map +1 -0
- package/dist/infrastructure/result-formatter.js +3 -0
- package/dist/infrastructure/result-formatter.js.map +1 -0
- package/dist/infrastructure/suppress.d.ts +25 -0
- package/dist/infrastructure/suppress.d.ts.map +1 -0
- package/dist/infrastructure/suppress.js +43 -0
- package/dist/infrastructure/suppress.js.map +1 -0
- package/dist/infrastructure/test-filter.d.ts +5 -0
- package/dist/infrastructure/test-filter.d.ts.map +1 -0
- package/dist/infrastructure/test-filter.js +7 -0
- package/dist/infrastructure/test-filter.js.map +1 -0
- package/dist/infrastructure/update-check.d.ts +26 -0
- package/dist/infrastructure/update-check.d.ts.map +1 -0
- package/dist/infrastructure/update-check.js +164 -0
- package/dist/infrastructure/update-check.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/middleware.d.ts +26 -0
- package/dist/mcp/middleware.d.ts.map +1 -0
- package/dist/mcp/middleware.js +32 -0
- package/dist/mcp/middleware.js.map +1 -0
- package/dist/mcp/server.d.ts +14 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +193 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +21 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js +839 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/tools/ast-query.d.ts +14 -0
- package/dist/mcp/tools/ast-query.d.ts.map +1 -0
- package/dist/mcp/tools/ast-query.js +13 -0
- package/dist/mcp/tools/ast-query.js.map +1 -0
- package/dist/mcp/tools/audit.d.ts +15 -0
- package/dist/mcp/tools/audit.d.ts.map +1 -0
- package/dist/mcp/tools/audit.js +20 -0
- package/dist/mcp/tools/audit.js.map +1 -0
- package/dist/mcp/tools/batch-query.d.ts +13 -0
- package/dist/mcp/tools/batch-query.d.ts.map +1 -0
- package/dist/mcp/tools/batch-query.js +11 -0
- package/dist/mcp/tools/batch-query.js.map +1 -0
- package/dist/mcp/tools/branch-compare.d.ts +12 -0
- package/dist/mcp/tools/branch-compare.d.ts.map +1 -0
- package/dist/mcp/tools/branch-compare.js +10 -0
- package/dist/mcp/tools/branch-compare.js.map +1 -0
- package/dist/mcp/tools/brief.d.ts +9 -0
- package/dist/mcp/tools/brief.d.ts.map +1 -0
- package/dist/mcp/tools/brief.js +8 -0
- package/dist/mcp/tools/brief.js.map +1 -0
- package/dist/mcp/tools/cfg.d.ts +14 -0
- package/dist/mcp/tools/cfg.d.ts.map +1 -0
- package/dist/mcp/tools/cfg.js +20 -0
- package/dist/mcp/tools/cfg.js.map +1 -0
- package/dist/mcp/tools/check.d.ts +20 -0
- package/dist/mcp/tools/check.d.ts.map +1 -0
- package/dist/mcp/tools/check.js +39 -0
- package/dist/mcp/tools/check.js.map +1 -0
- package/dist/mcp/tools/co-changes.d.ts +12 -0
- package/dist/mcp/tools/co-changes.d.ts.map +1 -0
- package/dist/mcp/tools/co-changes.js +19 -0
- package/dist/mcp/tools/co-changes.js.map +1 -0
- package/dist/mcp/tools/code-owners.d.ts +12 -0
- package/dist/mcp/tools/code-owners.d.ts.map +1 -0
- package/dist/mcp/tools/code-owners.js +12 -0
- package/dist/mcp/tools/code-owners.js.map +1 -0
- package/dist/mcp/tools/communities.d.ts +13 -0
- package/dist/mcp/tools/communities.d.ts.map +1 -0
- package/dist/mcp/tools/communities.js +14 -0
- package/dist/mcp/tools/communities.js.map +1 -0
- package/dist/mcp/tools/complexity.d.ts +16 -0
- package/dist/mcp/tools/complexity.d.ts.map +1 -0
- package/dist/mcp/tools/complexity.js +16 -0
- package/dist/mcp/tools/complexity.js.map +1 -0
- package/dist/mcp/tools/context.d.ts +16 -0
- package/dist/mcp/tools/context.d.ts.map +1 -0
- package/dist/mcp/tools/context.js +16 -0
- package/dist/mcp/tools/context.js.map +1 -0
- package/dist/mcp/tools/dataflow.d.ts +15 -0
- package/dist/mcp/tools/dataflow.d.ts.map +1 -0
- package/dist/mcp/tools/dataflow.js +25 -0
- package/dist/mcp/tools/dataflow.js.map +1 -0
- package/dist/mcp/tools/diff-impact.d.ts +14 -0
- package/dist/mcp/tools/diff-impact.d.ts.map +1 -0
- package/dist/mcp/tools/diff-impact.js +23 -0
- package/dist/mcp/tools/diff-impact.js.map +1 -0
- package/dist/mcp/tools/execution-flow.d.ts +15 -0
- package/dist/mcp/tools/execution-flow.d.ts.map +1 -0
- package/dist/mcp/tools/execution-flow.js +25 -0
- package/dist/mcp/tools/execution-flow.js.map +1 -0
- package/dist/mcp/tools/export-graph.d.ts +11 -0
- package/dist/mcp/tools/export-graph.d.ts.map +1 -0
- package/dist/mcp/tools/export-graph.js +57 -0
- package/dist/mcp/tools/export-graph.js.map +1 -0
- package/dist/mcp/tools/file-deps.d.ts +11 -0
- package/dist/mcp/tools/file-deps.d.ts.map +1 -0
- package/dist/mcp/tools/file-deps.js +11 -0
- package/dist/mcp/tools/file-deps.js.map +1 -0
- package/dist/mcp/tools/file-exports.d.ts +12 -0
- package/dist/mcp/tools/file-exports.d.ts.map +1 -0
- package/dist/mcp/tools/file-exports.js +12 -0
- package/dist/mcp/tools/file-exports.js.map +1 -0
- package/dist/mcp/tools/find-cycles.d.ts +7 -0
- package/dist/mcp/tools/find-cycles.d.ts.map +1 -0
- package/dist/mcp/tools/find-cycles.js +15 -0
- package/dist/mcp/tools/find-cycles.js.map +1 -0
- package/dist/mcp/tools/fn-impact.d.ts +14 -0
- package/dist/mcp/tools/fn-impact.d.ts.map +1 -0
- package/dist/mcp/tools/fn-impact.js +14 -0
- package/dist/mcp/tools/fn-impact.js.map +1 -0
- package/dist/mcp/tools/impact-analysis.d.ts +9 -0
- package/dist/mcp/tools/impact-analysis.d.ts.map +1 -0
- package/dist/mcp/tools/impact-analysis.js +8 -0
- package/dist/mcp/tools/impact-analysis.js.map +1 -0
- package/dist/mcp/tools/implementations.d.ts +13 -0
- package/dist/mcp/tools/implementations.d.ts.map +1 -0
- package/dist/mcp/tools/implementations.js +13 -0
- package/dist/mcp/tools/implementations.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +7 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +76 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/interfaces.d.ts +13 -0
- package/dist/mcp/tools/interfaces.d.ts.map +1 -0
- package/dist/mcp/tools/interfaces.js +13 -0
- package/dist/mcp/tools/interfaces.js.map +1 -0
- package/dist/mcp/tools/list-functions.d.ts +12 -0
- package/dist/mcp/tools/list-functions.d.ts.map +1 -0
- package/dist/mcp/tools/list-functions.js +13 -0
- package/dist/mcp/tools/list-functions.js.map +1 -0
- package/dist/mcp/tools/list-repos.d.ts +8 -0
- package/dist/mcp/tools/list-repos.d.ts.map +1 -0
- package/dist/mcp/tools/list-repos.js +11 -0
- package/dist/mcp/tools/list-repos.js.map +1 -0
- package/dist/mcp/tools/module-map.d.ts +9 -0
- package/dist/mcp/tools/module-map.d.ts.map +1 -0
- package/dist/mcp/tools/module-map.js +6 -0
- package/dist/mcp/tools/module-map.js.map +1 -0
- package/dist/mcp/tools/node-roles.d.ts +12 -0
- package/dist/mcp/tools/node-roles.d.ts.map +1 -0
- package/dist/mcp/tools/node-roles.js +13 -0
- package/dist/mcp/tools/node-roles.js.map +1 -0
- package/dist/mcp/tools/path.d.ts +15 -0
- package/dist/mcp/tools/path.d.ts.map +1 -0
- package/dist/mcp/tools/path.js +21 -0
- package/dist/mcp/tools/path.js.map +1 -0
- package/dist/mcp/tools/query.d.ts +20 -0
- package/dist/mcp/tools/query.d.ts.map +1 -0
- package/dist/mcp/tools/query.js +29 -0
- package/dist/mcp/tools/query.js.map +1 -0
- package/dist/mcp/tools/semantic-search.d.ts +13 -0
- package/dist/mcp/tools/semantic-search.d.ts.map +1 -0
- package/dist/mcp/tools/semantic-search.js +62 -0
- package/dist/mcp/tools/semantic-search.js.map +1 -0
- package/dist/mcp/tools/sequence.d.ts +16 -0
- package/dist/mcp/tools/sequence.d.ts.map +1 -0
- package/dist/mcp/tools/sequence.js +16 -0
- package/dist/mcp/tools/sequence.js.map +1 -0
- package/dist/mcp/tools/structure.d.ts +13 -0
- package/dist/mcp/tools/structure.d.ts.map +1 -0
- package/dist/mcp/tools/structure.js +14 -0
- package/dist/mcp/tools/structure.js.map +1 -0
- package/dist/mcp/tools/symbol-children.d.ts +13 -0
- package/dist/mcp/tools/symbol-children.d.ts.map +1 -0
- package/dist/mcp/tools/symbol-children.js +13 -0
- package/dist/mcp/tools/symbol-children.js.map +1 -0
- package/dist/mcp/tools/triage.d.ts +17 -0
- package/dist/mcp/tools/triage.d.ts.map +1 -0
- package/dist/mcp/tools/triage.js +34 -0
- package/dist/mcp/tools/triage.js.map +1 -0
- package/dist/mcp/tools/where.d.ts +12 -0
- package/dist/mcp/tools/where.d.ts.map +1 -0
- package/dist/mcp/tools/where.js +12 -0
- package/dist/mcp/tools/where.js.map +1 -0
- 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/audit.d.ts +15 -0
- package/dist/presentation/audit.d.ts.map +1 -0
- package/dist/presentation/audit.js +78 -0
- package/dist/presentation/audit.js.map +1 -0
- package/dist/presentation/batch.d.ts +20 -0
- package/dist/presentation/batch.d.ts.map +1 -0
- package/dist/presentation/batch.js +21 -0
- package/dist/presentation/batch.js.map +1 -0
- package/dist/presentation/branch-compare.d.ts +13 -0
- package/dist/presentation/branch-compare.d.ts.map +1 -0
- package/dist/presentation/branch-compare.js +91 -0
- package/dist/presentation/branch-compare.js.map +1 -0
- package/dist/presentation/brief.d.ts +9 -0
- package/dist/presentation/brief.d.ts.map +1 -0
- package/dist/presentation/brief.js +39 -0
- package/dist/presentation/brief.js.map +1 -0
- package/dist/presentation/cfg.d.ts +13 -0
- package/dist/presentation/cfg.d.ts.map +1 -0
- package/dist/presentation/cfg.js +62 -0
- package/dist/presentation/cfg.js.map +1 -0
- package/dist/presentation/check.d.ts +19 -0
- package/dist/presentation/check.d.ts.map +1 -0
- package/dist/presentation/check.js +74 -0
- package/dist/presentation/check.js.map +1 -0
- package/dist/presentation/cochange.d.ts +32 -0
- package/dist/presentation/cochange.d.ts.map +1 -0
- package/dist/presentation/cochange.js +33 -0
- package/dist/presentation/cochange.js.map +1 -0
- package/dist/presentation/colors.d.ts +12 -0
- package/dist/presentation/colors.d.ts.map +1 -0
- package/dist/presentation/colors.js +47 -0
- package/dist/presentation/colors.js.map +1 -0
- package/dist/presentation/communities.d.ts +11 -0
- package/dist/presentation/communities.d.ts.map +1 -0
- package/dist/presentation/communities.js +57 -0
- package/dist/presentation/communities.js.map +1 -0
- package/dist/presentation/complexity.d.ts +17 -0
- package/dist/presentation/complexity.d.ts.map +1 -0
- package/dist/presentation/complexity.js +59 -0
- package/dist/presentation/complexity.js.map +1 -0
- package/dist/presentation/dataflow.d.ts +14 -0
- package/dist/presentation/dataflow.d.ts.map +1 -0
- package/dist/presentation/dataflow.js +100 -0
- package/dist/presentation/dataflow.js.map +1 -0
- package/dist/presentation/diff-impact-mermaid.d.ts +11 -0
- package/dist/presentation/diff-impact-mermaid.d.ts.map +1 -0
- package/dist/presentation/diff-impact-mermaid.js +114 -0
- package/dist/presentation/diff-impact-mermaid.js.map +1 -0
- package/dist/presentation/export.d.ts +130 -0
- package/dist/presentation/export.d.ts.map +1 -0
- package/dist/presentation/export.js +311 -0
- package/dist/presentation/export.js.map +1 -0
- package/dist/presentation/flow.d.ts +16 -0
- package/dist/presentation/flow.d.ts.map +1 -0
- package/dist/presentation/flow.js +85 -0
- package/dist/presentation/flow.js.map +1 -0
- package/dist/presentation/manifesto.d.ts +13 -0
- package/dist/presentation/manifesto.d.ts.map +1 -0
- package/dist/presentation/manifesto.js +51 -0
- package/dist/presentation/manifesto.js.map +1 -0
- package/dist/presentation/owners.d.ts +16 -0
- package/dist/presentation/owners.d.ts.map +1 -0
- package/dist/presentation/owners.js +42 -0
- package/dist/presentation/owners.js.map +1 -0
- package/dist/presentation/queries-cli/exports.d.ts +12 -0
- package/dist/presentation/queries-cli/exports.d.ts.map +1 -0
- package/dist/presentation/queries-cli/exports.js +100 -0
- package/dist/presentation/queries-cli/exports.js.map +1 -0
- package/dist/presentation/queries-cli/impact.d.ts +23 -0
- package/dist/presentation/queries-cli/impact.d.ts.map +1 -0
- package/dist/presentation/queries-cli/impact.js +208 -0
- package/dist/presentation/queries-cli/impact.js.map +1 -0
- package/dist/presentation/queries-cli/index.d.ts +6 -0
- package/dist/presentation/queries-cli/index.d.ts.map +1 -0
- package/dist/presentation/queries-cli/index.js +6 -0
- package/dist/presentation/queries-cli/index.js.map +1 -0
- package/dist/presentation/queries-cli/inspect.d.ts +23 -0
- package/dist/presentation/queries-cli/inspect.d.ts.map +1 -0
- package/dist/presentation/queries-cli/inspect.js +376 -0
- package/dist/presentation/queries-cli/inspect.js.map +1 -0
- package/dist/presentation/queries-cli/overview.d.ts +19 -0
- package/dist/presentation/queries-cli/overview.d.ts.map +1 -0
- package/dist/presentation/queries-cli/overview.js +196 -0
- package/dist/presentation/queries-cli/overview.js.map +1 -0
- package/dist/presentation/queries-cli/path.d.ts +15 -0
- package/dist/presentation/queries-cli/path.d.ts.map +1 -0
- package/dist/presentation/queries-cli/path.js +101 -0
- package/dist/presentation/queries-cli/path.js.map +1 -0
- package/dist/presentation/queries-cli.d.ts +12 -0
- package/dist/presentation/queries-cli.d.ts.map +1 -0
- package/dist/presentation/queries-cli.js +12 -0
- package/dist/presentation/queries-cli.js.map +1 -0
- package/dist/presentation/query.d.ts +2 -0
- package/dist/presentation/query.d.ts.map +1 -0
- package/dist/presentation/query.js +2 -0
- package/dist/presentation/query.js.map +1 -0
- package/dist/presentation/result-formatter.d.ts +23 -0
- package/dist/presentation/result-formatter.d.ts.map +1 -0
- package/dist/presentation/result-formatter.js +122 -0
- package/dist/presentation/result-formatter.js.map +1 -0
- package/dist/presentation/sequence-renderer.d.ts +19 -0
- package/dist/presentation/sequence-renderer.d.ts.map +1 -0
- package/dist/presentation/sequence-renderer.js +23 -0
- package/dist/presentation/sequence-renderer.js.map +1 -0
- package/dist/presentation/sequence.d.ts +15 -0
- package/dist/presentation/sequence.d.ts.map +1 -0
- package/dist/presentation/sequence.js +26 -0
- package/dist/presentation/sequence.js.map +1 -0
- package/dist/presentation/structure.d.ts +46 -0
- package/dist/presentation/structure.d.ts.map +1 -0
- package/dist/presentation/structure.js +50 -0
- package/dist/presentation/structure.js.map +1 -0
- package/dist/presentation/table.d.ts +24 -0
- package/dist/presentation/table.d.ts.map +1 -0
- package/dist/presentation/table.js +33 -0
- package/dist/presentation/table.js.map +1 -0
- package/dist/presentation/triage.d.ts +19 -0
- package/dist/presentation/triage.d.ts.map +1 -0
- package/dist/presentation/triage.js +34 -0
- package/dist/presentation/triage.js.map +1 -0
- package/dist/presentation/viewer.d.ts +102 -0
- package/dist/presentation/viewer.d.ts.map +1 -0
- package/dist/presentation/viewer.js +618 -0
- package/dist/presentation/viewer.js.map +1 -0
- package/dist/shared/constants.d.ts +33 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +54 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/errors.d.ts +46 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +69 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/file-utils.d.ts +27 -0
- package/dist/shared/file-utils.d.ts.map +1 -0
- package/dist/shared/file-utils.js +186 -0
- package/dist/shared/file-utils.js.map +1 -0
- package/dist/shared/generators.d.ts +57 -0
- package/dist/shared/generators.d.ts.map +1 -0
- package/dist/shared/generators.js +106 -0
- package/dist/shared/generators.js.map +1 -0
- package/dist/shared/globs.d.ts +40 -0
- package/dist/shared/globs.d.ts.map +1 -0
- package/dist/shared/globs.js +126 -0
- package/dist/shared/globs.js.map +1 -0
- package/dist/shared/hierarchy.d.ts +9 -0
- package/dist/shared/hierarchy.d.ts.map +1 -0
- package/dist/shared/hierarchy.js +68 -0
- package/dist/shared/hierarchy.js.map +1 -0
- package/dist/shared/kinds.d.ts +12 -0
- package/dist/shared/kinds.d.ts.map +1 -0
- package/dist/shared/kinds.js +67 -0
- package/dist/shared/kinds.js.map +1 -0
- package/dist/shared/normalize.d.ts +49 -0
- package/dist/shared/normalize.d.ts.map +1 -0
- package/dist/shared/normalize.js +57 -0
- package/dist/shared/normalize.js.map +1 -0
- package/dist/shared/paginate.d.ts +32 -0
- package/dist/shared/paginate.d.ts.map +1 -0
- package/dist/shared/paginate.js +82 -0
- package/dist/shared/paginate.js.map +1 -0
- package/dist/shared/version.d.ts +2 -0
- package/dist/shared/version.d.ts.map +1 -0
- package/dist/shared/version.js +5 -0
- package/dist/shared/version.js.map +1 -0
- package/dist/types.d.ts +2468 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/grammars/tree-sitter-bash.wasm +0 -0
- package/grammars/tree-sitter-c.wasm +0 -0
- package/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/grammars/tree-sitter-clojure.wasm +0 -0
- package/grammars/tree-sitter-cpp.wasm +0 -0
- package/grammars/tree-sitter-cuda.wasm +0 -0
- package/grammars/tree-sitter-dart.wasm +0 -0
- package/grammars/tree-sitter-elixir.wasm +0 -0
- package/grammars/tree-sitter-erlang.wasm +0 -0
- package/grammars/tree-sitter-fsharp.wasm +0 -0
- package/grammars/tree-sitter-fsharp_signature.wasm +0 -0
- package/grammars/tree-sitter-gleam.wasm +0 -0
- package/grammars/tree-sitter-go.wasm +0 -0
- package/grammars/tree-sitter-groovy.wasm +0 -0
- package/grammars/tree-sitter-haskell.wasm +0 -0
- package/grammars/tree-sitter-hcl.wasm +0 -0
- package/grammars/tree-sitter-java.wasm +0 -0
- package/grammars/tree-sitter-javascript.wasm +0 -0
- package/grammars/tree-sitter-julia.wasm +0 -0
- package/grammars/tree-sitter-kotlin.wasm +0 -0
- package/grammars/tree-sitter-lua.wasm +0 -0
- package/grammars/tree-sitter-objc.wasm +0 -0
- package/grammars/tree-sitter-ocaml.wasm +0 -0
- package/grammars/tree-sitter-ocaml_interface.wasm +0 -0
- package/grammars/tree-sitter-php.wasm +0 -0
- package/grammars/tree-sitter-python.wasm +0 -0
- package/grammars/tree-sitter-r.wasm +0 -0
- package/grammars/tree-sitter-ruby.wasm +0 -0
- package/grammars/tree-sitter-rust.wasm +0 -0
- package/grammars/tree-sitter-scala.wasm +0 -0
- package/grammars/tree-sitter-solidity.wasm +0 -0
- package/grammars/tree-sitter-swift.wasm +0 -0
- package/grammars/tree-sitter-tsx.wasm +0 -0
- package/grammars/tree-sitter-typescript.wasm +0 -0
- package/grammars/tree-sitter-verilog.wasm +0 -0
- package/grammars/tree-sitter-zig.wasm +0 -0
- package/package.json +188 -0
- package/src/ast-analysis/engine.ts +926 -0
- package/src/ast-analysis/metrics.ts +150 -0
- 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/csharp.ts +210 -0
- package/src/ast-analysis/rules/go.ts +187 -0
- package/src/ast-analysis/rules/index.ts +380 -0
- package/src/ast-analysis/rules/java.ts +181 -0
- package/src/ast-analysis/rules/javascript.ts +249 -0
- package/src/ast-analysis/rules/php.ts +226 -0
- package/src/ast-analysis/rules/python.ts +202 -0
- package/src/ast-analysis/rules/ruby.ts +209 -0
- package/src/ast-analysis/rules/rust.ts +179 -0
- package/src/ast-analysis/shared.ts +223 -0
- package/src/ast-analysis/visitor-utils.ts +278 -0
- package/src/ast-analysis/visitor.ts +266 -0
- package/src/ast-analysis/visitors/ast-store-visitor.ts +334 -0
- package/src/ast-analysis/visitors/cfg-conditionals.ts +227 -0
- package/src/ast-analysis/visitors/cfg-loops.ts +136 -0
- package/src/ast-analysis/visitors/cfg-shared.ts +196 -0
- package/src/ast-analysis/visitors/cfg-try-catch.ts +142 -0
- package/src/ast-analysis/visitors/cfg-visitor.ts +367 -0
- package/src/ast-analysis/visitors/complexity-visitor.ts +328 -0
- package/src/ast-analysis/visitors/dataflow-visitor.ts +571 -0
- package/src/cli/commands/ast.ts +24 -0
- package/src/cli/commands/audit.ts +48 -0
- package/src/cli/commands/batch.ts +66 -0
- package/src/cli/commands/branch-compare.ts +27 -0
- package/src/cli/commands/brief.ts +13 -0
- package/src/cli/commands/build.ts +35 -0
- package/src/cli/commands/cfg.ts +28 -0
- package/src/cli/commands/check.ts +72 -0
- package/src/cli/commands/children.ts +34 -0
- package/src/cli/commands/co-change.ts +72 -0
- package/src/cli/commands/communities.ts +21 -0
- package/src/cli/commands/complexity.ts +48 -0
- package/src/cli/commands/config.ts +353 -0
- package/src/cli/commands/context.ts +36 -0
- package/src/cli/commands/cycles.ts +33 -0
- package/src/cli/commands/dataflow.ts +30 -0
- package/src/cli/commands/deps.ts +18 -0
- package/src/cli/commands/diff-impact.ts +30 -0
- package/src/cli/commands/embed.ts +82 -0
- package/src/cli/commands/export.ts +79 -0
- package/src/cli/commands/exports.ts +15 -0
- package/src/cli/commands/flow.ts +34 -0
- package/src/cli/commands/fn-impact.ts +34 -0
- package/src/cli/commands/impact.ts +13 -0
- package/src/cli/commands/implementations.ts +30 -0
- package/src/cli/commands/info.ts +79 -0
- package/src/cli/commands/interfaces.ts +30 -0
- package/src/cli/commands/map.ts +20 -0
- package/src/cli/commands/mcp.ts +19 -0
- package/src/cli/commands/models.ts +29 -0
- package/src/cli/commands/owners.ts +28 -0
- package/src/cli/commands/path.ts +42 -0
- package/src/cli/commands/plot.ts +110 -0
- package/src/cli/commands/query.ts +51 -0
- package/src/cli/commands/registry.ts +106 -0
- package/src/cli/commands/roles.ts +38 -0
- package/src/cli/commands/search.ts +45 -0
- package/src/cli/commands/sequence.ts +30 -0
- package/src/cli/commands/snapshot.ts +67 -0
- package/src/cli/commands/stats.ts +16 -0
- package/src/cli/commands/structure.ts +55 -0
- package/src/cli/commands/triage.ts +93 -0
- package/src/cli/commands/watch.ts +29 -0
- package/src/cli/commands/where.ts +21 -0
- package/src/cli/index.ts +159 -0
- package/src/cli/shared/open-graph.ts +13 -0
- package/src/cli/shared/options.ts +69 -0
- package/src/cli/shared/output.ts +1 -0
- package/src/cli/types.ts +35 -0
- package/src/cli.ts +37 -0
- package/src/db/better-sqlite3.ts +21 -0
- package/src/db/connection.ts +478 -0
- package/src/db/index.ts +84 -0
- package/src/db/migrations.ts +440 -0
- package/src/db/query-builder.ts +371 -0
- package/src/db/repository/base.ts +269 -0
- package/src/db/repository/build-stmts.ts +126 -0
- package/src/db/repository/cached-stmt.ts +20 -0
- package/src/db/repository/cfg.ts +81 -0
- package/src/db/repository/cochange.ts +48 -0
- package/src/db/repository/complexity.ts +21 -0
- package/src/db/repository/dataflow.ts +35 -0
- package/src/db/repository/edges.ts +281 -0
- package/src/db/repository/embeddings.ts +47 -0
- package/src/db/repository/graph-read.ts +62 -0
- package/src/db/repository/in-memory-repository.ts +657 -0
- package/src/db/repository/index.ts +53 -0
- package/src/db/repository/native-repository.ts +546 -0
- package/src/db/repository/nodes.ts +322 -0
- package/src/db/repository/sqlite-repository.ts +303 -0
- package/src/domain/analysis/brief.ts +165 -0
- package/src/domain/analysis/context.ts +537 -0
- package/src/domain/analysis/dependencies.ts +738 -0
- package/src/domain/analysis/diff-impact.ts +381 -0
- package/src/domain/analysis/exports.ts +262 -0
- package/src/domain/analysis/fn-impact.ts +311 -0
- package/src/domain/analysis/impact.ts +11 -0
- package/src/domain/analysis/implementations.ts +81 -0
- package/src/domain/analysis/module-map.ts +576 -0
- package/src/domain/analysis/query-helpers.ts +52 -0
- package/src/domain/analysis/roles.ts +95 -0
- package/src/domain/analysis/symbol-lookup.ts +284 -0
- package/src/domain/graph/builder/call-resolver.ts +289 -0
- package/src/domain/graph/builder/cha.ts +192 -0
- package/src/domain/graph/builder/context.ts +120 -0
- package/src/domain/graph/builder/helpers.ts +665 -0
- package/src/domain/graph/builder/incremental.ts +987 -0
- package/src/domain/graph/builder/native-db-proxy.ts +104 -0
- package/src/domain/graph/builder/pipeline.ts +517 -0
- package/src/domain/graph/builder/stages/build-edges.ts +1986 -0
- package/src/domain/graph/builder/stages/build-structure.ts +330 -0
- package/src/domain/graph/builder/stages/collect-files.ts +175 -0
- package/src/domain/graph/builder/stages/detect-changes.ts +751 -0
- package/src/domain/graph/builder/stages/finalize.ts +321 -0
- package/src/domain/graph/builder/stages/insert-nodes.ts +489 -0
- package/src/domain/graph/builder/stages/native-db-lifecycle.ts +74 -0
- package/src/domain/graph/builder/stages/native-orchestrator.ts +2241 -0
- package/src/domain/graph/builder/stages/parse-files.ts +26 -0
- package/src/domain/graph/builder/stages/resolve-imports.ts +285 -0
- package/src/domain/graph/builder/stages/run-analyses.ts +26 -0
- package/src/domain/graph/builder.ts +11 -0
- package/src/domain/graph/change-journal.ts +141 -0
- package/src/domain/graph/cycles.ts +155 -0
- package/src/domain/graph/journal.ts +377 -0
- package/src/domain/graph/resolve.ts +579 -0
- package/src/domain/graph/resolver/points-to.ts +377 -0
- package/src/domain/graph/resolver/strategy.ts +265 -0
- package/src/domain/graph/resolver/ts-resolver.ts +536 -0
- package/src/domain/graph/watcher.ts +339 -0
- package/src/domain/parser.ts +1437 -0
- package/src/domain/queries.ts +50 -0
- package/src/domain/search/generator.ts +260 -0
- package/src/domain/search/index.ts +15 -0
- package/src/domain/search/models.ts +356 -0
- package/src/domain/search/search/cli-formatter.ts +179 -0
- package/src/domain/search/search/filters.ts +38 -0
- package/src/domain/search/search/hybrid.ts +197 -0
- package/src/domain/search/search/keyword.ts +101 -0
- package/src/domain/search/search/prepare.ts +95 -0
- package/src/domain/search/search/semantic.ts +226 -0
- package/src/domain/search/stores/fts5.ts +27 -0
- package/src/domain/search/stores/sqlite-blob.ts +15 -0
- package/src/domain/search/strategies/source.ts +19 -0
- package/src/domain/search/strategies/structured.ts +48 -0
- package/src/domain/search/strategies/text-utils.ts +41 -0
- package/src/domain/wasm-worker-entry.ts +921 -0
- package/src/domain/wasm-worker-pool.ts +375 -0
- package/src/domain/wasm-worker-protocol.ts +98 -0
- package/src/extractors/bash.ts +97 -0
- package/src/extractors/c.ts +231 -0
- package/src/extractors/clojure.ts +273 -0
- package/src/extractors/cpp.ts +383 -0
- package/src/extractors/csharp.ts +448 -0
- package/src/extractors/cuda.ts +433 -0
- package/src/extractors/dart.ts +304 -0
- package/src/extractors/elixir.ts +350 -0
- package/src/extractors/erlang.ts +295 -0
- package/src/extractors/fsharp.ts +357 -0
- package/src/extractors/gleam.ts +247 -0
- package/src/extractors/go.ts +512 -0
- package/src/extractors/groovy.ts +436 -0
- package/src/extractors/haskell.ts +276 -0
- package/src/extractors/hcl.ts +136 -0
- package/src/extractors/helpers.ts +449 -0
- package/src/extractors/index.ts +32 -0
- package/src/extractors/java.ts +439 -0
- package/src/extractors/javascript.ts +3844 -0
- package/src/extractors/julia.ts +432 -0
- package/src/extractors/kotlin.ts +358 -0
- package/src/extractors/lua.ts +169 -0
- package/src/extractors/objc.ts +555 -0
- package/src/extractors/ocaml.ts +337 -0
- package/src/extractors/php.ts +399 -0
- package/src/extractors/python.ts +439 -0
- package/src/extractors/r.ts +275 -0
- package/src/extractors/ruby.ts +292 -0
- package/src/extractors/rust.ts +371 -0
- package/src/extractors/scala.ts +335 -0
- package/src/extractors/solidity.ts +375 -0
- package/src/extractors/swift.ts +337 -0
- package/src/extractors/verilog.ts +383 -0
- package/src/extractors/zig.ts +291 -0
- package/src/features/ast.ts +405 -0
- package/src/features/audit.ts +446 -0
- package/src/features/batch.ts +182 -0
- package/src/features/boundaries.ts +345 -0
- package/src/features/branch-compare.ts +618 -0
- package/src/features/cfg.ts +750 -0
- package/src/features/check.ts +454 -0
- package/src/features/cochange.ts +506 -0
- package/src/features/communities.ts +232 -0
- package/src/features/complexity-query.ts +388 -0
- package/src/features/complexity.ts +753 -0
- package/src/features/dataflow.ts +1654 -0
- package/src/features/export.ts +486 -0
- package/src/features/flow.ts +307 -0
- package/src/features/graph-enrichment.ts +493 -0
- package/src/features/manifesto.ts +508 -0
- package/src/features/owners.ts +360 -0
- package/src/features/sequence.ts +410 -0
- package/src/features/shared/find-nodes.ts +28 -0
- package/src/features/snapshot.ts +221 -0
- package/src/features/structure-query.ts +456 -0
- package/src/features/structure.ts +1100 -0
- package/src/features/triage.ts +199 -0
- package/src/graph/algorithms/bfs.ts +92 -0
- package/src/graph/algorithms/centrality.ts +50 -0
- package/src/graph/algorithms/index.ts +6 -0
- package/src/graph/algorithms/leiden/LICENSE +24 -0
- package/src/graph/algorithms/leiden/adapter.ts +252 -0
- package/src/graph/algorithms/leiden/cpm.ts +77 -0
- package/src/graph/algorithms/leiden/index.ts +224 -0
- package/src/graph/algorithms/leiden/modularity.ts +122 -0
- package/src/graph/algorithms/leiden/optimiser.ts +706 -0
- package/src/graph/algorithms/leiden/partition.ts +577 -0
- package/src/graph/algorithms/leiden/rng.ts +20 -0
- package/src/graph/algorithms/louvain.ts +75 -0
- package/src/graph/algorithms/shortest-path.ts +59 -0
- package/src/graph/algorithms/tarjan.ts +55 -0
- package/src/graph/builders/dependency.ts +148 -0
- package/src/graph/builders/index.ts +3 -0
- package/src/graph/builders/structure.ts +58 -0
- package/src/graph/builders/temporal.ts +51 -0
- package/src/graph/classifiers/index.ts +2 -0
- package/src/graph/classifiers/risk.ts +123 -0
- package/src/graph/classifiers/roles.ts +226 -0
- package/src/graph/index.ts +13 -0
- package/src/graph/model.ts +238 -0
- package/src/index.cjs +16 -0
- package/src/index.ts +72 -0
- package/src/infrastructure/config.ts +954 -0
- package/src/infrastructure/logger.ts +24 -0
- package/src/infrastructure/native.ts +199 -0
- package/src/infrastructure/registry.ts +313 -0
- package/src/infrastructure/result-formatter.ts +2 -0
- package/src/infrastructure/suppress.ts +47 -0
- package/src/infrastructure/test-filter.ts +7 -0
- package/src/infrastructure/update-check.ts +196 -0
- package/src/mcp/index.ts +2 -0
- package/src/mcp/middleware.ts +38 -0
- package/src/mcp/server.ts +259 -0
- package/src/mcp/tool-registry.ts +890 -0
- package/src/mcp/tools/ast-query.ts +25 -0
- package/src/mcp/tools/audit.ts +33 -0
- package/src/mcp/tools/batch-query.ts +22 -0
- package/src/mcp/tools/branch-compare.ts +22 -0
- package/src/mcp/tools/brief.ts +15 -0
- package/src/mcp/tools/cfg.ts +32 -0
- package/src/mcp/tools/check.ts +60 -0
- package/src/mcp/tools/co-changes.ts +29 -0
- package/src/mcp/tools/code-owners.ts +22 -0
- package/src/mcp/tools/communities.ts +25 -0
- package/src/mcp/tools/complexity.ts +30 -0
- package/src/mcp/tools/context.ts +30 -0
- package/src/mcp/tools/dataflow.ts +38 -0
- package/src/mcp/tools/diff-impact.ts +35 -0
- package/src/mcp/tools/execution-flow.ts +38 -0
- package/src/mcp/tools/export-graph.ts +67 -0
- package/src/mcp/tools/file-deps.ts +20 -0
- package/src/mcp/tools/file-exports.ts +22 -0
- package/src/mcp/tools/find-cycles.ts +19 -0
- package/src/mcp/tools/fn-impact.ts +26 -0
- package/src/mcp/tools/impact-analysis.ts +15 -0
- package/src/mcp/tools/implementations.ts +24 -0
- package/src/mcp/tools/index.ts +81 -0
- package/src/mcp/tools/interfaces.ts +24 -0
- package/src/mcp/tools/list-functions.ts +23 -0
- package/src/mcp/tools/list-repos.ts +17 -0
- package/src/mcp/tools/module-map.ts +13 -0
- package/src/mcp/tools/node-roles.ts +23 -0
- package/src/mcp/tools/path.ts +34 -0
- package/src/mcp/tools/query.ts +47 -0
- package/src/mcp/tools/semantic-search.ts +76 -0
- package/src/mcp/tools/sequence.ts +30 -0
- package/src/mcp/tools/structure.ts +25 -0
- package/src/mcp/tools/symbol-children.ts +24 -0
- package/src/mcp/tools/triage.ts +50 -0
- package/src/mcp/tools/where.ts +22 -0
- package/src/mcp/types.ts +21 -0
- package/src/presentation/audit.ts +109 -0
- package/src/presentation/batch.ts +50 -0
- package/src/presentation/branch-compare.ts +148 -0
- package/src/presentation/brief.ts +63 -0
- package/src/presentation/cfg.ts +103 -0
- package/src/presentation/check.ts +138 -0
- package/src/presentation/cochange.ts +57 -0
- package/src/presentation/colors.ts +51 -0
- package/src/presentation/communities.ts +114 -0
- package/src/presentation/complexity.ts +127 -0
- package/src/presentation/dataflow.ts +179 -0
- package/src/presentation/diff-impact-mermaid.ts +169 -0
- package/src/presentation/export.ts +509 -0
- package/src/presentation/flow.ts +147 -0
- package/src/presentation/manifesto.ts +92 -0
- package/src/presentation/owners.ts +89 -0
- package/src/presentation/queries-cli/exports.ts +152 -0
- package/src/presentation/queries-cli/impact.ts +340 -0
- package/src/presentation/queries-cli/index.ts +13 -0
- package/src/presentation/queries-cli/inspect.ts +594 -0
- package/src/presentation/queries-cli/overview.ts +375 -0
- package/src/presentation/queries-cli/path.ts +187 -0
- package/src/presentation/queries-cli.ts +30 -0
- package/src/presentation/query.ts +17 -0
- package/src/presentation/result-formatter.ts +161 -0
- package/src/presentation/sequence-renderer.ts +46 -0
- package/src/presentation/sequence.ts +43 -0
- package/src/presentation/structure.ts +109 -0
- package/src/presentation/table.ts +45 -0
- package/src/presentation/triage.ts +84 -0
- package/src/presentation/viewer.ts +715 -0
- package/src/shared/constants.ts +70 -0
- package/src/shared/errors.ts +85 -0
- package/src/shared/file-utils.ts +233 -0
- package/src/shared/generators.ts +176 -0
- package/src/shared/globs.ts +121 -0
- package/src/shared/hierarchy.ts +81 -0
- package/src/shared/kinds.ts +85 -0
- package/src/shared/normalize.ts +106 -0
- package/src/shared/paginate.ts +93 -0
- package/src/shared/version.ts +10 -0
- package/src/types.ts +2871 -0
|
@@ -0,0 +1,1763 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native build orchestrator stage — runs the full Rust pipeline when available,
|
|
3
|
+
* with WASM fallback for files the native engine drops.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from `pipeline.ts` to break the name-collision cycle between
|
|
6
|
+
* `buildGraph()` (this module's caller) and `ctx.nativeDb.buildGraph()` (the
|
|
7
|
+
* Rust orchestrator entry point invoked here). Codegraph's name-based call
|
|
8
|
+
* resolver previously conflated the two and reported a false-positive
|
|
9
|
+
* function-level cycle (`buildGraph ↔ tryNativeOrchestrator`).
|
|
10
|
+
*
|
|
11
|
+
* The orchestrator-selection strategy lives here so `pipeline.ts` stays a thin
|
|
12
|
+
* top-level controller: detect changes, try native, fall back to JS stages.
|
|
13
|
+
*/
|
|
14
|
+
import { execFileSync } from 'node:child_process';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { performance } from 'node:perf_hooks';
|
|
17
|
+
import { acquireAdvisoryLock, closeDbPair, openDb, purgeFilesData, releaseAdvisoryLock, setBuildMeta, } from '../../../../db/index.js';
|
|
18
|
+
import { debug, info, warn } from '../../../../infrastructure/logger.js';
|
|
19
|
+
import { loadNative } from '../../../../infrastructure/native.js';
|
|
20
|
+
import { semverCompare } from '../../../../infrastructure/update-check.js';
|
|
21
|
+
import { normalizePath, TS_NATIVE_CONFIDENCE_FLOOR } from '../../../../shared/constants.js';
|
|
22
|
+
import { toErrorMessage } from '../../../../shared/errors.js';
|
|
23
|
+
import { CODEGRAPH_VERSION } from '../../../../shared/version.js';
|
|
24
|
+
import { classifyNativeDrops, formatDropExtensionSummary, getInstalledWasmExtensions, NATIVE_SUPPORTED_EXTENSIONS, parseFilesWasmForBackfill, patchDataflowResult, } from '../../../parser.js';
|
|
25
|
+
import { computeConfidence } from '../../resolve.js';
|
|
26
|
+
import { resolveThisDispatch } from '../cha.js';
|
|
27
|
+
import { batchInsertEdges, batchInsertNodes, CHA_DISPATCH_PENALTY, CHA_TYPED_DISPATCH_CONFIDENCE, collectFiles as collectFilesUtil, fileHash, fileStat, readFileSafe, } from '../helpers.js';
|
|
28
|
+
import { NativeDbProxy } from '../native-db-proxy.js';
|
|
29
|
+
import { closeNativeDb } from './native-db-lifecycle.js';
|
|
30
|
+
// ── Native orchestrator helpers ───────────────────────────────────────
|
|
31
|
+
/** Determine whether the native orchestrator should be skipped. Returns a reason string, or null if it should run. */
|
|
32
|
+
function shouldSkipNativeOrchestrator(ctx) {
|
|
33
|
+
if (ctx.forceFullRebuild)
|
|
34
|
+
return 'forceFullRebuild';
|
|
35
|
+
// v3.9.0 addon had buggy incremental purge (wrong SQL on analysis tables,
|
|
36
|
+
// scoped removal over-detection). Fixed in v3.9.1 by PR #865. Gate on
|
|
37
|
+
// < 3.9.1 so v3.9.1+ uses the fast Rust orchestrator path.
|
|
38
|
+
const orchestratorBuggy = !!ctx.engineVersion && semverCompare(ctx.engineVersion, '3.9.1') < 0;
|
|
39
|
+
if (orchestratorBuggy)
|
|
40
|
+
return `buggy addon ${ctx.engineVersion}`;
|
|
41
|
+
if (ctx.engineName !== 'native')
|
|
42
|
+
return `engine=${ctx.engineName}`;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/** Checkpoint WAL through rusqlite, close nativeDb, and reopen better-sqlite3.
|
|
46
|
+
* Returns false if the DB reopen fails (caller should return partial result). */
|
|
47
|
+
function handoffWalAfterNativeBuild(ctx) {
|
|
48
|
+
closeNativeDb(ctx, 'post-native-build');
|
|
49
|
+
try {
|
|
50
|
+
ctx.db.close();
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
debug(`handoffWal JS db close failed: ${toErrorMessage(e)}`);
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
ctx.db = openDb(ctx.dbPath);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
catch (reopenErr) {
|
|
60
|
+
warn(`Failed to reopen DB after native build: ${reopenErr.message}`);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Reconstruct fileSymbols from the DB after a native orchestrator build.
|
|
66
|
+
* When `scopeFiles` is provided, only loads those files (for analysis-only).
|
|
67
|
+
* When omitted, loads all files (needed for structure rebuilds).
|
|
68
|
+
*/
|
|
69
|
+
function reconstructFileSymbolsFromDb(ctx, scopeFiles) {
|
|
70
|
+
let query = 'SELECT file, name, kind, line, end_line as endLine FROM nodes WHERE file IS NOT NULL';
|
|
71
|
+
const params = [];
|
|
72
|
+
if (scopeFiles && scopeFiles.length > 0) {
|
|
73
|
+
const placeholders = scopeFiles.map(() => '?').join(',');
|
|
74
|
+
query += ` AND file IN (${placeholders})`;
|
|
75
|
+
params.push(...scopeFiles);
|
|
76
|
+
}
|
|
77
|
+
query += ' ORDER BY file, line';
|
|
78
|
+
const rows = ctx.db.prepare(query).all(...params);
|
|
79
|
+
const fileSymbols = new Map();
|
|
80
|
+
for (const row of rows) {
|
|
81
|
+
let entry = fileSymbols.get(row.file);
|
|
82
|
+
if (!entry) {
|
|
83
|
+
entry = {
|
|
84
|
+
definitions: [],
|
|
85
|
+
calls: [],
|
|
86
|
+
imports: [],
|
|
87
|
+
classes: [],
|
|
88
|
+
exports: [],
|
|
89
|
+
typeMap: new Map(),
|
|
90
|
+
};
|
|
91
|
+
fileSymbols.set(row.file, entry);
|
|
92
|
+
}
|
|
93
|
+
entry.definitions.push({
|
|
94
|
+
name: row.name,
|
|
95
|
+
kind: row.kind,
|
|
96
|
+
line: row.line,
|
|
97
|
+
endLine: row.endLine ?? undefined,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Populate import/export counts from DB edges so buildStructure
|
|
101
|
+
// computes correct import_count/export_count in node_metrics.
|
|
102
|
+
// The extractor arrays aren't persisted to the DB, so we derive
|
|
103
|
+
// counts from edge data instead (#804).
|
|
104
|
+
const importCountRows = ctx.db
|
|
105
|
+
.prepare(`SELECT n.file, COUNT(*) AS cnt
|
|
106
|
+
FROM edges e JOIN nodes n ON e.source_id = n.id
|
|
107
|
+
WHERE e.kind IN ('imports', 'imports-type', 'dynamic-imports')
|
|
108
|
+
AND n.file IS NOT NULL
|
|
109
|
+
GROUP BY n.file`)
|
|
110
|
+
.all();
|
|
111
|
+
for (const row of importCountRows) {
|
|
112
|
+
const entry = fileSymbols.get(row.file);
|
|
113
|
+
if (entry)
|
|
114
|
+
entry.imports = new Array(row.cnt);
|
|
115
|
+
}
|
|
116
|
+
const exportCountRows = ctx.db
|
|
117
|
+
.prepare(`SELECT n_tgt.file, COUNT(DISTINCT n_tgt.id) AS cnt
|
|
118
|
+
FROM edges e
|
|
119
|
+
JOIN nodes n_tgt ON e.target_id = n_tgt.id
|
|
120
|
+
JOIN nodes n_src ON e.source_id = n_src.id
|
|
121
|
+
WHERE e.kind IN ('imports', 'imports-type', 'reexports')
|
|
122
|
+
AND n_tgt.file IS NOT NULL
|
|
123
|
+
AND n_src.file != n_tgt.file
|
|
124
|
+
GROUP BY n_tgt.file`)
|
|
125
|
+
.all();
|
|
126
|
+
for (const row of exportCountRows) {
|
|
127
|
+
const entry = fileSymbols.get(row.file);
|
|
128
|
+
if (entry)
|
|
129
|
+
entry.exports = new Array(row.cnt);
|
|
130
|
+
}
|
|
131
|
+
return fileSymbols;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Run JS buildStructure() after native orchestrator to fill directory nodes + contains edges.
|
|
135
|
+
* For full builds, passes changedFiles=null (full rebuild).
|
|
136
|
+
* For incremental builds, passes the changed file list to scope the update.
|
|
137
|
+
*/
|
|
138
|
+
async function runPostNativeStructure(ctx, allFileSymbols, isFullBuild, changedFiles) {
|
|
139
|
+
const structureStart = performance.now();
|
|
140
|
+
try {
|
|
141
|
+
const directories = new Set();
|
|
142
|
+
for (const relPath of allFileSymbols.keys()) {
|
|
143
|
+
const parts = relPath.split('/');
|
|
144
|
+
for (let i = 1; i < parts.length; i++) {
|
|
145
|
+
directories.add(parts.slice(0, i).join('/'));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const lineCountMap = new Map();
|
|
149
|
+
const cachedLineCounts = ctx.db
|
|
150
|
+
.prepare(`SELECT n.name AS file, m.line_count
|
|
151
|
+
FROM node_metrics m JOIN nodes n ON m.node_id = n.id
|
|
152
|
+
WHERE n.kind = 'file'`)
|
|
153
|
+
.all();
|
|
154
|
+
for (const row of cachedLineCounts) {
|
|
155
|
+
lineCountMap.set(row.file, row.line_count);
|
|
156
|
+
}
|
|
157
|
+
// Full builds need null (rebuild everything). Incremental builds pass the
|
|
158
|
+
// changed file list so buildStructure only updates those files' metrics
|
|
159
|
+
// and contains edges — matching the JS pipeline's medium-incremental path.
|
|
160
|
+
const changedFilePaths = isFullBuild || !changedFiles?.length ? null : changedFiles;
|
|
161
|
+
const { buildStructure: buildStructureFn } = (await import('../../../../features/structure.js'));
|
|
162
|
+
buildStructureFn(ctx.db, allFileSymbols, ctx.rootDir, lineCountMap, directories, changedFilePaths);
|
|
163
|
+
debug(`Structure phase completed after native orchestrator${changedFilePaths ? ` (${changedFilePaths.length} files)` : ' (full)'}`);
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
warn(`Structure phase failed after native build: ${toErrorMessage(err)}`);
|
|
167
|
+
}
|
|
168
|
+
return performance.now() - structureStart;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* P6: Build dataflow_vertices and inter-procedural edges after the Rust
|
|
172
|
+
* orchestrator completes.
|
|
173
|
+
*
|
|
174
|
+
* The Rust pipeline writes flows_to/returns/mutates edges directly to the DB
|
|
175
|
+
* but never writes to dataflow_vertices or dataflow_summary. This pass re-runs
|
|
176
|
+
* the Rust dataflow visitor (via extractDataflowAnalysis — fast, no re-parse)
|
|
177
|
+
* to get the DataflowResult and calls buildDataflowVerticesFromMap.
|
|
178
|
+
*
|
|
179
|
+
* Languages for which Rust has no dataflow rules return null from
|
|
180
|
+
* extractDataflowAnalysis and are silently skipped here. A follow-up issue
|
|
181
|
+
* (#1614 adjacent) will add WASM fallback for those languages.
|
|
182
|
+
*/
|
|
183
|
+
async function runDataflowVertexPass(ctx, changedFiles) {
|
|
184
|
+
if (ctx.opts.dataflow === false)
|
|
185
|
+
return;
|
|
186
|
+
const native = loadNative();
|
|
187
|
+
if (!native?.extractDataflowAnalysis)
|
|
188
|
+
return;
|
|
189
|
+
// Determine which files to process: changed files for incremental, all for full builds.
|
|
190
|
+
let filesToProcess;
|
|
191
|
+
if (changedFiles && changedFiles.length > 0) {
|
|
192
|
+
filesToProcess = changedFiles;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Full build: scope to files that need vertex extraction rather than scanning every
|
|
196
|
+
// file in the project. Two categories:
|
|
197
|
+
// (a) Non-native language files — NATIVE_SUPPORTED_EXTENSIONS doesn't cover them,
|
|
198
|
+
// so extractDataflowAnalysis returns null; the wasmStubs path calls buildDataflowEdges
|
|
199
|
+
// which writes both edges AND vertices for those files.
|
|
200
|
+
// (b) Native-language files with dataflow edges already written by the Rust orchestrator
|
|
201
|
+
// (flows_to/returns/mutates) — those need vertex rows to connect them.
|
|
202
|
+
//
|
|
203
|
+
// Skipping native-language files with no dataflow edges is safe: extractDataflowAnalysis
|
|
204
|
+
// would return argFlows=[], assignments=[], mutations=[] for them, producing zero vertices
|
|
205
|
+
// and zero inter-procedural edges. Excluding them avoids O(n_total_files) re-analysis on
|
|
206
|
+
// every full build (codegraph itself: ~2000 files, ~50-80% with no dataflow edges).
|
|
207
|
+
const filesWithDataflow = new Set(ctx.db
|
|
208
|
+
.prepare(`SELECT DISTINCT n.file
|
|
209
|
+
FROM dataflow d
|
|
210
|
+
JOIN nodes n ON n.id = d.source_id
|
|
211
|
+
WHERE n.file IS NOT NULL`)
|
|
212
|
+
.all().map((r) => r.file));
|
|
213
|
+
filesToProcess = ctx.db
|
|
214
|
+
.prepare(`SELECT DISTINCT file FROM nodes WHERE file IS NOT NULL AND kind != 'directory'`)
|
|
215
|
+
.all()
|
|
216
|
+
.map((r) => r.file)
|
|
217
|
+
.filter((f) => {
|
|
218
|
+
const ext = path.extname(f).toLowerCase();
|
|
219
|
+
// Non-native files: always include (WASM handles them via wasmStubs path).
|
|
220
|
+
if (!NATIVE_SUPPORTED_EXTENSIONS.has(ext))
|
|
221
|
+
return true;
|
|
222
|
+
// Native files: only include when Rust wrote dataflow edges for them.
|
|
223
|
+
return filesWithDataflow.has(f);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
// Split files into two buckets:
|
|
227
|
+
// nativeDataflow — Rust extracted data (vertex-only pass; edges already in DB)
|
|
228
|
+
// wasmStubs — Rust returned null (WASM will handle edges + vertices)
|
|
229
|
+
const nativeDataflow = new Map();
|
|
230
|
+
const wasmStubs = new Map();
|
|
231
|
+
for (const relPath of filesToProcess) {
|
|
232
|
+
const absPath = path.join(ctx.rootDir, relPath);
|
|
233
|
+
const source = readFileSafe(absPath);
|
|
234
|
+
if (!source)
|
|
235
|
+
continue;
|
|
236
|
+
let result = null;
|
|
237
|
+
try {
|
|
238
|
+
result = native.extractDataflowAnalysis(source, absPath);
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
// Language-specific parse failure — fall through to WASM.
|
|
242
|
+
}
|
|
243
|
+
if (result) {
|
|
244
|
+
// Normalise the native DataflowResult: Rust emits `bindingType: string | null`
|
|
245
|
+
// (flat) while the TS dataflow layer expects `binding: { type, index? }` (object).
|
|
246
|
+
// patchNativeResult handles this via patchDataflow for the full parse path;
|
|
247
|
+
// extractDataflowAnalysis is a vertex-only fast path that bypasses patchNativeResult,
|
|
248
|
+
// so we apply the same normalisation here.
|
|
249
|
+
patchDataflowResult(result);
|
|
250
|
+
nativeDataflow.set(relPath, result);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// Rust has no dataflow rules for this language; WASM fallback will handle
|
|
254
|
+
// both edge insertion and vertex extraction. Since Rust inserted 0 dataflow
|
|
255
|
+
// edges for these files, there is no risk of duplicates.
|
|
256
|
+
wasmStubs.set(relPath, { definitions: [], _langId: null, _tree: null });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const { buildExtToLangMap } = (await import('../../../../ast-analysis/shared.js'));
|
|
260
|
+
const { buildDataflowVerticesFromMap, buildDataflowEdges, collectCallerStitchCandidates, collectFuncIdsForFiles, } = (await import('../../../../features/dataflow.js'));
|
|
261
|
+
// Rust-supported languages: build vertices only (edges already written by Rust orchestrator).
|
|
262
|
+
if (nativeDataflow.size > 0) {
|
|
263
|
+
// P4: On incremental builds, unchanged caller files' arg_in edges were deleted when
|
|
264
|
+
// the changed files' param vertices were purged and recreated. Re-collect stitch
|
|
265
|
+
// candidates from those caller files so buildInterproceduralStitch can reconnect them.
|
|
266
|
+
// Skip on full builds (changedFiles absent/empty) — nativeDataflow covers all files.
|
|
267
|
+
let p4Candidates = [];
|
|
268
|
+
let p4Captures = [];
|
|
269
|
+
if (changedFiles && changedFiles.length > 0) {
|
|
270
|
+
const changedSet = new Set(changedFiles);
|
|
271
|
+
const totalFilesInDb = ctx.db.prepare(`SELECT COUNT(DISTINCT file) AS n FROM nodes`).get().n;
|
|
272
|
+
// Only run P4 when this is a real incremental build (not all files changed).
|
|
273
|
+
if (nativeDataflow.size < totalFilesInDb) {
|
|
274
|
+
const changedFuncIds = collectFuncIdsForFiles(ctx.db, changedSet);
|
|
275
|
+
if (changedFuncIds.length > 0) {
|
|
276
|
+
const extra = await collectCallerStitchCandidates(ctx.db, changedFuncIds, changedSet, ctx.rootDir, buildExtToLangMap(), null, // parsers — lazily loaded inside collectCallerStitchCandidates
|
|
277
|
+
null);
|
|
278
|
+
p4Candidates = extra.candidates;
|
|
279
|
+
p4Captures = extra.captures;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
const interCount = buildDataflowVerticesFromMap(ctx.db, nativeDataflow, p4Candidates.length > 0 ? p4Candidates : undefined, p4Captures.length > 0 ? p4Captures : undefined);
|
|
284
|
+
if (interCount > 0) {
|
|
285
|
+
info(`Dataflow (native orchestrator): ${interCount} inter-procedural edges inserted${p4Candidates.length > 0 ? ` (P4: ${p4Candidates.length} re-stitch candidate(s) from unchanged callers)` : ''}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Rust-unsupported languages: run the full WASM extraction (edges + vertices).
|
|
289
|
+
// wasmStubs entries have no `.dataflow` property, so the native bulk-insert
|
|
290
|
+
// fast path in buildDataflowEdges is always skipped for them — WASM runs
|
|
291
|
+
// both edge insertion and vertex extraction end-to-end.
|
|
292
|
+
if (wasmStubs.size > 0) {
|
|
293
|
+
await buildDataflowEdges(ctx.db, wasmStubs, ctx.rootDir);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* JS fallback for AST/complexity/CFG/dataflow analysis after native orchestrator.
|
|
298
|
+
* Used when the Rust addon doesn't include analysis persistence (older addon
|
|
299
|
+
* version) or when analysis failed on the Rust side.
|
|
300
|
+
*/
|
|
301
|
+
async function runPostNativeAnalysis(ctx, allFileSymbols, changedFiles) {
|
|
302
|
+
const timing = { astMs: 0, complexityMs: 0, cfgMs: 0, dataflowMs: 0 };
|
|
303
|
+
// Scope analysis fileSymbols to changed files only
|
|
304
|
+
let analysisFileSymbols;
|
|
305
|
+
if (changedFiles && changedFiles.length > 0) {
|
|
306
|
+
analysisFileSymbols = new Map();
|
|
307
|
+
for (const f of changedFiles) {
|
|
308
|
+
const entry = allFileSymbols.get(f);
|
|
309
|
+
if (entry)
|
|
310
|
+
analysisFileSymbols.set(f, entry);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
analysisFileSymbols = allFileSymbols;
|
|
315
|
+
}
|
|
316
|
+
// Reopen nativeDb for analysis features (suspend/resume WAL pattern).
|
|
317
|
+
const native = loadNative();
|
|
318
|
+
if (native?.NativeDatabase) {
|
|
319
|
+
try {
|
|
320
|
+
ctx.nativeDb = native.NativeDatabase.openReadWrite(ctx.dbPath);
|
|
321
|
+
if (ctx.engineOpts)
|
|
322
|
+
ctx.engineOpts.nativeDb = ctx.nativeDb;
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
ctx.nativeDb = undefined;
|
|
326
|
+
if (ctx.engineOpts)
|
|
327
|
+
ctx.engineOpts.nativeDb = undefined;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// Flush JS WAL pages once so Rust can see them, then no-op callbacks.
|
|
331
|
+
// Previously each feature called wal_checkpoint(TRUNCATE) individually
|
|
332
|
+
// (~68ms each × 3-4 features). One FULL checkpoint suffices.
|
|
333
|
+
if (ctx.nativeDb && ctx.engineOpts) {
|
|
334
|
+
ctx.db.pragma('wal_checkpoint(FULL)');
|
|
335
|
+
ctx.engineOpts.suspendJsDb = () => { };
|
|
336
|
+
ctx.engineOpts.resumeJsDb = () => { };
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
const { runAnalyses: runAnalysesFn } = (await import('../../../../ast-analysis/engine.js'));
|
|
340
|
+
const result = await runAnalysesFn(ctx.db, analysisFileSymbols, ctx.rootDir, ctx.opts, ctx.engineOpts);
|
|
341
|
+
timing.astMs = result.astMs ?? 0;
|
|
342
|
+
timing.complexityMs = result.complexityMs ?? 0;
|
|
343
|
+
timing.cfgMs = result.cfgMs ?? 0;
|
|
344
|
+
timing.dataflowMs = result.dataflowMs ?? 0;
|
|
345
|
+
}
|
|
346
|
+
catch (err) {
|
|
347
|
+
warn(`Analysis phases failed after native build: ${toErrorMessage(err)}`);
|
|
348
|
+
}
|
|
349
|
+
// Close nativeDb after analyses — TRUNCATE checkpoint flushes all Rust
|
|
350
|
+
// WAL writes so JS and external readers can see them. Runs once after
|
|
351
|
+
// all analysis features complete (not per-feature).
|
|
352
|
+
if (ctx.nativeDb) {
|
|
353
|
+
try {
|
|
354
|
+
ctx.nativeDb.exec('PRAGMA wal_checkpoint(TRUNCATE)');
|
|
355
|
+
}
|
|
356
|
+
catch {
|
|
357
|
+
/* ignore checkpoint errors */
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
ctx.nativeDb.close();
|
|
361
|
+
}
|
|
362
|
+
catch {
|
|
363
|
+
/* ignore close errors */
|
|
364
|
+
}
|
|
365
|
+
ctx.nativeDb = undefined;
|
|
366
|
+
if (ctx.engineOpts) {
|
|
367
|
+
ctx.engineOpts.nativeDb = undefined;
|
|
368
|
+
ctx.engineOpts.suspendJsDb = undefined;
|
|
369
|
+
ctx.engineOpts.resumeJsDb = undefined;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return timing;
|
|
373
|
+
}
|
|
374
|
+
// ── CHA post-pass helpers ────────────────────────────────────────────────────
|
|
375
|
+
/** Build implementors map: parent/interface name → [child/implementing class names]. */
|
|
376
|
+
function buildChaImplementorsMap(db) {
|
|
377
|
+
const hierarchyRows = db
|
|
378
|
+
.prepare(`
|
|
379
|
+
SELECT src.name AS child_name, tgt.name AS parent_name
|
|
380
|
+
FROM edges e
|
|
381
|
+
JOIN nodes src ON e.source_id = src.id
|
|
382
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
383
|
+
WHERE e.kind IN ('extends', 'implements')
|
|
384
|
+
`)
|
|
385
|
+
.all();
|
|
386
|
+
const implementors = new Map();
|
|
387
|
+
for (const row of hierarchyRows) {
|
|
388
|
+
let list = implementors.get(row.parent_name);
|
|
389
|
+
if (!list) {
|
|
390
|
+
list = [];
|
|
391
|
+
implementors.set(row.parent_name, list);
|
|
392
|
+
}
|
|
393
|
+
if (!list.includes(row.child_name))
|
|
394
|
+
list.push(row.child_name);
|
|
395
|
+
}
|
|
396
|
+
return implementors;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Build RTA set: class names actually instantiated via `new X()`.
|
|
400
|
+
* Primary query targets `class`-kind nodes (the canonical schema).
|
|
401
|
+
* Fallback also matches `constructor`/`function`-kind nodes because some native
|
|
402
|
+
* engine versions record constructor calls against those kinds instead of `class`.
|
|
403
|
+
* Returns `{ instantiated, noRtaEvidence }` where `noRtaEvidence` means no
|
|
404
|
+
* constructor-call evidence exists — skip RTA filtering so interface dispatch
|
|
405
|
+
* still produces edges.
|
|
406
|
+
*/
|
|
407
|
+
function buildChaRtaSet(db) {
|
|
408
|
+
let rtaRows = db
|
|
409
|
+
.prepare(`
|
|
410
|
+
SELECT DISTINCT tgt.name
|
|
411
|
+
FROM edges e
|
|
412
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
413
|
+
WHERE e.kind = 'calls' AND tgt.kind = 'class'
|
|
414
|
+
`)
|
|
415
|
+
.all();
|
|
416
|
+
if (rtaRows.length === 0) {
|
|
417
|
+
// Fallback: try constructor/function-kind nodes for older native engine schemas
|
|
418
|
+
rtaRows = db
|
|
419
|
+
.prepare(`
|
|
420
|
+
SELECT DISTINCT tgt.name
|
|
421
|
+
FROM edges e
|
|
422
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
423
|
+
WHERE e.kind = 'calls' AND tgt.kind IN ('constructor', 'function')
|
|
424
|
+
AND INSTR(tgt.name, '.') = 0
|
|
425
|
+
`)
|
|
426
|
+
.all();
|
|
427
|
+
}
|
|
428
|
+
const instantiated = new Set(rtaRows.map((r) => r.name));
|
|
429
|
+
const noRtaEvidence = instantiated.size === 0;
|
|
430
|
+
if (noRtaEvidence) {
|
|
431
|
+
debug('runPostNativeCha: no constructor-call evidence found — proceeding without RTA filter');
|
|
432
|
+
}
|
|
433
|
+
return { instantiated, noRtaEvidence };
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Determine CHA candidate scope for incremental builds.
|
|
437
|
+
*
|
|
438
|
+
* Gate A: did a changed file add/change a class hierarchy node?
|
|
439
|
+
* A new `extends`/`implements` edge means a previously-untracked implementor
|
|
440
|
+
* is now in the hierarchy — unchanged call sites in OTHER files may gain new
|
|
441
|
+
* valid expansions, so the full scan is required.
|
|
442
|
+
* Note: *removed* class nodes are safe — Rust's `purge_changed_files` runs
|
|
443
|
+
* before this post-pass and deletes stale nodes and their hierarchy edges, so
|
|
444
|
+
* Gate A queries the post-purge DB. A deleted class returns no row here, which
|
|
445
|
+
* is correct: its stale CHA edges were already cleaned up by the Rust purge.
|
|
446
|
+
*
|
|
447
|
+
* Gate B: did a changed file add new RTA evidence (`new ConcreteX()`)?
|
|
448
|
+
* A new `calls` edge to a class/constructor/function-kind target means the
|
|
449
|
+
* instantiated set grew — previously RTA-filtered expansions in unchanged
|
|
450
|
+
* caller files become admissible, so the full scan is required.
|
|
451
|
+
* (`constructor`/`function` cover the older native engine fallback schema.)
|
|
452
|
+
*
|
|
453
|
+
* Returns `true` when the scan should be scoped to changed-file sources only.
|
|
454
|
+
* Returns `false` (full scan) when changedFiles is null, empty, or either gate fires.
|
|
455
|
+
*/
|
|
456
|
+
function computeChaScope(db, changedFiles) {
|
|
457
|
+
if (changedFiles === null || changedFiles.length === 0)
|
|
458
|
+
return false;
|
|
459
|
+
const CHUNK_SIZE = 500;
|
|
460
|
+
let gateAFired = false;
|
|
461
|
+
for (let i = 0; i < changedFiles.length && !gateAFired; i += CHUNK_SIZE) {
|
|
462
|
+
const chunk = changedFiles.slice(i, i + CHUNK_SIZE);
|
|
463
|
+
const ph = chunk.map(() => '?').join(',');
|
|
464
|
+
const row = db
|
|
465
|
+
.prepare(`SELECT 1 FROM nodes
|
|
466
|
+
WHERE file IN (${ph})
|
|
467
|
+
AND kind IN ('class', 'interface', 'trait', 'struct', 'record')
|
|
468
|
+
LIMIT 1`)
|
|
469
|
+
.get(...chunk);
|
|
470
|
+
if (row)
|
|
471
|
+
gateAFired = true;
|
|
472
|
+
}
|
|
473
|
+
let gateBFired = false;
|
|
474
|
+
if (!gateAFired) {
|
|
475
|
+
for (let i = 0; i < changedFiles.length && !gateBFired; i += CHUNK_SIZE) {
|
|
476
|
+
const chunk = changedFiles.slice(i, i + CHUNK_SIZE);
|
|
477
|
+
const ph = chunk.map(() => '?').join(',');
|
|
478
|
+
const row = db
|
|
479
|
+
.prepare(`SELECT 1 FROM edges e
|
|
480
|
+
JOIN nodes src ON e.source_id = src.id
|
|
481
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
482
|
+
WHERE e.kind = 'calls'
|
|
483
|
+
AND tgt.kind IN ('class', 'interface', 'trait', 'struct', 'record', 'constructor', 'function')
|
|
484
|
+
AND src.file IN (${ph})
|
|
485
|
+
LIMIT 1`)
|
|
486
|
+
.get(...chunk);
|
|
487
|
+
if (row)
|
|
488
|
+
gateBFired = true;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (!gateAFired && !gateBFired) {
|
|
492
|
+
debug(`runPostNativeCha: neither gate fired — scoping candidate scan to ${changedFiles.length} changed file(s)`);
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
debug(`runPostNativeCha: ${gateAFired ? 'Gate A (hierarchy)' : 'Gate B (RTA)'} fired — running full scan`);
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Fetch call→method rows that are candidates for CHA expansion.
|
|
500
|
+
* When `scopeToChangedFiles` is true, restricts to source nodes in `changedFiles`.
|
|
501
|
+
*/
|
|
502
|
+
function fetchChaCallToMethods(db, changedFiles, scopeToChangedFiles) {
|
|
503
|
+
if (scopeToChangedFiles && changedFiles && changedFiles.length > 0) {
|
|
504
|
+
const CHUNK_SIZE = 500;
|
|
505
|
+
const rows = [];
|
|
506
|
+
for (let i = 0; i < changedFiles.length; i += CHUNK_SIZE) {
|
|
507
|
+
const chunk = changedFiles.slice(i, i + CHUNK_SIZE);
|
|
508
|
+
const ph = chunk.map(() => '?').join(',');
|
|
509
|
+
const chunkRows = db
|
|
510
|
+
.prepare(`SELECT e.source_id, src.name AS caller_name, tgt.name AS method_name, src.file AS caller_file
|
|
511
|
+
FROM edges e
|
|
512
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
513
|
+
JOIN nodes src ON e.source_id = src.id
|
|
514
|
+
WHERE e.kind = 'calls' AND tgt.kind = 'method'
|
|
515
|
+
AND INSTR(tgt.name, '.') > 0
|
|
516
|
+
AND (e.technique IS NULL OR e.technique != 'cha-expanded')
|
|
517
|
+
AND src.file IN (${ph})`)
|
|
518
|
+
.all(...chunk);
|
|
519
|
+
rows.push(...chunkRows);
|
|
520
|
+
}
|
|
521
|
+
return rows;
|
|
522
|
+
}
|
|
523
|
+
return db
|
|
524
|
+
.prepare(`
|
|
525
|
+
SELECT e.source_id, src.name AS caller_name, tgt.name AS method_name, src.file AS caller_file
|
|
526
|
+
FROM edges e
|
|
527
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
528
|
+
JOIN nodes src ON e.source_id = src.id
|
|
529
|
+
WHERE e.kind = 'calls' AND tgt.kind = 'method'
|
|
530
|
+
AND INSTR(tgt.name, '.') > 0
|
|
531
|
+
AND (e.technique IS NULL OR e.technique != 'cha-expanded')
|
|
532
|
+
`)
|
|
533
|
+
.all();
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* BFS-expand CHA call edges and insert new edges into the DB.
|
|
537
|
+
* Returns `{ newEdgeCount, affectedFiles }` for role re-classification scoping.
|
|
538
|
+
*/
|
|
539
|
+
function expandChaEdges(db, callToMethods, implementors, instantiated, noRtaEvidence) {
|
|
540
|
+
const affectedFiles = new Set();
|
|
541
|
+
// Seed seen-pairs only from the source_ids we'll be expanding — avoids loading every
|
|
542
|
+
// call edge in the DB (which would be O(all edges)) for large codebases.
|
|
543
|
+
const seen = new Set();
|
|
544
|
+
if (callToMethods.length > 0) {
|
|
545
|
+
const sourceIds = [...new Set(callToMethods.map((r) => r.source_id))];
|
|
546
|
+
const CHUNK_SIZE = 500;
|
|
547
|
+
for (let i = 0; i < sourceIds.length; i += CHUNK_SIZE) {
|
|
548
|
+
const chunk = sourceIds.slice(i, i + CHUNK_SIZE);
|
|
549
|
+
const placeholders = chunk.map(() => '?').join(',');
|
|
550
|
+
const existingPairs = db
|
|
551
|
+
.prepare(`SELECT source_id, target_id FROM edges WHERE kind = 'calls' AND source_id IN (${placeholders})`)
|
|
552
|
+
.all(...chunk);
|
|
553
|
+
for (const e of existingPairs)
|
|
554
|
+
seen.add(`${e.source_id}|${e.target_id}`);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
// No LIMIT: multiple files can define the same qualified name in a monorepo.
|
|
558
|
+
const findMethodStmt = db.prepare(`SELECT id, file AS method_file FROM nodes WHERE name = ? AND kind = 'method'`);
|
|
559
|
+
const newEdges = [];
|
|
560
|
+
let newEdgeCount = 0;
|
|
561
|
+
for (const { source_id, method_name, caller_file } of callToMethods) {
|
|
562
|
+
const dotIdx = method_name.indexOf('.');
|
|
563
|
+
if (dotIdx === -1)
|
|
564
|
+
continue;
|
|
565
|
+
const typeName = method_name.slice(0, dotIdx);
|
|
566
|
+
const methodSuffix = method_name.slice(dotIdx + 1);
|
|
567
|
+
// BFS over the implementors map — handles multi-level hierarchies where
|
|
568
|
+
// abstract/non-instantiated classes sit between the call-site type and
|
|
569
|
+
// the concrete leaf implementations (issue #1311).
|
|
570
|
+
const bfsQueue = [typeName];
|
|
571
|
+
const bfsVisited = new Set([typeName]);
|
|
572
|
+
while (bfsQueue.length > 0) {
|
|
573
|
+
const current = bfsQueue.shift();
|
|
574
|
+
const children = implementors.get(current);
|
|
575
|
+
if (!children?.length)
|
|
576
|
+
continue;
|
|
577
|
+
for (const cls of children) {
|
|
578
|
+
if (bfsVisited.has(cls))
|
|
579
|
+
continue;
|
|
580
|
+
bfsVisited.add(cls);
|
|
581
|
+
if (noRtaEvidence || instantiated.has(cls)) {
|
|
582
|
+
const qualifiedName = `${cls}.${methodSuffix}`;
|
|
583
|
+
const methodNodes = findMethodStmt.all(qualifiedName);
|
|
584
|
+
for (const methodNode of methodNodes) {
|
|
585
|
+
if (methodNode.id === source_id)
|
|
586
|
+
continue; // skip self-loops
|
|
587
|
+
const key = `${source_id}|${methodNode.id}`;
|
|
588
|
+
if (seen.has(key))
|
|
589
|
+
continue;
|
|
590
|
+
seen.add(key);
|
|
591
|
+
const conf = CHA_TYPED_DISPATCH_CONFIDENCE;
|
|
592
|
+
newEdges.push([source_id, methodNode.id, 'calls', conf, 0, 'cha-expanded']);
|
|
593
|
+
newEdgeCount++;
|
|
594
|
+
if (caller_file)
|
|
595
|
+
affectedFiles.add(caller_file);
|
|
596
|
+
if (methodNode.method_file)
|
|
597
|
+
affectedFiles.add(methodNode.method_file);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
// Always traverse children — non-instantiated classes may have instantiated subclasses.
|
|
601
|
+
bfsQueue.push(cls);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (newEdges.length > 0) {
|
|
606
|
+
db.transaction(() => batchInsertEdges(db, newEdges))();
|
|
607
|
+
// Account for post-pass edges excluded from the build summary line (#1452),
|
|
608
|
+
// mirroring the this/super dispatch post-pass insertion log.
|
|
609
|
+
debug(`CHA expansion post-pass: inserted ${newEdgeCount} edge(s)`);
|
|
610
|
+
}
|
|
611
|
+
return { newEdgeCount, affectedFiles };
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Phase 8.6: CHA expansion post-pass for the native orchestrator path.
|
|
615
|
+
*
|
|
616
|
+
* The Rust build pipeline resolves typed receiver calls (e.g. `worker.doWork()`
|
|
617
|
+
* where `worker: IWorker`) to the interface method declaration only. This
|
|
618
|
+
* post-pass reads the class hierarchy (via `implements`/`extends` edges) and
|
|
619
|
+
* instantiated types (via `calls` edges to class nodes) from the DB and expands
|
|
620
|
+
* each call to an interface/abstract method to ALL RTA-filtered concrete
|
|
621
|
+
* implementations.
|
|
622
|
+
*
|
|
623
|
+
* Note: `this`/`super` dispatch is handled separately by `runPostNativeThisDispatch`,
|
|
624
|
+
* which WASM-re-parses JS/TS files to obtain raw call site receiver info.
|
|
625
|
+
*
|
|
626
|
+
* `changedFiles` controls candidate scoping on incremental builds:
|
|
627
|
+
* - null → full build; scan all call→method edges (existing behaviour).
|
|
628
|
+
* - array → incremental; two cheap gate queries decide scope:
|
|
629
|
+
* Gate A: any class/interface/trait/struct/record nodes in changed files?
|
|
630
|
+
* If yes, a new implementor may have appeared — full scan required.
|
|
631
|
+
* Gate B: any `calls` edges from changed-file sources targeting
|
|
632
|
+
* class/constructor/function-kind nodes? If yes, the RTA set may
|
|
633
|
+
* have grown (also covers the older-schema fallback where
|
|
634
|
+
* constructor calls target `constructor`/`function` nodes instead
|
|
635
|
+
* of `class` nodes) — full scan required.
|
|
636
|
+
* If neither gate fires: scope `callToMethods` to `src.file IN changedFiles`
|
|
637
|
+
* (safe because no hierarchy or RTA evidence changed).
|
|
638
|
+
*
|
|
639
|
+
* Returns the count of newly inserted CHA edges plus the set of files containing
|
|
640
|
+
* the new edges' endpoints, so the caller can scope role re-classification to the
|
|
641
|
+
* nodes whose fan-in/out actually changed. A zero count means no edges were added
|
|
642
|
+
* and role re-classification is unnecessary.
|
|
643
|
+
*/
|
|
644
|
+
function runPostNativeCha(db, changedFiles) {
|
|
645
|
+
const affectedFiles = new Set();
|
|
646
|
+
const empty = { newEdgeCount: 0, affectedFiles };
|
|
647
|
+
// Fast guard: no hierarchy edges → no CHA work
|
|
648
|
+
const hasHierarchy = db
|
|
649
|
+
.prepare(`SELECT 1 FROM edges WHERE kind IN ('extends', 'implements') LIMIT 1`)
|
|
650
|
+
.get();
|
|
651
|
+
if (!hasHierarchy)
|
|
652
|
+
return empty;
|
|
653
|
+
const implementors = buildChaImplementorsMap(db);
|
|
654
|
+
if (implementors.size === 0)
|
|
655
|
+
return empty;
|
|
656
|
+
const { instantiated, noRtaEvidence } = buildChaRtaSet(db);
|
|
657
|
+
const scopeToChangedFiles = computeChaScope(db, changedFiles);
|
|
658
|
+
const callToMethods = fetchChaCallToMethods(db, changedFiles, scopeToChangedFiles);
|
|
659
|
+
return expandChaEdges(db, callToMethods, implementors, instantiated, noRtaEvidence);
|
|
660
|
+
}
|
|
661
|
+
// Extensions where `this`/`super` dispatch can occur (JS/TS family)
|
|
662
|
+
const THIS_DISPATCH_EXTS = new Set(['.js', '.ts', '.tsx', '.jsx', '.mjs', '.cjs', '.mts', '.cts']);
|
|
663
|
+
// ── this/super dispatch post-pass helpers ───────────────────────────────────
|
|
664
|
+
/**
|
|
665
|
+
* Build parents map: child class → direct parent class (from `extends` edges).
|
|
666
|
+
* May be empty when only func-prop methods exist (no class inheritance) —
|
|
667
|
+
* resolveThisDispatch handles that case via direct class-prefix lookup.
|
|
668
|
+
*/
|
|
669
|
+
function buildThisDispatchParentsMap(db, hasExtends) {
|
|
670
|
+
const parents = new Map();
|
|
671
|
+
if (!hasExtends)
|
|
672
|
+
return parents;
|
|
673
|
+
const parentRows = db
|
|
674
|
+
.prepare(`
|
|
675
|
+
SELECT src.name AS child_name, tgt.name AS parent_name
|
|
676
|
+
FROM edges e
|
|
677
|
+
JOIN nodes src ON e.source_id = src.id
|
|
678
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
679
|
+
WHERE e.kind = 'extends'
|
|
680
|
+
`)
|
|
681
|
+
.all();
|
|
682
|
+
for (const row of parentRows) {
|
|
683
|
+
if (!parents.has(row.child_name))
|
|
684
|
+
parents.set(row.child_name, row.parent_name);
|
|
685
|
+
}
|
|
686
|
+
return parents;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Determine the set of relative file paths to re-parse for this/super dispatch.
|
|
690
|
+
*
|
|
691
|
+
* On a full build we do NOT re-parse every JS/TS file — that would WASM-parse
|
|
692
|
+
* the entire project on top of the native pass, causing a massive regression
|
|
693
|
+
* (measured: +358% ms/file on codegraph itself). Instead we restrict to files
|
|
694
|
+
* that are part of the class inheritance hierarchy OR that contain dot-named
|
|
695
|
+
* method nodes (func-prop assignments whose bodies may call `this.sibling()`).
|
|
696
|
+
*/
|
|
697
|
+
function selectThisDispatchFiles(db, changedFiles, isFullBuild) {
|
|
698
|
+
if (isFullBuild || !changedFiles) {
|
|
699
|
+
const rows = db
|
|
700
|
+
.prepare(`
|
|
701
|
+
SELECT DISTINCT file FROM (
|
|
702
|
+
SELECT src.file AS file
|
|
703
|
+
FROM edges e
|
|
704
|
+
JOIN nodes src ON e.source_id = src.id
|
|
705
|
+
WHERE e.kind = 'extends' AND src.file IS NOT NULL
|
|
706
|
+
UNION
|
|
707
|
+
SELECT tgt.file AS file
|
|
708
|
+
FROM edges e
|
|
709
|
+
JOIN nodes tgt ON e.target_id = tgt.id
|
|
710
|
+
WHERE e.kind = 'extends' AND tgt.file IS NOT NULL
|
|
711
|
+
UNION
|
|
712
|
+
-- Files with func-prop method definitions (e.g. f.h = function(){this.g()}).
|
|
713
|
+
-- Only include files where the method's owner prefix is NOT a known class name —
|
|
714
|
+
-- this keeps the re-parse set small (func-prop files only, not all class-method files).
|
|
715
|
+
-- AND name IS NOT NULL guards the NOT IN sub-select: if any class node had a NULL
|
|
716
|
+
-- name the entire NOT IN clause would silently return no rows (SQL NULL semantics).
|
|
717
|
+
SELECT n.file AS file
|
|
718
|
+
FROM nodes n
|
|
719
|
+
WHERE n.kind = 'method'
|
|
720
|
+
AND INSTR(n.name, '.') > 0
|
|
721
|
+
AND n.file IS NOT NULL
|
|
722
|
+
AND SUBSTR(n.name, 1, INSTR(n.name, '.') - 1) NOT IN (
|
|
723
|
+
SELECT name FROM nodes WHERE kind IN ('class', 'struct', 'interface', 'type')
|
|
724
|
+
AND name IS NOT NULL
|
|
725
|
+
)
|
|
726
|
+
)
|
|
727
|
+
`)
|
|
728
|
+
.all();
|
|
729
|
+
return rows
|
|
730
|
+
.map((r) => r.file)
|
|
731
|
+
.filter((f) => THIS_DISPATCH_EXTS.has(path.extname(f).toLowerCase()));
|
|
732
|
+
}
|
|
733
|
+
// NOTE: Only files explicitly listed in changedFiles are re-parsed.
|
|
734
|
+
// If a parent-class method is replaced (new node ID) but the child file is
|
|
735
|
+
// unchanged, the stale super.method() edge is not refreshed here. A full
|
|
736
|
+
// rebuild (isFullBuild=true) is required to recover in that scenario.
|
|
737
|
+
return changedFiles.filter((f) => THIS_DISPATCH_EXTS.has(path.extname(f).toLowerCase()));
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Re-parse files via native (preferred) + WASM fallback to obtain call sites
|
|
741
|
+
* with receiver info. Returns a map of relPath → calls array.
|
|
742
|
+
*
|
|
743
|
+
* The native engine is preferred: this pass only runs after a native
|
|
744
|
+
* orchestrator build, so the addon is already loaded and re-parses the
|
|
745
|
+
* hierarchy file set in single-digit milliseconds with the same
|
|
746
|
+
* receiver-annotated call sites as the WASM extractor. Booting the WASM
|
|
747
|
+
* runtime here instead cost ~40–110ms per full build (in-process
|
|
748
|
+
* web-tree-sitter + grammar init dominated) — part of the v3.12.0
|
|
749
|
+
* publish-gate regression. Files the native engine cannot parse (extension
|
|
750
|
+
* outside NATIVE_SUPPORTED_EXTENSIONS, e.g. .mts/.cts) and native parse
|
|
751
|
+
* failures fall back to the WASM backfill path so the sweep stays complete.
|
|
752
|
+
*/
|
|
753
|
+
async function parseFilesForThisDispatch(absFiles, rootDir) {
|
|
754
|
+
const callsByRel = new Map();
|
|
755
|
+
const nativeAbs = absFiles.filter((f) => NATIVE_SUPPORTED_EXTENSIONS.has(path.extname(f).toLowerCase()));
|
|
756
|
+
// Track native-supported files that returned null (per-file parse error) so
|
|
757
|
+
// they can be included in the WASM fallback set below, ensuring no file's
|
|
758
|
+
// this/super call sites are silently discarded.
|
|
759
|
+
const nativeNullFiles = new Set();
|
|
760
|
+
let nativeParsed = false;
|
|
761
|
+
if (nativeAbs.length > 0) {
|
|
762
|
+
const native = loadNative();
|
|
763
|
+
if (native) {
|
|
764
|
+
try {
|
|
765
|
+
const results = native.parseFiles(nativeAbs, rootDir, false, false);
|
|
766
|
+
for (let i = 0; i < results.length; i++) {
|
|
767
|
+
const r = results[i];
|
|
768
|
+
if (!r) {
|
|
769
|
+
// Per-file parse failure — fall back to WASM for this file.
|
|
770
|
+
const abs = nativeAbs[i];
|
|
771
|
+
if (abs)
|
|
772
|
+
nativeNullFiles.add(abs);
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
callsByRel.set(normalizePath(path.relative(rootDir, r.file)), r.calls ?? []);
|
|
776
|
+
}
|
|
777
|
+
nativeParsed = true;
|
|
778
|
+
}
|
|
779
|
+
catch (e) {
|
|
780
|
+
debug(`this-dispatch native re-parse failed, falling back to WASM: ${toErrorMessage(e)}`);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
// WASM handles: (a) non-native extensions (e.g. .mts/.cts), (b) the entire
|
|
785
|
+
// file list when the native batch threw, and (c) individual files where the
|
|
786
|
+
// native addon returned null (per-file parse error).
|
|
787
|
+
const wasmAbs = nativeParsed
|
|
788
|
+
? [
|
|
789
|
+
...absFiles.filter((f) => !NATIVE_SUPPORTED_EXTENSIONS.has(path.extname(f).toLowerCase())),
|
|
790
|
+
...nativeNullFiles,
|
|
791
|
+
]
|
|
792
|
+
: absFiles;
|
|
793
|
+
const wasmResults = wasmAbs.length > 0
|
|
794
|
+
? await parseFilesWasmForBackfill(wasmAbs, rootDir, { symbolsOnly: true })
|
|
795
|
+
: new Map();
|
|
796
|
+
for (const [relPath, symbols] of wasmResults) {
|
|
797
|
+
callsByRel.set(relPath, symbols.calls ?? []);
|
|
798
|
+
}
|
|
799
|
+
return { callsByRel, wasmResults };
|
|
800
|
+
}
|
|
801
|
+
/** Emit this/super dispatch edges from re-parsed call sites. */
|
|
802
|
+
function emitThisDispatchEdges(db, callsByRel, chaCtx, lookup, seen) {
|
|
803
|
+
// Find the innermost containing method/function for a call at `line` in `file`.
|
|
804
|
+
// COALESCE maps NULL end_line to a large sentinel so unbounded nodes sort last
|
|
805
|
+
// (SQLite ASC orders NULLs first, so a raw `end_line - line` would pick them first).
|
|
806
|
+
const findCallerByLineStmt = db.prepare(`
|
|
807
|
+
SELECT id, name FROM nodes
|
|
808
|
+
WHERE file = ? AND kind IN ('method', 'function')
|
|
809
|
+
AND line <= ? AND (end_line IS NULL OR end_line >= ?)
|
|
810
|
+
ORDER BY COALESCE(end_line - line, 999999999) ASC
|
|
811
|
+
LIMIT 1
|
|
812
|
+
`);
|
|
813
|
+
const newEdges = [];
|
|
814
|
+
const targetIds = new Set();
|
|
815
|
+
const affectedFiles = new Set();
|
|
816
|
+
for (const [relPath, calls] of callsByRel) {
|
|
817
|
+
for (const call of calls) {
|
|
818
|
+
// Only 'this' and 'super' are class-instance receivers in JS/TS.
|
|
819
|
+
// 'self' refers to WindowOrWorkerGlobalScope — not a class instance — so
|
|
820
|
+
// filtering it here prevents spurious dispatch edges from Worker call sites.
|
|
821
|
+
if (call.receiver !== 'this' && call.receiver !== 'super')
|
|
822
|
+
continue;
|
|
823
|
+
const callerRow = findCallerByLineStmt.get(relPath, call.line, call.line);
|
|
824
|
+
if (!callerRow)
|
|
825
|
+
continue;
|
|
826
|
+
const targets = resolveThisDispatch(call.name, callerRow.name, call.receiver, chaCtx, lookup, relPath);
|
|
827
|
+
for (const t of targets) {
|
|
828
|
+
if (t.id === callerRow.id)
|
|
829
|
+
continue; // skip self-loops
|
|
830
|
+
const key = `${callerRow.id}|${t.id}`;
|
|
831
|
+
if (seen.has(key))
|
|
832
|
+
continue;
|
|
833
|
+
seen.add(key);
|
|
834
|
+
const conf = computeConfidence(relPath, t.file, null) - CHA_DISPATCH_PENALTY;
|
|
835
|
+
if (conf <= 0)
|
|
836
|
+
continue;
|
|
837
|
+
// Tag super-dispatch edges distinctly so runPostNativeCha can exclude them
|
|
838
|
+
// from further CHA expansion (super calls are not virtual dispatch).
|
|
839
|
+
const technique = call.receiver === 'super' ? 'super-dispatch' : 'cha';
|
|
840
|
+
newEdges.push([callerRow.id, t.id, 'calls', conf, 0, technique]);
|
|
841
|
+
targetIds.add(t.id);
|
|
842
|
+
affectedFiles.add(relPath);
|
|
843
|
+
if (t.file)
|
|
844
|
+
affectedFiles.add(t.file);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return { newEdges, targetIds, affectedFiles };
|
|
849
|
+
}
|
|
850
|
+
/** Free WASM parse trees after this-dispatch post-pass to prevent memory leaks. */
|
|
851
|
+
function cleanupThisDispatchWasmTrees(wasmResults) {
|
|
852
|
+
for (const [, symbols] of wasmResults) {
|
|
853
|
+
const tree = symbols._tree;
|
|
854
|
+
if (tree && typeof tree.delete === 'function') {
|
|
855
|
+
try {
|
|
856
|
+
tree.delete();
|
|
857
|
+
}
|
|
858
|
+
catch {
|
|
859
|
+
/* ignore cleanup errors */
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
symbols._tree = undefined;
|
|
863
|
+
symbols._langId = undefined;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Phase 8.5: this/super dispatch post-pass for the native orchestrator path.
|
|
868
|
+
*
|
|
869
|
+
* The Rust build pipeline resolves typed receiver calls but does NOT persist raw
|
|
870
|
+
* unresolved call site receiver info (e.g. `this`, `super`) to the DB. This
|
|
871
|
+
* hybrid post-pass re-parses JS/TS/TSX files via WASM to collect call sites with
|
|
872
|
+
* `this`/`super` receivers, then resolves them through the class hierarchy stored
|
|
873
|
+
* in DB `extends` edges — mirroring what `buildChaPostPass` does on the WASM path.
|
|
874
|
+
*
|
|
875
|
+
* Also handles function-as-object-property methods (`f.h = function() { this.g() }`):
|
|
876
|
+
* these use `this` to reference sibling properties on the same object (`f`), so
|
|
877
|
+
* `resolveThisDispatch` resolves them by treating the dot-prefix of the caller name
|
|
878
|
+
* (`f` from `f.h`) as the class and looking up `f.g` directly — no `extends` edge needed.
|
|
879
|
+
*
|
|
880
|
+
* Runs when either `extends` edges exist (class inheritance) OR dot-named `method`
|
|
881
|
+
* nodes exist (func-prop assignments); skips only when neither is present.
|
|
882
|
+
*/
|
|
883
|
+
async function runPostNativeThisDispatch(db, rootDir, changedFiles, isFullBuild) {
|
|
884
|
+
const t0 = performance.now();
|
|
885
|
+
// Fast guard: need at least one extends edge (class inheritance) OR a dot-named
|
|
886
|
+
// method node (func-prop assignment: `f.h = function() { this.g() }`) for
|
|
887
|
+
// this/super dispatch to produce any edges.
|
|
888
|
+
const hasExtends = db.prepare(`SELECT 1 FROM edges WHERE kind = 'extends' LIMIT 1`).get();
|
|
889
|
+
const hasFuncPropMethod = db
|
|
890
|
+
.prepare(`SELECT 1 FROM nodes WHERE kind = 'method' AND INSTR(name, '.') > 0 LIMIT 1`)
|
|
891
|
+
.get();
|
|
892
|
+
const emptyResult = {
|
|
893
|
+
elapsedMs: 0,
|
|
894
|
+
targetIds: new Set(),
|
|
895
|
+
affectedFiles: new Set(),
|
|
896
|
+
};
|
|
897
|
+
if (!hasExtends && !hasFuncPropMethod)
|
|
898
|
+
return emptyResult;
|
|
899
|
+
const parents = buildThisDispatchParentsMap(db, hasExtends);
|
|
900
|
+
// Note: parents may be empty when hasFuncPropMethod but !hasExtends — that is
|
|
901
|
+
// intentional. resolveThisDispatch still resolves `this.g()` inside `f.h` by
|
|
902
|
+
// treating `f` (the dot-prefix of callerName `f.h`) as the class and looking
|
|
903
|
+
// up `f.g` directly via lookup.byName(), without traversing the parents chain.
|
|
904
|
+
const chaCtx = {
|
|
905
|
+
implementors: new Map(), // not needed for this/super resolution
|
|
906
|
+
parents,
|
|
907
|
+
instantiatedTypes: new Set(), // not needed for this/super resolution
|
|
908
|
+
};
|
|
909
|
+
const relFiles = selectThisDispatchFiles(db, changedFiles, isFullBuild);
|
|
910
|
+
if (relFiles.length === 0)
|
|
911
|
+
return emptyResult;
|
|
912
|
+
// DB-backed CallNodeLookup — resolveThisDispatch only calls byName()
|
|
913
|
+
const findByNameStmt = db.prepare(`SELECT id, file, kind FROM nodes WHERE name = ?`);
|
|
914
|
+
const lookup = {
|
|
915
|
+
byName: (name) => findByNameStmt.all(name),
|
|
916
|
+
byNameAndFile: (name, file) => findByNameStmt.all(name).filter((n) => n.file === file),
|
|
917
|
+
isBarrel: () => false,
|
|
918
|
+
resolveBarrel: () => null,
|
|
919
|
+
nodeId: () => undefined,
|
|
920
|
+
};
|
|
921
|
+
// Seed seen-pairs from existing call edges on source nodes in our file set
|
|
922
|
+
const seen = new Set();
|
|
923
|
+
const CHUNK = 500;
|
|
924
|
+
for (let i = 0; i < relFiles.length; i += CHUNK) {
|
|
925
|
+
const chunk = relFiles.slice(i, i + CHUNK);
|
|
926
|
+
const ph = chunk.map(() => '?').join(',');
|
|
927
|
+
const rows = db
|
|
928
|
+
.prepare(`SELECT e.source_id, e.target_id
|
|
929
|
+
FROM edges e
|
|
930
|
+
JOIN nodes n ON e.source_id = n.id
|
|
931
|
+
WHERE e.kind = 'calls' AND n.file IN (${ph})`)
|
|
932
|
+
.all(...chunk);
|
|
933
|
+
for (const r of rows)
|
|
934
|
+
seen.add(`${r.source_id}|${r.target_id}`);
|
|
935
|
+
}
|
|
936
|
+
const absFiles = relFiles.map((f) => path.join(rootDir, f));
|
|
937
|
+
const { callsByRel, wasmResults } = await parseFilesForThisDispatch(absFiles, rootDir);
|
|
938
|
+
const { newEdges, targetIds, affectedFiles } = emitThisDispatchEdges(db, callsByRel, chaCtx, lookup, seen);
|
|
939
|
+
if (newEdges.length > 0) {
|
|
940
|
+
db.transaction(() => batchInsertEdges(db, newEdges))();
|
|
941
|
+
debug(`this/super dispatch post-pass: inserted ${newEdges.length} edge(s)`);
|
|
942
|
+
}
|
|
943
|
+
cleanupThisDispatchWasmTrees(wasmResults);
|
|
944
|
+
return { elapsedMs: performance.now() - t0, targetIds, affectedFiles };
|
|
945
|
+
}
|
|
946
|
+
/** Format timing result from native orchestrator phases + JS post-processing. */
|
|
947
|
+
function formatNativeTimingResult(p, structurePatchMs, analysisTiming, postPass) {
|
|
948
|
+
return {
|
|
949
|
+
phases: {
|
|
950
|
+
setupMs: +(p.setupMs ?? 0).toFixed(1),
|
|
951
|
+
collectMs: +(p.collectMs ?? 0).toFixed(1),
|
|
952
|
+
detectMs: +(p.detectMs ?? 0).toFixed(1),
|
|
953
|
+
parseMs: +(p.parseMs ?? 0).toFixed(1),
|
|
954
|
+
insertMs: +(p.insertMs ?? 0).toFixed(1),
|
|
955
|
+
resolveMs: +(p.resolveMs ?? 0).toFixed(1),
|
|
956
|
+
edgesMs: +(p.edgesMs ?? 0).toFixed(1),
|
|
957
|
+
structureMs: +((p.structureMs ?? 0) + structurePatchMs).toFixed(1),
|
|
958
|
+
rolesMs: +(p.rolesMs ?? 0).toFixed(1),
|
|
959
|
+
gapDetectMs: +postPass.gapDetectMs.toFixed(1),
|
|
960
|
+
chaMs: +postPass.chaMs.toFixed(1),
|
|
961
|
+
thisDispatchMs: +postPass.thisDispatchMs.toFixed(1),
|
|
962
|
+
reclassifyMs: +postPass.reclassifyMs.toFixed(1),
|
|
963
|
+
techniqueBackfillMs: +postPass.techniqueBackfillMs.toFixed(1),
|
|
964
|
+
astMs: +(analysisTiming.astMs ?? 0).toFixed(1),
|
|
965
|
+
complexityMs: +(analysisTiming.complexityMs ?? 0).toFixed(1),
|
|
966
|
+
cfgMs: +(analysisTiming.cfgMs ?? 0).toFixed(1),
|
|
967
|
+
dataflowMs: +(analysisTiming.dataflowMs ?? 0).toFixed(1),
|
|
968
|
+
finalizeMs: +(p.finalizeMs ?? 0).toFixed(1),
|
|
969
|
+
},
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Compute the WASM-only files present in the DB but missing from disk (#1073).
|
|
974
|
+
*
|
|
975
|
+
* Returns relative paths that:
|
|
976
|
+
* - appear in `existingNodes` or `existingHashes` (in DB),
|
|
977
|
+
* - are absent from `expected` (not on disk),
|
|
978
|
+
* - have an extension installed for WASM, AND
|
|
979
|
+
* - have an extension NOT covered by `nativeSupported` — Rust's
|
|
980
|
+
* `purge_changed_files` handles deletion for natively-supported extensions
|
|
981
|
+
* via its own `detect_removed_files`, so the caller must not double-purge.
|
|
982
|
+
*
|
|
983
|
+
* Extensions are lowercased before lookup to match the registry and Rust's
|
|
984
|
+
* `LanguageKind::from_extension` (which normalises case for the languages
|
|
985
|
+
* where both cases are conventional, e.g. R's `.r` / `.R`).
|
|
986
|
+
*
|
|
987
|
+
* DB paths are forced to forward slashes before comparison with `expected`
|
|
988
|
+
* (which is always normalised). The on-disk invariant is that DB rows are
|
|
989
|
+
* written with forward slashes, but a stale row written by older code on
|
|
990
|
+
* Windows could carry back-slashes — normalising here makes the comparison
|
|
991
|
+
* platform-safe and prevents false-positive purges of live rows. We replace
|
|
992
|
+
* `\\` explicitly (rather than calling `normalizePath`, which only touches
|
|
993
|
+
* `path.sep`) so the defence works when running on POSIX against a DB that
|
|
994
|
+
* was migrated from Windows.
|
|
995
|
+
*
|
|
996
|
+
* Exported for unit testing.
|
|
997
|
+
*/
|
|
998
|
+
export function computeWasmOnlyStaleFiles(input) {
|
|
999
|
+
const { existingNodes, existingHashes, expected, installedExts, nativeSupported } = input;
|
|
1000
|
+
const stale = [];
|
|
1001
|
+
const seen = new Set();
|
|
1002
|
+
const consider = (rawRel) => {
|
|
1003
|
+
const rel = rawRel.replace(/\\/g, '/');
|
|
1004
|
+
if (expected.has(rel) || seen.has(rel))
|
|
1005
|
+
return;
|
|
1006
|
+
const ext = path.extname(rel).toLowerCase();
|
|
1007
|
+
if (nativeSupported.has(ext))
|
|
1008
|
+
return;
|
|
1009
|
+
if (!installedExts.has(ext))
|
|
1010
|
+
return;
|
|
1011
|
+
seen.add(rel);
|
|
1012
|
+
// Push the ORIGINAL raw path (not the normalised form) so the eventual
|
|
1013
|
+
// `DELETE FROM nodes WHERE file = ?` predicate in `purgeFilesData`
|
|
1014
|
+
// matches the actual stored row. The dedup `seen` set keeps the
|
|
1015
|
+
// normalised form so a file written once with `\` and once with `/`
|
|
1016
|
+
// is still treated as one entry — but the value the SQL sees has to
|
|
1017
|
+
// be byte-identical to what's on disk in the DB.
|
|
1018
|
+
stale.push(rawRel);
|
|
1019
|
+
};
|
|
1020
|
+
for (const rel of existingNodes)
|
|
1021
|
+
consider(rel);
|
|
1022
|
+
for (const rel of existingHashes)
|
|
1023
|
+
consider(rel);
|
|
1024
|
+
return stale;
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* Group relative paths by their lowercased extension. Shape matches the bucket
|
|
1028
|
+
* type that `formatDropExtensionSummary` consumes, so callers can render a
|
|
1029
|
+
* log-friendly per-extension summary without going through `classifyNativeDrops`
|
|
1030
|
+
* when the reason is already known (e.g. the stale-purge path where every path
|
|
1031
|
+
* is guaranteed `unsupported-by-native`).
|
|
1032
|
+
*/
|
|
1033
|
+
function groupByExtension(relPaths) {
|
|
1034
|
+
const buckets = new Map();
|
|
1035
|
+
for (const rel of relPaths) {
|
|
1036
|
+
const ext = path.extname(rel).toLowerCase();
|
|
1037
|
+
let list = buckets.get(ext);
|
|
1038
|
+
if (!list) {
|
|
1039
|
+
list = [];
|
|
1040
|
+
buckets.set(ext, list);
|
|
1041
|
+
}
|
|
1042
|
+
list.push(rel);
|
|
1043
|
+
}
|
|
1044
|
+
return buckets;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Return the subset of relative paths that are gitignored in `rootDir`.
|
|
1048
|
+
*
|
|
1049
|
+
* Runs `git check-ignore --stdin` with all candidate paths piped in. Any
|
|
1050
|
+
* path that git echoes back is gitignored. Fails silently (returns an empty
|
|
1051
|
+
* set) when git is unavailable, the directory is not a git repo, or the
|
|
1052
|
+
* check-ignore call throws — the gap-detection logic handles those cases
|
|
1053
|
+
* gracefully without this filter.
|
|
1054
|
+
*
|
|
1055
|
+
* Uses relative paths (forward-slash separated) as both input and output so
|
|
1056
|
+
* the result set can be matched directly against the `expected` set in
|
|
1057
|
+
* `detectDroppedLanguageGap` without any further path manipulation.
|
|
1058
|
+
*/
|
|
1059
|
+
function queryGitIgnoredFiles(rootDir, relPaths) {
|
|
1060
|
+
const ignored = new Set();
|
|
1061
|
+
const paths = [...relPaths];
|
|
1062
|
+
if (paths.length === 0)
|
|
1063
|
+
return ignored;
|
|
1064
|
+
try {
|
|
1065
|
+
const stdin = paths.join('\n');
|
|
1066
|
+
const output = execFileSync('git', ['check-ignore', '--stdin'], {
|
|
1067
|
+
cwd: rootDir,
|
|
1068
|
+
input: stdin,
|
|
1069
|
+
encoding: 'utf-8',
|
|
1070
|
+
maxBuffer: 100 * 1024 * 1024,
|
|
1071
|
+
// git check-ignore exits with 1 when none of the paths are ignored —
|
|
1072
|
+
// that is not an error for our purposes. stdio: 'pipe' lets us capture
|
|
1073
|
+
// stdout without swallowing stderr, and the try/catch handles the
|
|
1074
|
+
// non-zero exit from execFileSync when ALL paths are non-ignored
|
|
1075
|
+
// (exit code 1 from git check-ignore means "no matches").
|
|
1076
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1077
|
+
});
|
|
1078
|
+
for (const line of output.split('\n')) {
|
|
1079
|
+
const trimmed = normalizePath(line.trim());
|
|
1080
|
+
if (trimmed)
|
|
1081
|
+
ignored.add(trimmed);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
catch (e) {
|
|
1085
|
+
// Exit code 1 means no paths were ignored — not an error. Any other
|
|
1086
|
+
// failure (git unavailable, not a repo, etc.) is silently swallowed
|
|
1087
|
+
// so the caller proceeds with the unfiltered set.
|
|
1088
|
+
const exitCode = e.status;
|
|
1089
|
+
if (exitCode !== 1) {
|
|
1090
|
+
debug(`queryGitIgnoredFiles: git check-ignore failed: ${toErrorMessage(e)}`);
|
|
1091
|
+
}
|
|
1092
|
+
// On exit code 1, output is empty so ignored stays empty — correct.
|
|
1093
|
+
// On other errors we also proceed with the empty set (safe degradation).
|
|
1094
|
+
}
|
|
1095
|
+
return ignored;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Detect files the native orchestrator silently dropped.
|
|
1099
|
+
*
|
|
1100
|
+
* Walks the filesystem and compares against `nodes` + `file_hashes`. A file
|
|
1101
|
+
* is "missing" if it's absent from EITHER table — both must be present for
|
|
1102
|
+
* the fast-skip pre-flight (#1054) to work, and the two can diverge (e.g.
|
|
1103
|
+
* legacy DBs where `nodes` was populated but `file_hashes` was not).
|
|
1104
|
+
*
|
|
1105
|
+
* Restricted to files with an installed WASM grammar; extensions in
|
|
1106
|
+
* `LANGUAGE_REGISTRY` without a shipped grammar (e.g. groovy on minimal
|
|
1107
|
+
* installs) can't be parsed by either engine, so they're not a native
|
|
1108
|
+
* regression — excluding them keeps the warn count in
|
|
1109
|
+
* `backfillNativeDroppedFiles` meaningful.
|
|
1110
|
+
*
|
|
1111
|
+
* Also detects WASM-only files deleted from disk (#1073). Rust's
|
|
1112
|
+
* `detect_removed_files` filter (#1070) skips files outside its supported
|
|
1113
|
+
* extensions, so deletions of WASM-only languages don't reach the native
|
|
1114
|
+
* purge path; the rest of the backfill only inserts rows, so without this
|
|
1115
|
+
* step stale `nodes`/`file_hashes` rows would linger across incremental
|
|
1116
|
+
* rebuilds until the next full rebuild.
|
|
1117
|
+
*
|
|
1118
|
+
* Cheap (no DB handoff, no parsing): used both to gate the backfill call
|
|
1119
|
+
* and as its working set. NativeDbProxy supports `.prepare().all()`, so
|
|
1120
|
+
* this works whether `ctx.db` is a proxy or a real better-sqlite3
|
|
1121
|
+
* connection — letting us skip the close-native / reopen-better-sqlite3
|
|
1122
|
+
* cost when there's nothing to backfill.
|
|
1123
|
+
*/
|
|
1124
|
+
function detectDroppedLanguageGap(ctx) {
|
|
1125
|
+
const collected = collectFilesUtil(ctx.rootDir, [], ctx.config, new Set());
|
|
1126
|
+
const expectedRaw = collected.files.map((f) => normalizePath(path.relative(ctx.rootDir, f)));
|
|
1127
|
+
// The native Rust engine uses the `ignore` crate with git_ignore(true), so it
|
|
1128
|
+
// respects .gitignore and never processes gitignored files. The JS collectFiles
|
|
1129
|
+
// walker has no gitignore awareness, so without this filter gitignored files
|
|
1130
|
+
// (e.g. NAPI-RS generated crates/codegraph-core/index.js / index.d.ts) appear
|
|
1131
|
+
// in `expected` but not in the DB, causing a spurious "native extractor bug"
|
|
1132
|
+
// WARN and triggering an unnecessary WASM backfill (#1626).
|
|
1133
|
+
const gitIgnored = queryGitIgnoredFiles(ctx.rootDir, expectedRaw);
|
|
1134
|
+
const expected = new Set(gitIgnored.size > 0 ? expectedRaw.filter((r) => !gitIgnored.has(r)) : expectedRaw);
|
|
1135
|
+
const existingNodeRows = ctx.db
|
|
1136
|
+
.prepare("SELECT DISTINCT file FROM nodes WHERE kind = 'file'")
|
|
1137
|
+
.all();
|
|
1138
|
+
const existingNodes = new Set(existingNodeRows.map((r) => r.file));
|
|
1139
|
+
let existingHashes = new Set();
|
|
1140
|
+
try {
|
|
1141
|
+
const existingHashRows = ctx.db
|
|
1142
|
+
.prepare('SELECT DISTINCT file FROM file_hashes')
|
|
1143
|
+
.all();
|
|
1144
|
+
existingHashes = new Set(existingHashRows.map((r) => r.file));
|
|
1145
|
+
}
|
|
1146
|
+
catch (e) {
|
|
1147
|
+
// file_hashes table may not exist on legacy DBs; treat as fully missing
|
|
1148
|
+
// so the backfill writes rows on the upsert path below.
|
|
1149
|
+
debug(`detectDroppedLanguageGap: file_hashes read failed (table may not exist): ${toErrorMessage(e)}`);
|
|
1150
|
+
}
|
|
1151
|
+
const installedExts = getInstalledWasmExtensions();
|
|
1152
|
+
const missingRel = [];
|
|
1153
|
+
const missingAbs = [];
|
|
1154
|
+
for (const rel of expected) {
|
|
1155
|
+
if (existingNodes.has(rel) && existingHashes.has(rel))
|
|
1156
|
+
continue;
|
|
1157
|
+
const ext = path.extname(rel).toLowerCase();
|
|
1158
|
+
if (!installedExts.has(ext))
|
|
1159
|
+
continue;
|
|
1160
|
+
missingRel.push(rel);
|
|
1161
|
+
missingAbs.push(path.join(ctx.rootDir, rel));
|
|
1162
|
+
}
|
|
1163
|
+
const staleRel = computeWasmOnlyStaleFiles({
|
|
1164
|
+
existingNodes,
|
|
1165
|
+
existingHashes,
|
|
1166
|
+
expected,
|
|
1167
|
+
installedExts,
|
|
1168
|
+
nativeSupported: NATIVE_SUPPORTED_EXTENSIONS,
|
|
1169
|
+
});
|
|
1170
|
+
return { missingRel, missingAbs, staleRel };
|
|
1171
|
+
}
|
|
1172
|
+
// ── backfillNativeDroppedFiles helpers ───────────────────────────────────────
|
|
1173
|
+
/** Purge stale WASM-only files deleted from disk (#1073). */
|
|
1174
|
+
function purgeStaleWasmOnlyFiles(db, staleRel) {
|
|
1175
|
+
// `computeWasmOnlyStaleFiles` guarantees every path here has an extension
|
|
1176
|
+
// outside NATIVE_SUPPORTED_EXTENSIONS, so `classifyNativeDrops` would
|
|
1177
|
+
// always bucket 100% into `unsupported-by-native`. Build the extension
|
|
1178
|
+
// summary directly to avoid a redundant classification pass.
|
|
1179
|
+
const staleByExt = groupByExtension(staleRel);
|
|
1180
|
+
info(`Detected ${staleRel.length} deleted WASM-only file(s) across ${staleByExt.size} extension(s) the native orchestrator skipped; purging stale rows:${formatDropExtensionSummary(staleByExt)}`);
|
|
1181
|
+
purgeFilesData(db, staleRel);
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Classify and log dropped file buckets.
|
|
1185
|
+
* Three-way split of native-extractor-failure files:
|
|
1186
|
+
* realFailureBuckets — WASM found symbols → real Rust extractor bug (WARN)
|
|
1187
|
+
* emptyFileBuckets — WASM parsed but found 0 symbols → gitignored/empty (debug)
|
|
1188
|
+
* wasmSkipBuckets — WASM skipped entirely → no file-node insert (debug)
|
|
1189
|
+
*/
|
|
1190
|
+
function classifyAndLogDroppedFiles(missingRel, wasmParsedFiles, wasmFoundSymbols) {
|
|
1191
|
+
const { byReason, totals } = classifyNativeDrops(missingRel);
|
|
1192
|
+
if (totals['unsupported-by-native'] > 0) {
|
|
1193
|
+
const buckets = byReason['unsupported-by-native'];
|
|
1194
|
+
info(`Native orchestrator skipped ${totals['unsupported-by-native']} file(s) across ${buckets.size} extension(s) in languages without a Rust extractor; backfilling via WASM:${formatDropExtensionSummary(buckets)}`);
|
|
1195
|
+
}
|
|
1196
|
+
if (totals['native-extractor-failure'] > 0) {
|
|
1197
|
+
const allFailurePaths = byReason['native-extractor-failure'];
|
|
1198
|
+
const realFailureBuckets = new Map();
|
|
1199
|
+
const emptyFileBuckets = new Map();
|
|
1200
|
+
const wasmSkipBuckets = new Map();
|
|
1201
|
+
for (const [ext, paths] of allFailurePaths) {
|
|
1202
|
+
for (const relPath of paths) {
|
|
1203
|
+
let bucket;
|
|
1204
|
+
if (wasmFoundSymbols.has(relPath)) {
|
|
1205
|
+
bucket = realFailureBuckets;
|
|
1206
|
+
}
|
|
1207
|
+
else if (wasmParsedFiles.has(relPath)) {
|
|
1208
|
+
bucket = emptyFileBuckets;
|
|
1209
|
+
}
|
|
1210
|
+
else {
|
|
1211
|
+
bucket = wasmSkipBuckets;
|
|
1212
|
+
}
|
|
1213
|
+
let list = bucket.get(ext);
|
|
1214
|
+
if (!list) {
|
|
1215
|
+
list = [];
|
|
1216
|
+
bucket.set(ext, list);
|
|
1217
|
+
}
|
|
1218
|
+
list.push(relPath);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
if (realFailureBuckets.size > 0) {
|
|
1222
|
+
const realCount = [...realFailureBuckets.values()].reduce((s, a) => s + a.length, 0);
|
|
1223
|
+
warn(`Native orchestrator dropped ${realCount} file(s) across ${realFailureBuckets.size} extension(s) in natively-supported languages — likely a Rust extractor bug. Backfilling via WASM:${formatDropExtensionSummary(realFailureBuckets)}`);
|
|
1224
|
+
}
|
|
1225
|
+
if (emptyFileBuckets.size > 0) {
|
|
1226
|
+
const emptyCount = [...emptyFileBuckets.values()].reduce((s, a) => s + a.length, 0);
|
|
1227
|
+
debug(`Native orchestrator skipped ${emptyCount} file(s) in natively-supported languages that also produced 0 symbols via WASM (likely gitignored or empty); backfilling file nodes:${formatDropExtensionSummary(emptyFileBuckets)}`);
|
|
1228
|
+
}
|
|
1229
|
+
if (wasmSkipBuckets.size > 0) {
|
|
1230
|
+
const skipCount = [...wasmSkipBuckets.values()].reduce((s, a) => s + a.length, 0);
|
|
1231
|
+
debug(`Native orchestrator skipped ${skipCount} file(s) in natively-supported languages that WASM also could not parse (unregistered extension or parse error); no file-node inserted:${formatDropExtensionSummary(wasmSkipBuckets)}`);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
/** Insert node rows for all backfilled files and mark exported symbols. */
|
|
1236
|
+
function insertBackfilledNodes(db, wasmResults) {
|
|
1237
|
+
const rows = [];
|
|
1238
|
+
const exportKeys = [];
|
|
1239
|
+
for (const [relPath, symbols] of wasmResults) {
|
|
1240
|
+
// File row — mirrors insertDefinitionsAndExports: qualified_name is null.
|
|
1241
|
+
rows.push([relPath, 'file', relPath, 0, null, null, null, null, null]);
|
|
1242
|
+
for (const def of symbols.definitions ?? []) {
|
|
1243
|
+
// Populate qualified_name/scope the same way the JS fallback does so
|
|
1244
|
+
// downstream queries (cross-file references, "go to definition") find
|
|
1245
|
+
// these symbols.
|
|
1246
|
+
const dotIdx = def.name.lastIndexOf('.');
|
|
1247
|
+
const scope = dotIdx !== -1 ? def.name.slice(0, dotIdx) : null;
|
|
1248
|
+
rows.push([
|
|
1249
|
+
def.name,
|
|
1250
|
+
def.kind,
|
|
1251
|
+
relPath,
|
|
1252
|
+
def.line,
|
|
1253
|
+
def.endLine ?? null,
|
|
1254
|
+
null,
|
|
1255
|
+
def.name,
|
|
1256
|
+
scope,
|
|
1257
|
+
def.visibility ?? null,
|
|
1258
|
+
]);
|
|
1259
|
+
}
|
|
1260
|
+
// Exports: insert the row (INSERT OR IGNORE — a matching definition row
|
|
1261
|
+
// is a no-op) and queue a key for the second-pass exported=1 update, so
|
|
1262
|
+
// queries filtering on exported=1 find backfilled symbols (#970).
|
|
1263
|
+
for (const exp of symbols.exports ?? []) {
|
|
1264
|
+
rows.push([exp.name, exp.kind, relPath, exp.line, null, null, exp.name, null, null]);
|
|
1265
|
+
exportKeys.push([exp.name, exp.kind, relPath, exp.line]);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
batchInsertNodes(db, rows);
|
|
1269
|
+
// Mark exported symbols in batches — mirrors insertDefinitionsAndExports.
|
|
1270
|
+
if (exportKeys.length > 0) {
|
|
1271
|
+
const EXPORT_CHUNK = 500;
|
|
1272
|
+
const exportStmtCache = new Map();
|
|
1273
|
+
for (let i = 0; i < exportKeys.length; i += EXPORT_CHUNK) {
|
|
1274
|
+
const end = Math.min(i + EXPORT_CHUNK, exportKeys.length);
|
|
1275
|
+
const chunkSize = end - i;
|
|
1276
|
+
let updateStmt = exportStmtCache.get(chunkSize);
|
|
1277
|
+
if (!updateStmt) {
|
|
1278
|
+
const conditions = Array.from({ length: chunkSize }, () => '(name = ? AND kind = ? AND file = ? AND line = ?)').join(' OR ');
|
|
1279
|
+
updateStmt = db.prepare(`UPDATE nodes SET exported = 1 WHERE ${conditions}`);
|
|
1280
|
+
exportStmtCache.set(chunkSize, updateStmt);
|
|
1281
|
+
}
|
|
1282
|
+
const vals = [];
|
|
1283
|
+
for (let j = i; j < end; j++) {
|
|
1284
|
+
const k = exportKeys[j];
|
|
1285
|
+
vals.push(k[0], k[1], k[2], k[3]);
|
|
1286
|
+
}
|
|
1287
|
+
updateStmt.run(...vals);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Persist file_hashes rows for every backfilled file.
|
|
1293
|
+
*
|
|
1294
|
+
* The Rust orchestrator only hashes files it parsed itself, so without this
|
|
1295
|
+
* step files in optional-language extensions (e.g. .clj when no Rust extractor
|
|
1296
|
+
* exists) would be missing from `file_hashes` — permanently breaking the JS-side
|
|
1297
|
+
* fast-skip pre-flight (#1054), which rejects on `collected file missing
|
|
1298
|
+
* from file_hashes` and forces every no-op rebuild back through the full
|
|
1299
|
+
* ~2s native pipeline (#1068).
|
|
1300
|
+
*
|
|
1301
|
+
* Iterates `missingRel` (every collected file the Rust orchestrator dropped),
|
|
1302
|
+
* not `wasmResults`, so files that produced zero symbols still get a row.
|
|
1303
|
+
*/
|
|
1304
|
+
function backfillFileHashes(db, missingRel, missingAbs) {
|
|
1305
|
+
try {
|
|
1306
|
+
const upsertHash = db.prepare('INSERT OR REPLACE INTO file_hashes (file, hash, mtime, size) VALUES (?, ?, ?, ?)');
|
|
1307
|
+
const writeHashes = db.transaction(() => {
|
|
1308
|
+
for (let i = 0; i < missingRel.length; i++) {
|
|
1309
|
+
const relPath = missingRel[i];
|
|
1310
|
+
const absPath = missingAbs[i];
|
|
1311
|
+
if (!relPath || !absPath)
|
|
1312
|
+
continue;
|
|
1313
|
+
let code;
|
|
1314
|
+
try {
|
|
1315
|
+
code = readFileSafe(absPath);
|
|
1316
|
+
}
|
|
1317
|
+
catch (e) {
|
|
1318
|
+
debug(`backfillNativeDroppedFiles: read failed for ${relPath}: ${toErrorMessage(e)}`);
|
|
1319
|
+
continue;
|
|
1320
|
+
}
|
|
1321
|
+
if (code === null)
|
|
1322
|
+
continue;
|
|
1323
|
+
const stat = fileStat(absPath);
|
|
1324
|
+
const mtime = stat ? stat.mtime : 0;
|
|
1325
|
+
const size = stat ? stat.size : 0;
|
|
1326
|
+
upsertHash.run(relPath, fileHash(code), mtime, size);
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
writeHashes();
|
|
1330
|
+
}
|
|
1331
|
+
catch (e) {
|
|
1332
|
+
debug(`backfillNativeDroppedFiles: file_hashes write failed (table may not exist): ${toErrorMessage(e)}`);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Backfill files that the native orchestrator silently dropped during parse.
|
|
1337
|
+
* Falls back to WASM + inserts file/symbol nodes so engine counts match (#967).
|
|
1338
|
+
*
|
|
1339
|
+
* Also purges stale rows for WASM-only files deleted from disk (#1073), which
|
|
1340
|
+
* Rust's `detect_removed_files` filter (#1070) skips.
|
|
1341
|
+
*
|
|
1342
|
+
* Accepts a pre-computed `gap` from `detectDroppedLanguageGap` so the caller
|
|
1343
|
+
* can use the same scan for both gating and the actual backfill — avoiding
|
|
1344
|
+
* a redundant fs walk when the orchestrator's signals already triggered.
|
|
1345
|
+
*/
|
|
1346
|
+
async function backfillNativeDroppedFiles(ctx, gap) {
|
|
1347
|
+
const { missingRel, missingAbs, staleRel } = gap;
|
|
1348
|
+
if (missingAbs.length === 0 && staleRel.length === 0)
|
|
1349
|
+
return;
|
|
1350
|
+
// Now that we know there's work to do, hand off to better-sqlite3 (needed
|
|
1351
|
+
// for the INSERT path below).
|
|
1352
|
+
if (ctx.nativeFirstProxy) {
|
|
1353
|
+
closeNativeDb(ctx, 'pre-parity-backfill');
|
|
1354
|
+
ctx.db = openDb(ctx.dbPath);
|
|
1355
|
+
ctx.nativeFirstProxy = false;
|
|
1356
|
+
}
|
|
1357
|
+
const dbConn = ctx.db;
|
|
1358
|
+
// Purge WASM-only files that were deleted from disk (#1073). Rust's
|
|
1359
|
+
// detect_removed_files skips them and the insert path below never visits
|
|
1360
|
+
// them, so without this their rows would persist across rebuilds until the
|
|
1361
|
+
// next full rebuild reset the DB.
|
|
1362
|
+
if (staleRel.length > 0) {
|
|
1363
|
+
purgeStaleWasmOnlyFiles(dbConn, staleRel);
|
|
1364
|
+
}
|
|
1365
|
+
if (missingAbs.length === 0)
|
|
1366
|
+
return;
|
|
1367
|
+
// Parse all missing files via WASM first so we can distinguish real native
|
|
1368
|
+
// extractor failures (WASM finds symbols but native didn't) from files the
|
|
1369
|
+
// Rust engine legitimately skipped (gitignored artifacts, empty declaration
|
|
1370
|
+
// files, etc. where WASM also produces 0 symbols). Both categories are
|
|
1371
|
+
// backfilled — only the former triggers a WARN (#1566).
|
|
1372
|
+
const wasmResults = await parseFilesWasmForBackfill(missingAbs, ctx.rootDir);
|
|
1373
|
+
// Build two sets from wasmResults:
|
|
1374
|
+
// wasmParsedFiles — rel-paths present in wasmResults (WASM succeeded, even 0 symbols)
|
|
1375
|
+
// wasmFoundSymbols — subset where WASM found ≥1 symbol
|
|
1376
|
+
// Files absent from wasmParsedFiles were skipped by WASM entirely (extension
|
|
1377
|
+
// not in _extToLang, wasmExtractSymbols returned null, or a read error).
|
|
1378
|
+
// Those files do NOT end up in the batchInsertNodes loop below.
|
|
1379
|
+
const wasmParsedFiles = new Set();
|
|
1380
|
+
const wasmFoundSymbols = new Set();
|
|
1381
|
+
for (const [relPath, symbols] of wasmResults) {
|
|
1382
|
+
wasmParsedFiles.add(relPath);
|
|
1383
|
+
if ((symbols.definitions?.length ?? 0) > 0 || (symbols.exports?.length ?? 0) > 0) {
|
|
1384
|
+
wasmFoundSymbols.add(relPath);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
// Classify drops so users see per-extension reasons instead of just a count
|
|
1388
|
+
// (#1011). `unsupported-by-native` is a legitimate parser limit (no Rust
|
|
1389
|
+
// extractor); `native-extractor-failure` indicates a real native bug since
|
|
1390
|
+
// the language IS supported by the addon yet WASM found symbols the native
|
|
1391
|
+
// engine should have extracted. Files where both engines produce 0 symbols
|
|
1392
|
+
// are legitimately empty (e.g. gitignored napi-generated declaration stubs)
|
|
1393
|
+
// and logged at debug level only.
|
|
1394
|
+
classifyAndLogDroppedFiles(missingRel, wasmParsedFiles, wasmFoundSymbols);
|
|
1395
|
+
insertBackfilledNodes(dbConn, wasmResults);
|
|
1396
|
+
backfillFileHashes(dbConn, missingRel, missingAbs);
|
|
1397
|
+
// Free WASM parse trees from the inline backfill path (#1058).
|
|
1398
|
+
// `parseFilesWasmInline` sets `symbols._tree` (a live web-tree-sitter Tree
|
|
1399
|
+
// backed by WASM linear memory) on every result, but these symbols are
|
|
1400
|
+
// consumed locally for DB row construction and never added to
|
|
1401
|
+
// `ctx.allSymbols`, so the finalize-stage `releaseWasmTrees` sweep never
|
|
1402
|
+
// sees them. Without this, trees leak WASM memory until process exit —
|
|
1403
|
+
// bounded per run but cumulative across in-process integration tests.
|
|
1404
|
+
// Mirrors the cleanup discipline established for #931.
|
|
1405
|
+
cleanupThisDispatchWasmTrees(wasmResults);
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Backfill the `technique` column on `calls` edges written by the native Rust
|
|
1409
|
+
* orchestrator, which does not write the column itself. Also lifts any
|
|
1410
|
+
* resolved ts-native edge whose confidence is below TS_NATIVE_CONFIDENCE_FLOOR
|
|
1411
|
+
* to that floor value so that the name-lookup quality of the native resolver is
|
|
1412
|
+
* reflected in the call-confidence metric.
|
|
1413
|
+
*
|
|
1414
|
+
* For full builds, all `calls` edges in the DB are new so a global UPDATE is
|
|
1415
|
+
* correct. For incremental builds, only changed-file source nodes are updated
|
|
1416
|
+
* to avoid overwriting previously-set technique values on unchanged edges.
|
|
1417
|
+
*/
|
|
1418
|
+
function backfillEdgeTechniquesAfterNativeOrchestrator(db, isFullBuild, changedFiles) {
|
|
1419
|
+
// Quiet incremental: no files changed → no new edges inserted, nothing to tag.
|
|
1420
|
+
// Running the global UPDATE here would mis-tag pre-migration NULL-technique edges
|
|
1421
|
+
// from unchanged files as 'ts-native'.
|
|
1422
|
+
if (!isFullBuild && changedFiles && changedFiles.length === 0) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
if (isFullBuild || !changedFiles) {
|
|
1426
|
+
db.prepare("UPDATE edges SET technique = 'ts-native' WHERE kind = 'calls' AND technique IS NULL").run();
|
|
1427
|
+
// Lift resolved ts-native edges below the confidence floor.
|
|
1428
|
+
db.prepare(`UPDATE edges SET confidence = ?
|
|
1429
|
+
WHERE kind = 'calls' AND technique = 'ts-native'
|
|
1430
|
+
AND confidence > 0 AND confidence < ?`).run(TS_NATIVE_CONFIDENCE_FLOOR, TS_NATIVE_CONFIDENCE_FLOOR);
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
// Incremental: scope to source nodes whose file is one of the changed files.
|
|
1434
|
+
// Chunk to stay within SQLite's SQLITE_LIMIT_VARIABLE_NUMBER (999 on older builds).
|
|
1435
|
+
const CHUNK_SIZE = 500;
|
|
1436
|
+
const tx = db.transaction(() => {
|
|
1437
|
+
for (let i = 0; i < changedFiles.length; i += CHUNK_SIZE) {
|
|
1438
|
+
const chunk = changedFiles.slice(i, i + CHUNK_SIZE);
|
|
1439
|
+
const placeholders = chunk.map(() => '?').join(',');
|
|
1440
|
+
db.prepare(`UPDATE edges SET technique = 'ts-native'
|
|
1441
|
+
WHERE kind = 'calls' AND technique IS NULL
|
|
1442
|
+
AND source_id IN (
|
|
1443
|
+
SELECT id FROM nodes WHERE file IN (${placeholders})
|
|
1444
|
+
)`).run(...chunk);
|
|
1445
|
+
// Lift resolved ts-native edges below the confidence floor for this chunk.
|
|
1446
|
+
db.prepare(`UPDATE edges SET confidence = ?
|
|
1447
|
+
WHERE kind = 'calls' AND technique = 'ts-native'
|
|
1448
|
+
AND confidence > 0 AND confidence < ?
|
|
1449
|
+
AND source_id IN (
|
|
1450
|
+
SELECT id FROM nodes WHERE file IN (${placeholders})
|
|
1451
|
+
)`).run(TS_NATIVE_CONFIDENCE_FLOOR, TS_NATIVE_CONFIDENCE_FLOOR, ...chunk);
|
|
1452
|
+
}
|
|
1453
|
+
});
|
|
1454
|
+
tx();
|
|
1455
|
+
}
|
|
1456
|
+
// ── tryNativeOrchestrator helpers ────────────────────────────────────────────
|
|
1457
|
+
/**
|
|
1458
|
+
* Open NativeDatabase on demand — deferred from setupPipeline to skip the
|
|
1459
|
+
* ~60ms cost on no-op/early-exit builds.
|
|
1460
|
+
*
|
|
1461
|
+
* Closes the better-sqlite3 connection first to avoid dual-connection WAL
|
|
1462
|
+
* corruption. On setup failure, falls back to reopening better-sqlite3 and
|
|
1463
|
+
* leaves ctx.nativeDb undefined so the caller falls through to the JS pipeline.
|
|
1464
|
+
*/
|
|
1465
|
+
function openNativeDatabase(ctx) {
|
|
1466
|
+
if (ctx.nativeDb || !ctx.nativeAvailable)
|
|
1467
|
+
return;
|
|
1468
|
+
const native = loadNative();
|
|
1469
|
+
if (!native?.NativeDatabase)
|
|
1470
|
+
return;
|
|
1471
|
+
try {
|
|
1472
|
+
// Close better-sqlite3 before opening rusqlite to avoid WAL conflicts.
|
|
1473
|
+
// Uses raw close() instead of closeDb() intentionally — the advisory lock
|
|
1474
|
+
// is kept and transferred to the NativeDbProxy below, not released here.
|
|
1475
|
+
ctx.db.close();
|
|
1476
|
+
acquireAdvisoryLock(ctx.dbPath);
|
|
1477
|
+
ctx.nativeDb = native.NativeDatabase.openReadWrite(ctx.dbPath);
|
|
1478
|
+
ctx.nativeDb.initSchema();
|
|
1479
|
+
// Replace ctx.db with a NativeDbProxy so post-native JS fallback
|
|
1480
|
+
// (structure, analysis) can use it without reopening better-sqlite3.
|
|
1481
|
+
const proxy = new NativeDbProxy(ctx.nativeDb);
|
|
1482
|
+
proxy.__lockPath = `${ctx.dbPath}.lock`;
|
|
1483
|
+
ctx.db = proxy;
|
|
1484
|
+
ctx.nativeFirstProxy = true;
|
|
1485
|
+
}
|
|
1486
|
+
catch (err) {
|
|
1487
|
+
warn(`NativeDatabase setup failed, falling back to JS: ${toErrorMessage(err)}`);
|
|
1488
|
+
try {
|
|
1489
|
+
ctx.nativeDb?.close();
|
|
1490
|
+
}
|
|
1491
|
+
catch (e) {
|
|
1492
|
+
debug(`tryNativeOrchestrator: close failed during fallback: ${toErrorMessage(e)}`);
|
|
1493
|
+
}
|
|
1494
|
+
ctx.nativeDb = undefined;
|
|
1495
|
+
ctx.nativeFirstProxy = false; // defensive: reset in case future refactors move the assignment above throwing lines
|
|
1496
|
+
releaseAdvisoryLock(`${ctx.dbPath}.lock`);
|
|
1497
|
+
// Reopen better-sqlite3 for JS pipeline fallback
|
|
1498
|
+
ctx.db = openDb(ctx.dbPath);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Coordinate all post-native edge-writing post-passes, role re-classification,
|
|
1503
|
+
* and technique backfill. Returns timing data for the build result.
|
|
1504
|
+
*
|
|
1505
|
+
* Post-passes run before structure/analysis so role classification sees the
|
|
1506
|
+
* complete graph including CHA + this/super dispatch edges.
|
|
1507
|
+
*/
|
|
1508
|
+
async function runPostNativePasses(ctx, result) {
|
|
1509
|
+
// Engine parity: the native orchestrator silently drops files whose
|
|
1510
|
+
// Rust extractor/grammar is missing or fails (e.g. HCL, Scala, Swift on
|
|
1511
|
+
// stale native binaries). WASM handles those — backfill via WASM so both
|
|
1512
|
+
// engines process the same file set (#967).
|
|
1513
|
+
//
|
|
1514
|
+
// Detect the gap once (fs walk + 2 DB queries) and use it for both gating
|
|
1515
|
+
// and the backfill itself. On quiet incrementals we still pay the walk so
|
|
1516
|
+
// we can detect brand-new files in dropped-language extensions — a gap that
|
|
1517
|
+
// the orchestrator's `detect_removed_files` filter (#1070) leaves open
|
|
1518
|
+
// (#1083, #1091). The pre-check is cheap because the expensive part (WASM
|
|
1519
|
+
// re-parse of the missing set) is gated below.
|
|
1520
|
+
const gapDetectStart = performance.now();
|
|
1521
|
+
const gap = detectDroppedLanguageGap(ctx);
|
|
1522
|
+
const backfillHappened = gap.missingAbs.length > 0 || gap.staleRel.length > 0;
|
|
1523
|
+
if (backfillHappened) {
|
|
1524
|
+
await backfillNativeDroppedFiles(ctx, gap);
|
|
1525
|
+
}
|
|
1526
|
+
const gapDetectMs = performance.now() - gapDetectStart;
|
|
1527
|
+
// Phase 8.5: this/super dispatch — hybrid WASM re-parse to resolve call sites
|
|
1528
|
+
// whose raw receiver info the Rust pipeline does not persist to DB.
|
|
1529
|
+
// Runs BEFORE the CHA expansion pass so that super.method() → Parent.method edges
|
|
1530
|
+
// (technique='cha') are in the DB when runPostNativeCha expands them to sibling
|
|
1531
|
+
// class overrides (e.g. PostMixin.m → B.m when PostMixin and B both extend A).
|
|
1532
|
+
const { elapsedMs: thisDispatchMs, targetIds: thisDispatchTargetIds, affectedFiles: thisDispatchAffectedFiles, } = await runPostNativeThisDispatch(ctx.db, ctx.rootDir, result.changedFiles, !!result.isFullBuild);
|
|
1533
|
+
// Phase 8.6: expand CHA call edges (interface dispatch → concrete implementations).
|
|
1534
|
+
// Returns the affected files so role re-classification below can be scoped to
|
|
1535
|
+
// the nodes whose fan-in/out actually changed.
|
|
1536
|
+
//
|
|
1537
|
+
// Runs AFTER this/super dispatch so super.method() edges are already in the DB.
|
|
1538
|
+
// The 'cha-expanded' technique tag on this pass's own output prevents re-expansion
|
|
1539
|
+
// of those edges in subsequent incremental builds, while 'cha'-tagged edges from
|
|
1540
|
+
// this/super dispatch remain eligible for expansion here.
|
|
1541
|
+
//
|
|
1542
|
+
// Function-as-object-property methods (`fn.method = function() {}`) are extracted
|
|
1543
|
+
// natively by the Rust engine (#1432) and resolved in-build by its edge builder, so
|
|
1544
|
+
// no WASM re-parse post-pass is needed for them. `Foo.prototype.bar = fn` likewise.
|
|
1545
|
+
const chaStart = performance.now();
|
|
1546
|
+
const { newEdgeCount: chaEdgeCount, affectedFiles: chaAffectedFiles } = runPostNativeCha(ctx.db,
|
|
1547
|
+
// null = full build (scan all call→method edges); array = incremental (gate queries decide scope)
|
|
1548
|
+
result.isFullBuild ? null : (result.changedFiles ?? null));
|
|
1549
|
+
const chaMs = performance.now() - chaStart;
|
|
1550
|
+
// Role re-classification after JS edge-writing post-passes.
|
|
1551
|
+
// The Rust orchestrator classifies roles before these post-passes (CHA,
|
|
1552
|
+
// this-dispatch) add edges, so roles for the edge endpoints are stale.
|
|
1553
|
+
// Scoped to the files containing those endpoints: a new edge only changes
|
|
1554
|
+
// fan-in/out for its own source and target nodes, so re-classifying their
|
|
1555
|
+
// files restores correctness without re-running the classifier over the
|
|
1556
|
+
// whole graph (which cost ~130ms per build on codegraph itself and was a
|
|
1557
|
+
// major part of the v3.12.0 native full-build benchmark regression).
|
|
1558
|
+
let reclassifyMs = 0;
|
|
1559
|
+
if (chaEdgeCount > 0 || thisDispatchTargetIds.size > 0) {
|
|
1560
|
+
const affectedFiles = [...new Set([...chaAffectedFiles, ...thisDispatchAffectedFiles])];
|
|
1561
|
+
// When edges were inserted but all their endpoint nodes have null `file`
|
|
1562
|
+
// columns (rare but possible), affectedFiles stays empty even though
|
|
1563
|
+
// fan-in/out changed. Fall back to full-graph re-classification in that
|
|
1564
|
+
// case — scoped classification with an empty set would be a no-op, leaving
|
|
1565
|
+
// roles stale for those nodes.
|
|
1566
|
+
const scopedFiles = affectedFiles.length > 0 ? affectedFiles : null;
|
|
1567
|
+
const reclassifyStart = performance.now();
|
|
1568
|
+
try {
|
|
1569
|
+
const { classifyNodeRoles } = (await import('../../../../features/structure.js'));
|
|
1570
|
+
classifyNodeRoles(ctx.db, scopedFiles);
|
|
1571
|
+
debug(scopedFiles
|
|
1572
|
+
? `Post-pass role re-classification complete (${scopedFiles.length} file(s))`
|
|
1573
|
+
: 'Post-pass role re-classification complete (full graph — null-file endpoints)');
|
|
1574
|
+
}
|
|
1575
|
+
catch (err) {
|
|
1576
|
+
debug(`Post-pass role re-classification failed: ${toErrorMessage(err)}`);
|
|
1577
|
+
}
|
|
1578
|
+
reclassifyMs = performance.now() - reclassifyStart;
|
|
1579
|
+
}
|
|
1580
|
+
// Backfill the `technique` column on `calls` edges written by the Rust
|
|
1581
|
+
// orchestrator, which does not write the column. Runs after all edge-writing
|
|
1582
|
+
// phases (including the WASM dropped-language backfill, CHA post-pass, and
|
|
1583
|
+
// this/super dispatch) so every new edge in this build cycle gets a label.
|
|
1584
|
+
const techniqueBackfillStart = performance.now();
|
|
1585
|
+
backfillEdgeTechniquesAfterNativeOrchestrator(ctx.db, !!result.isFullBuild, result.changedFiles);
|
|
1586
|
+
const techniqueBackfillMs = performance.now() - techniqueBackfillStart;
|
|
1587
|
+
// Re-count nodes/edges now that all edge-writing post-passes have run: the
|
|
1588
|
+
// Rust orchestrator captured its counts before the JS post-passes added
|
|
1589
|
+
// edges, so both its summary and build_meta under-report (#1452).
|
|
1590
|
+
//
|
|
1591
|
+
// Fast path: skip the COUNT(*) scan when no post-pass wrote any edges.
|
|
1592
|
+
// COUNT(*) on large tables (50K+ edges) is non-trivial, especially via the
|
|
1593
|
+
// NativeDbProxy napi-rs round-trip. When all post-passes were no-ops, the
|
|
1594
|
+
// Rust orchestrator's counts are still accurate — no re-count needed.
|
|
1595
|
+
let finalNodeCount = result.nodeCount ?? 0;
|
|
1596
|
+
let finalEdgeCount = result.edgeCount ?? 0;
|
|
1597
|
+
const postPassWroteData = backfillHappened || chaEdgeCount > 0 || thisDispatchTargetIds.size > 0;
|
|
1598
|
+
if (postPassWroteData) {
|
|
1599
|
+
try {
|
|
1600
|
+
const counts = ctx.db
|
|
1601
|
+
.prepare('SELECT (SELECT COUNT(*) FROM nodes) AS n, (SELECT COUNT(*) FROM edges) AS e')
|
|
1602
|
+
.get();
|
|
1603
|
+
if (counts.n !== finalNodeCount || counts.e !== finalEdgeCount) {
|
|
1604
|
+
finalNodeCount = counts.n;
|
|
1605
|
+
finalEdgeCount = counts.e;
|
|
1606
|
+
setBuildMeta(ctx.db, { node_count: finalNodeCount, edge_count: finalEdgeCount });
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
catch (err) {
|
|
1610
|
+
debug(`Post-pass node/edge re-count failed: ${toErrorMessage(err)}`);
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
info(`Native build orchestrator completed: ${finalNodeCount} nodes, ${finalEdgeCount} edges, ${result.fileCount ?? 0} files`);
|
|
1614
|
+
return {
|
|
1615
|
+
gapDetectMs,
|
|
1616
|
+
chaMs,
|
|
1617
|
+
thisDispatchMs,
|
|
1618
|
+
reclassifyMs,
|
|
1619
|
+
techniqueBackfillMs,
|
|
1620
|
+
backfillHappened,
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Try the native build orchestrator.
|
|
1625
|
+
*
|
|
1626
|
+
* Returns:
|
|
1627
|
+
* - `BuildResult` on success (caller should return it directly).
|
|
1628
|
+
* - `'early-exit'` when the orchestrator detected no changes (caller should return undefined).
|
|
1629
|
+
* - `undefined` when native is unavailable or skipped (caller should fall through to the JS pipeline).
|
|
1630
|
+
*
|
|
1631
|
+
* Encapsulates the orchestrator-selection strategy: open `NativeDatabase`,
|
|
1632
|
+
* invoke `nativeDb.buildGraph()` (the Rust pipeline), and run post-native
|
|
1633
|
+
* structure + analysis fallbacks. Lives in its own file to keep the Rust
|
|
1634
|
+
* orchestrator entry point separated from the JS-side `buildGraph()` driver
|
|
1635
|
+
* in `pipeline.ts`.
|
|
1636
|
+
*/
|
|
1637
|
+
export async function tryNativeOrchestrator(ctx) {
|
|
1638
|
+
const skipReason = shouldSkipNativeOrchestrator(ctx);
|
|
1639
|
+
if (skipReason) {
|
|
1640
|
+
debug(`Skipping native orchestrator: ${skipReason}`);
|
|
1641
|
+
return undefined;
|
|
1642
|
+
}
|
|
1643
|
+
openNativeDatabase(ctx);
|
|
1644
|
+
if (!ctx.nativeDb?.buildGraph)
|
|
1645
|
+
return undefined;
|
|
1646
|
+
const resultJson = ctx.nativeDb.buildGraph(ctx.rootDir, JSON.stringify(ctx.config), JSON.stringify(ctx.aliases), JSON.stringify(ctx.opts));
|
|
1647
|
+
const result = JSON.parse(resultJson);
|
|
1648
|
+
if (result.earlyExit) {
|
|
1649
|
+
info('No changes detected');
|
|
1650
|
+
// Even on no-op rebuilds, dropped-language files added since the last
|
|
1651
|
+
// full build are still missing from `nodes`/`file_hashes` (#1083), and
|
|
1652
|
+
// WASM-only files deleted from disk leave stale rows behind (#1073).
|
|
1653
|
+
// The orchestrator's collect_files skipped them, so its earlyExit
|
|
1654
|
+
// doesn't imply DB consistency. Run the gap repair before returning.
|
|
1655
|
+
const gap = detectDroppedLanguageGap(ctx);
|
|
1656
|
+
if (gap.missingAbs.length > 0 || gap.staleRel.length > 0) {
|
|
1657
|
+
await backfillNativeDroppedFiles(ctx, gap);
|
|
1658
|
+
}
|
|
1659
|
+
closeDbPair({ db: ctx.db, nativeDb: ctx.nativeDb });
|
|
1660
|
+
return 'early-exit';
|
|
1661
|
+
}
|
|
1662
|
+
// Log incremental status to match JS pipeline output
|
|
1663
|
+
const changed = result.changedCount ?? 0;
|
|
1664
|
+
const removed = result.removedCount ?? 0;
|
|
1665
|
+
if (!result.isFullBuild && (changed > 0 || removed > 0)) {
|
|
1666
|
+
info(`Incremental: ${changed} changed, ${removed} removed`);
|
|
1667
|
+
}
|
|
1668
|
+
const p = result.phases;
|
|
1669
|
+
// Sync build_meta so JS-side version/engine checks work on next build.
|
|
1670
|
+
// Use the binary's CARGO_PKG_VERSION (ctx.nativeBinaryVersion), not the
|
|
1671
|
+
// platform package.json version (ctx.engineVersion). The Rust side's
|
|
1672
|
+
// check_version_mismatch compares against CARGO_PKG_VERSION; writing
|
|
1673
|
+
// the package.json value would create a permanent mismatch whenever
|
|
1674
|
+
// the binary and platform package.json diverge — e.g., CI hot-swap
|
|
1675
|
+
// via ci-install-native.mjs (#1066) — forcing every subsequent build
|
|
1676
|
+
// to be a full rebuild.
|
|
1677
|
+
//
|
|
1678
|
+
// When the native addon doesn't expose engineVersion() (older addon),
|
|
1679
|
+
// fall back to CODEGRAPH_VERSION — same fallback used by both
|
|
1680
|
+
// checkEngineSchemaMismatch (read path) and persistBuildMetadata
|
|
1681
|
+
// (the JS-pipeline write path in finalize.ts). Using ctx.engineVersion
|
|
1682
|
+
// here would re-introduce the asymmetry this PR fixes for that case.
|
|
1683
|
+
const nativeVersionForMeta = ctx.nativeBinaryVersion || CODEGRAPH_VERSION;
|
|
1684
|
+
setBuildMeta(ctx.db, {
|
|
1685
|
+
engine: ctx.engineName,
|
|
1686
|
+
engine_version: nativeVersionForMeta,
|
|
1687
|
+
codegraph_version: nativeVersionForMeta,
|
|
1688
|
+
schema_version: String(ctx.schemaVersion),
|
|
1689
|
+
built_at: new Date().toISOString(),
|
|
1690
|
+
});
|
|
1691
|
+
// The build summary is logged after the JS edge-writing post-passes below
|
|
1692
|
+
// (dropped-language backfill, CHA, this/super dispatch) so the reported
|
|
1693
|
+
// counts include their edges (#1452).
|
|
1694
|
+
// ── Post-native structure + analysis ──────────────────────────────
|
|
1695
|
+
let analysisTiming = {
|
|
1696
|
+
astMs: +(p.astMs ?? 0),
|
|
1697
|
+
complexityMs: +(p.complexityMs ?? 0),
|
|
1698
|
+
cfgMs: +(p.cfgMs ?? 0),
|
|
1699
|
+
dataflowMs: +(p.dataflowMs ?? 0),
|
|
1700
|
+
};
|
|
1701
|
+
let structurePatchMs = 0;
|
|
1702
|
+
// Skip JS structure when the Rust pipeline's small-incremental fast path
|
|
1703
|
+
// already handled it. For full builds and large incrementals where Rust
|
|
1704
|
+
// skipped structure, we must run the JS fallback.
|
|
1705
|
+
const needsStructure = !result.structureHandled;
|
|
1706
|
+
// When the Rust addon doesn't include analysis persistence (older addon
|
|
1707
|
+
// version or analysis failed), fall back to JS-side analysis.
|
|
1708
|
+
const needsAnalysisFallback = !result.analysisComplete &&
|
|
1709
|
+
(ctx.opts.ast !== false ||
|
|
1710
|
+
ctx.opts.complexity !== false ||
|
|
1711
|
+
ctx.opts.cfg !== false ||
|
|
1712
|
+
ctx.opts.dataflow !== false);
|
|
1713
|
+
// ── DB handoff ────────────────────────────────────────────────────────────
|
|
1714
|
+
// Ensure a proper better-sqlite3 connection is open before any post-pass that
|
|
1715
|
+
// writes edges (dropped-language backfill, CHA) and before structure/analysis.
|
|
1716
|
+
// When analysis fallback is needed the handoff already happened above; when
|
|
1717
|
+
// neither structure nor analysis is needed the proxy conversion is deferred to
|
|
1718
|
+
// here so CHA and technique-backfill can still write rows.
|
|
1719
|
+
if (needsStructure || needsAnalysisFallback) {
|
|
1720
|
+
if (needsAnalysisFallback && ctx.nativeFirstProxy) {
|
|
1721
|
+
closeNativeDb(ctx, 'pre-analysis-fallback');
|
|
1722
|
+
ctx.db = openDb(ctx.dbPath);
|
|
1723
|
+
ctx.nativeFirstProxy = false;
|
|
1724
|
+
}
|
|
1725
|
+
else if (!ctx.nativeFirstProxy && !handoffWalAfterNativeBuild(ctx)) {
|
|
1726
|
+
// DB reopen failed — return partial result (no post-pass phases completed)
|
|
1727
|
+
return formatNativeTimingResult(p, 0, analysisTiming, {
|
|
1728
|
+
gapDetectMs: 0,
|
|
1729
|
+
chaMs: 0,
|
|
1730
|
+
thisDispatchMs: 0,
|
|
1731
|
+
reclassifyMs: 0,
|
|
1732
|
+
techniqueBackfillMs: 0,
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
const postPassTimings = await runPostNativePasses(ctx, result);
|
|
1737
|
+
// ── Structure and analysis fallback (run after edge-writing so roles see full graph) ──
|
|
1738
|
+
// Reconstruct fileSymbols once for both structure and analysis to avoid two
|
|
1739
|
+
// expensive DB scans. The DB handoff above already ensured ctx.db is a proper
|
|
1740
|
+
// better-sqlite3 connection when either flag is set.
|
|
1741
|
+
if (needsStructure || needsAnalysisFallback) {
|
|
1742
|
+
const fileSymbols = reconstructFileSymbolsFromDb(ctx);
|
|
1743
|
+
if (needsStructure) {
|
|
1744
|
+
structurePatchMs = await runPostNativeStructure(ctx, fileSymbols, !!result.isFullBuild, result.changedFiles);
|
|
1745
|
+
}
|
|
1746
|
+
if (needsAnalysisFallback) {
|
|
1747
|
+
analysisTiming = await runPostNativeAnalysis(ctx, fileSymbols, result.changedFiles);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
// P6: Vertex extraction for the analysisComplete=true path.
|
|
1751
|
+
// When needsAnalysisFallback=false (the normal native case), runPostNativeAnalysis
|
|
1752
|
+
// was skipped, so buildDataflowEdges never ran and dataflow_vertices were never
|
|
1753
|
+
// populated. Re-run the Rust dataflow visitor per file (fast — no re-parse) to
|
|
1754
|
+
// get the DataflowResult, then build vertices and inter-procedural edges.
|
|
1755
|
+
// Languages where Rust has no dataflow rules are silently skipped; a WASM
|
|
1756
|
+
// fallback for those is tracked in issue #1614.
|
|
1757
|
+
if (ctx.opts.dataflow !== false && !needsAnalysisFallback) {
|
|
1758
|
+
await runDataflowVertexPass(ctx, result.changedFiles);
|
|
1759
|
+
}
|
|
1760
|
+
closeDbPair({ db: ctx.db, nativeDb: ctx.nativeDb });
|
|
1761
|
+
return formatNativeTimingResult(p, structurePatchMs, analysisTiming, postPassTimings);
|
|
1762
|
+
}
|
|
1763
|
+
//# sourceMappingURL=native-orchestrator.js.map
|