gitnexus 1.6.11-rc.8 → 1.6.11
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 +95 -26
- package/dist/_shared/graph/types.d.ts +81 -2
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/integrations/circuit-breaker.d.ts.map +1 -1
- package/dist/_shared/integrations/circuit-breaker.js.map +1 -1
- package/dist/_shared/integrations/resilient-fetch.d.ts.map +1 -1
- package/dist/_shared/integrations/resilient-fetch.js.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +2 -0
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/languages.d.ts +2 -1
- package/dist/_shared/languages.d.ts.map +1 -1
- package/dist/_shared/languages.js +1 -0
- package/dist/_shared/languages.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +2 -2
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +4 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/scope-resolution/evidence-weights.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/finalize-algorithm.js +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.d.ts +3 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.js +4 -0
- package/dist/_shared/scope-resolution/language-classification.js.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +10 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +15 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +4 -0
- package/dist/cli/ai-context.js +90 -14
- package/dist/cli/analyze-config.js +14 -0
- package/dist/cli/analyze-options.d.ts +14 -0
- package/dist/cli/analyze-watch.d.ts +20 -0
- package/dist/cli/analyze-watch.js +434 -0
- package/dist/cli/analyze.js +27 -9
- package/dist/cli/auto-sync.d.ts +1 -0
- package/dist/cli/auto-sync.js +107 -0
- package/dist/cli/command-banner.d.ts +15 -0
- package/dist/cli/command-banner.js +42 -0
- package/dist/cli/detect-changes-format.js +21 -0
- package/dist/cli/doctor.d.ts +7 -0
- package/dist/cli/doctor.js +14 -0
- package/dist/cli/group.js +7 -1
- package/dist/cli/help-i18n.js +4 -0
- package/dist/cli/i18n/en.d.ts +18 -3
- package/dist/cli/i18n/en.js +18 -3
- package/dist/cli/i18n/resources.d.ts +33 -3
- package/dist/cli/i18n/zh-CN.d.ts +15 -0
- package/dist/cli/i18n/zh-CN.js +18 -3
- package/dist/cli/index.js +34 -7
- package/dist/cli/mcp.d.ts +15 -0
- package/dist/cli/mcp.js +44 -0
- package/dist/cli/optional-grammars.d.ts +3 -2
- package/dist/cli/optional-grammars.js +19 -3
- package/dist/cli/setup.js +41 -15
- package/dist/cli/update-notice.d.ts +34 -0
- package/dist/cli/update-notice.js +91 -0
- package/dist/cli/update.d.ts +21 -0
- package/dist/cli/update.js +93 -0
- package/dist/cli/watch.d.ts +1 -20
- package/dist/cli/watch.js +5 -371
- package/dist/core/analysis-feature-registry.d.ts +2 -0
- package/dist/core/analysis-feature-registry.js +15 -0
- package/dist/core/analyzer-identity.js +21 -3
- package/dist/core/auto-sync/analysis-worker-launch.d.ts +30 -0
- package/dist/core/auto-sync/analysis-worker-launch.js +166 -0
- package/dist/core/auto-sync/config.d.ts +33 -0
- package/dist/core/auto-sync/config.js +320 -0
- package/dist/core/auto-sync/index.d.ts +6 -0
- package/dist/core/auto-sync/index.js +6 -0
- package/dist/core/auto-sync/path-security.d.ts +9 -0
- package/dist/core/auto-sync/path-security.js +251 -0
- package/dist/core/auto-sync/repo.d.ts +1 -0
- package/dist/core/auto-sync/repo.js +6 -0
- package/dist/core/auto-sync/runner.d.ts +44 -0
- package/dist/core/auto-sync/runner.js +428 -0
- package/dist/core/auto-sync/starter.d.ts +50 -0
- package/dist/core/auto-sync/starter.js +497 -0
- package/dist/core/auto-sync/state.d.ts +37 -0
- package/dist/core/auto-sync/state.js +119 -0
- package/dist/core/group/config-parser.js +8 -1
- package/dist/core/group/cross-impact.d.ts +3 -0
- package/dist/core/group/cross-impact.js +36 -4
- package/dist/core/group/extractors/http-patterns/java.js +22 -8
- package/dist/core/group/extractors/http-patterns/kotlin.js +86 -31
- package/dist/core/group/extractors/http-patterns/node.js +145 -8
- package/dist/core/group/extractors/http-patterns/python.js +11 -7
- package/dist/core/group/extractors/http-route-extractor.js +63 -17
- package/dist/core/group/extractors/java-workspace-extractor.js +244 -31
- package/dist/core/group/group-lock.js +5 -6
- package/dist/core/group/normalization.d.ts +38 -1
- package/dist/core/group/normalization.js +59 -3
- package/dist/core/group/service.d.ts +11 -0
- package/dist/core/group/service.js +13 -1
- package/dist/core/group/storage.js +2 -2
- package/dist/core/group/sync.d.ts +24 -1
- package/dist/core/group/sync.js +46 -8
- package/dist/core/group/types.d.ts +13 -0
- package/dist/core/incremental/derived-writeback.d.ts +36 -0
- package/dist/core/incremental/derived-writeback.js +68 -0
- package/dist/core/incremental/spring-config-drift.d.ts +12 -0
- package/dist/core/incremental/spring-config-drift.js +46 -0
- package/dist/core/incremental/subgraph-extract.d.ts +7 -4
- package/dist/core/incremental/subgraph-extract.js +30 -5
- package/dist/core/ingestion/asyncapi/document.d.ts +226 -0
- package/dist/core/ingestion/asyncapi/document.js +758 -0
- package/dist/core/ingestion/asyncapi/protocol.d.ts +79 -0
- package/dist/core/ingestion/asyncapi/protocol.js +203 -0
- package/dist/core/ingestion/call-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/zig.js +4 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.d.ts +100 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.js +319 -0
- package/dist/core/ingestion/call-processor.js +3 -1
- package/dist/core/ingestion/class-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/zig.js +32 -0
- package/dist/core/ingestion/class-extractors/generic.js +4 -1
- package/dist/core/ingestion/class-types.d.ts +6 -2
- package/dist/core/ingestion/destination-key.d.ts +59 -0
- package/dist/core/ingestion/destination-key.js +61 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +6 -2
- package/dist/core/ingestion/entry-point-scoring.js +8 -44
- package/dist/core/ingestion/export-detection.d.ts +37 -0
- package/dist/core/ingestion/export-detection.js +60 -0
- package/dist/core/ingestion/field-extractors/configs/zig.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/zig.js +49 -0
- package/dist/core/ingestion/field-extractors/generic.d.ts +1 -1
- package/dist/core/ingestion/field-extractors/generic.js +12 -1
- package/dist/core/ingestion/frameworks/spring/actuator-runtime.d.ts +26 -0
- package/dist/core/ingestion/frameworks/spring/actuator-runtime.js +843 -0
- package/dist/core/ingestion/frameworks/spring/analysis-features.d.ts +5 -0
- package/dist/core/ingestion/frameworks/spring/analysis-features.js +9 -0
- package/dist/core/ingestion/frameworks/spring/annotation-arguments.js +8 -1
- package/dist/core/ingestion/frameworks/spring/argument-facts.d.ts +80 -0
- package/dist/core/ingestion/frameworks/spring/argument-facts.js +85 -0
- package/dist/core/ingestion/frameworks/spring/config-bindings.d.ts +1 -0
- package/dist/core/ingestion/frameworks/spring/config-bindings.js +2 -1
- package/dist/core/ingestion/frameworks/spring/destinations.d.ts +539 -0
- package/dist/core/ingestion/frameworks/spring/destinations.js +840 -0
- package/dist/core/ingestion/frameworks/spring/dynamic-lookups.d.ts +22 -0
- package/dist/core/ingestion/frameworks/spring/dynamic-lookups.js +124 -0
- package/dist/core/ingestion/frameworks/spring/message-producers.d.ts +78 -0
- package/dist/core/ingestion/frameworks/spring/message-producers.js +90 -0
- package/dist/core/ingestion/frameworks/spring/non-http-handlers.d.ts +29 -0
- package/dist/core/ingestion/frameworks/spring/vendor-prefixes.d.ts +7 -0
- package/dist/core/ingestion/frameworks/spring/vendor-prefixes.js +22 -0
- package/dist/core/ingestion/import-resolvers/configs/zig.d.ts +13 -0
- package/dist/core/ingestion/import-resolvers/configs/zig.js +26 -0
- package/dist/core/ingestion/import-resolvers/zig.d.ts +34 -0
- package/dist/core/ingestion/import-resolvers/zig.js +193 -0
- package/dist/core/ingestion/language-config.d.ts +177 -0
- package/dist/core/ingestion/language-config.js +719 -0
- package/dist/core/ingestion/language-provider.d.ts +178 -1
- package/dist/core/ingestion/language-provider.js +22 -0
- package/dist/core/ingestion/languages/csharp/razor-view-components.d.ts +62 -0
- package/dist/core/ingestion/languages/csharp/razor-view-components.js +954 -0
- package/dist/core/ingestion/languages/csharp/resolution-config.d.ts +3 -0
- package/dist/core/ingestion/languages/csharp/resolution-config.js +6 -1
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -0
- package/dist/core/ingestion/languages/index.d.ts +1 -0
- package/dist/core/ingestion/languages/index.js +2 -0
- package/dist/core/ingestion/languages/java/analysis-features.d.ts +1 -1
- package/dist/core/ingestion/languages/java/analysis-features.js +14 -6
- package/dist/core/ingestion/languages/java/capture-side-channel.d.ts +8 -0
- package/dist/core/ingestion/languages/java/capture-side-channel.js +34 -0
- package/dist/core/ingestion/languages/java/captures.js +22 -1
- package/dist/core/ingestion/languages/java/lombok-synthesizer.d.ts +42 -0
- package/dist/core/ingestion/languages/java/lombok-synthesizer.js +439 -0
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -0
- package/dist/core/ingestion/languages/java/spring-actuator.d.ts +2 -0
- package/dist/core/ingestion/languages/java/spring-actuator.js +62 -0
- package/dist/core/ingestion/languages/java/spring-di.d.ts +17 -1
- package/dist/core/ingestion/languages/java/spring-di.js +44 -2
- package/dist/core/ingestion/languages/java/spring-dynamic-lookup.d.ts +8 -0
- package/dist/core/ingestion/languages/java/spring-dynamic-lookup.js +62 -0
- package/dist/core/ingestion/languages/java/spring-message-producers.d.ts +20 -0
- package/dist/core/ingestion/languages/java/spring-message-producers.js +83 -0
- package/dist/core/ingestion/languages/java/spring-non-http-handlers.d.ts +11 -1
- package/dist/core/ingestion/languages/java/spring-non-http-handlers.js +13 -3
- package/dist/core/ingestion/languages/java.js +18 -8
- package/dist/core/ingestion/languages/jvm/accessor-synthesis.d.ts +99 -0
- package/dist/core/ingestion/languages/jvm/accessor-synthesis.js +173 -0
- package/dist/core/ingestion/languages/jvm/beanspec.d.ts +17 -0
- package/dist/core/ingestion/languages/jvm/beanspec.js +42 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +15 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +50 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +24 -1
- package/dist/core/ingestion/languages/kotlin/lombok-synthesizer.d.ts +26 -0
- package/dist/core/ingestion/languages/kotlin/lombok-synthesizer.js +417 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +4 -0
- package/dist/core/ingestion/languages/kotlin/spring-actuator.d.ts +4 -0
- package/dist/core/ingestion/languages/kotlin/spring-actuator.js +172 -0
- package/dist/core/ingestion/languages/kotlin/spring-config-bindings.d.ts +18 -0
- package/dist/core/ingestion/languages/kotlin/spring-config-bindings.js +411 -0
- package/dist/core/ingestion/languages/kotlin/spring-di.d.ts +51 -1
- package/dist/core/ingestion/languages/kotlin/spring-di.js +86 -6
- package/dist/core/ingestion/languages/kotlin/spring-dynamic-lookup.d.ts +8 -0
- package/dist/core/ingestion/languages/kotlin/spring-dynamic-lookup.js +77 -0
- package/dist/core/ingestion/languages/kotlin/spring-message-producers.d.ts +17 -0
- package/dist/core/ingestion/languages/kotlin/spring-message-producers.js +119 -0
- package/dist/core/ingestion/languages/kotlin/spring-non-http-handlers.d.ts +16 -0
- package/dist/core/ingestion/languages/kotlin/spring-non-http-handlers.js +77 -2
- package/dist/core/ingestion/languages/kotlin.js +24 -0
- package/dist/core/ingestion/languages/python.js +2 -0
- package/dist/core/ingestion/languages/rust/query.js +8 -8
- package/dist/core/ingestion/languages/zig/captures.d.ts +260 -0
- package/dist/core/ingestion/languages/zig/captures.js +2070 -0
- package/dist/core/ingestion/languages/zig/index.d.ts +4 -0
- package/dist/core/ingestion/languages/zig/index.js +4 -0
- package/dist/core/ingestion/languages/zig/interpret.d.ts +36 -0
- package/dist/core/ingestion/languages/zig/interpret.js +176 -0
- package/dist/core/ingestion/languages/zig/query.d.ts +3 -0
- package/dist/core/ingestion/languages/zig/query.js +426 -0
- package/dist/core/ingestion/languages/zig/range-binding.d.ts +37 -0
- package/dist/core/ingestion/languages/zig/range-binding.js +373 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.d.ts +12 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.js +58 -0
- package/dist/core/ingestion/languages/zig/simple-hooks.d.ts +25 -0
- package/dist/core/ingestion/languages/zig/simple-hooks.js +143 -0
- package/dist/core/ingestion/languages/zig.d.ts +32 -0
- package/dist/core/ingestion/languages/zig.js +130 -0
- package/dist/core/ingestion/method-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/zig.js +120 -0
- package/dist/core/ingestion/method-extractors/generic.js +16 -4
- package/dist/core/ingestion/method-types.d.ts +10 -4
- package/dist/core/ingestion/model/field-registry.d.ts +3 -3
- package/dist/core/ingestion/model/field-registry.js +11 -7
- package/dist/core/ingestion/model/method-registry.d.ts +3 -3
- package/dist/core/ingestion/model/method-registry.js +13 -8
- package/dist/core/ingestion/model/registration-table.js +3 -0
- package/dist/core/ingestion/model/type-registry.js +8 -4
- package/dist/core/ingestion/pipeline-phases/di.js +47 -14
- 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/parse-impl.d.ts +7 -1
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +79 -91
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +2 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +39 -4
- package/dist/core/ingestion/pipeline-phases/routes.js +27 -18
- package/dist/core/ingestion/pipeline-phases/runner.d.ts +4 -1
- package/dist/core/ingestion/pipeline-phases/runner.js +34 -14
- package/dist/core/ingestion/pipeline-phases/scan.js +82 -1
- package/dist/core/ingestion/pipeline-phases/spring-auto-configuration.d.ts +2 -0
- package/dist/core/ingestion/pipeline-phases/spring-auto-configuration.js +8 -0
- package/dist/core/ingestion/pipeline-phases/spring-destinations.d.ts +123 -0
- package/dist/core/ingestion/pipeline-phases/spring-destinations.js +688 -0
- package/dist/core/ingestion/pipeline.d.ts +30 -1
- package/dist/core/ingestion/pipeline.js +52 -14
- package/dist/core/ingestion/resolve-references.js +5 -0
- package/dist/core/ingestion/route-extractors/constant-resolver.d.ts +16 -0
- package/dist/core/ingestion/route-extractors/constant-resolver.js +10 -0
- package/dist/core/ingestion/route-extractors/java-const-resolver.d.ts +27 -1
- package/dist/core/ingestion/route-extractors/java-const-resolver.js +161 -13
- package/dist/core/ingestion/route-extractors/kotlin-const-resolver.d.ts +12 -18
- package/dist/core/ingestion/route-extractors/kotlin-const-resolver.js +214 -33
- package/dist/core/ingestion/route-extractors/kotlin-spring.d.ts +13 -0
- package/dist/core/ingestion/route-extractors/kotlin-spring.js +259 -0
- package/dist/core/ingestion/route-extractors/python-decorator-handler.d.ts +6 -0
- package/dist/core/ingestion/route-extractors/python-decorator-handler.js +16 -0
- package/dist/core/ingestion/route-extractors/spring-shared.d.ts +30 -1
- package/dist/core/ingestion/route-extractors/spring-shared.js +77 -9
- package/dist/core/ingestion/route-extractors/spring.js +9 -5
- package/dist/core/ingestion/scope-extractor.js +8 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +62 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +4 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +2 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +28 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +11 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.d.ts +23 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +24 -3
- package/dist/core/ingestion/scope-resolution/passes/callable-value-flow.d.ts +11 -1
- package/dist/core/ingestion/scope-resolution/passes/callable-value-flow.js +26 -6
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.d.ts +11 -0
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +29 -3
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +8 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +35 -9
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +1 -4
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +277 -9
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +2 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +7 -3
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +43 -9
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +71 -10
- package/dist/core/ingestion/tree-sitter-queries.d.ts +1 -0
- package/dist/core/ingestion/tree-sitter-queries.js +161 -0
- package/dist/core/ingestion/type-extractors/zig.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/zig.js +17 -0
- package/dist/core/ingestion/utils/ast-helpers.d.ts +40 -1
- package/dist/core/ingestion/utils/ast-helpers.js +124 -6
- package/dist/core/ingestion/utils/callable-flow-captures.d.ts +9 -0
- package/dist/core/ingestion/utils/callable-flow-captures.js +75 -14
- package/dist/core/ingestion/utils/test-file-path.d.ts +28 -0
- package/dist/core/ingestion/utils/test-file-path.js +87 -0
- package/dist/core/ingestion/variable-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/zig.js +71 -0
- package/dist/core/ingestion/workers/parse-worker.js +85 -14
- package/dist/core/install-context.d.ts +4 -0
- package/dist/core/install-context.js +152 -0
- package/dist/core/lbug/csv-generator.d.ts +10 -1
- package/dist/core/lbug/csv-generator.js +92 -22
- package/dist/core/lbug/graph-emit-sink.d.ts +3 -2
- package/dist/core/lbug/graph-emit-sink.js +4 -2
- package/dist/core/lbug/lbug-adapter.d.ts +100 -5
- package/dist/core/lbug/lbug-adapter.js +236 -24
- package/dist/core/lbug/schema.d.ts +6 -5
- package/dist/core/lbug/schema.js +84 -22
- package/dist/core/net/url-guard.d.ts +6 -0
- package/dist/core/net/url-guard.js +147 -0
- package/dist/core/package-version.d.ts +5 -0
- package/dist/core/package-version.js +10 -0
- package/dist/core/run-analyze.d.ts +21 -4
- package/dist/core/run-analyze.js +426 -117
- package/dist/core/search/fts-indexes.d.ts +19 -1
- package/dist/core/search/fts-indexes.js +28 -1
- package/dist/core/tree-sitter/parser-loader.js +16 -0
- package/dist/core/update-cache.d.ts +39 -0
- package/dist/core/update-cache.js +141 -0
- package/dist/core/update-check.d.ts +31 -0
- package/dist/core/update-check.js +274 -0
- package/dist/mcp/local/local-backend.d.ts +27 -13
- package/dist/mcp/local/local-backend.js +148 -60
- package/dist/mcp/repository-policy.d.ts +5 -1
- package/dist/mcp/repository-policy.js +48 -4
- package/dist/mcp/resources.js +10 -1
- package/dist/mcp/server.js +8 -9
- package/dist/mcp/tools.js +32 -22
- package/dist/server/analyze-launch.d.ts +2 -0
- package/dist/server/analyze-launch.js +2 -0
- package/dist/server/analyze-worker-protocol.d.ts +6 -1
- package/dist/server/analyze-worker.d.ts +1 -0
- package/dist/server/analyze-worker.js +38 -20
- package/dist/server/api.d.ts +5 -1
- package/dist/server/api.js +105 -88
- package/dist/server/git-clone.d.ts +40 -16
- package/dist/server/git-clone.js +253 -199
- package/dist/server/grep-params.d.ts +18 -0
- package/dist/server/grep-params.js +83 -0
- package/dist/server/grep-scan.d.ts +23 -0
- package/dist/server/grep-scan.js +107 -0
- package/dist/server/grep-worker.d.ts +1 -0
- package/dist/server/grep-worker.js +12 -0
- package/dist/server/mcp-http.d.ts +8 -0
- package/dist/server/mcp-http.js +16 -1
- package/dist/server/update-controller.d.ts +29 -0
- package/dist/server/update-controller.js +82 -0
- package/dist/storage/file-lock.d.ts +15 -0
- package/dist/storage/file-lock.js +155 -0
- package/dist/storage/fs-atomic.d.ts +24 -0
- package/dist/storage/fs-atomic.js +86 -2
- package/dist/storage/global-dir.d.ts +2 -0
- package/dist/storage/global-dir.js +6 -0
- package/dist/storage/parse-cache.d.ts +45 -7
- package/dist/storage/parse-cache.js +189 -42
- package/dist/storage/parsedfile-store.d.ts +41 -60
- package/dist/storage/parsedfile-store.js +247 -171
- package/dist/storage/repo-manager.d.ts +10 -4
- package/dist/storage/repo-manager.js +35 -25
- package/dist/storage/repo-meta.d.ts +34 -0
- package/dist/storage/v8-sidecar.d.ts +48 -0
- package/dist/storage/v8-sidecar.js +347 -0
- package/dist/types/pipeline.d.ts +14 -0
- package/dist/utils/process-identity.d.ts +2 -0
- package/dist/utils/process-identity.js +35 -0
- package/package.json +10 -4
- package/scripts/assert-web-assets.mjs +35 -0
- package/scripts/build-web.js +72 -0
- package/scripts/build.js +31 -28
- package/scripts/cross-platform-tests.ts +5 -0
- package/skills/gitnexus-cli.md +5 -1
- package/web/assets/ProcessFlowModal-DAeX2BHW.js +24 -0
- package/web/assets/{abnfDiagram-QNN2D4NM-Cq2djWWe.js → abnfDiagram-PAR5IXJI-J3OdeHLl.js} +1 -1
- package/web/assets/{agent-BWAXPjC5.js → agent-BMRqXorA.js} +6 -4
- package/web/assets/architecture-7GRP2DOG-M7G3SWCO-G3sWyX6M.js +1 -0
- package/web/assets/architectureDiagram-2PNWDENW-ysKcRlGT.js +36 -0
- package/web/assets/blockDiagram-PUWGUBOA-oLXTa1lY.js +129 -0
- package/web/assets/c4Diagram-3NLNHZP5-D3iu4eC0.js +38 -0
- package/web/assets/{chunk-2SREHG4O-Dip42xOq.js → chunk-2NMSUPJH-B24w-wng.js} +1 -1
- package/web/assets/{chunk-VJFVEZTB-CX66F2ep.js → chunk-32MCUW2P-ByUyt0Sa.js} +3 -3
- package/web/assets/{chunk-4RFN2BYJ-DHHWuC-n.js → chunk-3NPNU5GP-DocZ07Sg.js} +1 -1
- package/web/assets/{chunk-XNMVGMAZ-Cg_LnPtj.js → chunk-3SMGFRGC-CAu4JRLv.js} +1 -1
- package/web/assets/{chunk-W44A43WB-BN8EQc_u.js → chunk-4CAJECRU-DRYMwG9z.js} +1 -1
- package/web/assets/chunk-4OADUZ5Q-CxrSvOwZ.js +10 -0
- package/web/assets/{chunk-DMV4VAQV-Bn6WXDSX.js → chunk-5IQCK5RY-CCMhl4so.js} +2 -2
- package/web/assets/{chunk-RRFMTAIC-CMN0wcYA.js → chunk-5MVFYWFU-Db9KvrYO.js} +1 -1
- package/web/assets/chunk-CLS4B6BI-Uvx5QNsu.js +168 -0
- package/web/assets/chunk-DZP67EKU-B3Mt380j.js +70 -0
- package/web/assets/{chunk-6L755F7B-CMhLBxi2.js → chunk-EICP7K5X-CqwE9hui.js} +1 -1
- package/web/assets/{chunk-BI6VK774-D0oaWk8V.js → chunk-GDY2UAB4-CtQQR0a8.js} +1 -1
- package/web/assets/chunk-H7VHZCWX-CE1nAmt6.js +1 -0
- package/web/assets/chunk-IJBDOHL6-BUKtY6oF.js +1 -0
- package/web/assets/{chunk-OIYT25JQ-CQ6KOZGX.js → chunk-JFFVMJIA-0fJenqia.js} +1 -1
- package/web/assets/{chunk-HNC4WDU7-DoU3KnA7.js → chunk-JZGDI5JK-BeTMSSkJ.js} +1 -1
- package/web/assets/{chunk-EQFTRU2I-1ix7TzW9.js → chunk-KD6SPIPN-Qp1Pflah.js} +1 -1
- package/web/assets/chunk-NF366YI6-CpSpya3n.js +231 -0
- package/web/assets/chunk-NUDPKBEF-CU1-BQIW.js +34 -0
- package/web/assets/{chunk-SATU7PGQ-B1zhgOvc.js → chunk-OJINMHTS-zOCQe4eI.js} +1 -1
- package/web/assets/{chunk-E5QJAATJ-dh-5CtIV.js → chunk-Q6NGPIAH-yyBomb63.js} +1 -1
- package/web/assets/chunk-QJSWEUOL-D_rf9gPD.js +128 -0
- package/web/assets/chunk-R7JDMUKV-CRoqKpD6.js +1 -0
- package/web/assets/{chunk-VE5CLXGZ-C1vB7wpY.js → chunk-RCXAM2GK-CUqrWQDV.js} +1 -1
- package/web/assets/{chunk-66DQ2XMT-CM0xjFAN.js → chunk-RT4MAWR3-zXy9-Lvt.js} +1 -1
- package/web/assets/{chunk-TZUXEDM2-B7p9AcTw.js → chunk-SFMINX4W-J2UrvMpD.js} +1 -1
- package/web/assets/{chunk-LORZLZWG-B57uGw2N.js → chunk-SLDQ463B-CHY6e_bQ.js} +2 -2
- package/web/assets/{chunk-FWYVLQTC-BgDItRzJ.js → chunk-TCEHX7R3-CXPDEVbm.js} +1 -1
- package/web/assets/{chunk-224SPVON-B8gxtXpy.js → chunk-VQC2EELJ-Dc8fIy4R.js} +1 -1
- package/web/assets/chunk-VRZKL3EH-DB3KixTQ.js +1 -0
- package/web/assets/{chunk-A7VWPJGB-B4O3oQdQ.js → chunk-VTHDQ7BV-b7FsPQZO.js} +1 -1
- package/web/assets/chunk-VY2OSTJR-Dkgc3Brg.js +2 -0
- package/web/assets/chunk-WUBWJARI-7FwILJ3k.js +2 -0
- package/web/assets/{chunk-D6VWDJW2-BxcBdZ9c.js → chunk-YBMQ5JGJ-BSnyWZmd.js} +1 -1
- package/web/assets/chunk-YDMLL4PJ-IHhMngTz.js +2 -0
- package/web/assets/chunk-Z6V44ARX-BjCEsF0Q.js +62 -0
- package/web/assets/chunk-ZJJ7VQJP-Dz089b-K.js +321 -0
- package/web/assets/chunk-ZNLK7HRR-B0iFpmW4.js +1 -0
- package/web/assets/chunk-ZQN7UHIL-Cy7KAjQt.js +1 -0
- package/web/assets/{chunk-L5GCOVLC-CE2w8Nm_.js → chunk-ZS6VBONO-DBjJO0w9.js} +2 -2
- package/web/assets/{chunk-NV3KIAZN-5yvcpMiu.js → chunk-ZUNWM646-DNRJyNPe.js} +1 -1
- package/web/assets/classDiagram-FGAMPOII-C5Ibyode.js +1 -0
- package/web/assets/classDiagram-v2-AI5RJEK4-C5Ibyode.js +1 -0
- package/web/assets/{cose-bilkent-RZA4XIPR-BHpK4Crp.js → cose-bilkent-Q72C2OJ3-DMeFXnK8.js} +1 -1
- package/web/assets/cynefin-OW5HDTMX-6OCTWOGG-vlqakYcO.js +1 -0
- package/web/assets/{cynefinDiagram-TR7LZUCG-C3Iar9lZ.js → cynefinDiagram-2OOWUY4M-BY6DZkTt.js} +1 -1
- package/web/assets/dagre-MPVFI544-DWO70fy_.js +4 -0
- package/web/assets/diagram-AE4NWXFW-f7JRVRUL.js +24 -0
- package/web/assets/{diagram-L7DVE3PN-GIRyVUtt.js → diagram-BUJID5UG-BXZv1rCS.js} +2 -2
- package/web/assets/{diagram-JCD7PQ7C-DC5-9FRr.js → diagram-C44CZ5NI-CRNfvjCq.js} +1 -1
- package/web/assets/diagram-EYOLEXXS-DZOjKQVE.js +30 -0
- package/web/assets/diagram-P7B6PWOJ-D3SQmw3_.js +3 -0
- package/web/assets/{ebnfDiagram-DRHRQJWO-D8_CI4ZF.js → ebnfDiagram-FTPZ3PV6-jKWpIDN2.js} +1 -1
- package/web/assets/erDiagram-H3ERR26V-BqJntEuJ.js +99 -0
- package/web/assets/eventmodeling-NTZA5JFV-WKSWQHFS-Bq4FqtBL.js +1 -0
- package/web/assets/flowDiagram-YHGXBVSY-Dnlk2bEu.js +1 -0
- package/web/assets/ganttDiagram-RWFTB7ED-Bl6Y1K5T.js +292 -0
- package/web/assets/gitGraph-4MIJSDKK-JH2HKYUO-B3yc4GkH.js +1 -0
- package/web/assets/gitGraphDiagram-MAR6GKOP-CkNvsrdw.js +106 -0
- package/web/assets/{index-CJDpyH-n.css → index-C2_aej58.css} +1 -1
- package/web/assets/{index-DDRie6_8.js → index-Dj3vQOHK.js} +51 -51
- package/web/assets/info-A6RAGUB7-3TX3OFWW-BM3N5_Dv.js +1 -0
- package/web/assets/infoDiagram-LV547AFH-COkFutAf.js +2 -0
- package/web/assets/{ishikawaDiagram-4JDSWWDM-DmqWtjkl.js → ishikawaDiagram-PUJQGNDS-Bb8FylSR.js} +2 -2
- package/web/assets/{journeyDiagram-QUS3FAKT-XAzVzrQW.js → journeyDiagram-EW5QJT4W-BzoHUBhM.js} +4 -4
- package/web/assets/{kanban-definition-D4L7SQKK-YurRnmYn.js → kanban-definition-JSQERAZB-Uy2Pi0yQ.js} +4 -4
- package/web/assets/katex-CZ4GXH2S-C0Fcou7U.js +257 -0
- package/web/assets/{mindmap-definition-66QP5TD6-ChrWWnil.js → mindmap-definition-VBJCLQLM-B-CnOnt_.js} +3 -3
- package/web/assets/packet-AYTQ26CC-MKII6P3Y-Bd52ZE3V.js +1 -0
- package/web/assets/{pegDiagram-YKIO5C6U-QGeQLEq2.js → pegDiagram-7WILOQTJ-D9sneKXg.js} +1 -1
- package/web/assets/pie-WAS4IAKB-6B4OPMJ5-DW5Xy69Z.js +1 -0
- package/web/assets/pieDiagram-EFA7CBSB-Dx2NQofL.js +39 -0
- package/web/assets/{quadrantDiagram-VO5QLCXA-B7098wSc.js → quadrantDiagram-WARVYA7P-DPKL9_0A.js} +3 -3
- package/web/assets/radar-RG4KPBEZ-UPTR3XUL-CkzibT2h.js +1 -0
- package/web/assets/railroad-74A4TZTK-MEFUPFMS-D9zF-mDN.js +1 -0
- package/web/assets/railroad-abnf-HS5TGJTU-R5YG2S5D-ruacjUbX.js +1 -0
- package/web/assets/railroad-ebnf-LZEXJU2U-G5QEX2L6-S1zc5OiO.js +1 -0
- package/web/assets/railroad-peg-WCYAUIDC-H5I2ZRY2-Cbcr0XzY.js +1 -0
- package/web/assets/{railroadDiagram-M77LTMSB-AXu4vxk_.js → railroadDiagram-5NIQVNLQ-DsweTo14.js} +1 -1
- package/web/assets/{requirementDiagram-RASO5HTO-B-l8InpK.js → requirementDiagram-SXREGOKZ-CXwdNSVR.js} +4 -4
- package/web/assets/{sankeyDiagram-F32LOJ6L-Kd7zjJgX.js → sankeyDiagram-VV74M2VP-CA6jtP9P.js} +3 -3
- package/web/assets/{sequenceDiagram-URATNSBD-BlcdY9DS.js → sequenceDiagram-52ZFIFDL-k_5rEbzm.js} +15 -15
- package/web/assets/src-Df5C1Nz4.js +1 -0
- package/web/assets/stateDiagram-3QAKPIVI-BejHTf31.js +1 -0
- package/web/assets/stateDiagram-v2-HN2P4RDZ-BrfoRuOc.js +1 -0
- package/web/assets/swimlanes-QLVP42QD-CQSVO5D6.js +1 -0
- package/web/assets/swimlanesDiagram-JKPDBFCN-DrWB9kcD.js +8 -0
- package/web/assets/{timeline-definition-WJXWRH4I-DUfp1R3E.js → timeline-definition-GS45XAXW-C0Ks8rPP.js} +4 -4
- package/web/assets/treeView-Q6P3EWNA-ZRJGANNQ-DmKOCo6L.js +1 -0
- package/web/assets/treemap-WGGIJYW6-K64VN5AS-DO3xY92U.js +1 -0
- package/web/assets/{vennDiagram-K3VCMQLI-Bj-FN-XS.js → vennDiagram-QIQU2ZRJ-rgPiS837.js} +3 -3
- package/web/assets/wardley-WFR3VGLG-D67OWCCH-DiDPBNft.js +1 -0
- package/web/assets/wardleyDiagram-U6YNM66N-DRVr7SPi.js +78 -0
- package/web/assets/{xychartDiagram-5VRUVLCW-CK_rbSWE.js → xychartDiagram-XJAZEDNM-COtlZzYb.js} +3 -3
- package/web/index.html +19 -17
- package/web/assets/ProcessFlowModal-Badh2Pbg.js +0 -24
- package/web/assets/architecture-TIHT7OUA-V6N4J3SY-fTePvLoe.js +0 -1
- package/web/assets/architectureDiagram-OT7VKSJ7-mKEXxkeF.js +0 -36
- package/web/assets/blockDiagram-54WLDVWM-Dg_hrRWE.js +0 -132
- package/web/assets/c4Diagram-X2LASM7V-CnhoT4aV.js +0 -10
- package/web/assets/chunk-2AEHWXPW-CV4r6-1I.js +0 -127
- package/web/assets/chunk-5VCL7Z4A-CQ-2dYWj.js +0 -1
- package/web/assets/chunk-6BELYETK-ChsYtfHW.js +0 -1
- package/web/assets/chunk-7CWYLC5S-DRgGkkpF.js +0 -2
- package/web/assets/chunk-7FYTHRHK-CsmYIswB.js +0 -32
- package/web/assets/chunk-KRXBNO2N-C-UNuKKf.js +0 -1
- package/web/assets/chunk-LAHSG3N2-Bz4hcn0N.js +0 -321
- package/web/assets/chunk-LIEV3EAG-pyKGssV3.js +0 -1
- package/web/assets/chunk-NLANEA3F-XpH_NPA5.js +0 -62
- package/web/assets/chunk-PE7DX7ZZ-CCvRVj43.js +0 -10
- package/web/assets/chunk-Q67WD55A-BWCH2SVz.js +0 -156
- package/web/assets/chunk-SZD42YQK-ijyKKVr1.js +0 -70
- package/web/assets/chunk-TFPGFQPA-Dj6a-0pC.js +0 -231
- package/web/assets/chunk-TGVD4F4B-BMc31Gj2.js +0 -2
- package/web/assets/chunk-UAT7B5JY-DW-A_fpI.js +0 -1
- package/web/assets/chunk-VY5UBI4V-yxPQAWxw.js +0 -1
- package/web/assets/chunk-WJBAP47W-BckNkuEN.js +0 -1
- package/web/assets/classDiagram-VPOSVPXH-BjOiXA_C.js +0 -1
- package/web/assets/classDiagram-v2-5VFNUXQA-BjOiXA_C.js +0 -1
- package/web/assets/cynefin-VYW2F7L2-2VAHYKR6-DAsF6GZv.js +0 -1
- package/web/assets/dagre-K64A6Z3X-CUwi79mA.js +0 -4
- package/web/assets/diagram-2TLGJV2N-C2F5Nfym.js +0 -30
- package/web/assets/diagram-KFBZAVDW-Dfmf_4ti.js +0 -3
- package/web/assets/diagram-YP3FGXHI-CyNFYtkd.js +0 -24
- package/web/assets/erDiagram-SZLJLQMB-CohQjznC.js +0 -85
- package/web/assets/eventmodeling-45OFAUF4-AOUJWSLX-BvTc6iQi.js +0 -1
- package/web/assets/flowDiagram-BWE6NHOH-B6RnEvD9.js +0 -1
- package/web/assets/ganttDiagram-2QTCJSNI-Cks_mEcF.js +0 -292
- package/web/assets/gitGraph-TEB2WS4Q-U5VWYIBC-Dy7CCSZ5.js +0 -1
- package/web/assets/gitGraphDiagram-VVZAVV5G-CG41cIVc.js +0 -106
- package/web/assets/info-DKCQHKI2-DX6KST54-BLJg1ikX.js +0 -1
- package/web/assets/infoDiagram-FY4PZKRE-BJ3vPVwW.js +0 -2
- package/web/assets/katex-C5OPUE3Q-Bnbavtmu.js +0 -257
- package/web/assets/packet-7NZHBO7P-5WG45QPS-KUxcuvaA.js +0 -1
- package/web/assets/pie-RZYD4A2V-2OCZ2VTD-DPs08kJY.js +0 -1
- package/web/assets/pieDiagram-YPY3TKG5-BuT3MYzm.js +0 -39
- package/web/assets/radar-I7S5WNFK-EPLSA35B-w5F0K3a7.js +0 -1
- package/web/assets/railroad-3IZDKUUU-PWFQV6Y6-Bu668yqY.js +0 -1
- package/web/assets/railroad-abnf-AHOZXSZD-JYYJX3BS-B6ghpETS.js +0 -1
- package/web/assets/railroad-ebnf-EBAXGLYW-RBZ4ONAP-D-XmHh3M.js +0 -1
- package/web/assets/railroad-peg-LSFZ7HO6-KHNPXGPG-mhkrhzEn.js +0 -1
- package/web/assets/src-C5sx_gMp.js +0 -1
- package/web/assets/stateDiagram-DODFXNG5-DTdHc-fF.js +0 -1
- package/web/assets/stateDiagram-v2-JNMM5JRA-DioNLDDo.js +0 -1
- package/web/assets/swimlanes-OSWOYLSK-CA0ofdwY.js +0 -2
- package/web/assets/swimlanesDiagram-RHGX2RDE-PkwUdckC.js +0 -8
- package/web/assets/treeView-QDETBFTQ-EHYTSQNO-C5lpBgPm.js +0 -1
- package/web/assets/treemap-6X3UGDF4-CCWCF7EK-BB0ZyO-B.js +0 -1
- package/web/assets/wardley-OPB4EBWU-6OWERDVT-CEA3Nq0j.js +0 -1
- package/web/assets/wardleyDiagram-XK6FUAWV-CVV0dHFr.js +0 -78
- /package/web/assets/{sizeCapture-5GORAGP4-BEqQzsxs.js → sizeCapture-FGA5AGYP-BEqQzsxs.js} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { emitZigScopeCaptures, isZigContainerMethod, isZigContainerOrImportBinding, isZigFileStruct, isZigFileThisAlias, isZigKeywordDeclaration, isZigRedundantContainerCapture, isZigTypeShadowingBinding, zigCallableQualifiedName, zigContainerAnchor, zigContainerBindingName, zigContainerLabel, zigContainerName, zigFileStructName, zigImportRootOf, zigCallReturnTypeOf, zigReturnTypeIsNominal, zigTypeConstructorOf, zigUnwrapValue, ZIG_CONTAINER_TYPES, } from './captures.js';
|
|
2
|
+
export { populateZigRangeBindings, zigElementSpelling, zigOptionalPayloadSpelling, zigPointeeSpelling, } from './range-binding.js';
|
|
3
|
+
export { interpretZigImport, interpretZigTypeBinding, normalizeZigTypeName } from './interpret.js';
|
|
4
|
+
export { expandZigWildcardNames, zigArityCompatibility, zigBindingScopeFor, zigMergeBindings, zigReceiverBinding, } from './simple-hooks.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { emitZigScopeCaptures, isZigContainerMethod, isZigContainerOrImportBinding, isZigFileStruct, isZigFileThisAlias, isZigKeywordDeclaration, isZigRedundantContainerCapture, isZigTypeShadowingBinding, zigCallableQualifiedName, zigContainerAnchor, zigContainerBindingName, zigContainerLabel, zigContainerName, zigFileStructName, zigImportRootOf, zigCallReturnTypeOf, zigReturnTypeIsNominal, zigTypeConstructorOf, zigUnwrapValue, ZIG_CONTAINER_TYPES, } from './captures.js';
|
|
2
|
+
export { populateZigRangeBindings, zigElementSpelling, zigOptionalPayloadSpelling, zigPointeeSpelling, } from './range-binding.js';
|
|
3
|
+
export { interpretZigImport, interpretZigTypeBinding, normalizeZigTypeName } from './interpret.js';
|
|
4
|
+
export { expandZigWildcardNames, zigArityCompatibility, zigBindingScopeFor, zigMergeBindings, zigReceiverBinding, } from './simple-hooks.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CaptureMatch, ParsedImport, ParsedTypeBinding } from '../../../../_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The module a `@import` target names, for the `importedName` of a namespace
|
|
4
|
+
* import (the shared contract wants the MODULE there — Go's `import foo
|
|
5
|
+
* "pkg/bar"` records `bar` — not the local handle): the last path segment
|
|
6
|
+
* without its `.zig` extension. `"std"` → `std`, `"./net/socket.zig"` →
|
|
7
|
+
* `socket`, `"mylib"` (a build.zig.zon dep) → `mylib`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function zigModuleNameOf(targetRaw: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* `const std = @import("std");` binds the imported module to a const handle
|
|
12
|
+
* accessed via qualified syntax — a namespace import (closest peers: Python
|
|
13
|
+
* `import numpy`, Go `import "pkg/bar"`). `localName` is the handle the
|
|
14
|
+
* author chose, `importedName` the module (`zigModuleNameOf`).
|
|
15
|
+
*
|
|
16
|
+
* `_ = @import("x.zig");` (and any keyword-less `<ident> = @import(…)`, a
|
|
17
|
+
* statement rather than a declaration in this grammar) references the file
|
|
18
|
+
* without binding a name — the `refAllDecls` / test-aggregation idiom. That
|
|
19
|
+
* is a `side-effect` import: file edge, no binding (TS `import './x'`). So is
|
|
20
|
+
* an `@import` in any expression position (a tuple element, a call argument,
|
|
21
|
+
* a comparison operand — `emitZigScopeCaptures`'s `@import.inline` rule).
|
|
22
|
+
*
|
|
23
|
+
* The receiver of a member call, `@import("dump.zig").root(...)`, arrives as
|
|
24
|
+
* a namespace import whose `@import.name` is the builtin's own text: the
|
|
25
|
+
* shared namespace-receiver lookup keys on the receiver text, and that is
|
|
26
|
+
* how the call resolves into `dump.zig` without a `const` handle.
|
|
27
|
+
*/
|
|
28
|
+
export declare function interpretZigImport(captures: CaptureMatch): ParsedImport | null;
|
|
29
|
+
/**
|
|
30
|
+
* Strip Zig type sigils that wrap the nominal type: pointers (`*T`, `[*]T`),
|
|
31
|
+
* optionals (`?T`), error unions (`!T` / `E!T`), slices (`[]T`), arrays
|
|
32
|
+
* (`[N]T`), and `const` qualifiers. Keeps the bare type name so registry
|
|
33
|
+
* lookup matches the container declaration.
|
|
34
|
+
*/
|
|
35
|
+
export declare function normalizeZigTypeName(text: string): string;
|
|
36
|
+
export declare function interpretZigTypeBinding(captures: CaptureMatch): ParsedTypeBinding | null;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
const stripQuotes = (s) => s.replace(/^["']|["']$/g, '');
|
|
2
|
+
/**
|
|
3
|
+
* The module a `@import` target names, for the `importedName` of a namespace
|
|
4
|
+
* import (the shared contract wants the MODULE there — Go's `import foo
|
|
5
|
+
* "pkg/bar"` records `bar` — not the local handle): the last path segment
|
|
6
|
+
* without its `.zig` extension. `"std"` → `std`, `"./net/socket.zig"` →
|
|
7
|
+
* `socket`, `"mylib"` (a build.zig.zon dep) → `mylib`.
|
|
8
|
+
*/
|
|
9
|
+
export function zigModuleNameOf(targetRaw) {
|
|
10
|
+
const last = targetRaw.replace(/\\/g, '/').split('/').filter(Boolean).pop() ?? targetRaw;
|
|
11
|
+
return last.endsWith('.zig') ? last.slice(0, -'.zig'.length) : last;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `const std = @import("std");` binds the imported module to a const handle
|
|
15
|
+
* accessed via qualified syntax — a namespace import (closest peers: Python
|
|
16
|
+
* `import numpy`, Go `import "pkg/bar"`). `localName` is the handle the
|
|
17
|
+
* author chose, `importedName` the module (`zigModuleNameOf`).
|
|
18
|
+
*
|
|
19
|
+
* `_ = @import("x.zig");` (and any keyword-less `<ident> = @import(…)`, a
|
|
20
|
+
* statement rather than a declaration in this grammar) references the file
|
|
21
|
+
* without binding a name — the `refAllDecls` / test-aggregation idiom. That
|
|
22
|
+
* is a `side-effect` import: file edge, no binding (TS `import './x'`). So is
|
|
23
|
+
* an `@import` in any expression position (a tuple element, a call argument,
|
|
24
|
+
* a comparison operand — `emitZigScopeCaptures`'s `@import.inline` rule).
|
|
25
|
+
*
|
|
26
|
+
* The receiver of a member call, `@import("dump.zig").root(...)`, arrives as
|
|
27
|
+
* a namespace import whose `@import.name` is the builtin's own text: the
|
|
28
|
+
* shared namespace-receiver lookup keys on the receiver text, and that is
|
|
29
|
+
* how the call resolves into `dump.zig` without a `const` handle.
|
|
30
|
+
*/
|
|
31
|
+
export function interpretZigImport(captures) {
|
|
32
|
+
const source = captures['@import.source']?.text;
|
|
33
|
+
if (source === undefined)
|
|
34
|
+
return null;
|
|
35
|
+
const targetRaw = stripQuotes(source);
|
|
36
|
+
if (targetRaw.length === 0)
|
|
37
|
+
return null;
|
|
38
|
+
// `pub usingnamespace @import("x.zig");` — every pub decl of the target
|
|
39
|
+
// becomes a decl of this container. A wildcard, expanded by
|
|
40
|
+
// `expandZigWildcardNames` in the scope resolver.
|
|
41
|
+
if (captures['@import.wildcard'] !== undefined) {
|
|
42
|
+
return { kind: 'wildcard', targetRaw };
|
|
43
|
+
}
|
|
44
|
+
if (captures['@import.side-effect'] !== undefined) {
|
|
45
|
+
return { kind: 'side-effect', targetRaw };
|
|
46
|
+
}
|
|
47
|
+
const name = captures['@import.name']?.text;
|
|
48
|
+
if (name === undefined)
|
|
49
|
+
return null;
|
|
50
|
+
// `const Foo = @import("x.zig").Foo;` — one member, under a name of the
|
|
51
|
+
// importer's choosing (a rename when it differs: `const Alloc =
|
|
52
|
+
// @import("std").mem;`). Same fact as TS `import { Foo } from './x'` /
|
|
53
|
+
// `import { Foo as Bar }`.
|
|
54
|
+
const imported = captures['@import.imported']?.text;
|
|
55
|
+
if (imported !== undefined) {
|
|
56
|
+
// `pub const X = …` at file scope republishes the name (Python
|
|
57
|
+
// `__init__.py` shape): a third file reads it as `thisModule.X`. The
|
|
58
|
+
// marker is set by `emitZigScopeCaptures` where the syntax node is
|
|
59
|
+
// still available (`isZigPublishingImport`).
|
|
60
|
+
const republish = captures['@import.reexports'] !== undefined ? { reexportsName: true } : {};
|
|
61
|
+
return imported === name
|
|
62
|
+
? { kind: 'named', localName: name, importedName: imported, targetRaw, ...republish }
|
|
63
|
+
: {
|
|
64
|
+
kind: 'alias',
|
|
65
|
+
localName: name,
|
|
66
|
+
importedName: imported,
|
|
67
|
+
alias: name,
|
|
68
|
+
targetRaw,
|
|
69
|
+
...republish,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
kind: 'namespace',
|
|
74
|
+
localName: name,
|
|
75
|
+
importedName: zigModuleNameOf(targetRaw),
|
|
76
|
+
targetRaw,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Strip Zig type sigils that wrap the nominal type: pointers (`*T`, `[*]T`),
|
|
81
|
+
* optionals (`?T`), error unions (`!T` / `E!T`), slices (`[]T`), arrays
|
|
82
|
+
* (`[N]T`), and `const` qualifiers. Keeps the bare type name so registry
|
|
83
|
+
* lookup matches the container declaration.
|
|
84
|
+
*/
|
|
85
|
+
export function normalizeZigTypeName(text) {
|
|
86
|
+
let t = text.trim();
|
|
87
|
+
// Error union first: the payload of `E!*T` / `!?T` carries its own sigils
|
|
88
|
+
// (F6: `Allocator.Error!*Page` is the shape of every fallible constructor).
|
|
89
|
+
const bang = t.lastIndexOf('!');
|
|
90
|
+
if (bang !== -1)
|
|
91
|
+
t = t.slice(bang + 1).trim();
|
|
92
|
+
let previous;
|
|
93
|
+
do {
|
|
94
|
+
previous = t;
|
|
95
|
+
t = t.replace(/^(\*|\?|\[\*?c?\]|\[[^\]]*\])\s*/, '');
|
|
96
|
+
t = t.replace(/^const\s+/, '');
|
|
97
|
+
} while (t !== previous);
|
|
98
|
+
// Generic instantiation `List(u8)` / `std.ArrayList(u8)` → the type
|
|
99
|
+
// constructor `List` / `std.ArrayList`: Zig spells a generic type as a
|
|
100
|
+
// call, and the container def is registered under the function's name.
|
|
101
|
+
// Builtins (`@This()`, `@TypeOf(x)`) keep their parentheses — they are
|
|
102
|
+
// not constructor names and must not turn into `@This`.
|
|
103
|
+
if (!t.startsWith('@')) {
|
|
104
|
+
const paren = t.indexOf('(');
|
|
105
|
+
if (paren > 0 && t.endsWith(')'))
|
|
106
|
+
t = t.slice(0, paren).trim();
|
|
107
|
+
}
|
|
108
|
+
return t;
|
|
109
|
+
}
|
|
110
|
+
export function interpretZigTypeBinding(captures) {
|
|
111
|
+
const name = captures['@type-binding.name']?.text;
|
|
112
|
+
const type = captures['@type-binding.type']?.text;
|
|
113
|
+
if (name === undefined || type === undefined)
|
|
114
|
+
return null;
|
|
115
|
+
let source = 'annotation';
|
|
116
|
+
if (captures['@type-binding.parameter'] !== undefined) {
|
|
117
|
+
// Zig has no implicit receiver keyword. `emitZigScopeCaptures` tags the
|
|
118
|
+
// receiver parameter (`@type-binding.receiver`, see `zigReceiverParameter`):
|
|
119
|
+
// the FIRST parameter when it is named `self` OR typed as the enclosing
|
|
120
|
+
// container (`counter: *Counter`, `pool: *@This()`, `prng: *PRNG` with
|
|
121
|
+
// `const PRNG = @This();`). Position matters — `fn f(a: u32, self: T)` is
|
|
122
|
+
// legal and `self` there is an ordinary parameter.
|
|
123
|
+
const isReceiver = captures['@type-binding.receiver'] !== undefined;
|
|
124
|
+
source = isReceiver ? 'self' : 'parameter-annotation';
|
|
125
|
+
}
|
|
126
|
+
else if (captures['@type-binding.constructor'] !== undefined) {
|
|
127
|
+
source = 'constructor-inferred';
|
|
128
|
+
}
|
|
129
|
+
else if (captures['@type-binding.call-return'] !== undefined) {
|
|
130
|
+
// `var c = Counter.init();` — the call's receiver names the type when it
|
|
131
|
+
// is a container (`Counter`, `mod.Counter`, `List(u8)`); a value receiver
|
|
132
|
+
// (`std.mem`, `self.items`) simply finds no container and declines.
|
|
133
|
+
// `const t = makeThing();` — the callee name, chained to its return
|
|
134
|
+
// binding by the shared resolver.
|
|
135
|
+
source = 'constructor-inferred';
|
|
136
|
+
// `const el = node.asElement();` on a fn-LOCAL receiver (F6): the type is
|
|
137
|
+
// the METHOD's return type, spelled as the compound `node.asElement()` the
|
|
138
|
+
// shared resolver walks (receiver binding → class scope → the method's
|
|
139
|
+
// `@type-binding.return`). Kept verbatim: `normalizeZigTypeName` would
|
|
140
|
+
// read the `()` as a generic instantiation and strip it.
|
|
141
|
+
if (captures['@type-binding.member-call-return'] !== undefined) {
|
|
142
|
+
return { boundName: name, rawTypeName: type.trim(), source };
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else if (captures['@type-binding.return'] !== undefined) {
|
|
146
|
+
// `fn make() !*Thing` — `make ↦ Thing`, in the enclosing scope, so a
|
|
147
|
+
// call site chains through it. Error unions / pointers / optionals are
|
|
148
|
+
// stripped by `normalizeZigTypeName` (`Allocator.Error!*Page` → `Page`).
|
|
149
|
+
source = 'return-annotation';
|
|
150
|
+
}
|
|
151
|
+
else if (captures['@type-binding.annotation'] !== undefined) {
|
|
152
|
+
// `var x: T = undefined;` / `const x: T = .init(…);` — the declared type.
|
|
153
|
+
source = 'annotation';
|
|
154
|
+
}
|
|
155
|
+
else if (captures['@type-binding.field'] !== undefined) {
|
|
156
|
+
// `session: *Session,` — a container field's declared type, hosted in
|
|
157
|
+
// the container's Class scope so `self.session.name()` walks it
|
|
158
|
+
// (synthesized by `emitZigScopeCaptures`, F5). A declaration, hence
|
|
159
|
+
// 'annotation': it must outrank nothing and be outranked by nothing —
|
|
160
|
+
// a field has exactly one type source.
|
|
161
|
+
source = 'annotation';
|
|
162
|
+
}
|
|
163
|
+
else if (captures['@type-binding.alias'] !== undefined) {
|
|
164
|
+
// Two alias shapes share the group: `const page = self.page;` — the RHS
|
|
165
|
+
// member path IS the "type"; the compound resolver's member-alias branch
|
|
166
|
+
// re-resolves `self.page` as a receiver chain (F5) — and
|
|
167
|
+
// `const LocalAlias = Local;` / `const B = util.List(u8);` — the alias
|
|
168
|
+
// name is bound to the value's type text (`util.List` after the comptime
|
|
169
|
+
// arguments are dropped) and chained to the target by the shared
|
|
170
|
+
// `followChainedRef` (F7). Rust's `let x = y` source: it must rank
|
|
171
|
+
// BELOW an annotation on the same name (`const x: T = y;` is typed by
|
|
172
|
+
// `T`), and the default here is 'annotation'.
|
|
173
|
+
source = 'assignment-inferred';
|
|
174
|
+
}
|
|
175
|
+
return { boundName: name, rawTypeName: normalizeZigTypeName(type), source };
|
|
176
|
+
}
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import Parser from 'tree-sitter';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
const _require = createRequire(import.meta.url);
|
|
4
|
+
/**
|
|
5
|
+
* Zig scope-resolution query (RFC #909 Ring 3).
|
|
6
|
+
*
|
|
7
|
+
* The grammar is an optionalDependency (`@tree-sitter-grammars/tree-sitter-zig`),
|
|
8
|
+
* so the language module is required lazily and `getZigParser` /
|
|
9
|
+
* `getZigScopeQuery` throw only when actually invoked without the grammar
|
|
10
|
+
* installed. That is safe: the parse pipeline filters `.zig` files through
|
|
11
|
+
* `parser-loader.isLanguageAvailable` before any scope extraction runs.
|
|
12
|
+
*
|
|
13
|
+
* Zig specifics encoded here:
|
|
14
|
+
* - Containers (struct/enum/union/opaque) are anonymous nodes bound by the
|
|
15
|
+
* enclosing `variable_declaration`; declarations capture the binding
|
|
16
|
+
* identifier from the wrapper.
|
|
17
|
+
* - `@import` is a builtin call, not import-statement syntax; the
|
|
18
|
+
* `#eq?` predicate keeps other builtins (@sizeOf, @as, …) out.
|
|
19
|
+
* - A plain `(variable_declaration (identifier))` rule would also match
|
|
20
|
+
* container and import bindings — `emitZigScopeCaptures` filters those
|
|
21
|
+
* groups out so a name binds exactly once.
|
|
22
|
+
*/
|
|
23
|
+
const ZIG_SCOPE_QUERY = `
|
|
24
|
+
;; Scopes
|
|
25
|
+
(source_file) @scope.module
|
|
26
|
+
(struct_declaration) @scope.class
|
|
27
|
+
(enum_declaration) @scope.class
|
|
28
|
+
(union_declaration) @scope.class
|
|
29
|
+
(opaque_declaration) @scope.class
|
|
30
|
+
(function_declaration) @scope.function
|
|
31
|
+
(test_declaration) @scope.function
|
|
32
|
+
(block) @scope.block
|
|
33
|
+
|
|
34
|
+
;; Declarations — functions (relabeled @declaration.method inside containers
|
|
35
|
+
;; by emitZigScopeCaptures, mirroring the provider's labelOverride)
|
|
36
|
+
(function_declaration
|
|
37
|
+
name: (identifier) @declaration.name) @declaration.function
|
|
38
|
+
|
|
39
|
+
;; Declarations — named tests. Same naming rule as ZIG_QUERIES: the string
|
|
40
|
+
;; node WITH quotes, so the def joins the graph node and never collides with
|
|
41
|
+
;; a same-named fn. Anonymous / decl-form tests are scopes without a def.
|
|
42
|
+
(test_declaration
|
|
43
|
+
(string) @declaration.name) @declaration.function
|
|
44
|
+
|
|
45
|
+
;; Declarations — containers. The binding name lives on the wrapper
|
|
46
|
+
;; variable_declaration, but the ANCHOR is the container node itself so its
|
|
47
|
+
;; range equals the @scope.class range: the extractor then attaches the def
|
|
48
|
+
;; to the class scope (walkers.populateClassOwnedMembers expects the
|
|
49
|
+
;; class-like def among the class scope's ownedDefs) and auto-hoists the
|
|
50
|
+
;; name binding to the parent scope. Keyword-gated like the ordinary
|
|
51
|
+
;; binding rules: a keyword-less \`x = struct {…};\` is an assignment
|
|
52
|
+
;; (tree-sitter-zig 1.1.2 reuses variable_declaration), not a container def.
|
|
53
|
+
(variable_declaration
|
|
54
|
+
"const" . (identifier) @declaration.name
|
|
55
|
+
(struct_declaration) @declaration.struct)
|
|
56
|
+
(variable_declaration
|
|
57
|
+
"var" . (identifier) @declaration.name
|
|
58
|
+
(struct_declaration) @declaration.struct)
|
|
59
|
+
(variable_declaration
|
|
60
|
+
"const" . (identifier) @declaration.name
|
|
61
|
+
(enum_declaration) @declaration.enum)
|
|
62
|
+
(variable_declaration
|
|
63
|
+
"var" . (identifier) @declaration.name
|
|
64
|
+
(enum_declaration) @declaration.enum)
|
|
65
|
+
(variable_declaration
|
|
66
|
+
"const" . (identifier) @declaration.name
|
|
67
|
+
(union_declaration) @declaration.union)
|
|
68
|
+
(variable_declaration
|
|
69
|
+
"var" . (identifier) @declaration.name
|
|
70
|
+
(union_declaration) @declaration.union)
|
|
71
|
+
;; opaque {} is a fieldless container that may own methods — Struct, as in
|
|
72
|
+
;; ZIG_QUERIES (see the rationale there).
|
|
73
|
+
(variable_declaration
|
|
74
|
+
"const" . (identifier) @declaration.name
|
|
75
|
+
(opaque_declaration) @declaration.struct)
|
|
76
|
+
(variable_declaration
|
|
77
|
+
"var" . (identifier) @declaration.name
|
|
78
|
+
(opaque_declaration) @declaration.struct)
|
|
79
|
+
|
|
80
|
+
;; Declarations — generic type constructors. \`fn List(comptime T: type) type
|
|
81
|
+
;; { return struct {…}; }\` is Zig's only spelling of a generic type; the
|
|
82
|
+
;; returned container is anonymous in the grammar but every reader (and every
|
|
83
|
+
;; caller: \`List(u8)\`) names it after the function. Anchor on the container
|
|
84
|
+
;; so the def sits in its own class scope; the name binding is hoisted to the
|
|
85
|
+
;; MODULE scope by \`zigBindingScopeFor\` (not the fn body, where the name
|
|
86
|
+
;; would be invisible to callers) and coexists with the Function def of the
|
|
87
|
+
;; same name — \`List\` really is both a callable and a type.
|
|
88
|
+
((function_declaration
|
|
89
|
+
name: (identifier) @declaration.name
|
|
90
|
+
type: (builtin_type) @_ret
|
|
91
|
+
body: (block (expression_statement (return_expression
|
|
92
|
+
(struct_declaration) @declaration.struct))))
|
|
93
|
+
(#eq? @_ret "type"))
|
|
94
|
+
((function_declaration
|
|
95
|
+
name: (identifier) @declaration.name
|
|
96
|
+
type: (builtin_type) @_ret
|
|
97
|
+
body: (block (expression_statement (return_expression
|
|
98
|
+
(union_declaration) @declaration.union))))
|
|
99
|
+
(#eq? @_ret "type"))
|
|
100
|
+
((function_declaration
|
|
101
|
+
name: (identifier) @declaration.name
|
|
102
|
+
type: (builtin_type) @_ret
|
|
103
|
+
body: (block (expression_statement (return_expression
|
|
104
|
+
(enum_declaration) @declaration.enum))))
|
|
105
|
+
(#eq? @_ret "type"))
|
|
106
|
+
|
|
107
|
+
;; Declarations — container fields (struct fields, enum/union variants).
|
|
108
|
+
;; The #not-eq? guard drops the MISSING placeholder identifier tree-sitter-zig
|
|
109
|
+
;; recovers for an empty container body (see ZIG_QUERIES). The optional
|
|
110
|
+
;; \`type:\` (absent on enum variants) is captured as @declaration.field-type:
|
|
111
|
+
;; \`emitZigScopeCaptures\` turns it into a @type-binding.field on the
|
|
112
|
+
;; container's Class scope so \`self.session.name()\` can walk the field's
|
|
113
|
+
;; type (Rust/Go parity — see the F5 block in captures.ts).
|
|
114
|
+
((container_field
|
|
115
|
+
name: (identifier) @declaration.name
|
|
116
|
+
type: (_)? @declaration.field-type) @declaration.field
|
|
117
|
+
(#not-eq? @declaration.name ""))
|
|
118
|
+
|
|
119
|
+
;; Declarations — const/var bindings (import/container groups filtered in TS).
|
|
120
|
+
;; The \`.\` anchor pins the FIRST named child: without it the pattern also
|
|
121
|
+
;; matched the initializer of \`const first = target;\`, minting a phantom
|
|
122
|
+
;; local named \`target\` that shadowed the real callee for every later
|
|
123
|
+
;; reference in the block. The literal keyword is load-bearing too:
|
|
124
|
+
;; tree-sitter-zig 1.1.2 parses statement assignments (\`x = 5;\`, \`x += 1;\`,
|
|
125
|
+
;; \`_ = expr;\`) as \`variable_declaration\` WITHOUT a keyword child, and
|
|
126
|
+
;; without the keyword every assignment and every discard minted a phantom
|
|
127
|
+
;; local (one \`_\` per statement).
|
|
128
|
+
(variable_declaration
|
|
129
|
+
"const" . (identifier) @declaration.name) @declaration.variable
|
|
130
|
+
(variable_declaration
|
|
131
|
+
"var" . (identifier) @declaration.name) @declaration.variable
|
|
132
|
+
|
|
133
|
+
;; Imports — const x = @import("...") / var x = @import("..."). Keyword-gated
|
|
134
|
+
;; like every binding rule: a keyword-less \`x = @import("...")\` is a
|
|
135
|
+
;; statement (see the side-effect rule below), not a binding.
|
|
136
|
+
(variable_declaration
|
|
137
|
+
"const" . (identifier) @import.name
|
|
138
|
+
(builtin_function
|
|
139
|
+
(builtin_identifier) @_builtin
|
|
140
|
+
(arguments (string) @import.source))
|
|
141
|
+
(#eq? @_builtin "@import")) @import.statement
|
|
142
|
+
(variable_declaration
|
|
143
|
+
"var" . (identifier) @import.name
|
|
144
|
+
(builtin_function
|
|
145
|
+
(builtin_identifier) @_builtin
|
|
146
|
+
(arguments (string) @import.source))
|
|
147
|
+
(#eq? @_builtin "@import")) @import.statement
|
|
148
|
+
|
|
149
|
+
;; Imports — const X = @import("...").X : a NAMED import of one member. The
|
|
150
|
+
;; local name is whatever the user chose (\`const Alloc = @import("std").mem;\`
|
|
151
|
+
;; is a rename), the imported name is the member. A deeper chain
|
|
152
|
+
;; (\`@import("std").mem.Allocator\`, \`@import("lib.zig").B.work\`) is matched
|
|
153
|
+
;; by the second rule below but is NOT bound as a named import of the
|
|
154
|
+
;; innermost member: that discarded the written owner (\`B\`) and let a
|
|
155
|
+
;; same-named \`A.work\` answer first. \`emitZigScopeCaptures\` binds the module
|
|
156
|
+
;; under the builtin's text instead and rewrites the alias's use sites to the
|
|
157
|
+
;; full path (\`collectZigDeepAliases\`, PR #1432 review 8.4).
|
|
158
|
+
(variable_declaration
|
|
159
|
+
"const" . (identifier) @import.name
|
|
160
|
+
(field_expression
|
|
161
|
+
object: (builtin_function
|
|
162
|
+
(builtin_identifier) @_builtin
|
|
163
|
+
(arguments (string) @import.source))
|
|
164
|
+
member: (identifier) @import.imported)
|
|
165
|
+
(#eq? @_builtin "@import")) @import.statement
|
|
166
|
+
(variable_declaration
|
|
167
|
+
"const" . (identifier) @import.name
|
|
168
|
+
(field_expression
|
|
169
|
+
object: (field_expression
|
|
170
|
+
object: (builtin_function
|
|
171
|
+
(builtin_identifier) @_builtin
|
|
172
|
+
(arguments (string) @import.source)))
|
|
173
|
+
member: (identifier) @import.imported)
|
|
174
|
+
(#eq? @_builtin "@import")) @import.statement
|
|
175
|
+
|
|
176
|
+
;; Imports — a keyword-less \`<ident> = @import("...");\` statement
|
|
177
|
+
;; (\`_ = @import("all_tests.zig");\` in a test block, the refAllDecls
|
|
178
|
+
;; idiom): tree-sitter-zig reuses \`variable_declaration\` for assignments, so
|
|
179
|
+
;; the shape is a declaration minus the keyword. It references the file
|
|
180
|
+
;; without binding a name — a side-effect import. Tree-sitter queries cannot
|
|
181
|
+
;; say "no keyword child", so this rule matches the keyword-bearing shapes
|
|
182
|
+
;; too; \`emitZigScopeCaptures\` keeps it only when \`isZigKeywordDeclaration\`
|
|
183
|
+
;; is false (the keyword shapes are the binding rules above).
|
|
184
|
+
(variable_declaration
|
|
185
|
+
. (identifier)
|
|
186
|
+
(builtin_function
|
|
187
|
+
(builtin_identifier) @_builtin
|
|
188
|
+
(arguments (string) @import.source))
|
|
189
|
+
(#eq? @_builtin "@import")) @import.side-effect
|
|
190
|
+
|
|
191
|
+
;; Aliases of a namespace member — const Counter = counter.Counter; where
|
|
192
|
+
;; \`counter\` is an @import binding of THIS file. The query cannot know which
|
|
193
|
+
;; identifiers are import bindings, so it captures every one-level member
|
|
194
|
+
;; alias and \`emitZigScopeCaptures\` promotes the ones whose object is a
|
|
195
|
+
;; known @import to a named import (same fact as \`const Counter =
|
|
196
|
+
;; @import("counter.zig").Counter;\`); the rest stay ordinary variables.
|
|
197
|
+
;; Only the ONE-level shape is promoted; a deeper chain (\`lib.B.work\`,
|
|
198
|
+
;; \`std.mem.Allocator\`) is a deep alias — a Const whose use sites are
|
|
199
|
+
;; rewritten to the written owner path (see the import rule above, 8.4).
|
|
200
|
+
(variable_declaration
|
|
201
|
+
"const" . (identifier) @alias.name
|
|
202
|
+
(field_expression
|
|
203
|
+
object: (identifier) @alias.namespace
|
|
204
|
+
member: (identifier) @alias.member) .) @alias.statement
|
|
205
|
+
(variable_declaration
|
|
206
|
+
"const" . (identifier) @alias.name
|
|
207
|
+
(field_expression
|
|
208
|
+
object: (field_expression
|
|
209
|
+
object: (identifier) @alias.namespace)
|
|
210
|
+
member: (identifier) @alias.member) .) @alias.statement
|
|
211
|
+
|
|
212
|
+
;; Imports — pub usingnamespace @import("..."); : every pub decl of the target
|
|
213
|
+
;; becomes a decl of this container (removed from the language in 0.15, still
|
|
214
|
+
;; everywhere in 0.11–0.14 code). Modelled as a wildcard import.
|
|
215
|
+
(using_namespace_declaration
|
|
216
|
+
(builtin_function
|
|
217
|
+
(builtin_identifier) @_builtin
|
|
218
|
+
(arguments (string) @import.source))
|
|
219
|
+
(#eq? @_builtin "@import")) @import.wildcard
|
|
220
|
+
|
|
221
|
+
;; Imports — \`@import("...")\` in ANY other position: a tuple element
|
|
222
|
+
;; (\`pub const Interfaces = .{ @import("a.zig"), @import("b.zig") }\`, the
|
|
223
|
+
;; JS-API registration table), a call argument (\`event.is(@import("x.zig"))\`),
|
|
224
|
+
;; a comparison operand (\`T == @import("x.zig").T\`), the receiver of a
|
|
225
|
+
;; member call (\`try @import("dump.zig").root(...)\`), a 3-deep member chain…
|
|
226
|
+
;; Every one of them is a file dependency; only the const/var/usingnamespace
|
|
227
|
+
;; shapes above bind a name. This rule matches EVERY \`@import\` builtin, the
|
|
228
|
+
;; bound shapes included — \`emitZigScopeCaptures\` drops the matches whose
|
|
229
|
+
;; string node a binding rule (or the keyword-less side-effect rule) already
|
|
230
|
+
;; claimed, so a bound import is never doubled, and emits the rest as
|
|
231
|
+
;; side-effect imports (file edge, no binding) — except the member-call
|
|
232
|
+
;; receiver, which becomes a namespace import keyed by its own source text so
|
|
233
|
+
;; the call resolves into the imported module (see the emitter).
|
|
234
|
+
((builtin_function
|
|
235
|
+
(builtin_identifier) @_builtin
|
|
236
|
+
(arguments (string) @import.source))
|
|
237
|
+
(#eq? @_builtin "@import")) @import.inline
|
|
238
|
+
|
|
239
|
+
;; Type bindings — parameter annotations (incl. self: *T receivers)
|
|
240
|
+
(parameter
|
|
241
|
+
name: (identifier) @type-binding.name
|
|
242
|
+
type: (_) @type-binding.type) @type-binding.parameter
|
|
243
|
+
|
|
244
|
+
;; Type bindings — constructor inference: const p = T{ ... }. Keyword-gated
|
|
245
|
+
;; like every binding rule: a keyword-less \`p = T{ ... };\` is a
|
|
246
|
+
;; re-assignment (same node type in tree-sitter-zig 1.1.2), and Zig's static
|
|
247
|
+
;; typing means \`p\` already carries its type from its declaration
|
|
248
|
+
;; (annotation, constructor or inferred value) — the assignment declares
|
|
249
|
+
;; nothing, and \`_ = T{ ... };\` must not bind \`_\`.
|
|
250
|
+
(variable_declaration
|
|
251
|
+
"const" . (identifier) @type-binding.name
|
|
252
|
+
(struct_initializer
|
|
253
|
+
(identifier) @type-binding.type)) @type-binding.constructor
|
|
254
|
+
(variable_declaration
|
|
255
|
+
"var" . (identifier) @type-binding.name
|
|
256
|
+
(struct_initializer
|
|
257
|
+
(identifier) @type-binding.type)) @type-binding.constructor
|
|
258
|
+
|
|
259
|
+
;; Type bindings — qualified constructor: const p = mod.T{ ... }. The whole
|
|
260
|
+
;; field_expression is captured so the dotted text "mod.T" survives —
|
|
261
|
+
;; receiver dispatch resolves the namespace prefix through the import
|
|
262
|
+
;; binding (emitReceiverBoundCalls Case 3).
|
|
263
|
+
(variable_declaration
|
|
264
|
+
"const" . (identifier) @type-binding.name
|
|
265
|
+
(struct_initializer
|
|
266
|
+
(field_expression) @type-binding.type)) @type-binding.constructor
|
|
267
|
+
(variable_declaration
|
|
268
|
+
"var" . (identifier) @type-binding.name
|
|
269
|
+
(struct_initializer
|
|
270
|
+
(field_expression) @type-binding.type)) @type-binding.constructor
|
|
271
|
+
|
|
272
|
+
;; Type bindings — generic instantiation literal: const l = List(u8){ ... }.
|
|
273
|
+
;; The callee is the type constructor; \`normalizeZigTypeName\` drops the
|
|
274
|
+
;; comptime argument list so \`List(u8)\` looks up \`List\`.
|
|
275
|
+
(variable_declaration
|
|
276
|
+
"const" . (identifier) @type-binding.name
|
|
277
|
+
(struct_initializer
|
|
278
|
+
(call_expression) @type-binding.type)) @type-binding.constructor
|
|
279
|
+
(variable_declaration
|
|
280
|
+
"var" . (identifier) @type-binding.name
|
|
281
|
+
(struct_initializer
|
|
282
|
+
(call_expression) @type-binding.type)) @type-binding.constructor
|
|
283
|
+
|
|
284
|
+
;; Type bindings — declared type: var x: T = …; const x: T = .init(…);
|
|
285
|
+
;; The annotation is the ONLY type source for \`= undefined\` and for 0.14+
|
|
286
|
+
;; decl literals (\`.init\`, \`.empty\`), which are the idiomatic
|
|
287
|
+
;; constructors in current std. Ranked below constructor inference by the
|
|
288
|
+
;; shared resolver (source 'annotation'), so a literal on the right still
|
|
289
|
+
;; wins when both are present.
|
|
290
|
+
(variable_declaration
|
|
291
|
+
. (identifier) @type-binding.name
|
|
292
|
+
type: (_) @type-binding.type) @type-binding.annotation
|
|
293
|
+
|
|
294
|
+
;; Type bindings — value inference (F6): const t = <value>; where <value> is a
|
|
295
|
+
;; call (\`Counter.init()\`, \`makeThing()\`, \`node.asElement()\`), possibly
|
|
296
|
+
;; wrapped in \`try\` / \`catch …\` / \`… orelse …\` / parentheses — the shape of
|
|
297
|
+
;; nearly every Zig constructor call (\`const p = try Page.init(…)\`). The
|
|
298
|
+
;; query only pins the declaration; \`emitZigScopeCaptures\` unwraps the
|
|
299
|
+
;; wrappers and rewrites \`@type-binding.type\` to the type source (see
|
|
300
|
+
;; \`zigCallReturnTypeOf\`). Keyword-gated: \`_ = e.top();\` is an assignment
|
|
301
|
+
;; (same node type), not a binding of \`_\`. Rust's twin is
|
|
302
|
+
;; \`let x = Foo::new()\` / \`let x = foo().await\`.
|
|
303
|
+
(variable_declaration
|
|
304
|
+
"const" . (identifier) @type-binding.name
|
|
305
|
+
(_) @type-binding.value .) @type-binding.call-return
|
|
306
|
+
(variable_declaration
|
|
307
|
+
"var" . (identifier) @type-binding.name
|
|
308
|
+
(_) @type-binding.value .) @type-binding.call-return
|
|
309
|
+
|
|
310
|
+
;; Type bindings — return-type annotation (F6): \`fn make() !*Thing\` binds
|
|
311
|
+
;; \`make ↦ Thing\` in the enclosing scope (Module for free fns, the container's
|
|
312
|
+
;; Class scope for methods — that is where the compound resolver reads a
|
|
313
|
+
;; method's return type for \`node.asElement()\`), so \`const t = makeThing()\`
|
|
314
|
+
;; chains to \`Thing\`. Rust: \`(function_item … return_type:) @type-binding.return\`.
|
|
315
|
+
;; \`emitZigScopeCaptures\` drops builtin / \`type\` returns (a \`List ↦ type\`
|
|
316
|
+
;; binding would hijack the \`List(u8){}\` constructor chain).
|
|
317
|
+
(function_declaration
|
|
318
|
+
name: (identifier) @type-binding.name
|
|
319
|
+
type: (_) @type-binding.type) @type-binding.return
|
|
320
|
+
|
|
321
|
+
;; Type bindings — aliases (F5 field-access aliases + F7 type aliases):
|
|
322
|
+
;; \`const page = self.page;\` (F5: the RHS path is kept verbatim as the
|
|
323
|
+
;; "type", the compound resolver's member-alias branch re-resolves it as a
|
|
324
|
+
;; receiver chain — head \`self\` → class → field type), \`const LocalAlias = Local;\`,
|
|
325
|
+
;; \`const Proto = HtmlElement;\`, \`const T2 = Thing;\` (alias of an alias /
|
|
326
|
+
;; import), \`const B = util.List(u8);\` (an INSTANTIATED generic type
|
|
327
|
+
;; constructor). Zig has no \`type X = Y\` syntax — a type alias is a const
|
|
328
|
+
;; whose value is a type expression, and it stays a Const in the graph. What
|
|
329
|
+
;; must change is the scope side: bind the alias NAME to the value's type
|
|
330
|
+
;; text (Rust's \`let x = y\` / JS's \`const B = Foo\` \`@type-binding.alias\`,
|
|
331
|
+
;; source 'assignment-inferred'), so \`LocalAlias.mk()\` types through Case 4,
|
|
332
|
+
;; \`B.init()\` / \`x: B\` / \`B{}\` through Case 3 once \`normalizeZigTypeName\`
|
|
333
|
+
;; drops the comptime arguments (\`util.List(u8)\` → \`util.List\`), and every
|
|
334
|
+
;; binding that names the alias (\`var l = LocalAlias.mk()\`, \`var x: B\`) is
|
|
335
|
+
;; chained to the target by the shared \`followChainedRef\` /
|
|
336
|
+
;; \`followChainPostFinalize\`. The identifier / member shapes take \`var\` too:
|
|
337
|
+
;; \`var node = orig_node;\` is the same value alias as Rust's \`let x = y\`
|
|
338
|
+
;; and chains to the type of \`orig_node\` (a Zig type is comptime and never
|
|
339
|
+
;; \`var\`, so the type-alias reading only ever applies to \`const\`). The
|
|
340
|
+
;; call shape is \`const\`-only and kept only when the callee's last
|
|
341
|
+
;; identifier is TitleCase — see \`emitZigScopeCaptures\` (a value call
|
|
342
|
+
;; \`const t = util.makeThing()\` belongs to the call-return rules above and
|
|
343
|
+
;; must not receive a competing binding). A promoted namespace-member alias
|
|
344
|
+
;; (\`const Counter = counter.Counter;\` → named import) is skipped there too:
|
|
345
|
+
;; the import binding already carries the type.
|
|
346
|
+
(variable_declaration
|
|
347
|
+
"const" . (identifier) @type-binding.name
|
|
348
|
+
(identifier) @type-binding.type .) @type-binding.alias
|
|
349
|
+
(variable_declaration
|
|
350
|
+
"var" . (identifier) @type-binding.name
|
|
351
|
+
(identifier) @type-binding.type .) @type-binding.alias
|
|
352
|
+
(variable_declaration
|
|
353
|
+
"const" . (identifier) @type-binding.name
|
|
354
|
+
(field_expression) @type-binding.type .) @type-binding.alias
|
|
355
|
+
(variable_declaration
|
|
356
|
+
"var" . (identifier) @type-binding.name
|
|
357
|
+
(field_expression) @type-binding.type .) @type-binding.alias
|
|
358
|
+
(variable_declaration
|
|
359
|
+
"const" . (identifier) @type-binding.name
|
|
360
|
+
(call_expression) @type-binding.type .) @type-binding.alias
|
|
361
|
+
|
|
362
|
+
;; References — free calls: foo(...)
|
|
363
|
+
(call_expression
|
|
364
|
+
function: (identifier) @reference.name) @reference.call.free
|
|
365
|
+
|
|
366
|
+
;; References — member calls: obj.method(...) / mod.fn(...)
|
|
367
|
+
(call_expression
|
|
368
|
+
function: (field_expression
|
|
369
|
+
object: (_) @reference.receiver
|
|
370
|
+
member: (identifier) @reference.name)) @reference.call.member
|
|
371
|
+
|
|
372
|
+
;; References — constructor uses: T{ ... }
|
|
373
|
+
(struct_initializer
|
|
374
|
+
(identifier) @reference.name) @reference.call.constructor
|
|
375
|
+
|
|
376
|
+
;; References — qualified constructor uses: mod.T{ ... } / hub.sub.T{ ... }
|
|
377
|
+
;; Captured with the RECEIVER, not as a free constructor with a raw qualified
|
|
378
|
+
;; name, on purpose: the free-call fallback resolves a qualified constructor by
|
|
379
|
+
;; its simple tail, and a workspace-unique \`Thing\` then answers for
|
|
380
|
+
;; \`other.Thing{}\` whichever module the source named (measured: \`c.Thing{}\`
|
|
381
|
+
;; with no \`Thing\` in c.zig bound to a.zig's). With the receiver the site goes
|
|
382
|
+
;; through the receiver-bound namespace case, which resolves the member inside
|
|
383
|
+
;; the module the receiver is bound to — the same path \`mod.fn()\` takes — so
|
|
384
|
+
;; \`a.Thing{}\` and \`b.Thing{}\` each bind their own file and \`std.Thread.Mutex{}\`
|
|
385
|
+
;; binds nothing even when a local \`Mutex\` exists.
|
|
386
|
+
(struct_initializer
|
|
387
|
+
(field_expression
|
|
388
|
+
object: (_) @reference.receiver
|
|
389
|
+
member: (identifier) @reference.name)) @reference.call.constructor
|
|
390
|
+
|
|
391
|
+
;; References — generic instantiation literals: List(u8){ ... } /
|
|
392
|
+
;; lists.List(u8){ ... }. The type head is a call_expression — the
|
|
393
|
+
;; instantiation of the type constructor — which neither constructor rule
|
|
394
|
+
;; above matches, so the OUTER aggregate event had no site: only the inner
|
|
395
|
+
;; \`List(u8)\` call (a free / member call reference on the call node) reached
|
|
396
|
+
;; the graph (PR #1432 review, 8.11). Two sites on two anchors: the call
|
|
397
|
+
;; (an invocation of \`List\`) and this initializer (a construction of the
|
|
398
|
+
;; container \`List\` returns, marked \`(constructor)\`). The receiver form goes
|
|
399
|
+
;; through the same namespace path as \`mod.T{}\`.
|
|
400
|
+
(struct_initializer
|
|
401
|
+
(call_expression
|
|
402
|
+
function: (identifier) @reference.name)) @reference.call.constructor
|
|
403
|
+
(struct_initializer
|
|
404
|
+
(call_expression
|
|
405
|
+
function: (field_expression
|
|
406
|
+
object: (_) @reference.receiver
|
|
407
|
+
member: (identifier) @reference.name))) @reference.call.constructor
|
|
408
|
+
`;
|
|
409
|
+
let _parser = null;
|
|
410
|
+
let _query = null;
|
|
411
|
+
function getZigLanguage() {
|
|
412
|
+
return _require('@tree-sitter-grammars/tree-sitter-zig');
|
|
413
|
+
}
|
|
414
|
+
export function getZigParser() {
|
|
415
|
+
if (_parser === null) {
|
|
416
|
+
_parser = new Parser();
|
|
417
|
+
_parser.setLanguage(getZigLanguage());
|
|
418
|
+
}
|
|
419
|
+
return _parser;
|
|
420
|
+
}
|
|
421
|
+
export function getZigScopeQuery() {
|
|
422
|
+
if (_query === null) {
|
|
423
|
+
_query = new Parser.Query(getZigLanguage(), ZIG_SCOPE_QUERY);
|
|
424
|
+
}
|
|
425
|
+
return _query;
|
|
426
|
+
}
|