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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parentPort } from 'node:worker_threads';
|
|
1
|
+
import { parentPort, threadId, workerData } from 'node:worker_threads';
|
|
2
2
|
import Parser from 'tree-sitter';
|
|
3
3
|
import JavaScript from 'tree-sitter-javascript';
|
|
4
4
|
import TypeScript from 'tree-sitter-typescript';
|
|
@@ -16,6 +16,7 @@ import { createRequire } from 'node:module';
|
|
|
16
16
|
import { SupportedLanguages } from '../../../_shared/index.js';
|
|
17
17
|
import { getProvider } from '../languages/index.js';
|
|
18
18
|
import { getTreeSitterBufferSize, getTreeSitterContentByteLength, TREE_SITTER_MAX_BUFFER, } from '../constants.js';
|
|
19
|
+
import { ARRAY_METHOD_HOC_BLOCKLIST_SET, DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST_SET, deriveDefaultExportHocName, } from '../ts-js-hoc-utils.js';
|
|
19
20
|
import { parseSourceSafe } from '../../tree-sitter/safe-parse.js';
|
|
20
21
|
// tree-sitter-swift is an optionalDependency — may not be installed
|
|
21
22
|
const _require = createRequire(import.meta.url);
|
|
@@ -37,18 +38,55 @@ try {
|
|
|
37
38
|
}
|
|
38
39
|
catch { }
|
|
39
40
|
import { getLanguageFromFilename } from '../../../_shared/index.js';
|
|
40
|
-
import { FUNCTION_NODE_TYPES, getDefinitionNodeFromCaptures, findEnclosingClassInfo, findObjectLiteralBindingInfo, getLabelFromCaptures, genericFuncName, inferFunctionLabel, CLASS_CONTAINER_TYPES, } from '../utils/ast-helpers.js';
|
|
41
|
+
import { buildConcreteTypedefDefinitionRanges, FUNCTION_NODE_TYPES, findAncestorBeforeBoundary, getDefinitionNodeFromCaptures, findEnclosingClassInfo, findObjectLiteralBindingInfo, getLabelFromCaptures, genericFuncName, inferFunctionLabel, isSuppressedConcreteTypedefDuplicate, isQualifiableScopeLabel, qualifyRustImplTargetByModScope, CLASS_CONTAINER_TYPES, PARAMETER_LIST_NODE_TYPES, LOCAL_SCOPE_BODY_NODE_TYPES, } from '../utils/ast-helpers.js';
|
|
41
42
|
import { extractCallArgTypes } from '../utils/call-analysis.js';
|
|
42
43
|
import { buildTypeEnv } from '../type-env.js';
|
|
43
44
|
import { detectFrameworkFromAST } from '../framework-detection.js';
|
|
44
45
|
import { generateId } from '../../../lib/utils.js';
|
|
45
|
-
import { preprocessImportPath } from '../import-processor.js';
|
|
46
46
|
import { extractVueScript, extractTemplateComponents, isVueSetupTopLevel, } from '../vue-sfc-extractor.js';
|
|
47
47
|
import { buildMethodProps, arityForIdFromInfo, typeTagForId, constTagForId, buildCollisionGroups, parameterShapeIdTag, } from '../utils/method-props.js';
|
|
48
|
-
import { extractTemplateArguments, templateArgumentsIdTag } from '../utils/template-arguments.js';
|
|
48
|
+
import { extractTemplateArguments, templateArgumentsIdTag, templateConstraintsIdTag, } from '../utils/template-arguments.js';
|
|
49
49
|
import { extractParsedFile } from '../scope-extractor-bridge.js';
|
|
50
|
+
import { persistParsedFileShardSync, persistDurableParsedFileShardSync, } from '../../../storage/parsedfile-store.js';
|
|
50
51
|
import { extractLaravelRoutes } from '../route-extractors/laravel.js';
|
|
51
52
|
import { logger } from '../../logger.js';
|
|
53
|
+
// ── ParsedFile store (#1983 parallel serialization) ─────────────────────────
|
|
54
|
+
// Read ONCE at worker init from `workerData` (immutable for the run, inherited
|
|
55
|
+
// by respawned workers via the pool's factory closure). When set, this worker
|
|
56
|
+
// writes its own ParsedFile shards to disk at each job flush instead of
|
|
57
|
+
// returning them over the MessageChannel — parallelizing serialization off the
|
|
58
|
+
// main thread. `undefined` ⇒ return ParsedFiles in the result (no-store
|
|
59
|
+
// fallback). `shardSeq` makes each shard name unique within this worker; global
|
|
60
|
+
// uniqueness for the run rests on the process-monotonic `threadId` (never reused
|
|
61
|
+
// across respawns) plus the per-run store clear on the main thread.
|
|
62
|
+
const PARSED_FILE_STORE_STORAGE_PATH = workerData?.parsedFileStoreStoragePath;
|
|
63
|
+
// Durable, content-addressed ParsedFile store dir (#2038 warm-cache coverage).
|
|
64
|
+
// When set AND the flush carries a chunk hash, the worker ALSO writes its
|
|
65
|
+
// ParsedFiles to `<durableDir>/<chunkHash>/` so a future warm parse-cache hit
|
|
66
|
+
// restores them without re-parsing. `undefined` ⇒ no durable write.
|
|
67
|
+
const DURABLE_PARSED_FILE_STORAGE_PATH = workerData?.durableParsedFileStoragePath;
|
|
68
|
+
let shardSeq = 0;
|
|
69
|
+
// ── Bootstrap-stage diagnostics (#1741) ────────────────────────────────────
|
|
70
|
+
// When GITNEXUS_WORKER_BOOTSTRAP=1 (or --verbose sets GITNEXUS_VERBOSE), each
|
|
71
|
+
// worker reports its startup stage timings to stderr — which the pool tees
|
|
72
|
+
// and captures (worker-pool.ts captureWorkerStderr). This makes a slow or
|
|
73
|
+
// crashing startup diagnosable: you can see whether a worker reached
|
|
74
|
+
// "grammars loaded", "ready sent", or never emitted a line at all (=> it
|
|
75
|
+
// crashed in a native binding load before this code ran). The pool then
|
|
76
|
+
// attaches whatever stderr it captured to its readiness-failure message,
|
|
77
|
+
// so the operator sees the real cause instead of "did not report ready".
|
|
78
|
+
const BOOTSTRAP_LOG = process.env.GITNEXUS_WORKER_BOOTSTRAP === '1' || process.env.GITNEXUS_VERBOSE === '1';
|
|
79
|
+
const bootstrapStart = performance.now();
|
|
80
|
+
const bootstrapLog = (stage) => {
|
|
81
|
+
if (!BOOTSTRAP_LOG)
|
|
82
|
+
return;
|
|
83
|
+
const ms = Math.round(performance.now() - bootstrapStart);
|
|
84
|
+
process.stderr.write(`[parse-worker bootstrap] thread=${threadId} ${stage} (+${ms}ms)\n`);
|
|
85
|
+
};
|
|
86
|
+
// First line we can emit: every static import above (tree-sitter native
|
|
87
|
+
// bindings, language grammars, helper modules) has already resolved by the
|
|
88
|
+
// time this module-body statement runs.
|
|
89
|
+
bootstrapLog('imports + grammars loaded');
|
|
52
90
|
// ============================================================================
|
|
53
91
|
// Worker-local parser + language map
|
|
54
92
|
// ============================================================================
|
|
@@ -278,7 +316,7 @@ const findEnclosingFunctionId = (node, filePath, provider) => {
|
|
|
278
316
|
let current = node.parent;
|
|
279
317
|
while (current) {
|
|
280
318
|
if (FUNCTION_NODE_TYPES.has(current.type)) {
|
|
281
|
-
const efnResult = provider.methodExtractor?.extractFunctionName?.(current);
|
|
319
|
+
const efnResult = provider.methodExtractor?.extractFunctionName?.(current, filePath);
|
|
282
320
|
const funcName = efnResult?.funcName ?? genericFuncName(current);
|
|
283
321
|
const label = efnResult?.label ?? inferFunctionLabel(current.type);
|
|
284
322
|
if (funcName) {
|
|
@@ -399,11 +437,11 @@ const findEnclosingFunctionId = (node, filePath, provider) => {
|
|
|
399
437
|
return null;
|
|
400
438
|
};
|
|
401
439
|
/** Cached wrapper for findEnclosingClassInfo — avoids repeated parent walks. */
|
|
402
|
-
const cachedFindEnclosingClassInfo = (node, filePath, resolveEnclosingOwner) => {
|
|
440
|
+
const cachedFindEnclosingClassInfo = (node, filePath, resolveEnclosingOwner, getQualifiedOwnerName) => {
|
|
403
441
|
const cached = classIdCache.get(node);
|
|
404
442
|
if (cached !== undefined)
|
|
405
443
|
return cached;
|
|
406
|
-
const result = findEnclosingClassInfo(node, filePath, resolveEnclosingOwner);
|
|
444
|
+
const result = findEnclosingClassInfo(node, filePath, resolveEnclosingOwner, getQualifiedOwnerName);
|
|
407
445
|
classIdCache.set(node, result);
|
|
408
446
|
return result;
|
|
409
447
|
};
|
|
@@ -426,10 +464,8 @@ const processBatch = (files, onProgress) => {
|
|
|
426
464
|
nodes: [],
|
|
427
465
|
relationships: [],
|
|
428
466
|
symbols: [],
|
|
429
|
-
imports: [],
|
|
430
467
|
calls: [],
|
|
431
468
|
assignments: [],
|
|
432
|
-
heritage: [],
|
|
433
469
|
routes: [],
|
|
434
470
|
fetchCalls: [],
|
|
435
471
|
fetchWrapperDefs: [],
|
|
@@ -475,23 +511,16 @@ const processBatch = (files, onProgress) => {
|
|
|
475
511
|
const queryString = provider.treeSitterQueries;
|
|
476
512
|
if (!queryString) {
|
|
477
513
|
// Standalone providers (regex-based, no tree-sitter) that implement
|
|
478
|
-
// emitScopeCaptures
|
|
479
|
-
//
|
|
514
|
+
// emitScopeCaptures resolve via the scope-resolution pipeline, which
|
|
515
|
+
// re-extracts from source on the main thread.
|
|
480
516
|
if (provider.emitScopeCaptures) {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
}
|
|
489
|
-
}, undefined);
|
|
490
|
-
if (parsedFile !== undefined) {
|
|
491
|
-
result.parsedFiles.push(parsedFile);
|
|
492
|
-
result.fileCount++;
|
|
493
|
-
onFileProcessed?.();
|
|
494
|
-
}
|
|
517
|
+
// The worker no longer builds `ParsedFile`s for standalone providers
|
|
518
|
+
// either — scope-resolution re-extracts on the main thread, and for
|
|
519
|
+
// standalone COBOL the graph nodes come from cobolPhase, not this
|
|
520
|
+
// artifact (#1983). Count one unit of progress per file, as before.
|
|
521
|
+
for (let i = 0; i < langFiles.length; i++) {
|
|
522
|
+
result.fileCount++;
|
|
523
|
+
onFileProcessed?.();
|
|
495
524
|
}
|
|
496
525
|
}
|
|
497
526
|
continue;
|
|
@@ -712,6 +741,7 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
712
741
|
}
|
|
713
742
|
// Vue SFC preprocessing: extract <script> block content
|
|
714
743
|
let parseContent = file.content;
|
|
744
|
+
let scopeSourceKind = 'full-file';
|
|
715
745
|
let lineOffset = 0;
|
|
716
746
|
let isVueSetup = false;
|
|
717
747
|
if (language === SupportedLanguages.Vue) {
|
|
@@ -719,6 +749,7 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
719
749
|
if (!extracted)
|
|
720
750
|
continue; // skip .vue files with no script block
|
|
721
751
|
parseContent = extracted.scriptContent;
|
|
752
|
+
scopeSourceKind = 'pre-extracted-script';
|
|
722
753
|
lineOffset = extracted.lineOffset;
|
|
723
754
|
isVueSetup = extracted.isSetup;
|
|
724
755
|
}
|
|
@@ -747,13 +778,16 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
747
778
|
logger.warn(`Query execution failed for ${file.path}: ${err instanceof Error ? err.message : String(err)}`);
|
|
748
779
|
continue;
|
|
749
780
|
}
|
|
781
|
+
const concreteTypedefRanges = buildConcreteTypedefDefinitionRanges(matches);
|
|
750
782
|
const provider = getProvider(language);
|
|
751
|
-
//
|
|
752
|
-
//
|
|
753
|
-
//
|
|
754
|
-
//
|
|
755
|
-
//
|
|
756
|
-
//
|
|
783
|
+
// Produce the `ParsedFile` for the scope-resolution pipeline HERE, reusing
|
|
784
|
+
// the tree we just parsed (no second tree-sitter parse). Scope-resolution
|
|
785
|
+
// consumes these via the disk-backed parsedfile-store instead of
|
|
786
|
+
// re-extracting each file from source on the main thread — which
|
|
787
|
+
// accumulated an unbounded native tree-sitter leak on huge repos (#1983;
|
|
788
|
+
// see parsedfile-store.ts). parse-impl flushes `result.parsedFiles` to disk
|
|
789
|
+
// per chunk and does NOT retain them in main-thread heap, so this no longer
|
|
790
|
+
// costs ~1× the semantic model in RAM during parse.
|
|
757
791
|
const parsedFile = extractParsedFile(provider, parseContent, file.path, (message) => {
|
|
758
792
|
if (parentPort) {
|
|
759
793
|
parentPort.postMessage({ type: 'warning', message });
|
|
@@ -761,43 +795,34 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
761
795
|
else {
|
|
762
796
|
logger.warn(message);
|
|
763
797
|
}
|
|
764
|
-
}, tree);
|
|
765
|
-
if (parsedFile !== undefined)
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
});
|
|
783
|
-
for (const item of heritageItems) {
|
|
784
|
-
if (item.kind === 'extends') {
|
|
785
|
-
let parents = fileParentMap.get(item.className);
|
|
786
|
-
if (!parents) {
|
|
787
|
-
parents = [];
|
|
788
|
-
fileParentMap.set(item.className, parents);
|
|
789
|
-
}
|
|
790
|
-
if (!parents.includes(item.parentName))
|
|
791
|
-
parents.push(item.parentName);
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
}
|
|
798
|
+
}, tree, scopeSourceKind);
|
|
799
|
+
if (parsedFile !== undefined) {
|
|
800
|
+
// Capture-time side-channel (#1983): `extractParsedFile` just ran the
|
|
801
|
+
// provider's `emitScopeCaptures`, which (for C++ ADL/namespace marks,
|
|
802
|
+
// C `static`-linkage names, and Kotlin companion scopes) populated
|
|
803
|
+
// module-level maps as a SIDE EFFECT that is NOT on `parsedFile`'s
|
|
804
|
+
// scopes/defs. Snapshot
|
|
805
|
+
// that per-file state as plain data onto `ParsedFile.captureSideChannel`
|
|
806
|
+
// so the main thread can restore it (via `ScopeResolver.applyCaptureSideChannel`)
|
|
807
|
+
// WITHOUT a re-parse, after this ParsedFile crosses the worker boundary /
|
|
808
|
+
// disk store. Providers without capture-time side effects leave the hook
|
|
809
|
+
// undefined and this is a no-op. `undefined` return ⇒ no field added.
|
|
810
|
+
//
|
|
811
|
+
// `extractParsedFile` returns a frozen ParsedFile, so re-wrap (shallow
|
|
812
|
+
// copy — scopes/defs are carried by reference) to attach the field rather
|
|
813
|
+
// than mutate the frozen object.
|
|
814
|
+
const sideChannel = provider.collectCaptureSideChannel?.(file.path);
|
|
815
|
+
result.parsedFiles.push(sideChannel !== undefined ? { ...parsedFile, captureSideChannel: sideChannel } : parsedFile);
|
|
796
816
|
}
|
|
797
817
|
// Build per-file type environment + constructor bindings in a single AST walk.
|
|
798
|
-
//
|
|
799
|
-
|
|
818
|
+
// The legacy heritage pre-pass that seeded a file-local parentMap for
|
|
819
|
+
// buildTypeEnv was removed in RING4-1 (#942) along with the rest of the
|
|
820
|
+
// call-resolution DAG. Inheritance is now emitted by scope-resolution
|
|
821
|
+
// (preEmitInheritanceEdges + @reference.inherits), so buildTypeEnv runs with
|
|
822
|
+
// an empty parentMap — cross-file inheritance was never resolved here anyway.
|
|
823
|
+
const parentMap = new Map();
|
|
800
824
|
const typeEnv = buildTypeEnv(tree, language, {
|
|
825
|
+
filePath: file.path,
|
|
801
826
|
parentMap,
|
|
802
827
|
enclosingFunctionFinder: provider?.enclosingFunctionFinder,
|
|
803
828
|
extractFunctionName: provider?.methodExtractor?.extractFunctionName,
|
|
@@ -833,24 +858,18 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
833
858
|
// (e.g. @definition.function) to avoid duplicate nodes when @definition.const/@definition.variable
|
|
834
859
|
// patterns overlap with the same source range.
|
|
835
860
|
const processedDefinitionNodes = new Set();
|
|
861
|
+
const variableInfoCache = new Map();
|
|
836
862
|
for (const match of matches) {
|
|
837
863
|
const captureMap = {};
|
|
838
864
|
for (const c of match.captures) {
|
|
839
865
|
captureMap[c.name] = c.node;
|
|
840
866
|
}
|
|
841
|
-
|
|
867
|
+
if (isSuppressedConcreteTypedefDuplicate(captureMap, concreteTypedefRanges))
|
|
868
|
+
continue;
|
|
869
|
+
// Import matches: IMPORTS edges are emitted by the scope-resolution
|
|
870
|
+
// phase from finalized ImportEdges (RING4-1 #942 / RING4-2 #943 removed
|
|
871
|
+
// the legacy per-file import-map extraction that ran here). Skip.
|
|
842
872
|
if (captureMap['import'] && captureMap['import.source']) {
|
|
843
|
-
const rawImportPath = preprocessImportPath(captureMap['import.source'].text, captureMap['import'], provider);
|
|
844
|
-
if (!rawImportPath)
|
|
845
|
-
continue;
|
|
846
|
-
const extractor = provider.namedBindingExtractor;
|
|
847
|
-
const namedBindings = extractor ? extractor(captureMap['import']) : undefined;
|
|
848
|
-
result.imports.push({
|
|
849
|
-
filePath: file.path,
|
|
850
|
-
rawImportPath,
|
|
851
|
-
language: language,
|
|
852
|
-
...(namedBindings ? { namedBindings } : {}),
|
|
853
|
-
});
|
|
854
873
|
continue;
|
|
855
874
|
}
|
|
856
875
|
// Extract assignment sites (field write access)
|
|
@@ -1043,38 +1062,31 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1043
1062
|
// ── Path 2: Generic extraction via @call.name ────────────────
|
|
1044
1063
|
if (callNameNode) {
|
|
1045
1064
|
const calledName = callNameNode.text;
|
|
1046
|
-
//
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
for (const item of heritageItems) {
|
|
1051
|
-
result.heritage.push({
|
|
1052
|
-
filePath: file.path,
|
|
1053
|
-
className: item.className,
|
|
1054
|
-
parentName: item.parentName,
|
|
1055
|
-
kind: item.kind,
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
continue;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
// Dispatch: route language-specific calls (properties, imports)
|
|
1062
|
-
// Heritage routing is handled by heritageExtractor.extractFromCall above.
|
|
1065
|
+
// Dispatch: route language-specific calls (properties, imports).
|
|
1066
|
+
// Call-based heritage (Ruby include/extend/prepend) is no longer
|
|
1067
|
+
// routed here — those calls return 'skip' from the router and the
|
|
1068
|
+
// mixin edges are emitted by scope-resolution (emitHeritageEdges).
|
|
1063
1069
|
const routed = callRouter?.(calledName, captureMap['call']);
|
|
1064
1070
|
if (routed) {
|
|
1065
1071
|
if (routed.kind === 'skip')
|
|
1066
1072
|
continue;
|
|
1067
1073
|
if (routed.kind === 'import') {
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
});
|
|
1074
|
+
// Call-routed imports (e.g. Ruby `require`) are emitted as
|
|
1075
|
+
// IMPORTS edges by the scope-resolution phase; the legacy
|
|
1076
|
+
// per-file extraction that consumed these was removed in
|
|
1077
|
+
// RING4-2 (#943). Skip.
|
|
1073
1078
|
continue;
|
|
1074
1079
|
}
|
|
1075
1080
|
if (routed.kind === 'properties') {
|
|
1076
|
-
|
|
1077
|
-
|
|
1081
|
+
// #1978: thread the qualifier so a routed property's owner edge
|
|
1082
|
+
// points at the *qualified* nested-class node (Outer.Inner) rather
|
|
1083
|
+
// than a now-nonexistent simple `Class:file:Inner` id. Gated on the
|
|
1084
|
+
// flag → byte-identical when off. Mirrors the main owner path.
|
|
1085
|
+
const propGetQualifiedOwnerName = provider.classExtractor?.qualifiedNodeId === true
|
|
1086
|
+
? (node, simpleName) => provider.classExtractor.extractQualifiedName(node, simpleName)
|
|
1087
|
+
: undefined;
|
|
1088
|
+
const propEnclosingInfo = cachedFindEnclosingClassInfo(captureMap['call'], file.path, provider.resolveEnclosingOwner, propGetQualifiedOwnerName);
|
|
1089
|
+
const propEnclosingClassId = propEnclosingInfo?.qualifiedClassId ?? propEnclosingInfo?.classId ?? null;
|
|
1078
1090
|
// Enrich routed properties with FieldExtractor metadata
|
|
1079
1091
|
let routedFieldMap;
|
|
1080
1092
|
if (provider.fieldExtractor && typeEnv) {
|
|
@@ -1142,16 +1154,20 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1142
1154
|
? { isReadonly: routedFieldInfo.isReadonly }
|
|
1143
1155
|
: {}),
|
|
1144
1156
|
});
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1157
|
+
// Only emit File -> Property DEFINES for top-level properties
|
|
1158
|
+
// (issue #1944); class members are reached via HAS_PROPERTY.
|
|
1159
|
+
if (!propEnclosingClassId) {
|
|
1160
|
+
const fileId = generateId('File', file.path);
|
|
1161
|
+
const relId = generateId('DEFINES', `${fileId}->${nodeId}`);
|
|
1162
|
+
result.relationships.push({
|
|
1163
|
+
id: relId,
|
|
1164
|
+
sourceId: fileId,
|
|
1165
|
+
targetId: nodeId,
|
|
1166
|
+
type: 'DEFINES',
|
|
1167
|
+
confidence: 1.0,
|
|
1168
|
+
reason: '',
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1155
1171
|
if (propEnclosingClassId) {
|
|
1156
1172
|
result.relationships.push({
|
|
1157
1173
|
id: generateId('HAS_PROPERTY', `${propEnclosingClassId}->${nodeId}`),
|
|
@@ -1210,35 +1226,6 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1210
1226
|
}
|
|
1211
1227
|
continue;
|
|
1212
1228
|
}
|
|
1213
|
-
// Extract heritage (extends/implements) via provider heritage extractor
|
|
1214
|
-
if (captureMap['heritage.class']) {
|
|
1215
|
-
if (provider.heritageExtractor) {
|
|
1216
|
-
const heritageItems = provider.heritageExtractor.extract(captureMap, {
|
|
1217
|
-
filePath: file.path,
|
|
1218
|
-
language,
|
|
1219
|
-
});
|
|
1220
|
-
for (const item of heritageItems) {
|
|
1221
|
-
result.heritage.push({
|
|
1222
|
-
filePath: file.path,
|
|
1223
|
-
className: item.className,
|
|
1224
|
-
parentName: item.parentName,
|
|
1225
|
-
kind: item.kind,
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
// When the extractor consumes the match, skip symbol processing below.
|
|
1229
|
-
if (heritageItems.length > 0) {
|
|
1230
|
-
continue;
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
// Fallback: the extractor returned [] (or is absent), but the match still
|
|
1234
|
-
// carries a heritage-specific capture. The match belongs to a heritage
|
|
1235
|
-
// clause and must not fall through to generic symbol processing.
|
|
1236
|
-
if (captureMap['heritage.extends'] ||
|
|
1237
|
-
captureMap['heritage.implements'] ||
|
|
1238
|
-
captureMap['heritage.trait']) {
|
|
1239
|
-
continue;
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
1229
|
const definitionNode = getDefinitionNodeFromCaptures(captureMap);
|
|
1243
1230
|
const defaultNodeLabel = getLabelFromCaptures(captureMap, provider);
|
|
1244
1231
|
if (!defaultNodeLabel)
|
|
@@ -1265,21 +1252,52 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1265
1252
|
}) === true) {
|
|
1266
1253
|
continue;
|
|
1267
1254
|
}
|
|
1255
|
+
const exportDefaultCall = nodeLabel === 'Function' && definitionNode?.type === 'export_statement'
|
|
1256
|
+
? definitionNode.namedChildren.find((child) => child.type === 'call_expression')
|
|
1257
|
+
: undefined;
|
|
1258
|
+
const defaultExportHocName = (() => {
|
|
1259
|
+
if (exportDefaultCall === undefined)
|
|
1260
|
+
return null;
|
|
1261
|
+
const argList = exportDefaultCall.childForFieldName?.('arguments');
|
|
1262
|
+
const callback = argList?.namedChildren.find((child) => child.type === 'arrow_function' || child.type === 'function_expression');
|
|
1263
|
+
if (callback === undefined)
|
|
1264
|
+
return null;
|
|
1265
|
+
const callee = exportDefaultCall.childForFieldName?.('function');
|
|
1266
|
+
if (callee?.type === 'identifier' &&
|
|
1267
|
+
DEFAULT_EXPORT_IDENTIFIER_BLOCKLIST_SET.has(callee.text))
|
|
1268
|
+
return null;
|
|
1269
|
+
if (callee?.type === 'member_expression') {
|
|
1270
|
+
const property = callee.childForFieldName?.('property');
|
|
1271
|
+
if (property?.type === 'property_identifier' &&
|
|
1272
|
+
ARRAY_METHOD_HOC_BLOCKLIST_SET.has(property.text))
|
|
1273
|
+
return null;
|
|
1274
|
+
}
|
|
1275
|
+
return deriveDefaultExportHocName(file.path);
|
|
1276
|
+
})();
|
|
1277
|
+
// Synthesize name for constructors without explicit @name capture (e.g. Swift init)
|
|
1278
|
+
if (!nameNode &&
|
|
1279
|
+
nodeLabel !== 'Constructor' &&
|
|
1280
|
+
!extractedClassSymbol &&
|
|
1281
|
+
!defaultExportHocName)
|
|
1282
|
+
continue;
|
|
1283
|
+
const nodeName = extractedClassSymbol?.name ?? defaultExportHocName ?? (nameNode ? nameNode.text : 'init');
|
|
1268
1284
|
// Dedup: variable captures (Const/Static/Variable) may overlap with higher-priority
|
|
1269
1285
|
// captures (e.g. `const fn = () => {}` matches both @definition.function and @definition.const).
|
|
1270
|
-
//
|
|
1271
|
-
if ((nodeLabel === 'Const' || nodeLabel === 'Static' || nodeLabel === 'Variable') &&
|
|
1272
|
-
definitionNode &&
|
|
1273
|
-
processedDefinitionNodes.has(definitionNode.startIndex)) {
|
|
1274
|
-
continue;
|
|
1275
|
-
}
|
|
1286
|
+
// Multi-name declarations share the same definition node, so include the emitted name.
|
|
1276
1287
|
if (definitionNode) {
|
|
1277
|
-
|
|
1288
|
+
const definitionBaseKey = `${definitionNode.startIndex}`;
|
|
1289
|
+
if (nodeLabel === 'Const' || nodeLabel === 'Static' || nodeLabel === 'Variable') {
|
|
1290
|
+
const definitionNameKey = `${definitionBaseKey}:${nodeName}`;
|
|
1291
|
+
if (processedDefinitionNodes.has(definitionBaseKey) ||
|
|
1292
|
+
processedDefinitionNodes.has(definitionNameKey)) {
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
processedDefinitionNodes.add(definitionNameKey);
|
|
1296
|
+
}
|
|
1297
|
+
else {
|
|
1298
|
+
processedDefinitionNodes.add(definitionBaseKey);
|
|
1299
|
+
}
|
|
1278
1300
|
}
|
|
1279
|
-
// Synthesize name for constructors without explicit @name capture (e.g. Swift init)
|
|
1280
|
-
if (!nameNode && nodeLabel !== 'Constructor' && !extractedClassSymbol)
|
|
1281
|
-
continue;
|
|
1282
|
-
const nodeName = extractedClassSymbol?.name ?? (nameNode ? nameNode.text : 'init');
|
|
1283
1301
|
const startLine = definitionNode
|
|
1284
1302
|
? definitionNode.startPosition.row + lineOffset
|
|
1285
1303
|
: nameNode
|
|
@@ -1290,17 +1308,93 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1290
1308
|
nodeLabel === 'Constructor' ||
|
|
1291
1309
|
nodeLabel === 'Property' ||
|
|
1292
1310
|
nodeLabel === 'Function';
|
|
1293
|
-
|
|
1294
|
-
|
|
1311
|
+
// #1978: thread the class-extractor's qualifier into the owner walk when the
|
|
1312
|
+
// language opts into qualified node ids, so a nested member's owner resolves
|
|
1313
|
+
// to the *qualified* class id (Outer.Inner). Gated on the flag → byte-identical
|
|
1314
|
+
// when off. Mirrors parsing-processor.ts.
|
|
1315
|
+
const getQualifiedOwnerName = provider.classExtractor?.qualifiedNodeId === true
|
|
1316
|
+
? (node, simpleName) =>
|
|
1317
|
+
// #1991: LOCKSTEP — a Ruby `module` owner is not a typeDeclaration, so
|
|
1318
|
+
// extractQualifiedName returns null; fall back to the scope walk so a
|
|
1319
|
+
// method inside a nested module owns through the SAME qualified Trait
|
|
1320
|
+
// id its node uses on the worker path too.
|
|
1321
|
+
provider.classExtractor.extractQualifiedName(node, simpleName) ??
|
|
1322
|
+
provider.classExtractor.qualifyScopeName?.(node, simpleName) ??
|
|
1323
|
+
null
|
|
1324
|
+
: undefined;
|
|
1325
|
+
// A Property declared inside a function/lambda BODY is a function-LOCAL
|
|
1326
|
+
// binding (e.g. Kotlin `val (a,b) = pair` or a `for ((k,v) in m)` loop
|
|
1327
|
+
// destructuring emitted as `@definition.property` to dodge the local-symbol
|
|
1328
|
+
// pruner), NOT a class member. Such locals must not get a HAS_PROPERTY owner
|
|
1329
|
+
// edge from the enclosing class. Detect them by walking from the def node:
|
|
1330
|
+
// if a function-like ancestor is reached BEFORE any class container, the
|
|
1331
|
+
// property is enclosed by a function. Language-agnostic — genuine class
|
|
1332
|
+
// fields sit directly in the class body with no intervening function, so
|
|
1333
|
+
// they are unaffected (#1919 review CF3).
|
|
1334
|
+
//
|
|
1335
|
+
// EXCEPTION: a constructor PARAMETER property (TypeScript
|
|
1336
|
+
// `constructor(public name: string)`) is also enclosed by a function, but
|
|
1337
|
+
// it IS a class member — it is reached through the parameter list, not the
|
|
1338
|
+
// executable body. So only strip the owner when the property is NOT inside
|
|
1339
|
+
// a parameter list of that function (i.e. it's a body local).
|
|
1340
|
+
const propOwnerNode = nameNode || definitionNode;
|
|
1341
|
+
// A Property is function-local (and must NOT get a class HAS_PROPERTY owner)
|
|
1342
|
+
// when its nearest enclosing executable body — reached before any class
|
|
1343
|
+
// container — is a function/accessor/initializer body, AND it is not a
|
|
1344
|
+
// constructor parameter-property (rescued by the param-list carve-out).
|
|
1345
|
+
// Uses LOCAL_SCOPE_BODY_NODE_TYPES (not FUNCTION_NODE_TYPES): the latter
|
|
1346
|
+
// mis-includes Dart bare signatures (over-stripping accessors) and omits
|
|
1347
|
+
// Kotlin/Swift init+accessor bodies (under-stripping their locals) — see
|
|
1348
|
+
// the #1919 review of this guard.
|
|
1349
|
+
const isFunctionLocalProperty = nodeLabel === 'Property' &&
|
|
1350
|
+
propOwnerNode !== undefined &&
|
|
1351
|
+
findAncestorBeforeBoundary(propOwnerNode, LOCAL_SCOPE_BODY_NODE_TYPES, CLASS_CONTAINER_TYPES) !== null &&
|
|
1352
|
+
findAncestorBeforeBoundary(propOwnerNode, PARAMETER_LIST_NODE_TYPES, LOCAL_SCOPE_BODY_NODE_TYPES) === null;
|
|
1353
|
+
const enclosingClassInfo = needsOwner && !isFunctionLocalProperty
|
|
1354
|
+
? cachedFindEnclosingClassInfo(nameNode || definitionNode, file.path, provider.resolveEnclosingOwner, getQualifiedOwnerName)
|
|
1295
1355
|
: null;
|
|
1296
|
-
const enclosingClassId = enclosingClassInfo?.classId ?? null;
|
|
1356
|
+
const enclosingClassId = enclosingClassInfo?.qualifiedClassId ?? enclosingClassInfo?.classId ?? null;
|
|
1297
1357
|
const objectLiteralOwnerInfo = !enclosingClassId && nodeLabel === 'Method' && definitionNode
|
|
1298
1358
|
? findObjectLiteralBindingInfo(definitionNode, file.path)
|
|
1299
1359
|
: null;
|
|
1300
|
-
//
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1360
|
+
// #1978: hoisted ABOVE qualifiedName/node-id (load-bearing order) so a
|
|
1361
|
+
// class-like node can key its id by its fully-qualified path. Derived from
|
|
1362
|
+
// the SAME extractQualifiedName the owner edge uses → owner id == node id.
|
|
1363
|
+
const classNodeForSymbol = definitionNode || nameNode;
|
|
1364
|
+
const qualifiedTypeName = extractedClassSymbol?.qualifiedName ??
|
|
1365
|
+
(classNodeForSymbol && provider.classExtractor?.isTypeDeclaration(classNodeForSymbol)
|
|
1366
|
+
? (provider.classExtractor.extractQualifiedName(classNodeForSymbol, nodeName) ?? nodeName)
|
|
1367
|
+
: // #1991: LOCKSTEP with parsing-processor.ts — qualify a Ruby `module`
|
|
1368
|
+
// (Trait) via the scope walk so same-tail nested mixin modules get
|
|
1369
|
+
// distinct ids on the worker path too. Gated on qualifiedNodeId.
|
|
1370
|
+
isQualifiableScopeLabel(nodeLabel) &&
|
|
1371
|
+
provider.classExtractor?.qualifiedNodeId === true &&
|
|
1372
|
+
classNodeForSymbol
|
|
1373
|
+
? (provider.classExtractor.qualifyScopeName?.(classNodeForSymbol, nodeName) ??
|
|
1374
|
+
undefined)
|
|
1375
|
+
: undefined);
|
|
1376
|
+
// Qualify method/property IDs with enclosing class name to avoid collisions.
|
|
1377
|
+
// Class-like nodes use their own fully-qualified path as the id key when the
|
|
1378
|
+
// language enables qualifiedNodeId (#1978); everything else is unchanged.
|
|
1379
|
+
// #1982: LOCKSTEP with parsing-processor.ts — a Rust inherent-impl with an
|
|
1380
|
+
// UNSCOPED bare target is keyed by the enclosing `mod_item` scope so the
|
|
1381
|
+
// worker-path Impl node id matches the sequential path and the owner walk.
|
|
1382
|
+
const rustImplQualifiedName = nodeLabel === 'Impl' &&
|
|
1383
|
+
definitionNode?.type === 'impl_item' &&
|
|
1384
|
+
nameNode?.type === 'type_identifier'
|
|
1385
|
+
? qualifyRustImplTargetByModScope(definitionNode, nodeName)
|
|
1386
|
+
: undefined;
|
|
1387
|
+
const qualifiedName = rustImplQualifiedName !== undefined
|
|
1388
|
+
? rustImplQualifiedName
|
|
1389
|
+
: // #1991: LOCKSTEP — include Trait so a Ruby mixin module's qualified
|
|
1390
|
+
// scope id keys the worker-path node, matching the sequential path.
|
|
1391
|
+
(isClassLikeLabel || isQualifiableScopeLabel(nodeLabel)) &&
|
|
1392
|
+
provider.classExtractor?.qualifiedNodeId === true &&
|
|
1393
|
+
qualifiedTypeName !== undefined
|
|
1394
|
+
? qualifiedTypeName
|
|
1395
|
+
: enclosingClassInfo
|
|
1396
|
+
? `${enclosingClassInfo.className}.${nodeName}`
|
|
1397
|
+
: nodeName;
|
|
1304
1398
|
// Extract method metadata BEFORE generating node ID — parameterCount is needed
|
|
1305
1399
|
// to disambiguate overloaded methods via #<arity> suffix in the ID.
|
|
1306
1400
|
let declaredType;
|
|
@@ -1379,12 +1473,35 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1379
1473
|
classTemplateArguments.length > 0
|
|
1380
1474
|
? templateArgumentsIdTag(classTemplateArguments)
|
|
1381
1475
|
: '';
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1476
|
+
// SFINAE / `requires`-clause aware ID disambiguation (issue #1579).
|
|
1477
|
+
// Function-template overloads with identical parameterTypes but
|
|
1478
|
+
// mutually-exclusive constraints (e.g. `enable_if_t<is_integral_v<T>>`
|
|
1479
|
+
// vs `enable_if_t<is_floating_point_v<T>>`) need distinct graph nodes
|
|
1480
|
+
// so the constraint-filter step in `narrowOverloadCandidates` has two
|
|
1481
|
+
// candidates to narrow between. Without this tag they collapse to a
|
|
1482
|
+
// single Function node and the SFINAE call resolves to only one edge
|
|
1483
|
+
// regardless of which overload's constraint holds. This mirrors the
|
|
1484
|
+
// sequential `parsing-processor` path removed in #1983 — the worker is
|
|
1485
|
+
// now the sole parse path, so it must stamp the constraint tag and the
|
|
1486
|
+
// `templateConstraints` node property the resolver looks up by re-
|
|
1487
|
+
// hashing the def's constraints (see graph-bridge ids.ts / node-lookup.ts).
|
|
1488
|
+
let parsedTemplateConstraints = undefined;
|
|
1489
|
+
let constraintsTag = '';
|
|
1490
|
+
if ((nodeLabel === 'Function' || nodeLabel === 'Method') &&
|
|
1491
|
+
provider.extractTemplateConstraints !== undefined &&
|
|
1492
|
+
definitionNode) {
|
|
1493
|
+
try {
|
|
1494
|
+
parsedTemplateConstraints = provider.extractTemplateConstraints(definitionNode);
|
|
1495
|
+
if (parsedTemplateConstraints !== undefined) {
|
|
1496
|
+
constraintsTag = templateConstraintsIdTag(parsedTemplateConstraints);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
catch {
|
|
1500
|
+
parsedTemplateConstraints = undefined;
|
|
1501
|
+
constraintsTag = '';
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
const nodeId = generateId(nodeLabel, `${file.path}:${qualifiedName}${classTemplateTag}${arityTag}${parameterShapeTag}${constraintsTag}`);
|
|
1388
1505
|
const description = provider.descriptionExtractor?.(nodeLabel, nodeName, captureMap);
|
|
1389
1506
|
let frameworkHint = definitionNode
|
|
1390
1507
|
? detectFrameworkFromAST(language, (definitionNode.text || '').slice(0, 300))
|
|
@@ -1460,11 +1577,18 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1460
1577
|
if ((nodeLabel === 'Const' || nodeLabel === 'Static' || nodeLabel === 'Variable') &&
|
|
1461
1578
|
definitionNode &&
|
|
1462
1579
|
provider.variableExtractor) {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1580
|
+
let variableInfoByName = variableInfoCache.get(definitionNode.startIndex);
|
|
1581
|
+
if (!variableInfoByName) {
|
|
1582
|
+
const varCtx = {
|
|
1583
|
+
filePath: file.path,
|
|
1584
|
+
language,
|
|
1585
|
+
};
|
|
1586
|
+
variableInfoByName = new Map(provider.variableExtractor
|
|
1587
|
+
.extractAll(definitionNode, varCtx)
|
|
1588
|
+
.map((info) => [info.name, info]));
|
|
1589
|
+
variableInfoCache.set(definitionNode.startIndex, variableInfoByName);
|
|
1590
|
+
}
|
|
1591
|
+
const varInfo = variableInfoByName.get(nodeName);
|
|
1468
1592
|
if (varInfo) {
|
|
1469
1593
|
if (varInfo.type)
|
|
1470
1594
|
declaredType = varInfo.type;
|
|
@@ -1491,6 +1615,9 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1491
1615
|
...(classTemplateArguments !== undefined && classTemplateArguments.length > 0
|
|
1492
1616
|
? { templateArguments: classTemplateArguments }
|
|
1493
1617
|
: {}),
|
|
1618
|
+
...(parsedTemplateConstraints !== undefined
|
|
1619
|
+
? { templateConstraints: parsedTemplateConstraints }
|
|
1620
|
+
: {}),
|
|
1494
1621
|
...(frameworkHint
|
|
1495
1622
|
? {
|
|
1496
1623
|
astFrameworkMultiplier: frameworkHint.entryPointMultiplier,
|
|
@@ -1539,16 +1666,19 @@ const processFileGroup = (files, language, queryString, result, onFileProcessed)
|
|
|
1539
1666
|
? { annotations: methodProps.annotations }
|
|
1540
1667
|
: {}),
|
|
1541
1668
|
});
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1669
|
+
// Only emit File -> Symbol DEFINES for top-level symbols (issue #1944).
|
|
1670
|
+
if (ownerId === undefined) {
|
|
1671
|
+
const fileId = generateId('File', file.path);
|
|
1672
|
+
const relId = generateId('DEFINES', `${fileId}->${nodeId}`);
|
|
1673
|
+
result.relationships.push({
|
|
1674
|
+
id: relId,
|
|
1675
|
+
sourceId: fileId,
|
|
1676
|
+
targetId: nodeId,
|
|
1677
|
+
type: 'DEFINES',
|
|
1678
|
+
confidence: 1.0,
|
|
1679
|
+
reason: '',
|
|
1680
|
+
});
|
|
1681
|
+
}
|
|
1552
1682
|
// ── HAS_METHOD / HAS_PROPERTY: link member to enclosing class ──
|
|
1553
1683
|
if (ownerId !== undefined) {
|
|
1554
1684
|
const memberEdgeType = nodeLabel === 'Property' ? 'HAS_PROPERTY' : 'HAS_METHOD';
|
|
@@ -1613,10 +1743,8 @@ let accumulated = {
|
|
|
1613
1743
|
nodes: [],
|
|
1614
1744
|
relationships: [],
|
|
1615
1745
|
symbols: [],
|
|
1616
|
-
imports: [],
|
|
1617
1746
|
calls: [],
|
|
1618
1747
|
assignments: [],
|
|
1619
|
-
heritage: [],
|
|
1620
1748
|
routes: [],
|
|
1621
1749
|
fetchCalls: [],
|
|
1622
1750
|
fetchWrapperDefs: [],
|
|
@@ -1644,10 +1772,8 @@ const mergeResult = (target, src) => {
|
|
|
1644
1772
|
appendAll(target.nodes, src.nodes);
|
|
1645
1773
|
appendAll(target.relationships, src.relationships);
|
|
1646
1774
|
appendAll(target.symbols, src.symbols);
|
|
1647
|
-
appendAll(target.imports, src.imports);
|
|
1648
1775
|
appendAll(target.calls, src.calls);
|
|
1649
1776
|
appendAll(target.assignments, src.assignments);
|
|
1650
|
-
appendAll(target.heritage, src.heritage);
|
|
1651
1777
|
appendAll(target.routes, src.routes);
|
|
1652
1778
|
appendAll(target.fetchCalls, src.fetchCalls);
|
|
1653
1779
|
appendAll(target.fetchWrapperDefs, src.fetchWrapperDefs);
|
|
@@ -1685,6 +1811,7 @@ const mergeResult = (target, src) => {
|
|
|
1685
1811
|
// `WORKER_READY_TIMEOUT_MS` (5s), so emitting it AFTER all top-of-script
|
|
1686
1812
|
// init (imports, native binding loads, type-env setup) completes is the
|
|
1687
1813
|
// load-bearing signal that this worker is ready for dispatch.
|
|
1814
|
+
bootstrapLog('ready sent');
|
|
1688
1815
|
parentPort.postMessage({ type: 'ready' });
|
|
1689
1816
|
// Module-scope `TextDecoder` for sub-batch content. The pool sends each
|
|
1690
1817
|
// file's content as a `Uint8Array` (zero-copy ArrayBuffer transfer); we
|
|
@@ -1710,7 +1837,12 @@ function decodeSubBatchFiles(files) {
|
|
|
1710
1837
|
content: typeof f.content === 'string' ? f.content : sharedContentDecoder.decode(f.content),
|
|
1711
1838
|
}));
|
|
1712
1839
|
}
|
|
1840
|
+
let firstTaskLogged = false;
|
|
1713
1841
|
parentPort.on('message', (msg) => {
|
|
1842
|
+
if (!firstTaskLogged) {
|
|
1843
|
+
firstTaskLogged = true;
|
|
1844
|
+
bootstrapLog('first task received');
|
|
1845
|
+
}
|
|
1714
1846
|
try {
|
|
1715
1847
|
// Sub-batch mode: { type: 'sub-batch', files: [...] }
|
|
1716
1848
|
if (msg.type === 'sub-batch') {
|
|
@@ -1729,16 +1861,41 @@ parentPort.on('message', (msg) => {
|
|
|
1729
1861
|
}
|
|
1730
1862
|
// Flush: send accumulated results
|
|
1731
1863
|
if (msg.type === 'flush') {
|
|
1864
|
+
// #1983 parallel serialization: when a store path is configured, write
|
|
1865
|
+
// this job's ParsedFiles to our own disk shard HERE (at the flush
|
|
1866
|
+
// boundary, where `accumulated.parsedFiles` is complete) and drop them
|
|
1867
|
+
// from the result so the main thread never deserializes/re-serializes
|
|
1868
|
+
// them. Writing at flush — not per sub-batch — encodes the invariant
|
|
1869
|
+
// "a shard is written iff its result is delivered": a worker that dies
|
|
1870
|
+
// before flush wrote no shard, so the pool's job retry yields exactly
|
|
1871
|
+
// one. `undefined` store path keeps ParsedFiles in the result (no-store
|
|
1872
|
+
// fallback). The write is synchronous: blocking this dedicated worker
|
|
1873
|
+
// thread protects the main thread and avoids threading async through the
|
|
1874
|
+
// accumulate path; per-job write time is small vs the parse it follows.
|
|
1875
|
+
if ((PARSED_FILE_STORE_STORAGE_PATH || DURABLE_PARSED_FILE_STORAGE_PATH) &&
|
|
1876
|
+
accumulated.parsedFiles.length > 0) {
|
|
1877
|
+
const seq = shardSeq++;
|
|
1878
|
+
// #2038 warm-cache coverage: ALSO write a durable, content-addressed
|
|
1879
|
+
// shard keyed by chunk hash so a future warm parse-cache hit (no worker
|
|
1880
|
+
// runs) can restore these ParsedFiles without re-parsing. Same bytes,
|
|
1881
|
+
// same `seq`, so durable and run-scoped shards correlate. Only when the
|
|
1882
|
+
// flush carried a chunk hash (content-addressed dispatch).
|
|
1883
|
+
if (DURABLE_PARSED_FILE_STORAGE_PATH && typeof msg.chunkHash === 'string') {
|
|
1884
|
+
persistDurableParsedFileShardSync(DURABLE_PARSED_FILE_STORAGE_PATH, msg.chunkHash, threadId, seq, accumulated.parsedFiles);
|
|
1885
|
+
}
|
|
1886
|
+
if (PARSED_FILE_STORE_STORAGE_PATH) {
|
|
1887
|
+
persistParsedFileShardSync(PARSED_FILE_STORE_STORAGE_PATH, `w${threadId}-${seq}`, accumulated.parsedFiles);
|
|
1888
|
+
accumulated.parsedFiles = [];
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1732
1891
|
parentPort.postMessage({ type: 'result', data: accumulated });
|
|
1733
1892
|
// Reset for potential reuse
|
|
1734
1893
|
accumulated = {
|
|
1735
1894
|
nodes: [],
|
|
1736
1895
|
relationships: [],
|
|
1737
1896
|
symbols: [],
|
|
1738
|
-
imports: [],
|
|
1739
1897
|
calls: [],
|
|
1740
1898
|
assignments: [],
|
|
1741
|
-
heritage: [],
|
|
1742
1899
|
routes: [],
|
|
1743
1900
|
fetchCalls: [],
|
|
1744
1901
|
fetchWrapperDefs: [],
|
|
@@ -1759,7 +1916,21 @@ parentPort.on('message', (msg) => {
|
|
|
1759
1916
|
}
|
|
1760
1917
|
}
|
|
1761
1918
|
catch (err) {
|
|
1762
|
-
|
|
1763
|
-
|
|
1919
|
+
// Carry the worker-side stack across the MessageChannel, not just the
|
|
1920
|
+
// message. Without this, an unexpected worker throw (e.g. the minified
|
|
1921
|
+
// `this.#<x> is not a function` family) reaches the operator as a bare
|
|
1922
|
+
// one-liner with no file:line — exactly what made #2068 undebuggable. The
|
|
1923
|
+
// pool embeds `errorStack` into its death/circuit-breaker reason so the
|
|
1924
|
+
// surfaced "Phase 'parse' failed" message points at the real frame (the
|
|
1925
|
+
// stack's first line already carries the error's type + message). We send
|
|
1926
|
+
// primitive fields (not the raw Error) so a non-cloneable `cause` payload
|
|
1927
|
+
// can never turn the report itself into a `messageerror`. `errorStack` is
|
|
1928
|
+
// optional on the wire, so an older pool ignores it.
|
|
1929
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
1930
|
+
parentPort.postMessage({
|
|
1931
|
+
type: 'error',
|
|
1932
|
+
error: e.message,
|
|
1933
|
+
errorStack: e.stack,
|
|
1934
|
+
});
|
|
1764
1935
|
}
|
|
1765
1936
|
});
|