@optave/codegraph 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -54
- package/dist/ast-analysis/engine.d.ts +17 -0
- package/dist/ast-analysis/engine.d.ts.map +1 -0
- package/dist/ast-analysis/engine.js +328 -0
- package/dist/ast-analysis/engine.js.map +1 -0
- package/dist/ast-analysis/metrics.d.ts +51 -0
- package/dist/ast-analysis/metrics.d.ts.map +1 -0
- package/dist/ast-analysis/metrics.js +106 -0
- package/dist/ast-analysis/metrics.js.map +1 -0
- package/dist/ast-analysis/rules/csharp.d.ts +24 -0
- package/dist/ast-analysis/rules/csharp.d.ts.map +1 -0
- package/dist/ast-analysis/rules/csharp.js +192 -0
- package/dist/ast-analysis/rules/csharp.js.map +1 -0
- package/dist/ast-analysis/rules/go.d.ts +24 -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 +31 -0
- package/dist/ast-analysis/rules/index.d.ts.map +1 -0
- package/dist/ast-analysis/rules/index.js +72 -0
- package/dist/ast-analysis/rules/index.js.map +1 -0
- package/dist/ast-analysis/rules/java.d.ts +24 -0
- package/dist/ast-analysis/rules/java.d.ts.map +1 -0
- package/dist/ast-analysis/rules/java.js +166 -0
- package/dist/ast-analysis/rules/java.js.map +1 -0
- package/dist/ast-analysis/rules/javascript.d.ts +31 -0
- package/dist/ast-analysis/rules/javascript.d.ts.map +1 -0
- package/dist/ast-analysis/rules/javascript.js +235 -0
- package/dist/ast-analysis/rules/javascript.js.map +1 -0
- package/dist/ast-analysis/rules/php.d.ts +24 -0
- package/dist/ast-analysis/rules/php.d.ts.map +1 -0
- package/dist/ast-analysis/rules/php.js +210 -0
- package/dist/ast-analysis/rules/php.js.map +1 -0
- package/dist/ast-analysis/rules/python.d.ts +24 -0
- package/dist/ast-analysis/rules/python.d.ts.map +1 -0
- package/dist/ast-analysis/rules/python.js +188 -0
- package/dist/ast-analysis/rules/python.js.map +1 -0
- package/dist/ast-analysis/rules/ruby.d.ts +24 -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 +24 -0
- package/dist/ast-analysis/rules/rust.d.ts.map +1 -0
- package/dist/ast-analysis/rules/rust.js +165 -0
- package/dist/ast-analysis/rules/rust.js.map +1 -0
- package/dist/ast-analysis/shared.d.ts +106 -0
- package/dist/ast-analysis/shared.d.ts.map +1 -0
- package/dist/ast-analysis/shared.js +186 -0
- package/dist/ast-analysis/shared.js.map +1 -0
- package/dist/ast-analysis/visitor-utils.d.ts +41 -0
- package/dist/ast-analysis/visitor-utils.d.ts.map +1 -0
- package/dist/ast-analysis/visitor-utils.js +180 -0
- package/dist/ast-analysis/visitor-utils.js.map +1 -0
- package/dist/ast-analysis/visitor.d.ts +119 -0
- package/dist/ast-analysis/visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitor.js +146 -0
- package/dist/ast-analysis/visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.d.ts +11 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.js +147 -0
- package/dist/ast-analysis/visitors/ast-store-visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts +8 -0
- package/dist/ast-analysis/visitors/cfg-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/cfg-visitor.js +660 -0
- package/dist/ast-analysis/visitors/cfg-visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/complexity-visitor.d.ts +17 -0
- package/dist/ast-analysis/visitors/complexity-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/complexity-visitor.js +216 -0
- package/dist/ast-analysis/visitors/complexity-visitor.js.map +1 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.d.ts +8 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.d.ts.map +1 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.js +321 -0
- package/dist/ast-analysis/visitors/dataflow-visitor.js.map +1 -0
- package/dist/cli/commands/ast.d.ts +9 -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 +9 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +46 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/batch.d.ts +9 -0
- package/dist/cli/commands/batch.d.ts.map +1 -0
- package/dist/cli/commands/batch.js +70 -0
- package/dist/cli/commands/batch.js.map +1 -0
- package/dist/cli/commands/branch-compare.d.ts +7 -0
- package/dist/cli/commands/branch-compare.d.ts.map +1 -0
- package/dist/cli/commands/branch-compare.js +22 -0
- package/dist/cli/commands/branch-compare.js.map +1 -0
- package/dist/cli/commands/brief.d.ts +7 -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 +7 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +26 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/cfg.d.ts +10 -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 +8 -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 +9 -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 +7 -0
- package/dist/cli/commands/co-change.d.ts.map +1 -0
- package/dist/cli/commands/co-change.js +62 -0
- package/dist/cli/commands/co-change.js.map +1 -0
- package/dist/cli/commands/communities.d.ts +8 -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 +9 -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/context.d.ts +10 -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 +7 -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 +10 -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 +8 -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 +7 -0
- package/dist/cli/commands/diff-impact.d.ts.map +1 -0
- package/dist/cli/commands/diff-impact.js +28 -0
- package/dist/cli/commands/diff-impact.js.map +1 -0
- package/dist/cli/commands/embed.d.ts +8 -0
- package/dist/cli/commands/embed.d.ts.map +1 -0
- package/dist/cli/commands/embed.js +29 -0
- package/dist/cli/commands/embed.js.map +1 -0
- package/dist/cli/commands/export.d.ts +7 -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 +8 -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 +10 -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 +10 -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 +7 -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 +10 -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 +6 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +66 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/interfaces.d.ts +10 -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 +7 -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 +7 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +19 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/models.d.ts +6 -0
- package/dist/cli/commands/models.d.ts.map +1 -0
- package/dist/cli/commands/models.js +17 -0
- package/dist/cli/commands/models.js.map +1 -0
- package/dist/cli/commands/owners.d.ts +8 -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 +8 -0
- package/dist/cli/commands/path.d.ts.map +1 -0
- package/dist/cli/commands/path.js +36 -0
- package/dist/cli/commands/path.js.map +1 -0
- package/dist/cli/commands/plot.d.ts +7 -0
- package/dist/cli/commands/plot.d.ts.map +1 -0
- package/dist/cli/commands/plot.js +94 -0
- package/dist/cli/commands/plot.js.map +1 -0
- package/dist/cli/commands/query.d.ts +10 -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 +16 -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 +9 -0
- package/dist/cli/commands/roles.d.ts.map +1 -0
- package/dist/cli/commands/roles.js +31 -0
- package/dist/cli/commands/roles.js.map +1 -0
- package/dist/cli/commands/search.d.ts +9 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +47 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/sequence.d.ts +10 -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 +11 -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 +7 -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 +7 -0
- package/dist/cli/commands/structure.d.ts.map +1 -0
- package/dist/cli/commands/structure.js +33 -0
- package/dist/cli/commands/structure.js.map +1 -0
- package/dist/cli/commands/triage.d.ts +8 -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 +6 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +12 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/commands/where.d.ts +9 -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 +31 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +109 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/shared/open-graph.d.ts +14 -0
- package/dist/cli/shared/open-graph.d.ts.map +1 -0
- package/dist/cli/shared/open-graph.js +13 -0
- package/dist/cli/shared/open-graph.js.map +1 -0
- package/dist/cli/shared/options.d.ts +31 -0
- package/dist/cli/shared/options.d.ts.map +1 -0
- package/dist/cli/shared/options.js +58 -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.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +15 -0
- package/dist/cli.js.map +1 -0
- package/dist/db/connection.d.ts +39 -0
- package/dist/db/connection.d.ts.map +1 -0
- package/dist/db/connection.js +217 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/index.d.ts +5 -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 +8 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +323 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/query-builder.d.ts +106 -0
- package/dist/db/query-builder.d.ts.map +1 -0
- package/dist/db/query-builder.js +313 -0
- package/dist/db/query-builder.js.map +1 -0
- package/dist/db/repository/base.d.ts +115 -0
- package/dist/db/repository/base.d.ts.map +1 -0
- package/dist/db/repository/base.js +165 -0
- package/dist/db/repository/base.js.map +1 -0
- package/dist/db/repository/build-stmts.d.ts +25 -0
- package/dist/db/repository/build-stmts.d.ts.map +1 -0
- package/dist/db/repository/build-stmts.js +86 -0
- package/dist/db/repository/build-stmts.js.map +1 -0
- package/dist/db/repository/cached-stmt.d.ts +13 -0
- package/dist/db/repository/cached-stmt.d.ts.map +1 -0
- package/dist/db/repository/cached-stmt.js +20 -0
- package/dist/db/repository/cached-stmt.js.map +1 -0
- package/dist/db/repository/cfg.d.ts +27 -0
- package/dist/db/repository/cfg.d.ts.map +1 -0
- package/dist/db/repository/cfg.js +57 -0
- package/dist/db/repository/cfg.js.map +1 -0
- package/dist/db/repository/cochange.d.ts +20 -0
- package/dist/db/repository/cochange.d.ts.map +1 -0
- package/dist/db/repository/cochange.js +45 -0
- package/dist/db/repository/cochange.js.map +1 -0
- package/dist/db/repository/complexity.d.ts +15 -0
- package/dist/db/repository/complexity.d.ts.map +1 -0
- package/dist/db/repository/complexity.js +15 -0
- package/dist/db/repository/complexity.js.map +1 -0
- package/dist/db/repository/dataflow.d.ts +7 -0
- package/dist/db/repository/dataflow.d.ts.map +1 -0
- package/dist/db/repository/dataflow.js +17 -0
- package/dist/db/repository/dataflow.js.map +1 -0
- package/dist/db/repository/edges.d.ts +173 -0
- package/dist/db/repository/edges.d.ts.map +1 -0
- package/dist/db/repository/edges.js +231 -0
- package/dist/db/repository/edges.js.map +1 -0
- package/dist/db/repository/embeddings.d.ts +20 -0
- package/dist/db/repository/embeddings.d.ts.map +1 -0
- package/dist/db/repository/embeddings.js +47 -0
- package/dist/db/repository/embeddings.js.map +1 -0
- package/dist/db/repository/graph-read.d.ts +41 -0
- package/dist/db/repository/graph-read.d.ts.map +1 -0
- package/dist/db/repository/graph-read.js +41 -0
- package/dist/db/repository/graph-read.js.map +1 -0
- package/dist/db/repository/in-memory-repository.d.ts +156 -0
- package/dist/db/repository/in-memory-repository.d.ts.map +1 -0
- package/dist/db/repository/in-memory-repository.js +533 -0
- package/dist/db/repository/in-memory-repository.js.map +1 -0
- package/dist/db/repository/index.d.ts +14 -0
- package/dist/db/repository/index.d.ts.map +1 -0
- package/dist/db/repository/index.js +15 -0
- package/dist/db/repository/index.js.map +1 -0
- package/dist/db/repository/nodes.d.ts +151 -0
- package/dist/db/repository/nodes.d.ts.map +1 -0
- package/dist/db/repository/nodes.js +244 -0
- package/dist/db/repository/nodes.js.map +1 -0
- package/dist/db/repository/sqlite-repository.d.ts +100 -0
- package/dist/db/repository/sqlite-repository.d.ts.map +1 -0
- package/dist/db/repository/sqlite-repository.js +143 -0
- package/dist/db/repository/sqlite-repository.js.map +1 -0
- package/dist/domain/analysis/brief.d.ts +16 -0
- package/dist/domain/analysis/brief.d.ts.map +1 -0
- package/dist/domain/analysis/brief.js +147 -0
- package/dist/domain/analysis/brief.js.map +1 -0
- package/dist/domain/analysis/context.d.ts +3 -0
- package/dist/domain/analysis/context.d.ts.map +1 -0
- package/dist/domain/analysis/context.js +378 -0
- package/dist/domain/analysis/context.js.map +1 -0
- package/dist/domain/analysis/dependencies.d.ts +60 -0
- package/dist/domain/analysis/dependencies.d.ts.map +1 -0
- package/dist/domain/analysis/dependencies.js +359 -0
- package/dist/domain/analysis/dependencies.js.map +1 -0
- package/dist/domain/analysis/exports.d.ts +2 -0
- package/dist/domain/analysis/exports.d.ts.map +1 -0
- package/dist/domain/analysis/exports.js +168 -0
- package/dist/domain/analysis/exports.js.map +1 -0
- package/dist/domain/analysis/impact.d.ts +39 -0
- package/dist/domain/analysis/impact.d.ts.map +1 -0
- package/dist/domain/analysis/impact.js +596 -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 +93 -0
- package/dist/domain/analysis/implementations.js.map +1 -0
- package/dist/domain/analysis/module-map.d.ts +64 -0
- package/dist/domain/analysis/module-map.d.ts.map +1 -0
- package/dist/domain/analysis/module-map.js +334 -0
- package/dist/domain/analysis/module-map.js.map +1 -0
- package/dist/domain/analysis/roles.d.ts +2 -0
- package/dist/domain/analysis/roles.d.ts.map +1 -0
- package/dist/domain/analysis/roles.js +50 -0
- package/dist/domain/analysis/roles.js.map +1 -0
- package/dist/domain/analysis/symbol-lookup.d.ts +12 -0
- package/dist/domain/analysis/symbol-lookup.d.ts.map +1 -0
- package/dist/domain/analysis/symbol-lookup.js +202 -0
- package/dist/domain/analysis/symbol-lookup.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 +78 -0
- package/dist/domain/graph/builder/context.js.map +1 -0
- package/dist/domain/graph/builder/helpers.d.ts +43 -0
- package/dist/domain/graph/builder/helpers.d.ts.map +1 -0
- package/dist/domain/graph/builder/helpers.js +209 -0
- package/dist/domain/graph/builder/helpers.js.map +1 -0
- package/dist/domain/graph/builder/incremental.d.ts +17 -0
- package/dist/domain/graph/builder/incremental.d.ts.map +1 -0
- package/dist/domain/graph/builder/incremental.js +191 -0
- package/dist/domain/graph/builder/incremental.js.map +1 -0
- package/dist/domain/graph/builder/pipeline.d.ts +13 -0
- package/dist/domain/graph/builder/pipeline.d.ts.map +1 -0
- package/dist/domain/graph/builder/pipeline.js +146 -0
- package/dist/domain/graph/builder/pipeline.js.map +1 -0
- package/dist/domain/graph/builder/stages/build-edges.d.ts +5 -0
- package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/build-edges.js +387 -0
- package/dist/domain/graph/builder/stages/build-edges.js.map +1 -0
- package/dist/domain/graph/builder/stages/build-structure.d.ts +5 -0
- package/dist/domain/graph/builder/stages/build-structure.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/build-structure.js +107 -0
- package/dist/domain/graph/builder/stages/build-structure.js.map +1 -0
- package/dist/domain/graph/builder/stages/collect-files.d.ts +5 -0
- package/dist/domain/graph/builder/stages/collect-files.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/collect-files.js +45 -0
- package/dist/domain/graph/builder/stages/collect-files.js.map +1 -0
- package/dist/domain/graph/builder/stages/detect-changes.d.ts +5 -0
- package/dist/domain/graph/builder/stages/detect-changes.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/detect-changes.js +358 -0
- package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -0
- package/dist/domain/graph/builder/stages/finalize.d.ts +5 -0
- package/dist/domain/graph/builder/stages/finalize.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/finalize.js +123 -0
- package/dist/domain/graph/builder/stages/finalize.js.map +1 -0
- package/dist/domain/graph/builder/stages/insert-nodes.d.ts +5 -0
- package/dist/domain/graph/builder/stages/insert-nodes.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/insert-nodes.js +183 -0
- package/dist/domain/graph/builder/stages/insert-nodes.js.map +1 -0
- package/dist/domain/graph/builder/stages/parse-files.d.ts +5 -0
- package/dist/domain/graph/builder/stages/parse-files.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/parse-files.js +25 -0
- package/dist/domain/graph/builder/stages/parse-files.js.map +1 -0
- package/dist/domain/graph/builder/stages/resolve-imports.d.ts +18 -0
- package/dist/domain/graph/builder/stages/resolve-imports.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/resolve-imports.js +139 -0
- package/dist/domain/graph/builder/stages/resolve-imports.js.map +1 -0
- package/dist/domain/graph/builder/stages/run-analyses.d.ts +5 -0
- package/dist/domain/graph/builder/stages/run-analyses.d.ts.map +1 -0
- package/dist/domain/graph/builder/stages/run-analyses.js +39 -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 +57 -0
- package/dist/domain/graph/change-journal.d.ts.map +1 -0
- package/dist/domain/graph/change-journal.js +120 -0
- package/dist/domain/graph/change-journal.js.map +1 -0
- package/dist/domain/graph/cycles.d.ts +18 -0
- package/dist/domain/graph/cycles.d.ts.map +1 -0
- package/dist/domain/graph/cycles.js +75 -0
- package/dist/domain/graph/cycles.js.map +1 -0
- package/dist/domain/graph/journal.d.ts +27 -0
- package/dist/domain/graph/journal.d.ts.map +1 -0
- package/dist/domain/graph/journal.js +100 -0
- package/dist/domain/graph/journal.js.map +1 -0
- package/dist/domain/graph/resolve.d.ts +76 -0
- package/dist/domain/graph/resolve.d.ts.map +1 -0
- package/dist/domain/graph/resolve.js +482 -0
- package/dist/domain/graph/resolve.js.map +1 -0
- package/dist/domain/graph/watcher.d.ts +2 -0
- package/dist/domain/graph/watcher.d.ts.map +1 -0
- package/dist/domain/graph/watcher.js +140 -0
- package/dist/domain/graph/watcher.js.map +1 -0
- package/dist/domain/parser.d.ts +104 -0
- package/dist/domain/parser.d.ts.map +1 -0
- package/dist/domain/parser.js +557 -0
- package/dist/domain/parser.js.map +1 -0
- package/dist/domain/queries.d.ts +14 -0
- package/dist/domain/queries.d.ts.map +1 -0
- package/dist/domain/queries.js +25 -0
- package/dist/domain/queries.js.map +1 -0
- package/dist/domain/search/generator.d.ts +17 -0
- package/dist/domain/search/generator.d.ts.map +1 -0
- package/dist/domain/search/generator.js +135 -0
- package/dist/domain/search/generator.js.map +1 -0
- package/dist/domain/search/index.d.ts +8 -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 +82 -0
- package/dist/domain/search/models.d.ts.map +1 -0
- package/dist/domain/search/models.js +198 -0
- package/dist/domain/search/models.js.map +1 -0
- package/dist/domain/search/search/cli-formatter.d.ts +6 -0
- package/dist/domain/search/search/cli-formatter.d.ts.map +1 -0
- package/dist/domain/search/search/cli-formatter.js +135 -0
- package/dist/domain/search/search/cli-formatter.js.map +1 -0
- package/dist/domain/search/search/filters.d.ts +19 -0
- package/dist/domain/search/search/filters.d.ts.map +1 -0
- package/dist/domain/search/search/filters.js +48 -0
- package/dist/domain/search/search/filters.js.map +1 -0
- package/dist/domain/search/search/hybrid.d.ts +22 -0
- package/dist/domain/search/search/hybrid.d.ts.map +1 -0
- package/dist/domain/search/search/hybrid.js +113 -0
- package/dist/domain/search/search/hybrid.js.map +1 -0
- package/dist/domain/search/search/keyword.d.ts +17 -0
- package/dist/domain/search/search/keyword.d.ts.map +1 -0
- package/dist/domain/search/search/keyword.js +66 -0
- package/dist/domain/search/search/keyword.js.map +1 -0
- package/dist/domain/search/search/prepare.d.ts +13 -0
- package/dist/domain/search/search/prepare.d.ts.map +1 -0
- package/dist/domain/search/search/prepare.js +70 -0
- package/dist/domain/search/search/prepare.js.map +1 -0
- package/dist/domain/search/search/semantic.d.ts +34 -0
- package/dist/domain/search/search/semantic.d.ts.map +1 -0
- package/dist/domain/search/search/semantic.js +129 -0
- package/dist/domain/search/search/semantic.js.map +1 -0
- package/dist/domain/search/stores/fts5.d.ts +11 -0
- package/dist/domain/search/stores/fts5.d.ts.map +1 -0
- package/dist/domain/search/stores/fts5.js +31 -0
- package/dist/domain/search/stores/fts5.js.map +1 -0
- package/dist/domain/search/stores/sqlite-blob.d.ts +27 -0
- package/dist/domain/search/stores/sqlite-blob.d.ts.map +1 -0
- package/dist/domain/search/stores/sqlite-blob.js +22 -0
- package/dist/domain/search/stores/sqlite-blob.js.map +1 -0
- package/dist/domain/search/strategies/source.d.ts +5 -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 +6 -0
- package/dist/domain/search/strategies/structured.d.ts.map +1 -0
- package/dist/domain/search/strategies/structured.js +40 -0
- package/dist/domain/search/strategies/structured.js.map +1 -0
- package/dist/domain/search/strategies/text-utils.d.ts +11 -0
- package/dist/domain/search/strategies/text-utils.d.ts.map +1 -0
- package/dist/domain/search/strategies/text-utils.js +47 -0
- package/dist/domain/search/strategies/text-utils.js.map +1 -0
- package/dist/extractors/csharp.d.ts +12 -0
- package/dist/extractors/csharp.d.ts.map +1 -0
- package/dist/extractors/csharp.js +402 -0
- package/dist/extractors/csharp.js.map +1 -0
- package/dist/extractors/go.d.ts +12 -0
- package/dist/extractors/go.d.ts.map +1 -0
- package/dist/extractors/go.js +381 -0
- package/dist/extractors/go.js.map +1 -0
- package/dist/extractors/hcl.d.ts +11 -0
- package/dist/extractors/hcl.d.ts.map +1 -0
- package/dist/extractors/hcl.js +105 -0
- package/dist/extractors/hcl.js.map +1 -0
- package/dist/extractors/helpers.d.ts +16 -0
- package/dist/extractors/helpers.d.ts.map +1 -0
- package/dist/extractors/helpers.js +88 -0
- package/dist/extractors/helpers.js.map +1 -0
- package/dist/extractors/index.d.ts +10 -0
- package/dist/extractors/index.d.ts.map +1 -0
- package/dist/extractors/index.js +10 -0
- package/dist/extractors/index.js.map +1 -0
- package/dist/extractors/java.d.ts +12 -0
- package/dist/extractors/java.d.ts.map +1 -0
- package/dist/extractors/java.js +325 -0
- package/dist/extractors/java.js.map +1 -0
- package/dist/extractors/javascript.d.ts +81 -0
- package/dist/extractors/javascript.d.ts.map +1 -0
- package/dist/extractors/javascript.js +1232 -0
- package/dist/extractors/javascript.js.map +1 -0
- package/dist/extractors/php.d.ts +12 -0
- package/dist/extractors/php.d.ts.map +1 -0
- package/dist/extractors/php.js +380 -0
- package/dist/extractors/php.js.map +1 -0
- package/dist/extractors/python.d.ts +12 -0
- package/dist/extractors/python.d.ts.map +1 -0
- package/dist/extractors/python.js +426 -0
- package/dist/extractors/python.js.map +1 -0
- package/dist/extractors/ruby.d.ts +11 -0
- package/dist/extractors/ruby.d.ts.map +1 -0
- package/dist/extractors/ruby.js +284 -0
- package/dist/extractors/ruby.js.map +1 -0
- package/dist/extractors/rust.d.ts +12 -0
- package/dist/extractors/rust.d.ts.map +1 -0
- package/dist/extractors/rust.js +366 -0
- package/dist/extractors/rust.js.map +1 -0
- package/dist/features/ast.d.ts +30 -0
- package/dist/features/ast.d.ts.map +1 -0
- package/dist/features/ast.js +242 -0
- package/dist/features/ast.js.map +1 -0
- package/dist/features/audit.d.ts +6 -0
- package/dist/features/audit.d.ts.map +1 -0
- package/dist/features/audit.js +283 -0
- package/dist/features/audit.js.map +1 -0
- package/dist/features/batch.d.ts +110 -0
- package/dist/features/batch.d.ts.map +1 -0
- package/dist/features/batch.js +138 -0
- package/dist/features/batch.js.map +1 -0
- package/dist/features/boundaries.d.ts +69 -0
- package/dist/features/boundaries.d.ts.map +1 -0
- package/dist/features/boundaries.js +344 -0
- package/dist/features/boundaries.js.map +1 -0
- package/dist/features/branch-compare.d.ts +52 -0
- package/dist/features/branch-compare.d.ts.map +1 -0
- package/dist/features/branch-compare.js +425 -0
- package/dist/features/branch-compare.js.map +1 -0
- package/dist/features/cfg.d.ts +51 -0
- package/dist/features/cfg.d.ts.map +1 -0
- package/dist/features/cfg.js +372 -0
- package/dist/features/cfg.js.map +1 -0
- package/dist/features/check.d.ts +99 -0
- package/dist/features/check.d.ts.map +1 -0
- package/dist/features/check.js +296 -0
- package/dist/features/check.js.map +1 -0
- package/dist/features/cochange.d.ts +119 -0
- package/dist/features/cochange.d.ts.map +1 -0
- package/dist/features/cochange.js +425 -0
- package/dist/features/cochange.js.map +1 -0
- package/dist/features/communities.d.ts +40 -0
- package/dist/features/communities.d.ts.map +1 -0
- package/dist/features/communities.js +163 -0
- package/dist/features/communities.js.map +1 -0
- package/dist/features/complexity.d.ts +127 -0
- package/dist/features/complexity.d.ts.map +1 -0
- package/dist/features/complexity.js +683 -0
- package/dist/features/complexity.js.map +1 -0
- package/dist/features/dataflow.d.ts +72 -0
- package/dist/features/dataflow.d.ts.map +1 -0
- package/dist/features/dataflow.js +483 -0
- package/dist/features/dataflow.js.map +1 -0
- package/dist/features/export.d.ts +29 -0
- package/dist/features/export.d.ts.map +1 -0
- package/dist/features/export.js +336 -0
- package/dist/features/export.js.map +1 -0
- package/dist/features/flow.d.ts +49 -0
- package/dist/features/flow.d.ts.map +1 -0
- package/dist/features/flow.js +203 -0
- package/dist/features/flow.js.map +1 -0
- package/dist/features/graph-enrichment.d.ts +54 -0
- package/dist/features/graph-enrichment.d.ts.map +1 -0
- package/dist/features/graph-enrichment.js +297 -0
- package/dist/features/graph-enrichment.js.map +1 -0
- package/dist/features/manifesto.d.ts +46 -0
- package/dist/features/manifesto.d.ts.map +1 -0
- package/dist/features/manifesto.js +398 -0
- package/dist/features/manifesto.js.map +1 -0
- package/dist/features/owners.d.ts +123 -0
- package/dist/features/owners.d.ts.map +1 -0
- package/dist/features/owners.js +289 -0
- package/dist/features/owners.js.map +1 -0
- package/dist/features/sequence.d.ts +33 -0
- package/dist/features/sequence.d.ts.map +1 -0
- package/dist/features/sequence.js +269 -0
- package/dist/features/sequence.js.map +1 -0
- package/dist/features/shared/find-nodes.d.ts +11 -0
- package/dist/features/shared/find-nodes.d.ts.map +1 -0
- package/dist/features/shared/find-nodes.js +27 -0
- package/dist/features/shared/find-nodes.js.map +1 -0
- package/dist/features/snapshot.d.ts +64 -0
- package/dist/features/snapshot.d.ts.map +1 -0
- package/dist/features/snapshot.js +132 -0
- package/dist/features/snapshot.js.map +1 -0
- package/dist/features/structure.d.ts +42 -0
- package/dist/features/structure.d.ts.map +1 -0
- package/dist/features/structure.js +596 -0
- package/dist/features/structure.js.map +1 -0
- package/dist/features/triage.d.ts +13 -0
- package/dist/features/triage.d.ts.map +1 -0
- package/dist/features/triage.js +133 -0
- package/dist/features/triage.js.map +1 -0
- package/dist/graph/algorithms/bfs.d.ts +13 -0
- package/dist/graph/algorithms/bfs.d.ts.map +1 -0
- package/dist/graph/algorithms/bfs.js +47 -0
- package/dist/graph/algorithms/bfs.js.map +1 -0
- package/dist/graph/algorithms/centrality.d.ts +11 -0
- package/dist/graph/algorithms/centrality.d.ts.map +1 -0
- package/dist/graph/algorithms/centrality.js +17 -0
- package/dist/graph/algorithms/centrality.js.map +1 -0
- package/dist/graph/algorithms/index.d.ts +6 -0
- package/dist/graph/algorithms/index.d.ts.map +1 -0
- package/dist/graph/algorithms/index.js +6 -0
- package/dist/graph/algorithms/index.js.map +1 -0
- package/dist/graph/algorithms/louvain.d.ts +5 -0
- package/dist/graph/algorithms/louvain.d.ts.map +1 -0
- package/dist/graph/algorithms/louvain.js +22 -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 +41 -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 +48 -0
- package/dist/graph/algorithms/tarjan.js.map +1 -0
- package/dist/graph/builders/dependency.d.ts +15 -0
- package/dist/graph/builders/dependency.d.ts.map +1 -0
- package/dist/graph/builders/dependency.js +99 -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 +7 -0
- package/dist/graph/builders/structure.d.ts.map +1 -0
- package/dist/graph/builders/structure.js +32 -0
- package/dist/graph/builders/structure.js.map +1 -0
- package/dist/graph/builders/temporal.d.ts +10 -0
- package/dist/graph/builders/temporal.d.ts.map +1 -0
- package/dist/graph/builders/temporal.js +31 -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 +49 -0
- package/dist/graph/classifiers/risk.d.ts.map +1 -0
- package/dist/graph/classifiers/risk.js +84 -0
- package/dist/graph/classifiers/risk.js.map +1 -0
- package/dist/graph/classifiers/roles.d.ts +29 -0
- package/dist/graph/classifiers/roles.d.ts.map +1 -0
- package/dist/graph/classifiers/roles.js +109 -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 +53 -0
- package/dist/graph/model.d.ts.map +1 -0
- package/dist/graph/model.js +210 -0
- package/dist/graph/model.js.map +1 -0
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +26 -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 +222 -0
- package/dist/infrastructure/config.d.ts.map +1 -0
- package/dist/infrastructure/config.js +386 -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 +19 -0
- package/dist/infrastructure/native.d.ts.map +1 -0
- package/dist/infrastructure/native.js +105 -0
- package/dist/infrastructure/native.js.map +1 -0
- package/dist/infrastructure/registry.d.ts +57 -0
- package/dist/infrastructure/registry.d.ts.map +1 -0
- package/dist/infrastructure/registry.js +157 -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/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 +24 -0
- package/dist/infrastructure/update-check.d.ts.map +1 -0
- package/dist/infrastructure/update-check.js +150 -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 +38 -0
- package/dist/mcp/middleware.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +120 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +8 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js +819 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/tools/ast-query.d.ts +9 -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 +3 -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 +9 -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 +3 -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 +3 -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 +10 -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 +24 -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 +10 -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 +48 -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 +8 -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 +7 -0
- package/dist/mcp/tools/complexity.d.ts.map +1 -0
- package/dist/mcp/tools/complexity.js +17 -0
- package/dist/mcp/tools/complexity.js.map +1 -0
- package/dist/mcp/tools/context.d.ts +3 -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 +6 -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 +3 -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 +17 -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 +3 -0
- package/dist/mcp/tools/export-graph.d.ts.map +1 -0
- package/dist/mcp/tools/export-graph.js +55 -0
- package/dist/mcp/tools/export-graph.js.map +1 -0
- package/dist/mcp/tools/file-deps.d.ts +3 -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 +3 -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 +6 -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 +3 -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 +3 -0
- package/dist/mcp/tools/impact-analysis.d.ts.map +1 -0
- package/dist/mcp/tools/impact-analysis.js +11 -0
- package/dist/mcp/tools/impact-analysis.js.map +1 -0
- package/dist/mcp/tools/implementations.d.ts +3 -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 +3 -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 +3 -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 +3 -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 +11 -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 +3 -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 +3 -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 +3 -0
- package/dist/mcp/tools/path.d.ts.map +1 -0
- package/dist/mcp/tools/path.js +12 -0
- package/dist/mcp/tools/path.js.map +1 -0
- package/dist/mcp/tools/query.d.ts +3 -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 +3 -0
- package/dist/mcp/tools/semantic-search.d.ts.map +1 -0
- package/dist/mcp/tools/semantic-search.js +61 -0
- package/dist/mcp/tools/semantic-search.js.map +1 -0
- package/dist/mcp/tools/sequence.d.ts +18 -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 +3 -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 +3 -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 +3 -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 +3 -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/presentation/audit.d.ts +5 -0
- package/dist/presentation/audit.d.ts.map +1 -0
- package/dist/presentation/audit.js +77 -0
- package/dist/presentation/audit.js.map +1 -0
- package/dist/presentation/batch.d.ts +10 -0
- package/dist/presentation/batch.d.ts.map +1 -0
- package/dist/presentation/batch.js +25 -0
- package/dist/presentation/batch.js.map +1 -0
- package/dist/presentation/branch-compare.d.ts +2 -0
- package/dist/presentation/branch-compare.d.ts.map +1 -0
- package/dist/presentation/branch-compare.js +75 -0
- package/dist/presentation/branch-compare.js.map +1 -0
- package/dist/presentation/brief.d.ts +12 -0
- package/dist/presentation/brief.d.ts.map +1 -0
- package/dist/presentation/brief.js +49 -0
- package/dist/presentation/brief.js.map +1 -0
- package/dist/presentation/cfg.d.ts +5 -0
- package/dist/presentation/cfg.d.ts.map +1 -0
- package/dist/presentation/cfg.js +50 -0
- package/dist/presentation/cfg.js.map +1 -0
- package/dist/presentation/check.d.ts +5 -0
- package/dist/presentation/check.d.ts.map +1 -0
- package/dist/presentation/check.js +70 -0
- package/dist/presentation/check.js.map +1 -0
- package/dist/presentation/cochange.d.ts +9 -0
- package/dist/presentation/cochange.d.ts.map +1 -0
- package/dist/presentation/cochange.js +39 -0
- package/dist/presentation/cochange.js.map +1 -0
- package/dist/presentation/colors.d.ts +26 -0
- package/dist/presentation/colors.d.ts.map +1 -0
- package/dist/presentation/colors.js +42 -0
- package/dist/presentation/colors.js.map +1 -0
- package/dist/presentation/communities.d.ts +5 -0
- package/dist/presentation/communities.d.ts.map +1 -0
- package/dist/presentation/communities.js +56 -0
- package/dist/presentation/communities.js.map +1 -0
- package/dist/presentation/complexity.d.ts +5 -0
- package/dist/presentation/complexity.d.ts.map +1 -0
- package/dist/presentation/complexity.js +56 -0
- package/dist/presentation/complexity.js.map +1 -0
- package/dist/presentation/dataflow.d.ts +5 -0
- package/dist/presentation/dataflow.d.ts.map +1 -0
- package/dist/presentation/dataflow.js +96 -0
- package/dist/presentation/dataflow.js.map +1 -0
- package/dist/presentation/export.d.ts +137 -0
- package/dist/presentation/export.d.ts.map +1 -0
- package/dist/presentation/export.js +374 -0
- package/dist/presentation/export.js.map +1 -0
- package/dist/presentation/flow.d.ts +5 -0
- package/dist/presentation/flow.d.ts.map +1 -0
- package/dist/presentation/flow.js +64 -0
- package/dist/presentation/flow.js.map +1 -0
- package/dist/presentation/manifesto.d.ts +5 -0
- package/dist/presentation/manifesto.d.ts.map +1 -0
- package/dist/presentation/manifesto.js +56 -0
- package/dist/presentation/manifesto.js.map +1 -0
- package/dist/presentation/owners.d.ts +5 -0
- package/dist/presentation/owners.d.ts.map +1 -0
- package/dist/presentation/owners.js +45 -0
- package/dist/presentation/owners.js.map +1 -0
- package/dist/presentation/queries-cli/exports.d.ts +2 -0
- package/dist/presentation/queries-cli/exports.d.ts.map +1 -0
- package/dist/presentation/queries-cli/exports.js +94 -0
- package/dist/presentation/queries-cli/exports.js.map +1 -0
- package/dist/presentation/queries-cli/impact.d.ts +6 -0
- package/dist/presentation/queries-cli/impact.d.ts.map +1 -0
- package/dist/presentation/queries-cli/impact.js +196 -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 +8 -0
- package/dist/presentation/queries-cli/inspect.d.ts.map +1 -0
- package/dist/presentation/queries-cli/inspect.js +353 -0
- package/dist/presentation/queries-cli/inspect.js.map +1 -0
- package/dist/presentation/queries-cli/overview.d.ts +4 -0
- package/dist/presentation/queries-cli/overview.d.ts.map +1 -0
- package/dist/presentation/queries-cli/overview.js +163 -0
- package/dist/presentation/queries-cli/overview.js.map +1 -0
- package/dist/presentation/queries-cli/path.d.ts +2 -0
- package/dist/presentation/queries-cli/path.d.ts.map +1 -0
- package/dist/presentation/queries-cli/path.js +51 -0
- package/dist/presentation/queries-cli/path.js.map +1 -0
- package/dist/presentation/queries-cli.d.ts +2 -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 +6 -0
- package/dist/presentation/query.js.map +1 -0
- package/dist/presentation/result-formatter.d.ts +10 -0
- package/dist/presentation/result-formatter.d.ts.map +1 -0
- package/dist/presentation/result-formatter.js +134 -0
- package/dist/presentation/result-formatter.js.map +1 -0
- package/dist/presentation/sequence-renderer.d.ts +12 -0
- package/dist/presentation/sequence-renderer.d.ts.map +1 -0
- package/dist/presentation/sequence-renderer.js +36 -0
- package/dist/presentation/sequence-renderer.js.map +1 -0
- package/dist/presentation/sequence.d.ts +5 -0
- package/dist/presentation/sequence.d.ts.map +1 -0
- package/dist/presentation/sequence.js +29 -0
- package/dist/presentation/sequence.js.map +1 -0
- package/dist/presentation/structure.d.ts +8 -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 +28 -0
- package/dist/presentation/table.d.ts.map +1 -0
- package/dist/presentation/table.js +39 -0
- package/dist/presentation/table.js.map +1 -0
- package/dist/presentation/triage.d.ts +5 -0
- package/dist/presentation/triage.d.ts.map +1 -0
- package/dist/presentation/triage.js +37 -0
- package/dist/presentation/triage.js.map +1 -0
- package/dist/presentation/viewer.d.ts +85 -0
- package/dist/presentation/viewer.d.ts.map +1 -0
- package/dist/presentation/viewer.js +621 -0
- package/dist/presentation/viewer.js.map +1 -0
- package/dist/shared/constants.d.ts +11 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +35 -0
- package/dist/shared/constants.js.map +1 -0
- package/dist/shared/errors.d.ts +47 -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 +14 -0
- package/dist/shared/file-utils.d.ts.map +1 -0
- package/dist/shared/file-utils.js +165 -0
- package/dist/shared/file-utils.js.map +1 -0
- package/dist/shared/generators.d.ts +62 -0
- package/dist/shared/generators.d.ts.map +1 -0
- package/dist/shared/generators.js +120 -0
- package/dist/shared/generators.js.map +1 -0
- package/dist/shared/hierarchy.d.ts +2 -0
- package/dist/shared/hierarchy.d.ts.map +1 -0
- package/dist/shared/hierarchy.js +27 -0
- package/dist/shared/hierarchy.js.map +1 -0
- package/dist/shared/kinds.d.ts +11 -0
- package/dist/shared/kinds.d.ts.map +1 -0
- package/dist/shared/kinds.js +56 -0
- package/dist/shared/kinds.js.map +1 -0
- package/dist/shared/normalize.d.ts +19 -0
- package/dist/shared/normalize.d.ts.map +1 -0
- package/dist/shared/normalize.js +59 -0
- package/dist/shared/normalize.js.map +1 -0
- package/dist/shared/paginate.d.ts +80 -0
- package/dist/shared/paginate.d.ts.map +1 -0
- package/dist/shared/paginate.js +111 -0
- package/dist/shared/paginate.js.map +1 -0
- package/dist/types.d.ts +1322 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/package.json +21 -15
- package/src/cli/commands/diff-impact.js +2 -0
- package/src/cli/commands/fn-impact.js +2 -0
- package/src/cli/commands/implementations.js +29 -0
- package/src/cli/commands/info.js +1 -1
- package/src/cli/commands/interfaces.js +29 -0
- package/src/cli/commands/roles.js +2 -1
- package/src/cli/commands/triage.js +4 -1
- package/src/db/index.js +2 -0
- package/src/db/query-builder.js +9 -4
- package/src/db/repository/edges.js +38 -0
- package/src/db/repository/in-memory-repository.js +11 -2
- package/src/db/repository/index.js +2 -0
- package/src/domain/analysis/brief.js +12 -6
- package/src/domain/analysis/context.js +74 -20
- package/src/domain/analysis/exports.js +81 -10
- package/src/domain/analysis/impact.js +84 -6
- package/src/domain/analysis/implementations.js +98 -0
- package/src/domain/analysis/module-map.js +13 -4
- package/src/domain/analysis/roles.js +8 -2
- package/src/domain/graph/builder/incremental.js +22 -2
- package/src/domain/graph/builder/pipeline.js +9 -1
- package/src/domain/graph/builder/stages/build-edges.js +117 -20
- package/src/domain/graph/resolve.js +315 -1
- package/src/domain/parser.js +70 -6
- package/src/domain/queries.js +1 -0
- package/src/domain/search/search/hybrid.js +7 -4
- package/src/domain/search/search/semantic.js +11 -6
- package/src/extractors/csharp.js +62 -0
- package/src/extractors/go.js +141 -0
- package/src/extractors/java.js +29 -3
- package/src/extractors/javascript.js +163 -1
- package/src/extractors/php.js +43 -0
- package/src/extractors/python.js +130 -0
- package/src/extractors/rust.js +60 -0
- package/src/features/audit.js +2 -1
- package/src/features/communities.js +3 -1
- package/src/features/graph-enrichment.js +1 -1
- package/src/features/sequence.js +3 -1
- package/src/features/structure.js +33 -4
- package/src/features/triage.js +9 -2
- package/src/graph/classifiers/risk.js +9 -2
- package/src/graph/classifiers/roles.js +51 -3
- package/src/infrastructure/config.js +255 -4
- package/src/mcp/middleware.js +20 -2
- package/src/mcp/server.js +6 -0
- package/src/mcp/tool-registry.js +40 -1
- package/src/mcp/tools/implementations.js +14 -0
- package/src/mcp/tools/index.js +4 -0
- package/src/mcp/tools/interfaces.js +14 -0
- package/src/presentation/queries-cli/exports.js +54 -4
- package/src/presentation/queries-cli/index.js +9 -1
- package/src/presentation/queries-cli/inspect.js +64 -0
- package/src/presentation/queries-cli.js +3 -1
- package/src/presentation/result-formatter.js +9 -5
- package/src/shared/file-utils.js +20 -11
- package/src/shared/kinds.js +14 -1
- package/src/shared/paginate.js +10 -2
- package/src/types.ts +1609 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared AST helper functions used by multiple visitors (dataflow, etc.).
|
|
3
|
+
*
|
|
4
|
+
* Extracted from dataflow.js to be reusable across the visitor framework.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Truncate a string to a maximum length.
|
|
8
|
+
*/
|
|
9
|
+
export function truncate(str, max = 120) {
|
|
10
|
+
if (!str)
|
|
11
|
+
return '';
|
|
12
|
+
return str.length > max ? `${str.slice(0, max)}…` : str;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the name of a function node from the AST using rules.
|
|
16
|
+
*/
|
|
17
|
+
export function functionName(fnNode, rules) {
|
|
18
|
+
if (!fnNode)
|
|
19
|
+
return null;
|
|
20
|
+
const nameNode = fnNode.childForFieldName(rules.nameField);
|
|
21
|
+
if (nameNode)
|
|
22
|
+
return nameNode.text;
|
|
23
|
+
const parent = fnNode.parent;
|
|
24
|
+
if (parent) {
|
|
25
|
+
if (rules.varAssignedFnParent && parent.type === rules.varAssignedFnParent) {
|
|
26
|
+
const n = parent.childForFieldName('name');
|
|
27
|
+
return n ? n.text : null;
|
|
28
|
+
}
|
|
29
|
+
if (rules.pairFnParent && parent.type === rules.pairFnParent) {
|
|
30
|
+
const keyNode = parent.childForFieldName('key');
|
|
31
|
+
return keyNode ? keyNode.text : null;
|
|
32
|
+
}
|
|
33
|
+
if (rules.assignmentFnParent && parent.type === rules.assignmentFnParent) {
|
|
34
|
+
const left = parent.childForFieldName(rules.assignLeftField);
|
|
35
|
+
return left ? left.text : null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Extract parameter names and indices from a formal_parameters node.
|
|
42
|
+
*/
|
|
43
|
+
export function extractParams(paramsNode, rules) {
|
|
44
|
+
if (!paramsNode)
|
|
45
|
+
return [];
|
|
46
|
+
const result = [];
|
|
47
|
+
let index = 0;
|
|
48
|
+
for (const child of paramsNode.namedChildren) {
|
|
49
|
+
const names = extractParamNames(child, rules);
|
|
50
|
+
for (const name of names) {
|
|
51
|
+
result.push({ name, index });
|
|
52
|
+
}
|
|
53
|
+
index++;
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Extract parameter names from a single parameter node.
|
|
59
|
+
*/
|
|
60
|
+
export function extractParamNames(node, rules) {
|
|
61
|
+
if (!node)
|
|
62
|
+
return [];
|
|
63
|
+
const t = node.type;
|
|
64
|
+
if (rules.extractParamName) {
|
|
65
|
+
const result = rules.extractParamName(node);
|
|
66
|
+
if (result)
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
if (t === rules.paramIdentifier)
|
|
70
|
+
return [node.text];
|
|
71
|
+
if (rules.paramWrapperTypes.has(t)) {
|
|
72
|
+
const pattern = node.childForFieldName('pattern') || node.childForFieldName('name');
|
|
73
|
+
return pattern ? extractParamNames(pattern, rules) : [];
|
|
74
|
+
}
|
|
75
|
+
if (rules.defaultParamType && t === rules.defaultParamType) {
|
|
76
|
+
const left = node.childForFieldName('left') || node.childForFieldName('name');
|
|
77
|
+
return left ? extractParamNames(left, rules) : [];
|
|
78
|
+
}
|
|
79
|
+
if (rules.restParamType && t === rules.restParamType) {
|
|
80
|
+
const nameNode = node.childForFieldName('name');
|
|
81
|
+
if (nameNode)
|
|
82
|
+
return [nameNode.text];
|
|
83
|
+
for (const child of node.namedChildren) {
|
|
84
|
+
if (child.type === rules.paramIdentifier)
|
|
85
|
+
return [child.text];
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
if (rules.objectDestructType && t === rules.objectDestructType) {
|
|
90
|
+
const names = [];
|
|
91
|
+
for (const child of node.namedChildren) {
|
|
92
|
+
if (rules.shorthandPropPattern && child.type === rules.shorthandPropPattern) {
|
|
93
|
+
names.push(child.text);
|
|
94
|
+
}
|
|
95
|
+
else if (rules.pairPatternType && child.type === rules.pairPatternType) {
|
|
96
|
+
const value = child.childForFieldName('value');
|
|
97
|
+
if (value)
|
|
98
|
+
names.push(...extractParamNames(value, rules));
|
|
99
|
+
}
|
|
100
|
+
else if (rules.restParamType && child.type === rules.restParamType) {
|
|
101
|
+
names.push(...extractParamNames(child, rules));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return names;
|
|
105
|
+
}
|
|
106
|
+
if (rules.arrayDestructType && t === rules.arrayDestructType) {
|
|
107
|
+
const names = [];
|
|
108
|
+
for (const child of node.namedChildren) {
|
|
109
|
+
names.push(...extractParamNames(child, rules));
|
|
110
|
+
}
|
|
111
|
+
return names;
|
|
112
|
+
}
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Check if a node type is identifier-like for this language.
|
|
117
|
+
*/
|
|
118
|
+
export function isIdent(nodeType, rules) {
|
|
119
|
+
if (nodeType === 'identifier' || nodeType === rules.paramIdentifier)
|
|
120
|
+
return true;
|
|
121
|
+
return rules.extraIdentifierTypes ? rules.extraIdentifierTypes.has(nodeType) : false;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Resolve the name a call expression is calling using rules.
|
|
125
|
+
*/
|
|
126
|
+
export function resolveCalleeName(callNode, rules) {
|
|
127
|
+
const fn = callNode.childForFieldName(rules.callFunctionField);
|
|
128
|
+
if (!fn) {
|
|
129
|
+
const nameNode = callNode.childForFieldName('name') || callNode.childForFieldName('method');
|
|
130
|
+
return nameNode ? nameNode.text : null;
|
|
131
|
+
}
|
|
132
|
+
if (isIdent(fn.type, rules))
|
|
133
|
+
return fn.text;
|
|
134
|
+
if (fn.type === rules.memberNode) {
|
|
135
|
+
const prop = fn.childForFieldName(rules.memberPropertyField);
|
|
136
|
+
return prop ? prop.text : null;
|
|
137
|
+
}
|
|
138
|
+
if (rules.optionalChainNode && fn.type === rules.optionalChainNode) {
|
|
139
|
+
const target = fn.namedChildren[0];
|
|
140
|
+
if (!target)
|
|
141
|
+
return null;
|
|
142
|
+
if (target.type === rules.memberNode) {
|
|
143
|
+
const prop = target.childForFieldName(rules.memberPropertyField);
|
|
144
|
+
return prop ? prop.text : null;
|
|
145
|
+
}
|
|
146
|
+
if (target.type === 'identifier')
|
|
147
|
+
return target.text;
|
|
148
|
+
const prop = fn.childForFieldName(rules.memberPropertyField);
|
|
149
|
+
return prop ? prop.text : null;
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get the receiver (object) of a member expression using rules.
|
|
155
|
+
*/
|
|
156
|
+
export function memberReceiver(memberExpr, rules) {
|
|
157
|
+
const obj = memberExpr.childForFieldName(rules.memberObjectField);
|
|
158
|
+
if (!obj)
|
|
159
|
+
return null;
|
|
160
|
+
if (isIdent(obj.type, rules))
|
|
161
|
+
return obj.text;
|
|
162
|
+
if (obj.type === rules.memberNode)
|
|
163
|
+
return memberReceiver(obj, rules);
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Collect all identifier names referenced within a node.
|
|
168
|
+
*/
|
|
169
|
+
export function collectIdentifiers(node, out, rules) {
|
|
170
|
+
if (!node)
|
|
171
|
+
return;
|
|
172
|
+
if (isIdent(node.type, rules)) {
|
|
173
|
+
out.push(node.text);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
for (const child of node.namedChildren) {
|
|
177
|
+
collectIdentifiers(child, out, rules);
|
|
178
|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KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared DFS walker with pluggable visitors for AST analysis.
|
|
3
|
+
*
|
|
4
|
+
* Provides a single tree traversal that multiple analysis visitors can hook into,
|
|
5
|
+
* avoiding redundant walks over the same AST. Two hook styles:
|
|
6
|
+
*
|
|
7
|
+
* - Node-level: enterNode / exitNode (called for every node)
|
|
8
|
+
* - Function-level: enterFunction / exitFunction (called at function boundaries)
|
|
9
|
+
*
|
|
10
|
+
* The walker maintains shared context (nestingLevel, scopeStack, currentFunction)
|
|
11
|
+
* so individual visitors don't need to track traversal state themselves.
|
|
12
|
+
*
|
|
13
|
+
* @typedef {object} VisitorContext
|
|
14
|
+
* @property {number} nestingLevel - Current nesting depth (for complexity)
|
|
15
|
+
* @property {object} currentFunction - Enclosing function node (or null)
|
|
16
|
+
* @property {string} langId - Language ID
|
|
17
|
+
* @property {Array} scopeStack - Function scope stack [{funcName, funcNode, params, locals}]
|
|
18
|
+
*
|
|
19
|
+
* @typedef {object} Visitor
|
|
20
|
+
* @property {string} name
|
|
21
|
+
* @property {function} [init](langId, rules) - Called once before the walk
|
|
22
|
+
* @property {function} [enterNode](node, context) - Called entering each node; return { skipChildren: true } to skip this visitor's hooks for descendants
|
|
23
|
+
* @property {function} [exitNode](node, context) - Called leaving each node
|
|
24
|
+
* @property {function} [enterFunction](funcNode, funcName, context) - Called entering a function
|
|
25
|
+
* @property {function} [exitFunction](funcNode, funcName, context) - Called leaving a function
|
|
26
|
+
* @property {function} [finish]() - Called after the walk; return collected data
|
|
27
|
+
* @property {Set} [functionNodeTypes] - Extra function node types this visitor cares about
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Walk an AST root with multiple visitors in a single DFS pass.
|
|
31
|
+
*
|
|
32
|
+
* @param {object} rootNode - tree-sitter root node to walk
|
|
33
|
+
* @param {Visitor[]} visitors - array of visitor objects
|
|
34
|
+
* @param {string} langId - language identifier
|
|
35
|
+
* @param {object} [options]
|
|
36
|
+
* @param {Set} [options.functionNodeTypes] - set of node types that are function boundaries
|
|
37
|
+
* @param {Set} [options.nestingNodeTypes] - set of node types that increase nesting depth
|
|
38
|
+
* @param {function} [options.getFunctionName] - (funcNode) => string|null
|
|
39
|
+
* @returns {object} Map of visitor.name → finish() result
|
|
40
|
+
*/
|
|
41
|
+
export function walkWithVisitors(rootNode: object, visitors: Visitor[], langId: string, options?: {
|
|
42
|
+
functionNodeTypes?: Set<any> | undefined;
|
|
43
|
+
nestingNodeTypes?: Set<any> | undefined;
|
|
44
|
+
getFunctionName?: Function | undefined;
|
|
45
|
+
}): object;
|
|
46
|
+
/**
|
|
47
|
+
* Shared DFS walker with pluggable visitors for AST analysis.
|
|
48
|
+
*
|
|
49
|
+
* Provides a single tree traversal that multiple analysis visitors can hook into,
|
|
50
|
+
* avoiding redundant walks over the same AST. Two hook styles:
|
|
51
|
+
*
|
|
52
|
+
* - Node-level: enterNode / exitNode (called for every node)
|
|
53
|
+
* - Function-level: enterFunction / exitFunction (called at function boundaries)
|
|
54
|
+
*
|
|
55
|
+
* The walker maintains shared context (nestingLevel, scopeStack, currentFunction)
|
|
56
|
+
* so individual visitors don't need to track traversal state themselves.
|
|
57
|
+
*/
|
|
58
|
+
export type VisitorContext = {
|
|
59
|
+
/**
|
|
60
|
+
* - Current nesting depth (for complexity)
|
|
61
|
+
*/
|
|
62
|
+
nestingLevel: number;
|
|
63
|
+
/**
|
|
64
|
+
* - Enclosing function node (or null)
|
|
65
|
+
*/
|
|
66
|
+
currentFunction: object;
|
|
67
|
+
/**
|
|
68
|
+
* - Language ID
|
|
69
|
+
*/
|
|
70
|
+
langId: string;
|
|
71
|
+
/**
|
|
72
|
+
* - Function scope stack [{funcName, funcNode, params, locals}]
|
|
73
|
+
*/
|
|
74
|
+
scopeStack: any[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Shared DFS walker with pluggable visitors for AST analysis.
|
|
78
|
+
*
|
|
79
|
+
* Provides a single tree traversal that multiple analysis visitors can hook into,
|
|
80
|
+
* avoiding redundant walks over the same AST. Two hook styles:
|
|
81
|
+
*
|
|
82
|
+
* - Node-level: enterNode / exitNode (called for every node)
|
|
83
|
+
* - Function-level: enterFunction / exitFunction (called at function boundaries)
|
|
84
|
+
*
|
|
85
|
+
* The walker maintains shared context (nestingLevel, scopeStack, currentFunction)
|
|
86
|
+
* so individual visitors don't need to track traversal state themselves.
|
|
87
|
+
*/
|
|
88
|
+
export type Visitor = {
|
|
89
|
+
name: string;
|
|
90
|
+
/**
|
|
91
|
+
* (langId, rules) - Called once before the walk
|
|
92
|
+
*/
|
|
93
|
+
init?: Function | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* (node, context) - Called entering each node; return { skipChildren: true } to skip this visitor's hooks for descendants
|
|
96
|
+
*/
|
|
97
|
+
enterNode?: Function | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* (node, context) - Called leaving each node
|
|
100
|
+
*/
|
|
101
|
+
exitNode?: Function | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* (funcNode, funcName, context) - Called entering a function
|
|
104
|
+
*/
|
|
105
|
+
enterFunction?: Function | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* (funcNode, funcName, context) - Called leaving a function
|
|
108
|
+
*/
|
|
109
|
+
exitFunction?: Function | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* () - Called after the walk; return collected data
|
|
112
|
+
*/
|
|
113
|
+
finish?: Function | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* - Extra function node types this visitor cares about
|
|
116
|
+
*/
|
|
117
|
+
functionNodeTypes?: Set<any> | undefined;
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor.d.ts","sourceRoot":"","sources":["../../src/ast-analysis/visitor.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,YACN,OAAO,EAAE,UACT,MAAM,YAEd;IAAyB,iBAAiB;IACjB,gBAAgB;IACd,eAAe;CAC1C,GAAU,MAAM,CA0HlB;;;;;;;;;;;;;;;;;kBApJa,MAAM;;;;qBACN,MAAM;;;;YACN,MAAM;;;;;;;;;;;;;;;;;;;UAIN,MAAM"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared DFS walker with pluggable visitors for AST analysis.
|
|
3
|
+
*
|
|
4
|
+
* Provides a single tree traversal that multiple analysis visitors can hook into,
|
|
5
|
+
* avoiding redundant walks over the same AST. Two hook styles:
|
|
6
|
+
*
|
|
7
|
+
* - Node-level: enterNode / exitNode (called for every node)
|
|
8
|
+
* - Function-level: enterFunction / exitFunction (called at function boundaries)
|
|
9
|
+
*
|
|
10
|
+
* The walker maintains shared context (nestingLevel, scopeStack, currentFunction)
|
|
11
|
+
* so individual visitors don't need to track traversal state themselves.
|
|
12
|
+
*
|
|
13
|
+
* @typedef {object} VisitorContext
|
|
14
|
+
* @property {number} nestingLevel - Current nesting depth (for complexity)
|
|
15
|
+
* @property {object} currentFunction - Enclosing function node (or null)
|
|
16
|
+
* @property {string} langId - Language ID
|
|
17
|
+
* @property {Array} scopeStack - Function scope stack [{funcName, funcNode, params, locals}]
|
|
18
|
+
*
|
|
19
|
+
* @typedef {object} Visitor
|
|
20
|
+
* @property {string} name
|
|
21
|
+
* @property {function} [init](langId, rules) - Called once before the walk
|
|
22
|
+
* @property {function} [enterNode](node, context) - Called entering each node; return { skipChildren: true } to skip this visitor's hooks for descendants
|
|
23
|
+
* @property {function} [exitNode](node, context) - Called leaving each node
|
|
24
|
+
* @property {function} [enterFunction](funcNode, funcName, context) - Called entering a function
|
|
25
|
+
* @property {function} [exitFunction](funcNode, funcName, context) - Called leaving a function
|
|
26
|
+
* @property {function} [finish]() - Called after the walk; return collected data
|
|
27
|
+
* @property {Set} [functionNodeTypes] - Extra function node types this visitor cares about
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Walk an AST root with multiple visitors in a single DFS pass.
|
|
31
|
+
*
|
|
32
|
+
* @param {object} rootNode - tree-sitter root node to walk
|
|
33
|
+
* @param {Visitor[]} visitors - array of visitor objects
|
|
34
|
+
* @param {string} langId - language identifier
|
|
35
|
+
* @param {object} [options]
|
|
36
|
+
* @param {Set} [options.functionNodeTypes] - set of node types that are function boundaries
|
|
37
|
+
* @param {Set} [options.nestingNodeTypes] - set of node types that increase nesting depth
|
|
38
|
+
* @param {function} [options.getFunctionName] - (funcNode) => string|null
|
|
39
|
+
* @returns {object} Map of visitor.name → finish() result
|
|
40
|
+
*/
|
|
41
|
+
export function walkWithVisitors(rootNode, visitors, langId, options = {}) {
|
|
42
|
+
const { functionNodeTypes = new Set(), nestingNodeTypes = new Set(), getFunctionName = () => null, } = options;
|
|
43
|
+
// Merge all visitors' functionNodeTypes into the master set
|
|
44
|
+
const allFuncTypes = new Set(functionNodeTypes);
|
|
45
|
+
for (const v of visitors) {
|
|
46
|
+
if (v.functionNodeTypes) {
|
|
47
|
+
for (const t of v.functionNodeTypes)
|
|
48
|
+
allFuncTypes.add(t);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Initialize visitors
|
|
52
|
+
for (const v of visitors) {
|
|
53
|
+
if (v.init)
|
|
54
|
+
v.init(langId);
|
|
55
|
+
}
|
|
56
|
+
// Shared context object (mutated during walk)
|
|
57
|
+
const scopeStack = [];
|
|
58
|
+
const context = {
|
|
59
|
+
nestingLevel: 0,
|
|
60
|
+
currentFunction: null,
|
|
61
|
+
langId,
|
|
62
|
+
scopeStack,
|
|
63
|
+
};
|
|
64
|
+
// Track which visitors have requested skipChildren at each depth
|
|
65
|
+
// Key: visitor index, Value: depth at which skip was requested
|
|
66
|
+
const skipDepths = new Map();
|
|
67
|
+
function walk(node, depth) {
|
|
68
|
+
if (!node)
|
|
69
|
+
return;
|
|
70
|
+
const type = node.type;
|
|
71
|
+
const isFunction = allFuncTypes.has(type);
|
|
72
|
+
let funcName = null;
|
|
73
|
+
// Function boundary: enter
|
|
74
|
+
if (isFunction) {
|
|
75
|
+
funcName = getFunctionName(node);
|
|
76
|
+
context.currentFunction = node;
|
|
77
|
+
scopeStack.push({ funcName, funcNode: node, params: new Map(), locals: new Map() });
|
|
78
|
+
for (let i = 0; i < visitors.length; i++) {
|
|
79
|
+
const v = visitors[i];
|
|
80
|
+
if (v.enterFunction && !isSkipped(i, depth)) {
|
|
81
|
+
v.enterFunction(node, funcName, context);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// enterNode hooks
|
|
86
|
+
for (let i = 0; i < visitors.length; i++) {
|
|
87
|
+
const v = visitors[i];
|
|
88
|
+
if (v.enterNode && !isSkipped(i, depth)) {
|
|
89
|
+
const result = v.enterNode(node, context);
|
|
90
|
+
if (result?.skipChildren) {
|
|
91
|
+
skipDepths.set(i, depth);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Nesting tracking
|
|
96
|
+
const addsNesting = nestingNodeTypes.has(type);
|
|
97
|
+
if (addsNesting)
|
|
98
|
+
context.nestingLevel++;
|
|
99
|
+
// Recurse children using node.child(i) (all children, not just named)
|
|
100
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
101
|
+
walk(node.child(i), depth + 1);
|
|
102
|
+
}
|
|
103
|
+
// Undo nesting
|
|
104
|
+
if (addsNesting)
|
|
105
|
+
context.nestingLevel--;
|
|
106
|
+
// exitNode hooks
|
|
107
|
+
for (let i = 0; i < visitors.length; i++) {
|
|
108
|
+
const v = visitors[i];
|
|
109
|
+
if (v.exitNode && !isSkipped(i, depth)) {
|
|
110
|
+
v.exitNode(node, context);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Clear skip for any visitor that started skipping at this depth
|
|
114
|
+
for (let i = 0; i < visitors.length; i++) {
|
|
115
|
+
if (skipDepths.get(i) === depth) {
|
|
116
|
+
skipDepths.delete(i);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Function boundary: exit
|
|
120
|
+
if (isFunction) {
|
|
121
|
+
for (let i = 0; i < visitors.length; i++) {
|
|
122
|
+
const v = visitors[i];
|
|
123
|
+
if (v.exitFunction && !isSkipped(i, depth)) {
|
|
124
|
+
v.exitFunction(node, funcName, context);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
scopeStack.pop();
|
|
128
|
+
context.currentFunction =
|
|
129
|
+
scopeStack.length > 0 ? scopeStack[scopeStack.length - 1].funcNode : null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function isSkipped(visitorIndex, currentDepth) {
|
|
133
|
+
const skipAt = skipDepths.get(visitorIndex);
|
|
134
|
+
// Skipped if skip was requested at a shallower (or equal) depth
|
|
135
|
+
// We skip descendants, not the node itself, so skip when currentDepth > skipAt
|
|
136
|
+
return skipAt !== undefined && currentDepth > skipAt;
|
|
137
|
+
}
|
|
138
|
+
walk(rootNode, 0);
|
|
139
|
+
// Collect results
|
|
140
|
+
const results = {};
|
|
141
|
+
for (const v of visitors) {
|
|
142
|
+
results[v.name] = v.finish ? v.finish() : undefined;
|
|
143
|
+
}
|
|
144
|
+
return results;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitor.js","sourceRoot":"","sources":["../../src/ast-analysis/visitor.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE;IACvE,MAAM,EACJ,iBAAiB,GAAG,IAAI,GAAG,EAAE,EAC7B,gBAAgB,GAAG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CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9E,CAAC;IACH,CAAC;IAED,SAAS,SAAS,CAAC,YAAY,EAAE,YAAY;QAC3C,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC5C,gEAAgE;QAChE,+EAA+E;QAC/E,OAAO,MAAM,KAAK,SAAS,IAAI,YAAY,GAAG,MAAM,CAAC;IACvD,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAElB,kBAAkB;IAClB,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an AST-store visitor for use with walkWithVisitors.
|
|
3
|
+
*
|
|
4
|
+
* @param {object} astTypeMap - node type → kind mapping (e.g. JS_TS_AST_TYPES)
|
|
5
|
+
* @param {object[]} defs - symbol definitions for parent lookup
|
|
6
|
+
* @param {string} relPath - relative file path
|
|
7
|
+
* @param {Map} nodeIdMap - def key → node ID mapping
|
|
8
|
+
* @returns {Visitor}
|
|
9
|
+
*/
|
|
10
|
+
export function createAstStoreVisitor(astTypeMap: object, defs: object[], relPath: string, nodeIdMap: Map<any, any>): Visitor;
|
|
11
|
+
//# sourceMappingURL=ast-store-visitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-store-visitor.d.ts","sourceRoot":"","sources":["../../../src/ast-analysis/visitors/ast-store-visitor.js"],"names":[],"mappings":"AA+DA;;;;;;;;GAQG;AACH,kDANW,MAAM,QACN,MAAM,EAAE,WACR,MAAM,6BAEJ,OAAO,CA+EnB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Visitor: Extract new/throw/await/string/regex AST nodes during a shared walk.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the standalone walkAst() DFS in ast.js with a visitor that plugs
|
|
5
|
+
* into the unified walkWithVisitors framework.
|
|
6
|
+
*/
|
|
7
|
+
/** Max length for the `text` column. */
|
|
8
|
+
const TEXT_MAX = 200;
|
|
9
|
+
function truncate(s, max = TEXT_MAX) {
|
|
10
|
+
if (!s)
|
|
11
|
+
return null;
|
|
12
|
+
return s.length <= max ? s : `${s.slice(0, max - 1)}\u2026`;
|
|
13
|
+
}
|
|
14
|
+
function extractNewName(node) {
|
|
15
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
16
|
+
const child = node.child(i);
|
|
17
|
+
if (child.type === 'identifier')
|
|
18
|
+
return child.text;
|
|
19
|
+
if (child.type === 'member_expression')
|
|
20
|
+
return child.text;
|
|
21
|
+
}
|
|
22
|
+
return node.text?.split('(')[0]?.replace('new ', '').trim() || '?';
|
|
23
|
+
}
|
|
24
|
+
function extractExpressionText(node) {
|
|
25
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
26
|
+
const child = node.child(i);
|
|
27
|
+
if (child.type !== 'throw' && child.type !== 'await') {
|
|
28
|
+
return truncate(child.text);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return truncate(node.text);
|
|
32
|
+
}
|
|
33
|
+
function extractName(kind, node) {
|
|
34
|
+
if (kind === 'throw') {
|
|
35
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
36
|
+
const child = node.child(i);
|
|
37
|
+
if (child.type === 'new_expression')
|
|
38
|
+
return extractNewName(child);
|
|
39
|
+
if (child.type === 'call_expression') {
|
|
40
|
+
const fn = child.childForFieldName('function');
|
|
41
|
+
return fn ? fn.text : child.text?.split('(')[0] || '?';
|
|
42
|
+
}
|
|
43
|
+
if (child.type === 'identifier')
|
|
44
|
+
return child.text;
|
|
45
|
+
}
|
|
46
|
+
return truncate(node.text);
|
|
47
|
+
}
|
|
48
|
+
if (kind === 'await') {
|
|
49
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
50
|
+
const child = node.child(i);
|
|
51
|
+
if (child.type === 'call_expression') {
|
|
52
|
+
const fn = child.childForFieldName('function');
|
|
53
|
+
return fn ? fn.text : child.text?.split('(')[0] || '?';
|
|
54
|
+
}
|
|
55
|
+
if (child.type === 'identifier' || child.type === 'member_expression') {
|
|
56
|
+
return child.text;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return truncate(node.text);
|
|
60
|
+
}
|
|
61
|
+
return truncate(node.text);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create an AST-store visitor for use with walkWithVisitors.
|
|
65
|
+
*
|
|
66
|
+
* @param {object} astTypeMap - node type → kind mapping (e.g. JS_TS_AST_TYPES)
|
|
67
|
+
* @param {object[]} defs - symbol definitions for parent lookup
|
|
68
|
+
* @param {string} relPath - relative file path
|
|
69
|
+
* @param {Map} nodeIdMap - def key → node ID mapping
|
|
70
|
+
* @returns {Visitor}
|
|
71
|
+
*/
|
|
72
|
+
export function createAstStoreVisitor(astTypeMap, defs, relPath, nodeIdMap) {
|
|
73
|
+
const rows = [];
|
|
74
|
+
// Track which nodes we've already matched to avoid duplicates in recursive walk
|
|
75
|
+
const matched = new Set();
|
|
76
|
+
function findParentDef(line) {
|
|
77
|
+
let best = null;
|
|
78
|
+
for (const def of defs) {
|
|
79
|
+
if (def.line <= line && (def.endLine == null || def.endLine >= line)) {
|
|
80
|
+
if (!best || def.endLine - def.line < best.endLine - best.line) {
|
|
81
|
+
best = def;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return best;
|
|
86
|
+
}
|
|
87
|
+
function resolveParentNodeId(line) {
|
|
88
|
+
const parentDef = findParentDef(line);
|
|
89
|
+
if (!parentDef)
|
|
90
|
+
return null;
|
|
91
|
+
return nodeIdMap.get(`${parentDef.name}|${parentDef.kind}|${parentDef.line}`) || null;
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
name: 'ast-store',
|
|
95
|
+
enterNode(node, _context) {
|
|
96
|
+
if (matched.has(node.id))
|
|
97
|
+
return;
|
|
98
|
+
const kind = astTypeMap[node.type];
|
|
99
|
+
if (!kind)
|
|
100
|
+
return;
|
|
101
|
+
const line = node.startPosition.row + 1;
|
|
102
|
+
let name;
|
|
103
|
+
let text = null;
|
|
104
|
+
if (kind === 'new') {
|
|
105
|
+
name = extractNewName(node);
|
|
106
|
+
text = truncate(node.text);
|
|
107
|
+
}
|
|
108
|
+
else if (kind === 'throw') {
|
|
109
|
+
name = extractName('throw', node);
|
|
110
|
+
text = extractExpressionText(node);
|
|
111
|
+
}
|
|
112
|
+
else if (kind === 'await') {
|
|
113
|
+
name = extractName('await', node);
|
|
114
|
+
text = extractExpressionText(node);
|
|
115
|
+
}
|
|
116
|
+
else if (kind === 'string') {
|
|
117
|
+
const content = node.text?.replace(/^['"`]|['"`]$/g, '') || '';
|
|
118
|
+
if (content.length < 2)
|
|
119
|
+
return; // skip trivial strings, walker still descends
|
|
120
|
+
name = truncate(content, 100);
|
|
121
|
+
text = truncate(node.text);
|
|
122
|
+
}
|
|
123
|
+
else if (kind === 'regex') {
|
|
124
|
+
name = node.text || '?';
|
|
125
|
+
text = truncate(node.text);
|
|
126
|
+
}
|
|
127
|
+
rows.push({
|
|
128
|
+
file: relPath,
|
|
129
|
+
line,
|
|
130
|
+
kind,
|
|
131
|
+
name,
|
|
132
|
+
text,
|
|
133
|
+
receiver: null,
|
|
134
|
+
parentNodeId: resolveParentNodeId(line),
|
|
135
|
+
});
|
|
136
|
+
matched.add(node.id);
|
|
137
|
+
// Don't recurse into children for new/throw/await (same as original walkAst)
|
|
138
|
+
if (kind !== 'string' && kind !== 'regex') {
|
|
139
|
+
return { skipChildren: true };
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
finish() {
|
|
143
|
+
return rows;
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=ast-store-visitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-store-visitor.js","sourceRoot":"","sources":["../../../src/ast-analysis/visitors/ast-store-visitor.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wCAAwC;AACxC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,SAAS,QAAQ,CAAC,CAAC,EAAE,GAAG,GAAG,QAAQ;IACjC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC;AAC9D,CAAC;AAED,SAAS,cAAc,CAAC,IAAI;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC;QACnD,IAAI,KAAK,CAAC,IAAI,KAAK,mBAAmB;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC;AACrE,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAI;IACjC,KAAK,IAAI,CAA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