gitnexus 1.6.6-rc.99 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -68
- package/dist/_shared/graph/types.d.ts +17 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +3 -5
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +2 -4
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.js +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
- package/dist/_shared/scope-resolution/parsed-file.d.ts +24 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +13 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.d.ts +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.js +6 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.js +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts +29 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +9 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +1 -1
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +35 -1
- package/dist/cli/ai-context.js +111 -12
- package/dist/cli/analyze-config.d.ts +92 -0
- package/dist/cli/analyze-config.js +364 -0
- package/dist/cli/analyze.d.ts +17 -1
- package/dist/cli/analyze.js +224 -71
- package/dist/cli/cli-message.d.ts +1 -1
- package/dist/cli/doctor.d.ts +18 -0
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/i18n/en.d.ts +2 -2
- package/dist/cli/i18n/en.js +2 -2
- package/dist/cli/i18n/resources.d.ts +2 -2
- package/dist/cli/i18n/zh-CN.js +2 -2
- package/dist/cli/index.js +4 -2
- package/dist/cli/resolve-invocation.d.ts +21 -0
- package/dist/cli/resolve-invocation.js +68 -0
- package/dist/cli/setup.d.ts +33 -0
- package/dist/cli/setup.js +96 -35
- package/dist/cli/skill-gen.js +2 -2
- package/dist/cli/wiki.js +20 -4
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +14 -1
- package/dist/core/embeddings/runtime-support.d.ts +41 -0
- package/dist/core/embeddings/runtime-support.js +65 -0
- package/dist/core/group/extractors/grpc-patterns/proto.js +2 -1
- package/dist/core/group/extractors/http-patterns/java.js +15 -1
- package/dist/core/ingestion/call-processor.d.ts +57 -227
- package/dist/core/ingestion/call-processor.js +172 -2595
- package/dist/core/ingestion/call-routing.d.ts +6 -5
- package/dist/core/ingestion/call-routing.js +6 -6
- package/dist/core/ingestion/call-types.d.ts +0 -75
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +26 -1
- package/dist/core/ingestion/class-extractors/configs/ruby.js +3 -0
- package/dist/core/ingestion/class-extractors/generic.js +9 -11
- package/dist/core/ingestion/class-types.d.ts +23 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +11 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +227 -73
- package/dist/core/ingestion/cobol-processor.d.ts +1 -0
- package/dist/core/ingestion/cobol-processor.js +51 -2
- package/dist/core/ingestion/emit-references.js +8 -2
- package/dist/core/ingestion/export-detection.d.ts +2 -1
- package/dist/core/ingestion/export-detection.js +2 -6
- package/dist/core/ingestion/field-extractors/configs/dart.d.ts +0 -6
- package/dist/core/ingestion/field-extractors/configs/dart.js +62 -44
- package/dist/core/ingestion/field-extractors/configs/go.d.ts +0 -9
- package/dist/core/ingestion/field-extractors/configs/go.js +40 -1
- package/dist/core/ingestion/field-extractors/configs/jvm.js +43 -4
- package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
- package/dist/core/ingestion/field-extractors/configs/swift.d.ts +12 -1
- package/dist/core/ingestion/field-extractors/configs/swift.js +31 -6
- package/dist/core/ingestion/field-extractors/generic.d.ts +6 -0
- package/dist/core/ingestion/field-extractors/generic.js +5 -4
- package/dist/core/ingestion/field-extractors/typescript.js +0 -29
- package/dist/core/ingestion/filesystem-walker.d.ts +0 -9
- package/dist/core/ingestion/filesystem-walker.js +0 -11
- package/dist/core/ingestion/finalize-orchestrator.js +14 -2
- package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +21 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.js +72 -11
- package/dist/core/ingestion/import-resolvers/python.d.ts +1 -1
- package/dist/core/ingestion/import-resolvers/standard.d.ts +2 -2
- package/dist/core/ingestion/import-resolvers/standard.js +6 -5
- package/dist/core/ingestion/import-resolvers/utils.d.ts +2 -5
- package/dist/core/ingestion/import-resolvers/utils.js +1 -9
- package/dist/core/ingestion/language-provider.d.ts +39 -119
- package/dist/core/ingestion/language-provider.js +0 -2
- package/dist/core/ingestion/languages/c/capture-side-channel.d.ts +62 -0
- package/dist/core/ingestion/languages/c/capture-side-channel.js +65 -0
- package/dist/core/ingestion/languages/c/captures.js +41 -23
- package/dist/core/ingestion/languages/c/import-decomposer.d.ts +9 -0
- package/dist/core/ingestion/languages/c/import-decomposer.js +15 -0
- package/dist/core/ingestion/languages/c/import-target.js +52 -9
- package/dist/core/ingestion/languages/c/index.d.ts +2 -1
- package/dist/core/ingestion/languages/c/index.js +2 -1
- package/dist/core/ingestion/languages/c/query.js +15 -0
- package/dist/core/ingestion/languages/c/scope-resolver.js +47 -4
- package/dist/core/ingestion/languages/c/static-linkage.d.ts +8 -0
- package/dist/core/ingestion/languages/c/static-linkage.js +46 -1
- package/dist/core/ingestion/languages/c-cpp.js +16 -7
- package/dist/core/ingestion/languages/cobol/captures.js +25 -2
- package/dist/core/ingestion/languages/cpp/adl.d.ts +88 -4
- package/dist/core/ingestion/languages/cpp/adl.js +380 -160
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
- package/dist/core/ingestion/languages/cpp/capture-side-channel.d.ts +65 -0
- package/dist/core/ingestion/languages/cpp/capture-side-channel.js +78 -0
- package/dist/core/ingestion/languages/cpp/captures.js +162 -54
- package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +18 -52
- package/dist/core/ingestion/languages/cpp/file-local-linkage.js +49 -1
- package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +7 -0
- package/dist/core/ingestion/languages/cpp/import-decomposer.js +12 -0
- package/dist/core/ingestion/languages/cpp/index.d.ts +1 -0
- package/dist/core/ingestion/languages/cpp/index.js +1 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +8 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.js +21 -0
- package/dist/core/ingestion/languages/cpp/query.js +21 -0
- package/dist/core/ingestion/languages/cpp/range-bindings.js +20 -5
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +52 -5
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +20 -0
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +83 -3
- package/dist/core/ingestion/languages/csharp/captures.js +205 -41
- package/dist/core/ingestion/languages/csharp/index.d.ts +3 -4
- package/dist/core/ingestion/languages/csharp/index.js +3 -4
- package/dist/core/ingestion/languages/csharp/interpret.js +17 -3
- package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +17 -7
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +129 -124
- package/dist/core/ingestion/languages/csharp/qualified-type-names.d.ts +14 -0
- package/dist/core/ingestion/languages/csharp/qualified-type-names.js +59 -0
- package/dist/core/ingestion/languages/csharp/query.js +13 -0
- package/dist/core/ingestion/languages/csharp/receiver-binding.js +10 -6
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -1
- package/dist/core/ingestion/languages/csharp.js +0 -5
- package/dist/core/ingestion/languages/dart/arity-metadata.d.ts +25 -0
- package/dist/core/ingestion/languages/dart/arity-metadata.js +35 -0
- package/dist/core/ingestion/languages/dart/arity.d.ts +19 -0
- package/dist/core/ingestion/languages/dart/arity.js +31 -0
- package/dist/core/ingestion/languages/dart/built-ins.d.ts +11 -0
- package/dist/core/ingestion/languages/dart/built-ins.js +34 -0
- package/dist/core/ingestion/languages/dart/cache-stats.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/cache-stats.js +24 -0
- package/dist/core/ingestion/languages/dart/captures.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/captures.js +445 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.js +31 -0
- package/dist/core/ingestion/languages/dart/import-target.d.ts +15 -0
- package/dist/core/ingestion/languages/dart/import-target.js +65 -0
- package/dist/core/ingestion/languages/dart/index.d.ts +28 -0
- package/dist/core/ingestion/languages/dart/index.js +28 -0
- package/dist/core/ingestion/languages/dart/interpret.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/interpret.js +95 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.d.ts +10 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.js +39 -0
- package/dist/core/ingestion/languages/dart/query.d.ts +26 -0
- package/dist/core/ingestion/languages/dart/query.js +142 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.js +87 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.js +194 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.d.ts +23 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.js +51 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.d.ts +20 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.js +47 -0
- package/dist/core/ingestion/languages/dart.d.ts +0 -1
- package/dist/core/ingestion/languages/dart.js +15 -29
- package/dist/core/ingestion/languages/go/arity-metadata.d.ts +1 -0
- package/dist/core/ingestion/languages/go/arity-metadata.js +31 -1
- package/dist/core/ingestion/languages/go/captures.js +162 -3
- package/dist/core/ingestion/languages/go/interface-impls.js +476 -50
- package/dist/core/ingestion/languages/go/interpret.js +21 -11
- package/dist/core/ingestion/languages/go/method-owners.js +20 -8
- package/dist/core/ingestion/languages/go/query.js +15 -7
- package/dist/core/ingestion/languages/go/range-binding.js +24 -9
- package/dist/core/ingestion/languages/go/receiver-binding.js +1 -1
- package/dist/core/ingestion/languages/go/scope-resolver.js +2 -2
- package/dist/core/ingestion/languages/go/simple-hooks.js +10 -5
- package/dist/core/ingestion/languages/go/type-binding.d.ts +1 -0
- package/dist/core/ingestion/languages/go/type-binding.js +40 -2
- package/dist/core/ingestion/languages/go.d.ts +0 -1
- package/dist/core/ingestion/languages/go.js +0 -5
- package/dist/core/ingestion/languages/index.d.ts +0 -5
- package/dist/core/ingestion/languages/index.js +0 -3
- package/dist/core/ingestion/languages/java/captures.js +252 -23
- package/dist/core/ingestion/languages/java/interpret.js +12 -6
- package/dist/core/ingestion/languages/java/package-siblings.js +18 -5
- package/dist/core/ingestion/languages/java/query.js +16 -1
- package/dist/core/ingestion/languages/java/scope-resolver.d.ts +2 -8
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -8
- package/dist/core/ingestion/languages/java.js +0 -5
- package/dist/core/ingestion/languages/javascript/captures.js +185 -11
- package/dist/core/ingestion/languages/javascript/query.js +107 -1
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +57 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +60 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +213 -22
- package/dist/core/ingestion/languages/kotlin/companion-scopes.d.ts +7 -0
- package/dist/core/ingestion/languages/kotlin/companion-scopes.js +10 -0
- package/dist/core/ingestion/languages/kotlin/index.d.ts +1 -0
- package/dist/core/ingestion/languages/kotlin/index.js +1 -0
- package/dist/core/ingestion/languages/kotlin/query.js +30 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.d.ts +5 -7
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +22 -7
- package/dist/core/ingestion/languages/kotlin.js +8 -5
- package/dist/core/ingestion/languages/php/captures.js +135 -19
- package/dist/core/ingestion/languages/php/import-decomposer.js +21 -63
- package/dist/core/ingestion/languages/php/index.d.ts +3 -4
- package/dist/core/ingestion/languages/php/index.js +3 -4
- package/dist/core/ingestion/languages/php/query.js +5 -0
- package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
- package/dist/core/ingestion/languages/php.js +0 -4
- package/dist/core/ingestion/languages/python/captures.js +128 -13
- package/dist/core/ingestion/languages/python/depends-references.js +1 -1
- package/dist/core/ingestion/languages/python/import-target.d.ts +4 -5
- package/dist/core/ingestion/languages/python/import-target.js +108 -16
- package/dist/core/ingestion/languages/python/index-stats.d.ts +18 -0
- package/dist/core/ingestion/languages/python/index-stats.js +25 -0
- package/dist/core/ingestion/languages/python/index.d.ts +3 -4
- package/dist/core/ingestion/languages/python/index.js +3 -4
- package/dist/core/ingestion/languages/python/query.js +17 -0
- package/dist/core/ingestion/languages/python/scope-resolver.js +7 -6
- package/dist/core/ingestion/languages/python.d.ts +0 -2
- package/dist/core/ingestion/languages/python.js +0 -7
- package/dist/core/ingestion/languages/ruby/captures.js +174 -31
- package/dist/core/ingestion/languages/ruby/import-target.js +2 -1
- package/dist/core/ingestion/languages/ruby/interpret.js +2 -1
- package/dist/core/ingestion/languages/ruby/query.js +10 -0
- package/dist/core/ingestion/languages/ruby/scope-resolver.js +61 -11
- package/dist/core/ingestion/languages/ruby.js +4 -53
- package/dist/core/ingestion/languages/rust/captures.js +95 -13
- package/dist/core/ingestion/languages/rust/query.js +64 -1
- package/dist/core/ingestion/languages/rust/range-binding.js +40 -12
- package/dist/core/ingestion/languages/rust/receiver-binding.js +9 -0
- package/dist/core/ingestion/languages/rust/scope-resolver.js +75 -1
- package/dist/core/ingestion/languages/rust.d.ts +0 -2
- package/dist/core/ingestion/languages/rust.js +0 -6
- package/dist/core/ingestion/languages/swift/arity-metadata.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/arity-metadata.js +41 -0
- package/dist/core/ingestion/languages/swift/arity.d.ts +29 -0
- package/dist/core/ingestion/languages/swift/arity.js +42 -0
- package/dist/core/ingestion/languages/swift/base-type.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/base-type.js +27 -0
- package/dist/core/ingestion/languages/swift/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/swift/captures.d.ts +35 -0
- package/dist/core/ingestion/languages/swift/captures.js +495 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.js +57 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.js +84 -0
- package/dist/core/ingestion/languages/swift/import-target.d.ts +33 -0
- package/dist/core/ingestion/languages/swift/import-target.js +81 -0
- package/dist/core/ingestion/languages/swift/index.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/index.js +37 -0
- package/dist/core/ingestion/languages/swift/interpret.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/interpret.js +89 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.js +48 -0
- package/dist/core/ingestion/languages/swift/query.d.ts +46 -0
- package/dist/core/ingestion/languages/swift/query.js +194 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.d.ts +40 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.js +161 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.d.ts +50 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.js +189 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.js +65 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.d.ts +25 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.js +66 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.js +60 -0
- package/dist/core/ingestion/languages/swift/target-grouping.d.ts +51 -0
- package/dist/core/ingestion/languages/swift/target-grouping.js +93 -0
- package/dist/core/ingestion/languages/swift/target-siblings.d.ts +30 -0
- package/dist/core/ingestion/languages/swift/target-siblings.js +71 -0
- package/dist/core/ingestion/languages/swift.d.ts +0 -5
- package/dist/core/ingestion/languages/swift.js +11 -87
- package/dist/core/ingestion/languages/typescript/array-callback.d.ts +3 -29
- package/dist/core/ingestion/languages/typescript/array-callback.js +4 -43
- package/dist/core/ingestion/languages/typescript/captures.js +147 -17
- package/dist/core/ingestion/languages/typescript/index.d.ts +3 -4
- package/dist/core/ingestion/languages/typescript/index.js +3 -4
- package/dist/core/ingestion/languages/typescript/query.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript/query.js +125 -4
- package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
- package/dist/core/ingestion/languages/typescript.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript.js +46 -23
- package/dist/core/ingestion/languages/vue/captures.d.ts +46 -0
- package/dist/core/ingestion/languages/vue/captures.js +67 -0
- package/dist/core/ingestion/languages/vue/import-target.d.ts +27 -0
- package/dist/core/ingestion/languages/vue/import-target.js +58 -0
- package/dist/core/ingestion/languages/vue/index.d.ts +49 -0
- package/dist/core/ingestion/languages/vue/index.js +49 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.d.ts +55 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.js +292 -0
- package/dist/core/ingestion/languages/vue.js +12 -4
- package/dist/core/ingestion/local-symbol-pruner.d.ts +11 -0
- package/dist/core/ingestion/local-symbol-pruner.js +63 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +14 -1
- package/dist/core/ingestion/method-extractors/configs/jvm.js +37 -20
- package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
- package/dist/core/ingestion/method-extractors/configs/swift.js +11 -4
- package/dist/core/ingestion/method-types.d.ts +2 -2
- package/dist/core/ingestion/model/index.d.ts +0 -3
- package/dist/core/ingestion/model/index.js +0 -8
- package/dist/core/ingestion/model/resolve.d.ts +7 -43
- package/dist/core/ingestion/model/resolve.js +7 -226
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +46 -1
- package/dist/core/ingestion/model/semantic-model.d.ts +4 -6
- package/dist/core/ingestion/model/semantic-model.js +1 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +3 -4
- package/dist/core/ingestion/model/symbol-table.js +3 -4
- package/dist/core/ingestion/parsing-processor.d.ts +30 -24
- package/dist/core/ingestion/parsing-processor.js +76 -640
- package/dist/core/ingestion/pipeline-phases/communities.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/communities.js +5 -2
- package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +9 -8
- package/dist/core/ingestion/pipeline-phases/cross-file.js +16 -12
- package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
- package/dist/core/ingestion/pipeline-phases/index.js +1 -0
- package/dist/core/ingestion/pipeline-phases/mro.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/mro.js +2 -2
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +44 -22
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +426 -565
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +13 -33
- package/dist/core/ingestion/pipeline-phases/parse.js +2 -2
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +5 -3
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.d.ts +14 -0
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.js +26 -0
- package/dist/core/ingestion/pipeline.d.ts +27 -19
- package/dist/core/ingestion/pipeline.js +4 -2
- package/dist/core/ingestion/resolve-references.js +15 -3
- package/dist/core/ingestion/route-extractors/laravel.d.ts +10 -0
- package/dist/core/ingestion/route-extractors/laravel.js +88 -9
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +2 -1
- package/dist/core/ingestion/scope-extractor-bridge.js +2 -2
- package/dist/core/ingestion/scope-extractor.js +13 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +181 -15
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +21 -10
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +10 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +7 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +58 -6
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +24 -5
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +68 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +189 -29
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +21 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1 -1
- package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +8 -11
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +171 -50
- package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +3 -4
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +9 -4
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +28 -5
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +191 -24
- package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +31 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +72 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +440 -39
- package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +18 -2
- package/dist/core/ingestion/scope-resolution/workspace-index.js +94 -7
- package/dist/core/ingestion/tree-sitter-queries.d.ts +14 -14
- package/dist/core/ingestion/tree-sitter-queries.js +380 -158
- package/dist/core/ingestion/ts-js-hoc-utils.d.ts +12 -0
- package/dist/core/ingestion/ts-js-hoc-utils.js +105 -0
- package/dist/core/ingestion/type-env.d.ts +2 -1
- package/dist/core/ingestion/type-env.js +6 -8
- package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
- package/dist/core/ingestion/type-extractors/csharp.js +18 -34
- package/dist/core/ingestion/type-extractors/go.js +2 -10
- package/dist/core/ingestion/type-extractors/jvm.js +6 -5
- package/dist/core/ingestion/type-extractors/php.js +1 -1
- package/dist/core/ingestion/type-extractors/python.js +1 -1
- package/dist/core/ingestion/type-extractors/ruby.js +2 -2
- package/dist/core/ingestion/type-extractors/rust.js +0 -16
- package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
- package/dist/core/ingestion/type-extractors/shared.js +25 -11
- package/dist/core/ingestion/type-extractors/swift.js +5 -5
- package/dist/core/ingestion/type-extractors/types.d.ts +1 -1
- package/dist/core/ingestion/type-extractors/typescript.js +1 -1
- package/dist/core/ingestion/utils/ast-helpers.d.ts +119 -1
- package/dist/core/ingestion/utils/ast-helpers.js +260 -13
- package/dist/core/ingestion/utils/callable-labels.d.ts +13 -0
- package/dist/core/ingestion/utils/callable-labels.js +14 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.d.ts +10 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.js +30 -0
- package/dist/core/ingestion/utils/heap-probe.d.ts +20 -0
- package/dist/core/ingestion/utils/heap-probe.js +39 -0
- package/dist/core/ingestion/utils/heritage-marker.d.ts +33 -0
- package/dist/core/ingestion/utils/heritage-marker.js +41 -0
- package/dist/core/ingestion/utils/qualified-name.d.ts +37 -0
- package/dist/core/ingestion/utils/qualified-name.js +67 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +49 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.js +76 -62
- package/dist/core/ingestion/variable-extractors/configs/go.js +74 -7
- package/dist/core/ingestion/variable-extractors/configs/jvm.js +35 -8
- package/dist/core/ingestion/variable-extractors/generic.js +40 -12
- package/dist/core/ingestion/variable-types.d.ts +9 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +97 -7
- package/dist/core/ingestion/vue-sfc-extractor.js +433 -11
- package/dist/core/ingestion/workers/parse-worker.d.ts +0 -11
- package/dist/core/ingestion/workers/parse-worker.js +358 -187
- package/dist/core/ingestion/workers/worker-pool.d.ts +78 -9
- package/dist/core/ingestion/workers/worker-pool.js +346 -49
- package/dist/core/lbug/csv-generator.js +20 -2
- package/dist/core/lbug/lbug-adapter.js +29 -10
- package/dist/core/lbug/native-check.js +17 -5
- package/dist/core/lbug/pool-adapter.d.ts +0 -19
- package/dist/core/lbug/pool-adapter.js +40 -77
- package/dist/core/lbug/query-result-utils.d.ts +19 -0
- package/dist/core/lbug/query-result-utils.js +28 -0
- package/dist/core/run-analyze.d.ts +9 -2
- package/dist/core/run-analyze.js +24 -3
- package/dist/core/tree-sitter/parser-loader.d.ts +13 -0
- package/dist/core/tree-sitter/parser-loader.js +4 -0
- package/dist/core/tree-sitter/safe-parse.d.ts +70 -3
- package/dist/core/tree-sitter/safe-parse.js +214 -11
- package/dist/core/wiki/generator.js +13 -5
- package/dist/core/wiki/graph-queries.d.ts +3 -0
- package/dist/core/wiki/graph-queries.js +9 -1
- package/dist/core/wiki/llm-client.d.ts +1 -1
- package/dist/core/wiki/llm-client.js +7 -2
- package/dist/core/wiki/local-cli-client.d.ts +2 -1
- package/dist/core/wiki/local-cli-client.js +62 -4
- package/dist/mcp/compatible-stdio-transport.d.ts +3 -0
- package/dist/mcp/compatible-stdio-transport.js +22 -0
- package/dist/mcp/core/embedder.d.ts +1 -1
- package/dist/mcp/core/embedder.js +13 -1
- package/dist/mcp/local/local-backend.d.ts +37 -5
- package/dist/mcp/local/local-backend.js +227 -129
- package/dist/mcp/resources.js +3 -3
- package/dist/mcp/server.js +9 -1
- package/dist/storage/git.d.ts +11 -0
- package/dist/storage/git.js +30 -0
- package/dist/storage/parse-cache.d.ts +23 -1
- package/dist/storage/parse-cache.js +138 -32
- package/dist/storage/parsedfile-store.d.ts +142 -0
- package/dist/storage/parsedfile-store.js +367 -0
- package/dist/storage/repo-manager.d.ts +2 -1
- package/dist/storage/scope-index-store.d.ts +114 -0
- package/dist/storage/scope-index-store.js +236 -0
- package/dist/types/pipeline.d.ts +6 -3
- package/hooks/antigravity/gitnexus-antigravity-hook.cjs +2 -1
- package/hooks/claude/gitnexus-hook.cjs +2 -1
- package/hooks/claude/resolve-analyze-cmd.cjs +323 -0
- package/package.json +4 -5
- package/scripts/bench-scope-resolution.ts +1 -3
- package/scripts/cross-platform-tests.ts +4 -1
- package/skills/gitnexus-cli.md +8 -6
- package/skills/gitnexus-debugging.md +15 -15
- package/skills/gitnexus-exploring.md +11 -11
- package/skills/gitnexus-guide.md +1 -1
- package/skills/gitnexus-impact-analysis.md +10 -10
- package/skills/gitnexus-pr-review.md +19 -19
- package/skills/gitnexus-refactoring.md +25 -25
- package/web/assets/{agent-BRX-afm3.js → agent-EkX7webX.js} +156 -131
- package/web/assets/{architectureDiagram-UL44E2DR-B1oYB8-c.js → architectureDiagram-UL44E2DR-BoczH8cv.js} +1 -1
- package/web/assets/{chunk-LCXTWHL2-SPC6pgWI.js → chunk-LCXTWHL2-By5HB3b-.js} +1 -1
- package/web/assets/{chunk-RG4AUYOV-DZXr4Yv3.js → chunk-RG4AUYOV-BQE_DkpL.js} +1 -1
- package/web/assets/{classDiagram-KGZ6W3CR-BqpOj8L9.js → classDiagram-KGZ6W3CR-Dj_02GUH.js} +1 -1
- package/web/assets/{classDiagram-v2-72OJOZXJ-FmElywK2.js → classDiagram-v2-72OJOZXJ-D-NArMpf.js} +1 -1
- package/web/assets/{diagram-3NCE3AQN-BWtJXMDq.js → diagram-3NCE3AQN-VXtXDO95.js} +1 -1
- package/web/assets/{diagram-GF46GFSD-Hh-fChxU.js → diagram-GF46GFSD-B1qab2Ah.js} +1 -1
- package/web/assets/{diagram-QXG6HAR7-DYeQHxGU.js → diagram-QXG6HAR7-BSCHGzzT.js} +1 -1
- package/web/assets/{diagram-WEQXMOUZ-DYGU4T0y.js → diagram-WEQXMOUZ-DHtknmNT.js} +1 -1
- package/web/assets/{erDiagram-L5TCEMPS-bN3wlP2A.js → erDiagram-L5TCEMPS-Db-IYTmm.js} +1 -1
- package/web/assets/{flowDiagram-H6V6AXG4-YACVtF3-.js → flowDiagram-H6V6AXG4-BHDoyVoW.js} +1 -1
- package/web/assets/{index-BhnAdWTt.js → index-BR0IhgbR.js} +10 -10
- package/web/assets/{infoDiagram-3YFTVSEB-BWBzD28-.js → infoDiagram-3YFTVSEB-6h8wbWEe.js} +1 -1
- package/web/assets/{ishikawaDiagram-BNXS4ZKH-B8qYT-j9.js → ishikawaDiagram-BNXS4ZKH-Dx2OkPk1.js} +1 -1
- package/web/assets/{kanban-definition-75IXJCU3-BeoPr5Tl.js → kanban-definition-75IXJCU3-CIIEZfqV.js} +1 -1
- package/web/assets/{mindmap-definition-2TDM6QVE-CdLLN_so.js → mindmap-definition-2TDM6QVE-DUAqydRq.js} +1 -1
- package/web/assets/{pieDiagram-CU6KROY3-DEd2a_k_.js → pieDiagram-CU6KROY3-BntYuYZa.js} +1 -1
- package/web/assets/{requirementDiagram-JXO7QTGE-QNeTo5C_.js → requirementDiagram-JXO7QTGE-QCD6I29n.js} +1 -1
- package/web/assets/{sequenceDiagram-VS2MUI6T-BHC7q7yJ.js → sequenceDiagram-VS2MUI6T-DScFwLz2.js} +1 -1
- package/web/assets/{stateDiagram-7D4R322I-KONnc2Px.js → stateDiagram-7D4R322I-AkRAm6Hl.js} +1 -1
- package/web/assets/{stateDiagram-v2-36443NZ5-C2QfuMlu.js → stateDiagram-v2-36443NZ5-BCK1vigR.js} +1 -1
- package/web/assets/{timeline-definition-O6YCAMPW-D4t4NJx1.js → timeline-definition-O6YCAMPW-BvpIVXjX.js} +1 -1
- package/web/assets/{vennDiagram-MWXL3ELB-6bctC9Yg.js → vennDiagram-MWXL3ELB-BYGWk6dK.js} +1 -1
- package/web/assets/{wardleyDiagram-CUQ6CDDI-BPZYNTvC.js → wardleyDiagram-CUQ6CDDI-Dk1z7H2T.js} +1 -1
- package/web/assets/{xychartDiagram-N2JHSOCM-lBI9O6DW.js → xychartDiagram-N2JHSOCM-2N6NCSWN.js} +1 -1
- package/web/index.html +1 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +0 -63
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.js +0 -122
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +0 -59
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.js +0 -79
- package/dist/_shared/scope-resolution/shadow/diff.js.map +0 -1
- package/dist/core/ingestion/ast-cache.d.ts +0 -26
- package/dist/core/ingestion/ast-cache.js +0 -48
- package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +0 -13
- package/dist/core/ingestion/heritage-extractors/configs/go.js +0 -20
- package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +0 -18
- package/dist/core/ingestion/heritage-extractors/configs/ruby.js +0 -65
- package/dist/core/ingestion/heritage-extractors/generic.d.ts +0 -23
- package/dist/core/ingestion/heritage-extractors/generic.js +0 -47
- package/dist/core/ingestion/heritage-processor.d.ts +0 -54
- package/dist/core/ingestion/heritage-processor.js +0 -367
- package/dist/core/ingestion/heritage-types.d.ts +0 -73
- package/dist/core/ingestion/heritage-types.js +0 -2
- package/dist/core/ingestion/import-processor.d.ts +0 -23
- package/dist/core/ingestion/import-processor.js +0 -377
- package/dist/core/ingestion/model/heritage-map.d.ts +0 -105
- package/dist/core/ingestion/model/heritage-map.js +0 -294
- package/dist/core/ingestion/model/resolution-context.d.ts +0 -93
- package/dist/core/ingestion/model/resolution-context.js +0 -337
- package/dist/core/ingestion/named-bindings/csharp.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/csharp.js +0 -37
- package/dist/core/ingestion/named-bindings/java.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/java.js +0 -29
- package/dist/core/ingestion/named-bindings/kotlin.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/kotlin.js +0 -36
- package/dist/core/ingestion/named-bindings/php.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/php.js +0 -61
- package/dist/core/ingestion/named-bindings/python.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/python.js +0 -49
- package/dist/core/ingestion/named-bindings/rust.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/rust.js +0 -66
- package/dist/core/ingestion/named-bindings/types.d.ts +0 -16
- package/dist/core/ingestion/named-bindings/types.js +0 -6
- package/dist/core/ingestion/named-bindings/typescript.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/typescript.js +0 -58
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +0 -17
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +0 -209
- package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +0 -22
- package/dist/core/ingestion/pipeline-phases/orm-extraction.js +0 -92
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +0 -70
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +0 -312
- package/dist/core/ingestion/registry-primary-flag.d.ts +0 -89
- package/dist/core/ingestion/registry-primary-flag.js +0 -122
- package/dist/core/ingestion/shadow-harness.d.ts +0 -113
- package/dist/core/ingestion/shadow-harness.js +0 -148
- package/dist/core/ingestion/utils/ruby-self-call.d.ts +0 -52
- package/dist/core/ingestion/utils/ruby-self-call.js +0 -59
- package/scripts/ci-list-migrated-languages.ts +0 -24
- package/scripts/run-parity.ts +0 -128
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-local `.gitnexusrc` support for `gitnexus analyze` (#243).
|
|
3
|
+
*
|
|
4
|
+
* Lets a repository commit recurring `analyze` defaults — default branch for the
|
|
5
|
+
* generated regression example, AI-context / skills opt-outs, embedding knobs —
|
|
6
|
+
* so contributors don't re-pass the same flags on every run. Design rules:
|
|
7
|
+
*
|
|
8
|
+
* - Config is repo-local (`.gitnexusrc` at the resolved repo root). It is NOT
|
|
9
|
+
* read from `.gitnexus/` because that directory is index storage and is
|
|
10
|
+
* commonly gitignored.
|
|
11
|
+
* - JSON only. No YAML, no `package.json` field, no global `~/.gitnexus` file
|
|
12
|
+
* in this pass.
|
|
13
|
+
* - CLI flags always override config (see {@link mergeAnalyzeOptions}).
|
|
14
|
+
* - Fail closed: unknown keys, wrong value types, conflicting aliases, and
|
|
15
|
+
* invalid JSON all throw {@link GitNexusRcError} so a typo never silently
|
|
16
|
+
* no-ops. Errors are actionable and surface before any expensive analysis.
|
|
17
|
+
* - Config values never reach a shell. Strings are validated against control
|
|
18
|
+
* and hidden/bidirectional characters so they cannot inject markdown,
|
|
19
|
+
* JSON, or hidden controls into generated context files.
|
|
20
|
+
*
|
|
21
|
+
* Both a flat shape and a nested `analyze` block are accepted:
|
|
22
|
+
*
|
|
23
|
+
* { "defaultBranch": "develop", "skipContextFiles": true }
|
|
24
|
+
* { "analyze": { "defaultBranch": "develop", "skipSkills": true } }
|
|
25
|
+
*
|
|
26
|
+
* When both set the same option, the nested `analyze` block wins (deterministic,
|
|
27
|
+
* documented precedence). Conflicting *aliases at the same level* (e.g. both
|
|
28
|
+
* `defaultBranch` and `branch`) are rejected.
|
|
29
|
+
*/
|
|
30
|
+
import fs from 'node:fs';
|
|
31
|
+
import path from 'node:path';
|
|
32
|
+
export const GITNEXUS_RC_FILENAME = '.gitnexusrc';
|
|
33
|
+
/** Final fallback when no branch is configured or detectable. */
|
|
34
|
+
export const DEFAULT_BRANCH_FALLBACK = 'main';
|
|
35
|
+
/** Git refs longer than this are almost certainly a mistake / injection attempt. */
|
|
36
|
+
const BRANCH_MAX_LENGTH = 255;
|
|
37
|
+
/**
|
|
38
|
+
* Thrown for any `.gitnexusrc` problem (missing-file is NOT an error — it
|
|
39
|
+
* returns `undefined`). The message is user-facing and names the file so the
|
|
40
|
+
* CLI can print it verbatim before starting the progress bar.
|
|
41
|
+
*/
|
|
42
|
+
export class GitNexusRcError extends Error {
|
|
43
|
+
constructor(message) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.name = 'GitNexusRcError';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Allowed `.gitnexusrc` keys and how each maps onto `AnalyzeOptions`.
|
|
50
|
+
*
|
|
51
|
+
* Aliases intentionally collapse onto a shared target:
|
|
52
|
+
* - `branch` is the legacy alias for `defaultBranch` (issue-comment shape).
|
|
53
|
+
* - `skipContextFiles` / `skipAiContext` are aliases for `skipAgentsMd` — they
|
|
54
|
+
* suppress the AGENTS.md / CLAUDE.md block ONLY. They do not imply
|
|
55
|
+
* `skipSkills`, and they are weaker than `indexOnly` (which skips all
|
|
56
|
+
* file injection). This matches the existing CLI semantics exactly.
|
|
57
|
+
* - `noStats` is the negation of `stats`.
|
|
58
|
+
*/
|
|
59
|
+
const KEY_SPECS = {
|
|
60
|
+
defaultBranch: { target: 'defaultBranch', kind: 'branch' },
|
|
61
|
+
branch: { target: 'defaultBranch', kind: 'branch' },
|
|
62
|
+
skipAgentsMd: { target: 'skipAgentsMd', kind: 'boolean' },
|
|
63
|
+
skipContextFiles: { target: 'skipAgentsMd', kind: 'boolean' },
|
|
64
|
+
skipAiContext: { target: 'skipAgentsMd', kind: 'boolean' },
|
|
65
|
+
skipSkills: { target: 'skipSkills', kind: 'boolean' },
|
|
66
|
+
indexOnly: { target: 'indexOnly', kind: 'boolean' },
|
|
67
|
+
stats: { target: 'stats', kind: 'boolean' },
|
|
68
|
+
noStats: { target: 'stats', kind: 'boolean-negate' },
|
|
69
|
+
embeddings: { target: 'embeddings', kind: 'embeddings' },
|
|
70
|
+
dropEmbeddings: { target: 'dropEmbeddings', kind: 'boolean' },
|
|
71
|
+
name: { target: 'name', kind: 'string' },
|
|
72
|
+
allowDuplicateName: { target: 'allowDuplicateName', kind: 'boolean' },
|
|
73
|
+
maxFileSize: { target: 'maxFileSize', kind: 'numeric-string' },
|
|
74
|
+
workerTimeout: { target: 'workerTimeout', kind: 'numeric-string' },
|
|
75
|
+
walCheckpointThreshold: { target: 'walCheckpointThreshold', kind: 'numeric-string' },
|
|
76
|
+
workers: { target: 'workers', kind: 'numeric-string' },
|
|
77
|
+
embeddingThreads: { target: 'embeddingThreads', kind: 'numeric-string' },
|
|
78
|
+
embeddingBatchSize: { target: 'embeddingBatchSize', kind: 'numeric-string' },
|
|
79
|
+
embeddingSubBatchSize: { target: 'embeddingSubBatchSize', kind: 'numeric-string' },
|
|
80
|
+
embeddingDevice: { target: 'embeddingDevice', kind: 'string' },
|
|
81
|
+
};
|
|
82
|
+
/** Top-level container key for the nested form; not itself an `AnalyzeOptions` field. */
|
|
83
|
+
const NESTED_KEY = 'analyze';
|
|
84
|
+
const ALLOWED_KEYS_HINT = `Allowed keys: ${Object.keys(KEY_SPECS).join(', ')} (or a nested "${NESTED_KEY}" object).`;
|
|
85
|
+
/**
|
|
86
|
+
* Reject control characters and hidden / bidirectional Unicode in a string
|
|
87
|
+
* value. These have no legitimate place in a branch name, registry name, or
|
|
88
|
+
* device string, and would otherwise let a committed config smuggle invisible
|
|
89
|
+
* controls into generated AGENTS.md / CLAUDE.md content.
|
|
90
|
+
*/
|
|
91
|
+
const isHiddenOrControl = (codePoint) => codePoint < 0x20 ||
|
|
92
|
+
codePoint === 0x7f ||
|
|
93
|
+
(codePoint >= 0x200b && codePoint <= 0x200f) || // zero-width + LRM/RLM
|
|
94
|
+
(codePoint >= 0x202a && codePoint <= 0x202e) || // bidi embeddings/overrides
|
|
95
|
+
(codePoint >= 0x2060 && codePoint <= 0x2064) || // word-joiner + invisible math
|
|
96
|
+
(codePoint >= 0x2066 && codePoint <= 0x206f) || // bidi isolates + deprecated
|
|
97
|
+
codePoint === 0xfeff; // BOM / zero-width no-break space
|
|
98
|
+
const assertNoHiddenChars = (value, source) => {
|
|
99
|
+
for (const ch of value) {
|
|
100
|
+
const cp = ch.codePointAt(0);
|
|
101
|
+
if (cp !== undefined && isHiddenOrControl(cp)) {
|
|
102
|
+
throw new GitNexusRcError(`${source}: value contains control or hidden/bidirectional characters, which are not allowed.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Validate a user-supplied branch name (from CLI or `.gitnexusrc`). Returns the
|
|
108
|
+
* trimmed name or throws {@link GitNexusRcError}. Conservative but accepts the
|
|
109
|
+
* shapes real branches use (`feature/foo-bar`, `release/1.2`, `develop`).
|
|
110
|
+
*/
|
|
111
|
+
export function validateBranchName(value, source) {
|
|
112
|
+
const trimmed = value.trim();
|
|
113
|
+
if (!trimmed) {
|
|
114
|
+
throw new GitNexusRcError(`${source}: branch name must not be empty.`);
|
|
115
|
+
}
|
|
116
|
+
if (trimmed.length > BRANCH_MAX_LENGTH) {
|
|
117
|
+
throw new GitNexusRcError(`${source}: branch name is too long (max ${BRANCH_MAX_LENGTH}).`);
|
|
118
|
+
}
|
|
119
|
+
assertNoHiddenChars(trimmed, source);
|
|
120
|
+
if (/\s/.test(trimmed)) {
|
|
121
|
+
throw new GitNexusRcError(`${source}: branch name must not contain whitespace.`);
|
|
122
|
+
}
|
|
123
|
+
// git ref-name rules (subset): reject characters git itself forbids in refs.
|
|
124
|
+
if (/[~^:?*[\\]/.test(trimmed)) {
|
|
125
|
+
throw new GitNexusRcError(`${source}: branch name contains characters not allowed in a git ref (~ ^ : ? * [ \\).`);
|
|
126
|
+
}
|
|
127
|
+
if (trimmed.startsWith('-')) {
|
|
128
|
+
throw new GitNexusRcError(`${source}: branch name must not start with "-".`);
|
|
129
|
+
}
|
|
130
|
+
if (trimmed.includes('..')) {
|
|
131
|
+
throw new GitNexusRcError(`${source}: branch name must not contain "..".`);
|
|
132
|
+
}
|
|
133
|
+
// Git permits a backtick in a ref, but the branch is embedded inside a
|
|
134
|
+
// Markdown inline-code span in the generated AGENTS.md/CLAUDE.md regression
|
|
135
|
+
// example, where a backtick would close the span early and let the rest of
|
|
136
|
+
// the template render as instruction text. Reject it at this single
|
|
137
|
+
// chokepoint so all three tiers (CLI flag, .gitnexusrc, auto-detect via
|
|
138
|
+
// sanitizeDetectedBranch) are covered (#1996 tri-review P1).
|
|
139
|
+
if (trimmed.includes('`')) {
|
|
140
|
+
throw new GitNexusRcError(`${source}: branch name must not contain a backtick (it would break the generated Markdown).`);
|
|
141
|
+
}
|
|
142
|
+
return trimmed;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Best-effort validation for an auto-detected branch (from git). Never throws —
|
|
146
|
+
* returns `undefined` for anything unusable so the resolver falls back to the
|
|
147
|
+
* next precedence tier.
|
|
148
|
+
*/
|
|
149
|
+
export function sanitizeDetectedBranch(value) {
|
|
150
|
+
if (!value)
|
|
151
|
+
return undefined;
|
|
152
|
+
try {
|
|
153
|
+
return validateBranchName(value, 'detected branch');
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const normalizeValue = (kind, value, key) => {
|
|
160
|
+
const source = `${GITNEXUS_RC_FILENAME} "${key}"`;
|
|
161
|
+
switch (kind) {
|
|
162
|
+
case 'boolean':
|
|
163
|
+
if (typeof value !== 'boolean') {
|
|
164
|
+
throw new GitNexusRcError(`${source} must be a boolean (true/false).`);
|
|
165
|
+
}
|
|
166
|
+
return value;
|
|
167
|
+
case 'boolean-negate':
|
|
168
|
+
if (typeof value !== 'boolean') {
|
|
169
|
+
throw new GitNexusRcError(`${source} must be a boolean (true/false).`);
|
|
170
|
+
}
|
|
171
|
+
return !value;
|
|
172
|
+
case 'branch':
|
|
173
|
+
if (typeof value !== 'string') {
|
|
174
|
+
throw new GitNexusRcError(`${source} must be a string branch name.`);
|
|
175
|
+
}
|
|
176
|
+
return validateBranchName(value, source);
|
|
177
|
+
case 'string': {
|
|
178
|
+
if (typeof value !== 'string') {
|
|
179
|
+
throw new GitNexusRcError(`${source} must be a string.`);
|
|
180
|
+
}
|
|
181
|
+
const trimmed = value.trim();
|
|
182
|
+
if (!trimmed) {
|
|
183
|
+
throw new GitNexusRcError(`${source} must not be empty.`);
|
|
184
|
+
}
|
|
185
|
+
assertNoHiddenChars(trimmed, source);
|
|
186
|
+
// `name` flows into the generated AGENTS.md/CLAUDE.md as `**${name}**` and
|
|
187
|
+
// inside `gitnexus://repo/${name}/…` code spans, so a Markdown-significant
|
|
188
|
+
// character would break those spans or inject emphasis/links/HTML into
|
|
189
|
+
// agent-instruction content (#1996 tri-review P1). `_` is intentionally
|
|
190
|
+
// allowed (legitimate in repo names; intraword `_` is not emphasis).
|
|
191
|
+
// embeddingDevice (the other `string`-kind option) only ever holds a
|
|
192
|
+
// fixed device token, so this guard never rejects a valid value there.
|
|
193
|
+
if (/[`*[\]<>]/.test(trimmed)) {
|
|
194
|
+
throw new GitNexusRcError(`${source} must not contain Markdown-significant characters (\` * [ ] < >).`);
|
|
195
|
+
}
|
|
196
|
+
return trimmed;
|
|
197
|
+
}
|
|
198
|
+
case 'numeric-string': {
|
|
199
|
+
// Mirror Commander's contract: these options reach the existing CLI
|
|
200
|
+
// validation as strings. Accept a JSON number or a string; normalize to a
|
|
201
|
+
// string and let the downstream per-flag validation enforce ranges so the
|
|
202
|
+
// error messages stay in one place.
|
|
203
|
+
if (typeof value === 'number') {
|
|
204
|
+
if (!Number.isFinite(value)) {
|
|
205
|
+
throw new GitNexusRcError(`${source} must be a finite number.`);
|
|
206
|
+
}
|
|
207
|
+
return String(value);
|
|
208
|
+
}
|
|
209
|
+
if (typeof value === 'string') {
|
|
210
|
+
const trimmed = value.trim();
|
|
211
|
+
if (!trimmed) {
|
|
212
|
+
throw new GitNexusRcError(`${source} must not be empty.`);
|
|
213
|
+
}
|
|
214
|
+
return trimmed;
|
|
215
|
+
}
|
|
216
|
+
throw new GitNexusRcError(`${source} must be a number or numeric string.`);
|
|
217
|
+
}
|
|
218
|
+
case 'embeddings': {
|
|
219
|
+
// Mirror `--embeddings [limit]`: boolean toggles, a non-negative integer
|
|
220
|
+
// sets the node cap (normalized to a string, as Commander would supply).
|
|
221
|
+
if (typeof value === 'boolean')
|
|
222
|
+
return value;
|
|
223
|
+
if (typeof value === 'number') {
|
|
224
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
225
|
+
throw new GitNexusRcError(`${source} must be true/false or a non-negative integer (node cap; 0 disables the cap).`);
|
|
226
|
+
}
|
|
227
|
+
return String(value);
|
|
228
|
+
}
|
|
229
|
+
throw new GitNexusRcError(`${source} must be a boolean or a non-negative integer (node cap; 0 disables the cap).`);
|
|
230
|
+
}
|
|
231
|
+
default:
|
|
232
|
+
// Exhaustive — kept for forward-compat if a new kind is added.
|
|
233
|
+
throw new GitNexusRcError(`${source}: unsupported config value kind.`);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Normalize one level (flat top-level or the nested `analyze` block) into a
|
|
238
|
+
* partial `AnalyzeOptions`. Rejects unknown keys and two aliases that configure
|
|
239
|
+
* the same option at the same level.
|
|
240
|
+
*/
|
|
241
|
+
const normalizeLevel = (obj, { allowNestedKey }) => {
|
|
242
|
+
const out = {};
|
|
243
|
+
const setBy = new Map();
|
|
244
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
245
|
+
if (allowNestedKey && key === NESTED_KEY)
|
|
246
|
+
continue; // handled separately
|
|
247
|
+
// `Object.hasOwn`, not a truthiness check: a plain-object lookup like
|
|
248
|
+
// `KEY_SPECS["__proto__"]` returns an inherited member (Object.prototype,
|
|
249
|
+
// truthy) and would slip past `if (!spec)`, hitting the wrong error branch
|
|
250
|
+
// instead of the documented "Unknown key" message (#1996 tri-review P3).
|
|
251
|
+
if (!Object.hasOwn(KEY_SPECS, key)) {
|
|
252
|
+
throw new GitNexusRcError(`Unknown key "${key}" in ${GITNEXUS_RC_FILENAME}. ${ALLOWED_KEYS_HINT}`);
|
|
253
|
+
}
|
|
254
|
+
const spec = KEY_SPECS[key];
|
|
255
|
+
const prev = setBy.get(spec.target);
|
|
256
|
+
if (prev && prev !== key) {
|
|
257
|
+
throw new GitNexusRcError(`${GITNEXUS_RC_FILENAME}: "${prev}" and "${key}" both configure the same option; set only one.`);
|
|
258
|
+
}
|
|
259
|
+
setBy.set(spec.target, key);
|
|
260
|
+
out[spec.target] = normalizeValue(spec.kind, value, key);
|
|
261
|
+
}
|
|
262
|
+
return out;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Locate, read, parse, validate, and normalize `.gitnexusrc` at `repoRoot`.
|
|
266
|
+
*
|
|
267
|
+
* @returns the normalized config defaults, or `undefined` when no file exists
|
|
268
|
+
* (the normal case). Throws {@link GitNexusRcError} on any problem.
|
|
269
|
+
*/
|
|
270
|
+
export function loadAnalyzeConfig(repoRoot) {
|
|
271
|
+
const filePath = path.join(repoRoot, GITNEXUS_RC_FILENAME);
|
|
272
|
+
let raw;
|
|
273
|
+
try {
|
|
274
|
+
raw = fs.readFileSync(filePath, 'utf-8');
|
|
275
|
+
}
|
|
276
|
+
catch (err) {
|
|
277
|
+
if (err?.code === 'ENOENT')
|
|
278
|
+
return undefined;
|
|
279
|
+
throw new GitNexusRcError(`Could not read ${GITNEXUS_RC_FILENAME}: ${err.message}`);
|
|
280
|
+
}
|
|
281
|
+
// Strip a leading UTF-8 BOM: Node's 'utf-8' decode keeps it, and JSON.parse
|
|
282
|
+
// then fails with a confusing "Unexpected token" on an otherwise-valid file
|
|
283
|
+
// (#1996 tri-review). Only one leading BOM is stripped; in-string control
|
|
284
|
+
// rejection still applies to the parsed values.
|
|
285
|
+
if (raw.charCodeAt(0) === 0xfeff)
|
|
286
|
+
raw = raw.slice(1);
|
|
287
|
+
let parsed;
|
|
288
|
+
try {
|
|
289
|
+
parsed = JSON.parse(raw);
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
throw new GitNexusRcError(`${GITNEXUS_RC_FILENAME} is not valid JSON: ${err.message}. ` +
|
|
293
|
+
`Expected a JSON object such as {"defaultBranch": "develop", "skipContextFiles": true}.`);
|
|
294
|
+
}
|
|
295
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
296
|
+
throw new GitNexusRcError(`${GITNEXUS_RC_FILENAME} must contain a JSON object.`);
|
|
297
|
+
}
|
|
298
|
+
const obj = parsed;
|
|
299
|
+
const flat = normalizeLevel(obj, { allowNestedKey: true });
|
|
300
|
+
let nested = {};
|
|
301
|
+
if (Object.prototype.hasOwnProperty.call(obj, NESTED_KEY)) {
|
|
302
|
+
const nestedRaw = obj[NESTED_KEY];
|
|
303
|
+
if (nestedRaw === null || typeof nestedRaw !== 'object' || Array.isArray(nestedRaw)) {
|
|
304
|
+
throw new GitNexusRcError(`${GITNEXUS_RC_FILENAME} "${NESTED_KEY}" must be a JSON object.`);
|
|
305
|
+
}
|
|
306
|
+
nested = normalizeLevel(nestedRaw, { allowNestedKey: false });
|
|
307
|
+
}
|
|
308
|
+
// Nested `analyze` block overrides flat top-level keys for the same option.
|
|
309
|
+
return { ...flat, ...nested };
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Merge CLI options over `.gitnexusrc` defaults. CLI wins whenever it provides a
|
|
313
|
+
* value — including an explicit `false` (so an explicit CLI off-switch beats a
|
|
314
|
+
* config `true`). Config fills only the genuinely-unset (`undefined`) options.
|
|
315
|
+
*
|
|
316
|
+
* `stats` is special: Commander always materializes it (`true` by default,
|
|
317
|
+
* `false` only when `--no-stats` is passed), so plain `??` can't tell "default
|
|
318
|
+
* on" from "explicitly on". The rule is: a passed `--no-stats` (`stats: false`)
|
|
319
|
+
* always wins; otherwise the config value applies. There is intentionally no
|
|
320
|
+
* `--stats` counter-flag, so config can only turn stats off, not force it back
|
|
321
|
+
* on against a `--no-stats`.
|
|
322
|
+
*
|
|
323
|
+
* `defaultBranch` is NOT resolved here — see {@link resolveDefaultBranch}, which
|
|
324
|
+
* applies the CLI > config > auto-detect > "main" precedence chain.
|
|
325
|
+
*/
|
|
326
|
+
export function mergeAnalyzeOptions(cli, config) {
|
|
327
|
+
if (!config)
|
|
328
|
+
return cli;
|
|
329
|
+
const merged = { ...cli };
|
|
330
|
+
for (const key of Object.keys(config)) {
|
|
331
|
+
if (key === 'stats' || key === 'defaultBranch')
|
|
332
|
+
continue; // handled below / by resolver
|
|
333
|
+
if (merged[key] === undefined) {
|
|
334
|
+
merged[key] = config[key];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (config.stats !== undefined && cli.stats !== false) {
|
|
338
|
+
merged.stats = config.stats;
|
|
339
|
+
}
|
|
340
|
+
return merged;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Resolve the default branch threaded into generated context, applying the
|
|
344
|
+
* precedence chain:
|
|
345
|
+
*
|
|
346
|
+
* CLI `--default-branch` > `.gitnexusrc` `defaultBranch`/`branch`
|
|
347
|
+
* > auto-detected `origin/HEAD` > {@link DEFAULT_BRANCH_FALLBACK} ("main").
|
|
348
|
+
*
|
|
349
|
+
* User-supplied values (CLI, config) are validated strictly and throw on bad
|
|
350
|
+
* input. The auto-detected value is best-effort and silently ignored if
|
|
351
|
+
* unusable.
|
|
352
|
+
*/
|
|
353
|
+
export function resolveDefaultBranch(input) {
|
|
354
|
+
if (input.cliBranch !== undefined) {
|
|
355
|
+
return validateBranchName(input.cliBranch, '--default-branch');
|
|
356
|
+
}
|
|
357
|
+
if (input.configBranch !== undefined) {
|
|
358
|
+
return validateBranchName(input.configBranch, `${GITNEXUS_RC_FILENAME} "defaultBranch"`);
|
|
359
|
+
}
|
|
360
|
+
const detected = sanitizeDetectedBranch(input.detectedBranch);
|
|
361
|
+
if (detected)
|
|
362
|
+
return detected;
|
|
363
|
+
return DEFAULT_BRANCH_FALLBACK;
|
|
364
|
+
}
|
package/dist/cli/analyze.d.ts
CHANGED
|
@@ -7,6 +7,15 @@
|
|
|
7
7
|
* This CLI wrapper handles: heap management, progress bar, SIGINT,
|
|
8
8
|
* skill generation (--skills), summary output, and process.exit().
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* RAM-aware re-exec heap cap (MB): `0.75 × effective RAM`, clamped to
|
|
12
|
+
* `>= DEFAULT_HEAP_MB`. Kept BELOW physical RAM on purpose — a cap `>=` RAM makes
|
|
13
|
+
* V8 collect lazily and inflate the heap into swap-thrash (observed analyzing the
|
|
14
|
+
* Linux kernel at a 30GB cap on a 31GB box). `constrainedBytes` is the cgroup
|
|
15
|
+
* limit or `null`; it is honored only as a real, smaller-than-physical cap, because
|
|
16
|
+
* `process.constrainedMemory()` returns a huge sentinel when UNCONSTRAINED.
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeHeapCapMb(totalBytes: number, constrainedBytes: number | null): number;
|
|
10
19
|
export interface AnalyzeOptions {
|
|
11
20
|
force?: boolean;
|
|
12
21
|
repairFts?: boolean;
|
|
@@ -42,6 +51,13 @@ export interface AnalyzeOptions {
|
|
|
42
51
|
stats?: boolean;
|
|
43
52
|
/** Skip installing standard GitNexus skill files to .claude/skills/gitnexus/. */
|
|
44
53
|
skipSkills?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Default branch for the generated regression-compare example (#243). From
|
|
56
|
+
* `--default-branch`; may also be supplied via `.gitnexusrc`. Resolved to a
|
|
57
|
+
* concrete branch (CLI > `.gitnexusrc` > auto-detected origin/HEAD > "main")
|
|
58
|
+
* before being threaded into the generated AGENTS.md / CLAUDE.md content.
|
|
59
|
+
*/
|
|
60
|
+
defaultBranch?: string;
|
|
45
61
|
/** Pure index mode: skip all file injection (AGENTS.md, CLAUDE.md, skills). */
|
|
46
62
|
indexOnly?: boolean;
|
|
47
63
|
/** Index the folder even when no .git directory is present. */
|
|
@@ -71,7 +87,7 @@ export interface AnalyzeOptions {
|
|
|
71
87
|
workerTimeout?: string;
|
|
72
88
|
/** Control LadybugDB WAL auto-checkpoint threshold during analyze. */
|
|
73
89
|
walCheckpointThreshold?: string;
|
|
74
|
-
/** Parse worker pool size; 0
|
|
90
|
+
/** Parse worker pool size (>=1); 0 is rejected (no sequential mode). */
|
|
75
91
|
workers?: string;
|
|
76
92
|
embeddingThreads?: string;
|
|
77
93
|
embeddingBatchSize?: string;
|