cgraphx 2.0.1 → 2.0.3
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/dist/.claude-template/FLOW-MAP.md +7 -5
- package/dist/.claude-template/commands/end.md +1 -1
- package/dist/.claude-template/skills/cgraphx-guide/SKILL.md +2 -1
- package/dist/.claude-template/skills/cgraphx-guide/how-to-use.html +4 -2
- package/dist/.claude-template/skills/cgraphx-guide/how-to-use.md +5 -2
- package/dist/.claude-template/skills/iboc-check/SKILL.md +116 -0
- package/dist/.claude-template/skills/iboc-check/filler-prompt.md +75 -0
- package/dist/.claude-template/skills/implementation/SKILL.md +7 -0
- package/dist/.claude-template/skills/init-project-guides/SKILL.md +1 -1
- package/dist/.claude-template/skills/run-api-test/references/db-verification.md +2 -2
- package/dist/.claude-template/skills/subagent-implement/SKILL.md +3 -2
- package/dist/.claude-template/skills/write-api/assets/template-request.bru +3 -3
- package/dist/.claude-template/skills/write-api/references/bru-format.md +6 -6
- package/dist/.claude-template/skills/write-delivery-guide/SKILL.md +97 -0
- package/dist/.claude-template/skills/write-delivery-guide/template-change-type.md +120 -0
- package/dist/.claude-template/skills/write-delivery-guide/template-multi-role-flow.md +148 -0
- package/dist/.claude-template/skills/write-unit-test-code/SKILL.md +23 -6
- package/dist/core/code/engine/cli/analyze-config.js +320 -0
- package/dist/core/code/engine/cli/analyze.js +1086 -0
- package/dist/core/code/engine/cli/cli-message.js +83 -0
- package/dist/core/code/engine/cli/detect-changes-format.js +58 -0
- package/dist/core/code/engine/cli/embedding-dims.js +43 -0
- package/dist/core/code/engine/cli/format-elapsed.js +12 -0
- package/dist/core/code/engine/cli/help-i18n.js +144 -0
- package/dist/core/code/engine/cli/i18n/en.js +110 -0
- package/dist/core/code/engine/cli/i18n/index.js +47 -0
- package/dist/core/code/engine/cli/i18n/resources.js +9 -0
- package/dist/core/code/engine/cli/i18n/zh-CN.js +110 -0
- package/dist/core/code/engine/cli/lazy-action.js +67 -0
- package/dist/core/code/engine/cli/optional-grammars.js +136 -0
- package/dist/core/code/engine/cli/resolve-invocation.js +76 -0
- package/dist/core/code/engine/cli/status.js +156 -0
- package/dist/core/code/engine/cli/tool.js +384 -0
- package/dist/core/code/engine/config/ignore-service.js +511 -0
- package/dist/core/code/engine/config/supported-languages.js +17 -0
- package/dist/core/code/engine/core/analysis-features.js +64 -0
- package/dist/core/code/engine/core/analyzer-identity.js +2171 -0
- package/dist/core/code/engine/core/git-staleness.js +180 -0
- package/dist/core/code/engine/core/graph/graph.js +180 -0
- package/dist/core/code/engine/core/graph/import-cycles.js +106 -0
- package/dist/core/code/engine/core/graph/types.js +2 -0
- package/dist/core/code/engine/core/index-freshness.js +12 -0
- package/dist/core/code/engine/core/ingestion/binding-accumulator.js +341 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/c-cpp.js +168 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/csharp.js +9 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/dart.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/go.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/jvm.js +54 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/php.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/python.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/ruby.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/rust.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/swift.js +8 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/configs/typescript-javascript.js +11 -0
- package/dist/core/code/engine/core/ingestion/call-extractors/generic.js +62 -0
- package/dist/core/code/engine/core/ingestion/call-processor.js +503 -0
- package/dist/core/code/engine/core/ingestion/call-routing.js +98 -0
- package/dist/core/code/engine/core/ingestion/call-types.js +3 -0
- package/dist/core/code/engine/core/ingestion/cfg/callee-cell-format.js +45 -0
- package/dist/core/code/engine/core/ingestion/cfg/cfg-builder.js +202 -0
- package/dist/core/code/engine/core/ingestion/cfg/collect.js +81 -0
- package/dist/core/code/engine/core/ingestion/cfg/control-dependence.js +185 -0
- package/dist/core/code/engine/core/ingestion/cfg/control-flow-context.js +130 -0
- package/dist/core/code/engine/core/ingestion/cfg/emit.js +646 -0
- package/dist/core/code/engine/core/ingestion/cfg/post-dominators.js +182 -0
- package/dist/core/code/engine/core/ingestion/cfg/reaching-def-reason-codec.js +139 -0
- package/dist/core/code/engine/core/ingestion/cfg/reaching-defs-graph.js +322 -0
- package/dist/core/code/engine/core/ingestion/cfg/reaching-defs.js +792 -0
- package/dist/core/code/engine/core/ingestion/cfg/synthetic-escape.js +305 -0
- package/dist/core/code/engine/core/ingestion/cfg/traversal-result.js +6 -0
- package/dist/core/code/engine/core/ingestion/cfg/types.js +14 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/c-cpp-harvest.js +545 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/c-cpp.js +590 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/call-site-harvest.js +356 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/csharp-harvest.js +593 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/csharp.js +871 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/dart-harvest.js +874 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/dart.js +840 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/go-harvest.js +625 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/go.js +642 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/java-harvest.js +517 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/java.js +816 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/kotlin-harvest.js +723 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/kotlin.js +813 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/php-harvest.js +630 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/php.js +725 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/python-harvest.js +776 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/python.js +562 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/ruby-harvest.js +591 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/ruby.js +760 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/rust-harvest.js +877 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/rust.js +562 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/scope-tree-harvest.js +120 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/swift-harvest.js +683 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/swift.js +791 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/typescript-harvest.js +1060 -0
- package/dist/core/code/engine/core/ingestion/cfg/visitors/typescript.js +587 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/c-cpp.js +77 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/csharp.js +24 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/dart.js +10 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/go.js +28 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/jvm.js +67 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/php.js +10 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/python.js +10 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/ruby.js +13 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/rust.js +10 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/swift.js +21 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/configs/typescript-javascript.js +31 -0
- package/dist/core/code/engine/core/ingestion/class-extractors/generic.js +144 -0
- package/dist/core/code/engine/core/ingestion/class-types.js +2 -0
- package/dist/core/code/engine/core/ingestion/cluster-enricher.js +174 -0
- package/dist/core/code/engine/core/ingestion/community-processor.js +604 -0
- package/dist/core/code/engine/core/ingestion/constants.js +26 -0
- package/dist/core/code/engine/core/ingestion/cpp-ue-preprocessor.js +263 -0
- package/dist/core/code/engine/core/ingestion/csharp-namespace-gate.js +133 -0
- package/dist/core/code/engine/core/ingestion/di-extractors/index.js +38 -0
- package/dist/core/code/engine/core/ingestion/di-extractors/spring.js +310 -0
- package/dist/core/code/engine/core/ingestion/emit-references.js +244 -0
- package/dist/core/code/engine/core/ingestion/entry-point-scoring.js +201 -0
- package/dist/core/code/engine/core/ingestion/export-detection.js +244 -0
- package/dist/core/code/engine/core/ingestion/field-extractor.js +29 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/c-cpp.js +107 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/csharp.js +124 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/dart.js +99 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/go.js +102 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/helpers.js +198 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/jvm.js +172 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/php.js +67 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/python.js +94 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/ruby.js +79 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/rust.js +55 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/swift.js +93 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/configs/typescript-javascript.js +59 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/generic.js +147 -0
- package/dist/core/code/engine/core/ingestion/field-extractors/typescript.js +266 -0
- package/dist/core/code/engine/core/ingestion/field-types.js +3 -0
- package/dist/core/code/engine/core/ingestion/filesystem-walker.js +136 -0
- package/dist/core/code/engine/core/ingestion/finalize-orchestrator.js +159 -0
- package/dist/core/code/engine/core/ingestion/framework-detection.js +432 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/analysis-features.js +38 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/annotation-arguments.js +234 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/aop-candidates.js +88 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/aop.js +487 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/auto-configuration.js +21 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/bean-candidates.js +189 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/bean-catalog.js +32 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/bean-factories.js +73 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/conditionals.js +323 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/config-bindings.js +119 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/di-metadata.js +385 -0
- package/dist/core/code/engine/core/ingestion/frameworks/spring/resource-injection.js +96 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/c-cpp.js +17 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/csharp.js +46 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/dart.js +59 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/go.js +30 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/jvm.js +73 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/php.js +19 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/python.js +45 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/ruby.js +20 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/rust.js +58 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/swift.js +94 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/configs/typescript-javascript.js +26 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/csharp.js +128 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/go.js +50 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/jvm.js +112 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/php.js +80 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/python.js +75 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/resolver-factory.js +36 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/ruby.js +20 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/rust.js +79 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/standard.js +180 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/types.js +7 -0
- package/dist/core/code/engine/core/ingestion/import-resolvers/utils.js +153 -0
- package/dist/core/code/engine/core/ingestion/import-target-adapter.js +99 -0
- package/dist/core/code/engine/core/ingestion/language-config.js +391 -0
- package/dist/core/code/engine/core/ingestion/language-provider.js +25 -0
- package/dist/core/code/engine/core/ingestion/languages/c/arity-metadata.js +98 -0
- package/dist/core/code/engine/core/ingestion/languages/c/arity.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/c/capture-side-channel.js +69 -0
- package/dist/core/code/engine/core/ingestion/languages/c/captures.js +189 -0
- package/dist/core/code/engine/core/ingestion/languages/c/header-scan.js +58 -0
- package/dist/core/code/engine/core/ingestion/languages/c/import-decomposer.js +68 -0
- package/dist/core/code/engine/core/ingestion/languages/c/import-target.js +103 -0
- package/dist/core/code/engine/core/ingestion/languages/c/index.js +33 -0
- package/dist/core/code/engine/core/ingestion/languages/c/interpret.js +53 -0
- package/dist/core/code/engine/core/ingestion/languages/c/merge-bindings.js +26 -0
- package/dist/core/code/engine/core/ingestion/languages/c/query.js +210 -0
- package/dist/core/code/engine/core/ingestion/languages/c/scope-resolver.js +112 -0
- package/dist/core/code/engine/core/ingestion/languages/c/simple-hooks.js +24 -0
- package/dist/core/code/engine/core/ingestion/languages/c/static-linkage.js +109 -0
- package/dist/core/code/engine/core/ingestion/languages/c-cpp.js +506 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/adl.js +804 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/arity-metadata.js +258 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/arity.js +37 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/capture-side-channel.js +89 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/captures.js +1975 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/constraint-extractor.js +311 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/constraint-filter.js +210 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/conversion-rank.js +163 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/file-local-linkage.js +327 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/header-scan.js +53 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/import-decomposer.js +134 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/import-target.js +16 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/index.js +33 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/inline-namespaces.js +379 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/interpret.js +239 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/member-lookup.js +470 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/merge-bindings.js +32 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/query.js +763 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/range-bindings.js +230 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/scope-resolver.js +354 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/simple-hooks.js +67 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/two-phase-lookup.js +348 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/type-classifier.js +56 -0
- package/dist/core/code/engine/core/ingestion/languages/cpp/user-defined-conversions.js +128 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/accessor-unwrap.js +67 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/arity-metadata.js +49 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/arity.js +40 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/cache-stats.js +32 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/captures.js +557 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/import-decomposer.js +96 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/import-target.js +176 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/index.js +95 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/interpret.js +150 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/merge-bindings.js +58 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/namespace-siblings.js +708 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/qualified-type-names.js +62 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/query.js +578 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/receiver-binding.js +142 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/resolution-config.js +18 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/scope-resolver.js +84 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp/simple-hooks.js +81 -0
- package/dist/core/code/engine/core/ingestion/languages/csharp.js +204 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/arity-metadata.js +38 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/arity.js +34 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/built-ins.js +37 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/cache-stats.js +30 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/captures.js +1096 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/expand-wildcards.js +34 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/extension-type-preprocess.js +33 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/import-target.js +68 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/index.js +45 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/interpret.js +101 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/merge-bindings.js +42 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/query.js +246 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/receiver-binding.js +90 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/scope-resolver.js +197 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/signature-bindings.js +54 -0
- package/dist/core/code/engine/core/ingestion/languages/dart/simple-hooks.js +61 -0
- package/dist/core/code/engine/core/ingestion/languages/dart.js +138 -0
- package/dist/core/code/engine/core/ingestion/languages/go/arity-metadata.js +71 -0
- package/dist/core/code/engine/core/ingestion/languages/go/arity.js +17 -0
- package/dist/core/code/engine/core/ingestion/languages/go/cache-stats.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/go/captures.js +492 -0
- package/dist/core/code/engine/core/ingestion/languages/go/expand-wildcards.js +97 -0
- package/dist/core/code/engine/core/ingestion/languages/go/generic-type-parameters.js +146 -0
- package/dist/core/code/engine/core/ingestion/languages/go/import-decomposer.js +47 -0
- package/dist/core/code/engine/core/ingestion/languages/go/import-target.js +70 -0
- package/dist/core/code/engine/core/ingestion/languages/go/index.js +39 -0
- package/dist/core/code/engine/core/ingestion/languages/go/interface-impls.js +955 -0
- package/dist/core/code/engine/core/ingestion/languages/go/interpret.js +177 -0
- package/dist/core/code/engine/core/ingestion/languages/go/merge-bindings.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/go/method-owners.js +131 -0
- package/dist/core/code/engine/core/ingestion/languages/go/namespace-mirror.js +56 -0
- package/dist/core/code/engine/core/ingestion/languages/go/package-clause.js +79 -0
- package/dist/core/code/engine/core/ingestion/languages/go/package-siblings.js +83 -0
- package/dist/core/code/engine/core/ingestion/languages/go/query.js +298 -0
- package/dist/core/code/engine/core/ingestion/languages/go/range-binding.js +127 -0
- package/dist/core/code/engine/core/ingestion/languages/go/receiver-binding.js +24 -0
- package/dist/core/code/engine/core/ingestion/languages/go/scope-resolver.js +75 -0
- package/dist/core/code/engine/core/ingestion/languages/go/simple-hooks.js +31 -0
- package/dist/core/code/engine/core/ingestion/languages/go/type-binding.js +279 -0
- package/dist/core/code/engine/core/ingestion/languages/go.js +160 -0
- package/dist/core/code/engine/core/ingestion/languages/index.js +66 -0
- package/dist/core/code/engine/core/ingestion/languages/java/analysis-features.js +16 -0
- package/dist/core/code/engine/core/ingestion/languages/java/arity-metadata.js +43 -0
- package/dist/core/code/engine/core/ingestion/languages/java/arity.js +27 -0
- package/dist/core/code/engine/core/ingestion/languages/java/cache-stats.js +32 -0
- package/dist/core/code/engine/core/ingestion/languages/java/capture-side-channel.js +123 -0
- package/dist/core/code/engine/core/ingestion/languages/java/captures.js +791 -0
- package/dist/core/code/engine/core/ingestion/languages/java/import-decomposer.js +88 -0
- package/dist/core/code/engine/core/ingestion/languages/java/import-target.js +103 -0
- package/dist/core/code/engine/core/ingestion/languages/java/index.js +43 -0
- package/dist/core/code/engine/core/ingestion/languages/java/interpret.js +146 -0
- package/dist/core/code/engine/core/ingestion/languages/java/merge-bindings.js +43 -0
- package/dist/core/code/engine/core/ingestion/languages/java/package-facts.js +16 -0
- package/dist/core/code/engine/core/ingestion/languages/java/package-siblings.js +11 -0
- package/dist/core/code/engine/core/ingestion/languages/java/query.js +319 -0
- package/dist/core/code/engine/core/ingestion/languages/java/receiver-binding.js +98 -0
- package/dist/core/code/engine/core/ingestion/languages/java/scope-resolver.js +213 -0
- package/dist/core/code/engine/core/ingestion/languages/java/simple-hooks.js +39 -0
- package/dist/core/code/engine/core/ingestion/languages/java/spring-aop.js +53 -0
- package/dist/core/code/engine/core/ingestion/languages/java/spring-bean-metadata.js +11 -0
- package/dist/core/code/engine/core/ingestion/languages/java/spring-conditionals.js +52 -0
- package/dist/core/code/engine/core/ingestion/languages/java/spring-config-bindings.js +222 -0
- package/dist/core/code/engine/core/ingestion/languages/java/spring-di.js +165 -0
- package/dist/core/code/engine/core/ingestion/languages/java.js +192 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/arity.js +15 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/captures.js +1122 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/import-target.js +56 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/index.js +109 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/interpret.js +45 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/merge-bindings.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/query.js +659 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/scope-resolver.js +78 -0
- package/dist/core/code/engine/core/ingestion/languages/javascript/simple-hooks.js +44 -0
- package/dist/core/code/engine/core/ingestion/languages/jvm/package-facts.js +46 -0
- package/dist/core/code/engine/core/ingestion/languages/jvm/package-siblings.js +200 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/arity-metadata.js +23 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/arity.js +18 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/cache-stats.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/capture-side-channel.js +160 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/captures.js +1262 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/companion-scopes.js +72 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/import-decomposer.js +40 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/import-target.js +135 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/index.js +26 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/interpret.js +75 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/merge-bindings.js +28 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/owners.js +134 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/package-facts.js +16 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/package-siblings.js +11 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/query.js +243 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/receiver-binding.js +103 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/scope-resolver.js +207 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/simple-hooks.js +42 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-aop.js +68 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-bean-metadata.js +11 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-conditionals.js +53 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin/spring-di.js +304 -0
- package/dist/core/code/engine/core/ingestion/languages/kotlin.js +189 -0
- package/dist/core/code/engine/core/ingestion/languages/php/arity-metadata.js +66 -0
- package/dist/core/code/engine/core/ingestion/languages/php/arity.js +43 -0
- package/dist/core/code/engine/core/ingestion/languages/php/cache-stats.js +32 -0
- package/dist/core/code/engine/core/ingestion/languages/php/captures.js +1166 -0
- package/dist/core/code/engine/core/ingestion/languages/php/import-decomposer.js +238 -0
- package/dist/core/code/engine/core/ingestion/languages/php/import-target.js +213 -0
- package/dist/core/code/engine/core/ingestion/languages/php/index.js +85 -0
- package/dist/core/code/engine/core/ingestion/languages/php/interpret.js +256 -0
- package/dist/core/code/engine/core/ingestion/languages/php/merge-bindings.js +50 -0
- package/dist/core/code/engine/core/ingestion/languages/php/namespace-siblings.js +353 -0
- package/dist/core/code/engine/core/ingestion/languages/php/query.js +391 -0
- package/dist/core/code/engine/core/ingestion/languages/php/receiver-binding.js +135 -0
- package/dist/core/code/engine/core/ingestion/languages/php/scope-resolver.js +361 -0
- package/dist/core/code/engine/core/ingestion/languages/php/simple-hooks.js +116 -0
- package/dist/core/code/engine/core/ingestion/languages/php.js +302 -0
- package/dist/core/code/engine/core/ingestion/languages/python/arity-metadata.js +49 -0
- package/dist/core/code/engine/core/ingestion/languages/python/arity.js +41 -0
- package/dist/core/code/engine/core/ingestion/languages/python/cache-stats.js +34 -0
- package/dist/core/code/engine/core/ingestion/languages/python/captures.js +299 -0
- package/dist/core/code/engine/core/ingestion/languages/python/depends-references.js +68 -0
- package/dist/core/code/engine/core/ingestion/languages/python/import-decomposer.js +115 -0
- package/dist/core/code/engine/core/ingestion/languages/python/import-target.js +440 -0
- package/dist/core/code/engine/core/ingestion/languages/python/index-stats.js +30 -0
- package/dist/core/code/engine/core/ingestion/languages/python/index.js +96 -0
- package/dist/core/code/engine/core/ingestion/languages/python/interpret.js +430 -0
- package/dist/core/code/engine/core/ingestion/languages/python/merge-bindings.js +47 -0
- package/dist/core/code/engine/core/ingestion/languages/python/query.js +323 -0
- package/dist/core/code/engine/core/ingestion/languages/python/receiver-binding.js +310 -0
- package/dist/core/code/engine/core/ingestion/languages/python/scope-resolver.js +80 -0
- package/dist/core/code/engine/core/ingestion/languages/python/simple-hooks.js +53 -0
- package/dist/core/code/engine/core/ingestion/languages/python.js +140 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/arity.js +41 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/cache-stats.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/captures.js +864 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/import-target.js +88 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/index.js +29 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/interpret.js +115 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/merge-bindings.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/query.js +349 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/receiver-binding.js +70 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/scope-resolver.js +263 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby/simple-hooks.js +68 -0
- package/dist/core/code/engine/core/ingestion/languages/ruby.js +215 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/arity.js +16 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/cache-stats.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/captures.js +304 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/import-decomposer.js +167 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/import-target.js +108 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/index.js +29 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/interpret.js +201 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/merge-bindings.js +21 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/method-owners.js +76 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/module-path.js +222 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/qualified-call.js +482 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/query.js +280 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/range-binding.js +687 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/receiver-binding.js +148 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/scope-resolver.js +151 -0
- package/dist/core/code/engine/core/ingestion/languages/rust/simple-hooks.js +32 -0
- package/dist/core/code/engine/core/ingestion/languages/rust.js +183 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/arity-metadata.js +44 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/arity.js +45 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/base-type.js +30 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/cache-stats.js +32 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/captures.js +594 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/conditional-directive-preprocess.js +256 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/implicit-imports.js +60 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/import-decomposer.js +87 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/import-target.js +84 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/index.js +56 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/interpret.js +93 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/merge-bindings.js +51 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/query.js +226 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/receiver-binding.js +169 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/scope-resolver.js +192 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/sibling-type-bindings.js +68 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/signature-bindings.js +69 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/simple-hooks.js +65 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/target-grouping.js +97 -0
- package/dist/core/code/engine/core/ingestion/languages/swift/target-siblings.js +74 -0
- package/dist/core/code/engine/core/ingestion/languages/swift.js +246 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/arity-metadata.js +106 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/arity.js +57 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/array-callback.js +58 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/cache-stats.js +34 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/captures.js +956 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/cjs-export-assignment.js +535 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/cjs-module-exports.js +196 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/import-decomposer.js +374 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/import-target.js +65 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/index.js +108 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/interpret.js +344 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/merge-bindings.js +161 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/nuxt-auto-imports.js +325 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/query.js +1328 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/receiver-binding.js +201 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/scope-resolver.js +293 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript/simple-hooks.js +139 -0
- package/dist/core/code/engine/core/ingestion/languages/typescript.js +455 -0
- package/dist/core/code/engine/core/ingestion/languages/vue/captures.js +70 -0
- package/dist/core/code/engine/core/ingestion/languages/vue/import-target.js +61 -0
- package/dist/core/code/engine/core/ingestion/languages/vue/index.js +55 -0
- package/dist/core/code/engine/core/ingestion/languages/vue/scope-resolver.js +295 -0
- package/dist/core/code/engine/core/ingestion/languages/vue.js +96 -0
- package/dist/core/code/engine/core/ingestion/local-symbol-pruner.js +68 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/c-cpp.js +387 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/csharp.js +290 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/dart.js +392 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/go.js +179 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/jvm.js +350 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/php.js +306 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/python.js +312 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/ruby.js +289 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/rust.js +198 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/swift.js +286 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/configs/typescript-javascript.js +341 -0
- package/dist/core/code/engine/core/ingestion/method-extractors/generic.js +209 -0
- package/dist/core/code/engine/core/ingestion/method-types.js +3 -0
- package/dist/core/code/engine/core/ingestion/model/field-registry.js +41 -0
- package/dist/core/code/engine/core/ingestion/model/index.js +52 -0
- package/dist/core/code/engine/core/ingestion/model/method-registry.js +138 -0
- package/dist/core/code/engine/core/ingestion/model/owned-members-lookup.js +46 -0
- package/dist/core/code/engine/core/ingestion/model/registration-table.js +234 -0
- package/dist/core/code/engine/core/ingestion/model/resolve.js +183 -0
- package/dist/core/code/engine/core/ingestion/model/scope-resolution-indexes.js +43 -0
- package/dist/core/code/engine/core/ingestion/model/semantic-model.js +179 -0
- package/dist/core/code/engine/core/ingestion/model/symbol-table.js +216 -0
- package/dist/core/code/engine/core/ingestion/model/type-registry.js +84 -0
- package/dist/core/code/engine/core/ingestion/mro-processor.js +709 -0
- package/dist/core/code/engine/core/ingestion/parsing-processor.js +312 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/communities.js +69 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/cross-file.js +71 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/di.js +338 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/http-api-calls.js +312 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/index.js +54 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/mro.js +40 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/orm.js +78 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/parse-impl.js +1286 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/parse.js +41 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/processes.js +193 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/prune-local-symbols.js +29 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/registry.js +52 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/routes.js +409 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/rpc-edges.js +301 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/runner.js +207 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/scan.js +49 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/spring-aop.js +442 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/spring-auto-configuration.js +264 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/spring-config.js +440 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/structure.js +38 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/tools.js +89 -0
- package/dist/core/code/engine/core/ingestion/pipeline-phases/types.js +40 -0
- package/dist/core/code/engine/core/ingestion/pipeline.js +152 -0
- package/dist/core/code/engine/core/ingestion/process-processor.js +325 -0
- package/dist/core/code/engine/core/ingestion/resolve-references.js +205 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/constant-resolver.js +135 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/django-root-discovery.js +221 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/django.js +428 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/expo.js +39 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/fastapi-router-bindings.js +264 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/laravel.js +501 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/middleware.js +175 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/nextjs.js +81 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/php.js +25 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/python-const-resolver.js +307 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/response-shapes.js +299 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/route-path.js +71 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/spring-shared.js +310 -0
- package/dist/core/code/engine/core/ingestion/route-extractors/spring.js +441 -0
- package/dist/core/code/engine/core/ingestion/scope-extractor-bridge.js +60 -0
- package/dist/core/code/engine/core/ingestion/scope-extractor.js +1373 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/contract/scope-resolver.js +282 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/callee-id-sink.js +72 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/edges.js +194 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/ids.js +472 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.js +49 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/method-dispatch.js +43 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +274 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +93 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/callable-value-flow.js +1240 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/compound-receiver.js +1174 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/free-call-fallback.js +873 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/imported-return-types.js +226 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/mro.js +107 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/overload-narrowing.js +441 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/property-dispatch.js +122 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1720 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/phase.js +395 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/reconcile-ownership.js +208 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/registry.js +49 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/run.js +632 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +112 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/resolution-outcome.js +41 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/scope/namespace-targets.js +81 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/scope/walkers.js +1835 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/unresolved-receivers.js +242 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/utils/definition-id.js +22 -0
- package/dist/core/code/engine/core/ingestion/scope-resolution/workspace-index.js +151 -0
- package/dist/core/code/engine/core/ingestion/structure-processor.js +40 -0
- package/dist/core/code/engine/core/ingestion/tree-sitter-queries.js +2244 -0
- package/dist/core/code/engine/core/ingestion/ts-js-hoc-utils.js +115 -0
- package/dist/core/code/engine/core/ingestion/type-env.js +1136 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/c-cpp.js +555 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/csharp.js +570 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/dart.js +372 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/go.js +508 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/jvm.js +875 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/php.js +537 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/python.js +477 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/ruby.js +380 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/rust.js +502 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/shared.js +843 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/swift.js +490 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/types.js +2 -0
- package/dist/core/code/engine/core/ingestion/type-extractors/typescript.js +690 -0
- package/dist/core/code/engine/core/ingestion/utils/ast-helpers.js +1693 -0
- package/dist/core/code/engine/core/ingestion/utils/call-analysis.js +779 -0
- package/dist/core/code/engine/core/ingestion/utils/callable-flow-captures.js +932 -0
- package/dist/core/code/engine/core/ingestion/utils/callable-labels.js +49 -0
- package/dist/core/code/engine/core/ingestion/utils/deferred-resolution-profile.js +151 -0
- package/dist/core/code/engine/core/ingestion/utils/effective-ram.js +67 -0
- package/dist/core/code/engine/core/ingestion/utils/env.js +60 -0
- package/dist/core/code/engine/core/ingestion/utils/event-loop.js +9 -0
- package/dist/core/code/engine/core/ingestion/utils/graph-sort.js +103 -0
- package/dist/core/code/engine/core/ingestion/utils/heap-probe.js +45 -0
- package/dist/core/code/engine/core/ingestion/utils/heritage-marker.js +47 -0
- package/dist/core/code/engine/core/ingestion/utils/line-base.js +24 -0
- package/dist/core/code/engine/core/ingestion/utils/max-file-size.js +59 -0
- package/dist/core/code/engine/core/ingestion/utils/method-props.js +198 -0
- package/dist/core/code/engine/core/ingestion/utils/qualified-name.js +73 -0
- package/dist/core/code/engine/core/ingestion/utils/receiver-chain-captures.js +60 -0
- package/dist/core/code/engine/core/ingestion/utils/receiver-chain-codec.js +188 -0
- package/dist/core/code/engine/core/ingestion/utils/scope-tree-walk.js +36 -0
- package/dist/core/code/engine/core/ingestion/utils/symbol-labels.js +48 -0
- package/dist/core/code/engine/core/ingestion/utils/template-arguments.js +187 -0
- package/dist/core/code/engine/core/ingestion/utils/type-parameters.js +209 -0
- package/dist/core/code/engine/core/ingestion/utils/verbose.js +6 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/c-cpp.js +133 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/csharp.js +66 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/dart.js +111 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/go.js +153 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/jvm.js +145 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/php.js +61 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/python.js +104 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/ruby.js +55 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/rust.js +79 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/swift.js +91 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/configs/typescript-javascript.js +86 -0
- package/dist/core/code/engine/core/ingestion/variable-extractors/generic.js +111 -0
- package/dist/core/code/engine/core/ingestion/variable-types.js +3 -0
- package/dist/core/code/engine/core/ingestion/vue-sfc-extractor.js +544 -0
- package/dist/core/code/engine/core/ingestion/workers/callable-id.js +122 -0
- package/dist/core/code/engine/core/ingestion/workers/clone-safety.js +470 -0
- package/dist/core/code/engine/core/ingestion/workers/parse-worker.js +2456 -0
- package/dist/core/code/engine/core/ingestion/workers/post-result.js +90 -0
- package/dist/core/code/engine/core/ingestion/workers/quarantine.js +41 -0
- package/dist/core/code/engine/core/ingestion/workers/result-merge.js +59 -0
- package/dist/core/code/engine/core/ingestion/workers/worker-pool.js +1725 -0
- package/dist/core/code/engine/core/ingestion/workspace-config.js +139 -0
- package/dist/core/code/engine/core/lbug/conn-lock.js +72 -0
- package/dist/core/code/engine/core/lbug/csv-generator.js +710 -0
- package/dist/core/code/engine/core/lbug/cypher-escape.js +24 -0
- package/dist/core/code/engine/core/lbug/extension-load-error.js +339 -0
- package/dist/core/code/engine/core/lbug/extension-loader.js +261 -0
- package/dist/core/code/engine/core/lbug/graph-emit-sink.js +584 -0
- package/dist/core/code/engine/core/lbug/lbug-adapter.js +2703 -0
- package/dist/core/code/engine/core/lbug/lbug-config.js +1029 -0
- package/dist/core/code/engine/core/lbug/native-check.js +435 -0
- package/dist/core/code/engine/core/lbug/pool-adapter.js +973 -0
- package/dist/core/code/engine/core/lbug/query-params.js +25 -0
- package/dist/core/code/engine/core/lbug/query-result-utils.js +31 -0
- package/dist/core/code/engine/core/lbug/rel-pair-routing.js +373 -0
- package/dist/core/code/engine/core/lbug/schema.js +771 -0
- package/dist/core/code/engine/core/lbug/shutdown-helpers.js +40 -0
- package/dist/core/code/engine/core/lbug/sidecar-recovery.js +716 -0
- package/dist/core/code/engine/core/lbug/stdio-capture.js +49 -0
- package/dist/core/code/engine/core/lbug/sync-csv-writer.js +115 -0
- package/dist/core/code/engine/core/lbug/wal-checkpoint-driver.js +215 -0
- package/dist/core/code/engine/core/lbug/wal-driver-state.js +28 -0
- package/dist/core/code/engine/core/logger.js +339 -0
- package/dist/core/code/engine/core/platform/capabilities.js +91 -0
- package/dist/core/code/engine/core/run-analyze.js +1098 -0
- package/dist/core/code/engine/core/tree-sitter/parser-loader.js +281 -0
- package/dist/core/code/engine/core/tree-sitter/safe-parse.js +258 -0
- package/dist/core/code/engine/core/tree-sitter/vendored-grammars.js +64 -0
- package/dist/core/code/engine/lib/utils.js +121 -0
- package/dist/core/code/engine/mcp/core/lbug-adapter.js +27 -0
- package/dist/core/code/engine/mcp/local/aop-metadata.js +230 -0
- package/dist/core/code/engine/mcp/local/bean-metadata.js +49 -0
- package/dist/core/code/engine/mcp/local/limits.js +15 -0
- package/dist/core/code/engine/mcp/local/line-display.js +6 -0
- package/dist/core/code/engine/mcp/local/local-backend.js +4142 -0
- package/dist/core/code/engine/storage/branch-index.js +72 -0
- package/dist/core/code/engine/storage/file-hash.js +95 -0
- package/dist/core/code/engine/storage/fs-atomic.js +34 -0
- package/dist/core/code/engine/storage/git.js +555 -0
- package/dist/core/code/engine/storage/index-lock.js +664 -0
- package/dist/core/code/engine/storage/parse-cache.js +650 -0
- package/dist/core/code/engine/storage/parsedfile-store.js +620 -0
- package/dist/core/code/engine/storage/repo-manager.js +1061 -0
- package/dist/core/code/engine/storage/scope-index-store.js +247 -0
- package/dist/core/code/engine/types/pipeline.js +2 -0
- package/dist/core/code/scripts/install-duckdb-extension.mjs +125 -0
- package/dist/core/code/scripts/resolve-analyze-cmd.cjs +346 -0
- package/dist/core/code/shared/graph/types.js +8 -0
- package/dist/core/code/shared/index.js +105 -0
- package/dist/core/code/shared/integrations/circuit-breaker.js +242 -0
- package/dist/core/code/shared/integrations/resilient-fetch.js +224 -0
- package/dist/core/code/shared/integrations/retry.js +70 -0
- package/dist/core/code/shared/integrations/understand-quickly.js +145 -0
- package/dist/core/code/shared/language-detection.js +162 -0
- package/dist/core/code/shared/languages.js +27 -0
- package/dist/core/code/shared/lbug/schema-constants.js +98 -0
- package/dist/core/code/shared/mro-strategy.js +2 -0
- package/dist/core/code/shared/pipeline.js +5 -0
- package/dist/core/code/shared/scope-resolution/callable-flow-site.js +11 -0
- package/dist/core/code/shared/scope-resolution/def-index.js +53 -0
- package/dist/core/code/shared/scope-resolution/evidence-weights.js +87 -0
- package/dist/core/code/shared/scope-resolution/finalize-algorithm.js +807 -0
- package/dist/core/code/shared/scope-resolution/language-classification.js +46 -0
- package/dist/core/code/shared/scope-resolution/method-dispatch-index.js +100 -0
- package/dist/core/code/shared/scope-resolution/module-scope-index.js +59 -0
- package/dist/core/code/shared/scope-resolution/origin-priority.js +23 -0
- package/dist/core/code/shared/scope-resolution/parsed-file.js +54 -0
- package/dist/core/code/shared/scope-resolution/position-index.js +136 -0
- package/dist/core/code/shared/scope-resolution/qualified-name-index.js +77 -0
- package/dist/core/code/shared/scope-resolution/reference-site.js +24 -0
- package/dist/core/code/shared/scope-resolution/registries/class-registry.js +32 -0
- package/dist/core/code/shared/scope-resolution/registries/context.js +52 -0
- package/dist/core/code/shared/scope-resolution/registries/evidence.js +152 -0
- package/dist/core/code/shared/scope-resolution/registries/field-registry.js +33 -0
- package/dist/core/code/shared/scope-resolution/registries/lookup-core.js +392 -0
- package/dist/core/code/shared/scope-resolution/registries/lookup-qualified.js +58 -0
- package/dist/core/code/shared/scope-resolution/registries/macro-registry.js +34 -0
- package/dist/core/code/shared/scope-resolution/registries/method-registry.js +34 -0
- package/dist/core/code/shared/scope-resolution/registries/tie-breaks.js +63 -0
- package/dist/core/code/shared/scope-resolution/resolve-type-ref.js +128 -0
- package/dist/core/code/shared/scope-resolution/scope-id.js +49 -0
- package/dist/core/code/shared/scope-resolution/scope-tree.js +225 -0
- package/dist/core/code/shared/scope-resolution/symbol-definition.js +12 -0
- package/dist/core/code/shared/scope-resolution/types.js +25 -0
- package/dist/core/code/shared/test-helpers.js +17 -0
- package/dist/core/code/vendor/leiden/index.cjs +355 -0
- package/dist/core/code/vendor/leiden/utils.cjs +419 -0
- package/dist/core/features/scanner.d.ts +2 -0
- package/dist/core/features/scanner.d.ts.map +1 -1
- package/dist/core/features/scanner.js +27 -6
- package/dist/core/features/scanner.js.map +1 -1
- package/dist/core/timeline/cli.d.ts.map +1 -1
- package/dist/core/timeline/cli.js +13 -6
- package/dist/core/timeline/cli.js.map +1 -1
- package/dist/core/timeline/debris.d.ts +20 -0
- package/dist/core/timeline/debris.d.ts.map +1 -0
- package/dist/core/timeline/debris.js +124 -0
- package/dist/core/timeline/debris.js.map +1 -0
- package/dist/core/timeline/hook-runner.d.ts.map +1 -1
- package/dist/core/timeline/hook-runner.js +3 -1
- package/dist/core/timeline/hook-runner.js.map +1 -1
- package/dist/core/timeline/hooks.d.ts.map +1 -1
- package/dist/core/timeline/hooks.js +13 -5
- package/dist/core/timeline/hooks.js.map +1 -1
- package/dist/core/timeline/installer.d.ts +2 -0
- package/dist/core/timeline/installer.d.ts.map +1 -1
- package/dist/core/timeline/installer.js +12 -0
- package/dist/core/timeline/installer.js.map +1 -1
- package/dist/core/timeline/project-root.d.ts +21 -0
- package/dist/core/timeline/project-root.d.ts.map +1 -0
- package/dist/core/timeline/project-root.js +83 -0
- package/dist/core/timeline/project-root.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capture-match → semantic-shape interpreters for PHP.
|
|
4
|
+
*
|
|
5
|
+
* - `interpretPhpImport` → `ParsedImport`
|
|
6
|
+
* - `interpretPhpTypeBinding` → `ParsedTypeBinding`
|
|
7
|
+
*
|
|
8
|
+
* Import matches arrive pre-decomposed by `emitPhpScopeCaptures` (one
|
|
9
|
+
* CaptureMatch per logical import, with synthesized `@import.kind /
|
|
10
|
+
* source / name / alias` markers). Type-binding matches arrive from
|
|
11
|
+
* the raw query captures — each `@type-binding.*` anchor carries
|
|
12
|
+
* `@type-binding.name` + `@type-binding.type`.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.interpretPhpImport = interpretPhpImport;
|
|
16
|
+
exports.interpretPhpTypeBinding = interpretPhpTypeBinding;
|
|
17
|
+
exports.normalizePhpType = normalizePhpType;
|
|
18
|
+
// ─── interpretImport ──────────────────────────────────────────────────────
|
|
19
|
+
function interpretPhpImport(captures) {
|
|
20
|
+
const kindCap = captures['@import.kind'];
|
|
21
|
+
const sourceCap = captures['@import.source'];
|
|
22
|
+
const nameCap = captures['@import.name'];
|
|
23
|
+
const aliasCap = captures['@import.alias'];
|
|
24
|
+
const symbolKindCap = captures['@import.symbol-kind'];
|
|
25
|
+
const kind = kindCap?.text;
|
|
26
|
+
if (kind === undefined || sourceCap === undefined)
|
|
27
|
+
return null;
|
|
28
|
+
const source = sourceCap.text.trim();
|
|
29
|
+
if (source === '')
|
|
30
|
+
return null;
|
|
31
|
+
const importedSymbolKind = symbolKindCap?.text === 'function' || symbolKindCap?.text === 'const'
|
|
32
|
+
? symbolKindCap.text
|
|
33
|
+
: kind === 'function' || kind === 'const'
|
|
34
|
+
? kind
|
|
35
|
+
: 'type';
|
|
36
|
+
switch (kind) {
|
|
37
|
+
case 'namespace': {
|
|
38
|
+
// `use Foo\Bar;` — PHP `use` is a NAMED import (binds the class
|
|
39
|
+
// `Bar`, not the namespace `Foo`). This differs from C# `using`,
|
|
40
|
+
// which is a true namespace import. Producing 'named' here makes
|
|
41
|
+
// `new Bar()` resolve to the imported class def.
|
|
42
|
+
const localName = nameCap?.text.trim() ?? lastSegment(source);
|
|
43
|
+
return {
|
|
44
|
+
kind: 'named',
|
|
45
|
+
localName,
|
|
46
|
+
importedName: localName,
|
|
47
|
+
targetRaw: source,
|
|
48
|
+
importedSymbolKind,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
case 'alias': {
|
|
52
|
+
// `use Foo\Bar as Baz;`
|
|
53
|
+
if (aliasCap === undefined)
|
|
54
|
+
return null;
|
|
55
|
+
const alias = aliasCap.text.trim();
|
|
56
|
+
if (alias === '')
|
|
57
|
+
return null;
|
|
58
|
+
const importedName = lastSegment(source);
|
|
59
|
+
return {
|
|
60
|
+
kind: 'alias',
|
|
61
|
+
localName: alias,
|
|
62
|
+
importedName,
|
|
63
|
+
alias,
|
|
64
|
+
targetRaw: source,
|
|
65
|
+
importedSymbolKind,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
case 'function': {
|
|
69
|
+
// `use function Foo\bar;` — treat as named import; importedName is
|
|
70
|
+
// the function name (last segment). targetRaw is the full path.
|
|
71
|
+
const localName = nameCap?.text.trim() ?? lastSegment(source);
|
|
72
|
+
return {
|
|
73
|
+
kind: 'named',
|
|
74
|
+
localName,
|
|
75
|
+
importedName: localName,
|
|
76
|
+
targetRaw: source,
|
|
77
|
+
importedSymbolKind,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
case 'const': {
|
|
81
|
+
// `use const Foo\BAR;` — same shape as function.
|
|
82
|
+
const localName = nameCap?.text.trim() ?? lastSegment(source);
|
|
83
|
+
return {
|
|
84
|
+
kind: 'named',
|
|
85
|
+
localName,
|
|
86
|
+
importedName: localName,
|
|
87
|
+
targetRaw: source,
|
|
88
|
+
importedSymbolKind,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
default:
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// ─── interpretTypeBinding ─────────────────────────────────────────────────
|
|
96
|
+
function interpretPhpTypeBinding(captures) {
|
|
97
|
+
const nameCap = captures['@type-binding.name'];
|
|
98
|
+
const typeCap = captures['@type-binding.type'];
|
|
99
|
+
if (nameCap === undefined || typeCap === undefined)
|
|
100
|
+
return null;
|
|
101
|
+
// Determine source from anchor captures. Order: most-specific first.
|
|
102
|
+
let source = 'parameter-annotation';
|
|
103
|
+
if (captures['@type-binding.self'] !== undefined)
|
|
104
|
+
source = 'self';
|
|
105
|
+
else if (captures['@type-binding.constructor'] !== undefined)
|
|
106
|
+
source = 'constructor-inferred';
|
|
107
|
+
else if (captures['@type-binding.annotation'] !== undefined)
|
|
108
|
+
source = 'annotation';
|
|
109
|
+
else if (captures['@type-binding.alias'] !== undefined)
|
|
110
|
+
source = 'assignment-inferred';
|
|
111
|
+
else if (captures['@type-binding.return'] !== undefined)
|
|
112
|
+
source = 'return-annotation';
|
|
113
|
+
let rawType;
|
|
114
|
+
if (source === 'assignment-inferred') {
|
|
115
|
+
// `@type-binding.alias` captures cover several assignment RHS shapes:
|
|
116
|
+
// - `$alias = $u` → rawType = '$u' (variable alias)
|
|
117
|
+
// - `$u = getUser()` → rawType = 'getUser' (callable alias)
|
|
118
|
+
// - `$u = new User()` → rawType = 'User' (constructor — via @type-binding.constructor; handled below)
|
|
119
|
+
// - `$role = UserRole::Viewer` → rawType = 'UserRole' (enum/class constant)
|
|
120
|
+
//
|
|
121
|
+
// For variable aliases (`$u`), `normalizePhpType` returns null because
|
|
122
|
+
// `$` is not a word character. We must preserve the raw `$`-prefixed name
|
|
123
|
+
// so `followChainedRef` can walk the chain `$alias → $u → User`.
|
|
124
|
+
// For callable/class names, `normalizePhpType` strips qualifiers correctly.
|
|
125
|
+
const rawText = typeCap.text.trim();
|
|
126
|
+
if (rawText.startsWith('$')) {
|
|
127
|
+
// Variable alias: keep as-is for chain-following.
|
|
128
|
+
rawType = rawText;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
rawType = normalizePhpType(rawText);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// All other sources: strip PHP type decoration to get the simple class name:
|
|
136
|
+
// ?User → User (nullable prefix)
|
|
137
|
+
// User|null → User (union with null/false/void)
|
|
138
|
+
// User&Loggable → User (intersection — take first meaningful)
|
|
139
|
+
// Collection<User> → User (PHPDoc generic wrapper)
|
|
140
|
+
// User[] → User (array suffix)
|
|
141
|
+
// \App\Models\User → User (backslash qualifier)
|
|
142
|
+
rawType = normalizePhpType(typeCap.text.trim());
|
|
143
|
+
}
|
|
144
|
+
if (rawType === null)
|
|
145
|
+
return null;
|
|
146
|
+
// PHP variable names include the `$` sigil (e.g. `$user`). Most
|
|
147
|
+
// bindings keep it because they are looked up via the variable
|
|
148
|
+
// (`$user->method()` finds binding `$user`). Property field bindings
|
|
149
|
+
// are different: `$user->address` looks up `address` (no sigil) on
|
|
150
|
+
// the User class. Property declarations carry source `'annotation'`,
|
|
151
|
+
// so we strip the leading `$` for that source only.
|
|
152
|
+
let boundName = nameCap.text.trim();
|
|
153
|
+
if (source === 'annotation' && boundName.startsWith('$')) {
|
|
154
|
+
boundName = boundName.slice(1);
|
|
155
|
+
}
|
|
156
|
+
return { boundName, rawTypeName: rawType, source };
|
|
157
|
+
}
|
|
158
|
+
// ─── Type normalization ───────────────────────────────────────────────────
|
|
159
|
+
/**
|
|
160
|
+
* Normalize a PHP type string to a simple class identifier, or `null`
|
|
161
|
+
* when the type is uninformative (primitive, void, mixed, self, etc.).
|
|
162
|
+
*
|
|
163
|
+
* Rules applied in order:
|
|
164
|
+
* 1. Strip nullable prefix `?`
|
|
165
|
+
* 2. Split on `|` (union) — keep only if exactly one non-null part
|
|
166
|
+
* 3. Take first part of `&` intersection
|
|
167
|
+
* 4. Strip array suffix `[]`
|
|
168
|
+
* 5. Strip generic wrapper `Collection<User>` → `User`
|
|
169
|
+
* 6. Canonicalize leading backslash off: `\App\Models\User` → `App\Models\User`
|
|
170
|
+
* 7. Reject PHP primitive / pseudo types
|
|
171
|
+
*
|
|
172
|
+
* The qualified form is preserved on `TypeRef.rawName` so downstream PHP
|
|
173
|
+
* receiver resolution can distinguish `\App\Other\User` from a same-simple-name
|
|
174
|
+
* `User` reachable via `use`. Without this, fully-qualified type hints collapse
|
|
175
|
+
* to ambiguous simple names and resolve against the caller's scope chain
|
|
176
|
+
* instead of the explicit target the source named (Codex PR #1497 review,
|
|
177
|
+
* finding 1).
|
|
178
|
+
*/
|
|
179
|
+
function normalizePhpType(raw) {
|
|
180
|
+
// 1. Strip nullable prefix
|
|
181
|
+
let type = raw.startsWith('?') ? raw.slice(1).trim() : raw;
|
|
182
|
+
// 2. Union type — keep only if one non-null/false/void part remains
|
|
183
|
+
if (type.includes('|')) {
|
|
184
|
+
const parts = type
|
|
185
|
+
.split('|')
|
|
186
|
+
.map((p) => p.trim())
|
|
187
|
+
.filter((p) => p !== 'null' && p !== 'false' && p !== 'void' && p !== 'mixed' && p !== '');
|
|
188
|
+
if (parts.length !== 1)
|
|
189
|
+
return null;
|
|
190
|
+
type = parts[0];
|
|
191
|
+
}
|
|
192
|
+
// 3. Intersection type — take the first part
|
|
193
|
+
if (type.includes('&')) {
|
|
194
|
+
const first = type.split('&')[0].trim();
|
|
195
|
+
if (first === '')
|
|
196
|
+
return null;
|
|
197
|
+
type = first;
|
|
198
|
+
}
|
|
199
|
+
// 4. Strip array suffix
|
|
200
|
+
if (type.endsWith('[]'))
|
|
201
|
+
type = type.slice(0, -2).trim();
|
|
202
|
+
// 5. Strip single-arg generic wrapper: Collection<User> → User
|
|
203
|
+
// Qualified inner types (Collection<\App\Models\User>) survive — the
|
|
204
|
+
// capture group preserves whatever the writer named.
|
|
205
|
+
const genericMatch = type.match(/^\w[\w\\]*\s*<([^,<>]+)>$/);
|
|
206
|
+
if (genericMatch) {
|
|
207
|
+
type = genericMatch[1].trim();
|
|
208
|
+
}
|
|
209
|
+
// 6. Canonicalize leading backslash off — keep the qualified path intact.
|
|
210
|
+
// `\App\Models\User` → `App\Models\User`. `App\Models\User` → unchanged.
|
|
211
|
+
// Unqualified `User` stays as `User`. The qualified form is the lookup
|
|
212
|
+
// key into the workspace QualifiedNameIndex (PHP defs are indexed by
|
|
213
|
+
// namespace-joined qualifiedName); the leading-backslash distinction in
|
|
214
|
+
// source is only an "absolute path" anchor, not part of the canonical key.
|
|
215
|
+
if (type.startsWith('\\'))
|
|
216
|
+
type = type.replace(/^\\+/, '');
|
|
217
|
+
// 7. Reject primitives / pseudo-types
|
|
218
|
+
if (isPrimitiveOrPseudo(type))
|
|
219
|
+
return null;
|
|
220
|
+
// Must be a (possibly qualified) PHP identifier — segments of word chars
|
|
221
|
+
// separated by single backslashes. Empty segments (consecutive backslashes,
|
|
222
|
+
// trailing backslash) are rejected.
|
|
223
|
+
if (!/^\w+(?:\\\w+)*$/.test(type))
|
|
224
|
+
return null;
|
|
225
|
+
return type;
|
|
226
|
+
}
|
|
227
|
+
const PHP_PRIMITIVE_TYPES = new Set([
|
|
228
|
+
'int',
|
|
229
|
+
'integer',
|
|
230
|
+
'float',
|
|
231
|
+
'double',
|
|
232
|
+
'string',
|
|
233
|
+
'bool',
|
|
234
|
+
'boolean',
|
|
235
|
+
'array',
|
|
236
|
+
'object',
|
|
237
|
+
'callable',
|
|
238
|
+
'iterable',
|
|
239
|
+
'null',
|
|
240
|
+
'void',
|
|
241
|
+
'never',
|
|
242
|
+
'mixed',
|
|
243
|
+
'false',
|
|
244
|
+
'true',
|
|
245
|
+
'self',
|
|
246
|
+
'static',
|
|
247
|
+
'parent',
|
|
248
|
+
]);
|
|
249
|
+
function isPrimitiveOrPseudo(type) {
|
|
250
|
+
return PHP_PRIMITIVE_TYPES.has(type.toLowerCase());
|
|
251
|
+
}
|
|
252
|
+
/** Last backslash-separated segment: `Foo\Bar\Baz` → `Baz`. */
|
|
253
|
+
function lastSegment(path) {
|
|
254
|
+
const parts = path.split('\\').filter(Boolean);
|
|
255
|
+
return parts[parts.length - 1] ?? path;
|
|
256
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PHP shadowing precedence for the `mergeBindings` hook.
|
|
4
|
+
*
|
|
5
|
+
* Tier ranking (lower wins in shadowing):
|
|
6
|
+
*
|
|
7
|
+
* - 0: `local` — a class member, method, local variable, or parameter
|
|
8
|
+
* declared in this scope.
|
|
9
|
+
* - 1: `import` / `namespace` / `reexport` — `use Foo\Bar;`,
|
|
10
|
+
* `use Foo\Bar as Baz;`, `use function`, `use const`.
|
|
11
|
+
* All use-statement flavors that introduce a name sit at this tier.
|
|
12
|
+
* - 2: `wildcard` — grouped uses / wildcard imports (deferred; mapped
|
|
13
|
+
* here for completeness).
|
|
14
|
+
*
|
|
15
|
+
* Within a surviving tier we de-dup by `DefId`, last-write-wins so a
|
|
16
|
+
* `use` re-declared further down the file cleanly replaces the earlier
|
|
17
|
+
* binding.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.phpMergeBindings = phpMergeBindings;
|
|
21
|
+
const TIER_LOCAL = 0;
|
|
22
|
+
const TIER_IMPORT = 1;
|
|
23
|
+
const TIER_WILDCARD = 2;
|
|
24
|
+
const TIER_UNKNOWN = 3;
|
|
25
|
+
function tierOf(b) {
|
|
26
|
+
switch (b.origin) {
|
|
27
|
+
case 'local':
|
|
28
|
+
return TIER_LOCAL;
|
|
29
|
+
case 'reexport':
|
|
30
|
+
case 'import':
|
|
31
|
+
case 'namespace':
|
|
32
|
+
return TIER_IMPORT;
|
|
33
|
+
case 'wildcard':
|
|
34
|
+
return TIER_WILDCARD;
|
|
35
|
+
default:
|
|
36
|
+
return TIER_UNKNOWN;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function phpMergeBindings(bindings) {
|
|
40
|
+
if (bindings.length === 0)
|
|
41
|
+
return bindings;
|
|
42
|
+
let bestTier = Number.POSITIVE_INFINITY;
|
|
43
|
+
for (const b of bindings)
|
|
44
|
+
bestTier = Math.min(bestTier, tierOf(b));
|
|
45
|
+
const survivors = bindings.filter((b) => tierOf(b) === bestTier);
|
|
46
|
+
const seen = new Map();
|
|
47
|
+
for (const b of survivors)
|
|
48
|
+
seen.set(b.def.nodeId, b);
|
|
49
|
+
return [...seen.values()];
|
|
50
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PHP same-namespace cross-file visibility.
|
|
4
|
+
*
|
|
5
|
+
* In PHP, every class declared in `namespace Foo\Bar` is visible to all
|
|
6
|
+
* other files in the same namespace WITHOUT an explicit `use` statement.
|
|
7
|
+
* Without this pass, `Service.php` (namespace `App\Services`) can't see
|
|
8
|
+
* `User` declared in `Models.php` (namespace `App\Models`) unless
|
|
9
|
+
* `UserService.php` has an explicit `use App\Models\User` statement.
|
|
10
|
+
*
|
|
11
|
+
* More importantly, A.php (namespace `App\Models`) can return `Greeting`
|
|
12
|
+
* (same namespace `App\Models`) without importing it, and the compound-
|
|
13
|
+
* receiver resolver needs to find `Greeting` as a class binding in the
|
|
14
|
+
* scope chain.
|
|
15
|
+
*
|
|
16
|
+
* Implementation mirrors C#'s `namespace-siblings.ts`:
|
|
17
|
+
* 1. Extract the declared namespace from each PHP file's source.
|
|
18
|
+
* 2. Group class-like defs by namespace.
|
|
19
|
+
* 3. Inject sibling class defs into each file's Module scope's
|
|
20
|
+
* `bindingAugmentations` with `origin: 'namespace'`.
|
|
21
|
+
* 4. Also mirror return-type bindings from same-namespace siblings
|
|
22
|
+
* so cross-file chain-follow finds return types without explicit imports.
|
|
23
|
+
*
|
|
24
|
+
* Uses the PHP tree-sitter parser (via the lazy singleton in `query.ts`)
|
|
25
|
+
* to extract namespace declarations — same AST that `extractParsedFile`
|
|
26
|
+
* already parsed, reused via `treeCache` to avoid double-parsing.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.extractNamespaceViaScanner = extractNamespaceViaScanner;
|
|
30
|
+
exports.extractPhpFileStructure = extractPhpFileStructure;
|
|
31
|
+
exports.getPhpNamespaceForFile = getPhpNamespaceForFile;
|
|
32
|
+
exports.populatePhpNamespaceSiblings = populatePhpNamespaceSiblings;
|
|
33
|
+
const NAMESPACE_RE = /^\s*namespace\s+([\w\\]+)\s*[;{]/i;
|
|
34
|
+
const HEREDOC_START_RE = /<<<\s*['"]?(\w+)['"]?\s*$/;
|
|
35
|
+
/**
|
|
36
|
+
* Extract a PHP namespace declaration from raw source without tree-sitter.
|
|
37
|
+
*
|
|
38
|
+
* Single-pass line scanner that skips heredoc/nowdoc bodies, block
|
|
39
|
+
* comments, and single-line comments before matching. This avoids the
|
|
40
|
+
* false positives that a multiline regex produces when `namespace` appears
|
|
41
|
+
* inside a heredoc, nowdoc, string, or comment.
|
|
42
|
+
*/
|
|
43
|
+
function extractNamespaceViaScanner(content) {
|
|
44
|
+
const lines = content.split('\n');
|
|
45
|
+
let inBlockComment = false;
|
|
46
|
+
let heredocDelimiter = null;
|
|
47
|
+
for (const raw of lines) {
|
|
48
|
+
if (heredocDelimiter !== null) {
|
|
49
|
+
const trimmed = raw.trim();
|
|
50
|
+
if (trimmed === heredocDelimiter + ';' || trimmed === heredocDelimiter) {
|
|
51
|
+
heredocDelimiter = null;
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (inBlockComment) {
|
|
56
|
+
if (raw.includes('*/')) {
|
|
57
|
+
inBlockComment = false;
|
|
58
|
+
}
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
let line = raw;
|
|
62
|
+
const blockStart = line.indexOf('/*');
|
|
63
|
+
if (blockStart >= 0) {
|
|
64
|
+
const blockEnd = line.indexOf('*/', blockStart + 2);
|
|
65
|
+
if (blockEnd >= 0) {
|
|
66
|
+
line = line.slice(0, blockStart) + line.slice(blockEnd + 2);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
line = line.slice(0, blockStart);
|
|
70
|
+
inBlockComment = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const slashIdx = line.indexOf('//');
|
|
74
|
+
const hashIdx = line.indexOf('#');
|
|
75
|
+
if (slashIdx >= 0 && (hashIdx < 0 || slashIdx < hashIdx)) {
|
|
76
|
+
line = line.slice(0, slashIdx);
|
|
77
|
+
}
|
|
78
|
+
else if (hashIdx >= 0) {
|
|
79
|
+
line = line.slice(0, hashIdx);
|
|
80
|
+
}
|
|
81
|
+
const heredocMatch = raw.match(HEREDOC_START_RE);
|
|
82
|
+
if (heredocMatch) {
|
|
83
|
+
heredocDelimiter = heredocMatch[1];
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const stripped = line.replace(/<\?php/gi, '').replace(/declare\s*\([^)]*\)\s*;?/gi, '');
|
|
87
|
+
const nsMatch = stripped.match(NAMESPACE_RE);
|
|
88
|
+
if (nsMatch) {
|
|
89
|
+
return nsMatch[1];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return '';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Extract the declared namespace from a PHP file's source.
|
|
96
|
+
* Uses the cached AST tree when available to avoid re-parsing.
|
|
97
|
+
*
|
|
98
|
+
* When no cached tree is available (worker-parsed files can't transfer
|
|
99
|
+
* native Tree objects across MessageChannels), uses a line scanner
|
|
100
|
+
* instead of re-parsing every file with tree-sitter. For 16K+ PHP files
|
|
101
|
+
* this eliminates ~16K tree-sitter re-parses during the namespace-siblings
|
|
102
|
+
* pass. See: https://github.com/abhigyanpatwari/GitNexus/issues/1741
|
|
103
|
+
*/
|
|
104
|
+
function extractPhpFileStructure(content, cachedTree) {
|
|
105
|
+
if (!cachedTree) {
|
|
106
|
+
return { namespace: extractNamespaceViaScanner(content) };
|
|
107
|
+
}
|
|
108
|
+
// Walk top-level nodes looking for namespace_definition.
|
|
109
|
+
// PHP files have at most one namespace declaration (PSR-4 convention).
|
|
110
|
+
// `namespace_definition` has a `name:` field of type `namespace_name`.
|
|
111
|
+
const root = cachedTree.rootNode;
|
|
112
|
+
for (let i = 0; i < root.namedChildCount; i++) {
|
|
113
|
+
const child = root.namedChild(i);
|
|
114
|
+
if (child === null)
|
|
115
|
+
continue;
|
|
116
|
+
if (child.type === 'namespace_definition') {
|
|
117
|
+
const nameNode = child.childForFieldName('name');
|
|
118
|
+
if (nameNode !== null) {
|
|
119
|
+
return { namespace: nameNode.text };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { namespace: '' };
|
|
124
|
+
}
|
|
125
|
+
// ─── Augmentation bucket helper ─────────────────────────────────────────────
|
|
126
|
+
function getAugmentationBucket(augmentations, scopeId, name) {
|
|
127
|
+
let scopeBindings = augmentations.get(scopeId);
|
|
128
|
+
if (scopeBindings === undefined) {
|
|
129
|
+
scopeBindings = new Map();
|
|
130
|
+
augmentations.set(scopeId, scopeBindings);
|
|
131
|
+
}
|
|
132
|
+
let bucket = scopeBindings.get(name);
|
|
133
|
+
if (bucket === undefined) {
|
|
134
|
+
bucket = [];
|
|
135
|
+
scopeBindings.set(name, bucket);
|
|
136
|
+
}
|
|
137
|
+
return bucket;
|
|
138
|
+
}
|
|
139
|
+
function isClassLikeDef(def) {
|
|
140
|
+
return (def.type === 'Class' ||
|
|
141
|
+
def.type === 'Interface' ||
|
|
142
|
+
def.type === 'Struct' ||
|
|
143
|
+
def.type === 'Enum' ||
|
|
144
|
+
def.type === 'Trait');
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Side-channel cache populated by `populatePhpNamespaceSiblings` so that
|
|
148
|
+
* later visibility-check hooks (e.g., `isCallableVisibleFromCaller`) can
|
|
149
|
+
* look up a file's PHP namespace without re-parsing. Cleared at the start
|
|
150
|
+
* of every populate run so stale entries don't leak across resolutions.
|
|
151
|
+
*/
|
|
152
|
+
const namespaceByFilePath = new Map();
|
|
153
|
+
/**
|
|
154
|
+
* Read the cached PHP namespace for a given filePath. Returns `''` (global)
|
|
155
|
+
* when the file has no namespace_definition or hasn't been processed yet.
|
|
156
|
+
* Callers should only consult this AFTER either `populatePhpClassQualifiedNames`
|
|
157
|
+
* or `populatePhpNamespaceSiblings` has run for the current resolution.
|
|
158
|
+
*/
|
|
159
|
+
function getPhpNamespaceForFile(filePath) {
|
|
160
|
+
return namespaceByFilePath.get(filePath) ?? '';
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Inject same-namespace class defs and return-type bindings into each
|
|
164
|
+
* PHP file's Module scope's `bindingAugmentations`. This makes classes
|
|
165
|
+
* in the same PHP namespace visible to each other without explicit `use`
|
|
166
|
+
* statements, mirroring PHP's actual runtime behavior.
|
|
167
|
+
*
|
|
168
|
+
* Uses `origin: 'namespace'` so `phpMergeBindings` tiers it below
|
|
169
|
+
* explicit `use` imports (`origin: 'import'`) and local declarations.
|
|
170
|
+
*/
|
|
171
|
+
function populatePhpNamespaceSiblings(parsedFiles, indexes, inputs) {
|
|
172
|
+
// Step 1: extract namespace structure for each file. Also seed the
|
|
173
|
+
// side-channel cache used by visibility-check hooks downstream.
|
|
174
|
+
namespaceByFilePath.clear();
|
|
175
|
+
const structureByFile = new Map();
|
|
176
|
+
for (const parsed of parsedFiles) {
|
|
177
|
+
const content = inputs.fileContents.get(parsed.filePath);
|
|
178
|
+
if (content === undefined)
|
|
179
|
+
continue;
|
|
180
|
+
const cachedTree = inputs.treeCache?.get(parsed.filePath);
|
|
181
|
+
const struct = extractPhpFileStructure(content, cachedTree);
|
|
182
|
+
structureByFile.set(parsed.filePath, struct);
|
|
183
|
+
namespaceByFilePath.set(parsed.filePath, struct.namespace);
|
|
184
|
+
}
|
|
185
|
+
const buckets = new Map();
|
|
186
|
+
const getBucket = (ns) => {
|
|
187
|
+
let b = buckets.get(ns);
|
|
188
|
+
if (b === undefined) {
|
|
189
|
+
b = { scopes: [], classDefs: [] };
|
|
190
|
+
buckets.set(ns, b);
|
|
191
|
+
}
|
|
192
|
+
return b;
|
|
193
|
+
};
|
|
194
|
+
for (const parsed of parsedFiles) {
|
|
195
|
+
const struct = structureByFile.get(parsed.filePath);
|
|
196
|
+
if (struct === undefined)
|
|
197
|
+
continue;
|
|
198
|
+
const ns = struct.namespace;
|
|
199
|
+
const bucket = getBucket(ns);
|
|
200
|
+
// Register the file's module scope in the bucket.
|
|
201
|
+
const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');
|
|
202
|
+
if (moduleScope !== undefined) {
|
|
203
|
+
bucket.scopes.push({
|
|
204
|
+
filePath: parsed.filePath,
|
|
205
|
+
scopeId: moduleScope.id,
|
|
206
|
+
scope: moduleScope,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
// Collect class-like defs declared at the top-level of this file
|
|
210
|
+
// (defs in Class or Module scopes, excluding nested inner classes).
|
|
211
|
+
for (const scope of parsed.scopes) {
|
|
212
|
+
if (scope.kind !== 'Class')
|
|
213
|
+
continue;
|
|
214
|
+
// Only top-level class scopes (parent is Module or Namespace scope).
|
|
215
|
+
if (scope.parent === null)
|
|
216
|
+
continue;
|
|
217
|
+
const parentScope = parsed.scopes.find((s) => s.id === scope.parent);
|
|
218
|
+
if (parentScope === undefined ||
|
|
219
|
+
(parentScope.kind !== 'Module' && parentScope.kind !== 'Namespace')) {
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
for (const def of scope.ownedDefs) {
|
|
223
|
+
if (isClassLikeDef(def)) {
|
|
224
|
+
bucket.classDefs.push(def);
|
|
225
|
+
break; // one class-like per scope
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const augmentations = indexes.bindingAugmentations;
|
|
231
|
+
// Step 3: For each namespace bucket, inject sibling class bindings
|
|
232
|
+
// into every file's Module scope (that is NOT the declaring file).
|
|
233
|
+
for (const [, bucket] of buckets) {
|
|
234
|
+
// Build name → def map (simple name of qualifiedName).
|
|
235
|
+
const defsByName = new Map();
|
|
236
|
+
for (const def of bucket.classDefs) {
|
|
237
|
+
const q = def.qualifiedName ?? '';
|
|
238
|
+
const simpleName = q.includes('.')
|
|
239
|
+
? q.slice(q.lastIndexOf('.') + 1)
|
|
240
|
+
: q.includes('\\')
|
|
241
|
+
? q.slice(q.lastIndexOf('\\') + 1)
|
|
242
|
+
: q;
|
|
243
|
+
if (simpleName === '')
|
|
244
|
+
continue;
|
|
245
|
+
const arr = defsByName.get(simpleName) ?? [];
|
|
246
|
+
arr.push(def);
|
|
247
|
+
defsByName.set(simpleName, arr);
|
|
248
|
+
}
|
|
249
|
+
for (const { filePath, scopeId, scope } of bucket.scopes) {
|
|
250
|
+
for (const [name, defs] of defsByName) {
|
|
251
|
+
// Skip if already locally declared (origin: 'local' wins).
|
|
252
|
+
const local = scope.bindings.get(name);
|
|
253
|
+
if (local !== undefined && local.some((b) => b.origin === 'local'))
|
|
254
|
+
continue;
|
|
255
|
+
for (const def of defs) {
|
|
256
|
+
if (def.filePath === filePath)
|
|
257
|
+
continue; // don't self-inject
|
|
258
|
+
const arr = getAugmentationBucket(augmentations, scopeId, name);
|
|
259
|
+
if (arr.some((b) => b.def.nodeId === def.nodeId))
|
|
260
|
+
continue;
|
|
261
|
+
arr.push({ def, origin: 'namespace' });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// Step 3b: Register FQN bindings in a workspace-level map instead of
|
|
267
|
+
// per-scope augmentations. PHP `\App\Models\User` and `App\Models\User`
|
|
268
|
+
// must resolve regardless of which file the lookup originates from.
|
|
269
|
+
// `lookupBindingsAt` consults `workspaceFqnBindings` as a third source.
|
|
270
|
+
//
|
|
271
|
+
// Cost: O(class-like defs) entries — NOT O(files × classDefs). For 16K
|
|
272
|
+
// PHP files with 5K classes, this is 5K entries instead of 80M.
|
|
273
|
+
const fqnMap = indexes.workspaceFqnBindings;
|
|
274
|
+
for (const [ns, bucket] of buckets) {
|
|
275
|
+
if (ns === '')
|
|
276
|
+
continue;
|
|
277
|
+
for (const def of bucket.classDefs) {
|
|
278
|
+
const q = def.qualifiedName ?? '';
|
|
279
|
+
const simpleName = q.includes('\\') ? q.slice(q.lastIndexOf('\\') + 1) : q;
|
|
280
|
+
if (simpleName === '')
|
|
281
|
+
continue;
|
|
282
|
+
const fqn = `${ns}\\${simpleName}`;
|
|
283
|
+
let arr = fqnMap.get(fqn);
|
|
284
|
+
if (arr === undefined) {
|
|
285
|
+
arr = [];
|
|
286
|
+
fqnMap.set(fqn, arr);
|
|
287
|
+
}
|
|
288
|
+
if (arr.some((b) => b.def.nodeId === def.nodeId))
|
|
289
|
+
continue;
|
|
290
|
+
arr.push({ def, origin: 'namespace' });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// Step 4: Mirror return-type bindings from same-namespace sibling files.
|
|
294
|
+
// This enables chain-follow like `$c->greet()->save()` where `greet()`
|
|
295
|
+
// returns `Greeting` (declared in A.php, same namespace) and `Greeting`
|
|
296
|
+
// isn't imported in the calling file. Without this, the compound-receiver
|
|
297
|
+
// resolver can't resolve `Greeting` as a class binding in the importer's
|
|
298
|
+
// scope chain.
|
|
299
|
+
//
|
|
300
|
+
// Additionally, mirror from files that are imported via `use` (different
|
|
301
|
+
// namespace) so return types from dependencies are chain-followable too.
|
|
302
|
+
const parsedByPath = new Map();
|
|
303
|
+
for (const p of parsedFiles)
|
|
304
|
+
parsedByPath.set(p.filePath, p);
|
|
305
|
+
for (const parsed of parsedFiles) {
|
|
306
|
+
const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');
|
|
307
|
+
if (moduleScope === undefined)
|
|
308
|
+
continue;
|
|
309
|
+
const moduleTypeBindings = moduleScope.typeBindings;
|
|
310
|
+
const struct = structureByFile.get(parsed.filePath);
|
|
311
|
+
const ownNs = struct?.namespace ?? '';
|
|
312
|
+
// Collect namespaces accessible from this file:
|
|
313
|
+
// 1. Own namespace (same-ns siblings)
|
|
314
|
+
// 2. Namespaces of directly imported files (via parsedImports → targetRaw → PSR-4 namespace)
|
|
315
|
+
const accessibleFiles = new Set();
|
|
316
|
+
// Same-namespace siblings.
|
|
317
|
+
const sameBucket = buckets.get(ownNs);
|
|
318
|
+
if (sameBucket !== undefined) {
|
|
319
|
+
for (const { filePath } of sameBucket.scopes) {
|
|
320
|
+
if (filePath !== parsed.filePath)
|
|
321
|
+
accessibleFiles.add(filePath);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// Files directly imported by this file (finalized import edges).
|
|
325
|
+
const ownModuleScopeBindings = indexes.bindings.get(moduleScope.id);
|
|
326
|
+
if (ownModuleScopeBindings !== undefined) {
|
|
327
|
+
for (const [, refs] of ownModuleScopeBindings) {
|
|
328
|
+
for (const ref of refs) {
|
|
329
|
+
if (ref.origin === 'import' || ref.origin === 'namespace') {
|
|
330
|
+
const importFilePath = ref.def.filePath;
|
|
331
|
+
if (importFilePath !== parsed.filePath) {
|
|
332
|
+
accessibleFiles.add(importFilePath);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
// Mirror return-type bindings from accessible files.
|
|
339
|
+
for (const srcFilePath of accessibleFiles) {
|
|
340
|
+
const srcParsed = parsedByPath.get(srcFilePath);
|
|
341
|
+
if (srcParsed === undefined)
|
|
342
|
+
continue;
|
|
343
|
+
const srcModuleScope = srcParsed.scopes.find((s) => s.kind === 'Module');
|
|
344
|
+
if (srcModuleScope === undefined)
|
|
345
|
+
continue;
|
|
346
|
+
for (const [boundName, typeRef] of srcModuleScope.typeBindings) {
|
|
347
|
+
if (moduleTypeBindings.has(boundName))
|
|
348
|
+
continue;
|
|
349
|
+
moduleTypeBindings.set(boundName, typeRef);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|