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
|
@@ -37,6 +37,7 @@ import { createCallExtractor } from '../call-extractors/generic.js';
|
|
|
37
37
|
import { cCallConfig, cppCallConfig } from '../call-extractors/configs/c-cpp.js';
|
|
38
38
|
import { createHeritageExtractor } from '../heritage-extractors/generic.js';
|
|
39
39
|
import { stripUeMacros } from '../cpp-ue-preprocessor.js';
|
|
40
|
+
import { emitCScopeCaptures, interpretCImport, interpretCTypeBinding, cArityCompatibility, cBindingScopeFor, cImportOwningScope, cReceiverBinding, } from './c/index.js';
|
|
40
41
|
const C_BUILT_INS = new Set([
|
|
41
42
|
'printf',
|
|
42
43
|
'fprintf',
|
|
@@ -338,6 +339,15 @@ export const cProvider = defineLanguage({
|
|
|
338
339
|
heritageExtractor: createHeritageExtractor(SupportedLanguages.C),
|
|
339
340
|
labelOverride: cppLabelOverride,
|
|
340
341
|
builtInNames: C_BUILT_INS,
|
|
342
|
+
// ── RFC #909 Ring 3: scope-based resolution hooks (RFC §5) ──────────
|
|
343
|
+
emitScopeCaptures: emitCScopeCaptures,
|
|
344
|
+
interpretImport: interpretCImport,
|
|
345
|
+
interpretTypeBinding: interpretCTypeBinding,
|
|
346
|
+
bindingScopeFor: cBindingScopeFor,
|
|
347
|
+
importOwningScope: cImportOwningScope,
|
|
348
|
+
receiverBinding: cReceiverBinding,
|
|
349
|
+
arityCompatibility: cArityCompatibility,
|
|
350
|
+
// mergeBindings + resolveImportTarget live on ScopeResolver (see c/scope-resolver.ts).
|
|
341
351
|
});
|
|
342
352
|
export const cppProvider = defineLanguage({
|
|
343
353
|
id: SupportedLanguages.CPlusPlus,
|
|
@@ -22,6 +22,7 @@ import { synthesizeCsharpReceiverBinding } from './receiver-binding.js';
|
|
|
22
22
|
import { getCsharpParser, getCsharpScopeQuery } from './query.js';
|
|
23
23
|
import { recordCacheHit, recordCacheMiss } from './cache-stats.js';
|
|
24
24
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
25
|
+
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
25
26
|
/** Declaration anchors that carry function-like arity metadata. */
|
|
26
27
|
const FUNCTION_DECL_TAGS = [
|
|
27
28
|
'@declaration.method',
|
|
@@ -75,7 +76,7 @@ export function emitCsharpScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
|
75
76
|
// the LanguageProvider contract layer; cast here at the use site.
|
|
76
77
|
let tree = cachedTree;
|
|
77
78
|
if (tree === undefined) {
|
|
78
|
-
tree = getCsharpParser()
|
|
79
|
+
tree = parseSourceSafe(getCsharpParser(), sourceText, undefined, {
|
|
79
80
|
bufferSize: getTreeSitterBufferSize(sourceText),
|
|
80
81
|
});
|
|
81
82
|
recordCacheMiss();
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import { getCsharpParser } from './query.js';
|
|
34
34
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
35
|
+
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
35
36
|
/** Build a structural view of a C# file by walking the tree-sitter
|
|
36
37
|
* AST. Prefers `cachedTree` (handed in via `treeCache`) so we don't
|
|
37
38
|
* re-parse files the orchestrator already parsed for `extractParsedFile`;
|
|
@@ -39,7 +40,7 @@ import { getTreeSitterBufferSize } from '../../constants.js';
|
|
|
39
40
|
* shared across calls. */
|
|
40
41
|
function extractFileStructure(content, cachedTree) {
|
|
41
42
|
const tree = cachedTree ??
|
|
42
|
-
getCsharpParser()
|
|
43
|
+
parseSourceSafe(getCsharpParser(), content, undefined, {
|
|
43
44
|
bufferSize: getTreeSitterBufferSize(content),
|
|
44
45
|
});
|
|
45
46
|
const namespaces = [];
|
|
@@ -332,7 +333,7 @@ export function populateCsharpNamespaceSiblings(parsedFiles, indexes, inputs) {
|
|
|
332
333
|
const key = q.includes('.') ? q.slice(q.lastIndexOf('.') + 1) : q;
|
|
333
334
|
if (key === '')
|
|
334
335
|
continue;
|
|
335
|
-
const arr = defsByName.get(key) ?? [];
|
|
336
|
+
const arr = [...(defsByName.get(key) ?? [])];
|
|
336
337
|
arr.push(def);
|
|
337
338
|
defsByName.set(key, arr);
|
|
338
339
|
}
|
|
@@ -6,10 +6,11 @@ import { splitGoImportStatement } from './import-decomposer.js';
|
|
|
6
6
|
import { synthesizeGoReceiverBinding } from './receiver-binding.js';
|
|
7
7
|
import { synthesizeGoTypeBindings } from './type-binding.js';
|
|
8
8
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
9
|
+
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
9
10
|
export function emitGoScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
10
11
|
let tree = cachedTree;
|
|
11
12
|
if (tree === undefined) {
|
|
12
|
-
tree = getGoParser()
|
|
13
|
+
tree = parseSourceSafe(getGoParser(), sourceText, undefined, {
|
|
13
14
|
bufferSize: getTreeSitterBufferSize(sourceText),
|
|
14
15
|
});
|
|
15
16
|
recordGoCacheMiss();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getGoParser } from './query.js';
|
|
2
2
|
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
3
|
+
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
3
4
|
export function populateGoRangeBindings(parsedFiles, _indexes, ctx) {
|
|
4
5
|
const parser = getGoParser();
|
|
5
6
|
for (const parsed of parsedFiles) {
|
|
@@ -8,7 +9,7 @@ export function populateGoRangeBindings(parsedFiles, _indexes, ctx) {
|
|
|
8
9
|
continue;
|
|
9
10
|
const cachedTree = ctx.treeCache?.get(parsed.filePath);
|
|
10
11
|
const tree = cachedTree ??
|
|
11
|
-
parser
|
|
12
|
+
parseSourceSafe(parser, sourceText, undefined, {
|
|
12
13
|
bufferSize: getTreeSitterBufferSize(sourceText),
|
|
13
14
|
});
|
|
14
15
|
const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract Java arity metadata from a method-like tree-sitter node —
|
|
3
|
+
* `method_declaration` or `constructor_declaration`.
|
|
4
|
+
*
|
|
5
|
+
* Reuses `javaMethodConfig.extractParameters` so scope-extracted defs
|
|
6
|
+
* carry the same arity semantics as the legacy parse-worker path:
|
|
7
|
+
* - varargs (`...`) collapses `parameterCount` to `undefined`
|
|
8
|
+
* - `parameterTypes` collects declared type names; a literal
|
|
9
|
+
* `'varargs'` marker is appended for variadic methods so
|
|
10
|
+
* `javaArityCompatibility` can detect them.
|
|
11
|
+
*/
|
|
12
|
+
import type { SyntaxNode } from '../../utils/ast-helpers.js';
|
|
13
|
+
export interface JavaArityMetadata {
|
|
14
|
+
readonly parameterCount: number | undefined;
|
|
15
|
+
readonly requiredParameterCount: number | undefined;
|
|
16
|
+
readonly parameterTypes: readonly string[] | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function computeJavaArityMetadata(fnNode: SyntaxNode): JavaArityMetadata;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract Java arity metadata from a method-like tree-sitter node —
|
|
3
|
+
* `method_declaration` or `constructor_declaration`.
|
|
4
|
+
*
|
|
5
|
+
* Reuses `javaMethodConfig.extractParameters` so scope-extracted defs
|
|
6
|
+
* carry the same arity semantics as the legacy parse-worker path:
|
|
7
|
+
* - varargs (`...`) collapses `parameterCount` to `undefined`
|
|
8
|
+
* - `parameterTypes` collects declared type names; a literal
|
|
9
|
+
* `'varargs'` marker is appended for variadic methods so
|
|
10
|
+
* `javaArityCompatibility` can detect them.
|
|
11
|
+
*/
|
|
12
|
+
import { javaMethodConfig } from '../../method-extractors/configs/jvm.js';
|
|
13
|
+
export function computeJavaArityMetadata(fnNode) {
|
|
14
|
+
const params = javaMethodConfig.extractParameters?.(fnNode) ?? [];
|
|
15
|
+
let hasVariadic = false;
|
|
16
|
+
const types = [];
|
|
17
|
+
for (const p of params) {
|
|
18
|
+
if (p.isVariadic)
|
|
19
|
+
hasVariadic = true;
|
|
20
|
+
if (p.type !== null)
|
|
21
|
+
types.push(p.type);
|
|
22
|
+
}
|
|
23
|
+
if (hasVariadic)
|
|
24
|
+
types.push('varargs');
|
|
25
|
+
const total = params.length;
|
|
26
|
+
// For varargs methods, `parameterCount` (max) is unknown — any number of
|
|
27
|
+
// trailing arguments is valid. But the fixed-prefix parameters (everything
|
|
28
|
+
// before the variadic `...` param) are still required, so we preserve that
|
|
29
|
+
// count in `requiredParameterCount` so `javaArityCompatibility` can reject
|
|
30
|
+
// calls that undersupply the fixed prefix (e.g. `f(int x, String... args)`
|
|
31
|
+
// called with 0 args).
|
|
32
|
+
const fixedCount = params.filter((p) => !p.isVariadic).length;
|
|
33
|
+
const parameterCount = hasVariadic ? undefined : total;
|
|
34
|
+
const requiredParameterCount = hasVariadic ? fixedCount : total;
|
|
35
|
+
return {
|
|
36
|
+
parameterCount,
|
|
37
|
+
requiredParameterCount,
|
|
38
|
+
parameterTypes: types.length > 0 ? types : undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java arity check, accommodating varargs (`...`).
|
|
3
|
+
*
|
|
4
|
+
* Verdicts:
|
|
5
|
+
* - `'compatible'` — argCount matches parameterCount, OR varargs present.
|
|
6
|
+
* - `'incompatible'` — argCount mismatches with no varargs.
|
|
7
|
+
* - `'unknown'` — metadata absent / incomplete.
|
|
8
|
+
*/
|
|
9
|
+
import type { Callsite, SymbolDefinition } from '../../../../_shared/index.js';
|
|
10
|
+
export declare function javaArityCompatibility(def: SymbolDefinition, callsite: Callsite): 'compatible' | 'unknown' | 'incompatible';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Java arity check, accommodating varargs (`...`).
|
|
3
|
+
*
|
|
4
|
+
* Verdicts:
|
|
5
|
+
* - `'compatible'` — argCount matches parameterCount, OR varargs present.
|
|
6
|
+
* - `'incompatible'` — argCount mismatches with no varargs.
|
|
7
|
+
* - `'unknown'` — metadata absent / incomplete.
|
|
8
|
+
*/
|
|
9
|
+
export function javaArityCompatibility(def, callsite) {
|
|
10
|
+
const max = def.parameterCount;
|
|
11
|
+
const min = def.requiredParameterCount;
|
|
12
|
+
if (max === undefined && min === undefined)
|
|
13
|
+
return 'unknown';
|
|
14
|
+
const argCount = callsite.arity;
|
|
15
|
+
if (!Number.isFinite(argCount) || argCount < 0)
|
|
16
|
+
return 'unknown';
|
|
17
|
+
const hasVarArgs = def.parameterTypes !== undefined &&
|
|
18
|
+
def.parameterTypes.some((t) => t === 'varargs' || t.includes('...'));
|
|
19
|
+
if (min !== undefined && argCount < min)
|
|
20
|
+
return 'incompatible';
|
|
21
|
+
if (max !== undefined && argCount > max && !hasVarArgs)
|
|
22
|
+
return 'incompatible';
|
|
23
|
+
return 'compatible';
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-mode counters for the cross-phase scope-captures parse cache
|
|
3
|
+
* (Java mirror of `languages/csharp/cache-stats.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Gated by `PROF_SCOPE_RESOLUTION=1`. Production builds fold every
|
|
6
|
+
* increment into dead code via the module-level `PROF` constant, so
|
|
7
|
+
* the hot path in `captures.ts` stays branch-free.
|
|
8
|
+
*/
|
|
9
|
+
export declare function recordCacheHit(): void;
|
|
10
|
+
export declare function recordCacheMiss(): void;
|
|
11
|
+
export declare function getJavaCaptureCacheStats(): {
|
|
12
|
+
hits: number;
|
|
13
|
+
misses: number;
|
|
14
|
+
};
|
|
15
|
+
export declare function resetJavaCaptureCacheStats(): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-mode counters for the cross-phase scope-captures parse cache
|
|
3
|
+
* (Java mirror of `languages/csharp/cache-stats.ts`).
|
|
4
|
+
*
|
|
5
|
+
* Gated by `PROF_SCOPE_RESOLUTION=1`. Production builds fold every
|
|
6
|
+
* increment into dead code via the module-level `PROF` constant, so
|
|
7
|
+
* the hot path in `captures.ts` stays branch-free.
|
|
8
|
+
*/
|
|
9
|
+
const PROF = process.env.PROF_SCOPE_RESOLUTION === '1';
|
|
10
|
+
let CACHE_HITS = 0;
|
|
11
|
+
let CACHE_MISSES = 0;
|
|
12
|
+
export function recordCacheHit() {
|
|
13
|
+
if (PROF)
|
|
14
|
+
CACHE_HITS++;
|
|
15
|
+
}
|
|
16
|
+
export function recordCacheMiss() {
|
|
17
|
+
if (PROF)
|
|
18
|
+
CACHE_MISSES++;
|
|
19
|
+
}
|
|
20
|
+
export function getJavaCaptureCacheStats() {
|
|
21
|
+
return { hits: CACHE_HITS, misses: CACHE_MISSES };
|
|
22
|
+
}
|
|
23
|
+
export function resetJavaCaptureCacheStats() {
|
|
24
|
+
CACHE_HITS = 0;
|
|
25
|
+
CACHE_MISSES = 0;
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `emitScopeCaptures` for Java.
|
|
3
|
+
*
|
|
4
|
+
* Drives the Java scope query against tree-sitter-java and groups raw
|
|
5
|
+
* matches into `CaptureMatch[]` for the central extractor. Layers:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Decomposed import declarations** — each `import_declaration`
|
|
8
|
+
* is re-emitted with `@import.kind/source/name` markers.
|
|
9
|
+
* 2. **Receiver binding synthesis** — `this`/`super` type-bindings
|
|
10
|
+
* on instance methods.
|
|
11
|
+
* 3. **Arity metadata** on method/constructor declarations.
|
|
12
|
+
* 4. **Reference arity** on call sites.
|
|
13
|
+
*
|
|
14
|
+
* Pure given the input source text. No I/O, no globals consulted.
|
|
15
|
+
*/
|
|
16
|
+
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
17
|
+
export declare function emitJavaScopeCaptures(sourceText: string, _filePath: string, cachedTree?: unknown): readonly CaptureMatch[];
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `emitScopeCaptures` for Java.
|
|
3
|
+
*
|
|
4
|
+
* Drives the Java scope query against tree-sitter-java and groups raw
|
|
5
|
+
* matches into `CaptureMatch[]` for the central extractor. Layers:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Decomposed import declarations** — each `import_declaration`
|
|
8
|
+
* is re-emitted with `@import.kind/source/name` markers.
|
|
9
|
+
* 2. **Receiver binding synthesis** — `this`/`super` type-bindings
|
|
10
|
+
* on instance methods.
|
|
11
|
+
* 3. **Arity metadata** on method/constructor declarations.
|
|
12
|
+
* 4. **Reference arity** on call sites.
|
|
13
|
+
*
|
|
14
|
+
* Pure given the input source text. No I/O, no globals consulted.
|
|
15
|
+
*/
|
|
16
|
+
import { findNodeAtRange, nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
|
|
17
|
+
import { splitImportDeclaration } from './import-decomposer.js';
|
|
18
|
+
import { computeJavaArityMetadata } from './arity-metadata.js';
|
|
19
|
+
import { synthesizeJavaReceiverBinding } from './receiver-binding.js';
|
|
20
|
+
import { getJavaParser, getJavaScopeQuery } from './query.js';
|
|
21
|
+
import { recordCacheHit, recordCacheMiss } from './cache-stats.js';
|
|
22
|
+
import { getTreeSitterBufferSize } from '../../constants.js';
|
|
23
|
+
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';
|
|
24
|
+
/** Declaration anchors that carry function-like arity metadata. */
|
|
25
|
+
const FUNCTION_DECL_TAGS = ['@declaration.method', '@declaration.constructor'];
|
|
26
|
+
/** tree-sitter-java node types that the method extractor accepts. */
|
|
27
|
+
const FUNCTION_NODE_TYPES = ['method_declaration', 'constructor_declaration'];
|
|
28
|
+
/** Suppress read.member emissions when the field_access is already
|
|
29
|
+
* covered by a method_invocation (object of a call) or an
|
|
30
|
+
* assignment_expression (write target). */
|
|
31
|
+
function shouldEmitReadMember(memberNode) {
|
|
32
|
+
const parent = memberNode.parent;
|
|
33
|
+
if (parent === null)
|
|
34
|
+
return true;
|
|
35
|
+
switch (parent.type) {
|
|
36
|
+
case 'method_invocation':
|
|
37
|
+
// Don't emit read.member when the field_access is the object of a method_invocation
|
|
38
|
+
// (the method call already handles this relationship)
|
|
39
|
+
return parent.childForFieldName('object')?.id !== memberNode.id;
|
|
40
|
+
case 'assignment_expression':
|
|
41
|
+
return parent.childForFieldName('left')?.id !== memberNode.id;
|
|
42
|
+
default:
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function emitJavaScopeCaptures(sourceText, _filePath, cachedTree) {
|
|
47
|
+
let tree = cachedTree;
|
|
48
|
+
if (tree === undefined) {
|
|
49
|
+
tree = parseSourceSafe(getJavaParser(), sourceText, undefined, {
|
|
50
|
+
bufferSize: getTreeSitterBufferSize(sourceText),
|
|
51
|
+
});
|
|
52
|
+
recordCacheMiss();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
recordCacheHit();
|
|
56
|
+
}
|
|
57
|
+
const rawMatches = getJavaScopeQuery().matches(tree.rootNode);
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const m of rawMatches) {
|
|
60
|
+
const grouped = {};
|
|
61
|
+
for (const c of m.captures) {
|
|
62
|
+
const tag = '@' + c.name;
|
|
63
|
+
grouped[tag] = nodeToCapture(tag, c.node);
|
|
64
|
+
}
|
|
65
|
+
if (Object.keys(grouped).length === 0)
|
|
66
|
+
continue;
|
|
67
|
+
// Decompose each `import_declaration`.
|
|
68
|
+
if (grouped['@import.statement'] !== undefined) {
|
|
69
|
+
const stmtCapture = grouped['@import.statement'];
|
|
70
|
+
const stmtNode = findNodeAtRange(tree.rootNode, stmtCapture.range, 'import_declaration');
|
|
71
|
+
if (stmtNode !== null) {
|
|
72
|
+
const decomposed = splitImportDeclaration(stmtNode);
|
|
73
|
+
if (decomposed !== null) {
|
|
74
|
+
out.push(decomposed);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
out.push(grouped);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Skip free-call matches that are actually member calls. The query
|
|
82
|
+
// matches ALL method_invocations as @reference.call.free (without
|
|
83
|
+
// negation) because tree-sitter-java's query engine drops !object
|
|
84
|
+
// patterns when a positive object: pattern exists for the same node
|
|
85
|
+
// type. Filter here: if the match has @reference.call.free but also
|
|
86
|
+
// has @reference.receiver, it's a member call — skip the free match
|
|
87
|
+
// (the separate @reference.call.member match covers it).
|
|
88
|
+
if (grouped['@reference.call.free'] !== undefined &&
|
|
89
|
+
grouped['@reference.receiver'] !== undefined) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
// Filter read.member when it's a child of method_invocation or assignment.
|
|
93
|
+
if (grouped['@reference.read.member'] !== undefined) {
|
|
94
|
+
const anchor = grouped['@reference.read.member'];
|
|
95
|
+
const memberNode = findNodeAtRange(tree.rootNode, anchor.range, 'field_access');
|
|
96
|
+
if (memberNode === null || !shouldEmitReadMember(memberNode)) {
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Synthesize `this` / `super` receiver type-bindings on every
|
|
101
|
+
// instance method-like.
|
|
102
|
+
if (grouped['@scope.function'] !== undefined) {
|
|
103
|
+
out.push(grouped);
|
|
104
|
+
const anchor = grouped['@scope.function'];
|
|
105
|
+
const fnNode = findFunctionNode(tree.rootNode, anchor.range);
|
|
106
|
+
if (fnNode !== null) {
|
|
107
|
+
for (const synth of synthesizeJavaReceiverBinding(fnNode)) {
|
|
108
|
+
out.push(synth);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
// Synthesize arity metadata on function-like declarations.
|
|
114
|
+
const declTag = FUNCTION_DECL_TAGS.find((t) => grouped[t] !== undefined);
|
|
115
|
+
if (declTag !== undefined) {
|
|
116
|
+
const anchor = grouped[declTag];
|
|
117
|
+
const fnNode = findFunctionNode(tree.rootNode, anchor.range);
|
|
118
|
+
if (fnNode !== null) {
|
|
119
|
+
const arity = computeJavaArityMetadata(fnNode);
|
|
120
|
+
if (arity.parameterCount !== undefined) {
|
|
121
|
+
grouped['@declaration.parameter-count'] = syntheticCapture('@declaration.parameter-count', fnNode, String(arity.parameterCount));
|
|
122
|
+
}
|
|
123
|
+
if (arity.requiredParameterCount !== undefined) {
|
|
124
|
+
grouped['@declaration.required-parameter-count'] = syntheticCapture('@declaration.required-parameter-count', fnNode, String(arity.requiredParameterCount));
|
|
125
|
+
}
|
|
126
|
+
if (arity.parameterTypes !== undefined) {
|
|
127
|
+
grouped['@declaration.parameter-types'] = syntheticCapture('@declaration.parameter-types', fnNode, JSON.stringify(arity.parameterTypes));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Synthesize `@reference.arity` on every callsite.
|
|
132
|
+
const callTag = ['@reference.call.free', '@reference.call.member', '@reference.call.constructor'].find((t) => grouped[t] !== undefined);
|
|
133
|
+
if (callTag !== undefined && grouped['@reference.arity'] === undefined) {
|
|
134
|
+
const anchor = grouped[callTag];
|
|
135
|
+
const callNode = findNodeAtRange(tree.rootNode, anchor.range, 'method_invocation') ??
|
|
136
|
+
findNodeAtRange(tree.rootNode, anchor.range, 'object_creation_expression');
|
|
137
|
+
if (callNode !== null) {
|
|
138
|
+
const argList = callNode.childForFieldName('arguments');
|
|
139
|
+
const args = argList === null
|
|
140
|
+
? []
|
|
141
|
+
: argList.namedChildren.filter((c) => c !== null && c.type !== 'comment');
|
|
142
|
+
grouped['@reference.arity'] = syntheticCapture('@reference.arity', callNode, String(args.length));
|
|
143
|
+
const argTypes = args.map((arg) => inferArgType(arg));
|
|
144
|
+
grouped['@reference.parameter-types'] = syntheticCapture('@reference.parameter-types', callNode, JSON.stringify(argTypes));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
out.push(grouped);
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
/** Infer a Java argument's static type from literal patterns. */
|
|
152
|
+
function inferArgType(argNode) {
|
|
153
|
+
switch (argNode.type) {
|
|
154
|
+
case 'decimal_integer_literal':
|
|
155
|
+
case 'hex_integer_literal':
|
|
156
|
+
case 'octal_integer_literal':
|
|
157
|
+
case 'binary_integer_literal':
|
|
158
|
+
return 'int';
|
|
159
|
+
case 'decimal_floating_point_literal':
|
|
160
|
+
case 'hex_floating_point_literal':
|
|
161
|
+
return 'double';
|
|
162
|
+
case 'string_literal':
|
|
163
|
+
return 'String';
|
|
164
|
+
case 'character_literal':
|
|
165
|
+
return 'char';
|
|
166
|
+
case 'true':
|
|
167
|
+
case 'false':
|
|
168
|
+
return 'boolean';
|
|
169
|
+
case 'null_literal':
|
|
170
|
+
return 'null';
|
|
171
|
+
case 'object_creation_expression': {
|
|
172
|
+
const typeNode = argNode.childForFieldName('type');
|
|
173
|
+
return typeNode?.text ?? '';
|
|
174
|
+
}
|
|
175
|
+
default:
|
|
176
|
+
return '';
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** Find the first Java function-like node at the given range. */
|
|
180
|
+
function findFunctionNode(rootNode, range) {
|
|
181
|
+
for (const nodeType of FUNCTION_NODE_TYPES) {
|
|
182
|
+
const n = findNodeAtRange(rootNode, range, nodeType);
|
|
183
|
+
if (n !== null)
|
|
184
|
+
return n;
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decompose a Java `import_declaration` into a `CaptureMatch` carrying
|
|
3
|
+
* the synthesized markers `@import.kind` / `@import.source` /
|
|
4
|
+
* `@import.name` that `interpretJavaImport` consumes.
|
|
5
|
+
*
|
|
6
|
+
* Unlike C#'s using-directive decomposer, Java has four import forms:
|
|
7
|
+
*
|
|
8
|
+
* import com.example.User; → named
|
|
9
|
+
* import com.example.*; → wildcard
|
|
10
|
+
* import static com.example.Utils.format; → static
|
|
11
|
+
* import static com.example.Utils.*; → static-wildcard
|
|
12
|
+
*
|
|
13
|
+
* Each produces exactly one import. The decomposer inspects the raw
|
|
14
|
+
* source text and tree-sitter children to determine the flavor.
|
|
15
|
+
*/
|
|
16
|
+
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
17
|
+
import { type SyntaxNode } from '../../utils/ast-helpers.js';
|
|
18
|
+
export declare function splitImportDeclaration(stmtNode: SyntaxNode): CaptureMatch | null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decompose a Java `import_declaration` into a `CaptureMatch` carrying
|
|
3
|
+
* the synthesized markers `@import.kind` / `@import.source` /
|
|
4
|
+
* `@import.name` that `interpretJavaImport` consumes.
|
|
5
|
+
*
|
|
6
|
+
* Unlike C#'s using-directive decomposer, Java has four import forms:
|
|
7
|
+
*
|
|
8
|
+
* import com.example.User; → named
|
|
9
|
+
* import com.example.*; → wildcard
|
|
10
|
+
* import static com.example.Utils.format; → static
|
|
11
|
+
* import static com.example.Utils.*; → static-wildcard
|
|
12
|
+
*
|
|
13
|
+
* Each produces exactly one import. The decomposer inspects the raw
|
|
14
|
+
* source text and tree-sitter children to determine the flavor.
|
|
15
|
+
*/
|
|
16
|
+
import { nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
|
|
17
|
+
export function splitImportDeclaration(stmtNode) {
|
|
18
|
+
if (stmtNode.type !== 'import_declaration')
|
|
19
|
+
return null;
|
|
20
|
+
const spec = parseImportDeclaration(stmtNode);
|
|
21
|
+
if (spec === null)
|
|
22
|
+
return null;
|
|
23
|
+
return buildImportMatch(stmtNode, spec);
|
|
24
|
+
}
|
|
25
|
+
function parseImportDeclaration(node) {
|
|
26
|
+
// Detect `static` by checking for an anonymous `static` token child.
|
|
27
|
+
let isStatic = false;
|
|
28
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
29
|
+
const child = node.child(i);
|
|
30
|
+
if (child !== null && child.type === 'static') {
|
|
31
|
+
isStatic = true;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Detect wildcard by checking for `asterisk` named child.
|
|
36
|
+
let isWildcard = false;
|
|
37
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
38
|
+
const child = node.namedChild(i);
|
|
39
|
+
if (child !== null && child.type === 'asterisk') {
|
|
40
|
+
isWildcard = true;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Find the scoped_identifier (or identifier for single-segment imports).
|
|
45
|
+
let pathNode = null;
|
|
46
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
47
|
+
const child = node.namedChild(i);
|
|
48
|
+
if (child !== null && (child.type === 'scoped_identifier' || child.type === 'identifier')) {
|
|
49
|
+
pathNode = child;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (pathNode === null)
|
|
54
|
+
return null;
|
|
55
|
+
const fullPath = pathNode.text;
|
|
56
|
+
if (fullPath === '')
|
|
57
|
+
return null;
|
|
58
|
+
if (isStatic && isWildcard) {
|
|
59
|
+
// `import static com.example.Utils.*;`
|
|
60
|
+
return { kind: 'static-wildcard', source: fullPath, name: '*', atNode: node };
|
|
61
|
+
}
|
|
62
|
+
if (isStatic) {
|
|
63
|
+
// `import static com.example.Utils.format;`
|
|
64
|
+
const lastDot = fullPath.lastIndexOf('.');
|
|
65
|
+
const name = lastDot >= 0 ? fullPath.slice(lastDot + 1) : fullPath;
|
|
66
|
+
return { kind: 'static', source: fullPath, name, atNode: node };
|
|
67
|
+
}
|
|
68
|
+
if (isWildcard) {
|
|
69
|
+
// `import com.example.*;`
|
|
70
|
+
return { kind: 'wildcard', source: fullPath, name: '*', atNode: node };
|
|
71
|
+
}
|
|
72
|
+
// `import com.example.User;`
|
|
73
|
+
const lastDot = fullPath.lastIndexOf('.');
|
|
74
|
+
const name = lastDot >= 0 ? fullPath.slice(lastDot + 1) : fullPath;
|
|
75
|
+
return { kind: 'named', source: fullPath, name, atNode: node };
|
|
76
|
+
}
|
|
77
|
+
function buildImportMatch(stmtNode, spec) {
|
|
78
|
+
const m = {
|
|
79
|
+
'@import.statement': nodeToCapture('@import.statement', stmtNode),
|
|
80
|
+
'@import.kind': syntheticCapture('@import.kind', spec.atNode, spec.kind),
|
|
81
|
+
'@import.source': syntheticCapture('@import.source', spec.atNode, spec.source),
|
|
82
|
+
'@import.name': syntheticCapture('@import.name', spec.atNode, spec.name),
|
|
83
|
+
};
|
|
84
|
+
return m;
|
|
85
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import type { ParsedImport, WorkspaceIndex } from '../../../../_shared/index.js';
|
|
13
|
+
export interface JavaResolveContext {
|
|
14
|
+
readonly fromFile: string;
|
|
15
|
+
readonly allFilePaths: ReadonlySet<string>;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveJavaImportTarget(parsedImport: ParsedImport, workspaceIndex: WorkspaceIndex): string | null;
|