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
package/dist/mcp/resources.js
CHANGED
|
@@ -234,7 +234,7 @@ async function getReposResource(backend) {
|
|
|
234
234
|
if (repos.length > 1) {
|
|
235
235
|
lines.push('');
|
|
236
236
|
lines.push('# Multiple repos indexed. Use repo parameter in tool calls:');
|
|
237
|
-
lines.push(`#
|
|
237
|
+
lines.push(`# query({query: "auth", repo: "${repos[0].name}"})`);
|
|
238
238
|
}
|
|
239
239
|
return lines.join('\n');
|
|
240
240
|
}
|
|
@@ -308,7 +308,7 @@ async function getClustersResource(backend, repoName) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
if (result.clusters.length > displayLimit) {
|
|
311
|
-
lines.push(`\n# Showing top ${displayLimit} of ${result.clusters.length} modules. Use
|
|
311
|
+
lines.push(`\n# Showing top ${displayLimit} of ${result.clusters.length} modules. Use the query tool for deeper search.`);
|
|
312
312
|
}
|
|
313
313
|
return lines.join('\n');
|
|
314
314
|
}
|
|
@@ -335,7 +335,7 @@ async function getProcessesResource(backend, repoName) {
|
|
|
335
335
|
lines.push(` steps: ${proc.stepCount || 0}`);
|
|
336
336
|
}
|
|
337
337
|
if (result.processes.length > displayLimit) {
|
|
338
|
-
lines.push(`\n# Showing top ${displayLimit} of ${result.processes.length} processes. Use
|
|
338
|
+
lines.push(`\n# Showing top ${displayLimit} of ${result.processes.length} processes. Use the query tool for deeper search.`);
|
|
339
339
|
}
|
|
340
340
|
return lines.join('\n');
|
|
341
341
|
}
|
package/dist/mcp/server.js
CHANGED
|
@@ -287,7 +287,6 @@ export async function startMCPServer(backend) {
|
|
|
287
287
|
},
|
|
288
288
|
});
|
|
289
289
|
const transport = new CompatibleStdioServerTransport(process.stdin, safeStdout);
|
|
290
|
-
await server.connect(transport);
|
|
291
290
|
// Surface the redirect counter on shutdown so users see the volume of
|
|
292
291
|
// stray writes even when individual payloads were truncated/suppressed.
|
|
293
292
|
process.on('exit', () => sentinel.flushSummary());
|
|
@@ -337,9 +336,18 @@ export async function startMCPServer(backend) {
|
|
|
337
336
|
process.stderr.write(`GitNexus MCP unhandledRejection: ${reason?.stack || reason}\n`);
|
|
338
337
|
});
|
|
339
338
|
// Handle stdio errors — stdin close means the parent process is gone.
|
|
339
|
+
// Defense-in-depth: the transport also listens for stdin end/close and
|
|
340
|
+
// handles transport-level cleanup. These listeners handle process-level
|
|
341
|
+
// shutdown. Both paths are idempotent and safe to fire together.
|
|
340
342
|
// Wrap so the event payload (e.g. an Error for 'error') can never reach
|
|
341
343
|
// process.exit() as a non-numeric exit code, and void the returned promise.
|
|
342
344
|
process.stdin.on('end', () => void shutdown(0));
|
|
345
|
+
process.stdin.on('close', () => void shutdown(0));
|
|
343
346
|
process.stdin.on('error', () => void shutdown(0));
|
|
344
347
|
process.stdout.on('error', () => void shutdown(0));
|
|
348
|
+
if (process.stdin.readableEnded || process.stdin.destroyed) {
|
|
349
|
+
await shutdown(0);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
await server.connect(transport);
|
|
345
353
|
}
|
package/dist/storage/git.d.ts
CHANGED
|
@@ -107,6 +107,17 @@ export declare const hasGitDir: (dirPath: string) => boolean;
|
|
|
107
107
|
* `<rig>/refinery/rig/` layouts).
|
|
108
108
|
*/
|
|
109
109
|
export declare const getRemoteOriginUrl: (repoPath: string) => string | null;
|
|
110
|
+
/**
|
|
111
|
+
* Best-effort detection of the repository's default branch (#243).
|
|
112
|
+
*
|
|
113
|
+
* Reads `git symbolic-ref --short refs/remotes/origin/HEAD`, which resolves to
|
|
114
|
+
* the short ref `origin/<branch>` that the local `origin/HEAD` points at, and
|
|
115
|
+
* strips the `origin/` prefix. This is a purely local lookup — it never makes a
|
|
116
|
+
* network call. Returns `null` when there is no git repo, no `origin` remote, no
|
|
117
|
+
* `origin/HEAD` (e.g. it was never set by clone, or the repo is detached), or
|
|
118
|
+
* git is unavailable, so callers can fall back to a configured/default branch.
|
|
119
|
+
*/
|
|
120
|
+
export declare const getDefaultBranch: (repoPath: string) => string | null;
|
|
110
121
|
/**
|
|
111
122
|
* Sanitize a repository name to prevent argument injection and ensure
|
|
112
123
|
* cross-platform filesystem compatibility.
|
package/dist/storage/git.js
CHANGED
|
@@ -265,6 +265,36 @@ export const getRemoteOriginUrl = (repoPath) => {
|
|
|
265
265
|
return null;
|
|
266
266
|
}
|
|
267
267
|
};
|
|
268
|
+
/**
|
|
269
|
+
* Best-effort detection of the repository's default branch (#243).
|
|
270
|
+
*
|
|
271
|
+
* Reads `git symbolic-ref --short refs/remotes/origin/HEAD`, which resolves to
|
|
272
|
+
* the short ref `origin/<branch>` that the local `origin/HEAD` points at, and
|
|
273
|
+
* strips the `origin/` prefix. This is a purely local lookup — it never makes a
|
|
274
|
+
* network call. Returns `null` when there is no git repo, no `origin` remote, no
|
|
275
|
+
* `origin/HEAD` (e.g. it was never set by clone, or the repo is detached), or
|
|
276
|
+
* git is unavailable, so callers can fall back to a configured/default branch.
|
|
277
|
+
*/
|
|
278
|
+
export const getDefaultBranch = (repoPath) => {
|
|
279
|
+
try {
|
|
280
|
+
const ref = execSync('git symbolic-ref --short refs/remotes/origin/HEAD', {
|
|
281
|
+
cwd: repoPath,
|
|
282
|
+
// Suppress stderr -- see getCurrentCommit comment and #1172. Without it,
|
|
283
|
+
// git prints "fatal: ref refs/remotes/origin/HEAD is not a symbolic ref"
|
|
284
|
+
// to the user's terminal on repos that never set origin/HEAD.
|
|
285
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
286
|
+
windowsHide: true,
|
|
287
|
+
})
|
|
288
|
+
.toString()
|
|
289
|
+
.trim();
|
|
290
|
+
if (!ref)
|
|
291
|
+
return null;
|
|
292
|
+
return ref.startsWith('origin/') ? ref.slice('origin/'.length) : ref;
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
268
298
|
/**
|
|
269
299
|
* Sanitize a repository name to prevent argument injection and ensure
|
|
270
300
|
* cross-platform filesystem compatibility.
|
|
@@ -35,6 +35,14 @@ export interface ParseCache {
|
|
|
35
35
|
* Transient — never serialized to disk.
|
|
36
36
|
*/
|
|
37
37
|
usedKeys: Set<string>;
|
|
38
|
+
/**
|
|
39
|
+
* When set, chunk payloads are loaded from / flushed to sharded files on
|
|
40
|
+
* demand instead of retaining every chunk in `entries` for the whole run
|
|
41
|
+
* (#1983 — Linux kernel OOM from duplicate in-memory cache + graph).
|
|
42
|
+
*/
|
|
43
|
+
storagePath?: string;
|
|
44
|
+
/** Index of chunk hashes known to exist under `storagePath/parse-cache/`. */
|
|
45
|
+
onDiskKeys?: Set<string>;
|
|
38
46
|
}
|
|
39
47
|
/** Stable hash of a single file's contents — used by callers to compose a chunk hash. */
|
|
40
48
|
export declare const fileContentHash: (content: Buffer | string) => string;
|
|
@@ -49,6 +57,20 @@ export declare const computeChunkHash: (entries: Array<{
|
|
|
49
57
|
filePath: string;
|
|
50
58
|
contentHash: string;
|
|
51
59
|
}>) => string;
|
|
60
|
+
export declare const mapReplacer: (_key: string, value: unknown) => unknown;
|
|
61
|
+
export declare const mapReviver: (_key: string, value: unknown) => unknown;
|
|
62
|
+
/**
|
|
63
|
+
* Drop fields that are not replayed by `mergeChunkResults` / parse-impl after
|
|
64
|
+
* RING4-1 (#942). Shrinks on-disk shards and peak RSS during cold runs.
|
|
65
|
+
*/
|
|
66
|
+
export declare const slimParseWorkerResultsForCache: (chunkResults: readonly ParseWorkerResult[]) => ParseWorkerResult[];
|
|
67
|
+
/** Load one chunk shard. Does not retain it in `cache.entries`. */
|
|
68
|
+
export declare const loadParseCacheChunk: (cache: ParseCache, chunkHash: string) => Promise<ParseWorkerResult[] | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* Persist one chunk shard and avoid retaining it in RAM for the rest of the
|
|
71
|
+
* run. Falls back to `cache.entries` when `storagePath` is unset (unit tests).
|
|
72
|
+
*/
|
|
73
|
+
export declare const persistParseCacheChunk: (cache: ParseCache, chunkHash: string, chunkResults: readonly ParseWorkerResult[]) => Promise<void>;
|
|
52
74
|
/**
|
|
53
75
|
* Load the parse cache. Returns an empty cache on any failure (missing
|
|
54
76
|
* file, corrupt JSON, version mismatch). Never throws on a normal load.
|
|
@@ -64,7 +86,7 @@ export declare const loadParseCache: (storagePath: string) => Promise<ParseCache
|
|
|
64
86
|
* reparses. This is not a single atomic swap of the whole tree, but avoids
|
|
65
87
|
* leaving a half-written shard set visible to readers.
|
|
66
88
|
*/
|
|
67
|
-
export declare const saveParseCache: (storagePath: string, cache: ParseCache) => Promise<
|
|
89
|
+
export declare const saveParseCache: (storagePath: string, cache: ParseCache) => Promise<string[]>;
|
|
68
90
|
/**
|
|
69
91
|
* Drop entries whose hashes are not in `usedHashes`. Called at the end
|
|
70
92
|
* of a run so chunks that no longer correspond to any current chunk
|
|
@@ -41,7 +41,18 @@ import { fileURLToPath } from 'url';
|
|
|
41
41
|
* On version mismatch, `loadParseCache` returns an empty cache and the
|
|
42
42
|
* next save overwrites the on-disk file with the new version baked in.
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
// Bumped to 4 in #1983: on-disk parse-cache shards omit legacy DAG fields
|
|
45
|
+
// (`calls`, `assignments`, `constructorBindings`) unused after RING4-1 (#942)
|
|
46
|
+
// and the worker `parsedFiles` (the worker writes those to the disk ParsedFile
|
|
47
|
+
// store instead). #2038 added a DURABLE, content-addressed ParsedFile store
|
|
48
|
+
// (`parsedfile-cache/`, see parsedfile-store.ts) keyed by chunk hash that
|
|
49
|
+
// mirrors THIS cache's lifecycle — version-gated by PARSE_CACHE_VERSION, pruned
|
|
50
|
+
// in lockstep to the surviving keys. On a warm parse-cache hit the chunk's
|
|
51
|
+
// ParsedFiles are restored from it, so scope-resolution does NOT re-extract on
|
|
52
|
+
// the main thread (the #1983 OOM). Because the two stores share this version,
|
|
53
|
+
// any future change to the `ParsedFile` serialization shape MUST bump
|
|
54
|
+
// SCHEMA_BUMP so both invalidate in lockstep.
|
|
55
|
+
const SCHEMA_BUMP = 4;
|
|
45
56
|
const GITNEXUS_PKG_VERSION = (() => {
|
|
46
57
|
try {
|
|
47
58
|
// package.json sits at gitnexus/package.json — two levels up from
|
|
@@ -104,14 +115,14 @@ export const computeChunkHash = (entries) => {
|
|
|
104
115
|
*/
|
|
105
116
|
const MAP_TAG = '__$mapEntries$__';
|
|
106
117
|
const SET_TAG = '__$setValues$__';
|
|
107
|
-
const mapReplacer = (_key, value) => {
|
|
118
|
+
export const mapReplacer = (_key, value) => {
|
|
108
119
|
if (value instanceof Map)
|
|
109
120
|
return { [MAP_TAG]: Array.from(value.entries()) };
|
|
110
121
|
if (value instanceof Set)
|
|
111
122
|
return { [SET_TAG]: Array.from(value.values()) };
|
|
112
123
|
return value;
|
|
113
124
|
};
|
|
114
|
-
const mapReviver = (_key, value) => {
|
|
125
|
+
export const mapReviver = (_key, value) => {
|
|
115
126
|
if (value && typeof value === 'object') {
|
|
116
127
|
const v = value;
|
|
117
128
|
if (Array.isArray(v[MAP_TAG]))
|
|
@@ -125,6 +136,73 @@ const getLegacyCachePath = (storagePath) => path.join(storagePath, LEGACY_CACHE_
|
|
|
125
136
|
const getCacheDirPath = (storagePath) => path.join(storagePath, CACHE_DIRNAME);
|
|
126
137
|
const getCacheIndexPath = (storagePath) => path.join(getCacheDirPath(storagePath), CACHE_INDEX_FILENAME);
|
|
127
138
|
const getCacheChunkPath = (storagePath, chunkHash) => path.join(getCacheDirPath(storagePath), `${chunkHash}.json`);
|
|
139
|
+
/**
|
|
140
|
+
* Drop fields that are not replayed by `mergeChunkResults` / parse-impl after
|
|
141
|
+
* RING4-1 (#942). Shrinks on-disk shards and peak RSS during cold runs.
|
|
142
|
+
*/
|
|
143
|
+
export const slimParseWorkerResultsForCache = (chunkResults) => {
|
|
144
|
+
const slim = [];
|
|
145
|
+
for (const result of chunkResults) {
|
|
146
|
+
slim.push({
|
|
147
|
+
...result,
|
|
148
|
+
calls: [],
|
|
149
|
+
assignments: [],
|
|
150
|
+
constructorBindings: [],
|
|
151
|
+
parsedFiles: [],
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return slim;
|
|
155
|
+
};
|
|
156
|
+
const readParseCacheChunkFromDisk = async (storagePath, chunkHash) => {
|
|
157
|
+
if (!isValidChunkCacheKey(chunkHash))
|
|
158
|
+
return undefined;
|
|
159
|
+
try {
|
|
160
|
+
const chunkRaw = await fs.readFile(getCacheChunkPath(storagePath, chunkHash), 'utf-8');
|
|
161
|
+
const chunkData = JSON.parse(chunkRaw, mapReviver);
|
|
162
|
+
return Array.isArray(chunkData) ? chunkData : undefined;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/** Load one chunk shard. Does not retain it in `cache.entries`. */
|
|
169
|
+
export const loadParseCacheChunk = async (cache, chunkHash) => {
|
|
170
|
+
const inMemory = cache.entries.get(chunkHash);
|
|
171
|
+
if (inMemory !== undefined)
|
|
172
|
+
return inMemory;
|
|
173
|
+
if (cache.storagePath && cache.onDiskKeys?.has(chunkHash)) {
|
|
174
|
+
return readParseCacheChunkFromDisk(cache.storagePath, chunkHash);
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Cache directories already created this process. `persistParseCacheChunk` runs
|
|
180
|
+
* once per cache-miss chunk; without this guard every miss re-issues a redundant
|
|
181
|
+
* `mkdir` syscall (hundreds on a large cold repo) (#1983). Storage paths are
|
|
182
|
+
* process-scoped, so the Set stays bounded.
|
|
183
|
+
*/
|
|
184
|
+
const createdCacheDirs = new Set();
|
|
185
|
+
/**
|
|
186
|
+
* Persist one chunk shard and avoid retaining it in RAM for the rest of the
|
|
187
|
+
* run. Falls back to `cache.entries` when `storagePath` is unset (unit tests).
|
|
188
|
+
*/
|
|
189
|
+
export const persistParseCacheChunk = async (cache, chunkHash, chunkResults) => {
|
|
190
|
+
const slim = slimParseWorkerResultsForCache(chunkResults);
|
|
191
|
+
if (cache.storagePath) {
|
|
192
|
+
const cacheDir = getCacheDirPath(cache.storagePath);
|
|
193
|
+
if (!createdCacheDirs.has(cacheDir)) {
|
|
194
|
+
await fs.mkdir(cacheDir, { recursive: true });
|
|
195
|
+
createdCacheDirs.add(cacheDir);
|
|
196
|
+
}
|
|
197
|
+
const payload = JSON.stringify(slim, mapReplacer);
|
|
198
|
+
await fs.writeFile(getCacheChunkPath(cache.storagePath, chunkHash), payload, 'utf-8');
|
|
199
|
+
cache.onDiskKeys ??= new Set();
|
|
200
|
+
cache.onDiskKeys.add(chunkHash);
|
|
201
|
+
cache.entries.delete(chunkHash);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
cache.entries.set(chunkHash, slim);
|
|
205
|
+
};
|
|
128
206
|
const loadLegacyParseCache = async (storagePath) => {
|
|
129
207
|
const cachePath = getLegacyCachePath(storagePath);
|
|
130
208
|
try {
|
|
@@ -135,17 +213,17 @@ const loadLegacyParseCache = async (storagePath) => {
|
|
|
135
213
|
data.version !== PARSE_CACHE_VERSION ||
|
|
136
214
|
typeof data.entries !== 'object' ||
|
|
137
215
|
data.entries === null) {
|
|
138
|
-
return emptyCache();
|
|
216
|
+
return emptyCache(storagePath);
|
|
139
217
|
}
|
|
140
218
|
const entries = new Map();
|
|
141
219
|
for (const [k, v] of Object.entries(data.entries)) {
|
|
142
220
|
if (Array.isArray(v))
|
|
143
221
|
entries.set(k, v);
|
|
144
222
|
}
|
|
145
|
-
return { version: PARSE_CACHE_VERSION, entries, usedKeys: new Set() };
|
|
223
|
+
return { version: PARSE_CACHE_VERSION, entries, usedKeys: new Set(), storagePath };
|
|
146
224
|
}
|
|
147
225
|
catch {
|
|
148
|
-
return emptyCache();
|
|
226
|
+
return emptyCache(storagePath);
|
|
149
227
|
}
|
|
150
228
|
};
|
|
151
229
|
const loadShardedParseCache = async (storagePath) => {
|
|
@@ -157,23 +235,22 @@ const loadShardedParseCache = async (storagePath) => {
|
|
|
157
235
|
data === null ||
|
|
158
236
|
data.version !== PARSE_CACHE_VERSION ||
|
|
159
237
|
!Array.isArray(data.keys)) {
|
|
160
|
-
return emptyCache();
|
|
238
|
+
return emptyCache(storagePath);
|
|
161
239
|
}
|
|
162
|
-
const
|
|
240
|
+
const onDiskKeys = new Set();
|
|
163
241
|
for (const chunkHash of data.keys) {
|
|
164
|
-
if (typeof chunkHash
|
|
165
|
-
|
|
166
|
-
try {
|
|
167
|
-
const chunkRaw = await fs.readFile(getCacheChunkPath(storagePath, chunkHash), 'utf-8');
|
|
168
|
-
const chunkData = JSON.parse(chunkRaw, mapReviver);
|
|
169
|
-
if (Array.isArray(chunkData))
|
|
170
|
-
entries.set(chunkHash, chunkData);
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
/* skip corrupt or missing shard */
|
|
242
|
+
if (typeof chunkHash === 'string' && isValidChunkCacheKey(chunkHash)) {
|
|
243
|
+
onDiskKeys.add(chunkHash);
|
|
174
244
|
}
|
|
175
245
|
}
|
|
176
|
-
|
|
246
|
+
// Lazy: index only — load individual shards on cache hit (#1983).
|
|
247
|
+
return {
|
|
248
|
+
version: PARSE_CACHE_VERSION,
|
|
249
|
+
entries: new Map(),
|
|
250
|
+
usedKeys: new Set(),
|
|
251
|
+
storagePath,
|
|
252
|
+
onDiskKeys,
|
|
253
|
+
};
|
|
177
254
|
}
|
|
178
255
|
catch {
|
|
179
256
|
return null;
|
|
@@ -205,31 +282,50 @@ export const saveParseCache = async (storagePath, cache) => {
|
|
|
205
282
|
const tmpDir = `${cacheDir}.tmp`;
|
|
206
283
|
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
207
284
|
await fs.mkdir(tmpDir, { recursive: true });
|
|
208
|
-
const keys = [];
|
|
209
|
-
|
|
210
|
-
|
|
285
|
+
const keys = [...cache.usedKeys].filter(isValidChunkCacheKey).sort();
|
|
286
|
+
// Track hashes whose shard was actually written/copied this save. A hash can
|
|
287
|
+
// be in `usedKeys` without a backing shard — its in-memory serialize threw, or
|
|
288
|
+
// its on-disk copy failed/was-absent (e.g. a worker-quarantined chunk added to
|
|
289
|
+
// usedKeys but never persisted). Writing such a hash into `index.keys` would
|
|
290
|
+
// make the next load reference a shard that doesn't exist (#1983). Build the
|
|
291
|
+
// index from what we persisted, not from the raw usedKeys snapshot.
|
|
292
|
+
const writtenKeys = [];
|
|
293
|
+
for (const chunkHash of keys) {
|
|
294
|
+
const chunkPath = path.join(tmpDir, `${chunkHash}.json`);
|
|
295
|
+
const inMemory = cache.entries.get(chunkHash);
|
|
296
|
+
if (inMemory !== undefined) {
|
|
297
|
+
let payload;
|
|
298
|
+
try {
|
|
299
|
+
payload = JSON.stringify(inMemory, mapReplacer);
|
|
300
|
+
}
|
|
301
|
+
catch {
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
await fs.writeFile(chunkPath, payload, 'utf-8');
|
|
305
|
+
writtenKeys.push(chunkHash);
|
|
211
306
|
continue;
|
|
212
|
-
|
|
307
|
+
}
|
|
308
|
+
const existingPath = getCacheChunkPath(storagePath, chunkHash);
|
|
213
309
|
try {
|
|
214
|
-
|
|
310
|
+
await fs.copyFile(existingPath, chunkPath);
|
|
311
|
+
writtenKeys.push(chunkHash);
|
|
215
312
|
}
|
|
216
313
|
catch {
|
|
217
|
-
|
|
218
|
-
// rather than failing the entire save (orchestrator catches save errors).
|
|
219
|
-
continue;
|
|
314
|
+
/* shard missing — skip; next run treats as cache miss */
|
|
220
315
|
}
|
|
221
|
-
keys.push(chunkHash);
|
|
222
|
-
const chunkPath = path.join(tmpDir, `${chunkHash}.json`);
|
|
223
|
-
await fs.writeFile(chunkPath, payload, 'utf-8');
|
|
224
316
|
}
|
|
225
317
|
const index = {
|
|
226
318
|
version: cache.version,
|
|
227
|
-
keys,
|
|
319
|
+
keys: writtenKeys,
|
|
228
320
|
};
|
|
229
321
|
await fs.writeFile(path.join(tmpDir, CACHE_INDEX_FILENAME), JSON.stringify(index), 'utf-8');
|
|
230
322
|
await fs.rm(cacheDir, { recursive: true, force: true });
|
|
231
323
|
await fs.rename(tmpDir, cacheDir);
|
|
232
324
|
await fs.rm(getLegacyCachePath(storagePath), { force: true });
|
|
325
|
+
// The authoritative final key set actually backed by a shard on disk.
|
|
326
|
+
// Callers (the durable ParsedFile store) prune to exactly these so the two
|
|
327
|
+
// content-addressed stores stay coherent — a chunk is cached iff BOTH have it.
|
|
328
|
+
return writtenKeys;
|
|
233
329
|
};
|
|
234
330
|
/**
|
|
235
331
|
* Drop entries whose hashes are not in `usedHashes`. Called at the end
|
|
@@ -244,10 +340,20 @@ export const pruneCache = (cache, usedHashes) => {
|
|
|
244
340
|
removed++;
|
|
245
341
|
}
|
|
246
342
|
}
|
|
343
|
+
if (cache.onDiskKeys) {
|
|
344
|
+
for (const k of cache.onDiskKeys) {
|
|
345
|
+
if (!usedHashes.has(k)) {
|
|
346
|
+
cache.onDiskKeys.delete(k);
|
|
347
|
+
removed++;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
247
351
|
return removed;
|
|
248
352
|
};
|
|
249
|
-
const emptyCache = () => ({
|
|
353
|
+
const emptyCache = (storagePath) => ({
|
|
250
354
|
version: PARSE_CACHE_VERSION,
|
|
251
355
|
entries: new Map(),
|
|
252
356
|
usedKeys: new Set(),
|
|
357
|
+
storagePath,
|
|
358
|
+
onDiskKeys: storagePath ? new Set() : undefined,
|
|
253
359
|
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disk-backed `ParsedFile` store (#1983 scope-resolution OOM).
|
|
3
|
+
*
|
|
4
|
+
* ## Why this exists
|
|
5
|
+
*
|
|
6
|
+
* The scope-resolution phase needs a `ParsedFile` (scopes / defs / reference
|
|
7
|
+
* sites) for every file. Historically it re-extracted each file from source on
|
|
8
|
+
* the **main thread** via `extractParsedFile` → `parseSourceSafe`. On a huge
|
|
9
|
+
* repo (Linux kernel, ~64k C files) that re-parse accumulates an unbounded
|
|
10
|
+
* **native** memory leak in `tree-sitter` 0.21.1 (`CallbackInput` retains the
|
|
11
|
+
* input string with no destructor; node-tree-sitter PR #201) — the leaked
|
|
12
|
+
* `TSTree` memory is invisible to V8, never reclaimed by GC, and not freed by
|
|
13
|
+
* worker_thread teardown. The parse phase escapes it only because each parse is
|
|
14
|
+
* relatively cheap there; a second full re-parse of every file on the immortal
|
|
15
|
+
* main thread pushes RSS past the heap cap and the OOM-killer fires.
|
|
16
|
+
*
|
|
17
|
+
* The fix: the parse workers already build a tree-sitter `Tree` per file, so
|
|
18
|
+
* they emit the `ParsedFile` directly (reusing that tree — no second parse).
|
|
19
|
+
* Holding all of them in main-thread heap is what the original #1983 work
|
|
20
|
+
* removed (it cost ~1× the semantic model in RAM during parse), so instead we
|
|
21
|
+
* flush them to this disk store per chunk and stream them back per language in
|
|
22
|
+
* scope-resolution. Net effect: the file is parsed exactly once (in a worker),
|
|
23
|
+
* scope-resolution does ZERO parsing, and peak heap stays bounded.
|
|
24
|
+
*
|
|
25
|
+
* ## Shape
|
|
26
|
+
*
|
|
27
|
+
* `<storagePath>/parsedfile-store/<shardId>.json` — one shard per parse chunk,
|
|
28
|
+
* a JSON array of `ParsedFile` serialized with the same `mapReplacer` the parse
|
|
29
|
+
* cache uses (Scope.bindings / Scope.typeBindings are `Map`s). The store is
|
|
30
|
+
* cleared at the start of each parse and after scope-resolution consumes it, so
|
|
31
|
+
* it never lingers and never goes stale across runs.
|
|
32
|
+
*
|
|
33
|
+
* ## Durable sibling store (`parsedfile-cache/`, warm-cache coverage)
|
|
34
|
+
*
|
|
35
|
+
* The run-scoped store above is only populated when the parse workers actually
|
|
36
|
+
* run. On a warm re-analyze where every chunk is a parse-cache HIT, no worker
|
|
37
|
+
* runs, the run-scoped store was cleared at parse start, and the cached
|
|
38
|
+
* `ParseWorkerResult` carries no `ParsedFile`s (the worker emptied them after
|
|
39
|
+
* its store write) — so scope-resolution would find an empty store and fall
|
|
40
|
+
* back to main-thread `extractParsedFile`, re-opening the #1983 OOM. To close
|
|
41
|
+
* that gap we ALSO write the worker's ParsedFiles to a second, CONTENT-ADDRESSED
|
|
42
|
+
* store keyed by the parse chunk hash (`getDurableParsedFileDir`), which mirrors
|
|
43
|
+
* the parse cache's lifecycle (persists across runs, pruned by `usedKeys`,
|
|
44
|
+
* version-tied via `PARSE_CACHE_VERSION`). On a warm hit the chunk's durable
|
|
45
|
+
* shards are byte-COPIED into the run-scoped store (no re-parse, no
|
|
46
|
+
* re-serialize → byte-identical), so scope-resolution streams them exactly as
|
|
47
|
+
* on a cold run. Content-addressing makes stale reuse impossible: a changed
|
|
48
|
+
* file changes its chunk hash, which misses BOTH stores and re-dispatches.
|
|
49
|
+
*/
|
|
50
|
+
import type { ParsedFile, SymbolDefinition } from '../_shared/index.js';
|
|
51
|
+
/**
|
|
52
|
+
* Build a JSON.parse reviver that (a) interns every string against a shared
|
|
53
|
+
* pool and (b) applies the parse-cache `mapReviver` (Map/Set reconstruction).
|
|
54
|
+
*
|
|
55
|
+
* `JSON.parse` allocates a DISTINCT string object for every textual token, so a
|
|
56
|
+
* `ParsedFile` graph round-tripped through disk holds millions of duplicate
|
|
57
|
+
* strings — every def repeats its `filePath`, and common type/qualified names
|
|
58
|
+
* (`int`, `void`, `struct …`) recur across the whole repo. On the Linux kernel
|
|
59
|
+
* that roughly DOUBLES the deserialized heap (~15 GB vs ~7.6 GB interned).
|
|
60
|
+
* Interning IN the reviver collapses duplicates as the tree is revived (one
|
|
61
|
+
* pass, no second walk). The pool is per-load; the interned strings stay shared
|
|
62
|
+
* through the retained `ParsedFile` references after the pool is dropped.
|
|
63
|
+
*/
|
|
64
|
+
export declare const makeInterningReviver: (pool: Map<string, string>, defPool: Map<string, SymbolDefinition>) => (key: string, value: unknown) => unknown;
|
|
65
|
+
/**
|
|
66
|
+
* Best-effort synchronous GC. Uses `globalThis.gc` when `--expose-gc` is set,
|
|
67
|
+
* else lazily wires it via `v8.setFlagsFromString('--expose-gc')` + a fresh
|
|
68
|
+
* `vm` context. Exported so scope-resolution can reclaim a finished language's
|
|
69
|
+
* ParsedFiles at the per-language eviction boundary (#1741 / kernel memory work).
|
|
70
|
+
*/
|
|
71
|
+
export declare const forceGc: () => void;
|
|
72
|
+
export declare const getParsedFileStoreDir: (storagePath: string) => string;
|
|
73
|
+
/** Remove any prior run's shards so a fresh parse starts clean. Idempotent. */
|
|
74
|
+
export declare const clearParsedFileStore: (storagePath: string) => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Write one parse chunk's `ParsedFile[]` to the store as a single shard (async).
|
|
77
|
+
* No-op for an empty chunk. `shardId` must be unique within a run. Used by the
|
|
78
|
+
* main-thread no-store-disabled fallback and any non-worker writer; the worker
|
|
79
|
+
* store path uses {@link persistParsedFileShardSync}.
|
|
80
|
+
*/
|
|
81
|
+
export declare const persistParsedFileChunk: (storagePath: string, shardId: string, parsedFiles: readonly ParsedFile[]) => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Synchronous shard writer for use INSIDE a parse worker (#1983 parallel
|
|
84
|
+
* serialization). The worker is a dedicated thread, so a blocking write there
|
|
85
|
+
* protects the main thread, and a sync write avoids threading `async`/`await`
|
|
86
|
+
* through the synchronous per-file extract loop. Produces byte-identical shards
|
|
87
|
+
* to {@link persistParsedFileChunk} via the shared {@link serializeParsedFileShard}.
|
|
88
|
+
* No-op for an empty chunk. `shardId` must be globally unique for the run (the
|
|
89
|
+
* worker uses `w<threadId>-<seq>`); a duplicate would silently overwrite.
|
|
90
|
+
*/
|
|
91
|
+
export declare const persistParsedFileShardSync: (storagePath: string, shardId: string, parsedFiles: readonly ParsedFile[]) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Stream the store and return the `ParsedFile`s whose `filePath` is in
|
|
94
|
+
* `wantPaths`, keyed by path. Loads one shard at a time and retains only the
|
|
95
|
+
* matching entries, so peak heap is bounded by (matched set) + (one shard)
|
|
96
|
+
* rather than the whole store. Returns an empty map when the store is absent
|
|
97
|
+
* (e.g. tests, or a run with no worker pool) — callers fall back to a fresh
|
|
98
|
+
* extract for the missing files.
|
|
99
|
+
*/
|
|
100
|
+
export declare const loadParsedFilesForPaths: (storagePath: string, wantPaths: ReadonlySet<string>) => Promise<Map<string, ParsedFile>>;
|
|
101
|
+
/** Durable store dir — a sibling of `parsedfile-store/`, NEVER cleared per run. */
|
|
102
|
+
export declare const getDurableParsedFileDir: (storagePath: string) => string;
|
|
103
|
+
/**
|
|
104
|
+
* Synchronous durable-shard writer for use INSIDE a parse worker, alongside
|
|
105
|
+
* {@link persistParsedFileShardSync}. Writes the SAME bytes to a content-addressed
|
|
106
|
+
* durable location keyed by the parse chunk hash so a future warm hit can reuse
|
|
107
|
+
* them. `chunkHash`+`threadId`+`shardSeq` is collision-free across the
|
|
108
|
+
* N-shards-per-chunk fan-out and across worker-death retries — the same
|
|
109
|
+
* uniqueness that makes the run-scoped `w<tid>-<seq>` name safe, prefixed by
|
|
110
|
+
* content. No-op for an empty chunk.
|
|
111
|
+
*/
|
|
112
|
+
export declare const persistDurableParsedFileShardSync: (durableDir: string, chunkHash: string, threadId: number, shardSeq: number, parsedFiles: readonly ParsedFile[]) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Restore a cached chunk's durable shards into the run-scoped store on a warm
|
|
115
|
+
* hit. A verbatim byte copy (no parse, no re-serialize), so the restored
|
|
116
|
+
* ParsedFiles are byte-identical to a cold run and `loadParsedFilesForPaths`
|
|
117
|
+
* (which keys on `filePath`, not shard name) gives scope-resolution full
|
|
118
|
+
* coverage. The durable shard names already carry the chunk hash, so they never
|
|
119
|
+
* collide with the worker's run-scoped `w<tid>-<seq>` shards. Returns the number
|
|
120
|
+
* of shards restored (0 ⇒ no durable coverage for this chunk; caller treats it
|
|
121
|
+
* as a miss).
|
|
122
|
+
*/
|
|
123
|
+
export declare const restoreDurableParsedFileShard: (durableDir: string, runStoragePath: string, chunkHash: string) => Promise<number>;
|
|
124
|
+
/**
|
|
125
|
+
* Read the durable index and return the set of chunk hashes it vouches for,
|
|
126
|
+
* gated on `expectedVersion` (`PARSE_CACHE_VERSION`). A version mismatch or a
|
|
127
|
+
* missing/corrupt index returns the empty set — the caller then treats every
|
|
128
|
+
* chunk as a durable miss and re-dispatches workers (NEVER the main-thread
|
|
129
|
+
* `extractParsedFile` fallback), which rewrites the durable store under the new
|
|
130
|
+
* version. Mirrors `loadParseCache`'s version-invalidation contract.
|
|
131
|
+
*/
|
|
132
|
+
export declare const loadDurableParsedFileIndex: (durableDir: string, expectedVersion: string) => Promise<Set<string>>;
|
|
133
|
+
/**
|
|
134
|
+
* Prune the durable store to `keepKeys` and rewrite its index. `keepKeys` must
|
|
135
|
+
* be the parse cache's surviving on-disk keys (so the two stores stay coherent:
|
|
136
|
+
* a chunk is "cached" iff BOTH its parse-cache shard and its durable shards
|
|
137
|
+
* exist; a quarantined chunk — no parse-cache shard — drops its durable subdir
|
|
138
|
+
* here and re-dispatches next run). Only subdirs with ≥1 shard are indexed
|
|
139
|
+
* (mirrors `saveParseCache`'s written-keys discipline — never vouch for a chunk
|
|
140
|
+
* hash with no backing shard). The index write is tmp+rename atomic.
|
|
141
|
+
*/
|
|
142
|
+
export declare const pruneAndSaveDurableParsedFileStore: (durableDir: string, version: string, keepKeys: ReadonlySet<string>) => Promise<void>;
|