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/cli/analyze.js
CHANGED
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
* skill generation (--skills), summary output, and process.exit().
|
|
9
9
|
*/
|
|
10
10
|
import path from 'path';
|
|
11
|
+
import os from 'os';
|
|
11
12
|
import { spawn } from 'child_process';
|
|
12
13
|
import v8 from 'v8';
|
|
13
14
|
import cliProgress from 'cli-progress';
|
|
14
15
|
import { closeLbug } from '../core/lbug/lbug-adapter.js';
|
|
15
16
|
import { isLbugCheckpointIoError, isWalCorruptionError, parseWalCheckpointThreshold, WAL_RECOVERY_SUGGESTION, } from '../core/lbug/lbug-config.js';
|
|
16
17
|
import { getStoragePaths, getGlobalRegistryPath, RegistryNameCollisionError, AnalysisNotFinalizedError, assertAnalysisFinalized, } from '../storage/repo-manager.js';
|
|
17
|
-
import { getGitRoot, hasGitDir } from '../storage/git.js';
|
|
18
|
+
import { getGitRoot, hasGitDir, getDefaultBranch } from '../storage/git.js';
|
|
19
|
+
import { loadAnalyzeConfig, mergeAnalyzeOptions, resolveDefaultBranch, validateBranchName, GitNexusRcError, } from './analyze-config.js';
|
|
18
20
|
import { runFullAnalysis } from '../core/run-analyze.js';
|
|
19
21
|
import { getMaxFileSizeBannerMessage } from '../core/ingestion/utils/max-file-size.js';
|
|
20
22
|
import { warnMissingOptionalGrammars } from './optional-grammars.js';
|
|
@@ -23,6 +25,8 @@ import fs from 'fs/promises';
|
|
|
23
25
|
import { cliError } from './cli-message.js';
|
|
24
26
|
import { formatElapsed } from './format-elapsed.js';
|
|
25
27
|
import { isHfDownloadFailure } from '../core/embeddings/hf-env.js';
|
|
28
|
+
import { isLocalEmbeddingRuntimeBlockerMessage } from '../core/embeddings/runtime-support.js';
|
|
29
|
+
import { warnIfNpm11NpxRisk } from './resolve-invocation.js';
|
|
26
30
|
// Capture stderr.write at module load BEFORE anything (LadybugDB native
|
|
27
31
|
// init, progress bar, console redirection) can monkey-patch it. The
|
|
28
32
|
// fatal handlers below MUST reach the user even when the analyze path
|
|
@@ -37,6 +41,22 @@ const writeFatalToStderr = (label, err) => {
|
|
|
37
41
|
realStderrWrite(`\n ${label}: ${message}\n`);
|
|
38
42
|
if (isErr && err.stack)
|
|
39
43
|
realStderrWrite(`${err.stack}\n`);
|
|
44
|
+
// Walk and print the `cause` chain. The phase runner wraps the underlying
|
|
45
|
+
// failure as `new Error("Phase 'X' failed: …", { cause })`, so the original
|
|
46
|
+
// error (e.g. a WorkerPoolDispatchError carrying the worker-side stack from
|
|
47
|
+
// #2068) is only reachable via `.cause`. Without this the user sees the
|
|
48
|
+
// wrapper's main-thread stack and never the real frame. `cause.stack` already
|
|
49
|
+
// begins with the cause's message, so we print the stack alone (not message +
|
|
50
|
+
// stack) to avoid repeating it. Depth-bounded so a cyclic `cause` can't loop
|
|
51
|
+
// (the phase runner wraps one level; the bound leaves headroom for future
|
|
52
|
+
// nesting); uses realStderrWrite so the redirected console.error's ANSI
|
|
53
|
+
// clear-line wrapping can't erase it (#1169).
|
|
54
|
+
const MAX_CAUSE_DEPTH = 5;
|
|
55
|
+
let cause = isErr ? err.cause : undefined;
|
|
56
|
+
for (let depth = 0; depth < MAX_CAUSE_DEPTH && cause instanceof Error; depth++) {
|
|
57
|
+
realStderrWrite(`\n Caused by: ${cause.stack ?? cause.message}\n`);
|
|
58
|
+
cause = cause.cause;
|
|
59
|
+
}
|
|
40
60
|
};
|
|
41
61
|
let fatalHandlersInstalled = false;
|
|
42
62
|
/**
|
|
@@ -60,12 +80,41 @@ const installFatalHandlers = () => {
|
|
|
60
80
|
process.exit(1);
|
|
61
81
|
});
|
|
62
82
|
};
|
|
63
|
-
|
|
83
|
+
/** Historical floor for the re-exec heap cap — the auto-sizer never goes below
|
|
84
|
+
* this, so small boxes / CI never regress. */
|
|
85
|
+
const DEFAULT_HEAP_MB = 16384;
|
|
86
|
+
/**
|
|
87
|
+
* RAM-aware re-exec heap cap (MB): `0.75 × effective RAM`, clamped to
|
|
88
|
+
* `>= DEFAULT_HEAP_MB`. Kept BELOW physical RAM on purpose — a cap `>=` RAM makes
|
|
89
|
+
* V8 collect lazily and inflate the heap into swap-thrash (observed analyzing the
|
|
90
|
+
* Linux kernel at a 30GB cap on a 31GB box). `constrainedBytes` is the cgroup
|
|
91
|
+
* limit or `null`; it is honored only as a real, smaller-than-physical cap, because
|
|
92
|
+
* `process.constrainedMemory()` returns a huge sentinel when UNCONSTRAINED.
|
|
93
|
+
*/
|
|
94
|
+
export function computeHeapCapMb(totalBytes, constrainedBytes) {
|
|
95
|
+
const effectiveBytes = constrainedBytes !== null && constrainedBytes > 0 && constrainedBytes < totalBytes
|
|
96
|
+
? constrainedBytes
|
|
97
|
+
: totalBytes;
|
|
98
|
+
const effectiveMb = Math.floor(effectiveBytes / (1024 * 1024));
|
|
99
|
+
return Math.max(DEFAULT_HEAP_MB, Math.floor(0.75 * effectiveMb));
|
|
100
|
+
}
|
|
101
|
+
function readConstrainedBytes() {
|
|
102
|
+
if (typeof process.constrainedMemory !== 'function')
|
|
103
|
+
return null;
|
|
104
|
+
const c = process.constrainedMemory();
|
|
105
|
+
return typeof c === 'number' && c > 0 ? c : null;
|
|
106
|
+
}
|
|
107
|
+
const HEAP_MB = computeHeapCapMb(os.totalmem(), readConstrainedBytes());
|
|
64
108
|
const TEST_RESPAWN_HEAP_MB = Number(process.env.GITNEXUS_TEST_RESPAWN_HEAP_MB);
|
|
65
109
|
const RESPAWN_HEAP_MB = Number.isFinite(TEST_RESPAWN_HEAP_MB) && TEST_RESPAWN_HEAP_MB > 0
|
|
66
110
|
? Math.floor(TEST_RESPAWN_HEAP_MB)
|
|
67
111
|
: HEAP_MB;
|
|
68
112
|
const HEAP_FLAG = `--max-old-space-size=${RESPAWN_HEAP_MB}`;
|
|
113
|
+
/** Larger semi-space (young-gen) cuts minor-GC frequency + promotion churn during
|
|
114
|
+
* the multi-million-node graph build/emit. Allowed in NODE_OPTIONS (unlike
|
|
115
|
+
* --stack-size), so it propagates to the re-exec env cleanly. */
|
|
116
|
+
const SEMI_SPACE_MB = 128;
|
|
117
|
+
const SEMI_FLAG = `--max-semi-space-size=${SEMI_SPACE_MB}`;
|
|
69
118
|
/** Increase default stack size (KB) to prevent stack overflow on deep class hierarchies. */
|
|
70
119
|
const STACK_KB = 4096;
|
|
71
120
|
const STACK_FLAG = `--stack-size=${STACK_KB}`;
|
|
@@ -332,7 +381,8 @@ const forceHeapOOMForTestIfEnabled = () => {
|
|
|
332
381
|
// the `DEFAULT_WAL_CHECKPOINT_THRESHOLD` constant in
|
|
333
382
|
// `gitnexus/src/core/lbug/lbug-config.ts` in sync with this value.
|
|
334
383
|
const RECOMMENDED_WAL_CHECKPOINT_THRESHOLD = 64 * 1024 * 1024;
|
|
335
|
-
/** Re-exec the process with
|
|
384
|
+
/** Re-exec the process with the RAM-aware auto heap cap + larger semi-space/stack
|
|
385
|
+
* if we're currently below that. A user-supplied NODE_OPTIONS heap wins (no re-exec). */
|
|
336
386
|
async function ensureHeap() {
|
|
337
387
|
const nodeOpts = process.env.NODE_OPTIONS || '';
|
|
338
388
|
if (nodeOpts.includes('--max-old-space-size'))
|
|
@@ -340,32 +390,32 @@ async function ensureHeap() {
|
|
|
340
390
|
const v8Heap = v8.getHeapStatistics().heap_size_limit;
|
|
341
391
|
if (v8Heap >= HEAP_MB * 1024 * 1024 * 0.9)
|
|
342
392
|
return false;
|
|
343
|
-
// --stack-size is a V8 flag not allowed in NODE_OPTIONS on Node 24+,
|
|
344
|
-
//
|
|
345
|
-
const cliFlags = [HEAP_FLAG];
|
|
393
|
+
// --stack-size is a V8 flag not allowed in NODE_OPTIONS on Node 24+, so pass it
|
|
394
|
+
// only as a direct CLI argument. --max-semi-space-size IS allowed in NODE_OPTIONS.
|
|
395
|
+
const cliFlags = [HEAP_FLAG, SEMI_FLAG];
|
|
346
396
|
if (!nodeOpts.includes('--stack-size'))
|
|
347
397
|
cliFlags.push(STACK_FLAG);
|
|
348
398
|
const childArgs = [...cliFlags, ...process.argv.slice(1)];
|
|
349
399
|
const childEnv = {
|
|
350
400
|
...process.env,
|
|
351
|
-
NODE_OPTIONS: `${nodeOpts} ${HEAP_FLAG}`.trim(),
|
|
401
|
+
NODE_OPTIONS: `${nodeOpts} ${HEAP_FLAG} ${SEMI_FLAG}`.trim(),
|
|
352
402
|
};
|
|
353
403
|
if (shouldBridgeRespawnProgressTty())
|
|
354
404
|
childEnv[RESPAWN_PROGRESS_ENV] = '1';
|
|
355
405
|
const childExit = await runRespawnedAnalyze(childArgs, childEnv);
|
|
356
406
|
if (childExit.status !== 0 || childExit.signal) {
|
|
357
407
|
if (childProcessLikelyOom(childExit)) {
|
|
358
|
-
cliError(` Analysis likely ran out of memory.\n` +
|
|
359
|
-
`
|
|
360
|
-
`
|
|
361
|
-
`
|
|
408
|
+
cliError(` Analysis likely ran out of memory (heap cap auto-sized to ${RESPAWN_HEAP_MB}MB ≈ 0.75x RAM).\n` +
|
|
409
|
+
` This repository's working set exceeds available RAM. Use a machine with more RAM,\n` +
|
|
410
|
+
` or override the cap (a cap above physical RAM causes swap-thrash — use with care):\n` +
|
|
411
|
+
` NODE_OPTIONS="--max-old-space-size=<MB>" gitnexus analyze [your-args]\n` +
|
|
412
|
+
` (Windows: set NODE_OPTIONS=--max-old-space-size=<MB> && gitnexus analyze [your-args])\n` +
|
|
362
413
|
` If this persists, it may be a native crash unrelated to heap size.\n`, { recoveryHint: 'heap-oom-respawn' });
|
|
363
414
|
}
|
|
364
415
|
else if (childProcessLikelyNativeAbort(childExit)) {
|
|
365
416
|
cliError(` Analysis aborted in a native worker or native binding path.\n` +
|
|
366
417
|
` Try one of these recovery paths:\n` +
|
|
367
|
-
` gitnexus
|
|
368
|
-
` npm uninstall -g gitnexus && npm install -g gitnexus@latest\n` +
|
|
418
|
+
` npm uninstall -g gitnexus && npm install -g gitnexus@latest (rebuilds native bindings)\n` +
|
|
369
419
|
` Use Node 22 LTS if you are on a newer non-LTS runtime.\n`, { recoveryHint: 'native-worker-abort' });
|
|
370
420
|
}
|
|
371
421
|
const status = typeof childExit.status === 'number' && childExit.status !== 0 ? childExit.status : 1;
|
|
@@ -386,6 +436,7 @@ const ANALYZE_CLI_ENV_KEYS = [
|
|
|
386
436
|
'GITNEXUS_VERBOSE',
|
|
387
437
|
'GITNEXUS_PROFILE_DEFERRED',
|
|
388
438
|
'GITNEXUS_PROFILE_DEFERRED_SLOW_MS',
|
|
439
|
+
'GITNEXUS_DEBUG_HEAP',
|
|
389
440
|
'GITNEXUS_MAX_FILE_SIZE',
|
|
390
441
|
'GITNEXUS_WORKER_SUB_BATCH_TIMEOUT_MS',
|
|
391
442
|
'GITNEXUS_WAL_CHECKPOINT_THRESHOLD',
|
|
@@ -433,6 +484,10 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
433
484
|
// async error that escapes the try/catch below (#1169) surfaces with
|
|
434
485
|
// a stack trace and a non-zero exit code instead of a silent exit 0.
|
|
435
486
|
installFatalHandlers();
|
|
487
|
+
// npm-11 npx-crash nudge (#1939). Runs here, after the heap re-exec guard,
|
|
488
|
+
// so it fires once in the working process and never on the lazy-startup path
|
|
489
|
+
// of other commands (e.g. `gitnexus mcp`).
|
|
490
|
+
warnIfNpm11NpxRisk();
|
|
436
491
|
// Snapshot the GITNEXUS_* env vars that the impl writes for downstream
|
|
437
492
|
// consumption, so they don't leak across `analyzeCommand` invocations in
|
|
438
493
|
// programmatic callers (tests, long-running hosts). `process.exit(0)` on
|
|
@@ -448,14 +503,101 @@ export const analyzeCommand = async (inputPath, options) => {
|
|
|
448
503
|
restoreAnalyzeEnv(envSnap);
|
|
449
504
|
}
|
|
450
505
|
};
|
|
451
|
-
const analyzeCommandImpl = async (inputPath,
|
|
452
|
-
|
|
506
|
+
const analyzeCommandImpl = async (inputPath, cliOptions) => {
|
|
507
|
+
console.log('\n GitNexus Analyzer\n');
|
|
508
|
+
// ── Resolve the target repo root ──────────────────────────────────
|
|
509
|
+
// Resolved FIRST because `.gitnexusrc` is read from the repo root (not the
|
|
510
|
+
// caller's cwd), and config can set defaults that the validation below
|
|
511
|
+
// consumes. `--skip-git` is a CLI-only flag (never a config key), so the raw
|
|
512
|
+
// CLI options are authoritative for repo-root resolution.
|
|
513
|
+
let repoPath;
|
|
514
|
+
if (inputPath) {
|
|
515
|
+
repoPath = path.resolve(inputPath);
|
|
516
|
+
}
|
|
517
|
+
else if (cliOptions?.skipGit) {
|
|
518
|
+
// --skip-git: treat cwd as the index root, do not walk up to a parent git repo.
|
|
519
|
+
repoPath = path.resolve(process.cwd());
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
const gitRoot = getGitRoot(process.cwd());
|
|
523
|
+
if (!gitRoot) {
|
|
524
|
+
console.log(' Not inside a git repository.\n Tip: pass --skip-git to index any folder without a .git directory.\n');
|
|
525
|
+
process.exitCode = 1;
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
repoPath = gitRoot;
|
|
529
|
+
}
|
|
530
|
+
const repoHasGit = hasGitDir(repoPath);
|
|
531
|
+
if (!repoHasGit && !cliOptions?.skipGit) {
|
|
532
|
+
console.log(' Not a git repository.\n Tip: pass --skip-git to index any folder without a .git directory.\n');
|
|
533
|
+
process.exitCode = 1;
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (!repoHasGit) {
|
|
537
|
+
console.log(' Warning: no .git directory found — commit-tracking and incremental updates disabled.\n');
|
|
538
|
+
}
|
|
539
|
+
// Validate an explicit `--default-branch` up front so its errors are
|
|
540
|
+
// attributed to the flag (with a CLI-specific recovery hint) rather than to
|
|
541
|
+
// `.gitnexusrc`, which the user may not even have (#1996 tri-review).
|
|
542
|
+
if (cliOptions?.defaultBranch !== undefined) {
|
|
543
|
+
try {
|
|
544
|
+
validateBranchName(cliOptions.defaultBranch, '--default-branch');
|
|
545
|
+
}
|
|
546
|
+
catch (err) {
|
|
547
|
+
cliError(` ${err instanceof Error ? err.message : String(err)}\n`, {
|
|
548
|
+
recoveryHint: 'default-branch-invalid',
|
|
549
|
+
});
|
|
550
|
+
process.exitCode = 1;
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
// ── Load .gitnexusrc and merge: CLI flags override config (#243) ───
|
|
555
|
+
// Parse/validate before the progress bar so a malformed config produces an
|
|
556
|
+
// actionable error and exits before any expensive analysis starts.
|
|
557
|
+
let options;
|
|
558
|
+
let resolvedDefaultBranch;
|
|
559
|
+
try {
|
|
560
|
+
const fileConfig = loadAnalyzeConfig(repoPath);
|
|
561
|
+
options = mergeAnalyzeOptions(cliOptions ?? {}, fileConfig);
|
|
562
|
+
// Resolve the default branch threaded into generated context:
|
|
563
|
+
// CLI --default-branch > .gitnexusrc defaultBranch/branch
|
|
564
|
+
// > auto-detected origin/HEAD > "main".
|
|
565
|
+
// Only shell out to git when no branch was configured AND the generated
|
|
566
|
+
// context will actually use it, keeping the common path free of an extra
|
|
567
|
+
// git call. Detection is best-effort and never blocks analyze.
|
|
568
|
+
const cliBranch = cliOptions?.defaultBranch;
|
|
569
|
+
const configBranch = fileConfig?.defaultBranch;
|
|
570
|
+
const willGenerateContext = !options.indexOnly && !options.skipAgentsMd;
|
|
571
|
+
let detectedBranch = null;
|
|
572
|
+
if (cliBranch === undefined &&
|
|
573
|
+
configBranch === undefined &&
|
|
574
|
+
repoHasGit &&
|
|
575
|
+
!cliOptions?.skipGit &&
|
|
576
|
+
willGenerateContext) {
|
|
577
|
+
try {
|
|
578
|
+
detectedBranch = getDefaultBranch(repoPath);
|
|
579
|
+
}
|
|
580
|
+
catch {
|
|
581
|
+
detectedBranch = null;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
resolvedDefaultBranch = resolveDefaultBranch({ cliBranch, configBranch, detectedBranch });
|
|
585
|
+
}
|
|
586
|
+
catch (err) {
|
|
587
|
+
const msg = err instanceof GitNexusRcError
|
|
588
|
+
? err.message
|
|
589
|
+
: `Invalid .gitnexusrc: ${err instanceof Error ? err.message : String(err)}`;
|
|
590
|
+
cliError(` ${msg}\n`, { recoveryHint: 'gitnexusrc-invalid' });
|
|
591
|
+
process.exitCode = 1;
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
if (options.verbose) {
|
|
453
595
|
process.env.GITNEXUS_VERBOSE = '1';
|
|
454
596
|
}
|
|
455
|
-
if (options
|
|
597
|
+
if (options.maxFileSize) {
|
|
456
598
|
process.env.GITNEXUS_MAX_FILE_SIZE = options.maxFileSize;
|
|
457
599
|
}
|
|
458
|
-
if (options
|
|
600
|
+
if (options.workerTimeout) {
|
|
459
601
|
const workerTimeoutSeconds = Number(options.workerTimeout);
|
|
460
602
|
if (!Number.isFinite(workerTimeoutSeconds) || workerTimeoutSeconds < 1) {
|
|
461
603
|
cliError(' --worker-timeout must be at least 1 second.\n');
|
|
@@ -464,7 +606,7 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
464
606
|
}
|
|
465
607
|
process.env.GITNEXUS_WORKER_SUB_BATCH_TIMEOUT_MS = String(Math.round(workerTimeoutSeconds * 1000));
|
|
466
608
|
}
|
|
467
|
-
if (options
|
|
609
|
+
if (options.walCheckpointThreshold !== undefined) {
|
|
468
610
|
const parsed = parseWalCheckpointThreshold(options.walCheckpointThreshold);
|
|
469
611
|
if (parsed === undefined) {
|
|
470
612
|
cliError(' --wal-checkpoint-threshold must be an integer >= -1.\n');
|
|
@@ -480,11 +622,12 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
480
622
|
// values back-to-back and observe the value they passed, not whatever the
|
|
481
623
|
// previous call leaked.
|
|
482
624
|
let workerPoolSize;
|
|
483
|
-
if (options
|
|
625
|
+
if (options.workers !== undefined) {
|
|
484
626
|
const parsedWorkers = Number(options.workers);
|
|
485
|
-
if (!Number.isInteger(parsedWorkers) || parsedWorkers <
|
|
486
|
-
cliError(' --workers must be a
|
|
487
|
-
'
|
|
627
|
+
if (!Number.isInteger(parsedWorkers) || parsedWorkers < 1) {
|
|
628
|
+
cliError(' --workers must be a positive integer (>= 1). ' +
|
|
629
|
+
'GitNexus parses through a worker pool only — there is no sequential ' +
|
|
630
|
+
'mode, so 0 is not allowed. Omit --workers for an auto-sized pool.\n');
|
|
488
631
|
process.exitCode = 1;
|
|
489
632
|
return;
|
|
490
633
|
}
|
|
@@ -495,7 +638,7 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
495
638
|
// sibling-validation pattern (exit before bar.start() — otherwise
|
|
496
639
|
// process.exit() leaves the progress bar's hidden cursor uncleared).
|
|
497
640
|
let embeddingsNodeLimit;
|
|
498
|
-
if (typeof options
|
|
641
|
+
if (typeof options.embeddings === 'string') {
|
|
499
642
|
const parsed = Number(options.embeddings);
|
|
500
643
|
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
501
644
|
cliError(` --embeddings expects a non-negative integer (got "${options.embeddings}"). ` +
|
|
@@ -505,7 +648,7 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
505
648
|
}
|
|
506
649
|
embeddingsNodeLimit = parsed;
|
|
507
650
|
}
|
|
508
|
-
const embeddingsEnabled = !!options
|
|
651
|
+
const embeddingsEnabled = !!options.embeddings;
|
|
509
652
|
const setPositiveEnv = (optionName, envName, value) => {
|
|
510
653
|
if (value === undefined)
|
|
511
654
|
return true;
|
|
@@ -518,12 +661,12 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
518
661
|
process.env[envName] = String(parsed);
|
|
519
662
|
return true;
|
|
520
663
|
};
|
|
521
|
-
if (!setPositiveEnv('--embedding-threads', 'GITNEXUS_EMBEDDING_THREADS', options
|
|
522
|
-
!setPositiveEnv('--embedding-batch-size', 'GITNEXUS_EMBEDDING_BATCH_SIZE', options
|
|
523
|
-
!setPositiveEnv('--embedding-sub-batch-size', 'GITNEXUS_EMBEDDING_SUB_BATCH_SIZE', options
|
|
664
|
+
if (!setPositiveEnv('--embedding-threads', 'GITNEXUS_EMBEDDING_THREADS', options.embeddingThreads) ||
|
|
665
|
+
!setPositiveEnv('--embedding-batch-size', 'GITNEXUS_EMBEDDING_BATCH_SIZE', options.embeddingBatchSize) ||
|
|
666
|
+
!setPositiveEnv('--embedding-sub-batch-size', 'GITNEXUS_EMBEDDING_SUB_BATCH_SIZE', options.embeddingSubBatchSize)) {
|
|
524
667
|
return;
|
|
525
668
|
}
|
|
526
|
-
if (options
|
|
669
|
+
if (options.embeddingDevice) {
|
|
527
670
|
const allowed = new Set(['auto', 'cpu', 'dml', 'cuda', 'wasm']);
|
|
528
671
|
if (!allowed.has(options.embeddingDevice)) {
|
|
529
672
|
cliError(' --embedding-device must be one of: auto, cpu, dml, cuda, wasm.\n');
|
|
@@ -532,48 +675,21 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
532
675
|
}
|
|
533
676
|
process.env.GITNEXUS_EMBEDDING_DEVICE = options.embeddingDevice;
|
|
534
677
|
}
|
|
535
|
-
if (options
|
|
678
|
+
if (options.repairFts && options.force) {
|
|
536
679
|
cliError(' Cannot combine `--repair-fts` with `--force`. ' +
|
|
537
680
|
'Use `--repair-fts` for fast FTS-only repair, or `--force` for a full rebuild.\n');
|
|
538
681
|
process.exitCode = 1;
|
|
539
682
|
return;
|
|
540
683
|
}
|
|
541
|
-
console.log('\n GitNexus Analyzer\n');
|
|
542
684
|
// `--index-only` is the stronger contract — it suppresses every form of file
|
|
543
685
|
// injection, including community skill writes that `--skills` would normally
|
|
544
686
|
// produce. Surface the override explicitly so users don't wonder why a
|
|
545
687
|
// pipeline re-index ran but no skill files appeared. The pipeline still
|
|
546
|
-
// re-runs (see `force: options
|
|
688
|
+
// re-runs (see `force: options.force || options.skills` below); the warning
|
|
547
689
|
// is purely about the dropped post-index write step.
|
|
548
|
-
if (options
|
|
690
|
+
if (options.indexOnly && options.skills) {
|
|
549
691
|
console.log(' Note: --index-only overrides --skills; community skill files will not be written.\n');
|
|
550
692
|
}
|
|
551
|
-
let repoPath;
|
|
552
|
-
if (inputPath) {
|
|
553
|
-
repoPath = path.resolve(inputPath);
|
|
554
|
-
}
|
|
555
|
-
else if (options?.skipGit) {
|
|
556
|
-
// --skip-git: treat cwd as the index root, do not walk up to a parent git repo.
|
|
557
|
-
repoPath = path.resolve(process.cwd());
|
|
558
|
-
}
|
|
559
|
-
else {
|
|
560
|
-
const gitRoot = getGitRoot(process.cwd());
|
|
561
|
-
if (!gitRoot) {
|
|
562
|
-
console.log(' Not inside a git repository.\n Tip: pass --skip-git to index any folder without a .git directory.\n');
|
|
563
|
-
process.exitCode = 1;
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
repoPath = gitRoot;
|
|
567
|
-
}
|
|
568
|
-
const repoHasGit = hasGitDir(repoPath);
|
|
569
|
-
if (!repoHasGit && !options?.skipGit) {
|
|
570
|
-
console.log(' Not a git repository.\n Tip: pass --skip-git to index any folder without a .git directory.\n');
|
|
571
|
-
process.exitCode = 1;
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
if (!repoHasGit) {
|
|
575
|
-
console.log(' Warning: no .git directory found \u2014 commit-tracking and incremental updates disabled.\n');
|
|
576
|
-
}
|
|
577
693
|
// If the target repo contains files an optional grammar would parse but
|
|
578
694
|
// that grammar's native binding is absent, warn before analysis so users
|
|
579
695
|
// learn why those files end up unparsed instead of silently getting a
|
|
@@ -692,34 +808,37 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
692
808
|
const t0 = Date.now();
|
|
693
809
|
// ── Run shared analysis orchestrator ───────────────────────────────
|
|
694
810
|
try {
|
|
695
|
-
const skipAll = options
|
|
696
|
-
const skipAgentsMd = skipAll || options
|
|
697
|
-
const skipSkills = skipAll || options
|
|
811
|
+
const skipAll = options.indexOnly;
|
|
812
|
+
const skipAgentsMd = skipAll || options.skipAgentsMd;
|
|
813
|
+
const skipSkills = skipAll || options.skipSkills;
|
|
698
814
|
const result = await runFullAnalysis(repoPath, {
|
|
699
815
|
// Pipeline re-index — OR'd with --skills because skill generation
|
|
700
816
|
// needs a fresh pipelineResult. Has no bearing on the registry
|
|
701
817
|
// collision guard (see allowDuplicateName below).
|
|
702
|
-
force: options
|
|
703
|
-
repairFts: options
|
|
818
|
+
force: options.force || options.skills,
|
|
819
|
+
repairFts: options.repairFts,
|
|
704
820
|
embeddings: embeddingsEnabled,
|
|
705
821
|
embeddingsNodeLimit,
|
|
706
|
-
dropEmbeddings: options
|
|
707
|
-
verbose: options
|
|
708
|
-
skipGit: options
|
|
822
|
+
dropEmbeddings: options.dropEmbeddings,
|
|
823
|
+
verbose: options.verbose,
|
|
824
|
+
skipGit: options.skipGit,
|
|
709
825
|
skipAgentsMd,
|
|
710
826
|
skipSkills,
|
|
827
|
+
// Resolved default branch (CLI > .gitnexusrc > auto-detect > "main")
|
|
828
|
+
// threaded into the generated regression-compare example (#243).
|
|
829
|
+
defaultBranch: resolvedDefaultBranch,
|
|
711
830
|
// commander.js `.option('--no-stats', …)` registers the flag as
|
|
712
831
|
// `options.stats` (boolean, default true; `false` when the user
|
|
713
|
-
// passed --no-stats). Reading `options
|
|
832
|
+
// passed --no-stats). Reading `options.noStats` here returns
|
|
714
833
|
// undefined every time, so the flag was a no-op on the markdown
|
|
715
834
|
// rewrite path before this fix. See #1477.
|
|
716
|
-
noStats: options
|
|
717
|
-
registryName: options
|
|
835
|
+
noStats: options.stats === false,
|
|
836
|
+
registryName: options.name,
|
|
718
837
|
// Registry-collision bypass — its own CLI flag, intentionally NOT
|
|
719
838
|
// overloading --force. A user who hits the collision guard should
|
|
720
839
|
// be able to accept the duplicate name without also paying the
|
|
721
840
|
// cost of a full pipeline re-index. See #829 review round 2.
|
|
722
|
-
allowDuplicateName: options
|
|
841
|
+
allowDuplicateName: options.allowDuplicateName,
|
|
723
842
|
// Worker pool size threaded from --workers, replacing the previous
|
|
724
843
|
// GITNEXUS_WORKER_POOL_SIZE env mutation. `undefined` defers to the
|
|
725
844
|
// env / auto-formula fallback inside the pipeline.
|
|
@@ -736,6 +855,20 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
736
855
|
// that half-finalized state, runFullAnalysis returns alreadyUpToDate
|
|
737
856
|
// on the next invocation unless we check the registry here too.
|
|
738
857
|
await assertAnalysisFinalized(repoPath);
|
|
858
|
+
// The fast path skips context regeneration, but a changed `.gitnexusrc`
|
|
859
|
+
// defaultBranch / `--default-branch` must still take effect. Surgically
|
|
860
|
+
// refresh just the `base_ref` line in AGENTS.md/CLAUDE.md in place,
|
|
861
|
+
// preserving the rest of the block (incl. --skills community rows). No-op
|
|
862
|
+
// when the value already matches, so a routine up-to-date run is silent
|
|
863
|
+
// (#1996 tri-review P2).
|
|
864
|
+
let baseRefRefreshed = [];
|
|
865
|
+
try {
|
|
866
|
+
const { refreshBaseRefLine } = await import('./ai-context.js');
|
|
867
|
+
baseRefRefreshed = (await refreshBaseRefLine(repoPath, resolvedDefaultBranch, { skipAgentsMd })).files;
|
|
868
|
+
}
|
|
869
|
+
catch {
|
|
870
|
+
/* best-effort — never fail the fast path over a context refresh */
|
|
871
|
+
}
|
|
739
872
|
clearInterval(elapsedTimer);
|
|
740
873
|
process.removeListener('SIGINT', sigintHandler);
|
|
741
874
|
console.log = origLog;
|
|
@@ -745,6 +878,9 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
745
878
|
console.error = origError;
|
|
746
879
|
bar.stop();
|
|
747
880
|
console.log(' Already up to date\n');
|
|
881
|
+
if (baseRefRefreshed.length > 0) {
|
|
882
|
+
console.log(` Updated base_ref to "${resolvedDefaultBranch}" in ${baseRefRefreshed.join(', ')}\n`);
|
|
883
|
+
}
|
|
748
884
|
// Safe to return without process.exit(0) — the early-return path in
|
|
749
885
|
// runFullAnalysis never opens LadybugDB, so no native handles prevent exit.
|
|
750
886
|
return;
|
|
@@ -803,9 +939,13 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
803
939
|
}, skillResult.skills, {
|
|
804
940
|
skipAgentsMd,
|
|
805
941
|
skipSkills,
|
|
942
|
+
// Same resolved branch as the main run (#243) so the --skills
|
|
943
|
+
// re-generation of AGENTS.md/CLAUDE.md does not revert base_ref
|
|
944
|
+
// to "main".
|
|
945
|
+
defaultBranch: resolvedDefaultBranch,
|
|
806
946
|
// Mirror runFullAnalysis `noStats` bridge (#1477) — same expression;
|
|
807
947
|
// exercised on the `--skills` path by analyze-no-stats-bridge.test.ts.
|
|
808
|
-
noStats: options
|
|
948
|
+
noStats: options.stats === false,
|
|
809
949
|
});
|
|
810
950
|
}
|
|
811
951
|
}
|
|
@@ -898,6 +1038,19 @@ const analyzeCommandImpl = async (inputPath, options) => {
|
|
|
898
1038
|
process.exitCode = 1;
|
|
899
1039
|
return;
|
|
900
1040
|
}
|
|
1041
|
+
// Local embedding runtime unsupported on this platform (macOS Intel ships no
|
|
1042
|
+
// darwin/x64 ONNX native binding, #1515). The guard threw before importing
|
|
1043
|
+
// transformers.js, so this is a clean, actionable GitNexus message. Checked
|
|
1044
|
+
// before the network-heuristic isHfDownloadFailure branch below (and before
|
|
1045
|
+
// the generic module-not-found "installation may be corrupt" hint) so the
|
|
1046
|
+
// explicit platform message always takes priority.
|
|
1047
|
+
if (isLocalEmbeddingRuntimeBlockerMessage(msg)) {
|
|
1048
|
+
cliError(` ${msg.replace(/\n/g, '\n ')}\n`, {
|
|
1049
|
+
recoveryHint: 'local-embedding-unsupported',
|
|
1050
|
+
});
|
|
1051
|
+
process.exitCode = 1;
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
901
1054
|
// HF download failure — show clean guidance without the raw stack trace.
|
|
902
1055
|
// Checked before writeFatalToStderr so the user sees one focused message
|
|
903
1056
|
// rather than a stack-trace dump followed by a second remediation block.
|
|
@@ -12,7 +12,7 @@ import { type CliMessageKey, type CliMessageVars } from './i18n/index.js';
|
|
|
12
12
|
* Consumers can import this type to narrow log-record `recoveryHint`
|
|
13
13
|
* fields without restating the literal list.
|
|
14
14
|
*/
|
|
15
|
-
export type RecoveryHint = 'wal-corruption' | 'wal-checkpoint-threshold' | 'heap-oom-respawn' | 'native-worker-abort' | 'hf-endpoint-unreachable' | 'large-repo' | 'npm-resolution' | 'module-not-found';
|
|
15
|
+
export type RecoveryHint = 'wal-corruption' | 'wal-checkpoint-threshold' | 'heap-oom-respawn' | 'native-worker-abort' | 'hf-endpoint-unreachable' | 'local-embedding-unsupported' | 'large-repo' | 'npm-resolution' | 'module-not-found' | 'gitnexusrc-invalid' | 'default-branch-invalid';
|
|
16
16
|
/**
|
|
17
17
|
* Common shape for the optional structured-field bag passed to
|
|
18
18
|
* `cliError`/`cliWarn`/`cliInfo`. Typed so the `recoveryHint` slot is
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export declare function displayWidth(value: string): number;
|
|
2
2
|
export declare function padDisplayEnd(value: string, columns: number): string;
|
|
3
|
+
/**
|
|
4
|
+
* Embedding-runtime support status for the `doctor` Embeddings section.
|
|
5
|
+
* Pure and DI-friendly so it can be unit-tested without running the whole
|
|
6
|
+
* command. Delegates the platform decision to
|
|
7
|
+
* {@link getLocalEmbeddingRuntimeBlocker} so the wording stays in one place.
|
|
8
|
+
*
|
|
9
|
+
* - HTTP mode: always supported (never touches the native runtime).
|
|
10
|
+
* - Local mode on an unsupported platform (macOS Intel, #1515): reports the
|
|
11
|
+
* blocker as `detail` so the caller can surface the full guidance.
|
|
12
|
+
*/
|
|
13
|
+
export declare function localEmbeddingDoctorStatus(opts: {
|
|
14
|
+
httpMode: boolean;
|
|
15
|
+
platform?: NodeJS.Platform;
|
|
16
|
+
arch?: NodeJS.Architecture;
|
|
17
|
+
}): {
|
|
18
|
+
status: string;
|
|
19
|
+
detail: string | null;
|
|
20
|
+
};
|
|
3
21
|
export declare const doctorCommand: () => Promise<void>;
|
package/dist/cli/doctor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getRuntimeCapabilities, getRuntimeFingerprint } from '../core/platform/capabilities.js';
|
|
2
2
|
import { resolveEmbeddingConfig } from '../core/embeddings/config.js';
|
|
3
3
|
import { isHttpMode } from '../core/embeddings/http-client.js';
|
|
4
|
+
import { getLocalEmbeddingRuntimeBlocker } from '../core/embeddings/runtime-support.js';
|
|
4
5
|
import { checkLbugNative } from '../core/lbug/native-check.js';
|
|
5
6
|
import { getExtensionInstallPolicy } from '../core/lbug/extension-loader.js';
|
|
6
7
|
import { t } from './i18n/index.js';
|
|
@@ -42,6 +43,28 @@ export function padDisplayEnd(value, columns) {
|
|
|
42
43
|
return value + ' '.repeat(Math.max(0, columns - displayWidth(value)));
|
|
43
44
|
}
|
|
44
45
|
const label = (key, width) => padDisplayEnd(t(key), width);
|
|
46
|
+
/**
|
|
47
|
+
* Embedding-runtime support status for the `doctor` Embeddings section.
|
|
48
|
+
* Pure and DI-friendly so it can be unit-tested without running the whole
|
|
49
|
+
* command. Delegates the platform decision to
|
|
50
|
+
* {@link getLocalEmbeddingRuntimeBlocker} so the wording stays in one place.
|
|
51
|
+
*
|
|
52
|
+
* - HTTP mode: always supported (never touches the native runtime).
|
|
53
|
+
* - Local mode on an unsupported platform (macOS Intel, #1515): reports the
|
|
54
|
+
* blocker as `detail` so the caller can surface the full guidance.
|
|
55
|
+
*/
|
|
56
|
+
export function localEmbeddingDoctorStatus(opts) {
|
|
57
|
+
if (opts.httpMode) {
|
|
58
|
+
return { status: '✓ http endpoint configured', detail: null };
|
|
59
|
+
}
|
|
60
|
+
const platform = opts.platform ?? process.platform;
|
|
61
|
+
const arch = opts.arch ?? process.arch;
|
|
62
|
+
const blocker = getLocalEmbeddingRuntimeBlocker({ platform, arch });
|
|
63
|
+
if (blocker) {
|
|
64
|
+
return { status: `✗ local embeddings unavailable on ${platform}/${arch}`, detail: blocker };
|
|
65
|
+
}
|
|
66
|
+
return { status: '✓ local embeddings supported', detail: null };
|
|
67
|
+
}
|
|
45
68
|
export const doctorCommand = async () => {
|
|
46
69
|
const fingerprint = getRuntimeFingerprint();
|
|
47
70
|
const capabilities = getRuntimeCapabilities();
|
|
@@ -87,4 +110,13 @@ export const doctorCommand = async () => {
|
|
|
87
110
|
console.log(` ${label('doctor.labels.threads', 12)}${embeddingConfig.threads}`);
|
|
88
111
|
console.log(` ${label('doctor.labels.batch', 12)}${t('doctor.nodes', { count: embeddingConfig.batchSize })}`);
|
|
89
112
|
console.log(` ${label('doctor.labels.subBatch', 12)}${t('doctor.chunks', { count: embeddingConfig.subBatchSize })}`);
|
|
113
|
+
// Surface local-runtime support so macOS Intel users see up front that local
|
|
114
|
+
// embeddings can't load here (the bundled ONNX Runtime ships no darwin/x64
|
|
115
|
+
// native binding, #1515) — rather than discovering it only when
|
|
116
|
+
// `analyze --embeddings` fails. Literal label like the 'native' line above.
|
|
117
|
+
const support = localEmbeddingDoctorStatus({ httpMode: isHttpMode() });
|
|
118
|
+
console.log(` ${padDisplayEnd('Support:', 12)}${support.status}`);
|
|
119
|
+
if (support.detail) {
|
|
120
|
+
process.stderr.write(`\n${support.detail.replace(/^/gm, ' ')}\n\n`);
|
|
121
|
+
}
|
|
90
122
|
};
|
package/dist/cli/i18n/en.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ export declare const en: {
|
|
|
143
143
|
readonly 'help.option.analyze.maxFileSize': "Skip files larger than this (KB). Default: 512. Hard cap: 32768 (tree-sitter limit).";
|
|
144
144
|
readonly 'help.option.analyze.workerTimeout': "Worker sub-batch idle timeout before retry/fallback. Default: 30.";
|
|
145
145
|
readonly 'help.option.analyze.walCheckpointThreshold': "LadybugDB WAL auto-checkpoint threshold in bytes during analyze (integer >= -1; default: 67108864 = 64 MiB; -1 keeps Ladybug stock ~16 MiB).";
|
|
146
|
-
readonly 'help.option.analyze.workers': "Parse worker pool size. Default: cores-1 capped at 16
|
|
146
|
+
readonly 'help.option.analyze.workers': "Parse worker pool size (>=1). Default: cores-1 capped at 16, auto-sized to the repo.";
|
|
147
147
|
readonly 'help.option.analyze.embeddingThreads': "Limit local ONNX embedding CPU threads";
|
|
148
148
|
readonly 'help.option.analyze.embeddingBatchSize': "Number of nodes per embedding batch";
|
|
149
149
|
readonly 'help.option.analyze.embeddingSubBatchSize': "Number of chunks per embedding model call";
|
|
@@ -156,7 +156,7 @@ export declare const en: {
|
|
|
156
156
|
readonly 'help.option.clean.all': "Clean all indexed repos";
|
|
157
157
|
readonly 'help.option.clean.lbugSidecars': "Clean quarantined LadybugDB missing-shadow WAL sidecars";
|
|
158
158
|
readonly 'help.option.wiki.force': "Force full regeneration even if up to date";
|
|
159
|
-
readonly 'help.option.wiki.provider': "LLM provider: openai, openrouter, azure, custom, cursor, claude, or
|
|
159
|
+
readonly 'help.option.wiki.provider': "LLM provider: openai, openrouter, azure, custom, cursor, claude, codex, or opencode (default: openai)";
|
|
160
160
|
readonly 'help.option.wiki.model': "LLM model or Azure deployment name (default: minimax/minimax-m2.5)";
|
|
161
161
|
readonly 'help.option.wiki.baseUrl': "LLM API base URL. Azure v1: https://{resource}.openai.azure.com/openai/v1";
|
|
162
162
|
readonly 'help.option.wiki.apiKey': "LLM API key or Azure api-key (saved to ~/.gitnexus/config.json)";
|
package/dist/cli/i18n/en.js
CHANGED
|
@@ -143,7 +143,7 @@ export const en = {
|
|
|
143
143
|
'help.option.analyze.maxFileSize': 'Skip files larger than this (KB). Default: 512. Hard cap: 32768 (tree-sitter limit).',
|
|
144
144
|
'help.option.analyze.workerTimeout': 'Worker sub-batch idle timeout before retry/fallback. Default: 30.',
|
|
145
145
|
'help.option.analyze.walCheckpointThreshold': 'LadybugDB WAL auto-checkpoint threshold in bytes during analyze (integer >= -1; default: 67108864 = 64 MiB; -1 keeps Ladybug stock ~16 MiB).',
|
|
146
|
-
'help.option.analyze.workers': 'Parse worker pool size. Default: cores-1 capped at 16
|
|
146
|
+
'help.option.analyze.workers': 'Parse worker pool size (>=1). Default: cores-1 capped at 16, auto-sized to the repo.',
|
|
147
147
|
'help.option.analyze.embeddingThreads': 'Limit local ONNX embedding CPU threads',
|
|
148
148
|
'help.option.analyze.embeddingBatchSize': 'Number of nodes per embedding batch',
|
|
149
149
|
'help.option.analyze.embeddingSubBatchSize': 'Number of chunks per embedding model call',
|
|
@@ -156,7 +156,7 @@ export const en = {
|
|
|
156
156
|
'help.option.clean.all': 'Clean all indexed repos',
|
|
157
157
|
'help.option.clean.lbugSidecars': 'Clean quarantined LadybugDB missing-shadow WAL sidecars',
|
|
158
158
|
'help.option.wiki.force': 'Force full regeneration even if up to date',
|
|
159
|
-
'help.option.wiki.provider': 'LLM provider: openai, openrouter, azure, custom, cursor, claude, or
|
|
159
|
+
'help.option.wiki.provider': 'LLM provider: openai, openrouter, azure, custom, cursor, claude, codex, or opencode (default: openai)',
|
|
160
160
|
'help.option.wiki.model': 'LLM model or Azure deployment name (default: minimax/minimax-m2.5)',
|
|
161
161
|
'help.option.wiki.baseUrl': 'LLM API base URL. Azure v1: https://{resource}.openai.azure.com/openai/v1',
|
|
162
162
|
'help.option.wiki.apiKey': 'LLM API key or Azure api-key (saved to ~/.gitnexus/config.json)',
|
|
@@ -144,7 +144,7 @@ export declare const cliResources: {
|
|
|
144
144
|
readonly 'help.option.analyze.maxFileSize': "Skip files larger than this (KB). Default: 512. Hard cap: 32768 (tree-sitter limit).";
|
|
145
145
|
readonly 'help.option.analyze.workerTimeout': "Worker sub-batch idle timeout before retry/fallback. Default: 30.";
|
|
146
146
|
readonly 'help.option.analyze.walCheckpointThreshold': "LadybugDB WAL auto-checkpoint threshold in bytes during analyze (integer >= -1; default: 67108864 = 64 MiB; -1 keeps Ladybug stock ~16 MiB).";
|
|
147
|
-
readonly 'help.option.analyze.workers': "Parse worker pool size. Default: cores-1 capped at 16
|
|
147
|
+
readonly 'help.option.analyze.workers': "Parse worker pool size (>=1). Default: cores-1 capped at 16, auto-sized to the repo.";
|
|
148
148
|
readonly 'help.option.analyze.embeddingThreads': "Limit local ONNX embedding CPU threads";
|
|
149
149
|
readonly 'help.option.analyze.embeddingBatchSize': "Number of nodes per embedding batch";
|
|
150
150
|
readonly 'help.option.analyze.embeddingSubBatchSize': "Number of chunks per embedding model call";
|
|
@@ -157,7 +157,7 @@ export declare const cliResources: {
|
|
|
157
157
|
readonly 'help.option.clean.all': "Clean all indexed repos";
|
|
158
158
|
readonly 'help.option.clean.lbugSidecars': "Clean quarantined LadybugDB missing-shadow WAL sidecars";
|
|
159
159
|
readonly 'help.option.wiki.force': "Force full regeneration even if up to date";
|
|
160
|
-
readonly 'help.option.wiki.provider': "LLM provider: openai, openrouter, azure, custom, cursor, claude, or
|
|
160
|
+
readonly 'help.option.wiki.provider': "LLM provider: openai, openrouter, azure, custom, cursor, claude, codex, or opencode (default: openai)";
|
|
161
161
|
readonly 'help.option.wiki.model': "LLM model or Azure deployment name (default: minimax/minimax-m2.5)";
|
|
162
162
|
readonly 'help.option.wiki.baseUrl': "LLM API base URL. Azure v1: https://{resource}.openai.azure.com/openai/v1";
|
|
163
163
|
readonly 'help.option.wiki.apiKey': "LLM API key or Azure api-key (saved to ~/.gitnexus/config.json)";
|