gitnexus 1.6.5-rc.2 → 1.6.5-rc.21
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 +1 -1
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +26 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/method-dispatch-index.js +22 -3
- package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/lookup-core.js +18 -1
- package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -1
- package/dist/cli/ai-context.d.ts +1 -0
- package/dist/cli/ai-context.js +30 -12
- package/dist/cli/analyze.d.ts +18 -0
- package/dist/cli/analyze.js +33 -4
- package/dist/cli/augment.d.ts +1 -1
- package/dist/cli/augment.js +1 -1
- package/dist/cli/index.js +6 -1
- package/dist/cli/setup.js +6 -0
- package/dist/core/augmentation/engine.d.ts +2 -2
- package/dist/core/augmentation/engine.js +26 -6
- package/dist/core/embeddings/ast-utils.js +2 -1
- package/dist/core/embeddings/http-client.js +22 -6
- package/dist/core/group/extractors/grpc-extractor.js +2 -1
- package/dist/core/group/extractors/http-patterns/python.js +175 -0
- package/dist/core/group/extractors/http-route-extractor.js +2 -1
- package/dist/core/group/extractors/include-extractor.js +2 -1
- package/dist/core/group/extractors/thrift-extractor.js +2 -1
- package/dist/core/group/extractors/tree-sitter-scanner.js +2 -1
- package/dist/core/incremental/shadow-candidates.d.ts +44 -0
- package/dist/core/incremental/shadow-candidates.js +74 -0
- package/dist/core/incremental/subgraph-extract.d.ts +64 -0
- package/dist/core/incremental/subgraph-extract.js +111 -0
- package/dist/core/ingestion/call-processor.js +166 -47
- package/dist/core/ingestion/community-processor.js +18 -0
- package/dist/core/ingestion/heritage-processor.js +3 -2
- package/dist/core/ingestion/import-processor.js +2 -1
- package/dist/core/ingestion/import-resolvers/standard.d.ts +5 -0
- package/dist/core/ingestion/import-resolvers/standard.js +27 -1
- package/dist/core/ingestion/import-resolvers/utils.js +4 -0
- package/dist/core/ingestion/languages/c/arity-metadata.d.ts +14 -0
- package/dist/core/ingestion/languages/c/arity-metadata.js +94 -0
- package/dist/core/ingestion/languages/c/arity.d.ts +6 -0
- package/dist/core/ingestion/languages/c/arity.js +18 -0
- package/dist/core/ingestion/languages/c/captures.d.ts +2 -0
- package/dist/core/ingestion/languages/c/captures.js +105 -0
- package/dist/core/ingestion/languages/c/header-scan.d.ts +7 -0
- package/dist/core/ingestion/languages/c/header-scan.js +55 -0
- package/dist/core/ingestion/languages/c/import-decomposer.d.ts +8 -0
- package/dist/core/ingestion/languages/c/import-decomposer.js +50 -0
- package/dist/core/ingestion/languages/c/import-target.d.ts +14 -0
- package/dist/core/ingestion/languages/c/import-target.js +57 -0
- package/dist/core/ingestion/languages/c/index.d.ts +11 -0
- package/dist/core/ingestion/languages/c/index.js +11 -0
- package/dist/core/ingestion/languages/c/interpret.d.ts +14 -0
- package/dist/core/ingestion/languages/c/interpret.js +48 -0
- package/dist/core/ingestion/languages/c/merge-bindings.d.ts +7 -0
- package/dist/core/ingestion/languages/c/merge-bindings.js +23 -0
- package/dist/core/ingestion/languages/c/query.d.ts +3 -0
- package/dist/core/ingestion/languages/c/query.js +161 -0
- package/dist/core/ingestion/languages/c/scope-resolver.d.ts +13 -0
- package/dist/core/ingestion/languages/c/scope-resolver.js +60 -0
- package/dist/core/ingestion/languages/c/simple-hooks.d.ts +14 -0
- package/dist/core/ingestion/languages/c/simple-hooks.js +19 -0
- package/dist/core/ingestion/languages/c/static-linkage.d.ts +13 -0
- package/dist/core/ingestion/languages/c/static-linkage.js +57 -0
- package/dist/core/ingestion/languages/c-cpp.js +10 -0
- package/dist/core/ingestion/languages/csharp/captures.js +2 -1
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +3 -2
- package/dist/core/ingestion/languages/go/captures.js +2 -1
- package/dist/core/ingestion/languages/go/range-binding.js +2 -1
- package/dist/core/ingestion/languages/java/arity-metadata.d.ts +18 -0
- package/dist/core/ingestion/languages/java/arity-metadata.js +40 -0
- package/dist/core/ingestion/languages/java/arity.d.ts +10 -0
- package/dist/core/ingestion/languages/java/arity.js +24 -0
- package/dist/core/ingestion/languages/java/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/java/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/java/captures.d.ts +17 -0
- package/dist/core/ingestion/languages/java/captures.js +187 -0
- package/dist/core/ingestion/languages/java/import-decomposer.d.ts +18 -0
- package/dist/core/ingestion/languages/java/import-decomposer.js +85 -0
- package/dist/core/ingestion/languages/java/import-target.d.ts +17 -0
- package/dist/core/ingestion/languages/java/import-target.js +100 -0
- package/dist/core/ingestion/languages/java/index.d.ts +29 -0
- package/dist/core/ingestion/languages/java/index.js +29 -0
- package/dist/core/ingestion/languages/java/interpret.d.ts +13 -0
- package/dist/core/ingestion/languages/java/interpret.js +131 -0
- package/dist/core/ingestion/languages/java/merge-bindings.d.ts +12 -0
- package/dist/core/ingestion/languages/java/merge-bindings.js +40 -0
- package/dist/core/ingestion/languages/java/query.d.ts +30 -0
- package/dist/core/ingestion/languages/java/query.js +192 -0
- package/dist/core/ingestion/languages/java/receiver-binding.d.ts +11 -0
- package/dist/core/ingestion/languages/java/receiver-binding.js +95 -0
- package/dist/core/ingestion/languages/java/scope-resolver.d.ts +50 -0
- package/dist/core/ingestion/languages/java/scope-resolver.js +74 -0
- package/dist/core/ingestion/languages/java/simple-hooks.d.ts +13 -0
- package/dist/core/ingestion/languages/java/simple-hooks.js +34 -0
- package/dist/core/ingestion/languages/java.js +11 -0
- package/dist/core/ingestion/languages/php/arity-metadata.d.ts +28 -0
- package/dist/core/ingestion/languages/php/arity-metadata.js +63 -0
- package/dist/core/ingestion/languages/php/arity.d.ts +25 -0
- package/dist/core/ingestion/languages/php/arity.js +40 -0
- package/dist/core/ingestion/languages/php/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/php/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/php/captures.d.ts +34 -0
- package/dist/core/ingestion/languages/php/captures.js +739 -0
- package/dist/core/ingestion/languages/php/import-decomposer.d.ts +28 -0
- package/dist/core/ingestion/languages/php/import-decomposer.js +265 -0
- package/dist/core/ingestion/languages/php/import-target.d.ts +47 -0
- package/dist/core/ingestion/languages/php/import-target.js +100 -0
- package/dist/core/ingestion/languages/php/index.d.ts +68 -0
- package/dist/core/ingestion/languages/php/index.js +72 -0
- package/dist/core/ingestion/languages/php/interpret.d.ts +36 -0
- package/dist/core/ingestion/languages/php/interpret.js +241 -0
- package/dist/core/ingestion/languages/php/merge-bindings.d.ts +19 -0
- package/dist/core/ingestion/languages/php/merge-bindings.js +47 -0
- package/dist/core/ingestion/languages/php/namespace-siblings.d.ts +51 -0
- package/dist/core/ingestion/languages/php/namespace-siblings.js +288 -0
- package/dist/core/ingestion/languages/php/query.d.ts +32 -0
- package/dist/core/ingestion/languages/php/query.js +326 -0
- package/dist/core/ingestion/languages/php/receiver-binding.d.ts +36 -0
- package/dist/core/ingestion/languages/php/receiver-binding.js +128 -0
- package/dist/core/ingestion/languages/php/scope-resolver.d.ts +23 -0
- package/dist/core/ingestion/languages/php/scope-resolver.js +358 -0
- package/dist/core/ingestion/languages/php/simple-hooks.d.ts +42 -0
- package/dist/core/ingestion/languages/php/simple-hooks.js +111 -0
- package/dist/core/ingestion/languages/php.d.ts +0 -7
- package/dist/core/ingestion/languages/php.js +15 -0
- package/dist/core/ingestion/languages/python/captures.js +2 -1
- package/dist/core/ingestion/languages/typescript/captures.js +2 -1
- package/dist/core/ingestion/parsing-processor.d.ts +22 -2
- package/dist/core/ingestion/parsing-processor.js +85 -50
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +5 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +119 -11
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +14 -0
- package/dist/core/ingestion/pipeline.d.ts +13 -0
- package/dist/core/ingestion/registry-primary-flag.js +2 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +65 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.d.ts +1 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.js +12 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +5 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +25 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +79 -7
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +7 -3
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +24 -4
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +21 -2
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +13 -1
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +6 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +17 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +31 -7
- package/dist/core/ingestion/tree-sitter-queries.d.ts +1 -1
- package/dist/core/ingestion/tree-sitter-queries.js +10 -0
- package/dist/core/ingestion/workers/parse-worker.js +2 -1
- package/dist/core/lbug/lbug-adapter.d.ts +26 -0
- package/dist/core/lbug/lbug-adapter.js +174 -40
- package/dist/core/lbug/pool-adapter.js +19 -2
- package/dist/core/run-analyze.d.ts +2 -0
- package/dist/core/run-analyze.js +323 -29
- package/dist/core/tree-sitter/safe-parse.d.ts +6 -0
- package/dist/core/tree-sitter/safe-parse.js +32 -0
- package/dist/server/git-clone.js +10 -13
- package/dist/storage/file-hash.d.ts +47 -0
- package/dist/storage/file-hash.js +86 -0
- package/dist/storage/git.d.ts +17 -6
- package/dist/storage/git.js +46 -12
- package/dist/storage/parse-cache.d.ts +67 -0
- package/dist/storage/parse-cache.js +182 -0
- package/dist/storage/repo-manager.d.ts +41 -1
- package/dist/storage/repo-manager.js +17 -2
- package/hooks/claude/gitnexus-hook.cjs +8 -1
- package/hooks/claude/hook-lock.cjs +119 -0
- package/package.json +1 -1
- package/web/assets/{agent-BpHQleHE.js → agent-BG6RCOzz.js} +1 -1
- package/web/assets/architecture-7EHR7CIX-6QZW5X65-F-tujre-.js +1 -0
- package/web/assets/architectureDiagram-UL44E2DR-2GL7nOvO.js +36 -0
- package/web/assets/blockDiagram-7IZFK4PR-5AjX0pPU.js +132 -0
- package/web/assets/{c4Diagram-DFAF54RM-DeJV1rCn.js → c4Diagram-Y2BXMSZH-hLOeq7xC.js} +2 -2
- package/web/assets/chunk-2T2R6R2M-B_pq_2nf.js +4 -0
- package/web/assets/chunk-2UTLFMKG-CpoohCFN.js +1 -0
- package/web/assets/{chunk-7RZVMHOQ-BdIU-RGO.js → chunk-3SSMPTDK-CfqpR3Nr.js} +1 -1
- package/web/assets/chunk-4R4BOZG6-D3gm7tYj.js +159 -0
- package/web/assets/chunk-6764PJDD-WcI965eO.js +1 -0
- package/web/assets/chunk-AQ6EADP3-BpMj3rQl.js +1 -0
- package/web/assets/{chunk-KSICW3F5-C2tZmXwv.js → chunk-AZZRMDJM-DSoCJlUA.js} +1 -1
- package/web/assets/chunk-C62D2QBJ-CvFF2PnB.js +1 -0
- package/web/assets/chunk-CEXFNPSA-DdNtJtrF.js +1 -0
- package/web/assets/chunk-J5EP6P6S-DtcVaAJI.js +1 -0
- package/web/assets/{chunk-AEOMTBSW-D7qjBMHW.js → chunk-JQRUD6KW-DElaNjc0.js} +1 -1
- package/web/assets/chunk-KGYTTC2M-D0K5or7e.js +1 -0
- package/web/assets/chunk-KRXBNO2N-DpR8iDt8.js +1 -0
- package/web/assets/chunk-LCXTWHL2-DdMObOEk.js +231 -0
- package/web/assets/chunk-LII3EMHJ-I78zXtzi.js +1 -0
- package/web/assets/chunk-RERM46MO-Betu1cSy.js +1 -0
- package/web/assets/chunk-RG4AUYOV-BUCJ2JP5.js +206 -0
- package/web/assets/chunk-RKZBBQEN-Cutpza0t.js +1 -0
- package/web/assets/chunk-RLI5ZMPA-BFUxCvX2.js +1 -0
- package/web/assets/chunk-T5OCTHI4-DKwlkuvB.js +1 -0
- package/web/assets/chunk-UP6H54XL-0YWa0NDg.js +1 -0
- package/web/assets/chunk-UXSXWOXI-CSz0OXpz.js +1 -0
- package/web/assets/chunk-W44A43WB-AOmgoT-X.js +1 -0
- package/web/assets/{chunk-RWUO3TPN-DTWzAhQ1.js → chunk-ZXARS5L4-DIzgxjMw.js} +1 -1
- package/web/assets/classDiagram-KGZ6W3CR-BT-rn7LF.js +1 -0
- package/web/assets/classDiagram-v2-72OJOZXJ-uR3nDadY.js +1 -0
- package/web/assets/{cose-bilkent-PNC4W37J-DdZq7Qz_.js → cose-bilkent-UX7MHV2Q-DCSCD1TK.js} +1 -1
- package/web/assets/dagre-ND4H6XIP-CsciHSij.js +4 -0
- package/web/assets/diagram-3NCE3AQN-BKUT5Rpc.js +43 -0
- package/web/assets/diagram-GF46GFSD-Dxb4hZSo.js +24 -0
- package/web/assets/diagram-HNR7UZ2L-D3qus9Cn.js +3 -0
- package/web/assets/diagram-QXG6HAR7-r9BMLGGP.js +24 -0
- package/web/assets/diagram-WEQXMOUZ-BGXqs7-m.js +10 -0
- package/web/assets/{erDiagram-GCSMX5X6-DfdN6iqF.js → erDiagram-L5TCEMPS-LgSWVrkZ.js} +2 -2
- package/web/assets/eventmodeling-FCH6USID-MREXMVOE-By7r3bla.js +1 -0
- package/web/assets/flowDiagram-H6V6AXG4-Bj_vV5ky.js +162 -0
- package/web/assets/ganttDiagram-JCBTUEKG-B1eVITSh.js +292 -0
- package/web/assets/gitGraph-WXDBUCRP-R675I2BI-ClEP6RdE.js +1 -0
- package/web/assets/gitGraphDiagram-S2ZK5IYY-BP0R-_FD.js +106 -0
- package/web/assets/{index-3NUCUW2s.js → index-oL-ZNYwb.js} +80 -81
- package/web/assets/info-J43DQDTF-KCYPFFUO-bBJRjmP5.js +1 -0
- package/web/assets/infoDiagram-3YFTVSEB-Dmj4OEO3.js +2 -0
- package/web/assets/{ishikawaDiagram-YMYX4NHK-BF8AtDaj.js → ishikawaDiagram-BNXS4ZKH-B3NgQ4lJ.js} +2 -2
- package/web/assets/{journeyDiagram-SO5T7YLQ-BW8oKa3N.js → journeyDiagram-M6C3CM3L-DALmL4_N.js} +3 -3
- package/web/assets/{kanban-definition-LJHFXRCJ-DzbOsR-2.js → kanban-definition-75IXJCU3-AvVbHpnN.js} +4 -4
- package/web/assets/{katex-GD7MH7QM-CJiOjBBJ.js → katex-K3KEBU37-CqF6_ZN-.js} +1 -1
- package/web/assets/{mindmap-definition-2EUWGEK5-BIXGQALq.js → mindmap-definition-2TDM6QVE-B5c9VOzs.js} +28 -28
- package/web/assets/packet-YPE3B663-LP52Z2RK-1ZCldnu3.js +1 -0
- package/web/assets/pie-LRSECV5Y-TCRJHUBD-EhjHC5EE.js +1 -0
- package/web/assets/pieDiagram-CU6KROY3-Po2HSSR4.js +30 -0
- package/web/assets/quadrantDiagram-VICAPDV7-C47UxSZD.js +7 -0
- package/web/assets/radar-GUYGQ44K-RDLRG3WG-CvXjgxlW.js +1 -0
- package/web/assets/{requirementDiagram-M5DCFWZL-CzUUrhQD.js → requirementDiagram-JXO7QTGE-CpECN_Hq.js} +6 -6
- package/web/assets/sankeyDiagram-URQDO5SZ-B3b7cLrS.js +40 -0
- package/web/assets/sequenceDiagram-VS2MUI6T-CRJ95oVP.js +162 -0
- package/web/assets/stateDiagram-7D4R322I-C7U9b3ks.js +1 -0
- package/web/assets/stateDiagram-v2-36443NZ5-BQajbtov.js +1 -0
- package/web/assets/{timeline-definition-5SPVSISX-DkMiGj4Z.js → timeline-definition-O6YCAMPW-rtbk6BBo.js} +4 -4
- package/web/assets/treeView-BLDUP644-QA4HXRO3-R2o5gwfP.js +1 -0
- package/web/assets/treemap-LRROVOQU-LLAWBHMP-Cesmac_u.js +1 -0
- package/web/assets/{vennDiagram-IE5QUKF5-BCxMmf9q.js → vennDiagram-MWXL3ELB-W8Yoaayh.js} +3 -3
- package/web/assets/wardley-L42UT6IY-5TKZOOLJ-B9HYoRgA.js +1 -0
- package/web/assets/wardleyDiagram-CUQ6CDDI-DIZw5Abj.js +78 -0
- package/web/assets/{xychartDiagram-ZHJ5623Y-DZ7fP1_3.js → xychartDiagram-N2JHSOCM-DGRtrj4P.js} +3 -3
- package/web/index.html +2 -2
- package/web/assets/architecture-YZFGNWBL-S5CXDPWN-BUzkWgDl.js +0 -1
- package/web/assets/architectureDiagram-EMZXCZ2Q-CXbzok1G.js +0 -36
- package/web/assets/blockDiagram-IGV67L2C-DA1QJ4ZB.js +0 -132
- package/web/assets/chunk-3GS5O3IE-B8hpnia8.js +0 -231
- package/web/assets/chunk-3YCYZ6SJ-B-BVu21C.js +0 -1
- package/web/assets/chunk-6NTNNK5N-DW-jYSDr.js +0 -1
- package/web/assets/chunk-A34GCYZU-BbZl-IKy.js +0 -1
- package/web/assets/chunk-DJ7UZH7F-B5tMfF87.js +0 -1
- package/web/assets/chunk-DKKBVRCY-Djm-6K_e.js +0 -4
- package/web/assets/chunk-DU5LTGQ6-QPoynYcp.js +0 -1
- package/web/assets/chunk-FXACKDTF-jieSmbe2.js +0 -159
- package/web/assets/chunk-H3VCZNTA-8EMHZ3SV.js +0 -1
- package/web/assets/chunk-HN6EAY2L-CgE_agsD.js +0 -1
- package/web/assets/chunk-O5ABG6QK-DEZV1O19.js +0 -1
- package/web/assets/chunk-PK6DOVAG-BXv0JnsJ.js +0 -206
- package/web/assets/chunk-RNJOYNJ4-BiBkF9dN.js +0 -1
- package/web/assets/chunk-TBF5ZNIQ-BSl6s9lT.js +0 -1
- package/web/assets/chunk-TU3PZOEN-DE5Qhc0N.js +0 -1
- package/web/assets/chunk-TYMNRAUI-D1NDLIMG.js +0 -1
- package/web/assets/chunk-VELTKBKT-C9dVN39o.js +0 -1
- package/web/assets/chunk-W7ZLLLMY-Bu-cdLzs.js +0 -1
- package/web/assets/chunk-WSB5WSVC-Dor71SOz.js +0 -1
- package/web/assets/chunk-XGPFEOL4-CUonLRle.js +0 -1
- package/web/assets/classDiagram-PPOCWD7C-Cdd6UdVv.js +0 -1
- package/web/assets/classDiagram-v2-23LJLIIU-DNhxY2Ib.js +0 -1
- package/web/assets/dagre-E77IOHMT-Cfj_6e17.js +0 -4
- package/web/assets/diagram-H7BISOXX-BNvpsrBv.js +0 -43
- package/web/assets/diagram-JC5VWROH-Cn0rtDbJ.js +0 -24
- package/web/assets/diagram-LXUTUG65-CHfoVKNm.js +0 -10
- package/web/assets/diagram-WEHSV5V5-BLxHksnu.js +0 -24
- package/web/assets/flowDiagram-OTCZ4VVT-aAZw4c_M.js +0 -162
- package/web/assets/ganttDiagram-MUNLMDZQ-BEfC_7Or.js +0 -292
- package/web/assets/gitGraph-7Q5UKJZL-54BCDZD5-B6ZeRLP0.js +0 -1
- package/web/assets/gitGraphDiagram-3HKGZ4G3-CG0kC8Q5.js +0 -106
- package/web/assets/info-OMHHGYJF-BF2H5H6G-BIOsZy0W.js +0 -1
- package/web/assets/infoDiagram-MN7RKWGX-DUoMH-pq.js +0 -2
- package/web/assets/packet-4T2RLAQJ-EV4IVRXR-Bs7ysNMU.js +0 -1
- package/web/assets/pie-ZZUOXDRM-N23DN5KN-Csi8nnbH.js +0 -1
- package/web/assets/pieDiagram-3IATQBI2-QY-u7P6a.js +0 -30
- package/web/assets/quadrantDiagram-E256RVCF-Di4aNiU8.js +0 -7
- package/web/assets/radar-PYXPWWZC-P6TP7ZYP-DJlyXh2-.js +0 -1
- package/web/assets/sankeyDiagram-L3NBLAOT-D2fbMiIU.js +0 -10
- package/web/assets/sequenceDiagram-ZOUHS735-BNdkqguh.js +0 -157
- package/web/assets/stateDiagram-MLPALWAM-51_Q2w2L.js +0 -1
- package/web/assets/stateDiagram-v2-B5LQ5ZB2-8nHs2aNE.js +0 -1
- package/web/assets/treeView-SZITEDCU-5DXDK3XO-Cy6P0_CZ.js +0 -1
- package/web/assets/treemap-W4RFUUIX-WYLRDWKO-C_pp1R7A.js +0 -1
- package/web/assets/wardley-RL74JXVD-BCRCBASE-CMStJhpn.js +0 -1
- package/web/assets/wardleyDiagram-XU3VSMPF-ijlLF77s.js +0 -20
- /package/web/assets/{context-builder-CqQNhRj1.js → context-builder-CG-ydtp4.js} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter from `(ParsedImport, WorkspaceIndex)` → concrete file path.
|
|
3
|
+
*
|
|
4
|
+
* Converts Java package paths (dots → slashes) and tries:
|
|
5
|
+
* 1. Exact file match: `com/example/User.java`
|
|
6
|
+
* 2. Suffix match for nested layouts
|
|
7
|
+
* 3. Directory match (wildcard imports)
|
|
8
|
+
* 4. Progressive prefix stripping for non-standard layouts
|
|
9
|
+
*
|
|
10
|
+
* Returns `null` for unresolvable / JDK imports.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveJavaImportTarget(parsedImport, workspaceIndex) {
|
|
13
|
+
const ctx = workspaceIndex;
|
|
14
|
+
if (ctx === undefined ||
|
|
15
|
+
typeof ctx.fromFile !== 'string' ||
|
|
16
|
+
!(ctx.allFilePaths instanceof Set)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (parsedImport.kind === 'dynamic-unresolved')
|
|
20
|
+
return null;
|
|
21
|
+
if (parsedImport.targetRaw === null || parsedImport.targetRaw === '')
|
|
22
|
+
return null;
|
|
23
|
+
// Strip trailing `.*` for wildcard imports: `com.example.*` → `com.example`
|
|
24
|
+
let target = parsedImport.targetRaw;
|
|
25
|
+
if (target.endsWith('.*')) {
|
|
26
|
+
target = target.slice(0, -2);
|
|
27
|
+
}
|
|
28
|
+
// Package path: `com.example.User` → `com/example/User`
|
|
29
|
+
const pathLike = target.replace(/\./g, '/');
|
|
30
|
+
const suffix = `/${pathLike}`;
|
|
31
|
+
let exactFile = null;
|
|
32
|
+
let suffixFile = null;
|
|
33
|
+
let directoryChild = null;
|
|
34
|
+
const dirPrefix = `${pathLike}/`;
|
|
35
|
+
const suffixDirPrefix = `/${dirPrefix}`;
|
|
36
|
+
for (const raw of ctx.allFilePaths) {
|
|
37
|
+
const f = raw.replace(/\\/g, '/');
|
|
38
|
+
if (!f.endsWith('.java'))
|
|
39
|
+
continue;
|
|
40
|
+
if (f === `${pathLike}.java`) {
|
|
41
|
+
exactFile = raw;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
if (suffixFile === null && f.endsWith(`${suffix}.java`)) {
|
|
45
|
+
suffixFile = raw;
|
|
46
|
+
}
|
|
47
|
+
if (directoryChild === null) {
|
|
48
|
+
const atRoot = f.startsWith(dirPrefix);
|
|
49
|
+
const atNested = f.includes(suffixDirPrefix);
|
|
50
|
+
if (atRoot || atNested) {
|
|
51
|
+
const idx = atRoot ? 0 : f.indexOf(suffixDirPrefix) + 1;
|
|
52
|
+
const after = f.slice(idx + dirPrefix.length);
|
|
53
|
+
if (after.length > 0 && !after.includes('/')) {
|
|
54
|
+
directoryChild = raw;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (exactFile !== null)
|
|
60
|
+
return exactFile;
|
|
61
|
+
if (suffixFile !== null)
|
|
62
|
+
return suffixFile;
|
|
63
|
+
if (directoryChild !== null)
|
|
64
|
+
return directoryChild;
|
|
65
|
+
// Progressive prefix stripping — handles `import com.example.User;`
|
|
66
|
+
// in a repo laid out `User.java` (no `com/example/` prefix).
|
|
67
|
+
const segments = pathLike.split('/').filter(Boolean);
|
|
68
|
+
for (let skip = 1; skip < segments.length; skip++) {
|
|
69
|
+
const tail = segments.slice(skip).join('/');
|
|
70
|
+
if (tail === '')
|
|
71
|
+
continue;
|
|
72
|
+
const tailFile = `${tail}.java`;
|
|
73
|
+
const tailSuffix = `/${tailFile}`;
|
|
74
|
+
const tailDir = `${tail}/`;
|
|
75
|
+
const tailSuffixDir = `/${tailDir}`;
|
|
76
|
+
let tailDirectChild = null;
|
|
77
|
+
for (const raw of ctx.allFilePaths) {
|
|
78
|
+
const f = raw.replace(/\\/g, '/');
|
|
79
|
+
if (!f.endsWith('.java'))
|
|
80
|
+
continue;
|
|
81
|
+
if (f === tailFile)
|
|
82
|
+
return raw;
|
|
83
|
+
if (f.endsWith(tailSuffix))
|
|
84
|
+
return raw;
|
|
85
|
+
if (tailDirectChild === null) {
|
|
86
|
+
const atRoot = f.startsWith(tailDir);
|
|
87
|
+
const atNested = f.includes(tailSuffixDir);
|
|
88
|
+
if (atRoot || atNested) {
|
|
89
|
+
const idx = atRoot ? 0 : f.indexOf(tailSuffixDir) + 1;
|
|
90
|
+
const after = f.slice(idx + tailDir.length);
|
|
91
|
+
if (after.length > 0 && !after.includes('/'))
|
|
92
|
+
tailDirectChild = raw;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (tailDirectChild !== null)
|
|
97
|
+
return tailDirectChild;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java scope-resolution hooks (RFC #909 Ring 3).
|
|
3
|
+
*
|
|
4
|
+
* Public API barrel. Consumers should import from this file rather than
|
|
5
|
+
* the individual modules.
|
|
6
|
+
*
|
|
7
|
+
* Module layout:
|
|
8
|
+
*
|
|
9
|
+
* - `query.ts` — tree-sitter query + lazy parser/query singletons
|
|
10
|
+
* - `captures.ts` — `emitJavaScopeCaptures` orchestrator
|
|
11
|
+
* - `import-decomposer.ts` — each `import` → ParsedImport-shaped captures
|
|
12
|
+
* - `interpret.ts` — capture-match → `ParsedImport` / `ParsedTypeBinding`
|
|
13
|
+
* - `simple-hooks.ts` — small hooks made explicit
|
|
14
|
+
* - `receiver-binding.ts` — synthesize `this`/`super` type-bindings on
|
|
15
|
+
* instance-method entry
|
|
16
|
+
* - `merge-bindings.ts` — Java import precedence
|
|
17
|
+
* - `arity.ts` — Java arity compatibility (varargs)
|
|
18
|
+
* - `arity-metadata.ts` — synthesize arity metadata from declarations
|
|
19
|
+
* - `import-target.ts` — `(ParsedImport, WorkspaceIndex) → file path` adapter
|
|
20
|
+
* - `scope-resolver.ts` — `ScopeResolver` registered in `SCOPE_RESOLVERS`
|
|
21
|
+
* - `cache-stats.ts` — PROF_SCOPE_RESOLUTION cache hit/miss counters
|
|
22
|
+
*/
|
|
23
|
+
export { emitJavaScopeCaptures } from './captures.js';
|
|
24
|
+
export { getJavaCaptureCacheStats, resetJavaCaptureCacheStats } from './cache-stats.js';
|
|
25
|
+
export { interpretJavaImport, interpretJavaTypeBinding } from './interpret.js';
|
|
26
|
+
export { javaMergeBindings } from './merge-bindings.js';
|
|
27
|
+
export { javaArityCompatibility } from './arity.js';
|
|
28
|
+
export { resolveJavaImportTarget, type JavaResolveContext } from './import-target.js';
|
|
29
|
+
export { javaBindingScopeFor, javaImportOwningScope, javaReceiverBinding } from './simple-hooks.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java scope-resolution hooks (RFC #909 Ring 3).
|
|
3
|
+
*
|
|
4
|
+
* Public API barrel. Consumers should import from this file rather than
|
|
5
|
+
* the individual modules.
|
|
6
|
+
*
|
|
7
|
+
* Module layout:
|
|
8
|
+
*
|
|
9
|
+
* - `query.ts` — tree-sitter query + lazy parser/query singletons
|
|
10
|
+
* - `captures.ts` — `emitJavaScopeCaptures` orchestrator
|
|
11
|
+
* - `import-decomposer.ts` — each `import` → ParsedImport-shaped captures
|
|
12
|
+
* - `interpret.ts` — capture-match → `ParsedImport` / `ParsedTypeBinding`
|
|
13
|
+
* - `simple-hooks.ts` — small hooks made explicit
|
|
14
|
+
* - `receiver-binding.ts` — synthesize `this`/`super` type-bindings on
|
|
15
|
+
* instance-method entry
|
|
16
|
+
* - `merge-bindings.ts` — Java import precedence
|
|
17
|
+
* - `arity.ts` — Java arity compatibility (varargs)
|
|
18
|
+
* - `arity-metadata.ts` — synthesize arity metadata from declarations
|
|
19
|
+
* - `import-target.ts` — `(ParsedImport, WorkspaceIndex) → file path` adapter
|
|
20
|
+
* - `scope-resolver.ts` — `ScopeResolver` registered in `SCOPE_RESOLVERS`
|
|
21
|
+
* - `cache-stats.ts` — PROF_SCOPE_RESOLUTION cache hit/miss counters
|
|
22
|
+
*/
|
|
23
|
+
export { emitJavaScopeCaptures } from './captures.js';
|
|
24
|
+
export { getJavaCaptureCacheStats, resetJavaCaptureCacheStats } from './cache-stats.js';
|
|
25
|
+
export { interpretJavaImport, interpretJavaTypeBinding } from './interpret.js';
|
|
26
|
+
export { javaMergeBindings } from './merge-bindings.js';
|
|
27
|
+
export { javaArityCompatibility } from './arity.js';
|
|
28
|
+
export { resolveJavaImportTarget } from './import-target.js';
|
|
29
|
+
export { javaBindingScopeFor, javaImportOwningScope, javaReceiverBinding } from './simple-hooks.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture-match → semantic-shape interpreters for Java.
|
|
3
|
+
*
|
|
4
|
+
* - `interpretJavaImport` → `ParsedImport`
|
|
5
|
+
* - `interpretJavaTypeBinding` → `ParsedTypeBinding`
|
|
6
|
+
*
|
|
7
|
+
* Import matches arrive pre-decomposed by `emitJavaScopeCaptures`
|
|
8
|
+
* (one import per match, with synthesized `@import.kind/source/name`
|
|
9
|
+
* markers). Type-binding matches arrive from the raw query captures.
|
|
10
|
+
*/
|
|
11
|
+
import type { CaptureMatch, ParsedImport, ParsedTypeBinding } from '../../../../_shared/index.js';
|
|
12
|
+
export declare function interpretJavaImport(captures: CaptureMatch): ParsedImport | null;
|
|
13
|
+
export declare function interpretJavaTypeBinding(captures: CaptureMatch): ParsedTypeBinding | null;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture-match → semantic-shape interpreters for Java.
|
|
3
|
+
*
|
|
4
|
+
* - `interpretJavaImport` → `ParsedImport`
|
|
5
|
+
* - `interpretJavaTypeBinding` → `ParsedTypeBinding`
|
|
6
|
+
*
|
|
7
|
+
* Import matches arrive pre-decomposed by `emitJavaScopeCaptures`
|
|
8
|
+
* (one import per match, with synthesized `@import.kind/source/name`
|
|
9
|
+
* markers). Type-binding matches arrive from the raw query captures.
|
|
10
|
+
*/
|
|
11
|
+
// ─── interpretImport ──────────────────────────────────────────────────────
|
|
12
|
+
export function interpretJavaImport(captures) {
|
|
13
|
+
const kindCap = captures['@import.kind'];
|
|
14
|
+
const sourceCap = captures['@import.source'];
|
|
15
|
+
const nameCap = captures['@import.name'];
|
|
16
|
+
const kind = kindCap?.text;
|
|
17
|
+
if (kind === undefined || sourceCap === undefined)
|
|
18
|
+
return null;
|
|
19
|
+
switch (kind) {
|
|
20
|
+
case 'named': {
|
|
21
|
+
// `import com.example.User;`
|
|
22
|
+
return {
|
|
23
|
+
kind: 'named',
|
|
24
|
+
localName: nameCap?.text ?? sourceCap.text.split('.').pop() ?? sourceCap.text,
|
|
25
|
+
importedName: sourceCap.text,
|
|
26
|
+
targetRaw: sourceCap.text,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
case 'wildcard': {
|
|
30
|
+
// `import com.example.*;`
|
|
31
|
+
return {
|
|
32
|
+
kind: 'wildcard',
|
|
33
|
+
targetRaw: sourceCap.text + '.*',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
case 'static': {
|
|
37
|
+
// `import static com.example.Utils.format;`
|
|
38
|
+
// The source contains the full path including the member name
|
|
39
|
+
// (e.g. `com.example.Utils.format`). For file resolution we need
|
|
40
|
+
// the class path (`com.example.Utils`), so strip the final member
|
|
41
|
+
// segment. The local binding name is the member itself.
|
|
42
|
+
const fullSource = sourceCap.text;
|
|
43
|
+
const lastDot = fullSource.lastIndexOf('.');
|
|
44
|
+
const classPath = lastDot >= 0 ? fullSource.slice(0, lastDot) : fullSource;
|
|
45
|
+
return {
|
|
46
|
+
kind: 'named',
|
|
47
|
+
localName: nameCap?.text ?? (lastDot >= 0 ? fullSource.slice(lastDot + 1) : fullSource),
|
|
48
|
+
importedName: fullSource,
|
|
49
|
+
targetRaw: classPath,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
case 'static-wildcard': {
|
|
53
|
+
// `import static com.example.Utils.*;`
|
|
54
|
+
// The source is the class path (e.g. `com.example.Utils`).
|
|
55
|
+
// Resolution should target the class file, not a wildcard directory
|
|
56
|
+
// scan — `Utils.java` is the file that contains the static members.
|
|
57
|
+
return {
|
|
58
|
+
kind: 'wildcard',
|
|
59
|
+
targetRaw: sourceCap.text + '.*',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// ─── interpretTypeBinding ─────────────────────────────────────────────────
|
|
67
|
+
export function interpretJavaTypeBinding(captures) {
|
|
68
|
+
const nameCap = captures['@type-binding.name'];
|
|
69
|
+
const typeCap = captures['@type-binding.type'];
|
|
70
|
+
if (nameCap === undefined || typeCap === undefined)
|
|
71
|
+
return null;
|
|
72
|
+
// Strip qualifier first so that `com.example.BaseModel<T>` becomes
|
|
73
|
+
// `BaseModel<T>` before stripGeneric — the JVM-erasure fallback pattern
|
|
74
|
+
// requires an unqualified identifier at the start of the string.
|
|
75
|
+
const rawType = stripGeneric(stripQualifier(typeCap.text.trim()));
|
|
76
|
+
// Skip `var` — tree-sitter-java parses `var` as type_identifier with
|
|
77
|
+
// text "var". When used without a constructor initializer, there's no
|
|
78
|
+
// concrete type to bind.
|
|
79
|
+
if (rawType === 'var')
|
|
80
|
+
return null;
|
|
81
|
+
let source = 'parameter-annotation';
|
|
82
|
+
if (captures['@type-binding.self'] !== undefined)
|
|
83
|
+
source = 'self';
|
|
84
|
+
else if (captures['@type-binding.constructor'] !== undefined)
|
|
85
|
+
source = 'constructor-inferred';
|
|
86
|
+
else if (captures['@type-binding.annotation'] !== undefined)
|
|
87
|
+
source = 'annotation';
|
|
88
|
+
else if (captures['@type-binding.return'] !== undefined)
|
|
89
|
+
source = 'return-annotation';
|
|
90
|
+
return { boundName: nameCap.text, rawTypeName: rawType, source };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Unwrap generic type parameters from Java types.
|
|
94
|
+
*
|
|
95
|
+
* Three tiers, checked in order:
|
|
96
|
+
* 1. Known single-arg collection wrappers → extract the element type
|
|
97
|
+
* (`List<User>` → `User`, `Optional<User>` → `User`).
|
|
98
|
+
* 2. Known two-arg map/container types → extract the value type
|
|
99
|
+
* (`Map<String, User>` → `User`).
|
|
100
|
+
* 3. **Fallback (JVM type erasure):** any other generic type →
|
|
101
|
+
* strip the generic parameters and keep the raw class name
|
|
102
|
+
* (`BaseModel<T>` → `BaseModel`, `CustomList<Foo>` → `CustomList`).
|
|
103
|
+
* This ensures receiver bindings (`this`/`super`) on classes with
|
|
104
|
+
* generic superclasses resolve to the correct class file.
|
|
105
|
+
*/
|
|
106
|
+
function stripGeneric(text) {
|
|
107
|
+
// Single-type-argument containers — extract the element type.
|
|
108
|
+
const single = text.match(/^(?:[A-Za-z_][A-Za-z0-9_.]*\.)?(?:List|ArrayList|LinkedList|Set|HashSet|TreeSet|SortedSet|LinkedHashSet|Collection|Iterable|Iterator|Optional|Stream|CompletableFuture|Future|Queue|Deque|ArrayDeque|PriorityQueue|Vector|Stack|Supplier|Consumer|Predicate|Function)<([^,<>]+)>$/);
|
|
109
|
+
if (single !== null)
|
|
110
|
+
return single[1].trim();
|
|
111
|
+
// Two-type-argument map/container types — extract the value type (second arg).
|
|
112
|
+
const twoArg = text.match(/^(?:[A-Za-z_][A-Za-z0-9_.]*\.)?(?:Map|HashMap|TreeMap|LinkedHashMap|ConcurrentHashMap|ConcurrentMap|SortedMap|NavigableMap|Hashtable|EnumMap|WeakHashMap|IdentityHashMap|BiFunction|BiConsumer|BiPredicate|Pair|Entry)<[^,<>]+,\s*([^,<>]+)>$/);
|
|
113
|
+
if (twoArg !== null)
|
|
114
|
+
return twoArg[1].trim();
|
|
115
|
+
// Fallback: strip generic parameters from any unrecognized generic type.
|
|
116
|
+
// `BaseModel<T>` → `BaseModel`, `Builder<Self>` → `Builder`.
|
|
117
|
+
// This mirrors JVM type erasure — the raw class name is the resolvable symbol.
|
|
118
|
+
// The pattern matches up to the first `<` to handle nested generics safely
|
|
119
|
+
// (e.g. `BaseModel<List<String>>` → `BaseModel`).
|
|
120
|
+
const fallback = text.match(/^([A-Za-z_$][A-Za-z0-9_$]*)<.+>$/s);
|
|
121
|
+
if (fallback !== null)
|
|
122
|
+
return fallback[1].trim();
|
|
123
|
+
return text;
|
|
124
|
+
}
|
|
125
|
+
/** `com.example.User` → `User`. */
|
|
126
|
+
function stripQualifier(text) {
|
|
127
|
+
const lastDot = text.lastIndexOf('.');
|
|
128
|
+
if (lastDot === -1)
|
|
129
|
+
return text;
|
|
130
|
+
return text.slice(lastDot + 1);
|
|
131
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java shadowing precedence for the `mergeBindings` hook.
|
|
3
|
+
*
|
|
4
|
+
* Tier ranking (lower wins):
|
|
5
|
+
* - 0: `local` — class member, method, local variable, parameter
|
|
6
|
+
* - 1: `import` / `namespace` / `reexport` — explicit imports
|
|
7
|
+
* - 2: `wildcard` — wildcard imports (`import x.y.*`)
|
|
8
|
+
*
|
|
9
|
+
* Within a surviving tier: de-dup by DefId, last-write-wins.
|
|
10
|
+
*/
|
|
11
|
+
import type { BindingRef } from '../../../../_shared/index.js';
|
|
12
|
+
export declare function javaMergeBindings(bindings: readonly BindingRef[]): readonly BindingRef[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java shadowing precedence for the `mergeBindings` hook.
|
|
3
|
+
*
|
|
4
|
+
* Tier ranking (lower wins):
|
|
5
|
+
* - 0: `local` — class member, method, local variable, parameter
|
|
6
|
+
* - 1: `import` / `namespace` / `reexport` — explicit imports
|
|
7
|
+
* - 2: `wildcard` — wildcard imports (`import x.y.*`)
|
|
8
|
+
*
|
|
9
|
+
* Within a surviving tier: de-dup by DefId, last-write-wins.
|
|
10
|
+
*/
|
|
11
|
+
const TIER_LOCAL = 0;
|
|
12
|
+
const TIER_IMPORT = 1;
|
|
13
|
+
const TIER_WILDCARD = 2;
|
|
14
|
+
const TIER_UNKNOWN = 3;
|
|
15
|
+
function tierOf(b) {
|
|
16
|
+
switch (b.origin) {
|
|
17
|
+
case 'local':
|
|
18
|
+
return TIER_LOCAL;
|
|
19
|
+
case 'reexport':
|
|
20
|
+
case 'import':
|
|
21
|
+
case 'namespace':
|
|
22
|
+
return TIER_IMPORT;
|
|
23
|
+
case 'wildcard':
|
|
24
|
+
return TIER_WILDCARD;
|
|
25
|
+
default:
|
|
26
|
+
return TIER_UNKNOWN;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function javaMergeBindings(bindings) {
|
|
30
|
+
if (bindings.length === 0)
|
|
31
|
+
return bindings;
|
|
32
|
+
let bestTier = Number.POSITIVE_INFINITY;
|
|
33
|
+
for (const b of bindings)
|
|
34
|
+
bestTier = Math.min(bestTier, tierOf(b));
|
|
35
|
+
const survivors = bindings.filter((b) => tierOf(b) === bestTier);
|
|
36
|
+
const seen = new Map();
|
|
37
|
+
for (const b of survivors)
|
|
38
|
+
seen.set(b.def.nodeId, b);
|
|
39
|
+
return [...seen.values()];
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-sitter query for Java scope captures (RFC §5.1).
|
|
3
|
+
*
|
|
4
|
+
* Captures the structural skeleton the generic scope-resolution
|
|
5
|
+
* pipeline consumes: scopes (module/class/function), declarations
|
|
6
|
+
* (class-likes, method-likes, fields, variables), imports (import
|
|
7
|
+
* declarations), type bindings (parameter annotations, variable
|
|
8
|
+
* annotations, constructor inference), and references (call sites,
|
|
9
|
+
* member writes/reads).
|
|
10
|
+
*
|
|
11
|
+
* Java specifics that shape this query:
|
|
12
|
+
*
|
|
13
|
+
* - Java uses `program` as the root node (not `compilation_unit`).
|
|
14
|
+
* - `import_declaration` nodes carry `scoped_identifier` children
|
|
15
|
+
* and optional `asterisk` for wildcard imports.
|
|
16
|
+
* - `static` imports are detected by an anonymous `static` token
|
|
17
|
+
* child within `import_declaration`.
|
|
18
|
+
* - `var` (Java 10+ local variable type inference) parses as a
|
|
19
|
+
* `type_identifier` with text `"var"`, not a dedicated node type.
|
|
20
|
+
* - Modifiers (`public`, `static`, etc.) are grouped under a
|
|
21
|
+
* `modifiers` named child with anonymous keyword tokens.
|
|
22
|
+
* - Superclass inheritance uses a `superclass:` field containing
|
|
23
|
+
* a `superclass` node wrapping a `type_identifier`.
|
|
24
|
+
*
|
|
25
|
+
* Exposes lazy `Parser` and `Query` singletons so callers don't pay
|
|
26
|
+
* tree-sitter init cost per file.
|
|
27
|
+
*/
|
|
28
|
+
import Parser from 'tree-sitter';
|
|
29
|
+
export declare function getJavaParser(): Parser;
|
|
30
|
+
export declare function getJavaScopeQuery(): Parser.Query;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-sitter query for Java scope captures (RFC §5.1).
|
|
3
|
+
*
|
|
4
|
+
* Captures the structural skeleton the generic scope-resolution
|
|
5
|
+
* pipeline consumes: scopes (module/class/function), declarations
|
|
6
|
+
* (class-likes, method-likes, fields, variables), imports (import
|
|
7
|
+
* declarations), type bindings (parameter annotations, variable
|
|
8
|
+
* annotations, constructor inference), and references (call sites,
|
|
9
|
+
* member writes/reads).
|
|
10
|
+
*
|
|
11
|
+
* Java specifics that shape this query:
|
|
12
|
+
*
|
|
13
|
+
* - Java uses `program` as the root node (not `compilation_unit`).
|
|
14
|
+
* - `import_declaration` nodes carry `scoped_identifier` children
|
|
15
|
+
* and optional `asterisk` for wildcard imports.
|
|
16
|
+
* - `static` imports are detected by an anonymous `static` token
|
|
17
|
+
* child within `import_declaration`.
|
|
18
|
+
* - `var` (Java 10+ local variable type inference) parses as a
|
|
19
|
+
* `type_identifier` with text `"var"`, not a dedicated node type.
|
|
20
|
+
* - Modifiers (`public`, `static`, etc.) are grouped under a
|
|
21
|
+
* `modifiers` named child with anonymous keyword tokens.
|
|
22
|
+
* - Superclass inheritance uses a `superclass:` field containing
|
|
23
|
+
* a `superclass` node wrapping a `type_identifier`.
|
|
24
|
+
*
|
|
25
|
+
* Exposes lazy `Parser` and `Query` singletons so callers don't pay
|
|
26
|
+
* tree-sitter init cost per file.
|
|
27
|
+
*/
|
|
28
|
+
import Parser from 'tree-sitter';
|
|
29
|
+
import Java from 'tree-sitter-java';
|
|
30
|
+
const JAVA_SCOPE_QUERY = `
|
|
31
|
+
;; Scopes
|
|
32
|
+
(program) @scope.module
|
|
33
|
+
|
|
34
|
+
(class_declaration) @scope.class
|
|
35
|
+
(interface_declaration) @scope.class
|
|
36
|
+
(enum_declaration) @scope.class
|
|
37
|
+
(record_declaration) @scope.class
|
|
38
|
+
(annotation_type_declaration) @scope.class
|
|
39
|
+
|
|
40
|
+
(method_declaration) @scope.function
|
|
41
|
+
(constructor_declaration) @scope.function
|
|
42
|
+
|
|
43
|
+
;; Declarations — types
|
|
44
|
+
(class_declaration
|
|
45
|
+
name: (identifier) @declaration.name) @declaration.class
|
|
46
|
+
|
|
47
|
+
(interface_declaration
|
|
48
|
+
name: (identifier) @declaration.name) @declaration.interface
|
|
49
|
+
|
|
50
|
+
(enum_declaration
|
|
51
|
+
name: (identifier) @declaration.name) @declaration.enum
|
|
52
|
+
|
|
53
|
+
(record_declaration
|
|
54
|
+
name: (identifier) @declaration.name) @declaration.record
|
|
55
|
+
|
|
56
|
+
(annotation_type_declaration
|
|
57
|
+
name: (identifier) @declaration.name) @declaration.class
|
|
58
|
+
|
|
59
|
+
;; Declarations — methods / constructors
|
|
60
|
+
(method_declaration
|
|
61
|
+
name: (identifier) @declaration.name) @declaration.method
|
|
62
|
+
|
|
63
|
+
(constructor_declaration
|
|
64
|
+
name: (identifier) @declaration.name) @declaration.constructor
|
|
65
|
+
|
|
66
|
+
;; Declarations — fields
|
|
67
|
+
(field_declaration
|
|
68
|
+
declarator: (variable_declarator
|
|
69
|
+
name: (identifier) @declaration.name)) @declaration.variable
|
|
70
|
+
|
|
71
|
+
;; Declarations — local variables
|
|
72
|
+
(local_variable_declaration
|
|
73
|
+
declarator: (variable_declarator
|
|
74
|
+
name: (identifier) @declaration.name)) @declaration.variable
|
|
75
|
+
|
|
76
|
+
;; Imports — single anchor per import_declaration
|
|
77
|
+
(import_declaration) @import.statement
|
|
78
|
+
|
|
79
|
+
;; Type bindings — parameter annotations: void f(User u)
|
|
80
|
+
(formal_parameter
|
|
81
|
+
type: (type_identifier) @type-binding.type
|
|
82
|
+
name: (identifier) @type-binding.name) @type-binding.parameter
|
|
83
|
+
|
|
84
|
+
(formal_parameter
|
|
85
|
+
type: (generic_type) @type-binding.type
|
|
86
|
+
name: (identifier) @type-binding.name) @type-binding.parameter
|
|
87
|
+
|
|
88
|
+
(formal_parameter
|
|
89
|
+
type: (scoped_type_identifier) @type-binding.type
|
|
90
|
+
name: (identifier) @type-binding.name) @type-binding.parameter
|
|
91
|
+
|
|
92
|
+
;; Type bindings — local variable annotations: User u = new User();
|
|
93
|
+
(local_variable_declaration
|
|
94
|
+
type: (type_identifier) @type-binding.type
|
|
95
|
+
declarator: (variable_declarator
|
|
96
|
+
name: (identifier) @type-binding.name)) @type-binding.annotation
|
|
97
|
+
|
|
98
|
+
(local_variable_declaration
|
|
99
|
+
type: (generic_type) @type-binding.type
|
|
100
|
+
declarator: (variable_declarator
|
|
101
|
+
name: (identifier) @type-binding.name)) @type-binding.annotation
|
|
102
|
+
|
|
103
|
+
;; Type bindings — var u = new User(); (Java 10+ local variable type inference)
|
|
104
|
+
;; tree-sitter-java parses \`var\` as a \`type_identifier\` with text "var".
|
|
105
|
+
;; The type-binding.constructor anchor fires when the rhs is an
|
|
106
|
+
;; object_creation_expression so interpretJavaTypeBinding can infer
|
|
107
|
+
;; the concrete type from the constructor call.
|
|
108
|
+
(local_variable_declaration
|
|
109
|
+
type: (type_identifier) @_var_type
|
|
110
|
+
declarator: (variable_declarator
|
|
111
|
+
name: (identifier) @type-binding.name
|
|
112
|
+
value: (object_creation_expression
|
|
113
|
+
type: (type_identifier) @type-binding.type))) @type-binding.constructor
|
|
114
|
+
|
|
115
|
+
;; Type bindings — field declarations: private User user;
|
|
116
|
+
(field_declaration
|
|
117
|
+
type: (type_identifier) @type-binding.type
|
|
118
|
+
declarator: (variable_declarator
|
|
119
|
+
name: (identifier) @type-binding.name)) @type-binding.annotation
|
|
120
|
+
|
|
121
|
+
(field_declaration
|
|
122
|
+
type: (generic_type) @type-binding.type
|
|
123
|
+
declarator: (variable_declarator
|
|
124
|
+
name: (identifier) @type-binding.name)) @type-binding.annotation
|
|
125
|
+
|
|
126
|
+
;; Type bindings — method return type: public User getUser() { }
|
|
127
|
+
(method_declaration
|
|
128
|
+
type: (type_identifier) @type-binding.type
|
|
129
|
+
name: (identifier) @type-binding.name) @type-binding.return
|
|
130
|
+
|
|
131
|
+
(method_declaration
|
|
132
|
+
type: (generic_type) @type-binding.type
|
|
133
|
+
name: (identifier) @type-binding.name) @type-binding.return
|
|
134
|
+
|
|
135
|
+
;; Type bindings — enhanced for: for (User u : list)
|
|
136
|
+
(enhanced_for_statement
|
|
137
|
+
type: (type_identifier) @type-binding.type
|
|
138
|
+
name: (identifier) @type-binding.name) @type-binding.annotation
|
|
139
|
+
|
|
140
|
+
(enhanced_for_statement
|
|
141
|
+
type: (generic_type) @type-binding.type
|
|
142
|
+
name: (identifier) @type-binding.name) @type-binding.annotation
|
|
143
|
+
|
|
144
|
+
;; References — all method calls: foo() and obj.method()
|
|
145
|
+
;; tree-sitter-java's query engine drops negation-based \`!object\`
|
|
146
|
+
;; patterns when a positive \`object:\` pattern exists for the same
|
|
147
|
+
;; node type, so we match all calls here and classify free vs
|
|
148
|
+
;; member in captures.ts based on the presence of @reference.receiver.
|
|
149
|
+
(method_invocation
|
|
150
|
+
object: (_) @reference.receiver
|
|
151
|
+
name: (identifier) @reference.name) @reference.call.member
|
|
152
|
+
|
|
153
|
+
(method_invocation
|
|
154
|
+
name: (identifier) @reference.name) @reference.call.free
|
|
155
|
+
|
|
156
|
+
;; References — constructor calls: new User(...)
|
|
157
|
+
(object_creation_expression
|
|
158
|
+
type: (type_identifier) @reference.name) @reference.call.constructor
|
|
159
|
+
|
|
160
|
+
(object_creation_expression
|
|
161
|
+
type: (generic_type
|
|
162
|
+
(type_identifier) @reference.name)) @reference.call.constructor
|
|
163
|
+
|
|
164
|
+
(object_creation_expression
|
|
165
|
+
type: (scoped_type_identifier) @reference.call.constructor.qualified) @reference.call.constructor
|
|
166
|
+
|
|
167
|
+
;; References — field/property writes: obj.name = "x"
|
|
168
|
+
(assignment_expression
|
|
169
|
+
left: (field_access
|
|
170
|
+
object: (_) @reference.receiver
|
|
171
|
+
field: (identifier) @reference.name)) @reference.write.member
|
|
172
|
+
|
|
173
|
+
;; References — field/property reads: obj.name
|
|
174
|
+
(field_access
|
|
175
|
+
object: (_) @reference.receiver
|
|
176
|
+
field: (identifier) @reference.name) @reference.read.member
|
|
177
|
+
`;
|
|
178
|
+
let _parser = null;
|
|
179
|
+
let _query = null;
|
|
180
|
+
export function getJavaParser() {
|
|
181
|
+
if (_parser === null) {
|
|
182
|
+
_parser = new Parser();
|
|
183
|
+
_parser.setLanguage(Java);
|
|
184
|
+
}
|
|
185
|
+
return _parser;
|
|
186
|
+
}
|
|
187
|
+
export function getJavaScopeQuery() {
|
|
188
|
+
if (_query === null) {
|
|
189
|
+
_query = new Parser.Query(Java, JAVA_SCOPE_QUERY);
|
|
190
|
+
}
|
|
191
|
+
return _query;
|
|
192
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthesize `@type-binding.self` captures for Java instance methods —
|
|
3
|
+
* one for `this` (always on non-static methods inside a type
|
|
4
|
+
* declaration) and optionally one for `super` (only on class methods
|
|
5
|
+
* when the enclosing class has a `superclass`).
|
|
6
|
+
*
|
|
7
|
+
* Mirrors `languages/csharp/receiver-binding.ts` in structure.
|
|
8
|
+
*/
|
|
9
|
+
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
10
|
+
import { type SyntaxNode } from '../../utils/ast-helpers.js';
|
|
11
|
+
export declare function synthesizeJavaReceiverBinding(fnNode: SyntaxNode): CaptureMatch[];
|