gitnexus 1.6.6-rc.98 → 1.6.6
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 +122 -68
- package/dist/_shared/graph/types.d.ts +17 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +3 -5
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +2 -4
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.js +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
- package/dist/_shared/scope-resolution/parsed-file.d.ts +24 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +13 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.d.ts +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.js +6 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.js +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts +29 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +9 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +1 -1
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +35 -1
- package/dist/cli/ai-context.js +111 -12
- package/dist/cli/analyze-config.d.ts +92 -0
- package/dist/cli/analyze-config.js +364 -0
- package/dist/cli/analyze.d.ts +17 -1
- package/dist/cli/analyze.js +224 -71
- package/dist/cli/cli-message.d.ts +1 -1
- package/dist/cli/doctor.d.ts +18 -0
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/i18n/en.d.ts +2 -2
- package/dist/cli/i18n/en.js +2 -2
- package/dist/cli/i18n/resources.d.ts +2 -2
- package/dist/cli/i18n/zh-CN.js +2 -2
- package/dist/cli/index.js +4 -2
- package/dist/cli/resolve-invocation.d.ts +21 -0
- package/dist/cli/resolve-invocation.js +68 -0
- package/dist/cli/setup.d.ts +33 -0
- package/dist/cli/setup.js +96 -35
- package/dist/cli/skill-gen.js +2 -2
- package/dist/cli/wiki.js +20 -4
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +14 -1
- package/dist/core/embeddings/runtime-support.d.ts +41 -0
- package/dist/core/embeddings/runtime-support.js +65 -0
- package/dist/core/group/extractors/grpc-patterns/proto.js +2 -1
- package/dist/core/group/extractors/http-patterns/java.js +15 -1
- package/dist/core/ingestion/call-processor.d.ts +57 -227
- package/dist/core/ingestion/call-processor.js +172 -2595
- package/dist/core/ingestion/call-routing.d.ts +6 -5
- package/dist/core/ingestion/call-routing.js +6 -6
- package/dist/core/ingestion/call-types.d.ts +0 -75
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +26 -1
- package/dist/core/ingestion/class-extractors/configs/ruby.js +3 -0
- package/dist/core/ingestion/class-extractors/generic.js +9 -11
- package/dist/core/ingestion/class-types.d.ts +23 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +11 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +227 -73
- package/dist/core/ingestion/cobol-processor.d.ts +1 -0
- package/dist/core/ingestion/cobol-processor.js +51 -2
- package/dist/core/ingestion/emit-references.js +8 -2
- package/dist/core/ingestion/export-detection.d.ts +2 -1
- package/dist/core/ingestion/export-detection.js +2 -6
- package/dist/core/ingestion/field-extractors/configs/dart.d.ts +0 -6
- package/dist/core/ingestion/field-extractors/configs/dart.js +62 -44
- package/dist/core/ingestion/field-extractors/configs/go.d.ts +0 -9
- package/dist/core/ingestion/field-extractors/configs/go.js +40 -1
- package/dist/core/ingestion/field-extractors/configs/jvm.js +43 -4
- package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
- package/dist/core/ingestion/field-extractors/configs/swift.d.ts +12 -1
- package/dist/core/ingestion/field-extractors/configs/swift.js +31 -6
- package/dist/core/ingestion/field-extractors/generic.d.ts +6 -0
- package/dist/core/ingestion/field-extractors/generic.js +5 -4
- package/dist/core/ingestion/field-extractors/typescript.js +0 -29
- package/dist/core/ingestion/filesystem-walker.d.ts +0 -9
- package/dist/core/ingestion/filesystem-walker.js +0 -11
- package/dist/core/ingestion/finalize-orchestrator.js +14 -2
- package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +21 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.js +72 -11
- package/dist/core/ingestion/import-resolvers/python.d.ts +1 -1
- package/dist/core/ingestion/import-resolvers/standard.d.ts +2 -2
- package/dist/core/ingestion/import-resolvers/standard.js +6 -5
- package/dist/core/ingestion/import-resolvers/utils.d.ts +2 -5
- package/dist/core/ingestion/import-resolvers/utils.js +1 -9
- package/dist/core/ingestion/language-provider.d.ts +39 -119
- package/dist/core/ingestion/language-provider.js +0 -2
- package/dist/core/ingestion/languages/c/capture-side-channel.d.ts +62 -0
- package/dist/core/ingestion/languages/c/capture-side-channel.js +65 -0
- package/dist/core/ingestion/languages/c/captures.js +41 -23
- package/dist/core/ingestion/languages/c/import-decomposer.d.ts +9 -0
- package/dist/core/ingestion/languages/c/import-decomposer.js +15 -0
- package/dist/core/ingestion/languages/c/import-target.js +52 -9
- package/dist/core/ingestion/languages/c/index.d.ts +2 -1
- package/dist/core/ingestion/languages/c/index.js +2 -1
- package/dist/core/ingestion/languages/c/query.js +15 -0
- package/dist/core/ingestion/languages/c/scope-resolver.js +47 -4
- package/dist/core/ingestion/languages/c/static-linkage.d.ts +8 -0
- package/dist/core/ingestion/languages/c/static-linkage.js +46 -1
- package/dist/core/ingestion/languages/c-cpp.js +16 -7
- package/dist/core/ingestion/languages/cobol/captures.js +25 -2
- package/dist/core/ingestion/languages/cpp/adl.d.ts +88 -4
- package/dist/core/ingestion/languages/cpp/adl.js +380 -160
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
- package/dist/core/ingestion/languages/cpp/capture-side-channel.d.ts +65 -0
- package/dist/core/ingestion/languages/cpp/capture-side-channel.js +78 -0
- package/dist/core/ingestion/languages/cpp/captures.js +162 -54
- package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +18 -52
- package/dist/core/ingestion/languages/cpp/file-local-linkage.js +49 -1
- package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +7 -0
- package/dist/core/ingestion/languages/cpp/import-decomposer.js +12 -0
- package/dist/core/ingestion/languages/cpp/index.d.ts +1 -0
- package/dist/core/ingestion/languages/cpp/index.js +1 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +8 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.js +21 -0
- package/dist/core/ingestion/languages/cpp/query.js +21 -0
- package/dist/core/ingestion/languages/cpp/range-bindings.js +20 -5
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +52 -5
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +20 -0
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +83 -3
- package/dist/core/ingestion/languages/csharp/captures.js +205 -41
- package/dist/core/ingestion/languages/csharp/index.d.ts +3 -4
- package/dist/core/ingestion/languages/csharp/index.js +3 -4
- package/dist/core/ingestion/languages/csharp/interpret.js +17 -3
- package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +17 -7
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +129 -124
- package/dist/core/ingestion/languages/csharp/qualified-type-names.d.ts +14 -0
- package/dist/core/ingestion/languages/csharp/qualified-type-names.js +59 -0
- package/dist/core/ingestion/languages/csharp/query.js +13 -0
- package/dist/core/ingestion/languages/csharp/receiver-binding.js +10 -6
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -1
- package/dist/core/ingestion/languages/csharp.js +0 -5
- package/dist/core/ingestion/languages/dart/arity-metadata.d.ts +25 -0
- package/dist/core/ingestion/languages/dart/arity-metadata.js +35 -0
- package/dist/core/ingestion/languages/dart/arity.d.ts +19 -0
- package/dist/core/ingestion/languages/dart/arity.js +31 -0
- package/dist/core/ingestion/languages/dart/built-ins.d.ts +11 -0
- package/dist/core/ingestion/languages/dart/built-ins.js +34 -0
- package/dist/core/ingestion/languages/dart/cache-stats.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/cache-stats.js +24 -0
- package/dist/core/ingestion/languages/dart/captures.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/captures.js +445 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.js +31 -0
- package/dist/core/ingestion/languages/dart/import-target.d.ts +15 -0
- package/dist/core/ingestion/languages/dart/import-target.js +65 -0
- package/dist/core/ingestion/languages/dart/index.d.ts +28 -0
- package/dist/core/ingestion/languages/dart/index.js +28 -0
- package/dist/core/ingestion/languages/dart/interpret.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/interpret.js +95 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.d.ts +10 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.js +39 -0
- package/dist/core/ingestion/languages/dart/query.d.ts +26 -0
- package/dist/core/ingestion/languages/dart/query.js +142 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.js +87 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.js +194 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.d.ts +23 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.js +51 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.d.ts +20 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.js +47 -0
- package/dist/core/ingestion/languages/dart.d.ts +0 -1
- package/dist/core/ingestion/languages/dart.js +15 -29
- package/dist/core/ingestion/languages/go/arity-metadata.d.ts +1 -0
- package/dist/core/ingestion/languages/go/arity-metadata.js +31 -1
- package/dist/core/ingestion/languages/go/captures.js +247 -26
- package/dist/core/ingestion/languages/go/interface-impls.js +476 -50
- package/dist/core/ingestion/languages/go/interpret.js +21 -11
- package/dist/core/ingestion/languages/go/method-owners.js +20 -8
- package/dist/core/ingestion/languages/go/query.js +15 -7
- package/dist/core/ingestion/languages/go/range-binding.js +24 -9
- package/dist/core/ingestion/languages/go/receiver-binding.js +1 -1
- package/dist/core/ingestion/languages/go/scope-resolver.js +2 -2
- package/dist/core/ingestion/languages/go/simple-hooks.js +10 -5
- package/dist/core/ingestion/languages/go/type-binding.d.ts +1 -0
- package/dist/core/ingestion/languages/go/type-binding.js +40 -2
- package/dist/core/ingestion/languages/go.d.ts +0 -1
- package/dist/core/ingestion/languages/go.js +0 -5
- package/dist/core/ingestion/languages/index.d.ts +0 -5
- package/dist/core/ingestion/languages/index.js +0 -3
- package/dist/core/ingestion/languages/java/captures.js +252 -23
- package/dist/core/ingestion/languages/java/interpret.js +12 -6
- package/dist/core/ingestion/languages/java/package-siblings.js +18 -5
- package/dist/core/ingestion/languages/java/query.js +16 -1
- package/dist/core/ingestion/languages/java/scope-resolver.d.ts +2 -8
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -8
- package/dist/core/ingestion/languages/java.js +0 -5
- package/dist/core/ingestion/languages/javascript/captures.js +185 -11
- package/dist/core/ingestion/languages/javascript/query.js +107 -1
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +57 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +60 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +213 -22
- package/dist/core/ingestion/languages/kotlin/companion-scopes.d.ts +7 -0
- package/dist/core/ingestion/languages/kotlin/companion-scopes.js +10 -0
- package/dist/core/ingestion/languages/kotlin/index.d.ts +1 -0
- package/dist/core/ingestion/languages/kotlin/index.js +1 -0
- package/dist/core/ingestion/languages/kotlin/query.js +30 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.d.ts +5 -7
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +22 -7
- package/dist/core/ingestion/languages/kotlin.js +8 -5
- package/dist/core/ingestion/languages/php/captures.js +135 -19
- package/dist/core/ingestion/languages/php/import-decomposer.js +21 -63
- package/dist/core/ingestion/languages/php/index.d.ts +3 -4
- package/dist/core/ingestion/languages/php/index.js +3 -4
- package/dist/core/ingestion/languages/php/query.js +5 -0
- package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
- package/dist/core/ingestion/languages/php.js +0 -4
- package/dist/core/ingestion/languages/python/captures.js +128 -13
- package/dist/core/ingestion/languages/python/depends-references.js +1 -1
- package/dist/core/ingestion/languages/python/import-target.d.ts +4 -5
- package/dist/core/ingestion/languages/python/import-target.js +108 -16
- package/dist/core/ingestion/languages/python/index-stats.d.ts +18 -0
- package/dist/core/ingestion/languages/python/index-stats.js +25 -0
- package/dist/core/ingestion/languages/python/index.d.ts +3 -4
- package/dist/core/ingestion/languages/python/index.js +3 -4
- package/dist/core/ingestion/languages/python/query.js +17 -0
- package/dist/core/ingestion/languages/python/scope-resolver.js +7 -6
- package/dist/core/ingestion/languages/python.d.ts +0 -2
- package/dist/core/ingestion/languages/python.js +0 -7
- package/dist/core/ingestion/languages/ruby/captures.js +174 -31
- package/dist/core/ingestion/languages/ruby/import-target.js +2 -1
- package/dist/core/ingestion/languages/ruby/interpret.js +2 -1
- package/dist/core/ingestion/languages/ruby/query.js +10 -0
- package/dist/core/ingestion/languages/ruby/scope-resolver.js +61 -11
- package/dist/core/ingestion/languages/ruby.js +4 -53
- package/dist/core/ingestion/languages/rust/captures.js +95 -13
- package/dist/core/ingestion/languages/rust/query.js +64 -1
- package/dist/core/ingestion/languages/rust/range-binding.js +40 -12
- package/dist/core/ingestion/languages/rust/receiver-binding.js +9 -0
- package/dist/core/ingestion/languages/rust/scope-resolver.js +75 -1
- package/dist/core/ingestion/languages/rust.d.ts +0 -2
- package/dist/core/ingestion/languages/rust.js +0 -6
- package/dist/core/ingestion/languages/swift/arity-metadata.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/arity-metadata.js +41 -0
- package/dist/core/ingestion/languages/swift/arity.d.ts +29 -0
- package/dist/core/ingestion/languages/swift/arity.js +42 -0
- package/dist/core/ingestion/languages/swift/base-type.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/base-type.js +27 -0
- package/dist/core/ingestion/languages/swift/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/swift/captures.d.ts +35 -0
- package/dist/core/ingestion/languages/swift/captures.js +495 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.js +57 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.js +84 -0
- package/dist/core/ingestion/languages/swift/import-target.d.ts +33 -0
- package/dist/core/ingestion/languages/swift/import-target.js +81 -0
- package/dist/core/ingestion/languages/swift/index.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/index.js +37 -0
- package/dist/core/ingestion/languages/swift/interpret.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/interpret.js +89 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.js +48 -0
- package/dist/core/ingestion/languages/swift/query.d.ts +46 -0
- package/dist/core/ingestion/languages/swift/query.js +194 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.d.ts +40 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.js +161 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.d.ts +50 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.js +189 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.js +65 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.d.ts +25 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.js +66 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.js +60 -0
- package/dist/core/ingestion/languages/swift/target-grouping.d.ts +51 -0
- package/dist/core/ingestion/languages/swift/target-grouping.js +93 -0
- package/dist/core/ingestion/languages/swift/target-siblings.d.ts +30 -0
- package/dist/core/ingestion/languages/swift/target-siblings.js +71 -0
- package/dist/core/ingestion/languages/swift.d.ts +0 -5
- package/dist/core/ingestion/languages/swift.js +11 -87
- package/dist/core/ingestion/languages/typescript/array-callback.d.ts +3 -29
- package/dist/core/ingestion/languages/typescript/array-callback.js +4 -43
- package/dist/core/ingestion/languages/typescript/captures.js +147 -17
- package/dist/core/ingestion/languages/typescript/index.d.ts +3 -4
- package/dist/core/ingestion/languages/typescript/index.js +3 -4
- package/dist/core/ingestion/languages/typescript/query.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript/query.js +125 -4
- package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
- package/dist/core/ingestion/languages/typescript.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript.js +46 -23
- package/dist/core/ingestion/languages/vue/captures.d.ts +46 -0
- package/dist/core/ingestion/languages/vue/captures.js +67 -0
- package/dist/core/ingestion/languages/vue/import-target.d.ts +27 -0
- package/dist/core/ingestion/languages/vue/import-target.js +58 -0
- package/dist/core/ingestion/languages/vue/index.d.ts +49 -0
- package/dist/core/ingestion/languages/vue/index.js +49 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.d.ts +55 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.js +292 -0
- package/dist/core/ingestion/languages/vue.js +12 -4
- package/dist/core/ingestion/local-symbol-pruner.d.ts +11 -0
- package/dist/core/ingestion/local-symbol-pruner.js +63 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +14 -1
- package/dist/core/ingestion/method-extractors/configs/jvm.js +37 -20
- package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
- package/dist/core/ingestion/method-extractors/configs/swift.js +11 -4
- package/dist/core/ingestion/method-types.d.ts +2 -2
- package/dist/core/ingestion/model/index.d.ts +0 -3
- package/dist/core/ingestion/model/index.js +0 -8
- package/dist/core/ingestion/model/resolve.d.ts +7 -43
- package/dist/core/ingestion/model/resolve.js +7 -226
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +46 -1
- package/dist/core/ingestion/model/semantic-model.d.ts +4 -6
- package/dist/core/ingestion/model/semantic-model.js +1 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +3 -4
- package/dist/core/ingestion/model/symbol-table.js +3 -4
- package/dist/core/ingestion/parsing-processor.d.ts +30 -24
- package/dist/core/ingestion/parsing-processor.js +76 -640
- package/dist/core/ingestion/pipeline-phases/communities.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/communities.js +5 -2
- package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +9 -8
- package/dist/core/ingestion/pipeline-phases/cross-file.js +16 -12
- package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
- package/dist/core/ingestion/pipeline-phases/index.js +1 -0
- package/dist/core/ingestion/pipeline-phases/mro.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/mro.js +2 -2
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +44 -22
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +426 -565
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +13 -33
- package/dist/core/ingestion/pipeline-phases/parse.js +2 -2
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +5 -3
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.d.ts +14 -0
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.js +26 -0
- package/dist/core/ingestion/pipeline.d.ts +27 -19
- package/dist/core/ingestion/pipeline.js +4 -2
- package/dist/core/ingestion/resolve-references.js +15 -3
- package/dist/core/ingestion/route-extractors/laravel.d.ts +10 -0
- package/dist/core/ingestion/route-extractors/laravel.js +88 -9
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +2 -1
- package/dist/core/ingestion/scope-extractor-bridge.js +2 -2
- package/dist/core/ingestion/scope-extractor.js +13 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +181 -15
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +21 -10
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +10 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +7 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +58 -6
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +24 -5
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +68 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +189 -29
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +21 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1 -1
- package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +8 -11
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +171 -50
- package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +3 -4
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +9 -4
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +28 -5
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +191 -24
- package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +31 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +72 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +440 -39
- package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +18 -2
- package/dist/core/ingestion/scope-resolution/workspace-index.js +94 -7
- package/dist/core/ingestion/tree-sitter-queries.d.ts +14 -14
- package/dist/core/ingestion/tree-sitter-queries.js +380 -158
- package/dist/core/ingestion/ts-js-hoc-utils.d.ts +12 -0
- package/dist/core/ingestion/ts-js-hoc-utils.js +105 -0
- package/dist/core/ingestion/type-env.d.ts +2 -1
- package/dist/core/ingestion/type-env.js +6 -8
- package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
- package/dist/core/ingestion/type-extractors/csharp.js +18 -34
- package/dist/core/ingestion/type-extractors/go.js +2 -10
- package/dist/core/ingestion/type-extractors/jvm.js +6 -5
- package/dist/core/ingestion/type-extractors/php.js +1 -1
- package/dist/core/ingestion/type-extractors/python.js +1 -1
- package/dist/core/ingestion/type-extractors/ruby.js +2 -2
- package/dist/core/ingestion/type-extractors/rust.js +0 -16
- package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
- package/dist/core/ingestion/type-extractors/shared.js +25 -11
- package/dist/core/ingestion/type-extractors/swift.js +5 -5
- package/dist/core/ingestion/type-extractors/types.d.ts +1 -1
- package/dist/core/ingestion/type-extractors/typescript.js +1 -1
- package/dist/core/ingestion/utils/ast-helpers.d.ts +119 -1
- package/dist/core/ingestion/utils/ast-helpers.js +260 -13
- package/dist/core/ingestion/utils/callable-labels.d.ts +13 -0
- package/dist/core/ingestion/utils/callable-labels.js +14 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.d.ts +10 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.js +30 -0
- package/dist/core/ingestion/utils/heap-probe.d.ts +20 -0
- package/dist/core/ingestion/utils/heap-probe.js +39 -0
- package/dist/core/ingestion/utils/heritage-marker.d.ts +33 -0
- package/dist/core/ingestion/utils/heritage-marker.js +41 -0
- package/dist/core/ingestion/utils/qualified-name.d.ts +37 -0
- package/dist/core/ingestion/utils/qualified-name.js +67 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +49 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.js +76 -62
- package/dist/core/ingestion/variable-extractors/configs/go.js +74 -7
- package/dist/core/ingestion/variable-extractors/configs/jvm.js +35 -8
- package/dist/core/ingestion/variable-extractors/generic.js +40 -12
- package/dist/core/ingestion/variable-types.d.ts +9 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +97 -7
- package/dist/core/ingestion/vue-sfc-extractor.js +433 -11
- package/dist/core/ingestion/workers/parse-worker.d.ts +0 -11
- package/dist/core/ingestion/workers/parse-worker.js +358 -187
- package/dist/core/ingestion/workers/worker-pool.d.ts +78 -9
- package/dist/core/ingestion/workers/worker-pool.js +346 -49
- package/dist/core/lbug/csv-generator.js +20 -2
- package/dist/core/lbug/lbug-adapter.js +29 -10
- package/dist/core/lbug/native-check.js +17 -5
- package/dist/core/lbug/pool-adapter.d.ts +0 -19
- package/dist/core/lbug/pool-adapter.js +40 -77
- package/dist/core/lbug/query-result-utils.d.ts +19 -0
- package/dist/core/lbug/query-result-utils.js +28 -0
- package/dist/core/run-analyze.d.ts +9 -2
- package/dist/core/run-analyze.js +24 -3
- package/dist/core/tree-sitter/parser-loader.d.ts +13 -0
- package/dist/core/tree-sitter/parser-loader.js +4 -0
- package/dist/core/tree-sitter/safe-parse.d.ts +70 -3
- package/dist/core/tree-sitter/safe-parse.js +214 -11
- package/dist/core/wiki/generator.js +13 -5
- package/dist/core/wiki/graph-queries.d.ts +3 -0
- package/dist/core/wiki/graph-queries.js +9 -1
- package/dist/core/wiki/llm-client.d.ts +1 -1
- package/dist/core/wiki/llm-client.js +7 -2
- package/dist/core/wiki/local-cli-client.d.ts +2 -1
- package/dist/core/wiki/local-cli-client.js +62 -4
- package/dist/mcp/compatible-stdio-transport.d.ts +3 -0
- package/dist/mcp/compatible-stdio-transport.js +22 -0
- package/dist/mcp/core/embedder.d.ts +1 -1
- package/dist/mcp/core/embedder.js +13 -1
- package/dist/mcp/local/local-backend.d.ts +37 -5
- package/dist/mcp/local/local-backend.js +227 -129
- package/dist/mcp/resources.js +3 -3
- package/dist/mcp/server.js +9 -1
- package/dist/storage/git.d.ts +11 -0
- package/dist/storage/git.js +30 -0
- package/dist/storage/parse-cache.d.ts +23 -1
- package/dist/storage/parse-cache.js +138 -32
- package/dist/storage/parsedfile-store.d.ts +142 -0
- package/dist/storage/parsedfile-store.js +367 -0
- package/dist/storage/repo-manager.d.ts +2 -1
- package/dist/storage/scope-index-store.d.ts +114 -0
- package/dist/storage/scope-index-store.js +236 -0
- package/dist/types/pipeline.d.ts +6 -3
- package/hooks/antigravity/gitnexus-antigravity-hook.cjs +2 -1
- package/hooks/claude/gitnexus-hook.cjs +2 -1
- package/hooks/claude/resolve-analyze-cmd.cjs +323 -0
- package/package.json +4 -5
- package/scripts/bench-scope-resolution.ts +1 -3
- package/scripts/cross-platform-tests.ts +4 -1
- package/skills/gitnexus-cli.md +8 -6
- package/skills/gitnexus-debugging.md +15 -15
- package/skills/gitnexus-exploring.md +11 -11
- package/skills/gitnexus-guide.md +1 -1
- package/skills/gitnexus-impact-analysis.md +10 -10
- package/skills/gitnexus-pr-review.md +19 -19
- package/skills/gitnexus-refactoring.md +25 -25
- package/web/assets/{agent-BRX-afm3.js → agent-EkX7webX.js} +156 -131
- package/web/assets/{architectureDiagram-UL44E2DR-B1oYB8-c.js → architectureDiagram-UL44E2DR-BoczH8cv.js} +1 -1
- package/web/assets/{chunk-LCXTWHL2-SPC6pgWI.js → chunk-LCXTWHL2-By5HB3b-.js} +1 -1
- package/web/assets/{chunk-RG4AUYOV-DZXr4Yv3.js → chunk-RG4AUYOV-BQE_DkpL.js} +1 -1
- package/web/assets/{classDiagram-KGZ6W3CR-BqpOj8L9.js → classDiagram-KGZ6W3CR-Dj_02GUH.js} +1 -1
- package/web/assets/{classDiagram-v2-72OJOZXJ-FmElywK2.js → classDiagram-v2-72OJOZXJ-D-NArMpf.js} +1 -1
- package/web/assets/{diagram-3NCE3AQN-BWtJXMDq.js → diagram-3NCE3AQN-VXtXDO95.js} +1 -1
- package/web/assets/{diagram-GF46GFSD-Hh-fChxU.js → diagram-GF46GFSD-B1qab2Ah.js} +1 -1
- package/web/assets/{diagram-QXG6HAR7-DYeQHxGU.js → diagram-QXG6HAR7-BSCHGzzT.js} +1 -1
- package/web/assets/{diagram-WEQXMOUZ-DYGU4T0y.js → diagram-WEQXMOUZ-DHtknmNT.js} +1 -1
- package/web/assets/{erDiagram-L5TCEMPS-bN3wlP2A.js → erDiagram-L5TCEMPS-Db-IYTmm.js} +1 -1
- package/web/assets/{flowDiagram-H6V6AXG4-YACVtF3-.js → flowDiagram-H6V6AXG4-BHDoyVoW.js} +1 -1
- package/web/assets/{index-BhnAdWTt.js → index-BR0IhgbR.js} +10 -10
- package/web/assets/{infoDiagram-3YFTVSEB-BWBzD28-.js → infoDiagram-3YFTVSEB-6h8wbWEe.js} +1 -1
- package/web/assets/{ishikawaDiagram-BNXS4ZKH-B8qYT-j9.js → ishikawaDiagram-BNXS4ZKH-Dx2OkPk1.js} +1 -1
- package/web/assets/{kanban-definition-75IXJCU3-BeoPr5Tl.js → kanban-definition-75IXJCU3-CIIEZfqV.js} +1 -1
- package/web/assets/{mindmap-definition-2TDM6QVE-CdLLN_so.js → mindmap-definition-2TDM6QVE-DUAqydRq.js} +1 -1
- package/web/assets/{pieDiagram-CU6KROY3-DEd2a_k_.js → pieDiagram-CU6KROY3-BntYuYZa.js} +1 -1
- package/web/assets/{requirementDiagram-JXO7QTGE-QNeTo5C_.js → requirementDiagram-JXO7QTGE-QCD6I29n.js} +1 -1
- package/web/assets/{sequenceDiagram-VS2MUI6T-BHC7q7yJ.js → sequenceDiagram-VS2MUI6T-DScFwLz2.js} +1 -1
- package/web/assets/{stateDiagram-7D4R322I-KONnc2Px.js → stateDiagram-7D4R322I-AkRAm6Hl.js} +1 -1
- package/web/assets/{stateDiagram-v2-36443NZ5-C2QfuMlu.js → stateDiagram-v2-36443NZ5-BCK1vigR.js} +1 -1
- package/web/assets/{timeline-definition-O6YCAMPW-D4t4NJx1.js → timeline-definition-O6YCAMPW-BvpIVXjX.js} +1 -1
- package/web/assets/{vennDiagram-MWXL3ELB-6bctC9Yg.js → vennDiagram-MWXL3ELB-BYGWk6dK.js} +1 -1
- package/web/assets/{wardleyDiagram-CUQ6CDDI-BPZYNTvC.js → wardleyDiagram-CUQ6CDDI-Dk1z7H2T.js} +1 -1
- package/web/assets/{xychartDiagram-N2JHSOCM-lBI9O6DW.js → xychartDiagram-N2JHSOCM-2N6NCSWN.js} +1 -1
- package/web/index.html +1 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +0 -63
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.js +0 -122
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +0 -59
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.js +0 -79
- package/dist/_shared/scope-resolution/shadow/diff.js.map +0 -1
- package/dist/core/ingestion/ast-cache.d.ts +0 -26
- package/dist/core/ingestion/ast-cache.js +0 -48
- package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +0 -13
- package/dist/core/ingestion/heritage-extractors/configs/go.js +0 -20
- package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +0 -18
- package/dist/core/ingestion/heritage-extractors/configs/ruby.js +0 -65
- package/dist/core/ingestion/heritage-extractors/generic.d.ts +0 -23
- package/dist/core/ingestion/heritage-extractors/generic.js +0 -47
- package/dist/core/ingestion/heritage-processor.d.ts +0 -54
- package/dist/core/ingestion/heritage-processor.js +0 -367
- package/dist/core/ingestion/heritage-types.d.ts +0 -73
- package/dist/core/ingestion/heritage-types.js +0 -2
- package/dist/core/ingestion/import-processor.d.ts +0 -23
- package/dist/core/ingestion/import-processor.js +0 -377
- package/dist/core/ingestion/model/heritage-map.d.ts +0 -105
- package/dist/core/ingestion/model/heritage-map.js +0 -294
- package/dist/core/ingestion/model/resolution-context.d.ts +0 -93
- package/dist/core/ingestion/model/resolution-context.js +0 -337
- package/dist/core/ingestion/named-bindings/csharp.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/csharp.js +0 -37
- package/dist/core/ingestion/named-bindings/java.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/java.js +0 -29
- package/dist/core/ingestion/named-bindings/kotlin.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/kotlin.js +0 -36
- package/dist/core/ingestion/named-bindings/php.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/php.js +0 -61
- package/dist/core/ingestion/named-bindings/python.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/python.js +0 -49
- package/dist/core/ingestion/named-bindings/rust.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/rust.js +0 -66
- package/dist/core/ingestion/named-bindings/types.d.ts +0 -16
- package/dist/core/ingestion/named-bindings/types.js +0 -6
- package/dist/core/ingestion/named-bindings/typescript.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/typescript.js +0 -58
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +0 -17
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +0 -209
- package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +0 -22
- package/dist/core/ingestion/pipeline-phases/orm-extraction.js +0 -92
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +0 -70
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +0 -312
- package/dist/core/ingestion/registry-primary-flag.d.ts +0 -89
- package/dist/core/ingestion/registry-primary-flag.js +0 -122
- package/dist/core/ingestion/shadow-harness.d.ts +0 -113
- package/dist/core/ingestion/shadow-harness.js +0 -148
- package/dist/core/ingestion/utils/ruby-self-call.d.ts +0 -52
- package/dist/core/ingestion/utils/ruby-self-call.js +0 -59
- package/scripts/ci-list-migrated-languages.ts +0 -24
- package/scripts/run-parity.ts +0 -128
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Pure given the input source text. No I/O, no globals consulted.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import { nodeToCapture, syntheticCapture, walkNamedTree, } from '../../utils/ast-helpers.js';
|
|
19
19
|
import { splitImportStatement } from './import-decomposer.js';
|
|
20
20
|
import { getPythonParser, getPythonScopeQuery } from './query.js';
|
|
21
21
|
import { synthesizeReceiverTypeBinding } from './receiver-binding.js';
|
|
@@ -26,9 +26,10 @@ import { getTreeSitterBufferSize } from '../../constants.js';
|
|
|
26
26
|
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
27
27
|
import { pythonFunctionDefinitionLabel } from './simple-hooks.js';
|
|
28
28
|
export function emitPythonScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
29
|
-
// Skip the parse when the caller (
|
|
30
|
-
// produced a Tree for this source
|
|
31
|
-
//
|
|
29
|
+
// Skip the parse when the caller (the scope-resolution orchestrator's
|
|
30
|
+
// `treeCache`) already produced a Tree for this source — empty under
|
|
31
|
+
// worker-pool runs, so cache miss = re-parse. The cachedTree parameter
|
|
32
|
+
// is typed as `unknown` at the
|
|
32
33
|
// contract layer (see `LanguageProvider.emitScopeCaptures`); cast
|
|
33
34
|
// here at the use site.
|
|
34
35
|
let tree = cachedTree;
|
|
@@ -59,20 +60,30 @@ export function emitPythonScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
|
59
60
|
// `@`; we put it back so the central extractor's prefix lookups
|
|
60
61
|
// (`@scope.`, `@declaration.`, …) work.
|
|
61
62
|
const grouped = {};
|
|
63
|
+
// Parallel tag -> captured SyntaxNode map. The tree-sitter query already
|
|
64
|
+
// hands us each matched node as `c.node`, so anchor nodes can be used
|
|
65
|
+
// directly (or via a bounded LOCAL walk) instead of re-deriving them with
|
|
66
|
+
// `findNodeAtRange(tree.rootNode, ...)`, which scanned all of root's named
|
|
67
|
+
// children on every match -> O(matches x rootChildren). That was the #1848
|
|
68
|
+
// hotpath in Go (fixed in eaf0a305); the same shape lived here in Python.
|
|
69
|
+
const nodeMap = {};
|
|
62
70
|
for (const c of m.captures) {
|
|
63
71
|
const tag = '@' + c.name;
|
|
64
72
|
grouped[tag] = nodeToCapture(tag, c.node);
|
|
73
|
+
nodeMap[tag] = c.node;
|
|
65
74
|
}
|
|
66
75
|
if (Object.keys(grouped).length === 0)
|
|
67
76
|
continue;
|
|
68
77
|
if (grouped['@import.statement'] !== undefined) {
|
|
69
|
-
//
|
|
70
|
-
// `import_from_statement`
|
|
71
|
-
// `
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
// `@import.statement` is captured directly ON the `import_statement` /
|
|
79
|
+
// `import_from_statement` node (query: `(import_statement) @import.statement`
|
|
80
|
+
// and `(import_from_statement) @import.statement`), so the captured node IS
|
|
81
|
+
// the one the old findNodeAtRange re-derived. `splitImportStatement`
|
|
82
|
+
// dispatches on those two types; a captured node of any other type would
|
|
83
|
+
// have made the old range+type lookup return null -> the defensive raw
|
|
84
|
+
// fallback, which the type guard below reproduces exactly.
|
|
85
|
+
const stmtNode = nodeMap['@import.statement'];
|
|
86
|
+
if (stmtNode.type === 'import_from_statement' || stmtNode.type === 'import_statement') {
|
|
76
87
|
for (const piece of splitImportStatement(stmtNode))
|
|
77
88
|
out.push(piece);
|
|
78
89
|
}
|
|
@@ -84,7 +95,11 @@ export function emitPythonScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
|
84
95
|
}
|
|
85
96
|
if (grouped['@scope.function'] !== undefined) {
|
|
86
97
|
out.push(grouped);
|
|
87
|
-
|
|
98
|
+
// `@scope.function` is captured directly on the `function_definition`
|
|
99
|
+
// node (query: `(function_definition) @scope.function`), so it IS the
|
|
100
|
+
// node the old findNodeAtRange re-derived at that range.
|
|
101
|
+
const scopeNode = nodeMap['@scope.function'];
|
|
102
|
+
const fnNode = scopeNode.type === 'function_definition' ? scopeNode : null;
|
|
88
103
|
if (fnNode !== null) {
|
|
89
104
|
const synth = synthesizeReceiverTypeBinding(fnNode);
|
|
90
105
|
if (synth !== null)
|
|
@@ -100,7 +115,11 @@ export function emitPythonScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
|
100
115
|
// The anchor range is the function_definition itself — we resolve
|
|
101
116
|
// the node and pipe it through the arity helper.
|
|
102
117
|
const anchorCap = grouped['@declaration.function'];
|
|
103
|
-
|
|
118
|
+
// `@declaration.function` is captured directly on the `function_definition`
|
|
119
|
+
// node (query: `(function_definition name: (identifier) @declaration.name)
|
|
120
|
+
// @declaration.function`), so use the captured node, not a root re-walk.
|
|
121
|
+
const anchorNode = nodeMap['@declaration.function'];
|
|
122
|
+
const fnNode = anchorNode.type === 'function_definition' ? anchorNode : null;
|
|
104
123
|
if (fnNode !== null) {
|
|
105
124
|
if (pythonFunctionDefinitionLabel(fnNode, 'Function') === 'Method') {
|
|
106
125
|
delete grouped['@declaration.function'];
|
|
@@ -125,8 +144,104 @@ export function emitPythonScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
|
125
144
|
}
|
|
126
145
|
out.push(grouped);
|
|
127
146
|
}
|
|
147
|
+
out.push(...synthesizePythonInheritanceReferences(tree.rootNode));
|
|
128
148
|
return out;
|
|
129
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Synthesize `@reference.inherits` captures from Python class superclass
|
|
152
|
+
* lists so the registry-primary scope-resolution path emits EXTENDS edges
|
|
153
|
+
* (mirrors C#'s `synthesizeCsharpInheritanceReferences` / C++'s
|
|
154
|
+
* `emitCppInheritanceCaptures` / TypeScript's `synthesizeTsInheritanceReferences`).
|
|
155
|
+
* Without this, Python inheritance edges came only from the legacy
|
|
156
|
+
* heritage-capture leg (removed in #942), which is dropped for registry-primary
|
|
157
|
+
* languages in the worker pipeline (issue #1951).
|
|
158
|
+
*
|
|
159
|
+
* Scope matches the legacy Python heritage leg (config-driven since #1940):
|
|
160
|
+
* every direct base in the `superclasses` `argument_list`, resolved to its bare
|
|
161
|
+
* simple name. Three base shapes that the previous synth DROPPED — and so
|
|
162
|
+
* silently omitted in production while the legacy heritage leg captured them
|
|
163
|
+
* — are now handled (#1951):
|
|
164
|
+
*
|
|
165
|
+
* - `class C(pkg.Base)` → `attribute` (trailing `.attribute` id → `Base`)
|
|
166
|
+
* - `class C(pkg.sub.Base)` → nested `attribute` (recurse → `Base`)
|
|
167
|
+
* - `class C(Generic[T])` → `subscript` (`.value` id → `Generic`)
|
|
168
|
+
*
|
|
169
|
+
* The bare-name text MUST agree with `normalizeSupertypeName` (the legacy leg's
|
|
170
|
+
* reduction in heritage-extractors/supertype-alternation.ts) so both legs emit
|
|
171
|
+
* the same edge under the CI scope-parity gate: `pkg.Base` → `Base`,
|
|
172
|
+
* `Generic[T]` → `Generic`, `pkg.Container[str]` → `Container`. Verified by a
|
|
173
|
+
* real tree-sitter-python parse. The simple `identifier` base keeps its exact
|
|
174
|
+
* prior capture (the base node itself).
|
|
175
|
+
*
|
|
176
|
+
* Tuple/multi bases (`class C(A, pkg.B, Gen[T])`) already iterate here — each
|
|
177
|
+
* `argument_list` named child is one base. Python has no interfaces, so every
|
|
178
|
+
* base resolves to a Class and the central `preEmitInheritanceEdges` pass emits
|
|
179
|
+
* EXTENDS; the EXTENDS-vs-IMPLEMENTS split is decided downstream from the
|
|
180
|
+
* resolved target's symbol kind, so all bases are emitted with the same
|
|
181
|
+
* `inherits` kind here.
|
|
182
|
+
*/
|
|
183
|
+
function synthesizePythonInheritanceReferences(root) {
|
|
184
|
+
const out = [];
|
|
185
|
+
walkNamedTree(root, (node) => {
|
|
186
|
+
if (node.type !== 'class_definition')
|
|
187
|
+
return;
|
|
188
|
+
const superclasses = node.childForFieldName('superclasses');
|
|
189
|
+
if (superclasses === null || superclasses.type !== 'argument_list')
|
|
190
|
+
return;
|
|
191
|
+
for (let i = 0; i < superclasses.namedChildCount; i++) {
|
|
192
|
+
const base = superclasses.namedChild(i);
|
|
193
|
+
if (base === null)
|
|
194
|
+
continue;
|
|
195
|
+
const nameNode = pythonBaseLookupNameNode(base);
|
|
196
|
+
if (nameNode === null)
|
|
197
|
+
continue;
|
|
198
|
+
out.push({
|
|
199
|
+
'@reference.inherits': nodeToCapture('@reference.inherits', base),
|
|
200
|
+
'@reference.name': nodeToCapture('@reference.name', nameNode),
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Reduce a Python superclass base node to the bare simple-identifier node whose
|
|
208
|
+
* `.text` is the lookup name `findClassBindingInScope` resolves. Mirrors the
|
|
209
|
+
* TypeScript `terminalTsTypeNameNode` / C++ `extractBaseLookupName` reference
|
|
210
|
+
* patterns, and its returned node's `.text` is contractually equal to
|
|
211
|
+
* `normalizeSupertypeName(base)` for every shape (real-parse verified):
|
|
212
|
+
*
|
|
213
|
+
* - `identifier` (`Base`) → the node itself
|
|
214
|
+
* - `attribute` (`pkg.Base`,
|
|
215
|
+
* `pkg.sub.Base`) → trailing `attribute:` identifier → `Base`
|
|
216
|
+
* - `subscript` (`Generic[T]`,
|
|
217
|
+
* `pkg.Container[T]`)→ `value:` (recurse, strips `[...]` and
|
|
218
|
+
* any qualifier) → `Generic` / `Container`
|
|
219
|
+
*
|
|
220
|
+
* Returns null for any other shape (no leaf identifier reachable), so it never
|
|
221
|
+
* emits a spurious edge.
|
|
222
|
+
*/
|
|
223
|
+
function pythonBaseLookupNameNode(base) {
|
|
224
|
+
switch (base.type) {
|
|
225
|
+
case 'identifier':
|
|
226
|
+
return base;
|
|
227
|
+
case 'attribute': {
|
|
228
|
+
// `pkg.Base` / `pkg.sub.Base`: the `attribute:` field is the trailing
|
|
229
|
+
// simple-identifier segment (`Base`); recurse so chained dotted paths
|
|
230
|
+
// still resolve to the final identifier.
|
|
231
|
+
const attr = base.childForFieldName('attribute');
|
|
232
|
+
return attr === null ? null : pythonBaseLookupNameNode(attr);
|
|
233
|
+
}
|
|
234
|
+
case 'subscript': {
|
|
235
|
+
// `Generic[T]` / `pkg.Container[str]`: the `value:` field is the
|
|
236
|
+
// subscripted base (identifier or attribute); recurse to strip the
|
|
237
|
+
// `[...]` slice and any qualifier, reaching the bare base name.
|
|
238
|
+
const value = base.childForFieldName('value');
|
|
239
|
+
return value === null ? null : pythonBaseLookupNameNode(value);
|
|
240
|
+
}
|
|
241
|
+
default:
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
130
245
|
function scopeExtractionError(stage, filePath, err) {
|
|
131
246
|
const reason = err instanceof Error ? err.message : String(err);
|
|
132
247
|
return new Error(`[python] tree-sitter ${stage} failed for ${filePath}: ${reason}; skipping scope extraction for this file`);
|
|
@@ -27,7 +27,7 @@ export function synthesizeDependsReferences(fnNode) {
|
|
|
27
27
|
if (param.type !== 'typed_default_parameter' && param.type !== 'default_parameter') {
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
|
-
const defaultValue = param.childForFieldName('value')
|
|
30
|
+
const defaultValue = param.childForFieldName('value');
|
|
31
31
|
if (defaultValue === null)
|
|
32
32
|
continue;
|
|
33
33
|
const callNode = defaultValue.type === 'call' ? defaultValue : null;
|
|
@@ -12,10 +12,9 @@
|
|
|
12
12
|
import type { ParsedImport, WorkspaceIndex } from '../../../../_shared/index.js';
|
|
13
13
|
export interface PythonResolveContext {
|
|
14
14
|
readonly fromFile: string;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
19
|
-
readonly allFilePaths: Set<string>;
|
|
15
|
+
/** `ReadonlySet` so the orchestrator's stable run-level set flows straight
|
|
16
|
+
* through to `getPythonFileIndex`'s `WeakMap` key (built once per run, not
|
|
17
|
+
* copied per import). The whole resolver chain only reads the set. */
|
|
18
|
+
readonly allFilePaths: ReadonlySet<string>;
|
|
20
19
|
}
|
|
21
20
|
export declare function resolvePythonImportTarget(parsedImport: ParsedImport, workspaceIndex: WorkspaceIndex): string | null;
|
|
@@ -10,15 +10,23 @@
|
|
|
10
10
|
* `linkStatus: 'unresolved'`.
|
|
11
11
|
*/
|
|
12
12
|
import { resolvePythonImportInternal } from '../../import-resolvers/python.js';
|
|
13
|
+
import { recordPythonFileIndexBuild } from './index-stats.js';
|
|
13
14
|
export function resolvePythonImportTarget(parsedImport, workspaceIndex) {
|
|
14
15
|
// WorkspaceIndex is `unknown` in the shared contract (Ring 1
|
|
15
16
|
// placeholder). The scope-resolution orchestrator hands us a
|
|
16
17
|
// PythonResolveContext-shaped object; narrow structurally rather
|
|
17
18
|
// than via a cast chain so unexpected shapes return null cleanly.
|
|
18
19
|
const ctx = workspaceIndex;
|
|
20
|
+
// Duck-type the set rather than `instanceof Set`: `allFilePaths` is typed
|
|
21
|
+
// `ReadonlySet<string>` and the chain only ever calls `.has()` + iterates, so
|
|
22
|
+
// any set-like is valid. An `instanceof Set` check would reject a legitimate
|
|
23
|
+
// non-`Set` `ReadonlySet` implementation and silently return null for every
|
|
24
|
+
// import (PR #1918 tri-review P2).
|
|
25
|
+
const allFilePaths = ctx?.allFilePaths;
|
|
19
26
|
if (ctx === undefined ||
|
|
20
27
|
typeof ctx.fromFile !== 'string' ||
|
|
21
|
-
|
|
28
|
+
typeof allFilePaths?.has !== 'function' ||
|
|
29
|
+
typeof allFilePaths?.[Symbol.iterator] !== 'function') {
|
|
22
30
|
return null;
|
|
23
31
|
}
|
|
24
32
|
if (parsedImport.kind === 'dynamic-unresolved')
|
|
@@ -120,12 +128,29 @@ function resolveAbsoluteFromFiles(pathLike, allFilePaths, fromFile) {
|
|
|
120
128
|
// multi-directory collision repos.
|
|
121
129
|
const suffixFile = `/${directFile}`;
|
|
122
130
|
const suffixPkg = `/${directPkg}`;
|
|
131
|
+
// Indexed suffix gather. A file matching `…/<pathLike>.py` has basename
|
|
132
|
+
// `<lastSeg>.py`; one matching `…/<pathLike>/__init__.py` has basename
|
|
133
|
+
// `__init__.py`. Look up only those basename buckets and confirm the full
|
|
134
|
+
// suffix, instead of scanning every file (the O(imports x files) hotpath).
|
|
135
|
+
// The candidate SET is identical to the old full scan, and the tie-break
|
|
136
|
+
// sort below fully determines the result, so output is unchanged. The
|
|
137
|
+
// shared buildSuffixIndex is deliberately NOT used: it keeps only one
|
|
138
|
+
// path per suffix (longest wins) and so cannot reproduce this exact
|
|
139
|
+
// fewest-segments-then-lexicographic tie-break across all candidates.
|
|
140
|
+
const index = getPythonFileIndex(allFilePaths);
|
|
141
|
+
const lastSeg = pathLike.slice(pathLike.lastIndexOf('/') + 1);
|
|
123
142
|
const matches = [];
|
|
124
|
-
for (const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
143
|
+
for (const cand of index.byBasename.get(`${lastSeg}.py`) ?? []) {
|
|
144
|
+
if (cand.norm.endsWith(suffixFile))
|
|
145
|
+
matches.push(cand);
|
|
146
|
+
}
|
|
147
|
+
// Package form: only `__init__.py` files whose parent dir is named `<lastSeg>`
|
|
148
|
+
// can match `…/<lastSeg>/__init__.py` — look them up by parent key (P2b) and
|
|
149
|
+
// confirm the full suffix. Same final candidate set as the old `__init__.py`
|
|
150
|
+
// scan, just without iterating unrelated packages.
|
|
151
|
+
for (const cand of index.byInitParent.get(`${lastSeg}/__init__.py`) ?? []) {
|
|
152
|
+
if (cand.norm.endsWith(suffixPkg))
|
|
153
|
+
matches.push(cand);
|
|
129
154
|
}
|
|
130
155
|
if (matches.length === 0)
|
|
131
156
|
return null;
|
|
@@ -178,18 +203,85 @@ function hasRepoCandidate(leadingSegment, allFilePaths, fromFile) {
|
|
|
178
203
|
for (let i = dirParts.length; i > 0; i--) {
|
|
179
204
|
ancestorPrefixes.push(`${dirParts.slice(0, i).join('/')}/${leadingSegment}/`);
|
|
180
205
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
206
|
+
// Indexed equivalents of the old O(files) scan:
|
|
207
|
+
// (1) `f === rootFile || f === initFile` -> normalized-path membership.
|
|
208
|
+
// (2) `f.startsWith(`${seg}/`) && f.endsWith('.py')` -> some .py file lives
|
|
209
|
+
// under directory `${seg}/`, i.e. `${seg}/` is a known .py dir prefix.
|
|
210
|
+
// (3) ancestor namespace case -> `${ancestor}/${seg}/` is a known .py dir
|
|
211
|
+
// prefix.
|
|
212
|
+
const index = getPythonFileIndex(allFilePaths);
|
|
213
|
+
if (index.normSet.has(rootFile) || index.normSet.has(initFile))
|
|
214
|
+
return true;
|
|
215
|
+
if (index.dirPrefixes.has(prefix))
|
|
216
|
+
return true;
|
|
217
|
+
for (const ap of ancestorPrefixes) {
|
|
218
|
+
if (index.dirPrefixes.has(ap))
|
|
186
219
|
return true;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
}
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
const PYTHON_FILE_INDEX_CACHE = new WeakMap();
|
|
224
|
+
function getPythonFileIndex(allFilePaths) {
|
|
225
|
+
const cached = PYTHON_FILE_INDEX_CACHE.get(allFilePaths);
|
|
226
|
+
if (cached !== undefined)
|
|
227
|
+
return cached;
|
|
228
|
+
// Cache miss: materialize a fresh index. Counted so a test can assert this
|
|
229
|
+
// happens once per run, not once per import (PR #1918 review P1 guard).
|
|
230
|
+
recordPythonFileIndexBuild();
|
|
231
|
+
const normSet = new Set();
|
|
232
|
+
const byBasename = new Map();
|
|
233
|
+
const byInitParent = new Map();
|
|
234
|
+
const dirPrefixes = new Set();
|
|
235
|
+
for (const raw of allFilePaths) {
|
|
236
|
+
const norm = raw.replace(/\\/g, '/');
|
|
237
|
+
// Python import resolution only ever queries `.py` paths: module `<seg>.py`
|
|
238
|
+
// and package `<seg>/__init__.py` membership (normSet), `<lastSeg>.py` /
|
|
239
|
+
// `__init__.py` basename buckets (byBasename), and `.py` directory prefixes
|
|
240
|
+
// (dirPrefixes). Non-`.py` files can never match any of those, so skip them
|
|
241
|
+
// — they were dead weight in every structure on polyglot monorepos
|
|
242
|
+
// (PR #1918 review P3b; dirPrefixes was already `.py`-gated).
|
|
243
|
+
if (!norm.endsWith('.py'))
|
|
244
|
+
continue;
|
|
245
|
+
normSet.add(norm);
|
|
246
|
+
const lastSlash = norm.lastIndexOf('/');
|
|
247
|
+
const base = lastSlash >= 0 ? norm.slice(lastSlash + 1) : norm;
|
|
248
|
+
let bucket = byBasename.get(base);
|
|
249
|
+
if (bucket === undefined) {
|
|
250
|
+
bucket = [];
|
|
251
|
+
byBasename.set(base, bucket);
|
|
252
|
+
}
|
|
253
|
+
bucket.push({ raw, norm });
|
|
254
|
+
// Package files also get a parent-keyed bucket so a `pkg.sub` lookup hits
|
|
255
|
+
// only `…/sub/__init__.py` candidates, not every `__init__.py` (P2b).
|
|
256
|
+
if (base === '__init__.py' && lastSlash >= 0) {
|
|
257
|
+
const dir = norm.slice(0, lastSlash);
|
|
258
|
+
const parentSlash = dir.lastIndexOf('/');
|
|
259
|
+
const parentName = parentSlash >= 0 ? dir.slice(parentSlash + 1) : dir;
|
|
260
|
+
if (parentName) {
|
|
261
|
+
const initKey = `${parentName}/__init__.py`;
|
|
262
|
+
let ib = byInitParent.get(initKey);
|
|
263
|
+
if (ib === undefined) {
|
|
264
|
+
ib = [];
|
|
265
|
+
byInitParent.set(initKey, ib);
|
|
266
|
+
}
|
|
267
|
+
ib.push({ raw, norm });
|
|
191
268
|
}
|
|
192
269
|
}
|
|
270
|
+
// Directory prefixes: every slash-terminated prefix of the path (every
|
|
271
|
+
// index just past a '/', up to and including the file's own directory).
|
|
272
|
+
// Scanning the FULL normalized path — including any leading '/' for
|
|
273
|
+
// absolute paths — makes `dirPrefixes.has(X)` match exactly when the old
|
|
274
|
+
// gate's `f.startsWith(X)` (X always ends in '/') matched. The previous
|
|
275
|
+
// split+`filter(Boolean)` dropped the leading empty component, so an
|
|
276
|
+
// absolute file `/repo/svc/x.py` yielded `repo/svc/` (no leading slash) and
|
|
277
|
+
// gate-passed where `"/repo/svc/x.py".startsWith("repo/svc/")` is false
|
|
278
|
+
// (PR #1918 review P3a). For relative paths the set is identical.
|
|
279
|
+
for (let i = 0; i <= lastSlash; i++) {
|
|
280
|
+
if (norm[i] === '/')
|
|
281
|
+
dirPrefixes.add(norm.slice(0, i + 1));
|
|
282
|
+
}
|
|
193
283
|
}
|
|
194
|
-
|
|
284
|
+
const index = { normSet, byBasename, byInitParent, dirPrefixes };
|
|
285
|
+
PYTHON_FILE_INDEX_CACHE.set(allFilePaths, index);
|
|
286
|
+
return index;
|
|
195
287
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build counter for the per-file-set Python import-resolution index
|
|
3
|
+
* (`getPythonFileIndex` in `import-target.ts`).
|
|
4
|
+
*
|
|
5
|
+
* A "build" is a `WeakMap` cache MISS that materializes a fresh
|
|
6
|
+
* `PythonFileIndex` (O(files)). Unlike `cache-stats.ts` (which gates its
|
|
7
|
+
* counters behind `PROF_SCOPE_RESOLUTION` because they sit on the per-capture
|
|
8
|
+
* hot path), this counter is always live: an index build happens at most once
|
|
9
|
+
* per resolution run, so the single increment is negligible and an unconditional
|
|
10
|
+
* counter avoids env-var load-order fragility in tests.
|
|
11
|
+
*
|
|
12
|
+
* Used by `test/integration/python-import-index-reuse.test.ts` to assert the
|
|
13
|
+
* index is reused across imports (built once per run) rather than rebuilt per
|
|
14
|
+
* import — the regression guard for PR #1918 review finding P1.
|
|
15
|
+
*/
|
|
16
|
+
export declare function recordPythonFileIndexBuild(): void;
|
|
17
|
+
export declare function getPythonFileIndexBuildCount(): number;
|
|
18
|
+
export declare function resetPythonFileIndexBuildCount(): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build counter for the per-file-set Python import-resolution index
|
|
3
|
+
* (`getPythonFileIndex` in `import-target.ts`).
|
|
4
|
+
*
|
|
5
|
+
* A "build" is a `WeakMap` cache MISS that materializes a fresh
|
|
6
|
+
* `PythonFileIndex` (O(files)). Unlike `cache-stats.ts` (which gates its
|
|
7
|
+
* counters behind `PROF_SCOPE_RESOLUTION` because they sit on the per-capture
|
|
8
|
+
* hot path), this counter is always live: an index build happens at most once
|
|
9
|
+
* per resolution run, so the single increment is negligible and an unconditional
|
|
10
|
+
* counter avoids env-var load-order fragility in tests.
|
|
11
|
+
*
|
|
12
|
+
* Used by `test/integration/python-import-index-reuse.test.ts` to assert the
|
|
13
|
+
* index is reused across imports (built once per run) rather than rebuilt per
|
|
14
|
+
* import — the regression guard for PR #1918 review finding P1.
|
|
15
|
+
*/
|
|
16
|
+
let INDEX_BUILDS = 0;
|
|
17
|
+
export function recordPythonFileIndexBuild() {
|
|
18
|
+
INDEX_BUILDS++;
|
|
19
|
+
}
|
|
20
|
+
export function getPythonFileIndexBuildCount() {
|
|
21
|
+
return INDEX_BUILDS;
|
|
22
|
+
}
|
|
23
|
+
export function resetPythonFileIndexBuildCount() {
|
|
24
|
+
INDEX_BUILDS = 0;
|
|
25
|
+
}
|
|
@@ -66,10 +66,9 @@
|
|
|
66
66
|
* site where the enclosing class can't be statically determined
|
|
67
67
|
* is left unresolved.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
70
|
-
* of these matter in practice
|
|
71
|
-
*
|
|
72
|
-
* `test/integration/resolvers/python.test.ts`.
|
|
69
|
+
* The `test/integration/resolvers/python.test.ts` resolver suite is the
|
|
70
|
+
* authoritative signal for which of these matter in practice; it runs in
|
|
71
|
+
* the standard CI test workflow, so a regression blocks the merge.
|
|
73
72
|
*/
|
|
74
73
|
export { emitPythonScopeCaptures } from './captures.js';
|
|
75
74
|
export { getPythonCaptureCacheStats, resetPythonCaptureCacheStats } from './cache-stats.js';
|
|
@@ -66,10 +66,9 @@
|
|
|
66
66
|
* site where the enclosing class can't be statically determined
|
|
67
67
|
* is left unresolved.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
70
|
-
* of these matter in practice
|
|
71
|
-
*
|
|
72
|
-
* `test/integration/resolvers/python.test.ts`.
|
|
69
|
+
* The `test/integration/resolvers/python.test.ts` resolver suite is the
|
|
70
|
+
* authoritative signal for which of these matter in practice; it runs in
|
|
71
|
+
* the standard CI test workflow, so a regression blocks the merge.
|
|
73
72
|
*/
|
|
74
73
|
export { emitPythonScopeCaptures } from './captures.js';
|
|
75
74
|
export { getPythonCaptureCacheStats, resetPythonCaptureCacheStats } from './cache-stats.js';
|
|
@@ -11,6 +11,7 @@ const PYTHON_SCOPE_QUERY = `
|
|
|
11
11
|
(module) @scope.module
|
|
12
12
|
(class_definition) @scope.class
|
|
13
13
|
(function_definition) @scope.function
|
|
14
|
+
(lambda) @scope.function
|
|
14
15
|
|
|
15
16
|
;; Declarations
|
|
16
17
|
(class_definition
|
|
@@ -232,6 +233,22 @@ const PYTHON_SCOPE_QUERY = `
|
|
|
232
233
|
name: (identifier) @type-binding.name
|
|
233
234
|
return_type: (type) @type-binding.type) @type-binding.return
|
|
234
235
|
|
|
236
|
+
;; Decorators — simple @decorator
|
|
237
|
+
(decorator
|
|
238
|
+
(identifier) @reference.name) @reference.call.free
|
|
239
|
+
|
|
240
|
+
;; Decorators — @obj.decorator (single attribute, identifier receiver)
|
|
241
|
+
(decorator
|
|
242
|
+
(attribute
|
|
243
|
+
object: (identifier) @reference.receiver
|
|
244
|
+
attribute: (identifier) @reference.name)) @reference.call.member
|
|
245
|
+
|
|
246
|
+
;; Decorators — @a.b.decorator (nested attributes)
|
|
247
|
+
(decorator
|
|
248
|
+
(attribute
|
|
249
|
+
object: (attribute) @reference.receiver
|
|
250
|
+
attribute: (identifier) @reference.name)) @reference.call.member
|
|
251
|
+
|
|
235
252
|
;; References — calls
|
|
236
253
|
(call
|
|
237
254
|
function: (identifier) @reference.name) @reference.call.free
|
|
@@ -21,12 +21,13 @@ const pythonScopeResolver = {
|
|
|
21
21
|
languageProvider: pythonProvider,
|
|
22
22
|
importEdgeReason: 'python-scope: import',
|
|
23
23
|
resolveImportTarget: (targetRaw, fromFile, allFilePaths) => {
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// `
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
|
|
24
|
+
// Pass the orchestrator's stable run-level `ReadonlySet` straight through
|
|
25
|
+
// (no per-import copy). The Python resolver chain only reads the set, and
|
|
26
|
+
// `getPythonFileIndex` memoizes its index on the set's identity via a
|
|
27
|
+
// WeakMap — so the index is built once per run and reused across every
|
|
28
|
+
// import. Copying here (the previous `new Set(allFilePaths)`) handed a
|
|
29
|
+
// fresh identity to every import, defeating that cache (PR #1918 review P1).
|
|
30
|
+
const ws = { fromFile, allFilePaths };
|
|
30
31
|
// `WorkspaceIndex` is an opaque `unknown` placeholder in the
|
|
31
32
|
// shared contract, so `ws` passes structurally without a cast.
|
|
32
33
|
return resolvePythonImportTarget({ kind: 'named', localName: '_', importedName: '_', targetRaw }, ws);
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
* LanguageProvider, following the Strategy pattern used by the pipeline.
|
|
6
6
|
*
|
|
7
7
|
* Key Python traits:
|
|
8
|
-
* - importSemantics: 'namespace' (Python uses namespace imports, not wildcard)
|
|
9
8
|
* - mroStrategy: 'c3' (Python C3 linearization for multiple inheritance)
|
|
10
|
-
* - namedBindingExtractor: present (from X import Y)
|
|
11
9
|
*/
|
|
12
10
|
export declare const pythonProvider: import("../language-provider.js").LanguageProvider;
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
* LanguageProvider, following the Strategy pattern used by the pipeline.
|
|
6
6
|
*
|
|
7
7
|
* Key Python traits:
|
|
8
|
-
* - importSemantics: 'namespace' (Python uses namespace imports, not wildcard)
|
|
9
8
|
* - mroStrategy: 'c3' (Python C3 linearization for multiple inheritance)
|
|
10
|
-
* - namedBindingExtractor: present (from X import Y)
|
|
11
9
|
*/
|
|
12
10
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
13
11
|
import { createClassExtractor } from '../class-extractors/generic.js';
|
|
@@ -17,7 +15,6 @@ import { typeConfig as pythonConfig } from '../type-extractors/python.js';
|
|
|
17
15
|
import { pythonExportChecker } from '../export-detection.js';
|
|
18
16
|
import { createImportResolver } from '../import-resolvers/resolver-factory.js';
|
|
19
17
|
import { pythonImportConfig } from '../import-resolvers/configs/python.js';
|
|
20
|
-
import { extractPythonNamedBindings } from '../named-bindings/python.js';
|
|
21
18
|
import { PYTHON_QUERIES } from '../tree-sitter-queries.js';
|
|
22
19
|
import { createFieldExtractor } from '../field-extractors/generic.js';
|
|
23
20
|
import { pythonConfig as pythonFieldConfig } from '../field-extractors/configs/python.js';
|
|
@@ -27,7 +24,6 @@ import { createVariableExtractor } from '../variable-extractors/generic.js';
|
|
|
27
24
|
import { pythonVariableConfig } from '../variable-extractors/configs/python.js';
|
|
28
25
|
import { createCallExtractor } from '../call-extractors/generic.js';
|
|
29
26
|
import { pythonCallConfig } from '../call-extractors/configs/python.js';
|
|
30
|
-
import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
31
27
|
import { emitPythonScopeCaptures, pythonFunctionDefinitionLabel, interpretPythonImport, interpretPythonTypeBinding, pythonArityCompatibility, pythonBindingScopeFor, pythonImportOwningScope, pythonMergeBindings, pythonReceiverBinding, resolvePythonImportTarget, } from './python/index.js';
|
|
32
28
|
const BUILT_INS = new Set([
|
|
33
29
|
'print',
|
|
@@ -105,15 +101,12 @@ export const pythonProvider = defineLanguage({
|
|
|
105
101
|
typeConfig: pythonConfig,
|
|
106
102
|
exportChecker: pythonExportChecker,
|
|
107
103
|
importResolver: createImportResolver(pythonImportConfig),
|
|
108
|
-
namedBindingExtractor: extractPythonNamedBindings,
|
|
109
|
-
importSemantics: 'namespace',
|
|
110
104
|
mroStrategy: 'c3',
|
|
111
105
|
callExtractor: createCallExtractor(pythonCallConfig),
|
|
112
106
|
fieldExtractor: createFieldExtractor(pythonFieldConfig),
|
|
113
107
|
methodExtractor: createMethodExtractor(pythonMethodConfig),
|
|
114
108
|
variableExtractor: createVariableExtractor(pythonVariableConfig),
|
|
115
109
|
classExtractor: createClassExtractor(pythonClassConfig),
|
|
116
|
-
heritageExtractor: createHeritageExtractor(SupportedLanguages.Python),
|
|
117
110
|
descriptionExtractor: pythonDescriptionExtractor,
|
|
118
111
|
builtInNames: BUILT_INS,
|
|
119
112
|
labelOverride: pythonFunctionDefinitionLabel,
|