@optave/codegraph 3.1.5 → 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 +50 -56
- 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/ast-analysis/engine.js +252 -258
- package/src/ast-analysis/shared.js +0 -12
- package/src/ast-analysis/visitors/cfg-visitor.js +635 -649
- package/src/ast-analysis/visitors/complexity-visitor.js +135 -139
- package/src/ast-analysis/visitors/dataflow-visitor.js +230 -224
- package/src/cli/commands/ast.js +2 -1
- package/src/cli/commands/audit.js +2 -1
- package/src/cli/commands/batch.js +2 -1
- package/src/cli/commands/brief.js +12 -0
- package/src/cli/commands/cfg.js +2 -1
- package/src/cli/commands/check.js +20 -23
- package/src/cli/commands/children.js +6 -1
- package/src/cli/commands/complexity.js +2 -1
- package/src/cli/commands/context.js +6 -1
- package/src/cli/commands/dataflow.js +2 -1
- package/src/cli/commands/deps.js +8 -3
- package/src/cli/commands/diff-impact.js +2 -0
- package/src/cli/commands/flow.js +2 -1
- package/src/cli/commands/fn-impact.js +8 -1
- 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/owners.js +4 -2
- package/src/cli/commands/query.js +6 -1
- package/src/cli/commands/roles.js +4 -2
- package/src/cli/commands/search.js +8 -2
- package/src/cli/commands/sequence.js +2 -1
- package/src/cli/commands/triage.js +42 -28
- package/src/db/connection.js +18 -12
- package/src/db/index.js +2 -0
- package/src/db/migrations.js +41 -64
- package/src/db/query-builder.js +69 -8
- package/src/db/repository/edges.js +38 -0
- package/src/db/repository/in-memory-repository.js +38 -18
- package/src/db/repository/index.js +2 -0
- package/src/db/repository/nodes.js +8 -10
- package/src/domain/analysis/brief.js +161 -0
- package/src/domain/analysis/context.js +237 -199
- package/src/domain/analysis/dependencies.js +200 -146
- package/src/domain/analysis/exports.js +84 -12
- package/src/domain/analysis/impact.js +350 -157
- package/src/domain/analysis/implementations.js +98 -0
- package/src/domain/analysis/module-map.js +256 -221
- package/src/domain/analysis/roles.js +16 -7
- package/src/domain/analysis/symbol-lookup.js +7 -5
- package/src/domain/graph/builder/helpers.js +1 -1
- package/src/domain/graph/builder/incremental.js +136 -90
- package/src/domain/graph/builder/pipeline.js +114 -80
- package/src/domain/graph/builder/stages/build-edges.js +413 -237
- package/src/domain/graph/builder/stages/detect-changes.js +198 -177
- package/src/domain/graph/builder/stages/insert-nodes.js +147 -139
- package/src/domain/graph/resolve.js +315 -1
- package/src/domain/graph/watcher.js +2 -2
- package/src/domain/parser.js +90 -17
- package/src/domain/queries.js +2 -0
- package/src/domain/search/search/filters.js +9 -5
- package/src/domain/search/search/hybrid.js +7 -4
- package/src/domain/search/search/keyword.js +12 -5
- package/src/domain/search/search/prepare.js +13 -5
- package/src/domain/search/search/semantic.js +11 -6
- package/src/extractors/csharp.js +286 -207
- package/src/extractors/go.js +304 -159
- package/src/extractors/hcl.js +94 -78
- package/src/extractors/java.js +239 -207
- package/src/extractors/javascript.js +437 -305
- package/src/extractors/php.js +276 -220
- package/src/extractors/python.js +379 -247
- package/src/extractors/ruby.js +192 -185
- package/src/extractors/rust.js +243 -168
- package/src/features/ast.js +5 -3
- package/src/features/audit.js +6 -3
- package/src/features/boundaries.js +98 -83
- package/src/features/cfg.js +134 -143
- package/src/features/communities.js +70 -53
- package/src/features/complexity.js +143 -132
- package/src/features/dataflow.js +146 -149
- package/src/features/export.js +3 -3
- package/src/features/graph-enrichment.js +3 -3
- package/src/features/manifesto.js +9 -6
- package/src/features/owners.js +4 -3
- package/src/features/sequence.js +155 -142
- package/src/features/shared/find-nodes.js +31 -0
- package/src/features/structure.js +161 -101
- package/src/features/triage.js +93 -71
- package/src/graph/classifiers/risk.js +12 -4
- package/src/graph/classifiers/roles.js +54 -3
- package/src/index.js +1 -0
- package/src/infrastructure/config.js +255 -4
- package/src/mcp/middleware.js +20 -2
- package/src/mcp/server.js +71 -56
- package/src/mcp/tool-registry.js +53 -1
- package/src/mcp/tools/brief.js +8 -0
- package/src/mcp/tools/implementations.js +14 -0
- package/src/mcp/tools/index.js +6 -0
- package/src/mcp/tools/interfaces.js +14 -0
- package/src/presentation/brief.js +51 -0
- package/src/presentation/queries-cli/exports.js +72 -15
- package/src/presentation/queries-cli/impact.js +55 -39
- package/src/presentation/queries-cli/index.js +9 -1
- package/src/presentation/queries-cli/inspect.js +241 -182
- package/src/presentation/queries-cli/overview.js +57 -58
- package/src/presentation/queries-cli/path.js +36 -29
- package/src/presentation/queries-cli.js +3 -1
- package/src/presentation/result-formatter.js +9 -5
- package/src/presentation/table.js +0 -8
- package/src/shared/file-utils.js +20 -11
- package/src/shared/generators.js +7 -3
- package/src/shared/kinds.js +14 -1
- package/src/shared/paginate.js +10 -2
- package/src/types.ts +1609 -0
|
@@ -0,0 +1,1232 @@
|
|
|
1
|
+
import { debug } from '../infrastructure/logger.js';
|
|
2
|
+
import { findChild, nodeEndLine } from './helpers.js';
|
|
3
|
+
/** Built-in globals that start with uppercase but are not user-defined types. */
|
|
4
|
+
const BUILTIN_GLOBALS = new Set([
|
|
5
|
+
'Math',
|
|
6
|
+
'JSON',
|
|
7
|
+
'Promise',
|
|
8
|
+
'Array',
|
|
9
|
+
'Object',
|
|
10
|
+
'Date',
|
|
11
|
+
'Error',
|
|
12
|
+
'Symbol',
|
|
13
|
+
'Map',
|
|
14
|
+
'Set',
|
|
15
|
+
'RegExp',
|
|
16
|
+
'Number',
|
|
17
|
+
'String',
|
|
18
|
+
'Boolean',
|
|
19
|
+
'WeakMap',
|
|
20
|
+
'WeakSet',
|
|
21
|
+
'WeakRef',
|
|
22
|
+
'Proxy',
|
|
23
|
+
'Reflect',
|
|
24
|
+
'Intl',
|
|
25
|
+
'ArrayBuffer',
|
|
26
|
+
'SharedArrayBuffer',
|
|
27
|
+
'DataView',
|
|
28
|
+
'Atomics',
|
|
29
|
+
'BigInt',
|
|
30
|
+
'Float32Array',
|
|
31
|
+
'Float64Array',
|
|
32
|
+
'Int8Array',
|
|
33
|
+
'Int16Array',
|
|
34
|
+
'Int32Array',
|
|
35
|
+
'Uint8Array',
|
|
36
|
+
'Uint16Array',
|
|
37
|
+
'Uint32Array',
|
|
38
|
+
'Uint8ClampedArray',
|
|
39
|
+
'URL',
|
|
40
|
+
'URLSearchParams',
|
|
41
|
+
'TextEncoder',
|
|
42
|
+
'TextDecoder',
|
|
43
|
+
'AbortController',
|
|
44
|
+
'AbortSignal',
|
|
45
|
+
'Headers',
|
|
46
|
+
'Request',
|
|
47
|
+
'Response',
|
|
48
|
+
'FormData',
|
|
49
|
+
'Blob',
|
|
50
|
+
'File',
|
|
51
|
+
'ReadableStream',
|
|
52
|
+
'WritableStream',
|
|
53
|
+
'TransformStream',
|
|
54
|
+
'console',
|
|
55
|
+
'Buffer',
|
|
56
|
+
'EventEmitter',
|
|
57
|
+
'Stream',
|
|
58
|
+
]);
|
|
59
|
+
/**
|
|
60
|
+
* Extract symbols from a JS/TS parsed AST.
|
|
61
|
+
* When a compiled tree-sitter Query is provided (from parser.js),
|
|
62
|
+
* uses the fast query-based path. Falls back to manual tree walk otherwise.
|
|
63
|
+
*/
|
|
64
|
+
export function extractSymbols(tree, _filePath, query) {
|
|
65
|
+
if (query)
|
|
66
|
+
return extractSymbolsQuery(tree, query);
|
|
67
|
+
return extractSymbolsWalk(tree);
|
|
68
|
+
}
|
|
69
|
+
// ── Query-based extraction (fast path) ──────────────────────────────────────
|
|
70
|
+
function extractSymbolsQuery(tree, query) {
|
|
71
|
+
const definitions = [];
|
|
72
|
+
const calls = [];
|
|
73
|
+
const imports = [];
|
|
74
|
+
const classes = [];
|
|
75
|
+
const exps = [];
|
|
76
|
+
const typeMap = new Map();
|
|
77
|
+
const matches = query.matches(tree.rootNode);
|
|
78
|
+
for (const match of matches) {
|
|
79
|
+
// Build capture lookup for this match (1-3 captures each, very fast)
|
|
80
|
+
const c = Object.create(null);
|
|
81
|
+
for (const cap of match.captures)
|
|
82
|
+
c[cap.name] = cap.node;
|
|
83
|
+
if (c.fn_node) {
|
|
84
|
+
// function_declaration
|
|
85
|
+
const fnChildren = extractParameters(c.fn_node);
|
|
86
|
+
definitions.push({
|
|
87
|
+
name: c.fn_name.text,
|
|
88
|
+
kind: 'function',
|
|
89
|
+
line: c.fn_node.startPosition.row + 1,
|
|
90
|
+
endLine: nodeEndLine(c.fn_node),
|
|
91
|
+
children: fnChildren.length > 0 ? fnChildren : undefined,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else if (c.varfn_name) {
|
|
95
|
+
// variable_declarator with arrow_function / function_expression
|
|
96
|
+
const declNode = c.varfn_name.parent?.parent;
|
|
97
|
+
const line = declNode ? declNode.startPosition.row + 1 : c.varfn_name.startPosition.row + 1;
|
|
98
|
+
const varFnChildren = extractParameters(c.varfn_value);
|
|
99
|
+
definitions.push({
|
|
100
|
+
name: c.varfn_name.text,
|
|
101
|
+
kind: 'function',
|
|
102
|
+
line,
|
|
103
|
+
endLine: nodeEndLine(c.varfn_value),
|
|
104
|
+
children: varFnChildren.length > 0 ? varFnChildren : undefined,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
else if (c.cls_node) {
|
|
108
|
+
// class_declaration
|
|
109
|
+
const className = c.cls_name.text;
|
|
110
|
+
const startLine = c.cls_node.startPosition.row + 1;
|
|
111
|
+
const clsChildren = extractClassProperties(c.cls_node);
|
|
112
|
+
definitions.push({
|
|
113
|
+
name: className,
|
|
114
|
+
kind: 'class',
|
|
115
|
+
line: startLine,
|
|
116
|
+
endLine: nodeEndLine(c.cls_node),
|
|
117
|
+
children: clsChildren.length > 0 ? clsChildren : undefined,
|
|
118
|
+
});
|
|
119
|
+
const heritage = c.cls_node.childForFieldName('heritage') || findChild(c.cls_node, 'class_heritage');
|
|
120
|
+
if (heritage) {
|
|
121
|
+
const superName = extractSuperclass(heritage);
|
|
122
|
+
if (superName)
|
|
123
|
+
classes.push({ name: className, extends: superName, line: startLine });
|
|
124
|
+
const implementsList = extractImplements(heritage);
|
|
125
|
+
for (const iface of implementsList) {
|
|
126
|
+
classes.push({ name: className, implements: iface, line: startLine });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (c.meth_node) {
|
|
131
|
+
// method_definition
|
|
132
|
+
const methName = c.meth_name.text;
|
|
133
|
+
const parentClass = findParentClass(c.meth_node);
|
|
134
|
+
const fullName = parentClass ? `${parentClass}.${methName}` : methName;
|
|
135
|
+
const methChildren = extractParameters(c.meth_node);
|
|
136
|
+
const methVis = extractVisibility(c.meth_node);
|
|
137
|
+
definitions.push({
|
|
138
|
+
name: fullName,
|
|
139
|
+
kind: 'method',
|
|
140
|
+
line: c.meth_node.startPosition.row + 1,
|
|
141
|
+
endLine: nodeEndLine(c.meth_node),
|
|
142
|
+
children: methChildren.length > 0 ? methChildren : undefined,
|
|
143
|
+
visibility: methVis,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
else if (c.iface_node) {
|
|
147
|
+
// interface_declaration (TS/TSX only)
|
|
148
|
+
const ifaceName = c.iface_name.text;
|
|
149
|
+
definitions.push({
|
|
150
|
+
name: ifaceName,
|
|
151
|
+
kind: 'interface',
|
|
152
|
+
line: c.iface_node.startPosition.row + 1,
|
|
153
|
+
endLine: nodeEndLine(c.iface_node),
|
|
154
|
+
});
|
|
155
|
+
const body = c.iface_node.childForFieldName('body') ||
|
|
156
|
+
findChild(c.iface_node, 'interface_body') ||
|
|
157
|
+
findChild(c.iface_node, 'object_type');
|
|
158
|
+
if (body)
|
|
159
|
+
extractInterfaceMethods(body, ifaceName, definitions);
|
|
160
|
+
}
|
|
161
|
+
else if (c.type_node) {
|
|
162
|
+
// type_alias_declaration (TS/TSX only)
|
|
163
|
+
definitions.push({
|
|
164
|
+
name: c.type_name.text,
|
|
165
|
+
kind: 'type',
|
|
166
|
+
line: c.type_node.startPosition.row + 1,
|
|
167
|
+
endLine: nodeEndLine(c.type_node),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
else if (c.imp_node) {
|
|
171
|
+
// import_statement
|
|
172
|
+
const isTypeOnly = c.imp_node.text.startsWith('import type');
|
|
173
|
+
const modPath = c.imp_source.text.replace(/['"]/g, '');
|
|
174
|
+
const names = extractImportNames(c.imp_node);
|
|
175
|
+
imports.push({
|
|
176
|
+
source: modPath,
|
|
177
|
+
names,
|
|
178
|
+
line: c.imp_node.startPosition.row + 1,
|
|
179
|
+
typeOnly: isTypeOnly,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
else if (c.exp_node) {
|
|
183
|
+
// export_statement
|
|
184
|
+
const exportLine = c.exp_node.startPosition.row + 1;
|
|
185
|
+
const decl = c.exp_node.childForFieldName('declaration');
|
|
186
|
+
if (decl) {
|
|
187
|
+
const declType = decl.type;
|
|
188
|
+
const kindMap = {
|
|
189
|
+
function_declaration: 'function',
|
|
190
|
+
class_declaration: 'class',
|
|
191
|
+
interface_declaration: 'interface',
|
|
192
|
+
type_alias_declaration: 'type',
|
|
193
|
+
};
|
|
194
|
+
const kind = kindMap[declType];
|
|
195
|
+
if (kind) {
|
|
196
|
+
const n = decl.childForFieldName('name');
|
|
197
|
+
if (n)
|
|
198
|
+
exps.push({ name: n.text, kind, line: exportLine });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const source = c.exp_node.childForFieldName('source') || findChild(c.exp_node, 'string');
|
|
202
|
+
if (source && !decl) {
|
|
203
|
+
const modPath = source.text.replace(/['"]/g, '');
|
|
204
|
+
const reexportNames = extractImportNames(c.exp_node);
|
|
205
|
+
const nodeText = c.exp_node.text;
|
|
206
|
+
const isWildcard = nodeText.includes('export *') || nodeText.includes('export*');
|
|
207
|
+
imports.push({
|
|
208
|
+
source: modPath,
|
|
209
|
+
names: reexportNames,
|
|
210
|
+
line: exportLine,
|
|
211
|
+
reexport: true,
|
|
212
|
+
wildcardReexport: isWildcard && reexportNames.length === 0,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else if (c.callfn_node) {
|
|
217
|
+
// call_expression with identifier function
|
|
218
|
+
calls.push({
|
|
219
|
+
name: c.callfn_name.text,
|
|
220
|
+
line: c.callfn_node.startPosition.row + 1,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
else if (c.callmem_node) {
|
|
224
|
+
// call_expression with member_expression function
|
|
225
|
+
const callInfo = extractCallInfo(c.callmem_fn, c.callmem_node);
|
|
226
|
+
if (callInfo)
|
|
227
|
+
calls.push(callInfo);
|
|
228
|
+
const cbDef = extractCallbackDefinition(c.callmem_node, c.callmem_fn);
|
|
229
|
+
if (cbDef)
|
|
230
|
+
definitions.push(cbDef);
|
|
231
|
+
}
|
|
232
|
+
else if (c.callsub_node) {
|
|
233
|
+
// call_expression with subscript_expression function
|
|
234
|
+
const callInfo = extractCallInfo(c.callsub_fn, c.callsub_node);
|
|
235
|
+
if (callInfo)
|
|
236
|
+
calls.push(callInfo);
|
|
237
|
+
}
|
|
238
|
+
else if (c.assign_node) {
|
|
239
|
+
// CommonJS: module.exports = require(...) / module.exports = { ...require(...) }
|
|
240
|
+
handleCommonJSAssignment(c.assign_left, c.assign_right, c.assign_node, imports);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// Extract top-level constants via targeted walk (query patterns don't cover these)
|
|
244
|
+
extractConstantsWalk(tree.rootNode, definitions);
|
|
245
|
+
// Extract dynamic import() calls via targeted walk (query patterns don't match `import` function type)
|
|
246
|
+
extractDynamicImportsWalk(tree.rootNode, imports);
|
|
247
|
+
// Extract typeMap from type annotations and new expressions
|
|
248
|
+
extractTypeMapWalk(tree.rootNode, typeMap);
|
|
249
|
+
return { definitions, calls, imports, classes, exports: exps, typeMap };
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Walk program-level children to extract `const x = <literal>` as constants.
|
|
253
|
+
* The query-based fast path has no pattern for lexical_declaration/variable_declaration,
|
|
254
|
+
* so constants are missed. This targeted walk fills that gap without a full tree traversal.
|
|
255
|
+
*/
|
|
256
|
+
function extractConstantsWalk(rootNode, definitions) {
|
|
257
|
+
for (let i = 0; i < rootNode.childCount; i++) {
|
|
258
|
+
const node = rootNode.child(i);
|
|
259
|
+
if (!node)
|
|
260
|
+
continue;
|
|
261
|
+
let declNode = node;
|
|
262
|
+
// Handle `export const …` — unwrap the export_statement to its declaration child
|
|
263
|
+
if (node.type === 'export_statement') {
|
|
264
|
+
const inner = node.childForFieldName('declaration');
|
|
265
|
+
if (!inner)
|
|
266
|
+
continue;
|
|
267
|
+
declNode = inner;
|
|
268
|
+
}
|
|
269
|
+
const t = declNode.type;
|
|
270
|
+
if (t !== 'lexical_declaration' && t !== 'variable_declaration')
|
|
271
|
+
continue;
|
|
272
|
+
if (!declNode.text.startsWith('const '))
|
|
273
|
+
continue;
|
|
274
|
+
for (let j = 0; j < declNode.childCount; j++) {
|
|
275
|
+
const declarator = declNode.child(j);
|
|
276
|
+
if (!declarator || declarator.type !== 'variable_declarator')
|
|
277
|
+
continue;
|
|
278
|
+
const nameN = declarator.childForFieldName('name');
|
|
279
|
+
const valueN = declarator.childForFieldName('value');
|
|
280
|
+
if (!nameN || nameN.type !== 'identifier' || !valueN)
|
|
281
|
+
continue;
|
|
282
|
+
// Skip functions — already captured by query patterns
|
|
283
|
+
const valType = valueN.type;
|
|
284
|
+
if (valType === 'arrow_function' ||
|
|
285
|
+
valType === 'function_expression' ||
|
|
286
|
+
valType === 'function')
|
|
287
|
+
continue;
|
|
288
|
+
if (isConstantValue(valueN)) {
|
|
289
|
+
definitions.push({
|
|
290
|
+
name: nameN.text,
|
|
291
|
+
kind: 'constant',
|
|
292
|
+
line: declNode.startPosition.row + 1,
|
|
293
|
+
endLine: nodeEndLine(declNode),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Recursive walk to find dynamic import() calls.
|
|
301
|
+
* Query patterns match call_expression with identifier/member_expression/subscript_expression
|
|
302
|
+
* functions, but import() has function type `import` which none of those patterns cover.
|
|
303
|
+
*/
|
|
304
|
+
function extractDynamicImportsWalk(node, imports) {
|
|
305
|
+
if (node.type === 'call_expression') {
|
|
306
|
+
const fn = node.childForFieldName('function');
|
|
307
|
+
if (fn && fn.type === 'import') {
|
|
308
|
+
const args = node.childForFieldName('arguments') || findChild(node, 'arguments');
|
|
309
|
+
if (args) {
|
|
310
|
+
const strArg = findChild(args, 'string');
|
|
311
|
+
if (strArg) {
|
|
312
|
+
const modPath = strArg.text.replace(/['"]/g, '');
|
|
313
|
+
const names = extractDynamicImportNames(node);
|
|
314
|
+
imports.push({
|
|
315
|
+
source: modPath,
|
|
316
|
+
names,
|
|
317
|
+
line: node.startPosition.row + 1,
|
|
318
|
+
dynamicImport: true,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
debug(`Skipping non-static dynamic import() at line ${node.startPosition.row + 1} (template literal or variable)`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return; // no need to recurse into import() children
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
329
|
+
extractDynamicImportsWalk(node.child(i), imports);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function handleCommonJSAssignment(left, right, node, imports) {
|
|
333
|
+
if (!left || !right)
|
|
334
|
+
return;
|
|
335
|
+
const leftText = left.text;
|
|
336
|
+
if (!leftText.startsWith('module.exports') && leftText !== 'exports')
|
|
337
|
+
return;
|
|
338
|
+
const rightType = right.type;
|
|
339
|
+
const assignLine = node.startPosition.row + 1;
|
|
340
|
+
if (rightType === 'call_expression') {
|
|
341
|
+
const fn = right.childForFieldName('function');
|
|
342
|
+
const args = right.childForFieldName('arguments') || findChild(right, 'arguments');
|
|
343
|
+
if (fn && fn.text === 'require' && args) {
|
|
344
|
+
const strArg = findChild(args, 'string');
|
|
345
|
+
if (strArg) {
|
|
346
|
+
imports.push({
|
|
347
|
+
source: strArg.text.replace(/['"]/g, ''),
|
|
348
|
+
names: [],
|
|
349
|
+
line: assignLine,
|
|
350
|
+
reexport: true,
|
|
351
|
+
wildcardReexport: true,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (rightType === 'object') {
|
|
357
|
+
for (let ci = 0; ci < right.childCount; ci++) {
|
|
358
|
+
const child = right.child(ci);
|
|
359
|
+
if (child && child.type === 'spread_element') {
|
|
360
|
+
const spreadExpr = child.child(1) || child.childForFieldName('value');
|
|
361
|
+
if (spreadExpr && spreadExpr.type === 'call_expression') {
|
|
362
|
+
const fn2 = spreadExpr.childForFieldName('function');
|
|
363
|
+
const args2 = spreadExpr.childForFieldName('arguments') || findChild(spreadExpr, 'arguments');
|
|
364
|
+
if (fn2 && fn2.text === 'require' && args2) {
|
|
365
|
+
const strArg2 = findChild(args2, 'string');
|
|
366
|
+
if (strArg2) {
|
|
367
|
+
imports.push({
|
|
368
|
+
source: strArg2.text.replace(/['"]/g, ''),
|
|
369
|
+
names: [],
|
|
370
|
+
line: assignLine,
|
|
371
|
+
reexport: true,
|
|
372
|
+
wildcardReexport: true,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// ── Manual tree walk (fallback when Query not available) ────────────────────
|
|
382
|
+
function extractSymbolsWalk(tree) {
|
|
383
|
+
const ctx = {
|
|
384
|
+
definitions: [],
|
|
385
|
+
calls: [],
|
|
386
|
+
imports: [],
|
|
387
|
+
classes: [],
|
|
388
|
+
exports: [],
|
|
389
|
+
typeMap: new Map(),
|
|
390
|
+
};
|
|
391
|
+
walkJavaScriptNode(tree.rootNode, ctx);
|
|
392
|
+
// Populate typeMap for variables and parameter type annotations
|
|
393
|
+
extractTypeMapWalk(tree.rootNode, ctx.typeMap);
|
|
394
|
+
return ctx;
|
|
395
|
+
}
|
|
396
|
+
function walkJavaScriptNode(node, ctx) {
|
|
397
|
+
switch (node.type) {
|
|
398
|
+
case 'function_declaration':
|
|
399
|
+
handleFunctionDecl(node, ctx);
|
|
400
|
+
break;
|
|
401
|
+
case 'class_declaration':
|
|
402
|
+
handleClassDecl(node, ctx);
|
|
403
|
+
break;
|
|
404
|
+
case 'method_definition':
|
|
405
|
+
handleMethodDef(node, ctx);
|
|
406
|
+
break;
|
|
407
|
+
case 'interface_declaration':
|
|
408
|
+
handleInterfaceDecl(node, ctx);
|
|
409
|
+
break;
|
|
410
|
+
case 'type_alias_declaration':
|
|
411
|
+
handleTypeAliasDecl(node, ctx);
|
|
412
|
+
break;
|
|
413
|
+
case 'lexical_declaration':
|
|
414
|
+
case 'variable_declaration':
|
|
415
|
+
handleVariableDecl(node, ctx);
|
|
416
|
+
break;
|
|
417
|
+
case 'enum_declaration':
|
|
418
|
+
handleEnumDecl(node, ctx);
|
|
419
|
+
break;
|
|
420
|
+
case 'call_expression':
|
|
421
|
+
handleCallExpr(node, ctx);
|
|
422
|
+
break;
|
|
423
|
+
case 'import_statement':
|
|
424
|
+
handleImportStmt(node, ctx);
|
|
425
|
+
break;
|
|
426
|
+
case 'export_statement':
|
|
427
|
+
handleExportStmt(node, ctx);
|
|
428
|
+
break;
|
|
429
|
+
case 'expression_statement':
|
|
430
|
+
handleExpressionStmt(node, ctx);
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
434
|
+
walkJavaScriptNode(node.child(i), ctx);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
// ── Walk-path per-node-type handlers ────────────────────────────────────────
|
|
438
|
+
function handleFunctionDecl(node, ctx) {
|
|
439
|
+
const nameNode = node.childForFieldName('name');
|
|
440
|
+
if (nameNode) {
|
|
441
|
+
const fnChildren = extractParameters(node);
|
|
442
|
+
ctx.definitions.push({
|
|
443
|
+
name: nameNode.text,
|
|
444
|
+
kind: 'function',
|
|
445
|
+
line: node.startPosition.row + 1,
|
|
446
|
+
endLine: nodeEndLine(node),
|
|
447
|
+
children: fnChildren.length > 0 ? fnChildren : undefined,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
function handleClassDecl(node, ctx) {
|
|
452
|
+
const nameNode = node.childForFieldName('name');
|
|
453
|
+
if (!nameNode)
|
|
454
|
+
return;
|
|
455
|
+
const className = nameNode.text;
|
|
456
|
+
const startLine = node.startPosition.row + 1;
|
|
457
|
+
const clsChildren = extractClassProperties(node);
|
|
458
|
+
ctx.definitions.push({
|
|
459
|
+
name: className,
|
|
460
|
+
kind: 'class',
|
|
461
|
+
line: startLine,
|
|
462
|
+
endLine: nodeEndLine(node),
|
|
463
|
+
children: clsChildren.length > 0 ? clsChildren : undefined,
|
|
464
|
+
});
|
|
465
|
+
const heritage = node.childForFieldName('heritage') || findChild(node, 'class_heritage');
|
|
466
|
+
if (heritage) {
|
|
467
|
+
const superName = extractSuperclass(heritage);
|
|
468
|
+
if (superName) {
|
|
469
|
+
ctx.classes.push({ name: className, extends: superName, line: startLine });
|
|
470
|
+
}
|
|
471
|
+
const implementsList = extractImplements(heritage);
|
|
472
|
+
for (const iface of implementsList) {
|
|
473
|
+
ctx.classes.push({ name: className, implements: iface, line: startLine });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
function handleMethodDef(node, ctx) {
|
|
478
|
+
const nameNode = node.childForFieldName('name');
|
|
479
|
+
if (nameNode) {
|
|
480
|
+
const parentClass = findParentClass(node);
|
|
481
|
+
const fullName = parentClass ? `${parentClass}.${nameNode.text}` : nameNode.text;
|
|
482
|
+
const methChildren = extractParameters(node);
|
|
483
|
+
const methVis = extractVisibility(node);
|
|
484
|
+
ctx.definitions.push({
|
|
485
|
+
name: fullName,
|
|
486
|
+
kind: 'method',
|
|
487
|
+
line: node.startPosition.row + 1,
|
|
488
|
+
endLine: nodeEndLine(node),
|
|
489
|
+
children: methChildren.length > 0 ? methChildren : undefined,
|
|
490
|
+
visibility: methVis,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
function handleInterfaceDecl(node, ctx) {
|
|
495
|
+
const nameNode = node.childForFieldName('name');
|
|
496
|
+
if (!nameNode)
|
|
497
|
+
return;
|
|
498
|
+
ctx.definitions.push({
|
|
499
|
+
name: nameNode.text,
|
|
500
|
+
kind: 'interface',
|
|
501
|
+
line: node.startPosition.row + 1,
|
|
502
|
+
endLine: nodeEndLine(node),
|
|
503
|
+
});
|
|
504
|
+
const body = node.childForFieldName('body') ||
|
|
505
|
+
findChild(node, 'interface_body') ||
|
|
506
|
+
findChild(node, 'object_type');
|
|
507
|
+
if (body) {
|
|
508
|
+
extractInterfaceMethods(body, nameNode.text, ctx.definitions);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function handleTypeAliasDecl(node, ctx) {
|
|
512
|
+
const nameNode = node.childForFieldName('name');
|
|
513
|
+
if (nameNode) {
|
|
514
|
+
ctx.definitions.push({
|
|
515
|
+
name: nameNode.text,
|
|
516
|
+
kind: 'type',
|
|
517
|
+
line: node.startPosition.row + 1,
|
|
518
|
+
endLine: nodeEndLine(node),
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
function handleVariableDecl(node, ctx) {
|
|
523
|
+
const isConst = node.text.startsWith('const ');
|
|
524
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
525
|
+
const declarator = node.child(i);
|
|
526
|
+
if (declarator && declarator.type === 'variable_declarator') {
|
|
527
|
+
const nameN = declarator.childForFieldName('name');
|
|
528
|
+
const valueN = declarator.childForFieldName('value');
|
|
529
|
+
if (nameN && valueN) {
|
|
530
|
+
const valType = valueN.type;
|
|
531
|
+
if (valType === 'arrow_function' ||
|
|
532
|
+
valType === 'function_expression' ||
|
|
533
|
+
valType === 'function') {
|
|
534
|
+
const varFnChildren = extractParameters(valueN);
|
|
535
|
+
ctx.definitions.push({
|
|
536
|
+
name: nameN.text,
|
|
537
|
+
kind: 'function',
|
|
538
|
+
line: node.startPosition.row + 1,
|
|
539
|
+
endLine: nodeEndLine(valueN),
|
|
540
|
+
children: varFnChildren.length > 0 ? varFnChildren : undefined,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
else if (isConst && nameN.type === 'identifier' && isConstantValue(valueN)) {
|
|
544
|
+
ctx.definitions.push({
|
|
545
|
+
name: nameN.text,
|
|
546
|
+
kind: 'constant',
|
|
547
|
+
line: node.startPosition.row + 1,
|
|
548
|
+
endLine: nodeEndLine(node),
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function handleEnumDecl(node, ctx) {
|
|
556
|
+
const nameNode = node.childForFieldName('name');
|
|
557
|
+
if (!nameNode)
|
|
558
|
+
return;
|
|
559
|
+
const enumChildren = [];
|
|
560
|
+
const body = node.childForFieldName('body') || findChild(node, 'enum_body');
|
|
561
|
+
if (body) {
|
|
562
|
+
for (let i = 0; i < body.childCount; i++) {
|
|
563
|
+
const member = body.child(i);
|
|
564
|
+
if (!member)
|
|
565
|
+
continue;
|
|
566
|
+
if (member.type === 'enum_assignment' || member.type === 'property_identifier') {
|
|
567
|
+
const mName = member.childForFieldName('name') || member.child(0);
|
|
568
|
+
if (mName) {
|
|
569
|
+
enumChildren.push({
|
|
570
|
+
name: mName.text,
|
|
571
|
+
kind: 'constant',
|
|
572
|
+
line: member.startPosition.row + 1,
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
ctx.definitions.push({
|
|
579
|
+
name: nameNode.text,
|
|
580
|
+
kind: 'enum',
|
|
581
|
+
line: node.startPosition.row + 1,
|
|
582
|
+
endLine: nodeEndLine(node),
|
|
583
|
+
children: enumChildren.length > 0 ? enumChildren : undefined,
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
function handleCallExpr(node, ctx) {
|
|
587
|
+
const fn = node.childForFieldName('function');
|
|
588
|
+
if (!fn)
|
|
589
|
+
return;
|
|
590
|
+
if (fn.type === 'import') {
|
|
591
|
+
const args = node.childForFieldName('arguments') || findChild(node, 'arguments');
|
|
592
|
+
if (args) {
|
|
593
|
+
const strArg = findChild(args, 'string');
|
|
594
|
+
if (strArg) {
|
|
595
|
+
const modPath = strArg.text.replace(/['"]/g, '');
|
|
596
|
+
const names = extractDynamicImportNames(node);
|
|
597
|
+
ctx.imports.push({
|
|
598
|
+
source: modPath,
|
|
599
|
+
names,
|
|
600
|
+
line: node.startPosition.row + 1,
|
|
601
|
+
dynamicImport: true,
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
debug(`Skipping non-static dynamic import() at line ${node.startPosition.row + 1} (template literal or variable)`);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
const callInfo = extractCallInfo(fn, node);
|
|
611
|
+
if (callInfo)
|
|
612
|
+
ctx.calls.push(callInfo);
|
|
613
|
+
if (fn.type === 'member_expression') {
|
|
614
|
+
const cbDef = extractCallbackDefinition(node, fn);
|
|
615
|
+
if (cbDef)
|
|
616
|
+
ctx.definitions.push(cbDef);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
function handleImportStmt(node, ctx) {
|
|
621
|
+
const isTypeOnly = node.text.startsWith('import type');
|
|
622
|
+
const source = node.childForFieldName('source') || findChild(node, 'string');
|
|
623
|
+
if (source) {
|
|
624
|
+
const modPath = source.text.replace(/['"]/g, '');
|
|
625
|
+
const names = extractImportNames(node);
|
|
626
|
+
ctx.imports.push({
|
|
627
|
+
source: modPath,
|
|
628
|
+
names,
|
|
629
|
+
line: node.startPosition.row + 1,
|
|
630
|
+
typeOnly: isTypeOnly,
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function handleExportStmt(node, ctx) {
|
|
635
|
+
const exportLine = node.startPosition.row + 1;
|
|
636
|
+
const decl = node.childForFieldName('declaration');
|
|
637
|
+
if (decl) {
|
|
638
|
+
const declType = decl.type;
|
|
639
|
+
const kindMap = {
|
|
640
|
+
function_declaration: 'function',
|
|
641
|
+
class_declaration: 'class',
|
|
642
|
+
interface_declaration: 'interface',
|
|
643
|
+
type_alias_declaration: 'type',
|
|
644
|
+
};
|
|
645
|
+
const kind = kindMap[declType];
|
|
646
|
+
if (kind) {
|
|
647
|
+
const n = decl.childForFieldName('name');
|
|
648
|
+
if (n)
|
|
649
|
+
ctx.exports.push({ name: n.text, kind, line: exportLine });
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
const source = node.childForFieldName('source') || findChild(node, 'string');
|
|
653
|
+
if (source && !decl) {
|
|
654
|
+
const modPath = source.text.replace(/['"]/g, '');
|
|
655
|
+
const reexportNames = extractImportNames(node);
|
|
656
|
+
const nodeText = node.text;
|
|
657
|
+
const isWildcard = nodeText.includes('export *') || nodeText.includes('export*');
|
|
658
|
+
ctx.imports.push({
|
|
659
|
+
source: modPath,
|
|
660
|
+
names: reexportNames,
|
|
661
|
+
line: exportLine,
|
|
662
|
+
reexport: true,
|
|
663
|
+
wildcardReexport: isWildcard && reexportNames.length === 0,
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function handleExpressionStmt(node, ctx) {
|
|
668
|
+
const expr = node.child(0);
|
|
669
|
+
if (expr && expr.type === 'assignment_expression') {
|
|
670
|
+
const left = expr.childForFieldName('left');
|
|
671
|
+
const right = expr.childForFieldName('right');
|
|
672
|
+
handleCommonJSAssignment(left, right, node, ctx.imports);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
// ── Child extraction helpers ────────────────────────────────────────────────
|
|
676
|
+
function extractParameters(node) {
|
|
677
|
+
const params = [];
|
|
678
|
+
const paramsNode = node.childForFieldName('parameters') || findChild(node, 'formal_parameters');
|
|
679
|
+
if (!paramsNode)
|
|
680
|
+
return params;
|
|
681
|
+
for (let i = 0; i < paramsNode.childCount; i++) {
|
|
682
|
+
const child = paramsNode.child(i);
|
|
683
|
+
if (!child)
|
|
684
|
+
continue;
|
|
685
|
+
const t = child.type;
|
|
686
|
+
if (t === 'identifier') {
|
|
687
|
+
params.push({ name: child.text, kind: 'parameter', line: child.startPosition.row + 1 });
|
|
688
|
+
}
|
|
689
|
+
else if (t === 'required_parameter' ||
|
|
690
|
+
t === 'optional_parameter' ||
|
|
691
|
+
t === 'assignment_pattern') {
|
|
692
|
+
const nameNode = child.childForFieldName('pattern') || child.childForFieldName('left') || child.child(0);
|
|
693
|
+
if (nameNode &&
|
|
694
|
+
(nameNode.type === 'identifier' ||
|
|
695
|
+
nameNode.type === 'shorthand_property_identifier_pattern')) {
|
|
696
|
+
params.push({ name: nameNode.text, kind: 'parameter', line: child.startPosition.row + 1 });
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
else if (t === 'rest_pattern' || t === 'rest_element') {
|
|
700
|
+
const nameNode = child.child(1) || child.childForFieldName('name');
|
|
701
|
+
if (nameNode && nameNode.type === 'identifier') {
|
|
702
|
+
params.push({ name: nameNode.text, kind: 'parameter', line: child.startPosition.row + 1 });
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
return params;
|
|
707
|
+
}
|
|
708
|
+
function extractClassProperties(classNode) {
|
|
709
|
+
const props = [];
|
|
710
|
+
const body = classNode.childForFieldName('body') || findChild(classNode, 'class_body');
|
|
711
|
+
if (!body)
|
|
712
|
+
return props;
|
|
713
|
+
for (let i = 0; i < body.childCount; i++) {
|
|
714
|
+
const child = body.child(i);
|
|
715
|
+
if (!child)
|
|
716
|
+
continue;
|
|
717
|
+
if (child.type === 'field_definition' ||
|
|
718
|
+
child.type === 'public_field_definition' ||
|
|
719
|
+
child.type === 'property_definition') {
|
|
720
|
+
const nameNode = child.childForFieldName('name') || child.childForFieldName('property') || child.child(0);
|
|
721
|
+
if (nameNode &&
|
|
722
|
+
(nameNode.type === 'property_identifier' ||
|
|
723
|
+
nameNode.type === 'identifier' ||
|
|
724
|
+
nameNode.type === 'private_property_identifier')) {
|
|
725
|
+
// Private # fields: nameNode.type is 'private_property_identifier'
|
|
726
|
+
// TS modifiers: accessibility_modifier child on the field_definition
|
|
727
|
+
const vis = nameNode.type === 'private_property_identifier' ? 'private' : extractVisibility(child);
|
|
728
|
+
props.push({
|
|
729
|
+
name: nameNode.text,
|
|
730
|
+
kind: 'property',
|
|
731
|
+
line: child.startPosition.row + 1,
|
|
732
|
+
visibility: vis,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return props;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Extract visibility modifier from a class member node.
|
|
741
|
+
* Checks for TS access modifiers (public/private/protected) and JS private (#) fields.
|
|
742
|
+
* Returns 'public' | 'private' | 'protected' | undefined.
|
|
743
|
+
*/
|
|
744
|
+
function extractVisibility(node) {
|
|
745
|
+
// Check for TS accessibility modifiers (accessibility_modifier child)
|
|
746
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
747
|
+
const child = node.child(i);
|
|
748
|
+
if (!child)
|
|
749
|
+
continue;
|
|
750
|
+
if (child.type === 'accessibility_modifier') {
|
|
751
|
+
const text = child.text;
|
|
752
|
+
if (text === 'private' || text === 'protected' || text === 'public')
|
|
753
|
+
return text;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
// Check for JS private name (# prefix) — try multiple field names
|
|
757
|
+
const nameNode = node.childForFieldName('name') || node.childForFieldName('property') || node.child(0);
|
|
758
|
+
if (nameNode && nameNode.type === 'private_property_identifier') {
|
|
759
|
+
return 'private';
|
|
760
|
+
}
|
|
761
|
+
return undefined;
|
|
762
|
+
}
|
|
763
|
+
function isConstantValue(valueNode) {
|
|
764
|
+
if (!valueNode)
|
|
765
|
+
return false;
|
|
766
|
+
const t = valueNode.type;
|
|
767
|
+
return (t === 'number' ||
|
|
768
|
+
t === 'string' ||
|
|
769
|
+
t === 'template_string' ||
|
|
770
|
+
t === 'true' ||
|
|
771
|
+
t === 'false' ||
|
|
772
|
+
t === 'null' ||
|
|
773
|
+
t === 'undefined' ||
|
|
774
|
+
t === 'array' ||
|
|
775
|
+
t === 'object' ||
|
|
776
|
+
t === 'regex' ||
|
|
777
|
+
t === 'unary_expression' ||
|
|
778
|
+
t === 'binary_expression' ||
|
|
779
|
+
t === 'new_expression');
|
|
780
|
+
}
|
|
781
|
+
// ── Shared helpers ──────────────────────────────────────────────────────────
|
|
782
|
+
function extractInterfaceMethods(bodyNode, interfaceName, definitions) {
|
|
783
|
+
for (let i = 0; i < bodyNode.childCount; i++) {
|
|
784
|
+
const child = bodyNode.child(i);
|
|
785
|
+
if (!child)
|
|
786
|
+
continue;
|
|
787
|
+
if (child.type === 'method_signature' || child.type === 'property_signature') {
|
|
788
|
+
const nameNode = child.childForFieldName('name');
|
|
789
|
+
if (nameNode) {
|
|
790
|
+
definitions.push({
|
|
791
|
+
name: `${interfaceName}.${nameNode.text}`,
|
|
792
|
+
kind: 'method',
|
|
793
|
+
line: child.startPosition.row + 1,
|
|
794
|
+
endLine: child.endPosition.row + 1,
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function extractImplements(heritage) {
|
|
801
|
+
const interfaces = [];
|
|
802
|
+
for (let i = 0; i < heritage.childCount; i++) {
|
|
803
|
+
const child = heritage.child(i);
|
|
804
|
+
if (!child)
|
|
805
|
+
continue;
|
|
806
|
+
if (child.text === 'implements') {
|
|
807
|
+
for (let j = i + 1; j < heritage.childCount; j++) {
|
|
808
|
+
const next = heritage.child(j);
|
|
809
|
+
if (!next)
|
|
810
|
+
continue;
|
|
811
|
+
if (next.type === 'identifier')
|
|
812
|
+
interfaces.push(next.text);
|
|
813
|
+
else if (next.type === 'type_identifier')
|
|
814
|
+
interfaces.push(next.text);
|
|
815
|
+
if (next.childCount > 0)
|
|
816
|
+
interfaces.push(...extractImplementsFromNode(next));
|
|
817
|
+
}
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
if (child.type === 'implements_clause') {
|
|
821
|
+
interfaces.push(...extractImplementsFromNode(child));
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
return interfaces;
|
|
825
|
+
}
|
|
826
|
+
function extractImplementsFromNode(node) {
|
|
827
|
+
const result = [];
|
|
828
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
829
|
+
const child = node.child(i);
|
|
830
|
+
if (!child)
|
|
831
|
+
continue;
|
|
832
|
+
if (child.type === 'identifier' || child.type === 'type_identifier')
|
|
833
|
+
result.push(child.text);
|
|
834
|
+
if (child.childCount > 0)
|
|
835
|
+
result.push(...extractImplementsFromNode(child));
|
|
836
|
+
}
|
|
837
|
+
return result;
|
|
838
|
+
}
|
|
839
|
+
// ── Type inference helpers ───────────────────────────────────────────────
|
|
840
|
+
function extractSimpleTypeName(typeAnnotationNode) {
|
|
841
|
+
if (!typeAnnotationNode)
|
|
842
|
+
return null;
|
|
843
|
+
for (let i = 0; i < typeAnnotationNode.childCount; i++) {
|
|
844
|
+
const child = typeAnnotationNode.child(i);
|
|
845
|
+
if (!child)
|
|
846
|
+
continue;
|
|
847
|
+
const t = child.type;
|
|
848
|
+
if (t === 'type_identifier' || t === 'identifier')
|
|
849
|
+
return child.text;
|
|
850
|
+
if (t === 'generic_type')
|
|
851
|
+
return child.child(0)?.text || null;
|
|
852
|
+
if (t === 'parenthesized_type')
|
|
853
|
+
return extractSimpleTypeName(child);
|
|
854
|
+
// Skip union, intersection, and array types — too ambiguous
|
|
855
|
+
}
|
|
856
|
+
return null;
|
|
857
|
+
}
|
|
858
|
+
function extractNewExprTypeName(newExprNode) {
|
|
859
|
+
if (!newExprNode || newExprNode.type !== 'new_expression')
|
|
860
|
+
return null;
|
|
861
|
+
const ctor = newExprNode.childForFieldName('constructor') || newExprNode.child(1);
|
|
862
|
+
if (!ctor)
|
|
863
|
+
return null;
|
|
864
|
+
if (ctor.type === 'identifier')
|
|
865
|
+
return ctor.text;
|
|
866
|
+
if (ctor.type === 'member_expression') {
|
|
867
|
+
const prop = ctor.childForFieldName('property');
|
|
868
|
+
return prop ? prop.text : null;
|
|
869
|
+
}
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Extract variable-to-type assignments into a per-file type map.
|
|
874
|
+
*
|
|
875
|
+
* Values are `{ type: string, confidence: number }`:
|
|
876
|
+
* - 1.0: explicit constructor (`new Foo()`)
|
|
877
|
+
* - 0.9: type annotation (`: Foo`) or typed parameter
|
|
878
|
+
* - 0.7: factory method call (`Foo.create()` — uppercase-first heuristic)
|
|
879
|
+
*
|
|
880
|
+
* Higher-confidence entries take priority when the same variable is seen twice.
|
|
881
|
+
*/
|
|
882
|
+
function extractTypeMapWalk(rootNode, typeMap) {
|
|
883
|
+
function setIfHigher(name, type, confidence) {
|
|
884
|
+
const existing = typeMap.get(name);
|
|
885
|
+
if (!existing || confidence > existing.confidence) {
|
|
886
|
+
typeMap.set(name, { type, confidence });
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function walk(node, depth) {
|
|
890
|
+
if (depth >= 200)
|
|
891
|
+
return;
|
|
892
|
+
const t = node.type;
|
|
893
|
+
if (t === 'variable_declarator') {
|
|
894
|
+
const nameN = node.childForFieldName('name');
|
|
895
|
+
if (nameN && nameN.type === 'identifier') {
|
|
896
|
+
const typeAnno = findChild(node, 'type_annotation');
|
|
897
|
+
if (typeAnno) {
|
|
898
|
+
const typeName = extractSimpleTypeName(typeAnno);
|
|
899
|
+
if (typeName)
|
|
900
|
+
setIfHigher(nameN.text, typeName, 0.9);
|
|
901
|
+
}
|
|
902
|
+
const valueN = node.childForFieldName('value');
|
|
903
|
+
if (valueN) {
|
|
904
|
+
// Constructor: const x = new Foo() → confidence 1.0
|
|
905
|
+
if (valueN.type === 'new_expression') {
|
|
906
|
+
const ctorType = extractNewExprTypeName(valueN);
|
|
907
|
+
if (ctorType)
|
|
908
|
+
setIfHigher(nameN.text, ctorType, 1.0);
|
|
909
|
+
}
|
|
910
|
+
// Factory method: const x = Foo.create() → confidence 0.7
|
|
911
|
+
else if (valueN.type === 'call_expression') {
|
|
912
|
+
const fn = valueN.childForFieldName('function');
|
|
913
|
+
if (fn && fn.type === 'member_expression') {
|
|
914
|
+
const obj = fn.childForFieldName('object');
|
|
915
|
+
if (obj && obj.type === 'identifier') {
|
|
916
|
+
const objName = obj.text;
|
|
917
|
+
if (objName[0] !== objName[0].toLowerCase() && !BUILTIN_GLOBALS.has(objName)) {
|
|
918
|
+
setIfHigher(nameN.text, objName, 0.7);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
else if (t === 'required_parameter' || t === 'optional_parameter') {
|
|
927
|
+
const nameNode = node.childForFieldName('pattern') || node.childForFieldName('left') || node.child(0);
|
|
928
|
+
if (nameNode && nameNode.type === 'identifier') {
|
|
929
|
+
const typeAnno = findChild(node, 'type_annotation');
|
|
930
|
+
if (typeAnno) {
|
|
931
|
+
const typeName = extractSimpleTypeName(typeAnno);
|
|
932
|
+
if (typeName)
|
|
933
|
+
setIfHigher(nameNode.text, typeName, 0.9);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
938
|
+
walk(node.child(i), depth + 1);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
walk(rootNode, 0);
|
|
942
|
+
}
|
|
943
|
+
function extractReceiverName(objNode) {
|
|
944
|
+
if (!objNode)
|
|
945
|
+
return undefined;
|
|
946
|
+
const t = objNode.type;
|
|
947
|
+
if (t === 'identifier' || t === 'this' || t === 'super')
|
|
948
|
+
return objNode.text;
|
|
949
|
+
return objNode.text;
|
|
950
|
+
}
|
|
951
|
+
function extractCallInfo(fn, callNode) {
|
|
952
|
+
const fnType = fn.type;
|
|
953
|
+
if (fnType === 'identifier') {
|
|
954
|
+
return { name: fn.text, line: callNode.startPosition.row + 1 };
|
|
955
|
+
}
|
|
956
|
+
if (fnType === 'member_expression') {
|
|
957
|
+
const obj = fn.childForFieldName('object');
|
|
958
|
+
const prop = fn.childForFieldName('property');
|
|
959
|
+
if (!prop)
|
|
960
|
+
return null;
|
|
961
|
+
const callLine = callNode.startPosition.row + 1;
|
|
962
|
+
const propText = prop.text;
|
|
963
|
+
if (propText === 'call' || propText === 'apply' || propText === 'bind') {
|
|
964
|
+
if (obj && obj.type === 'identifier')
|
|
965
|
+
return { name: obj.text, line: callLine, dynamic: true };
|
|
966
|
+
if (obj && obj.type === 'member_expression') {
|
|
967
|
+
const innerProp = obj.childForFieldName('property');
|
|
968
|
+
if (innerProp)
|
|
969
|
+
return { name: innerProp.text, line: callLine, dynamic: true };
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
const propType = prop.type;
|
|
973
|
+
if (propType === 'string' || propType === 'string_fragment') {
|
|
974
|
+
const methodName = propText.replace(/['"]/g, '');
|
|
975
|
+
if (methodName) {
|
|
976
|
+
const receiver = extractReceiverName(obj);
|
|
977
|
+
return { name: methodName, line: callLine, dynamic: true, receiver };
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
const receiver = extractReceiverName(obj);
|
|
981
|
+
return { name: propText, line: callLine, receiver };
|
|
982
|
+
}
|
|
983
|
+
if (fnType === 'subscript_expression') {
|
|
984
|
+
const obj = fn.childForFieldName('object');
|
|
985
|
+
const index = fn.childForFieldName('index');
|
|
986
|
+
if (index) {
|
|
987
|
+
const indexType = index.type;
|
|
988
|
+
if (indexType === 'string' || indexType === 'template_string') {
|
|
989
|
+
const methodName = index.text.replace(/['"`]/g, '');
|
|
990
|
+
if (methodName && !methodName.includes('$')) {
|
|
991
|
+
const receiver = extractReceiverName(obj);
|
|
992
|
+
return {
|
|
993
|
+
name: methodName,
|
|
994
|
+
line: callNode.startPosition.row + 1,
|
|
995
|
+
dynamic: true,
|
|
996
|
+
receiver,
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
return null;
|
|
1003
|
+
}
|
|
1004
|
+
function findAnonymousCallback(argsNode) {
|
|
1005
|
+
for (let i = 0; i < argsNode.childCount; i++) {
|
|
1006
|
+
const child = argsNode.child(i);
|
|
1007
|
+
if (child && (child.type === 'arrow_function' || child.type === 'function_expression')) {
|
|
1008
|
+
return child;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
function findFirstStringArg(argsNode) {
|
|
1014
|
+
for (let i = 0; i < argsNode.childCount; i++) {
|
|
1015
|
+
const child = argsNode.child(i);
|
|
1016
|
+
if (child && child.type === 'string') {
|
|
1017
|
+
return child.text.replace(/['"]/g, '');
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return null;
|
|
1021
|
+
}
|
|
1022
|
+
function walkCallChain(startNode, methodName) {
|
|
1023
|
+
let current = startNode;
|
|
1024
|
+
while (current) {
|
|
1025
|
+
const curType = current.type;
|
|
1026
|
+
if (curType === 'call_expression') {
|
|
1027
|
+
const fn = current.childForFieldName('function');
|
|
1028
|
+
if (fn && fn.type === 'member_expression') {
|
|
1029
|
+
const prop = fn.childForFieldName('property');
|
|
1030
|
+
if (prop && prop.text === methodName) {
|
|
1031
|
+
return current;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
current = fn;
|
|
1035
|
+
}
|
|
1036
|
+
else if (curType === 'member_expression') {
|
|
1037
|
+
current = current.childForFieldName('object');
|
|
1038
|
+
}
|
|
1039
|
+
else {
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
return null;
|
|
1044
|
+
}
|
|
1045
|
+
const EXPRESS_METHODS = new Set([
|
|
1046
|
+
'get',
|
|
1047
|
+
'post',
|
|
1048
|
+
'put',
|
|
1049
|
+
'delete',
|
|
1050
|
+
'patch',
|
|
1051
|
+
'options',
|
|
1052
|
+
'head',
|
|
1053
|
+
'all',
|
|
1054
|
+
'use',
|
|
1055
|
+
]);
|
|
1056
|
+
const EVENT_METHODS = new Set(['on', 'once', 'addEventListener', 'addListener']);
|
|
1057
|
+
function extractCallbackDefinition(callNode, fn) {
|
|
1058
|
+
if (!fn)
|
|
1059
|
+
fn = callNode.childForFieldName('function');
|
|
1060
|
+
if (!fn || fn.type !== 'member_expression')
|
|
1061
|
+
return null;
|
|
1062
|
+
const prop = fn.childForFieldName('property');
|
|
1063
|
+
if (!prop)
|
|
1064
|
+
return null;
|
|
1065
|
+
const method = prop.text;
|
|
1066
|
+
const args = callNode.childForFieldName('arguments') || findChild(callNode, 'arguments');
|
|
1067
|
+
if (!args)
|
|
1068
|
+
return null;
|
|
1069
|
+
// Commander: .action(callback) with .command('name') in chain
|
|
1070
|
+
if (method === 'action') {
|
|
1071
|
+
const cb = findAnonymousCallback(args);
|
|
1072
|
+
if (!cb)
|
|
1073
|
+
return null;
|
|
1074
|
+
const commandCall = walkCallChain(fn.childForFieldName('object'), 'command');
|
|
1075
|
+
if (!commandCall)
|
|
1076
|
+
return null;
|
|
1077
|
+
const cmdArgs = commandCall.childForFieldName('arguments') || findChild(commandCall, 'arguments');
|
|
1078
|
+
if (!cmdArgs)
|
|
1079
|
+
return null;
|
|
1080
|
+
const cmdName = findFirstStringArg(cmdArgs);
|
|
1081
|
+
if (!cmdName)
|
|
1082
|
+
return null;
|
|
1083
|
+
const firstWord = cmdName.split(/\s/)[0];
|
|
1084
|
+
return {
|
|
1085
|
+
name: `command:${firstWord}`,
|
|
1086
|
+
kind: 'function',
|
|
1087
|
+
line: cb.startPosition.row + 1,
|
|
1088
|
+
endLine: nodeEndLine(cb),
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
// Express: app.get('/path', callback)
|
|
1092
|
+
if (EXPRESS_METHODS.has(method)) {
|
|
1093
|
+
const strArg = findFirstStringArg(args);
|
|
1094
|
+
if (!strArg || !strArg.startsWith('/'))
|
|
1095
|
+
return null;
|
|
1096
|
+
const cb = findAnonymousCallback(args);
|
|
1097
|
+
if (!cb)
|
|
1098
|
+
return null;
|
|
1099
|
+
return {
|
|
1100
|
+
name: `route:${method.toUpperCase()} ${strArg}`,
|
|
1101
|
+
kind: 'function',
|
|
1102
|
+
line: cb.startPosition.row + 1,
|
|
1103
|
+
endLine: nodeEndLine(cb),
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
// Events: emitter.on('event', callback)
|
|
1107
|
+
if (EVENT_METHODS.has(method)) {
|
|
1108
|
+
const eventName = findFirstStringArg(args);
|
|
1109
|
+
if (!eventName)
|
|
1110
|
+
return null;
|
|
1111
|
+
const cb = findAnonymousCallback(args);
|
|
1112
|
+
if (!cb)
|
|
1113
|
+
return null;
|
|
1114
|
+
return {
|
|
1115
|
+
name: `event:${eventName}`,
|
|
1116
|
+
kind: 'function',
|
|
1117
|
+
line: cb.startPosition.row + 1,
|
|
1118
|
+
endLine: nodeEndLine(cb),
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
return null;
|
|
1122
|
+
}
|
|
1123
|
+
function extractSuperclass(heritage) {
|
|
1124
|
+
for (let i = 0; i < heritage.childCount; i++) {
|
|
1125
|
+
const child = heritage.child(i);
|
|
1126
|
+
if (child.type === 'identifier')
|
|
1127
|
+
return child.text;
|
|
1128
|
+
if (child.type === 'member_expression')
|
|
1129
|
+
return child.text;
|
|
1130
|
+
const found = extractSuperclass(child);
|
|
1131
|
+
if (found)
|
|
1132
|
+
return found;
|
|
1133
|
+
}
|
|
1134
|
+
return null;
|
|
1135
|
+
}
|
|
1136
|
+
function findParentClass(node) {
|
|
1137
|
+
let current = node.parent;
|
|
1138
|
+
while (current) {
|
|
1139
|
+
const t = current.type;
|
|
1140
|
+
if (t === 'class_declaration' || t === 'class') {
|
|
1141
|
+
const nameNode = current.childForFieldName('name');
|
|
1142
|
+
return nameNode ? nameNode.text : null;
|
|
1143
|
+
}
|
|
1144
|
+
current = current.parent;
|
|
1145
|
+
}
|
|
1146
|
+
return null;
|
|
1147
|
+
}
|
|
1148
|
+
function extractImportNames(node) {
|
|
1149
|
+
const names = [];
|
|
1150
|
+
function scan(n) {
|
|
1151
|
+
if (n.type === 'import_specifier' || n.type === 'export_specifier') {
|
|
1152
|
+
const nameNode = n.childForFieldName('name') || n.childForFieldName('alias');
|
|
1153
|
+
if (nameNode)
|
|
1154
|
+
names.push(nameNode.text);
|
|
1155
|
+
else
|
|
1156
|
+
names.push(n.text);
|
|
1157
|
+
}
|
|
1158
|
+
else if (n.type === 'identifier' && n.parent && n.parent.type === 'import_clause') {
|
|
1159
|
+
names.push(n.text);
|
|
1160
|
+
}
|
|
1161
|
+
else if (n.type === 'namespace_import') {
|
|
1162
|
+
names.push(n.text);
|
|
1163
|
+
}
|
|
1164
|
+
for (let i = 0; i < n.childCount; i++)
|
|
1165
|
+
scan(n.child(i));
|
|
1166
|
+
}
|
|
1167
|
+
scan(node);
|
|
1168
|
+
return names;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Extract destructured names from a dynamic import() call expression.
|
|
1172
|
+
*
|
|
1173
|
+
* Handles:
|
|
1174
|
+
* const { a, b } = await import('./foo.js') → ['a', 'b']
|
|
1175
|
+
* const mod = await import('./foo.js') → ['mod']
|
|
1176
|
+
* import('./foo.js') → [] (no names extractable)
|
|
1177
|
+
*
|
|
1178
|
+
* Walks up the AST from the call_expression to find the enclosing
|
|
1179
|
+
* variable_declarator and reads the name/object_pattern.
|
|
1180
|
+
*/
|
|
1181
|
+
function extractDynamicImportNames(callNode) {
|
|
1182
|
+
// Walk up: call_expression → await_expression → variable_declarator
|
|
1183
|
+
let current = callNode.parent;
|
|
1184
|
+
// Skip await_expression wrapper if present
|
|
1185
|
+
if (current && current.type === 'await_expression')
|
|
1186
|
+
current = current.parent;
|
|
1187
|
+
// We should now be at a variable_declarator (or not, if standalone import())
|
|
1188
|
+
if (!current || current.type !== 'variable_declarator')
|
|
1189
|
+
return [];
|
|
1190
|
+
const nameNode = current.childForFieldName('name');
|
|
1191
|
+
if (!nameNode)
|
|
1192
|
+
return [];
|
|
1193
|
+
// const { a, b } = await import(...) → object_pattern
|
|
1194
|
+
if (nameNode.type === 'object_pattern') {
|
|
1195
|
+
const names = [];
|
|
1196
|
+
for (let i = 0; i < nameNode.childCount; i++) {
|
|
1197
|
+
const child = nameNode.child(i);
|
|
1198
|
+
if (child.type === 'shorthand_property_identifier_pattern') {
|
|
1199
|
+
names.push(child.text);
|
|
1200
|
+
}
|
|
1201
|
+
else if (child.type === 'pair_pattern') {
|
|
1202
|
+
// { a: localName } → use localName (the alias) for the local binding,
|
|
1203
|
+
// but use the key (original name) for import resolution
|
|
1204
|
+
const key = child.childForFieldName('key');
|
|
1205
|
+
if (key)
|
|
1206
|
+
names.push(key.text);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
return names;
|
|
1210
|
+
}
|
|
1211
|
+
// const mod = await import(...) → identifier (namespace-like import)
|
|
1212
|
+
if (nameNode.type === 'identifier') {
|
|
1213
|
+
return [nameNode.text];
|
|
1214
|
+
}
|
|
1215
|
+
// const [a, b] = await import(...) → array_pattern (rare but possible)
|
|
1216
|
+
if (nameNode.type === 'array_pattern') {
|
|
1217
|
+
const names = [];
|
|
1218
|
+
for (let i = 0; i < nameNode.childCount; i++) {
|
|
1219
|
+
const child = nameNode.child(i);
|
|
1220
|
+
if (child.type === 'identifier')
|
|
1221
|
+
names.push(child.text);
|
|
1222
|
+
else if (child.type === 'rest_pattern') {
|
|
1223
|
+
const inner = child.child(0) || child.childForFieldName('name');
|
|
1224
|
+
if (inner && inner.type === 'identifier')
|
|
1225
|
+
names.push(inner.text);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
return names;
|
|
1229
|
+
}
|
|
1230
|
+
return [];
|
|
1231
|
+
}
|
|
1232
|
+
//# sourceMappingURL=javascript.js.map
|