gitnexus 1.6.6-rc.99 → 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 +162 -3
- 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
|
@@ -3,6 +3,31 @@ import type { Capture, NodeLabel, Range } from '../../../_shared/index.js';
|
|
|
3
3
|
import type { LanguageProvider } from '../language-provider.js';
|
|
4
4
|
/** Tree-sitter AST node. Re-exported for use across ingestion modules. */
|
|
5
5
|
export type SyntaxNode = Parser.SyntaxNode;
|
|
6
|
+
/**
|
|
7
|
+
* Qualify a Rust inherent-impl target (`impl Inner { ... }`) by its enclosing
|
|
8
|
+
* `mod_item` scope, so a bare same-tail target nested under different modules
|
|
9
|
+
* resolves to a DISTINCT path (`outer.Inner` vs `other.Inner`) — the #1982
|
|
10
|
+
* follow-up to #1975. Walks `mod_item` ancestors (outermost → innermost) and
|
|
11
|
+
* joins them with the normalized raw target via the shared `splitQualifiedName`.
|
|
12
|
+
* A top-level `impl Inner` (no enclosing mod) returns the bare target unchanged.
|
|
13
|
+
* Keyed purely on tree-sitter node types (no language name), matching the
|
|
14
|
+
* inherent-impl branch in `findEnclosingClassInfo`; the caller restricts this to
|
|
15
|
+
* UNSCOPED targets (`type_identifier`) so a SCOPED `impl a::Inner` keeps its full
|
|
16
|
+
* raw text (#1975). The Impl-node materialization in parsing-processor /
|
|
17
|
+
* parse-worker mirrors this so the owner edge and node id agree byte-for-byte.
|
|
18
|
+
*/
|
|
19
|
+
export declare const qualifyRustImplTargetByModScope: (implNode: SyntaxNode, rawTargetText: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* #1991: scope-label predicate that single-sources the `nodeLabel === 'Trait'`
|
|
22
|
+
* checks in parsing-processor.ts / parse-worker.ts. A Ruby `module` maps to the
|
|
23
|
+
* `Trait` registry label but is NOT a typeDeclaration, so `extractQualifiedName`
|
|
24
|
+
* bails on it; these node labels are instead qualified via the scope walk
|
|
25
|
+
* (`qualifyScopeName`) so same-tail nested modules get distinct ids. Keeping the
|
|
26
|
+
* literal in one place stops the four hand-maintained copies (two each in the
|
|
27
|
+
* sequential and worker definition paths) from drifting apart. Pure predicate —
|
|
28
|
+
* value-identical to the inlined `nodeLabel === 'Trait'`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const isQualifiableScopeLabel: (nodeLabel: string) => boolean;
|
|
6
31
|
/**
|
|
7
32
|
* Ordered list of definition capture keys for tree-sitter query matches.
|
|
8
33
|
* Used to extract the definition node from a capture map.
|
|
@@ -10,6 +35,14 @@ export type SyntaxNode = Parser.SyntaxNode;
|
|
|
10
35
|
export declare const DEFINITION_CAPTURE_KEYS: readonly ["definition.function", "definition.class", "definition.interface", "definition.method", "definition.struct", "definition.enum", "definition.namespace", "definition.module", "definition.trait", "definition.impl", "definition.type", "definition.const", "definition.static", "definition.variable", "definition.typedef", "definition.macro", "definition.union", "definition.property", "definition.record", "definition.delegate", "definition.annotation", "definition.constructor", "definition.template"];
|
|
11
36
|
/** Extract the definition node from a tree-sitter query capture map. */
|
|
12
37
|
export declare const getDefinitionNodeFromCaptures: (captureMap: Record<string, SyntaxNode>) => SyntaxNode | null;
|
|
38
|
+
type QueryMatchLike = {
|
|
39
|
+
captures: Array<{
|
|
40
|
+
name: string;
|
|
41
|
+
node: SyntaxNode;
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
export declare const buildConcreteTypedefDefinitionRanges: (matches: readonly QueryMatchLike[]) => Set<string>;
|
|
45
|
+
export declare const isSuppressedConcreteTypedefDuplicate: (captureMap: Record<string, SyntaxNode>, concreteTypedefRanges: ReadonlySet<string>) => boolean;
|
|
13
46
|
/**
|
|
14
47
|
* Node types that represent function/method definitions across languages.
|
|
15
48
|
* Used by parent-walk in call-processor, parse-worker, and type-env to detect
|
|
@@ -31,6 +64,21 @@ export declare const FUNCTION_NODE_TYPES: Set<string>;
|
|
|
31
64
|
*/
|
|
32
65
|
export declare const CLASS_CONTAINER_TYPES: Set<string>;
|
|
33
66
|
export declare const CONTAINER_TYPE_TO_LABEL: Record<string, string>;
|
|
67
|
+
/**
|
|
68
|
+
* Pre-order walk over a node and all its named descendants, invoking `cb` on
|
|
69
|
+
* each. Replaces the per-language `visit`/`visitGo`/`visitRust`/`visitSwift`
|
|
70
|
+
* clones that every language's capture-synthesis walker re-implemented (#1956
|
|
71
|
+
* tri-review U6).
|
|
72
|
+
*
|
|
73
|
+
* Iterates by index with a null guard: `node.namedChild(i)` is typed
|
|
74
|
+
* `SyntaxNode | null`, and most callers already guarded it. The Go and C#
|
|
75
|
+
* callers previously iterated `node.namedChildren`; the Go one had no null
|
|
76
|
+
* guard, so this standardizes them onto the guarded indexed form — a deliberate,
|
|
77
|
+
* strictly-safer behavior addition (the traversal *sequence* is identical, so
|
|
78
|
+
* capture output stays byte-identical on well-formed trees; the guard only
|
|
79
|
+
* matters for a null named child, which the fixture corpus never produces).
|
|
80
|
+
*/
|
|
81
|
+
export declare function walkNamedTree(node: SyntaxNode, cb: (node: SyntaxNode) => void): void;
|
|
34
82
|
/** Return the first matching ancestor unless a boundary ancestor is reached first. */
|
|
35
83
|
export declare function findAncestorBeforeBoundary(node: SyntaxNode, targetTypes: ReadonlySet<string>, boundaryTypes: ReadonlySet<string>): SyntaxNode | null;
|
|
36
84
|
/**
|
|
@@ -44,8 +92,27 @@ export declare function getLabelFromCaptures(captureMap: Record<string, SyntaxNo
|
|
|
44
92
|
export interface EnclosingClassInfo {
|
|
45
93
|
classId: string;
|
|
46
94
|
className: string;
|
|
95
|
+
/**
|
|
96
|
+
* The owner node id keyed by the enclosing type's FULLY-QUALIFIED path
|
|
97
|
+
* (e.g. "Class:file:Outer.Inner"), present only when the language opts into
|
|
98
|
+
* `qualifiedNodeId` AND the enclosing type is actually nested (#1978).
|
|
99
|
+
* Consumers building HAS_METHOD/HAS_PROPERTY owner edges use this in
|
|
100
|
+
* preference to `classId` so the edge source matches the qualified class
|
|
101
|
+
* node id. When absent, `classId` (the simple-tail key) is unchanged.
|
|
102
|
+
*/
|
|
103
|
+
qualifiedClassId?: string;
|
|
47
104
|
}
|
|
48
|
-
export declare const findEnclosingClassInfo: (node: SyntaxNode, filePath: string, resolveEnclosingOwner?: (node: SyntaxNode) => SyntaxNode | null
|
|
105
|
+
export declare const findEnclosingClassInfo: (node: SyntaxNode, filePath: string, resolveEnclosingOwner?: (node: SyntaxNode) => SyntaxNode | null,
|
|
106
|
+
/**
|
|
107
|
+
* Optional (#1978): returns the enclosing type's fully-qualified name
|
|
108
|
+
* (e.g. "Outer.Inner") for a type-declaration container, or null. Callers
|
|
109
|
+
* pass `classExtractor.extractQualifiedName` ONLY when the language's
|
|
110
|
+
* `qualifiedNodeId` flag is on — so when omitted, behavior is byte-identical
|
|
111
|
+
* to before (qualifiedClassId stays undefined). Used by the standard
|
|
112
|
+
* class-container branch to compute `qualifiedClassId` from the SAME function
|
|
113
|
+
* the node-id is built from, guaranteeing owner-id == node-id by construction.
|
|
114
|
+
*/
|
|
115
|
+
getQualifiedOwnerName?: (node: SyntaxNode, simpleName: string) => string | null) => EnclosingClassInfo | null;
|
|
49
116
|
/** Object literal binding info for TS/JS shorthand methods. */
|
|
50
117
|
export interface ObjectLiteralBindingInfo {
|
|
51
118
|
ownerId: string;
|
|
@@ -106,6 +173,42 @@ export declare const CONSTRUCTOR_LABEL_NODE_TYPES: Set<string>;
|
|
|
106
173
|
export declare const inferFunctionLabel: (nodeType: string) => NodeLabel;
|
|
107
174
|
/** Argument list node types shared between countCallArguments and call-resolution helpers. */
|
|
108
175
|
export declare const CALL_ARGUMENT_LIST_TYPES: Set<string>;
|
|
176
|
+
/**
|
|
177
|
+
* Function/method parameter-list node types across grammars. Used to tell a
|
|
178
|
+
* PARAMETER-property (a constructor parameter that is also a class field, e.g.
|
|
179
|
+
* TypeScript `constructor(public name: string)`) apart from a function-BODY
|
|
180
|
+
* local: a property reached through one of these — rather than through the
|
|
181
|
+
* function's executable body — is a genuine class member, so the
|
|
182
|
+
* function-local-property guard must NOT strip its owner edge.
|
|
183
|
+
*/
|
|
184
|
+
export declare const PARAMETER_LIST_NODE_TYPES: Set<string>;
|
|
185
|
+
/**
|
|
186
|
+
* Executable local-scope boundaries for the property-ownership guard
|
|
187
|
+
* (`isFunctionLocalProperty` in parse-worker.ts). A `Property` capture whose
|
|
188
|
+
* nearest enclosing scope — walking up before any class container — is one of
|
|
189
|
+
* these executable bodies is a function-local binding, NOT a class member, so it
|
|
190
|
+
* must not receive a class `HAS_PROPERTY` owner edge.
|
|
191
|
+
*
|
|
192
|
+
* Derived from FUNCTION_NODE_TYPES, with two deliberate adjustments found by the
|
|
193
|
+
* #1919 review of the original guard:
|
|
194
|
+
* - EXCLUDES Dart's bare signature wrappers (`function_signature` /
|
|
195
|
+
* `method_signature`). A Dart getter/setter NAME lives under `method_signature`,
|
|
196
|
+
* yet it is a class-member declaration, not a local inside an executable body;
|
|
197
|
+
* treating the signature as a scope boundary OVER-stripped every Dart class
|
|
198
|
+
* accessor's owner edge. (Signatures are Dart-only; no language emits a
|
|
199
|
+
* legitimately-function-local Property under one.)
|
|
200
|
+
* - INCLUDES accessor + initializer bodies (Kotlin `anonymous_initializer` /
|
|
201
|
+
* `getter` / `setter`, Swift `computed_property` / `computed_getter` /
|
|
202
|
+
* `computed_setter` / `computed_modify`). Destructuring/locals inside these ARE
|
|
203
|
+
* function-local, yet they are absent from FUNCTION_NODE_TYPES; omitting them
|
|
204
|
+
* UNDER-stripped and emitted spurious class `HAS_PROPERTY` edges for
|
|
205
|
+
* `init {}` / accessor-body destructuring bindings.
|
|
206
|
+
*
|
|
207
|
+
* Kept separate from FUNCTION_NODE_TYPES because that set has many other consumers
|
|
208
|
+
* (e.g. enclosing-callable resolution) where signatures must remain function nodes
|
|
209
|
+
* and accessor bodies must not.
|
|
210
|
+
*/
|
|
211
|
+
export declare const LOCAL_SCOPE_BODY_NODE_TYPES: ReadonlySet<string>;
|
|
109
212
|
/** Walk an AST node depth-first, returning the first descendant with the given type. */
|
|
110
213
|
export declare function findDescendant(root: SyntaxNode, type: string): SyntaxNode | null;
|
|
111
214
|
/** Extract the text content from a string or encapsed_string AST node. */
|
|
@@ -130,3 +233,18 @@ export declare function syntheticCapture(name: string, atNode: SyntaxNode, text:
|
|
|
130
233
|
* row bounds — same optimization the prior recursive form used, minus
|
|
131
234
|
* the early-break since stack-push is cheap. */
|
|
132
235
|
export declare function findNodeAtRange(root: SyntaxNode, range: Range, expectedType?: string): SyntaxNode | null;
|
|
236
|
+
/**
|
|
237
|
+
* Return the captured node if its type is one of `types`, else null.
|
|
238
|
+
*
|
|
239
|
+
* The threaded-node equivalent of `findNodeAtRange(root, capture.range, type)`
|
|
240
|
+
* for the common case where a tree-sitter query already hands you the matched
|
|
241
|
+
* node (`c.node`): the captured node IS the node at that range, so a type check
|
|
242
|
+
* is exact and there is no need to re-walk from the tree root (the
|
|
243
|
+
* O(matches × rootChildren) hot path #1848 hit). Unlike `findNodeAtRange`, this
|
|
244
|
+
* does NOT traverse — the caller must already hold the node; for a multi-type
|
|
245
|
+
* call the node must literally be one of `types` (no fallback search).
|
|
246
|
+
*
|
|
247
|
+
* Used by every language's scope-capture path (go/python/ruby/php/rust/csharp).
|
|
248
|
+
*/
|
|
249
|
+
export declare function nodeIfType<T extends SyntaxNode>(node: T | undefined, ...types: readonly string[]): T | null;
|
|
250
|
+
export {};
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import { generateId } from '../../../lib/utils.js';
|
|
2
2
|
import { extractTemplateArguments, stripTemplateArguments, templateArgumentsIdTag, } from './template-arguments.js';
|
|
3
|
+
import { splitQualifiedName } from './qualified-name.js';
|
|
4
|
+
/**
|
|
5
|
+
* Qualify a Rust inherent-impl target (`impl Inner { ... }`) by its enclosing
|
|
6
|
+
* `mod_item` scope, so a bare same-tail target nested under different modules
|
|
7
|
+
* resolves to a DISTINCT path (`outer.Inner` vs `other.Inner`) — the #1982
|
|
8
|
+
* follow-up to #1975. Walks `mod_item` ancestors (outermost → innermost) and
|
|
9
|
+
* joins them with the normalized raw target via the shared `splitQualifiedName`.
|
|
10
|
+
* A top-level `impl Inner` (no enclosing mod) returns the bare target unchanged.
|
|
11
|
+
* Keyed purely on tree-sitter node types (no language name), matching the
|
|
12
|
+
* inherent-impl branch in `findEnclosingClassInfo`; the caller restricts this to
|
|
13
|
+
* UNSCOPED targets (`type_identifier`) so a SCOPED `impl a::Inner` keeps its full
|
|
14
|
+
* raw text (#1975). The Impl-node materialization in parsing-processor /
|
|
15
|
+
* parse-worker mirrors this so the owner edge and node id agree byte-for-byte.
|
|
16
|
+
*/
|
|
17
|
+
export const qualifyRustImplTargetByModScope = (implNode, rawTargetText) => {
|
|
18
|
+
const modSegments = [];
|
|
19
|
+
let current = implNode.parent;
|
|
20
|
+
while (current) {
|
|
21
|
+
if (current.type === 'mod_item') {
|
|
22
|
+
const nameNode = current.childForFieldName?.('name') ??
|
|
23
|
+
current.children?.find((c) => c.type === 'identifier');
|
|
24
|
+
if (nameNode)
|
|
25
|
+
modSegments.unshift(nameNode.text);
|
|
26
|
+
}
|
|
27
|
+
current = current.parent;
|
|
28
|
+
}
|
|
29
|
+
return [...modSegments, ...splitQualifiedName(rawTargetText)].filter(Boolean).join('.');
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* #1991: scope-label predicate that single-sources the `nodeLabel === 'Trait'`
|
|
33
|
+
* checks in parsing-processor.ts / parse-worker.ts. A Ruby `module` maps to the
|
|
34
|
+
* `Trait` registry label but is NOT a typeDeclaration, so `extractQualifiedName`
|
|
35
|
+
* bails on it; these node labels are instead qualified via the scope walk
|
|
36
|
+
* (`qualifyScopeName`) so same-tail nested modules get distinct ids. Keeping the
|
|
37
|
+
* literal in one place stops the four hand-maintained copies (two each in the
|
|
38
|
+
* sequential and worker definition paths) from drifting apart. Pure predicate —
|
|
39
|
+
* value-identical to the inlined `nodeLabel === 'Trait'`.
|
|
40
|
+
*/
|
|
41
|
+
export const isQualifiableScopeLabel = (nodeLabel) => nodeLabel === 'Trait';
|
|
3
42
|
/**
|
|
4
43
|
* Ordered list of definition capture keys for tree-sitter query matches.
|
|
5
44
|
* Used to extract the definition node from a capture map.
|
|
@@ -37,6 +76,32 @@ export const getDefinitionNodeFromCaptures = (captureMap) => {
|
|
|
37
76
|
}
|
|
38
77
|
return null;
|
|
39
78
|
};
|
|
79
|
+
const nodeRangeKey = (node) => `${node.startPosition.row}:${node.startPosition.column}:${node.endPosition.row}:${node.endPosition.column}`;
|
|
80
|
+
const isConcreteTypedefCapture = (captureMap) => {
|
|
81
|
+
const definitionNode = getDefinitionNodeFromCaptures(captureMap);
|
|
82
|
+
return (definitionNode?.type === 'type_definition' &&
|
|
83
|
+
(captureMap['definition.struct'] !== undefined || captureMap['definition.enum'] !== undefined));
|
|
84
|
+
};
|
|
85
|
+
export const buildConcreteTypedefDefinitionRanges = (matches) => {
|
|
86
|
+
const ranges = new Set();
|
|
87
|
+
for (const match of matches) {
|
|
88
|
+
const captureMap = {};
|
|
89
|
+
for (const capture of match.captures) {
|
|
90
|
+
captureMap[capture.name] = capture.node;
|
|
91
|
+
}
|
|
92
|
+
const definitionNode = getDefinitionNodeFromCaptures(captureMap);
|
|
93
|
+
if (definitionNode && isConcreteTypedefCapture(captureMap)) {
|
|
94
|
+
ranges.add(nodeRangeKey(definitionNode));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return ranges;
|
|
98
|
+
};
|
|
99
|
+
export const isSuppressedConcreteTypedefDuplicate = (captureMap, concreteTypedefRanges) => {
|
|
100
|
+
const definitionNode = getDefinitionNodeFromCaptures(captureMap);
|
|
101
|
+
return (definitionNode?.type === 'type_definition' &&
|
|
102
|
+
captureMap['definition.typedef'] !== undefined &&
|
|
103
|
+
concreteTypedefRanges.has(nodeRangeKey(definitionNode)));
|
|
104
|
+
};
|
|
40
105
|
/**
|
|
41
106
|
* Node types that represent function/method definitions across languages.
|
|
42
107
|
* Used by parent-walk in call-processor, parse-worker, and type-env to detect
|
|
@@ -77,6 +142,7 @@ export const FUNCTION_NODE_TYPES = new Set([
|
|
|
77
142
|
'anonymous_function',
|
|
78
143
|
// Kotlin
|
|
79
144
|
'lambda_literal',
|
|
145
|
+
'secondary_constructor', // F48: methodNodeTypes superset invariant
|
|
80
146
|
// Swift
|
|
81
147
|
'init_declaration',
|
|
82
148
|
'deinit_declaration',
|
|
@@ -122,6 +188,9 @@ export const CLASS_CONTAINER_TYPES = new Set([
|
|
|
122
188
|
// Kotlin
|
|
123
189
|
'object_declaration',
|
|
124
190
|
'companion_object',
|
|
191
|
+
// Go
|
|
192
|
+
'struct_type',
|
|
193
|
+
'interface_type',
|
|
125
194
|
]);
|
|
126
195
|
export const CONTAINER_TYPE_TO_LABEL = {
|
|
127
196
|
class_declaration: 'Class',
|
|
@@ -143,9 +212,9 @@ export const CONTAINER_TYPE_TO_LABEL = {
|
|
|
143
212
|
extension_declaration: 'Extension',
|
|
144
213
|
class: 'Class',
|
|
145
214
|
// Ruby `module` declarations map to `Trait` so they participate in the
|
|
146
|
-
// class-like type registry used by `lookupClassByName` /
|
|
147
|
-
// This lets `include` / `extend` / `prepend` mixin heritage
|
|
148
|
-
// the providing module. Safe for non-Ruby languages: the only supported
|
|
215
|
+
// class-like type registry used by `lookupClassByName` / inheritance
|
|
216
|
+
// resolution. This lets `include` / `extend` / `prepend` mixin heritage
|
|
217
|
+
// resolve to the providing module. Safe for non-Ruby languages: the only supported
|
|
149
218
|
// grammar that uses the bare `module` AST node type as a container is
|
|
150
219
|
// Ruby (Rust uses `mod_item`). Any new language adding a `module` node
|
|
151
220
|
// type must explicitly reclassify here.
|
|
@@ -153,7 +222,31 @@ export const CONTAINER_TYPE_TO_LABEL = {
|
|
|
153
222
|
singleton_class: 'Class', // Ruby: class << self inherits enclosing class name
|
|
154
223
|
object_declaration: 'Class',
|
|
155
224
|
companion_object: 'Class',
|
|
225
|
+
struct_type: 'Struct',
|
|
226
|
+
interface_type: 'Interface',
|
|
156
227
|
};
|
|
228
|
+
/**
|
|
229
|
+
* Pre-order walk over a node and all its named descendants, invoking `cb` on
|
|
230
|
+
* each. Replaces the per-language `visit`/`visitGo`/`visitRust`/`visitSwift`
|
|
231
|
+
* clones that every language's capture-synthesis walker re-implemented (#1956
|
|
232
|
+
* tri-review U6).
|
|
233
|
+
*
|
|
234
|
+
* Iterates by index with a null guard: `node.namedChild(i)` is typed
|
|
235
|
+
* `SyntaxNode | null`, and most callers already guarded it. The Go and C#
|
|
236
|
+
* callers previously iterated `node.namedChildren`; the Go one had no null
|
|
237
|
+
* guard, so this standardizes them onto the guarded indexed form — a deliberate,
|
|
238
|
+
* strictly-safer behavior addition (the traversal *sequence* is identical, so
|
|
239
|
+
* capture output stays byte-identical on well-formed trees; the guard only
|
|
240
|
+
* matters for a null named child, which the fixture corpus never produces).
|
|
241
|
+
*/
|
|
242
|
+
export function walkNamedTree(node, cb) {
|
|
243
|
+
cb(node);
|
|
244
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
245
|
+
const child = node.namedChild(i);
|
|
246
|
+
if (child !== null)
|
|
247
|
+
walkNamedTree(child, cb);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
157
250
|
/** Return the first matching ancestor unless a boundary ancestor is reached first. */
|
|
158
251
|
export function findAncestorBeforeBoundary(node, targetTypes, boundaryTypes) {
|
|
159
252
|
let current = node.parent;
|
|
@@ -175,7 +268,9 @@ export function findAncestorBeforeBoundary(node, targetTypes, boundaryTypes) {
|
|
|
175
268
|
export function getLabelFromCaptures(captureMap, provider) {
|
|
176
269
|
if (captureMap['import'] || captureMap['call'])
|
|
177
270
|
return null;
|
|
178
|
-
|
|
271
|
+
const hasDefaultExportHocNameSeed = captureMap['definition.function'] !== undefined &&
|
|
272
|
+
(captureMap['hoc'] !== undefined || captureMap['callee'] !== undefined);
|
|
273
|
+
if (!captureMap['name'] && !captureMap['definition.constructor'] && !hasDefaultExportHocNameSeed)
|
|
179
274
|
return null;
|
|
180
275
|
if (captureMap['definition.function']) {
|
|
181
276
|
if (provider.labelOverride) {
|
|
@@ -258,7 +353,17 @@ export function getLabelFromCaptures(captureMap, provider) {
|
|
|
258
353
|
* `MAX_ENCLOSING_WALK_ITERATIONS` defense-in-depth guard below prevents
|
|
259
354
|
* pathological hooks from creating an infinite loop. */
|
|
260
355
|
const MAX_ENCLOSING_WALK_ITERATIONS = 4096;
|
|
261
|
-
export const findEnclosingClassInfo = (node, filePath, resolveEnclosingOwner
|
|
356
|
+
export const findEnclosingClassInfo = (node, filePath, resolveEnclosingOwner,
|
|
357
|
+
/**
|
|
358
|
+
* Optional (#1978): returns the enclosing type's fully-qualified name
|
|
359
|
+
* (e.g. "Outer.Inner") for a type-declaration container, or null. Callers
|
|
360
|
+
* pass `classExtractor.extractQualifiedName` ONLY when the language's
|
|
361
|
+
* `qualifiedNodeId` flag is on — so when omitted, behavior is byte-identical
|
|
362
|
+
* to before (qualifiedClassId stays undefined). Used by the standard
|
|
363
|
+
* class-container branch to compute `qualifiedClassId` from the SAME function
|
|
364
|
+
* the node-id is built from, guaranteeing owner-id == node-id by construction.
|
|
365
|
+
*/
|
|
366
|
+
getQualifiedOwnerName) => {
|
|
262
367
|
let current = node.parent;
|
|
263
368
|
let iterations = 0;
|
|
264
369
|
// Tracks container nodes already visited via the hook so a misbehaving hook
|
|
@@ -330,8 +435,8 @@ export const findEnclosingClassInfo = (node, filePath, resolveEnclosingOwner) =>
|
|
|
330
435
|
}
|
|
331
436
|
}
|
|
332
437
|
// Rust impl_item: for `impl Trait for Struct {}`, pick the type after `for`
|
|
333
|
-
// NOTE: This impl_item ownership logic is
|
|
334
|
-
//
|
|
438
|
+
// NOTE: This impl_item ownership logic is mirrored in
|
|
439
|
+
// method-extractors/configs/rust.ts (extractOwnerName, metadata only).
|
|
335
440
|
if (current.type === 'impl_item') {
|
|
336
441
|
const children = current.children ?? [];
|
|
337
442
|
const forIdx = children.findIndex((c) => c.text === 'for');
|
|
@@ -342,18 +447,63 @@ export const findEnclosingClassInfo = (node, filePath, resolveEnclosingOwner) =>
|
|
|
342
447
|
c.type === 'scoped_type_identifier' ||
|
|
343
448
|
c.type === 'identifier');
|
|
344
449
|
if (nameNode) {
|
|
450
|
+
// `for` target keeps its raw text. A scoped path (impl T for a::Inner)
|
|
451
|
+
// therefore owns through `a::Inner`, which only resolves once the
|
|
452
|
+
// referenced struct is keyed by its qualified path — deferred to #1978.
|
|
345
453
|
return {
|
|
346
454
|
classId: generateId('Struct', `${filePath}:${nameNode.text}`),
|
|
347
455
|
className: nameNode.text,
|
|
348
456
|
};
|
|
349
457
|
}
|
|
350
458
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
459
|
+
// Inherent impl target.
|
|
460
|
+
// - SCOPED (`impl a::Inner`, scoped_type_identifier): key by FULL text,
|
|
461
|
+
// matching the @definition.impl scoped arm (#1975). UNCHANGED.
|
|
462
|
+
// - UNSCOPED (`impl Inner`, type_identifier): qualify by the enclosing
|
|
463
|
+
// `mod_item` scope (`outer.Inner`) so two same-tail bare impls under
|
|
464
|
+
// different mods own through DISTINCT nodes. The Impl-node
|
|
465
|
+
// materialization (parsing-processor / parse-worker) mirrors this, so
|
|
466
|
+
// the owner id == the Impl node id byte-for-byte (#1982).
|
|
467
|
+
// - GENERIC (`impl<T> Inner<T>`, generic_type): the @definition.impl
|
|
468
|
+
// node is materialized only when the generic base is a bare
|
|
469
|
+
// `type_identifier` (tree-sitter-queries.ts), qualified the same way —
|
|
470
|
+
// so drill into the base and mirror that gate, keeping the owner id ==
|
|
471
|
+
// the node id byte-for-byte (#1992). A generic over a SCOPED base
|
|
472
|
+
// (`impl<T> a::Inner<T>`) materializes NO node, so it must produce NO
|
|
473
|
+
// owner (the method orphans — scoped-generic deferred, #1992).
|
|
474
|
+
const implTarget = children.find((c) => c.type === 'type_identifier' ||
|
|
475
|
+
c.type === 'scoped_type_identifier' ||
|
|
476
|
+
c.type === 'generic_type');
|
|
477
|
+
if (implTarget) {
|
|
478
|
+
const baseType = implTarget.type === 'generic_type'
|
|
479
|
+
? (implTarget.childForFieldName?.('type') ?? null)
|
|
480
|
+
: implTarget;
|
|
481
|
+
if (baseType?.type === 'type_identifier') {
|
|
482
|
+
// Bare target (`impl Inner` or `impl<T> Inner<T>`): qualify by mod scope.
|
|
483
|
+
// #1992 follow-up: qualify `className` too (not just `classId`). The
|
|
484
|
+
// method node id is keyed `${className}.${name}`, so a bare tail collapses
|
|
485
|
+
// two same-tail bare impls that ALSO share a method name (`a::Inner::m` +
|
|
486
|
+
// `b::Inner::m` both → `Inner.m`) onto one Method node (graph addNode is
|
|
487
|
+
// first-write-wins). Qualifying className → `a.Inner.m` / `b.Inner.m` keeps
|
|
488
|
+
// them distinct. Symmetric: the call-resolution fallback rebuilds the same
|
|
489
|
+
// `${className}.${name}` from the same enclosing-impl walk, so def and call
|
|
490
|
+
// ids still agree. Owner edge anchors on `classId` (already qualified).
|
|
491
|
+
const qualified = qualifyRustImplTargetByModScope(current, baseType.text);
|
|
492
|
+
return {
|
|
493
|
+
classId: generateId('Impl', `${filePath}:${qualified}`),
|
|
494
|
+
className: qualified,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
if (baseType?.type === 'scoped_type_identifier' && implTarget.type !== 'generic_type') {
|
|
498
|
+
// Top-level scoped `impl a::Inner`: key by full raw text (#1975).
|
|
499
|
+
return {
|
|
500
|
+
classId: generateId('Impl', `${filePath}:${baseType.text}`),
|
|
501
|
+
className: baseType.text,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
// generic-over-scoped (`impl<T> a::Inner<T>`) and any other base: fall
|
|
505
|
+
// through with no owner — no @definition.impl node exists, so attributing
|
|
506
|
+
// a method to a synthesized id would orphan it against a phantom owner.
|
|
357
507
|
}
|
|
358
508
|
}
|
|
359
509
|
const nameNode = current.childForFieldName?.('name') ??
|
|
@@ -371,13 +521,42 @@ export const findEnclosingClassInfo = (node, filePath, resolveEnclosingOwner) =>
|
|
|
371
521
|
current.children?.some((c) => c.type === 'interface')) {
|
|
372
522
|
label = 'Interface';
|
|
373
523
|
}
|
|
524
|
+
// class_declaration with a `declaration_kind` field collapses several
|
|
525
|
+
// type kinds onto one node (tree-sitter-swift: class / struct / enum /
|
|
526
|
+
// extension / actor). The structure query labels struct → Struct and
|
|
527
|
+
// enum → Enum; refine the owner label to match so a member edge
|
|
528
|
+
// (HAS_METHOD / HAS_PROPERTY) anchors on the real Enum/Struct node id
|
|
529
|
+
// rather than a non-existent `Class:` id (F79). Gated on the field
|
|
530
|
+
// being present, so it is a no-op for grammars whose class_declaration
|
|
531
|
+
// has no `declaration_kind` field (e.g. Kotlin).
|
|
532
|
+
if (current.type === 'class_declaration' && label === 'Class') {
|
|
533
|
+
const declKind = current.childForFieldName?.('declaration_kind')?.text;
|
|
534
|
+
if (declKind === 'struct')
|
|
535
|
+
label = 'Struct';
|
|
536
|
+
else if (declKind === 'enum')
|
|
537
|
+
label = 'Enum';
|
|
538
|
+
}
|
|
374
539
|
const templateArguments = extractTemplateArguments(nameNode.text);
|
|
375
540
|
const classIdName = templateArguments !== undefined
|
|
376
541
|
? `${stripTemplateArguments(nameNode.text)}${templateArgumentsIdTag(templateArguments)}`
|
|
377
542
|
: nameNode.text;
|
|
543
|
+
// #1978: when the language opts into qualified node ids, key the owner
|
|
544
|
+
// edge by the enclosing type's qualified path (e.g. "Outer.Inner") so it
|
|
545
|
+
// matches the qualified class node id. Derived from the SAME
|
|
546
|
+
// extractQualifiedName the node-id uses → agree by construction. Only set
|
|
547
|
+
// when actually nested (qualified !== simple); top-level types are
|
|
548
|
+
// unchanged. (Go receiver / Rust impl branches return earlier and are
|
|
549
|
+
// intentionally untouched here.)
|
|
550
|
+
const qualifiedOwnerName = getQualifiedOwnerName?.(current, nameNode.text);
|
|
551
|
+
const qualifiedClassId = qualifiedOwnerName != null && qualifiedOwnerName !== nameNode.text
|
|
552
|
+
? generateId(label, `${filePath}:${templateArguments !== undefined
|
|
553
|
+
? `${stripTemplateArguments(qualifiedOwnerName)}${templateArgumentsIdTag(templateArguments)}`
|
|
554
|
+
: qualifiedOwnerName}`)
|
|
555
|
+
: undefined;
|
|
378
556
|
return {
|
|
379
557
|
classId: generateId(label, `${filePath}:${classIdName}`),
|
|
380
558
|
className: nameNode.text,
|
|
559
|
+
...(qualifiedClassId !== undefined ? { qualifiedClassId } : {}),
|
|
381
560
|
};
|
|
382
561
|
}
|
|
383
562
|
}
|
|
@@ -555,6 +734,58 @@ export const inferFunctionLabel = (nodeType) => METHOD_LABEL_NODE_TYPES.has(node
|
|
|
555
734
|
: 'Function';
|
|
556
735
|
/** Argument list node types shared between countCallArguments and call-resolution helpers. */
|
|
557
736
|
export const CALL_ARGUMENT_LIST_TYPES = new Set(['arguments', 'argument_list', 'value_arguments']);
|
|
737
|
+
/**
|
|
738
|
+
* Function/method parameter-list node types across grammars. Used to tell a
|
|
739
|
+
* PARAMETER-property (a constructor parameter that is also a class field, e.g.
|
|
740
|
+
* TypeScript `constructor(public name: string)`) apart from a function-BODY
|
|
741
|
+
* local: a property reached through one of these — rather than through the
|
|
742
|
+
* function's executable body — is a genuine class member, so the
|
|
743
|
+
* function-local-property guard must NOT strip its owner edge.
|
|
744
|
+
*/
|
|
745
|
+
export const PARAMETER_LIST_NODE_TYPES = new Set([
|
|
746
|
+
'formal_parameters', // TypeScript / JavaScript
|
|
747
|
+
'parameters', // Python / C#
|
|
748
|
+
'parameter_list', // Java / Go / C / Swift
|
|
749
|
+
'function_value_parameters', // Kotlin
|
|
750
|
+
'class_parameters', // Scala-like / future grammars
|
|
751
|
+
]);
|
|
752
|
+
/**
|
|
753
|
+
* Executable local-scope boundaries for the property-ownership guard
|
|
754
|
+
* (`isFunctionLocalProperty` in parse-worker.ts). A `Property` capture whose
|
|
755
|
+
* nearest enclosing scope — walking up before any class container — is one of
|
|
756
|
+
* these executable bodies is a function-local binding, NOT a class member, so it
|
|
757
|
+
* must not receive a class `HAS_PROPERTY` owner edge.
|
|
758
|
+
*
|
|
759
|
+
* Derived from FUNCTION_NODE_TYPES, with two deliberate adjustments found by the
|
|
760
|
+
* #1919 review of the original guard:
|
|
761
|
+
* - EXCLUDES Dart's bare signature wrappers (`function_signature` /
|
|
762
|
+
* `method_signature`). A Dart getter/setter NAME lives under `method_signature`,
|
|
763
|
+
* yet it is a class-member declaration, not a local inside an executable body;
|
|
764
|
+
* treating the signature as a scope boundary OVER-stripped every Dart class
|
|
765
|
+
* accessor's owner edge. (Signatures are Dart-only; no language emits a
|
|
766
|
+
* legitimately-function-local Property under one.)
|
|
767
|
+
* - INCLUDES accessor + initializer bodies (Kotlin `anonymous_initializer` /
|
|
768
|
+
* `getter` / `setter`, Swift `computed_property` / `computed_getter` /
|
|
769
|
+
* `computed_setter` / `computed_modify`). Destructuring/locals inside these ARE
|
|
770
|
+
* function-local, yet they are absent from FUNCTION_NODE_TYPES; omitting them
|
|
771
|
+
* UNDER-stripped and emitted spurious class `HAS_PROPERTY` edges for
|
|
772
|
+
* `init {}` / accessor-body destructuring bindings.
|
|
773
|
+
*
|
|
774
|
+
* Kept separate from FUNCTION_NODE_TYPES because that set has many other consumers
|
|
775
|
+
* (e.g. enclosing-callable resolution) where signatures must remain function nodes
|
|
776
|
+
* and accessor bodies must not.
|
|
777
|
+
*/
|
|
778
|
+
export const LOCAL_SCOPE_BODY_NODE_TYPES = new Set([...FUNCTION_NODE_TYPES]
|
|
779
|
+
.filter((t) => t !== 'function_signature' && t !== 'method_signature')
|
|
780
|
+
.concat([
|
|
781
|
+
'anonymous_initializer', // Kotlin: init { }
|
|
782
|
+
'getter', // Kotlin: val x get() { }
|
|
783
|
+
'setter', // Kotlin: var x set(v) { }
|
|
784
|
+
'computed_property', // Swift: var x: T { get set }
|
|
785
|
+
'computed_getter', // Swift: get { }
|
|
786
|
+
'computed_setter', // Swift: set { }
|
|
787
|
+
'computed_modify', // Swift: _modify { }
|
|
788
|
+
]));
|
|
558
789
|
// ============================================================================
|
|
559
790
|
// Generic AST traversal helpers (shared by parse-worker + php-helpers)
|
|
560
791
|
// ============================================================================
|
|
@@ -663,3 +894,19 @@ export function findNodeAtRange(root, range, expectedType) {
|
|
|
663
894
|
}
|
|
664
895
|
return null;
|
|
665
896
|
}
|
|
897
|
+
/**
|
|
898
|
+
* Return the captured node if its type is one of `types`, else null.
|
|
899
|
+
*
|
|
900
|
+
* The threaded-node equivalent of `findNodeAtRange(root, capture.range, type)`
|
|
901
|
+
* for the common case where a tree-sitter query already hands you the matched
|
|
902
|
+
* node (`c.node`): the captured node IS the node at that range, so a type check
|
|
903
|
+
* is exact and there is no need to re-walk from the tree root (the
|
|
904
|
+
* O(matches × rootChildren) hot path #1848 hit). Unlike `findNodeAtRange`, this
|
|
905
|
+
* does NOT traverse — the caller must already hold the node; for a multi-type
|
|
906
|
+
* call the node must literally be one of `types` (no fallback search).
|
|
907
|
+
*
|
|
908
|
+
* Used by every language's scope-capture path (go/python/ruby/php/rust/csharp).
|
|
909
|
+
*/
|
|
910
|
+
export function nodeIfType(node, ...types) {
|
|
911
|
+
return node !== undefined && types.includes(node.type) ? node : null;
|
|
912
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NodeLabel } from '../../../_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Callables whose same-name overloads occupy distinct graph nodes keyed by
|
|
4
|
+
* parameter types / shape. Shared by graph-bridge registration (`node-lookup.ts`)
|
|
5
|
+
* and resolution (`ids.ts`) so overload keys stay aligned.
|
|
6
|
+
*
|
|
7
|
+
* Constructors belong here: a class with `Foo()` and `Foo(int)` mints distinct
|
|
8
|
+
* `#0`/`#1` Constructor nodes, and a `: this(...)` / `: base(...)` (C#),
|
|
9
|
+
* `this(...)`/`super(...)` (Java), or `new Foo(args)` edge must reach the
|
|
10
|
+
* right overload — otherwise both ctor nodes collapse onto the first-wins
|
|
11
|
+
* qualified/simple key and a ctor chain becomes a self-loop (#1928 F38 / #2046).
|
|
12
|
+
*/
|
|
13
|
+
export declare function isOverloadableCallable(label: NodeLabel | undefined): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Callables whose same-name overloads occupy distinct graph nodes keyed by
|
|
3
|
+
* parameter types / shape. Shared by graph-bridge registration (`node-lookup.ts`)
|
|
4
|
+
* and resolution (`ids.ts`) so overload keys stay aligned.
|
|
5
|
+
*
|
|
6
|
+
* Constructors belong here: a class with `Foo()` and `Foo(int)` mints distinct
|
|
7
|
+
* `#0`/`#1` Constructor nodes, and a `: this(...)` / `: base(...)` (C#),
|
|
8
|
+
* `this(...)`/`super(...)` (Java), or `new Foo(args)` edge must reach the
|
|
9
|
+
* right overload — otherwise both ctor nodes collapse onto the first-wins
|
|
10
|
+
* qualified/simple key and a ctor chain becomes a self-loop (#1928 F38 / #2046).
|
|
11
|
+
*/
|
|
12
|
+
export function isOverloadableCallable(label) {
|
|
13
|
+
return label === 'Function' || label === 'Method' || label === 'Constructor';
|
|
14
|
+
}
|
|
@@ -10,12 +10,22 @@
|
|
|
10
10
|
* because the UI progress bar updates every 100 files and intermediate
|
|
11
11
|
* stages emit little to the log.
|
|
12
12
|
*/
|
|
13
|
+
/** Min wall-clock gap between always-on slow-file warnings (throttle). */
|
|
14
|
+
export declare const ALWAYS_ON_SLOW_FILE_WARN_THROTTLE_MS = 30000;
|
|
13
15
|
/** True when deferred-stage timing / progress logs should emit. */
|
|
14
16
|
export declare const isDeferredResolutionProfileEnabled: () => boolean;
|
|
15
17
|
/** Log a call-resolution progress line every N files (finer when verbose). */
|
|
16
18
|
export declare const deferredCallLogEveryN: () => number;
|
|
17
19
|
/** Per-file call-resolution log threshold (ms). Lower default when verbose. */
|
|
18
20
|
export declare const deferredCallFileSlowMs: () => number;
|
|
21
|
+
/**
|
|
22
|
+
* Always-on per-file slow threshold (ms) for the `logger.warn` watchdog in
|
|
23
|
+
* `processCallsFromExtracted`. Unlike {@link deferredCallFileSlowMs} this is
|
|
24
|
+
* NOT gated on verbose/profile — it fires on every run. `0` (or a negative /
|
|
25
|
+
* non-finite override) disables the watchdog entirely. Override via
|
|
26
|
+
* `GITNEXUS_SLOW_FILE_WARN_MS`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const alwaysOnSlowFileWarnMs: () => number;
|
|
19
29
|
export declare const profileNow: () => bigint;
|
|
20
30
|
export declare const profileElapsedMs: (start: bigint) => number;
|
|
21
31
|
/**
|
|
@@ -19,6 +19,19 @@ const LOG_EVERY_N_VERBOSE = 10;
|
|
|
19
19
|
const LOG_EVERY_N_PROFILE = 100;
|
|
20
20
|
const DEFAULT_SLOW_MS_VERBOSE = 3_000;
|
|
21
21
|
const DEFAULT_SLOW_MS = 5_000;
|
|
22
|
+
/**
|
|
23
|
+
* Always-on (NOT gated on verbose/profile) threshold above which a single
|
|
24
|
+
* file's deferred call resolution earns a `logger.warn`. The verbose
|
|
25
|
+
* slow-file profile (above) only fires with `-v`/`GITNEXUS_PROFILE_DEFERRED`;
|
|
26
|
+
* a plain `analyze` run that hangs in "Resolving calls" (the #1741 symptom)
|
|
27
|
+
* gives the user a frozen progress bar and nothing in the log. This higher
|
|
28
|
+
* default (15s — never hit by a healthy file) turns that silence into one
|
|
29
|
+
* actionable line naming the expensive file. Override via
|
|
30
|
+
* `GITNEXUS_SLOW_FILE_WARN_MS`; the throttle in the caller bounds volume.
|
|
31
|
+
*/
|
|
32
|
+
const DEFAULT_ALWAYS_ON_SLOW_FILE_WARN_MS = 15_000;
|
|
33
|
+
/** Min wall-clock gap between always-on slow-file warnings (throttle). */
|
|
34
|
+
export const ALWAYS_ON_SLOW_FILE_WARN_THROTTLE_MS = 30_000;
|
|
22
35
|
/** True when deferred-stage timing / progress logs should emit. */
|
|
23
36
|
export const isDeferredResolutionProfileEnabled = () => isVerboseIngestionEnabled() || parseTruthyEnv(process.env.GITNEXUS_PROFILE_DEFERRED);
|
|
24
37
|
/** Log a call-resolution progress line every N files (finer when verbose). */
|
|
@@ -35,6 +48,23 @@ export const deferredCallFileSlowMs = () => {
|
|
|
35
48
|
}
|
|
36
49
|
return isVerboseIngestionEnabled() ? DEFAULT_SLOW_MS_VERBOSE : DEFAULT_SLOW_MS;
|
|
37
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Always-on per-file slow threshold (ms) for the `logger.warn` watchdog in
|
|
53
|
+
* `processCallsFromExtracted`. Unlike {@link deferredCallFileSlowMs} this is
|
|
54
|
+
* NOT gated on verbose/profile — it fires on every run. `0` (or a negative /
|
|
55
|
+
* non-finite override) disables the watchdog entirely. Override via
|
|
56
|
+
* `GITNEXUS_SLOW_FILE_WARN_MS`.
|
|
57
|
+
*/
|
|
58
|
+
export const alwaysOnSlowFileWarnMs = () => {
|
|
59
|
+
const raw = process.env.GITNEXUS_SLOW_FILE_WARN_MS;
|
|
60
|
+
if (raw !== undefined) {
|
|
61
|
+
const n = Number(raw);
|
|
62
|
+
// 0 / negative / NaN → disabled. Use Number() not parseInt (see
|
|
63
|
+
// deferredCallFileSlowMs for the '1e9' prefix-parse hazard).
|
|
64
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
65
|
+
}
|
|
66
|
+
return DEFAULT_ALWAYS_ON_SLOW_FILE_WARN_MS;
|
|
67
|
+
};
|
|
38
68
|
export const profileNow = () => process.hrtime.bigint();
|
|
39
69
|
export const profileElapsedMs = (start) => Number(process.hrtime.bigint() - start) / 1e6;
|
|
40
70
|
// Module-private counter for `[deferred-profile]` log lines the underlying
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronous heap probes for large-repo OOM investigation (#1983).
|
|
3
|
+
*
|
|
4
|
+
* Writes to stderr (not pino) so lines flush under CI=1 / gdb attach.
|
|
5
|
+
* Enabled with `GITNEXUS_DEBUG_HEAP=1` or `GITNEXUS_PROFILE_DEFERRED=1`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isDebugHeapEnabled: () => boolean;
|
|
8
|
+
export declare const heapUsedMb: () => number;
|
|
9
|
+
/**
|
|
10
|
+
* Flush a one-line heap snapshot to stderr.
|
|
11
|
+
*
|
|
12
|
+
* stderr is async on a pipe (Linux), so a probe written just before an
|
|
13
|
+
* OOM-kill is lost in the pipe buffer. For OOM investigation set
|
|
14
|
+
* `GITNEXUS_HEAP_PROBE_FILE=/path` — each probe is then ALSO appended to
|
|
15
|
+
* that file with a synchronous `appendFileSync`, whose `write(2)` syscall
|
|
16
|
+
* completes (data handed to the kernel) before the call returns, so the
|
|
17
|
+
* last line survives SIGKILL. Includes rss alongside heapUsed so the
|
|
18
|
+
* native/off-heap gap is visible.
|
|
19
|
+
*/
|
|
20
|
+
export declare const logHeapProbe: (label: string, detail?: string) => void;
|