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,19 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { getProvider } from './languages/index.js';
|
|
4
|
-
import { generateId } from '../../lib/utils.js';
|
|
5
|
-
import { getLanguageFromFilename, SupportedLanguages } from '../../_shared/index.js';
|
|
6
|
-
import { extractVueScript, isVueSetupTopLevel } from './vue-sfc-extractor.js';
|
|
7
|
-
import { yieldToEventLoop } from './utils/event-loop.js';
|
|
8
|
-
import { parseSourceSafe } from '../tree-sitter/safe-parse.js';
|
|
9
|
-
import { isVerboseIngestionEnabled } from './utils/verbose.js';
|
|
10
|
-
import { getDefinitionNodeFromCaptures, findEnclosingClassInfo, findObjectLiteralBindingInfo, getLabelFromCaptures, CLASS_CONTAINER_TYPES, } from './utils/ast-helpers.js';
|
|
11
|
-
import { detectFrameworkFromAST } from './framework-detection.js';
|
|
12
|
-
import { buildTypeEnv } from './type-env.js';
|
|
13
|
-
import { buildMethodProps, arityForIdFromInfo, typeTagForId, constTagForId, buildCollisionGroups, parameterShapeIdTag, } from './utils/method-props.js';
|
|
14
|
-
import { extractTemplateArguments, templateArgumentsIdTag, templateConstraintsIdTag, } from './utils/template-arguments.js';
|
|
1
|
+
import { getLanguageFromFilename } from '../../_shared/index.js';
|
|
2
|
+
import { accumulateExportedTypesFromParsedNode } from './call-processor.js';
|
|
15
3
|
import { logger } from '../logger.js';
|
|
16
|
-
import { getTreeSitterBufferSize, getTreeSitterContentByteLength, TREE_SITTER_MAX_BUFFER, } from './constants.js';
|
|
17
4
|
// ============================================================================
|
|
18
5
|
// Worker-based parallel parsing
|
|
19
6
|
// ============================================================================
|
|
@@ -21,18 +8,14 @@ import { getTreeSitterBufferSize, getTreeSitterContentByteLength, TREE_SITTER_MA
|
|
|
21
8
|
* Merge a list of `ParseWorkerResult`s into the running graph + symbol
|
|
22
9
|
* table state and produce the chunk-aggregated `WorkerExtractedData`.
|
|
23
10
|
*
|
|
24
|
-
*
|
|
11
|
+
* Split out from the worker-parse path so the same merge logic can
|
|
25
12
|
* be applied to both freshly-parsed worker output AND cached worker
|
|
26
13
|
* output replayed during incremental analyze. Idempotent on the
|
|
27
14
|
* accumulator fields (push-only); idempotent on graph if the caller
|
|
28
15
|
* starts from a clean graph (otherwise duplicate `addNode` calls are
|
|
29
16
|
* silently no-op'd by `KnowledgeGraph`).
|
|
30
17
|
*/
|
|
31
|
-
export const mergeChunkResults = (graph, symbolTable, chunkResults) => {
|
|
32
|
-
const allImports = [];
|
|
33
|
-
const allCalls = [];
|
|
34
|
-
const allAssignments = [];
|
|
35
|
-
const allHeritage = [];
|
|
18
|
+
export const mergeChunkResults = (graph, symbolTable, chunkResults, exportedTypeMap) => {
|
|
36
19
|
const allRoutes = [];
|
|
37
20
|
const allFetchCalls = [];
|
|
38
21
|
const allFetchWrapperDefs = [];
|
|
@@ -42,7 +25,6 @@ export const mergeChunkResults = (graph, symbolTable, chunkResults) => {
|
|
|
42
25
|
const allRouterModuleAliases = [];
|
|
43
26
|
const allToolDefs = [];
|
|
44
27
|
const allORMQueries = [];
|
|
45
|
-
const allConstructorBindings = [];
|
|
46
28
|
const fileScopeBindingsByFile = [];
|
|
47
29
|
const allParsedFiles = [];
|
|
48
30
|
for (const result of chunkResults) {
|
|
@@ -69,14 +51,11 @@ export const mergeChunkResults = (graph, symbolTable, chunkResults) => {
|
|
|
69
51
|
qualifiedName: sym.qualifiedName,
|
|
70
52
|
});
|
|
71
53
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
allAssignments.push(item);
|
|
78
|
-
for (const item of result.heritage)
|
|
79
|
-
allHeritage.push(item);
|
|
54
|
+
if (exportedTypeMap) {
|
|
55
|
+
for (const node of result.nodes) {
|
|
56
|
+
accumulateExportedTypesFromParsedNode(exportedTypeMap, node, symbolTable);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
80
59
|
for (const item of result.routes)
|
|
81
60
|
allRoutes.push(item);
|
|
82
61
|
for (const item of result.fetchCalls)
|
|
@@ -96,8 +75,6 @@ export const mergeChunkResults = (graph, symbolTable, chunkResults) => {
|
|
|
96
75
|
if (result.ormQueries)
|
|
97
76
|
for (const item of result.ormQueries)
|
|
98
77
|
allORMQueries.push(item);
|
|
99
|
-
for (const item of result.constructorBindings)
|
|
100
|
-
allConstructorBindings.push(item);
|
|
101
78
|
if (result.fileScopeBindings)
|
|
102
79
|
for (const item of result.fileScopeBindings)
|
|
103
80
|
fileScopeBindingsByFile.push(item);
|
|
@@ -106,10 +83,6 @@ export const mergeChunkResults = (graph, symbolTable, chunkResults) => {
|
|
|
106
83
|
allParsedFiles.push(item);
|
|
107
84
|
}
|
|
108
85
|
return {
|
|
109
|
-
imports: allImports,
|
|
110
|
-
calls: allCalls,
|
|
111
|
-
assignments: allAssignments,
|
|
112
|
-
heritage: allHeritage,
|
|
113
86
|
routes: allRoutes,
|
|
114
87
|
fetchCalls: allFetchCalls,
|
|
115
88
|
fetchWrapperDefs: allFetchWrapperDefs,
|
|
@@ -119,21 +92,28 @@ export const mergeChunkResults = (graph, symbolTable, chunkResults) => {
|
|
|
119
92
|
routerModuleAliases: allRouterModuleAliases,
|
|
120
93
|
toolDefs: allToolDefs,
|
|
121
94
|
ormQueries: allORMQueries,
|
|
122
|
-
constructorBindings: allConstructorBindings,
|
|
123
95
|
fileScopeBindings: fileScopeBindingsByFile,
|
|
124
96
|
parsedFiles: allParsedFiles,
|
|
125
97
|
};
|
|
126
98
|
};
|
|
127
|
-
const processParsingWithWorkers = async (graph, files, symbolTable, astCache, workerPool, onFileProgress,
|
|
128
99
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
100
|
+
* Dispatch a chunk's files to the worker pool and return the RAW per-worker
|
|
101
|
+
* results, WITHOUT merging them into the graph. Split out from
|
|
102
|
+
* {@link processParsing} so the parse loop can overlap one chunk's
|
|
103
|
+
* merge (main-thread, via {@link mergeChunkResults}) with the NEXT chunk's
|
|
104
|
+
* worker parse — the merge is the only remaining serial main-thread step once
|
|
105
|
+
* ParsedFile serialization moved into the workers (#worker-idle pipelining).
|
|
106
|
+
* Returns `[]` for an all-unparseable chunk (the caller merges `[]` → empty).
|
|
134
107
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
108
|
+
export const dispatchChunkParse = async (files, workerPool, onFileProgress,
|
|
109
|
+
/** Populated in-place with the raw results (parse-cache capture). */
|
|
110
|
+
outRawResults,
|
|
111
|
+
/**
|
|
112
|
+
* Content hash of this parse chunk. When set, the workers tag their durable
|
|
113
|
+
* ParsedFile shards with it so a future warm cache hit can restore them
|
|
114
|
+
* (#2038). `undefined` ⇒ no durable write (tests / no-cache path).
|
|
115
|
+
*/
|
|
116
|
+
chunkHash) => {
|
|
137
117
|
const parseableFiles = [];
|
|
138
118
|
for (const file of files) {
|
|
139
119
|
const lang = getLanguageFromFilename(file.path);
|
|
@@ -141,39 +121,17 @@ outRawResults) => {
|
|
|
141
121
|
parseableFiles.push({ path: file.path, content: file.content });
|
|
142
122
|
}
|
|
143
123
|
if (parseableFiles.length === 0)
|
|
144
|
-
return
|
|
145
|
-
imports: [],
|
|
146
|
-
calls: [],
|
|
147
|
-
assignments: [],
|
|
148
|
-
heritage: [],
|
|
149
|
-
routes: [],
|
|
150
|
-
fetchCalls: [],
|
|
151
|
-
fetchWrapperDefs: [],
|
|
152
|
-
decoratorRoutes: [],
|
|
153
|
-
routerIncludes: [],
|
|
154
|
-
routerImports: [],
|
|
155
|
-
routerModuleAliases: [],
|
|
156
|
-
toolDefs: [],
|
|
157
|
-
ormQueries: [],
|
|
158
|
-
constructorBindings: [],
|
|
159
|
-
fileScopeBindings: [],
|
|
160
|
-
parsedFiles: [],
|
|
161
|
-
};
|
|
124
|
+
return [];
|
|
162
125
|
const total = files.length;
|
|
163
|
-
// Dispatch to worker pool — pool handles splitting into chunks and sub-batching
|
|
164
126
|
const chunkResults = await workerPool.dispatch(parseableFiles, (filesProcessed) => {
|
|
165
127
|
onFileProgress?.(Math.min(filesProcessed, total), total, 'Parsing...');
|
|
166
|
-
});
|
|
167
|
-
// Capture
|
|
168
|
-
// merging — the cache stores the unmerged worker output so a future run
|
|
169
|
-
// can re-merge them into a fresh graph state.
|
|
128
|
+
}, chunkHash);
|
|
129
|
+
// Capture raw results for the incremental parse cache before merging.
|
|
170
130
|
if (outRawResults) {
|
|
171
131
|
for (const r of chunkResults)
|
|
172
132
|
outRawResults.push(r);
|
|
173
133
|
}
|
|
174
|
-
//
|
|
175
|
-
const merged = mergeChunkResults(graph, symbolTable, chunkResults);
|
|
176
|
-
// Merge and log skipped languages from workers
|
|
134
|
+
// Skipped-language telemetry (worker output, independent of the merge).
|
|
177
135
|
const skippedLanguages = new Map();
|
|
178
136
|
for (const result of chunkResults) {
|
|
179
137
|
for (const [lang, count] of Object.entries(result.skippedLanguages)) {
|
|
@@ -186,497 +144,8 @@ outRawResults) => {
|
|
|
186
144
|
.join(', ');
|
|
187
145
|
logger.warn(` Skipped unsupported languages: ${summary}`);
|
|
188
146
|
}
|
|
189
|
-
// Final progress
|
|
190
147
|
onFileProgress?.(total, total, 'done');
|
|
191
|
-
return
|
|
192
|
-
};
|
|
193
|
-
// ============================================================================
|
|
194
|
-
// Sequential fallback (original implementation)
|
|
195
|
-
// ============================================================================
|
|
196
|
-
// Inline caches to avoid repeated parent-walks per node (same pattern as parse-worker.ts).
|
|
197
|
-
// Keyed by tree-sitter node reference — cleared at the start of each file.
|
|
198
|
-
const classInfoCache = new Map();
|
|
199
|
-
const exportCache = new Map();
|
|
200
|
-
const cachedFindEnclosingClassInfo = (node, filePath, resolveEnclosingOwner) => {
|
|
201
|
-
const cached = classInfoCache.get(node);
|
|
202
|
-
if (cached !== undefined)
|
|
203
|
-
return cached;
|
|
204
|
-
const result = findEnclosingClassInfo(node, filePath, resolveEnclosingOwner);
|
|
205
|
-
classInfoCache.set(node, result);
|
|
206
|
-
return result;
|
|
207
|
-
};
|
|
208
|
-
const cachedExportCheck = (checker, node, name) => {
|
|
209
|
-
const cached = exportCache.get(node);
|
|
210
|
-
if (cached !== undefined)
|
|
211
|
-
return cached;
|
|
212
|
-
const result = checker(node, name);
|
|
213
|
-
exportCache.set(node, result);
|
|
214
|
-
return result;
|
|
215
|
-
};
|
|
216
|
-
// FieldExtractor cache for sequential path — same pattern as parse-worker.ts
|
|
217
|
-
const seqFieldInfoCache = new Map();
|
|
218
|
-
// MethodExtractor cache for sequential path — avoids re-traversing the same class
|
|
219
|
-
// body once per method. Keyed on classNode.id (tree-sitter node identity number).
|
|
220
|
-
const seqMethodExtractCache = new Map();
|
|
221
|
-
// Derived method map + collision groups cache — avoids rebuilding per method.
|
|
222
|
-
const seqMethodMapCache = new Map();
|
|
223
|
-
/** Provider-aware enclosing container lookup.
|
|
224
|
-
* Walks up from `node` until a CLASS_CONTAINER_TYPES node is found.
|
|
225
|
-
* When `resolveEnclosingOwner` is provided, delegates language-specific
|
|
226
|
-
* container remapping (e.g., Ruby singleton_class → enclosing class).
|
|
227
|
-
* Without the hook, returns the first matching container directly (raw lookup). */
|
|
228
|
-
function seqFindEnclosingOwnerNode(node, resolveEnclosingOwner) {
|
|
229
|
-
let current = node.parent;
|
|
230
|
-
while (current) {
|
|
231
|
-
if (CLASS_CONTAINER_TYPES.has(current.type)) {
|
|
232
|
-
if (resolveEnclosingOwner) {
|
|
233
|
-
const resolved = resolveEnclosingOwner(current);
|
|
234
|
-
if (resolved === null) {
|
|
235
|
-
// Provider says skip this container — keep walking up.
|
|
236
|
-
current = current.parent;
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
return resolved;
|
|
240
|
-
}
|
|
241
|
-
return current;
|
|
242
|
-
}
|
|
243
|
-
current = current.parent;
|
|
244
|
-
}
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
/** Minimal no-op SymbolTable stub for sequential extractor contexts. The real
|
|
248
|
-
* SymbolTable is not fully populated yet at this stage, so use the stub for safety.
|
|
249
|
-
* Implements the full {@link SymbolTableReader} surface so future extractor additions
|
|
250
|
-
* don't silently fall off an `as unknown as` cast. */
|
|
251
|
-
const NOOP_SYMBOL_TABLE_SEQ = {
|
|
252
|
-
lookupExact: () => undefined,
|
|
253
|
-
lookupExactFull: () => undefined,
|
|
254
|
-
lookupExactAll: () => [],
|
|
255
|
-
lookupCallableByName: () => [],
|
|
256
|
-
getFiles: () => [][Symbol.iterator](),
|
|
257
|
-
getStats: () => ({ fileCount: 0 }),
|
|
258
|
-
};
|
|
259
|
-
function seqGetFieldInfo(classNode, provider, context) {
|
|
260
|
-
if (!provider.fieldExtractor)
|
|
261
|
-
return undefined;
|
|
262
|
-
const cacheKey = classNode.startIndex;
|
|
263
|
-
let cached = seqFieldInfoCache.get(cacheKey);
|
|
264
|
-
if (cached)
|
|
265
|
-
return cached;
|
|
266
|
-
const extracted = provider.fieldExtractor.extract(classNode, context);
|
|
267
|
-
if (!extracted?.fields?.length)
|
|
268
|
-
return undefined;
|
|
269
|
-
cached = new Map();
|
|
270
|
-
for (const field of extracted.fields)
|
|
271
|
-
cached.set(field.name, field);
|
|
272
|
-
seqFieldInfoCache.set(cacheKey, cached);
|
|
273
|
-
return cached;
|
|
274
|
-
}
|
|
275
|
-
const processParsingSequential = async (graph, files, symbolTable, astCache, scopeTreeCache, onFileProgress) => {
|
|
276
|
-
const parser = await loadParser();
|
|
277
|
-
const total = files.length;
|
|
278
|
-
const logSkipped = isVerboseIngestionEnabled();
|
|
279
|
-
const skippedByLang = logSkipped ? new Map() : null;
|
|
280
|
-
for (let i = 0; i < files.length; i++) {
|
|
281
|
-
const file = files[i];
|
|
282
|
-
// Reset memoization before each new file (node refs are per-tree)
|
|
283
|
-
classInfoCache.clear();
|
|
284
|
-
exportCache.clear();
|
|
285
|
-
seqFieldInfoCache.clear();
|
|
286
|
-
seqMethodExtractCache.clear();
|
|
287
|
-
seqMethodMapCache.clear();
|
|
288
|
-
onFileProgress?.(i + 1, total, file.path);
|
|
289
|
-
if (i % 20 === 0)
|
|
290
|
-
await yieldToEventLoop();
|
|
291
|
-
const language = getLanguageFromFilename(file.path);
|
|
292
|
-
if (!language)
|
|
293
|
-
continue;
|
|
294
|
-
if (!isLanguageAvailable(language)) {
|
|
295
|
-
if (skippedByLang) {
|
|
296
|
-
skippedByLang.set(language, (skippedByLang.get(language) ?? 0) + 1);
|
|
297
|
-
}
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
// Skip files larger than the max tree-sitter buffer (32 MB)
|
|
301
|
-
if (getTreeSitterContentByteLength(file.content) > TREE_SITTER_MAX_BUFFER)
|
|
302
|
-
continue;
|
|
303
|
-
// Vue SFC preprocessing: extract <script> block content
|
|
304
|
-
let parseContent = file.content;
|
|
305
|
-
let lineOffset = 0;
|
|
306
|
-
let isVueSetup = false;
|
|
307
|
-
if (language === SupportedLanguages.Vue) {
|
|
308
|
-
const extracted = extractVueScript(file.content);
|
|
309
|
-
if (!extracted)
|
|
310
|
-
continue; // skip .vue files with no script block
|
|
311
|
-
parseContent = extracted.scriptContent;
|
|
312
|
-
lineOffset = extracted.lineOffset;
|
|
313
|
-
isVueSetup = extracted.isSetup;
|
|
314
|
-
}
|
|
315
|
-
// Per-language source-text transform (e.g., UE macro stripping for C++).
|
|
316
|
-
// Length-preserving — see LanguageProvider.preprocessSource contract.
|
|
317
|
-
parseContent =
|
|
318
|
-
getProvider(language).preprocessSource?.(parseContent, file.path) ?? parseContent;
|
|
319
|
-
try {
|
|
320
|
-
await loadLanguage(language, file.path);
|
|
321
|
-
}
|
|
322
|
-
catch {
|
|
323
|
-
continue; // parser unavailable — safety net
|
|
324
|
-
}
|
|
325
|
-
let tree;
|
|
326
|
-
try {
|
|
327
|
-
tree = parseSourceSafe(parser, parseContent, undefined, {
|
|
328
|
-
bufferSize: getTreeSitterBufferSize(parseContent),
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
catch (parseError) {
|
|
332
|
-
logger.warn(`Skipping unparseable file: ${file.path}`);
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
astCache.set(file.path, tree);
|
|
336
|
-
const provider = getProvider(language);
|
|
337
|
-
// Mirror into the cross-phase cache only when the language has a
|
|
338
|
-
// scope-resolution consumer — otherwise we retain Trees no one
|
|
339
|
-
// reads. parse-impl clears `astCache` between chunks;
|
|
340
|
-
// `scopeTreeCache` survives until scope-resolution disposes it.
|
|
341
|
-
if (provider.emitScopeCaptures !== undefined) {
|
|
342
|
-
scopeTreeCache?.set(file.path, tree);
|
|
343
|
-
}
|
|
344
|
-
const queryString = provider.treeSitterQueries;
|
|
345
|
-
if (!queryString) {
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
let query;
|
|
349
|
-
let matches;
|
|
350
|
-
try {
|
|
351
|
-
const language = parser.getLanguage();
|
|
352
|
-
query = new Parser.Query(language, queryString);
|
|
353
|
-
matches = query.matches(tree.rootNode);
|
|
354
|
-
}
|
|
355
|
-
catch (queryError) {
|
|
356
|
-
logger.warn({ queryError }, `Query error for ${file.path}:`);
|
|
357
|
-
continue;
|
|
358
|
-
}
|
|
359
|
-
// Build per-file type environment for FieldExtractor context (lightweight — skipped if no fieldExtractor).
|
|
360
|
-
//
|
|
361
|
-
// Note: this TypeEnv is intentionally NOT flushed into the BindingAccumulator.
|
|
362
|
-
// The accumulator feed happens later in `call-processor.ts` via its own
|
|
363
|
-
// `typeEnv.flush(accumulator)` call. Flushing here would double-count
|
|
364
|
-
// file-scope bindings and break the single-use invariant of `flush()`.
|
|
365
|
-
// See the BindingAccumulator class JSDoc for the full accumulator
|
|
366
|
-
// lifecycle and flush-site ownership rules.
|
|
367
|
-
const typeEnv = provider.fieldExtractor
|
|
368
|
-
? buildTypeEnv(tree, language, {
|
|
369
|
-
enclosingFunctionFinder: provider.enclosingFunctionFinder,
|
|
370
|
-
extractFunctionName: provider.methodExtractor?.extractFunctionName,
|
|
371
|
-
})
|
|
372
|
-
: null;
|
|
373
|
-
matches.forEach((match) => {
|
|
374
|
-
const captureMap = {};
|
|
375
|
-
match.captures.forEach((c) => {
|
|
376
|
-
captureMap[c.name] = c.node;
|
|
377
|
-
});
|
|
378
|
-
const definitionNodeForRange = getDefinitionNodeFromCaptures(captureMap);
|
|
379
|
-
const definitionNode = getDefinitionNodeFromCaptures(captureMap);
|
|
380
|
-
const defaultNodeLabel = getLabelFromCaptures(captureMap, provider);
|
|
381
|
-
if (!defaultNodeLabel)
|
|
382
|
-
return;
|
|
383
|
-
const nameNode = captureMap['name'];
|
|
384
|
-
const extractedClassSymbol = definitionNode && provider.classExtractor?.isTypeDeclaration(definitionNode)
|
|
385
|
-
? provider.classExtractor.extract(definitionNode, {
|
|
386
|
-
name: nameNode?.text,
|
|
387
|
-
type: defaultNodeLabel,
|
|
388
|
-
})
|
|
389
|
-
: null;
|
|
390
|
-
const nodeLabel = extractedClassSymbol?.type ?? defaultNodeLabel;
|
|
391
|
-
const isClassLikeLabel = nodeLabel === 'Class' ||
|
|
392
|
-
nodeLabel === 'Struct' ||
|
|
393
|
-
nodeLabel === 'Interface' ||
|
|
394
|
-
nodeLabel === 'Enum' ||
|
|
395
|
-
nodeLabel === 'Record';
|
|
396
|
-
if (isClassLikeLabel &&
|
|
397
|
-
provider.classExtractor?.shouldSkipClassCapture?.({
|
|
398
|
-
captureMap,
|
|
399
|
-
definitionNode,
|
|
400
|
-
nameNode,
|
|
401
|
-
nodeLabel,
|
|
402
|
-
}) === true) {
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
// Synthesize name for constructors without explicit @name capture (e.g. Swift init)
|
|
406
|
-
if (!nameNode && nodeLabel !== 'Constructor' && !extractedClassSymbol)
|
|
407
|
-
return;
|
|
408
|
-
const nodeName = extractedClassSymbol?.name ?? (nameNode ? nameNode.text : 'init');
|
|
409
|
-
const startLine = definitionNodeForRange
|
|
410
|
-
? definitionNodeForRange.startPosition.row + lineOffset
|
|
411
|
-
: nameNode
|
|
412
|
-
? nameNode.startPosition.row + lineOffset
|
|
413
|
-
: lineOffset;
|
|
414
|
-
// Compute enclosing class BEFORE node ID — needed to qualify method IDs
|
|
415
|
-
const needsOwner = nodeLabel === 'Method' ||
|
|
416
|
-
nodeLabel === 'Constructor' ||
|
|
417
|
-
nodeLabel === 'Property' ||
|
|
418
|
-
nodeLabel === 'Function';
|
|
419
|
-
const enclosingClassInfo = needsOwner
|
|
420
|
-
? cachedFindEnclosingClassInfo(nameNode || definitionNodeForRange, file.path, provider.resolveEnclosingOwner)
|
|
421
|
-
: null;
|
|
422
|
-
const enclosingClassId = enclosingClassInfo?.classId ?? null;
|
|
423
|
-
const objectLiteralOwnerInfo = !enclosingClassId && nodeLabel === 'Method' && definitionNode
|
|
424
|
-
? findObjectLiteralBindingInfo(definitionNode, file.path)
|
|
425
|
-
: null;
|
|
426
|
-
// Qualify method/property IDs with enclosing class name to avoid collisions
|
|
427
|
-
// e.g. "Method:animal.dart:Animal.speak" vs "Method:animal.dart:Dog.speak"
|
|
428
|
-
const qualifiedName = enclosingClassInfo
|
|
429
|
-
? `${enclosingClassInfo.className}.${nodeName}`
|
|
430
|
-
: nodeName;
|
|
431
|
-
// Extract method metadata for Function/Method/Constructor nodes BEFORE generating
|
|
432
|
-
// the node ID — parameterCount is needed to disambiguate overloaded methods.
|
|
433
|
-
// Use the per-language MethodExtractor for method metadata (isAbstract, isStatic,
|
|
434
|
-
// visibility, annotations, parameterCount, parameterTypes, returnType, etc.).
|
|
435
|
-
const isMethodLike = nodeLabel === 'Function' || nodeLabel === 'Method' || nodeLabel === 'Constructor';
|
|
436
|
-
let methodProps = {};
|
|
437
|
-
let arityForId; // raw param count for ID, even for variadic
|
|
438
|
-
let seqDefMethodInfo;
|
|
439
|
-
let seqDefMethods;
|
|
440
|
-
let seqClassNodeId;
|
|
441
|
-
if (isMethodLike && definitionNode) {
|
|
442
|
-
let enriched = false;
|
|
443
|
-
if (provider.methodExtractor) {
|
|
444
|
-
// Try class-based extraction (method inside a class/struct/trait body).
|
|
445
|
-
// Raw lookup (no resolveEnclosingOwner) so the method extractor sees
|
|
446
|
-
// the actual container node (e.g. singleton_class) for static detection.
|
|
447
|
-
const methodOwnerNode = seqFindEnclosingOwnerNode(definitionNode);
|
|
448
|
-
if (methodOwnerNode) {
|
|
449
|
-
// Cache extract() results per class node to avoid re-traversing the
|
|
450
|
-
// same class body for every method it contains (O(N) -> O(1) per hit).
|
|
451
|
-
let result = seqMethodExtractCache.get(methodOwnerNode.id);
|
|
452
|
-
if (result === undefined) {
|
|
453
|
-
result =
|
|
454
|
-
provider.methodExtractor.extract(methodOwnerNode, {
|
|
455
|
-
filePath: file.path,
|
|
456
|
-
language,
|
|
457
|
-
}) ?? null;
|
|
458
|
-
seqMethodExtractCache.set(methodOwnerNode.id, result);
|
|
459
|
-
}
|
|
460
|
-
if (result?.methods?.length) {
|
|
461
|
-
const defLine = definitionNode.startPosition.row + 1;
|
|
462
|
-
const info = result.methods.find((m) => m.name === nodeName && m.line === defLine);
|
|
463
|
-
if (info) {
|
|
464
|
-
enriched = true;
|
|
465
|
-
arityForId = arityForIdFromInfo(info);
|
|
466
|
-
methodProps = buildMethodProps(info);
|
|
467
|
-
seqDefMethodInfo = info;
|
|
468
|
-
seqDefMethods = result.methods;
|
|
469
|
-
seqClassNodeId = methodOwnerNode.id;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
// For top-level methods (e.g. Go method_declaration), try extractFromNode
|
|
474
|
-
if (!enriched && provider.methodExtractor.extractFromNode) {
|
|
475
|
-
const info = provider.methodExtractor.extractFromNode(definitionNode, {
|
|
476
|
-
filePath: file.path,
|
|
477
|
-
language,
|
|
478
|
-
});
|
|
479
|
-
if (info) {
|
|
480
|
-
enriched = true;
|
|
481
|
-
arityForId = arityForIdFromInfo(info);
|
|
482
|
-
methodProps = buildMethodProps(info);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
// Append #<paramCount> to owned callable IDs to disambiguate overloads.
|
|
488
|
-
// Top-level Function IDs stay stable; functions inside an owner may overload.
|
|
489
|
-
// When same-arity collisions exist, append ~type1,type2 for further disambiguation.
|
|
490
|
-
const needsAritySuffix = nodeLabel === 'Method' ||
|
|
491
|
-
nodeLabel === 'Constructor' ||
|
|
492
|
-
(nodeLabel === 'Function' && enclosingClassId !== null);
|
|
493
|
-
let arityTag = needsAritySuffix && arityForId !== undefined ? `#${arityForId}` : '';
|
|
494
|
-
if (arityTag && seqDefMethods && seqDefMethodInfo && seqClassNodeId !== undefined) {
|
|
495
|
-
// Use cached method map + collision groups (built once per class, not per method)
|
|
496
|
-
let cached = seqMethodMapCache.get(seqClassNodeId);
|
|
497
|
-
if (!cached) {
|
|
498
|
-
const tempMap = new Map();
|
|
499
|
-
for (const m of seqDefMethods)
|
|
500
|
-
tempMap.set(`${m.name}:${m.line}`, m);
|
|
501
|
-
cached = { map: tempMap, groups: buildCollisionGroups(tempMap) };
|
|
502
|
-
seqMethodMapCache.set(seqClassNodeId, cached);
|
|
503
|
-
}
|
|
504
|
-
arityTag += typeTagForId(cached.map, nodeName, arityForId, seqDefMethodInfo, language, cached.groups);
|
|
505
|
-
arityTag += constTagForId(cached.map, nodeName, arityForId, seqDefMethodInfo, cached.groups);
|
|
506
|
-
}
|
|
507
|
-
const parameterShapeTag = nodeLabel === 'Function' || nodeLabel === 'Method'
|
|
508
|
-
? parameterShapeIdTag(methodProps.parameterTypes, methodProps.parameterTypeClasses)
|
|
509
|
-
: '';
|
|
510
|
-
const classTemplateArguments = extractedClassSymbol?.templateArguments ??
|
|
511
|
-
provider.classExtractor?.extractTemplateArgumentsFromCapture?.({
|
|
512
|
-
captureMap,
|
|
513
|
-
definitionNode,
|
|
514
|
-
nameNode,
|
|
515
|
-
}) ??
|
|
516
|
-
(captureMap['template-arguments']
|
|
517
|
-
? extractTemplateArguments(captureMap['template-arguments'].text)
|
|
518
|
-
: undefined) ??
|
|
519
|
-
(nameNode && nameNode.text ? extractTemplateArguments(nameNode.text) : undefined);
|
|
520
|
-
const classTemplateTag = (nodeLabel === 'Class' ||
|
|
521
|
-
nodeLabel === 'Struct' ||
|
|
522
|
-
nodeLabel === 'Interface' ||
|
|
523
|
-
nodeLabel === 'Enum' ||
|
|
524
|
-
nodeLabel === 'Record') &&
|
|
525
|
-
classTemplateArguments !== undefined &&
|
|
526
|
-
classTemplateArguments.length > 0
|
|
527
|
-
? templateArgumentsIdTag(classTemplateArguments)
|
|
528
|
-
: '';
|
|
529
|
-
// SFINAE / `requires`-clause aware ID disambiguation (issue #1579).
|
|
530
|
-
// Function-template overloads with identical parameterTypes but
|
|
531
|
-
// mutually-exclusive constraints (e.g. `enable_if_t<is_integral_v<T>>`
|
|
532
|
-
// vs `enable_if_t<is_floating_point_v<T>>`) need distinct graph
|
|
533
|
-
// nodes so the constraint-filter step in `narrowOverloadCandidates`
|
|
534
|
-
// has two candidates to narrow between. Without this tag they
|
|
535
|
-
// collapse to a single Function node and the SFINAE call resolves
|
|
536
|
-
// to only one edge regardless of which overload's constraint holds.
|
|
537
|
-
// The provider hook is the right invocation point — parsing-processor
|
|
538
|
-
// sees raw tree-sitter matches without the `@`-prefixed synthetic
|
|
539
|
-
// captures `scope-extractor` consumes, so we delegate extraction to
|
|
540
|
-
// the language adapter (C++ implements this; other languages opt out).
|
|
541
|
-
let parsedTemplateConstraints = undefined;
|
|
542
|
-
let constraintsTag = '';
|
|
543
|
-
if ((nodeLabel === 'Function' || nodeLabel === 'Method') &&
|
|
544
|
-
provider.extractTemplateConstraints !== undefined &&
|
|
545
|
-
definitionNode !== null) {
|
|
546
|
-
try {
|
|
547
|
-
parsedTemplateConstraints = provider.extractTemplateConstraints(definitionNode);
|
|
548
|
-
if (parsedTemplateConstraints !== undefined) {
|
|
549
|
-
constraintsTag = templateConstraintsIdTag(parsedTemplateConstraints);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
catch {
|
|
553
|
-
parsedTemplateConstraints = undefined;
|
|
554
|
-
constraintsTag = '';
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
const nodeId = generateId(nodeLabel, `${file.path}:${qualifiedName}${classTemplateTag}${arityTag}${constraintsTag}${parameterShapeTag}`);
|
|
558
|
-
const classNodeForSymbol = definitionNodeForRange || definitionNode || nameNode;
|
|
559
|
-
const qualifiedTypeName = extractedClassSymbol?.qualifiedName ??
|
|
560
|
-
(classNodeForSymbol && provider.classExtractor?.isTypeDeclaration(classNodeForSymbol)
|
|
561
|
-
? (provider.classExtractor.extractQualifiedName(classNodeForSymbol, nodeName) ?? nodeName)
|
|
562
|
-
: undefined);
|
|
563
|
-
const frameworkHint = definitionNode
|
|
564
|
-
? detectFrameworkFromAST(language, (definitionNode.text || '').slice(0, 300))
|
|
565
|
-
: null;
|
|
566
|
-
const node = {
|
|
567
|
-
id: nodeId,
|
|
568
|
-
label: nodeLabel,
|
|
569
|
-
properties: {
|
|
570
|
-
name: nodeName,
|
|
571
|
-
filePath: file.path,
|
|
572
|
-
startLine: definitionNodeForRange
|
|
573
|
-
? definitionNodeForRange.startPosition.row + lineOffset
|
|
574
|
-
: startLine,
|
|
575
|
-
endLine: definitionNodeForRange
|
|
576
|
-
? definitionNodeForRange.endPosition.row + lineOffset
|
|
577
|
-
: startLine,
|
|
578
|
-
language: language,
|
|
579
|
-
isExported: language === SupportedLanguages.Vue && isVueSetup
|
|
580
|
-
? isVueSetupTopLevel(nameNode || definitionNodeForRange)
|
|
581
|
-
: cachedExportCheck(provider.exportChecker, nameNode || definitionNodeForRange, nodeName),
|
|
582
|
-
...(qualifiedTypeName !== undefined ? { qualifiedName: qualifiedTypeName } : {}),
|
|
583
|
-
...(classTemplateArguments !== undefined && classTemplateArguments.length > 0
|
|
584
|
-
? { templateArguments: classTemplateArguments }
|
|
585
|
-
: {}),
|
|
586
|
-
...(parsedTemplateConstraints !== undefined
|
|
587
|
-
? { templateConstraints: parsedTemplateConstraints }
|
|
588
|
-
: {}),
|
|
589
|
-
...(frameworkHint
|
|
590
|
-
? {
|
|
591
|
-
astFrameworkMultiplier: frameworkHint.entryPointMultiplier,
|
|
592
|
-
astFrameworkReason: frameworkHint.reason,
|
|
593
|
-
}
|
|
594
|
-
: {}),
|
|
595
|
-
...methodProps,
|
|
596
|
-
},
|
|
597
|
-
};
|
|
598
|
-
graph.addNode(node);
|
|
599
|
-
// enclosingClassId already computed above (before nodeId generation)
|
|
600
|
-
// Extract declared type and field metadata for Property nodes
|
|
601
|
-
let declaredType;
|
|
602
|
-
let seqVisibility;
|
|
603
|
-
let seqIsStatic;
|
|
604
|
-
let seqIsReadonly;
|
|
605
|
-
if (nodeLabel === 'Property' && definitionNode) {
|
|
606
|
-
// FieldExtractor is the single source of truth when available
|
|
607
|
-
if (provider.fieldExtractor && typeEnv) {
|
|
608
|
-
const classNode = seqFindEnclosingOwnerNode(definitionNode, provider.resolveEnclosingOwner);
|
|
609
|
-
if (classNode) {
|
|
610
|
-
const fieldMap = seqGetFieldInfo(classNode, provider, {
|
|
611
|
-
typeEnv,
|
|
612
|
-
symbolTable: NOOP_SYMBOL_TABLE_SEQ,
|
|
613
|
-
filePath: file.path,
|
|
614
|
-
language,
|
|
615
|
-
});
|
|
616
|
-
const info = fieldMap?.get(nodeName);
|
|
617
|
-
if (info) {
|
|
618
|
-
declaredType = info.type ?? undefined;
|
|
619
|
-
seqVisibility = info.visibility;
|
|
620
|
-
seqIsStatic = info.isStatic;
|
|
621
|
-
seqIsReadonly = info.isReadonly;
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
// All 15 tree-sitter languages register a FieldExtractor — no fallback needed.
|
|
626
|
-
}
|
|
627
|
-
// Apply field metadata to the graph node retroactively
|
|
628
|
-
if (seqVisibility !== undefined)
|
|
629
|
-
node.properties.visibility = seqVisibility;
|
|
630
|
-
if (seqIsStatic !== undefined)
|
|
631
|
-
node.properties.isStatic = seqIsStatic;
|
|
632
|
-
if (seqIsReadonly !== undefined)
|
|
633
|
-
node.properties.isReadonly = seqIsReadonly;
|
|
634
|
-
if (declaredType !== undefined)
|
|
635
|
-
node.properties.declaredType = declaredType;
|
|
636
|
-
symbolTable.add(file.path, nodeName, nodeId, nodeLabel, {
|
|
637
|
-
parameterCount: methodProps.parameterCount,
|
|
638
|
-
requiredParameterCount: methodProps.requiredParameterCount,
|
|
639
|
-
parameterTypes: methodProps.parameterTypes,
|
|
640
|
-
parameterTypeClasses: methodProps.parameterTypeClasses,
|
|
641
|
-
returnType: methodProps.returnType,
|
|
642
|
-
declaredType,
|
|
643
|
-
templateArguments: classTemplateArguments,
|
|
644
|
-
ownerId: enclosingClassId ?? objectLiteralOwnerInfo?.ownerId ?? undefined,
|
|
645
|
-
qualifiedName: qualifiedTypeName,
|
|
646
|
-
});
|
|
647
|
-
const fileId = generateId('File', file.path);
|
|
648
|
-
const relId = generateId('DEFINES', `${fileId}->${nodeId}`);
|
|
649
|
-
const relationship = {
|
|
650
|
-
id: relId,
|
|
651
|
-
sourceId: fileId,
|
|
652
|
-
targetId: nodeId,
|
|
653
|
-
type: 'DEFINES',
|
|
654
|
-
confidence: 1.0,
|
|
655
|
-
reason: '',
|
|
656
|
-
};
|
|
657
|
-
graph.addRelationship(relationship);
|
|
658
|
-
// ── HAS_METHOD / HAS_PROPERTY: link member to enclosing class ──
|
|
659
|
-
const ownerIdForMemberEdge = enclosingClassId ?? objectLiteralOwnerInfo?.ownerId ?? null;
|
|
660
|
-
if (ownerIdForMemberEdge) {
|
|
661
|
-
const memberEdgeType = nodeLabel === 'Property' ? 'HAS_PROPERTY' : 'HAS_METHOD';
|
|
662
|
-
graph.addRelationship({
|
|
663
|
-
id: generateId(memberEdgeType, `${ownerIdForMemberEdge}->${nodeId}`),
|
|
664
|
-
sourceId: ownerIdForMemberEdge,
|
|
665
|
-
targetId: nodeId,
|
|
666
|
-
type: memberEdgeType,
|
|
667
|
-
confidence: 1.0,
|
|
668
|
-
reason: objectLiteralOwnerInfo
|
|
669
|
-
? 'object literal method belongs to exported object binding'
|
|
670
|
-
: '',
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
if (skippedByLang && skippedByLang.size > 0) {
|
|
676
|
-
for (const [lang, count] of skippedByLang.entries()) {
|
|
677
|
-
logger.warn(`[ingestion] Skipped ${count} ${lang} file(s) in parsing processing — ${lang} parser not available.`);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
148
|
+
return chunkResults;
|
|
680
149
|
};
|
|
681
150
|
// ============================================================================
|
|
682
151
|
// Public API
|
|
@@ -688,23 +157,13 @@ const processParsingSequential = async (graph, files, symbolTable, astCache, sco
|
|
|
688
157
|
* when the pool is garbage-collected.
|
|
689
158
|
*/
|
|
690
159
|
const loggedQuarantineByPool = new WeakMap();
|
|
691
|
-
export const processParsing = async (graph, files, symbolTable,
|
|
160
|
+
export const processParsing = async (graph, files, symbolTable, workerPool, onFileProgress,
|
|
692
161
|
/**
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
* Worker-mode parses skip — Trees can't cross MessageChannels.
|
|
697
|
-
* Pass `undefined` if no consumer needs cross-phase access.
|
|
162
|
+
* Optional out-parameter for the incremental parse cache. When provided,
|
|
163
|
+
* populated with the raw `ParseWorkerResult[]` from the workers (pre-merge).
|
|
164
|
+
* See `gitnexus/src/storage/parse-cache.ts`.
|
|
698
165
|
*/
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Optional out-parameter for the incremental parse cache. When
|
|
702
|
-
* provided AND the worker-pool path runs successfully, populated
|
|
703
|
-
* with the raw `ParseWorkerResult[]` from the workers (pre-merge).
|
|
704
|
-
* Stays empty for the sequential fallback path (no per-chunk
|
|
705
|
-
* artifact to cache there). See `gitnexus/src/storage/parse-cache.ts`.
|
|
706
|
-
*/
|
|
707
|
-
outRawResults) => {
|
|
166
|
+
outRawResults, exportedTypeMap) => {
|
|
708
167
|
let lastProgress = 0;
|
|
709
168
|
const reportProgress = onFileProgress
|
|
710
169
|
? (current, total, detail) => {
|
|
@@ -712,71 +171,48 @@ outRawResults) => {
|
|
|
712
171
|
onFileProgress(lastProgress, total, detail);
|
|
713
172
|
}
|
|
714
173
|
: undefined;
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
const quarantineSnapshot = workerPool.getQuarantinedPaths?.() ?? [];
|
|
755
|
-
const quarantineSet = new Set(quarantineSnapshot);
|
|
756
|
-
if (quarantineSet.size > 0) {
|
|
757
|
-
const quarantinedInChunk = files.filter((file) => quarantineSet.has(file.path));
|
|
758
|
-
if (quarantinedInChunk.length > 0) {
|
|
759
|
-
const seenForPool = loggedQuarantineByPool.get(workerPool) ?? new Set();
|
|
760
|
-
const newlyQuarantined = quarantinedInChunk
|
|
761
|
-
.map((file) => file.path)
|
|
762
|
-
.filter((p) => !seenForPool.has(p));
|
|
763
|
-
for (const p of newlyQuarantined)
|
|
764
|
-
seenForPool.add(p);
|
|
765
|
-
loggedQuarantineByPool.set(workerPool, seenForPool);
|
|
766
|
-
if (newlyQuarantined.length > 0) {
|
|
767
|
-
logger.warn({
|
|
768
|
-
newlyQuarantined,
|
|
769
|
-
cumulativeQuarantine: quarantineSet.size,
|
|
770
|
-
chunkSkipped: quarantinedInChunk.length,
|
|
771
|
-
}, `Worker quarantine: ${newlyQuarantined.length} new file(s) skipped this chunk ` +
|
|
772
|
-
`(${quarantinedInChunk.length} skipped total, ${quarantineSet.size} cumulative).`);
|
|
773
|
-
}
|
|
774
|
-
reportProgress?.(lastProgress, files.length, `${quarantinedInChunk.length} worker-quarantined file(s) skipped`);
|
|
174
|
+
// U20 design pivot: the worker pool's resilience layers (respawn budget,
|
|
175
|
+
// circuit breaker, quarantine, slot-attribution, cumulative timeout) are the
|
|
176
|
+
// SOLE contract for handling worker failures. There is no sequential parser:
|
|
177
|
+
// a partial quarantine drops the file from this run's graph (surfaced by the
|
|
178
|
+
// per-chunk warn below; the chunk-cache write-guard in parse-impl.ts keeps the
|
|
179
|
+
// chunk uncached so the next analyze retries with a fresh pool), and a full
|
|
180
|
+
// pool failure propagates `WorkerPoolDispatchError` so the run errors out.
|
|
181
|
+
const chunkResults = await dispatchChunkParse(files, workerPool, reportProgress, outRawResults);
|
|
182
|
+
const data = mergeChunkResults(graph, symbolTable, chunkResults, exportedTypeMap);
|
|
183
|
+
// Session-scoped quarantine (worker-pool resilience Layer 3): surface any
|
|
184
|
+
// files this pool has decided are unsafe for workers so the operator can see
|
|
185
|
+
// what was skipped. The pool already filtered them out of dispatch; we only
|
|
186
|
+
// need to log + progress-report. Quarantine is session-scoped per pool
|
|
187
|
+
// instance — a fresh `createWorkerPool` call clears it.
|
|
188
|
+
//
|
|
189
|
+
// Dedup: log the full path list only for entries newly quarantined since the
|
|
190
|
+
// previous dispatch on the same pool. The per-chunk progress message still
|
|
191
|
+
// surfaces the count for UX continuity, but the structured `quarantinedFiles`
|
|
192
|
+
// payload is only emitted when there is new signal — prevents
|
|
193
|
+
// O(quarantine × chunks) log spam.
|
|
194
|
+
const quarantineSnapshot = workerPool.getQuarantinedPaths?.() ?? [];
|
|
195
|
+
const quarantineSet = new Set(quarantineSnapshot);
|
|
196
|
+
if (quarantineSet.size > 0) {
|
|
197
|
+
const quarantinedInChunk = files.filter((file) => quarantineSet.has(file.path));
|
|
198
|
+
if (quarantinedInChunk.length > 0) {
|
|
199
|
+
const seenForPool = loggedQuarantineByPool.get(workerPool) ?? new Set();
|
|
200
|
+
const newlyQuarantined = quarantinedInChunk
|
|
201
|
+
.map((file) => file.path)
|
|
202
|
+
.filter((p) => !seenForPool.has(p));
|
|
203
|
+
for (const p of newlyQuarantined)
|
|
204
|
+
seenForPool.add(p);
|
|
205
|
+
loggedQuarantineByPool.set(workerPool, seenForPool);
|
|
206
|
+
if (newlyQuarantined.length > 0) {
|
|
207
|
+
logger.warn({
|
|
208
|
+
newlyQuarantined,
|
|
209
|
+
cumulativeQuarantine: quarantineSet.size,
|
|
210
|
+
chunkSkipped: quarantinedInChunk.length,
|
|
211
|
+
}, `Worker quarantine: ${newlyQuarantined.length} new file(s) skipped this chunk ` +
|
|
212
|
+
`(${quarantinedInChunk.length} skipped total, ${quarantineSet.size} cumulative).`);
|
|
775
213
|
}
|
|
214
|
+
reportProgress?.(lastProgress, files.length, `${quarantinedInChunk.length} worker-quarantined file(s) skipped`);
|
|
776
215
|
}
|
|
777
|
-
return data;
|
|
778
216
|
}
|
|
779
|
-
|
|
780
|
-
await processParsingSequential(graph, files, symbolTable, astCache, scopeTreeCache, reportProgress);
|
|
781
|
-
return null;
|
|
217
|
+
return data;
|
|
782
218
|
};
|