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
|
@@ -18,6 +18,7 @@ import { SupportedLanguages } from '../../_shared/index.js';
|
|
|
18
18
|
import { preprocessCobolSource, extractCobolSymbolsWithRegex, } from './cobol/cobol-preprocessor.js';
|
|
19
19
|
import { expandCopies } from './cobol/cobol-copy-expander.js';
|
|
20
20
|
import { processJclFiles } from './cobol/jcl-processor.js';
|
|
21
|
+
import { logger } from '../logger.js';
|
|
21
22
|
// ---------------------------------------------------------------------------
|
|
22
23
|
// File detection
|
|
23
24
|
// ---------------------------------------------------------------------------
|
|
@@ -68,6 +69,7 @@ export const processCobol = (graph, files, allPathSet) => {
|
|
|
68
69
|
sets: 0,
|
|
69
70
|
inspects: 0,
|
|
70
71
|
initializes: 0,
|
|
72
|
+
arithmeticOps: 0,
|
|
71
73
|
};
|
|
72
74
|
// ── 1. Separate programs, copybooks, and JCL ───────────────────────
|
|
73
75
|
const programs = [];
|
|
@@ -125,7 +127,14 @@ export const processCobol = (graph, files, allPathSet) => {
|
|
|
125
127
|
// Track module names for cross-program CALL resolution
|
|
126
128
|
const moduleNodeIds = new Map(); // uppercase program name -> node id
|
|
127
129
|
// ── 3. Process each COBOL program ──────────────────────────────────
|
|
130
|
+
const raw = parseInt(process.env.GITNEXUS_MAX_COBOL_FILE_SIZE_BYTES ?? '', 10);
|
|
131
|
+
const MAX_COBOL_FILE_SIZE = Number.isFinite(raw) && raw > 0 ? raw : 5 * 1024 * 1024;
|
|
128
132
|
for (const file of programs) {
|
|
133
|
+
// File-size guard: skip excessively large files to prevent OOM
|
|
134
|
+
if (file.content.length > MAX_COBOL_FILE_SIZE) {
|
|
135
|
+
logger.warn(`[cobol-processor] Skipping oversized file (${(file.content.length / 1024 / 1024).toFixed(1)}MB > ${(MAX_COBOL_FILE_SIZE / 1024 / 1024).toFixed(0)}MB): ${file.path}`);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
129
138
|
const fileNodeId = generateId('File', file.path);
|
|
130
139
|
// Skip if file node doesn't exist (structure-processor creates it)
|
|
131
140
|
if (!graph.getNode(fileNodeId))
|
|
@@ -156,6 +165,7 @@ export const processCobol = (graph, files, allPathSet) => {
|
|
|
156
165
|
result.sets += extracted.sets.length;
|
|
157
166
|
result.inspects += extracted.inspects.length;
|
|
158
167
|
result.initializes += extracted.initializes.length;
|
|
168
|
+
result.arithmeticOps += extracted.arithmeticOps.length;
|
|
159
169
|
}
|
|
160
170
|
// ── 4. Second pass: resolve cross-program CALL targets ─────────────
|
|
161
171
|
// During mapToGraph, early programs create unresolved CALL edges
|
|
@@ -1066,7 +1076,9 @@ function mapToGraph(graph, extracted, file, copyResolutions, moduleNodeIds) {
|
|
|
1066
1076
|
}
|
|
1067
1077
|
// ── MOVE data flow -> ACCESSES edges (read/write) ──────────────
|
|
1068
1078
|
for (const move of extracted.moves) {
|
|
1069
|
-
|
|
1079
|
+
// Strip any subscript from the source name for data item lookup
|
|
1080
|
+
const fromBase = stripMoveSubscript(move.from);
|
|
1081
|
+
const fromPropId = dataItemMap.get(fromBase.toUpperCase());
|
|
1070
1082
|
const callerId = scopedCallerLookup(move.caller, move.line);
|
|
1071
1083
|
// One read edge per MOVE (regardless of number of targets)
|
|
1072
1084
|
if (fromPropId) {
|
|
@@ -1081,7 +1093,8 @@ function mapToGraph(graph, extracted, file, copyResolutions, moduleNodeIds) {
|
|
|
1081
1093
|
}
|
|
1082
1094
|
// One write edge per target
|
|
1083
1095
|
for (const target of move.targets) {
|
|
1084
|
-
const
|
|
1096
|
+
const toBase = stripMoveSubscript(target);
|
|
1097
|
+
const toPropId = dataItemMap.get(toBase.toUpperCase());
|
|
1085
1098
|
if (toPropId) {
|
|
1086
1099
|
graph.addRelationship({
|
|
1087
1100
|
id: generateId('ACCESSES', `${callerId}->write->${target}:L${move.line}`),
|
|
@@ -1094,6 +1107,38 @@ function mapToGraph(graph, extracted, file, copyResolutions, moduleNodeIds) {
|
|
|
1094
1107
|
}
|
|
1095
1108
|
}
|
|
1096
1109
|
}
|
|
1110
|
+
// ── Arithmetic operations -> ACCESSES edges ──────────────────
|
|
1111
|
+
for (const arith of extracted.arithmeticOps) {
|
|
1112
|
+
const callerId = scopedCallerLookup(arith.caller, arith.line);
|
|
1113
|
+
// Write edge to target variable
|
|
1114
|
+
const targetBase = stripMoveSubscript(arith.target);
|
|
1115
|
+
const targetPropId = dataItemMap.get(targetBase.toUpperCase());
|
|
1116
|
+
if (targetPropId) {
|
|
1117
|
+
graph.addRelationship({
|
|
1118
|
+
id: generateId('ACCESSES', `${callerId}->arith-write->${arith.target}:L${arith.line}`),
|
|
1119
|
+
type: 'ACCESSES',
|
|
1120
|
+
sourceId: callerId,
|
|
1121
|
+
targetId: targetPropId,
|
|
1122
|
+
confidence: 0.9,
|
|
1123
|
+
reason: 'cobol-arithmetic-write',
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
// Read edge for each source operand
|
|
1127
|
+
for (const src of arith.sources) {
|
|
1128
|
+
const srcBase = stripMoveSubscript(src);
|
|
1129
|
+
const srcPropId = dataItemMap.get(srcBase.toUpperCase());
|
|
1130
|
+
if (srcPropId) {
|
|
1131
|
+
graph.addRelationship({
|
|
1132
|
+
id: generateId('ACCESSES', `${callerId}->arith-read->${src}:L${arith.line}`),
|
|
1133
|
+
type: 'ACCESSES',
|
|
1134
|
+
sourceId: callerId,
|
|
1135
|
+
targetId: srcPropId,
|
|
1136
|
+
confidence: 0.9,
|
|
1137
|
+
reason: 'cobol-arithmetic-read',
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1097
1142
|
// ── File declarations -> Record nodes ──────────────────────────
|
|
1098
1143
|
for (const fd of extracted.fileDeclarations) {
|
|
1099
1144
|
const fdId = generateId('Record', `${filePath}:${fd.selectName}`);
|
|
@@ -1219,6 +1264,10 @@ function mapToGraph(graph, extracted, file, copyResolutions, moduleNodeIds) {
|
|
|
1219
1264
|
// ---------------------------------------------------------------------------
|
|
1220
1265
|
// Helpers
|
|
1221
1266
|
// ---------------------------------------------------------------------------
|
|
1267
|
+
/** Strip parenthesized subscript/reference-modification suffixes */
|
|
1268
|
+
function stripMoveSubscript(name) {
|
|
1269
|
+
return name.replace(/\([^)]*\)/g, '').trim();
|
|
1270
|
+
}
|
|
1222
1271
|
/** Find the enclosing program name for a given line number (innermost wins). */
|
|
1223
1272
|
function findOwningProgramName(lineNum, programs) {
|
|
1224
1273
|
let best;
|
|
@@ -202,9 +202,14 @@ function buildRelationship(ref, callerId, targetDef, sourceLabel) {
|
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* Map a `Reference.kind` to an existing `RelationshipType`. Read/write
|
|
205
|
-
* both fold into `ACCESSES`; `type-reference
|
|
206
|
-
* into `USES`. This keeps the graph schema additive — no new
|
|
205
|
+
* both fold into `ACCESSES`; `type-reference`, `import-use`, and `macro`
|
|
206
|
+
* all fold into `USES`. This keeps the graph schema additive — no new
|
|
207
207
|
* RelationshipType values are introduced by this module.
|
|
208
|
+
*
|
|
209
|
+
* `macro` folds into `USES` (not `CALLS`) deliberately: a macro
|
|
210
|
+
* invocation targets a `Macro` node, not a callable function, so keeping
|
|
211
|
+
* it out of the `CALLS` keyspace preserves the invariant that `CALLS`
|
|
212
|
+
* edges denote function/method dispatch.
|
|
208
213
|
*/
|
|
209
214
|
function mapKindToType(kind) {
|
|
210
215
|
switch (kind) {
|
|
@@ -217,6 +222,7 @@ function mapKindToType(kind) {
|
|
|
217
222
|
return 'INHERITS';
|
|
218
223
|
case 'type-reference':
|
|
219
224
|
case 'import-use':
|
|
225
|
+
case 'macro':
|
|
220
226
|
return 'USES';
|
|
221
227
|
}
|
|
222
228
|
}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Determines whether a symbol (function, class, etc.) is exported/public
|
|
5
5
|
* in its language. This is a pure function — safe for use in worker threads.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Used by the language providers during worker parsing (parse-worker.ts) — the
|
|
8
|
+
* sole parse path. (Sequential parsing was removed.)
|
|
8
9
|
*/
|
|
9
10
|
import { type SyntaxNode } from './utils/ast-helpers.js';
|
|
10
11
|
/** Handler type: given a node and symbol name, return true if the symbol is exported/public. */
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Determines whether a symbol (function, class, etc.) is exported/public
|
|
5
5
|
* in its language. This is a pure function — safe for use in worker threads.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Used by the language providers during worker parsing (parse-worker.ts) — the
|
|
8
|
+
* sole parse path. (Sequential parsing was removed.)
|
|
8
9
|
*/
|
|
9
10
|
import { findSiblingChild } from './utils/ast-helpers.js';
|
|
10
11
|
// ============================================================================
|
|
@@ -62,11 +63,6 @@ const CSHARP_DECL_TYPES = new Set([
|
|
|
62
63
|
'struct_declaration',
|
|
63
64
|
'enum_declaration',
|
|
64
65
|
'record_declaration',
|
|
65
|
-
// tree-sitter-c-sharp absorbs 'record struct' and 'record class' into
|
|
66
|
-
// record_declaration — these two node types are listed defensively but
|
|
67
|
-
// never emitted by the grammar in practice (verified against ^0.23.1).
|
|
68
|
-
'record_struct_declaration',
|
|
69
|
-
'record_class_declaration',
|
|
70
66
|
'delegate_declaration',
|
|
71
67
|
'property_declaration',
|
|
72
68
|
'field_declaration',
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import type { FieldExtractionConfig } from '../generic.js';
|
|
2
|
-
/**
|
|
3
|
-
* Dart field extraction config.
|
|
4
|
-
*
|
|
5
|
-
* Dart class fields appear as declaration nodes inside class_body.
|
|
6
|
-
* Visibility is convention-based: underscore prefix = private.
|
|
7
|
-
*/
|
|
8
2
|
export declare const dartConfig: FieldExtractionConfig;
|
|
@@ -5,74 +5,92 @@ import { extractSimpleTypeName } from '../../type-extractors/shared.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Dart field extraction config.
|
|
7
7
|
*
|
|
8
|
-
* Dart class fields appear as declaration nodes inside class_body
|
|
8
|
+
* Dart class fields appear as `declaration` nodes inside `class_body`.
|
|
9
|
+
* Two shapes carry the field name(s):
|
|
10
|
+
* - instance / plain fields → `initialized_identifier_list`
|
|
11
|
+
* (`int z = 0;`, `int a = 1, b = 2;`)
|
|
12
|
+
* - `static const` / `static final` / `const` fields → `static_final_declaration_list`
|
|
13
|
+
* (`static const a = 1;`, `static final String b = 'x', c = 'y';`)
|
|
14
|
+
* Both shapes may declare SEVERAL fields in one declaration, so name extraction
|
|
15
|
+
* is multi-name (`extractNames`). The structure query (`DART_QUERIES`) emits one
|
|
16
|
+
* `@definition.property` per name for both shapes; this config enriches each.
|
|
17
|
+
*
|
|
9
18
|
* Visibility is convention-based: underscore prefix = private.
|
|
10
19
|
*/
|
|
20
|
+
/** All field names declared by a `declaration` node, across both Dart shapes. */
|
|
21
|
+
function extractDartFieldNames(node) {
|
|
22
|
+
const names = [];
|
|
23
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
24
|
+
const child = node.namedChild(i);
|
|
25
|
+
if (!child)
|
|
26
|
+
continue;
|
|
27
|
+
// instance / plain fields: initialized_identifier_list > initialized_identifier > identifier
|
|
28
|
+
if (child.type === 'initialized_identifier_list') {
|
|
29
|
+
for (let j = 0; j < child.namedChildCount; j++) {
|
|
30
|
+
const init = child.namedChild(j);
|
|
31
|
+
if (init?.type === 'initialized_identifier') {
|
|
32
|
+
const ident = init.firstNamedChild;
|
|
33
|
+
if (ident?.type === 'identifier')
|
|
34
|
+
names.push(ident.text);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// static const / final fields: static_final_declaration_list > static_final_declaration > identifier
|
|
39
|
+
if (child.type === 'static_final_declaration_list') {
|
|
40
|
+
for (let j = 0; j < child.namedChildCount; j++) {
|
|
41
|
+
const decl = child.namedChild(j);
|
|
42
|
+
if (decl?.type === 'static_final_declaration') {
|
|
43
|
+
const ident = decl.firstNamedChild;
|
|
44
|
+
if (ident?.type === 'identifier')
|
|
45
|
+
names.push(ident.text);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return names;
|
|
51
|
+
}
|
|
11
52
|
export const dartConfig = {
|
|
12
53
|
language: SupportedLanguages.Dart,
|
|
13
54
|
typeDeclarationNodes: ['class_definition'],
|
|
14
55
|
fieldNodeTypes: ['declaration'],
|
|
15
56
|
bodyNodeTypes: ['class_body'],
|
|
16
57
|
defaultVisibility: 'public',
|
|
58
|
+
// One AST `declaration` node may declare several fields (`int a, b;`,
|
|
59
|
+
// `static final String b = 'x', c = 'y';`), so use the multi-name path.
|
|
17
60
|
extractName(node) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (let j = 0; j < child.namedChildCount; j++) {
|
|
23
|
-
const init = child.namedChild(j);
|
|
24
|
-
if (init?.type === 'initialized_identifier') {
|
|
25
|
-
const ident = init.firstNamedChild;
|
|
26
|
-
if (ident?.type === 'identifier')
|
|
27
|
-
return ident.text;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (child?.type === 'initialized_identifier') {
|
|
32
|
-
const ident = child.firstNamedChild;
|
|
33
|
-
if (ident?.type === 'identifier')
|
|
34
|
-
return ident.text;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// fallback: look for direct identifier
|
|
38
|
-
const name = node.childForFieldName('name');
|
|
39
|
-
return name?.text;
|
|
61
|
+
return extractDartFieldNames(node)[0];
|
|
62
|
+
},
|
|
63
|
+
extractNames(node) {
|
|
64
|
+
return extractDartFieldNames(node);
|
|
40
65
|
},
|
|
41
66
|
extractType(node) {
|
|
42
|
-
// declaration > type_identifier (
|
|
67
|
+
// declaration > type_identifier (the type annotation, present for both the
|
|
68
|
+
// instance-field shape and `static final String b = …`). `static const a = 1;`
|
|
69
|
+
// has no annotation → undefined (untyped).
|
|
43
70
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
44
71
|
const child = node.namedChild(i);
|
|
45
|
-
if (child &&
|
|
46
|
-
(child.type === 'type_identifier' ||
|
|
47
|
-
child.type === 'generic_type' ||
|
|
48
|
-
child.type === 'function_type')) {
|
|
72
|
+
if (child && (child.type === 'type_identifier' || child.type === 'function_type')) {
|
|
49
73
|
return extractSimpleTypeName(child) ?? child.text?.trim();
|
|
50
74
|
}
|
|
51
75
|
}
|
|
52
76
|
return undefined;
|
|
53
77
|
},
|
|
78
|
+
// Per-name: Dart convention is underscore-prefixed = private. A single
|
|
79
|
+
// declaration can mix visibilities (`static const _p = 1, q = 2;`), so the
|
|
80
|
+
// decision is keyed on the individual field name.
|
|
81
|
+
extractVisibilityForName(_node, name) {
|
|
82
|
+
return name.startsWith('_') ? 'private' : 'public';
|
|
83
|
+
},
|
|
54
84
|
extractVisibility(node) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
for (let i = 0; i < node.namedChildCount; i++) {
|
|
58
|
-
const child = node.namedChild(i);
|
|
59
|
-
if (child?.type === 'initialized_identifier_list') {
|
|
60
|
-
for (let j = 0; j < child.namedChildCount; j++) {
|
|
61
|
-
const init = child.namedChild(j);
|
|
62
|
-
if (init?.type === 'initialized_identifier') {
|
|
63
|
-
const ident = init.firstNamedChild;
|
|
64
|
-
if (ident?.text?.startsWith('_'))
|
|
65
|
-
return 'private';
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return 'public';
|
|
85
|
+
const first = extractDartFieldNames(node)[0];
|
|
86
|
+
return first?.startsWith('_') ? 'private' : 'public';
|
|
71
87
|
},
|
|
72
88
|
isStatic(node) {
|
|
73
89
|
return hasKeyword(node, 'static');
|
|
74
90
|
},
|
|
75
91
|
isReadonly(node) {
|
|
92
|
+
// `final` / `const` (both `final_builtin`/`const_builtin` nodes whose text
|
|
93
|
+
// is `final`/`const`) are read-only.
|
|
76
94
|
return hasKeyword(node, 'final') || hasKeyword(node, 'const');
|
|
77
95
|
},
|
|
78
96
|
};
|
|
@@ -1,11 +1,2 @@
|
|
|
1
1
|
import type { FieldExtractionConfig } from '../generic.js';
|
|
2
|
-
/**
|
|
3
|
-
* Go field extraction config.
|
|
4
|
-
*
|
|
5
|
-
* Go struct fields live inside type_declaration > type_spec > struct_type >
|
|
6
|
-
* field_declaration_list > field_declaration.
|
|
7
|
-
*
|
|
8
|
-
* Visibility in Go is based on the first character: uppercase = exported (public),
|
|
9
|
-
* lowercase = unexported (package).
|
|
10
|
-
*/
|
|
11
2
|
export declare const goConfig: FieldExtractionConfig;
|
|
@@ -10,13 +10,48 @@ import { extractSimpleTypeName } from '../../type-extractors/shared.js';
|
|
|
10
10
|
* Visibility in Go is based on the first character: uppercase = exported (public),
|
|
11
11
|
* lowercase = unexported (package).
|
|
12
12
|
*/
|
|
13
|
+
function goVisibilityForName(name) {
|
|
14
|
+
const first = name.charAt(0);
|
|
15
|
+
return first === first.toUpperCase() && first !== first.toLowerCase() ? 'public' : 'package';
|
|
16
|
+
}
|
|
17
|
+
function extractGoFieldNames(node) {
|
|
18
|
+
const names = [];
|
|
19
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
20
|
+
const child = node.namedChild(i);
|
|
21
|
+
if (child?.type === 'field_identifier')
|
|
22
|
+
names.push(child.text);
|
|
23
|
+
}
|
|
24
|
+
return names;
|
|
25
|
+
}
|
|
13
26
|
export const goConfig = {
|
|
14
27
|
language: SupportedLanguages.Go,
|
|
15
|
-
typeDeclarationNodes: ['type_declaration'],
|
|
28
|
+
typeDeclarationNodes: ['type_declaration', 'struct_type'],
|
|
16
29
|
fieldNodeTypes: ['field_declaration'],
|
|
17
30
|
bodyNodeTypes: ['field_declaration_list'],
|
|
18
31
|
defaultVisibility: 'package',
|
|
32
|
+
extractOwnerName(node) {
|
|
33
|
+
if (node.type === 'struct_type') {
|
|
34
|
+
return node.parent?.type === 'type_spec'
|
|
35
|
+
? node.parent.childForFieldName('name')?.text
|
|
36
|
+
: undefined;
|
|
37
|
+
}
|
|
38
|
+
const typeSpec = node.namedChildren.find((child) => child.type === 'type_spec');
|
|
39
|
+
return typeSpec?.childForFieldName('name')?.text;
|
|
40
|
+
},
|
|
41
|
+
findBodyNodes(node) {
|
|
42
|
+
if (node.type === 'struct_type') {
|
|
43
|
+
const body = node.namedChildren.find((child) => child.type === 'field_declaration_list');
|
|
44
|
+
return body ? [body] : [];
|
|
45
|
+
}
|
|
46
|
+
const typeSpec = node.namedChildren.find((child) => child.type === 'type_spec');
|
|
47
|
+
const typeNode = typeSpec?.childForFieldName('type');
|
|
48
|
+
const body = typeNode?.namedChildren.find((child) => child.type === 'field_declaration_list');
|
|
49
|
+
return body ? [body] : [];
|
|
50
|
+
},
|
|
19
51
|
extractName(node) {
|
|
52
|
+
const firstName = extractGoFieldNames(node)[0];
|
|
53
|
+
if (firstName)
|
|
54
|
+
return firstName;
|
|
20
55
|
// field_declaration > name:(field_identifier)
|
|
21
56
|
const name = node.childForFieldName('name');
|
|
22
57
|
if (name)
|
|
@@ -29,6 +64,7 @@ export const goConfig = {
|
|
|
29
64
|
}
|
|
30
65
|
return undefined;
|
|
31
66
|
},
|
|
67
|
+
extractNames: extractGoFieldNames,
|
|
32
68
|
extractType(node) {
|
|
33
69
|
// field_declaration > type:(type_identifier | pointer_type | ...)
|
|
34
70
|
const typeNode = node.childForFieldName('type');
|
|
@@ -51,6 +87,9 @@ export const goConfig = {
|
|
|
51
87
|
}
|
|
52
88
|
return 'package';
|
|
53
89
|
},
|
|
90
|
+
extractVisibilityForName(_node, name) {
|
|
91
|
+
return goVisibilityForName(name);
|
|
92
|
+
},
|
|
54
93
|
isStatic(_node) {
|
|
55
94
|
return false; // Go has no static fields
|
|
56
95
|
},
|
|
@@ -60,12 +60,49 @@ export const javaConfig = {
|
|
|
60
60
|
// Kotlin
|
|
61
61
|
// ---------------------------------------------------------------------------
|
|
62
62
|
const KOTLIN_VIS = new Set(['public', 'private', 'protected', 'internal']);
|
|
63
|
+
/** A property_declaration is a companion-object member when its nearest
|
|
64
|
+
* class-body ancestor is the body of a companion_object (F52, issue #1919).
|
|
65
|
+
* Companion members are addressed statically through the enclosing class
|
|
66
|
+
* (`C.TAG`), so they are marked static. */
|
|
67
|
+
function isInsideKotlinCompanion(node) {
|
|
68
|
+
for (let cur = node.parent; cur !== null; cur = cur.parent) {
|
|
69
|
+
if (cur.type === 'class_body')
|
|
70
|
+
return cur.parent?.type === 'companion_object';
|
|
71
|
+
if (cur.type === 'companion_object')
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
63
76
|
export const kotlinConfig = {
|
|
64
77
|
language: SupportedLanguages.Kotlin,
|
|
65
|
-
|
|
78
|
+
// F52: include companion_object so a companion property's innermost
|
|
79
|
+
// class-container owner (findEnclosingClassNode returns the companion_object)
|
|
80
|
+
// is recognized as a type declaration and its nested class_body is walked.
|
|
81
|
+
// The structure query already creates the Property node and owns it on the
|
|
82
|
+
// ENCLOSING class for anonymous companions / on the named companion Class —
|
|
83
|
+
// this entry only drives field-metadata enrichment, so it does NOT change
|
|
84
|
+
// ownership or emit a second node (no double-count).
|
|
85
|
+
typeDeclarationNodes: ['class_declaration', 'object_declaration', 'companion_object'],
|
|
66
86
|
fieldNodeTypes: ['property_declaration'],
|
|
67
87
|
bodyNodeTypes: ['class_body'],
|
|
68
88
|
defaultVisibility: 'public',
|
|
89
|
+
// F52: an anonymous `companion object { ... }` has no name child, so the
|
|
90
|
+
// generic factory's `childForFieldName('name')` owner lookup is empty and
|
|
91
|
+
// `extract()` would bail before walking the body. Supply a stable owner
|
|
92
|
+
// name (the named companion's identifier, else "Companion") so the body IS
|
|
93
|
+
// walked; the resulting FieldInfo map is keyed by field NAME only, so the
|
|
94
|
+
// owner name does not affect which Property node gets enriched.
|
|
95
|
+
extractOwnerName(node) {
|
|
96
|
+
const typeIdentifierText = node.namedChildren.find((c) => c.type === 'type_identifier')?.text;
|
|
97
|
+
if (node.type === 'companion_object') {
|
|
98
|
+
// Anonymous companions have no type_identifier — fall back to "Companion".
|
|
99
|
+
return typeIdentifierText ?? 'Companion';
|
|
100
|
+
}
|
|
101
|
+
const name = node.childForFieldName('name');
|
|
102
|
+
if (name)
|
|
103
|
+
return name.text;
|
|
104
|
+
return typeIdentifierText;
|
|
105
|
+
},
|
|
69
106
|
extractName(node) {
|
|
70
107
|
// property_declaration > variable_declaration > simple_identifier
|
|
71
108
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
@@ -107,9 +144,11 @@ export const kotlinConfig = {
|
|
|
107
144
|
extractVisibility(node) {
|
|
108
145
|
return findVisibility(node, KOTLIN_VIS, 'public', 'modifiers');
|
|
109
146
|
},
|
|
110
|
-
isStatic(
|
|
111
|
-
// Kotlin
|
|
112
|
-
|
|
147
|
+
isStatic(node) {
|
|
148
|
+
// Kotlin has no `static`, but companion-object members are accessed
|
|
149
|
+
// statically through the enclosing class (`C.TAG`) — mark them static
|
|
150
|
+
// so the field metadata reflects that (F52).
|
|
151
|
+
return isInsideKotlinCompanion(node);
|
|
113
152
|
},
|
|
114
153
|
isReadonly(node) {
|
|
115
154
|
// 'val' = readonly, 'var' = mutable
|
|
@@ -46,8 +46,7 @@ export const phpConfig = {
|
|
|
46
46
|
child.type === 'named_type' ||
|
|
47
47
|
child.type === 'optional_type' ||
|
|
48
48
|
child.type === 'primitive_type' ||
|
|
49
|
-
child.type === 'intersection_type'
|
|
50
|
-
child.type === 'nullable_type') {
|
|
49
|
+
child.type === 'intersection_type') {
|
|
51
50
|
return extractSimpleTypeName(child) ?? child.text?.trim();
|
|
52
51
|
}
|
|
53
52
|
}
|
|
@@ -2,7 +2,18 @@ import type { FieldExtractionConfig } from '../generic.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Swift field extraction config.
|
|
4
4
|
*
|
|
5
|
-
* Handles property_declaration inside class_body / protocol_body
|
|
5
|
+
* Handles property_declaration inside class_body / protocol_body and
|
|
6
|
+
* protocol_property_declaration inside protocol_body (F75 — protocol property
|
|
7
|
+
* requirements like "var title: String { get }").
|
|
8
|
+
*
|
|
6
9
|
* tree-sitter-swift uses property_declaration for stored/computed properties.
|
|
10
|
+
* A protocol property requirement parses to its own node type,
|
|
11
|
+
* protocol_property_declaration, whose name lives in a "name:" pattern field
|
|
12
|
+
* (pattern > value_binding_pattern + simple_identifier(bound_identifier)), its
|
|
13
|
+
* type in a sibling type_annotation, and its "{ get }" / "{ get set }" in a
|
|
14
|
+
* protocol_property_requirements child. Note: Swift reuses the "name:" field
|
|
15
|
+
* across many positions (func name, every parameter label, parameter/return
|
|
16
|
+
* type), so the name is synthesized from the simple_identifier inside the
|
|
17
|
+
* pattern rather than read blindly off "name:".
|
|
7
18
|
*/
|
|
8
19
|
export declare const swiftConfig: FieldExtractionConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// gitnexus/src/core/ingestion/field-extractors/configs/swift.ts
|
|
2
2
|
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
3
|
-
import { hasKeyword, findVisibility } from './helpers.js';
|
|
3
|
+
import { hasKeyword, hasModifier, findVisibility } from './helpers.js';
|
|
4
4
|
import { extractSimpleTypeName } from '../../type-extractors/shared.js';
|
|
5
5
|
const SWIFT_VIS = new Set([
|
|
6
6
|
'public',
|
|
@@ -12,17 +12,32 @@ const SWIFT_VIS = new Set([
|
|
|
12
12
|
/**
|
|
13
13
|
* Swift field extraction config.
|
|
14
14
|
*
|
|
15
|
-
* Handles property_declaration inside class_body / protocol_body
|
|
15
|
+
* Handles property_declaration inside class_body / protocol_body and
|
|
16
|
+
* protocol_property_declaration inside protocol_body (F75 — protocol property
|
|
17
|
+
* requirements like "var title: String { get }").
|
|
18
|
+
*
|
|
16
19
|
* tree-sitter-swift uses property_declaration for stored/computed properties.
|
|
20
|
+
* A protocol property requirement parses to its own node type,
|
|
21
|
+
* protocol_property_declaration, whose name lives in a "name:" pattern field
|
|
22
|
+
* (pattern > value_binding_pattern + simple_identifier(bound_identifier)), its
|
|
23
|
+
* type in a sibling type_annotation, and its "{ get }" / "{ get set }" in a
|
|
24
|
+
* protocol_property_requirements child. Note: Swift reuses the "name:" field
|
|
25
|
+
* across many positions (func name, every parameter label, parameter/return
|
|
26
|
+
* type), so the name is synthesized from the simple_identifier inside the
|
|
27
|
+
* pattern rather than read blindly off "name:".
|
|
17
28
|
*/
|
|
18
29
|
export const swiftConfig = {
|
|
19
30
|
language: SupportedLanguages.Swift,
|
|
20
|
-
typeDeclarationNodes: ['class_declaration', '
|
|
21
|
-
fieldNodeTypes: ['property_declaration'],
|
|
31
|
+
typeDeclarationNodes: ['class_declaration', 'protocol_declaration'],
|
|
32
|
+
fieldNodeTypes: ['property_declaration', 'protocol_property_declaration'],
|
|
22
33
|
bodyNodeTypes: ['class_body', 'protocol_body'],
|
|
23
34
|
defaultVisibility: 'internal',
|
|
24
35
|
extractName(node) {
|
|
25
|
-
// property_declaration > pattern > simple_identifier
|
|
36
|
+
// property_declaration > pattern > simple_identifier, and
|
|
37
|
+
// protocol_property_declaration > name: (pattern ... simple_identifier).
|
|
38
|
+
// For protocol_property_declaration the pattern wraps a leading
|
|
39
|
+
// value_binding_pattern ("var") plus the simple_identifier — the loop
|
|
40
|
+
// below skips the binding keyword and returns the identifier.
|
|
26
41
|
for (let i = 0; i < node.namedChildCount; i++) {
|
|
27
42
|
const child = node.namedChild(i);
|
|
28
43
|
if (child?.type === 'pattern') {
|
|
@@ -56,7 +71,17 @@ export const swiftConfig = {
|
|
|
56
71
|
return findVisibility(node, SWIFT_VIS, 'internal', 'modifiers');
|
|
57
72
|
},
|
|
58
73
|
isStatic(node) {
|
|
59
|
-
|
|
74
|
+
// `static`/`class` (type-level) modifiers live inside a `modifiers`
|
|
75
|
+
// wrapper for both property_declaration and protocol_property_declaration
|
|
76
|
+
// (e.g. `static var shared: P { get }`), so check the wrapper too.
|
|
77
|
+
// `hasKeyword` compares each direct child by `.text` equality: it matches a
|
|
78
|
+
// single-modifier wrapper (`modifiers.text === 'static'`) but fails for a
|
|
79
|
+
// multi-modifier wrapper (`private static` → `modifiers.text === 'private static'`),
|
|
80
|
+
// which `hasModifier` handles by descending into the wrapper's children.
|
|
81
|
+
return (hasKeyword(node, 'static') ||
|
|
82
|
+
hasKeyword(node, 'class') ||
|
|
83
|
+
hasModifier(node, 'modifiers', 'static') ||
|
|
84
|
+
hasModifier(node, 'modifiers', 'class'));
|
|
60
85
|
},
|
|
61
86
|
isReadonly(node) {
|
|
62
87
|
// 'let' = constant/readonly, 'var' = variable
|
|
@@ -19,6 +19,10 @@ export interface FieldExtractionConfig {
|
|
|
19
19
|
bodyNodeTypes: string[];
|
|
20
20
|
/** Default visibility when no modifier is present */
|
|
21
21
|
defaultVisibility: FieldVisibility;
|
|
22
|
+
/** Extract owner type name from a type declaration node. */
|
|
23
|
+
extractOwnerName?: (node: SyntaxNode) => string | undefined;
|
|
24
|
+
/** Find body nodes inside a type declaration node. */
|
|
25
|
+
findBodyNodes?: (node: SyntaxNode) => SyntaxNode[];
|
|
22
26
|
/**
|
|
23
27
|
* Extract field name from a field declaration node.
|
|
24
28
|
* Use this for nodes that declare exactly one field.
|
|
@@ -35,6 +39,8 @@ export interface FieldExtractionConfig {
|
|
|
35
39
|
extractType: (node: SyntaxNode) => string | undefined;
|
|
36
40
|
/** Extract visibility from a field declaration node */
|
|
37
41
|
extractVisibility: (node: SyntaxNode) => FieldVisibility;
|
|
42
|
+
/** Extract visibility for one field name from a multi-name declaration. */
|
|
43
|
+
extractVisibilityForName?: (node: SyntaxNode, name: string) => FieldVisibility;
|
|
38
44
|
/** Check if a field is static */
|
|
39
45
|
isStatic: (node: SyntaxNode) => boolean;
|
|
40
46
|
/** Check if a field is readonly/final/const */
|
|
@@ -21,10 +21,9 @@ export function createFieldExtractor(config) {
|
|
|
21
21
|
extract(node, context) {
|
|
22
22
|
if (!this.isTypeDeclaration(node))
|
|
23
23
|
return null;
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
24
|
+
const ownerFqn = config.extractOwnerName?.(node) ?? node.childForFieldName('name')?.text;
|
|
25
|
+
if (!ownerFqn)
|
|
26
26
|
return null;
|
|
27
|
-
const ownerFqn = nameNode.text;
|
|
28
27
|
const fields = [];
|
|
29
28
|
// Find body container(s)
|
|
30
29
|
const bodies = this.findBodies(node);
|
|
@@ -43,6 +42,8 @@ export function createFieldExtractor(config) {
|
|
|
43
42
|
// private helpers
|
|
44
43
|
// ------------------------------------------------------------------
|
|
45
44
|
findBodies(node) {
|
|
45
|
+
if (config.findBodyNodes)
|
|
46
|
+
return config.findBodyNodes(node);
|
|
46
47
|
const result = [];
|
|
47
48
|
// Try named 'body' field first
|
|
48
49
|
const bodyField = node.childForFieldName('body');
|
|
@@ -105,7 +106,7 @@ export function createFieldExtractor(config) {
|
|
|
105
106
|
return {
|
|
106
107
|
name,
|
|
107
108
|
type,
|
|
108
|
-
visibility: config.extractVisibility(node),
|
|
109
|
+
visibility: config.extractVisibilityForName?.(node, name) ?? config.extractVisibility(node),
|
|
109
110
|
isStatic: config.isStatic(node),
|
|
110
111
|
isReadonly: config.isReadonly(node),
|
|
111
112
|
sourceFile: context.filePath,
|