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,55 @@
|
|
|
1
|
+
import { readdirSync } from 'fs';
|
|
2
|
+
import { join, relative } from 'path';
|
|
3
|
+
/** C header extensions to scan for in the workspace. */
|
|
4
|
+
const HEADER_EXTENSIONS = new Set(['.h']);
|
|
5
|
+
/**
|
|
6
|
+
* Walk `repoPath` recursively and return relative paths of all `.h` files.
|
|
7
|
+
* Used by `loadResolutionConfig` so the C resolver can resolve `#include`
|
|
8
|
+
* targets that live in `.h` files (classified as C++ by language detection
|
|
9
|
+
* but importable from `.c` files).
|
|
10
|
+
*/
|
|
11
|
+
export function scanHeaderFiles(repoPath) {
|
|
12
|
+
const headers = new Set();
|
|
13
|
+
walk(repoPath, repoPath, headers);
|
|
14
|
+
return headers;
|
|
15
|
+
}
|
|
16
|
+
function walk(dir, root, out) {
|
|
17
|
+
let entries;
|
|
18
|
+
try {
|
|
19
|
+
entries = readdirSync(dir, { withFileTypes: true, encoding: 'utf8' });
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return; // permission denied, etc.
|
|
23
|
+
}
|
|
24
|
+
for (const entry of entries) {
|
|
25
|
+
const name = entry.name;
|
|
26
|
+
const full = join(dir, name);
|
|
27
|
+
if (entry.isDirectory()) {
|
|
28
|
+
// Skip common non-source directories and build output dirs.
|
|
29
|
+
// Build dirs (dist, build, out, target, _build, .next, cmake-build-*)
|
|
30
|
+
// may contain generated headers that shadow source headers.
|
|
31
|
+
if (name === 'node_modules' ||
|
|
32
|
+
name === '.git' ||
|
|
33
|
+
name === 'vendor' ||
|
|
34
|
+
name === 'dist' ||
|
|
35
|
+
name === 'build' ||
|
|
36
|
+
name === 'out' ||
|
|
37
|
+
name === 'target' ||
|
|
38
|
+
name === '_build' ||
|
|
39
|
+
name === '.next' ||
|
|
40
|
+
name.startsWith('cmake-build')) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
walk(full, root, out);
|
|
44
|
+
}
|
|
45
|
+
else if (entry.isFile()) {
|
|
46
|
+
const ext = name.slice(name.lastIndexOf('.'));
|
|
47
|
+
if (HEADER_EXTENSIONS.has(ext)) {
|
|
48
|
+
// Normalize to forward slashes for cross-platform consistency.
|
|
49
|
+
// path.relative() returns backslash-separated paths on Windows,
|
|
50
|
+
// but the scope-resolution pipeline uses forward slashes uniformly.
|
|
51
|
+
out.add(relative(root, full).replace(/\\/g, '/'));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CaptureMatch } from '../../../../_shared/index.js';
|
|
2
|
+
import { type SyntaxNode } from '../../utils/ast-helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Decompose a `preproc_include` node into a CaptureMatch with structured
|
|
5
|
+
* import captures. C #include maps to a wildcard import (all symbols
|
|
6
|
+
* from the header are visible).
|
|
7
|
+
*/
|
|
8
|
+
export declare function splitCInclude(node: SyntaxNode): CaptureMatch | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { nodeToCapture, syntheticCapture } from '../../utils/ast-helpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* Decompose a `preproc_include` node into a CaptureMatch with structured
|
|
4
|
+
* import captures. C #include maps to a wildcard import (all symbols
|
|
5
|
+
* from the header are visible).
|
|
6
|
+
*/
|
|
7
|
+
export function splitCInclude(node) {
|
|
8
|
+
// node.type === 'preproc_include'
|
|
9
|
+
// path field: (string_literal (string_content)) | (system_lib_string)
|
|
10
|
+
const pathNode = node.childForFieldName?.('path') ?? null;
|
|
11
|
+
if (pathNode === null) {
|
|
12
|
+
// Fallback: scan children
|
|
13
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
14
|
+
const child = node.child(i);
|
|
15
|
+
if (child === null)
|
|
16
|
+
continue;
|
|
17
|
+
if (child.type === 'string_literal' || child.type === 'system_lib_string') {
|
|
18
|
+
return buildIncludeCapture(node, child);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return buildIncludeCapture(node, pathNode);
|
|
24
|
+
}
|
|
25
|
+
function buildIncludeCapture(node, pathNode) {
|
|
26
|
+
let raw;
|
|
27
|
+
if (pathNode.type === 'string_literal') {
|
|
28
|
+
// string_literal has children: `"`, string_content, `"`
|
|
29
|
+
// Use namedChildren to find the string_content node
|
|
30
|
+
const content = pathNode.namedChildren.find((c) => c.type === 'string_content');
|
|
31
|
+
raw = content?.text ?? pathNode.text.replace(/^"|"$/g, '');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// system_lib_string: <stdio.h> → strip angle brackets
|
|
35
|
+
raw = pathNode.text;
|
|
36
|
+
if (raw.startsWith('<') && raw.endsWith('>')) {
|
|
37
|
+
raw = raw.slice(1, -1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const isSystem = pathNode.type === 'system_lib_string';
|
|
41
|
+
const result = {
|
|
42
|
+
'@import.statement': nodeToCapture('@import.statement', node),
|
|
43
|
+
'@import.kind': syntheticCapture('@import.kind', node, 'wildcard'),
|
|
44
|
+
'@import.source': syntheticCapture('@import.source', node, raw),
|
|
45
|
+
};
|
|
46
|
+
if (isSystem) {
|
|
47
|
+
result['@import.system'] = syntheticCapture('@import.system', node, 'true');
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a C #include path to a file in the workspace.
|
|
3
|
+
*
|
|
4
|
+
* Strategy:
|
|
5
|
+
* 1. Check for a same-directory sibling relative to the including file
|
|
6
|
+
* (matches C compiler `#include "…"` relative-lookup semantics).
|
|
7
|
+
* 2. Check for an exact match (path as-is in the workspace).
|
|
8
|
+
* 3. Fall back to suffix matching against all workspace file paths.
|
|
9
|
+
* Tie-breaking: prefer the match with the fewest path components
|
|
10
|
+
* (closest to root). On equal depth, break ties lexicographically
|
|
11
|
+
* by normalized path to ensure deterministic resolution regardless
|
|
12
|
+
* of filesystem iteration order.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveCImportTarget(targetRaw: string, fromFile: string, allFilePaths: ReadonlySet<string>): string | null;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { dirname, join } from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a C #include path to a file in the workspace.
|
|
4
|
+
*
|
|
5
|
+
* Strategy:
|
|
6
|
+
* 1. Check for a same-directory sibling relative to the including file
|
|
7
|
+
* (matches C compiler `#include "…"` relative-lookup semantics).
|
|
8
|
+
* 2. Check for an exact match (path as-is in the workspace).
|
|
9
|
+
* 3. Fall back to suffix matching against all workspace file paths.
|
|
10
|
+
* Tie-breaking: prefer the match with the fewest path components
|
|
11
|
+
* (closest to root). On equal depth, break ties lexicographically
|
|
12
|
+
* by normalized path to ensure deterministic resolution regardless
|
|
13
|
+
* of filesystem iteration order.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveCImportTarget(targetRaw, fromFile, allFilePaths) {
|
|
16
|
+
if (!targetRaw)
|
|
17
|
+
return null;
|
|
18
|
+
const normalizedTarget = targetRaw.replace(/\\/g, '/');
|
|
19
|
+
// Same-directory sibling first: mirrors the C compiler's #include "…"
|
|
20
|
+
// relative-lookup semantics where the directory of the including
|
|
21
|
+
// file is searched before the include-path list.
|
|
22
|
+
if (fromFile) {
|
|
23
|
+
const siblingRaw = join(dirname(fromFile), targetRaw);
|
|
24
|
+
const sibling = siblingRaw.replace(/\\/g, '/');
|
|
25
|
+
if (allFilePaths.has(sibling))
|
|
26
|
+
return sibling;
|
|
27
|
+
// When targetRaw contains backslashes, the normalized form may
|
|
28
|
+
// resolve to a different sibling path — try it as well.
|
|
29
|
+
if (targetRaw !== normalizedTarget) {
|
|
30
|
+
const siblingAlt = join(dirname(fromFile), normalizedTarget);
|
|
31
|
+
const siblingAltNorm = siblingAlt.replace(/\\/g, '/');
|
|
32
|
+
if (allFilePaths.has(siblingAltNorm))
|
|
33
|
+
return siblingAltNorm;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Exact match (path as-is in the workspace)
|
|
37
|
+
if (allFilePaths.has(normalizedTarget))
|
|
38
|
+
return normalizedTarget;
|
|
39
|
+
// Suffix match: find files ending with /targetRaw or equal to targetRaw
|
|
40
|
+
const suffix = '/' + normalizedTarget;
|
|
41
|
+
let bestMatch = null;
|
|
42
|
+
let bestDepth = Infinity;
|
|
43
|
+
let bestNormalized = '';
|
|
44
|
+
for (const filePath of allFilePaths) {
|
|
45
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
46
|
+
if (normalized === normalizedTarget || normalized.endsWith(suffix)) {
|
|
47
|
+
// Prefer shortest path (closest match)
|
|
48
|
+
const depth = normalized.split('/').length;
|
|
49
|
+
if (depth < bestDepth || (depth === bestDepth && normalized < bestNormalized)) {
|
|
50
|
+
bestDepth = depth;
|
|
51
|
+
bestMatch = filePath;
|
|
52
|
+
bestNormalized = normalized;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return bestMatch;
|
|
57
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C scope-resolution hooks (RFC #909 Ring 3).
|
|
3
|
+
*/
|
|
4
|
+
export { emitCScopeCaptures } from './captures.js';
|
|
5
|
+
export { interpretCImport, interpretCTypeBinding, normalizeCTypeName } from './interpret.js';
|
|
6
|
+
export { splitCInclude } from './import-decomposer.js';
|
|
7
|
+
export { cArityCompatibility } from './arity.js';
|
|
8
|
+
export { cMergeBindings } from './merge-bindings.js';
|
|
9
|
+
export { cBindingScopeFor, cImportOwningScope, cReceiverBinding } from './simple-hooks.js';
|
|
10
|
+
export { resolveCImportTarget } from './import-target.js';
|
|
11
|
+
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames, } from './static-linkage.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C scope-resolution hooks (RFC #909 Ring 3).
|
|
3
|
+
*/
|
|
4
|
+
export { emitCScopeCaptures } from './captures.js';
|
|
5
|
+
export { interpretCImport, interpretCTypeBinding, normalizeCTypeName } from './interpret.js';
|
|
6
|
+
export { splitCInclude } from './import-decomposer.js';
|
|
7
|
+
export { cArityCompatibility } from './arity.js';
|
|
8
|
+
export { cMergeBindings } from './merge-bindings.js';
|
|
9
|
+
export { cBindingScopeFor, cImportOwningScope, cReceiverBinding } from './simple-hooks.js';
|
|
10
|
+
export { resolveCImportTarget } from './import-target.js';
|
|
11
|
+
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames, } from './static-linkage.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CaptureMatch, ParsedImport, ParsedTypeBinding } from '../../../../_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interpret a C #include capture into a ParsedImport.
|
|
4
|
+
* C includes are always wildcard imports (all symbols from the header).
|
|
5
|
+
*/
|
|
6
|
+
export declare function interpretCImport(captures: CaptureMatch): ParsedImport | null;
|
|
7
|
+
/**
|
|
8
|
+
* Interpret a C type-binding capture into a ParsedTypeBinding.
|
|
9
|
+
*/
|
|
10
|
+
export declare function interpretCTypeBinding(captures: CaptureMatch): ParsedTypeBinding | null;
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a C type name: strip pointer/array syntax, qualifiers.
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeCTypeName(text: string): string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interpret a C #include capture into a ParsedImport.
|
|
3
|
+
* C includes are always wildcard imports (all symbols from the header).
|
|
4
|
+
*/
|
|
5
|
+
export function interpretCImport(captures) {
|
|
6
|
+
const source = captures['@import.source']?.text;
|
|
7
|
+
if (source === undefined)
|
|
8
|
+
return null;
|
|
9
|
+
// System headers (e.g. <stdio.h>) are not resolved to local files
|
|
10
|
+
if (captures['@import.system'] !== undefined)
|
|
11
|
+
return null;
|
|
12
|
+
return { kind: 'wildcard', targetRaw: source };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interpret a C type-binding capture into a ParsedTypeBinding.
|
|
16
|
+
*/
|
|
17
|
+
export function interpretCTypeBinding(captures) {
|
|
18
|
+
const name = captures['@type-binding.name']?.text;
|
|
19
|
+
const type = captures['@type-binding.type']?.text;
|
|
20
|
+
if (name === undefined || type === undefined)
|
|
21
|
+
return null;
|
|
22
|
+
let source = 'annotation';
|
|
23
|
+
if (captures['@type-binding.parameter'] !== undefined) {
|
|
24
|
+
source = 'parameter-annotation';
|
|
25
|
+
}
|
|
26
|
+
else if (captures['@type-binding.assignment'] !== undefined) {
|
|
27
|
+
source = 'assignment-inferred';
|
|
28
|
+
}
|
|
29
|
+
return { boundName: name, rawTypeName: normalizeCTypeName(type), source };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Normalize a C type name: strip pointer/array syntax, qualifiers.
|
|
33
|
+
*/
|
|
34
|
+
export function normalizeCTypeName(text) {
|
|
35
|
+
let t = text.trim();
|
|
36
|
+
// Strip const, volatile, restrict qualifiers
|
|
37
|
+
t = t.replace(/\b(const|volatile|restrict|static|extern|inline)\b/g, '').trim();
|
|
38
|
+
// Strip pointer stars
|
|
39
|
+
while (t.endsWith('*'))
|
|
40
|
+
t = t.slice(0, -1).trim();
|
|
41
|
+
while (t.startsWith('*'))
|
|
42
|
+
t = t.slice(1).trim();
|
|
43
|
+
// Strip array brackets
|
|
44
|
+
t = t.replace(/\[.*?\]/g, '').trim();
|
|
45
|
+
// Strip struct/union/enum prefixes
|
|
46
|
+
t = t.replace(/^(struct|union|enum)\s+/, '');
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BindingRef } from '../../../../_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* C merge bindings: simple first-wins by tier (local > import > wildcard).
|
|
4
|
+
* C has no namespaces or reexports, but the tiers are defined for
|
|
5
|
+
* compatibility with the shared infrastructure.
|
|
6
|
+
*/
|
|
7
|
+
export declare function cMergeBindings(existing: readonly BindingRef[], incoming: readonly BindingRef[], _scopeId: string): BindingRef[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const TIER = {
|
|
2
|
+
local: 0,
|
|
3
|
+
namespace: 1,
|
|
4
|
+
import: 2,
|
|
5
|
+
reexport: 3,
|
|
6
|
+
wildcard: 4,
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* C merge bindings: simple first-wins by tier (local > import > wildcard).
|
|
10
|
+
* C has no namespaces or reexports, but the tiers are defined for
|
|
11
|
+
* compatibility with the shared infrastructure.
|
|
12
|
+
*/
|
|
13
|
+
export function cMergeBindings(existing, incoming, _scopeId) {
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
return [...existing, ...incoming]
|
|
16
|
+
.sort((a, b) => (TIER[a.origin] ?? 99) - (TIER[b.origin] ?? 99) || a.def.nodeId.localeCompare(b.def.nodeId))
|
|
17
|
+
.filter((binding) => {
|
|
18
|
+
if (seen.has(binding.def.nodeId))
|
|
19
|
+
return false;
|
|
20
|
+
seen.add(binding.def.nodeId);
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import Parser from 'tree-sitter';
|
|
2
|
+
import C from 'tree-sitter-c';
|
|
3
|
+
const C_SCOPE_QUERY = `
|
|
4
|
+
;; Scopes
|
|
5
|
+
(translation_unit) @scope.module
|
|
6
|
+
(struct_specifier) @scope.class
|
|
7
|
+
(union_specifier) @scope.class
|
|
8
|
+
(function_definition) @scope.function
|
|
9
|
+
(compound_statement) @scope.block
|
|
10
|
+
(if_statement) @scope.block
|
|
11
|
+
(for_statement) @scope.block
|
|
12
|
+
(while_statement) @scope.block
|
|
13
|
+
(do_statement) @scope.block
|
|
14
|
+
(switch_statement) @scope.block
|
|
15
|
+
(case_statement) @scope.block
|
|
16
|
+
|
|
17
|
+
;; Declarations — struct (named)
|
|
18
|
+
(struct_specifier
|
|
19
|
+
name: (type_identifier) @declaration.name
|
|
20
|
+
body: (field_declaration_list)) @declaration.struct
|
|
21
|
+
|
|
22
|
+
;; Declarations — struct (typedef struct { ... } Name)
|
|
23
|
+
(type_definition
|
|
24
|
+
type: (struct_specifier
|
|
25
|
+
body: (field_declaration_list))
|
|
26
|
+
declarator: (type_identifier) @declaration.name) @declaration.struct
|
|
27
|
+
|
|
28
|
+
;; Declarations — union (named)
|
|
29
|
+
(union_specifier
|
|
30
|
+
name: (type_identifier) @declaration.name
|
|
31
|
+
body: (field_declaration_list)) @declaration.union
|
|
32
|
+
|
|
33
|
+
;; Declarations — union (typedef union { ... } Name)
|
|
34
|
+
(type_definition
|
|
35
|
+
type: (union_specifier
|
|
36
|
+
body: (field_declaration_list))
|
|
37
|
+
declarator: (type_identifier) @declaration.name) @declaration.union
|
|
38
|
+
|
|
39
|
+
;; Declarations — enum
|
|
40
|
+
(enum_specifier
|
|
41
|
+
name: (type_identifier) @declaration.name) @declaration.enum
|
|
42
|
+
|
|
43
|
+
;; Declarations — function definition
|
|
44
|
+
(function_definition
|
|
45
|
+
declarator: (function_declarator
|
|
46
|
+
declarator: (identifier) @declaration.name)) @declaration.function
|
|
47
|
+
|
|
48
|
+
;; Declarations — function definition with pointer return
|
|
49
|
+
(function_definition
|
|
50
|
+
declarator: (pointer_declarator
|
|
51
|
+
declarator: (function_declarator
|
|
52
|
+
declarator: (identifier) @declaration.name))) @declaration.function
|
|
53
|
+
|
|
54
|
+
;; Declarations — function declaration (prototype)
|
|
55
|
+
;; Note: Both prototypes and definitions are captured as @declaration.function.
|
|
56
|
+
;; This may produce duplicate Function nodes in the knowledge graph when a
|
|
57
|
+
;; function is declared in a header and defined in a .c file. CALLS edges
|
|
58
|
+
;; resolve correctly through scope-based wildcard import chains; the
|
|
59
|
+
;; duplication is a graph-quality concern only (no false edges).
|
|
60
|
+
(declaration
|
|
61
|
+
declarator: (function_declarator
|
|
62
|
+
declarator: (identifier) @declaration.name)) @declaration.function
|
|
63
|
+
|
|
64
|
+
;; Declarations — function declaration with pointer return (prototype)
|
|
65
|
+
(declaration
|
|
66
|
+
declarator: (pointer_declarator
|
|
67
|
+
declarator: (function_declarator
|
|
68
|
+
declarator: (identifier) @declaration.name))) @declaration.function
|
|
69
|
+
|
|
70
|
+
;; Declarations — typedef
|
|
71
|
+
(type_definition
|
|
72
|
+
declarator: (type_identifier) @declaration.name) @declaration.typedef
|
|
73
|
+
|
|
74
|
+
;; Declarations — typedef for function pointers: typedef void (*callback)(int, int)
|
|
75
|
+
(type_definition
|
|
76
|
+
declarator: (function_declarator
|
|
77
|
+
declarator: (parenthesized_declarator
|
|
78
|
+
(pointer_declarator
|
|
79
|
+
declarator: (type_identifier) @declaration.name)))) @declaration.typedef
|
|
80
|
+
|
|
81
|
+
;; Declarations — struct fields
|
|
82
|
+
(field_declaration
|
|
83
|
+
declarator: (field_identifier) @declaration.name) @declaration.field
|
|
84
|
+
|
|
85
|
+
;; Declarations — struct fields (pointer)
|
|
86
|
+
(field_declaration
|
|
87
|
+
declarator: (pointer_declarator
|
|
88
|
+
declarator: (field_identifier) @declaration.name)) @declaration.field
|
|
89
|
+
|
|
90
|
+
;; Declarations — variables (with initializer)
|
|
91
|
+
(declaration
|
|
92
|
+
declarator: (init_declarator
|
|
93
|
+
declarator: (identifier) @declaration.name)) @declaration.variable
|
|
94
|
+
|
|
95
|
+
;; Declarations — macro definitions
|
|
96
|
+
(preproc_def
|
|
97
|
+
name: (identifier) @declaration.name) @declaration.macro
|
|
98
|
+
|
|
99
|
+
(preproc_function_def
|
|
100
|
+
name: (identifier) @declaration.name) @declaration.macro
|
|
101
|
+
|
|
102
|
+
;; Declarations — enum constants
|
|
103
|
+
(enumerator
|
|
104
|
+
name: (identifier) @declaration.name) @declaration.const
|
|
105
|
+
|
|
106
|
+
;; Imports
|
|
107
|
+
(preproc_include) @import.statement
|
|
108
|
+
|
|
109
|
+
;; Type bindings — parameter annotations
|
|
110
|
+
(parameter_declaration
|
|
111
|
+
type: (_) @type-binding.type
|
|
112
|
+
declarator: (identifier) @type-binding.name) @type-binding.parameter
|
|
113
|
+
|
|
114
|
+
;; Type bindings — variable with type (init_declarator)
|
|
115
|
+
(declaration
|
|
116
|
+
type: (_) @type-binding.type
|
|
117
|
+
declarator: (init_declarator
|
|
118
|
+
declarator: (identifier) @type-binding.name)) @type-binding.assignment
|
|
119
|
+
|
|
120
|
+
;; References — free calls
|
|
121
|
+
;; Note: This also captures calls through function pointer variables (e.g. fp(x))
|
|
122
|
+
;; since tree-sitter-c produces structurally identical AST nodes for both direct
|
|
123
|
+
;; function calls and function-pointer-variable calls. A type-based guard to
|
|
124
|
+
;; distinguish variable-calls from function-calls is not implemented — this is a
|
|
125
|
+
;; known architectural trade-off shared with the Go resolver. The uniqueness
|
|
126
|
+
;; constraint in pickUniqueGlobalCallable limits false edge exposure.
|
|
127
|
+
(call_expression
|
|
128
|
+
function: (identifier) @reference.name) @reference.call.free
|
|
129
|
+
|
|
130
|
+
;; References — member calls via pointer (ptr->func())
|
|
131
|
+
(call_expression
|
|
132
|
+
function: (field_expression
|
|
133
|
+
argument: (_) @reference.receiver
|
|
134
|
+
field: (field_identifier) @reference.name)) @reference.call.member
|
|
135
|
+
|
|
136
|
+
;; References — field reads
|
|
137
|
+
(field_expression
|
|
138
|
+
argument: (_) @reference.receiver
|
|
139
|
+
field: (field_identifier) @reference.name) @reference.read
|
|
140
|
+
|
|
141
|
+
;; References — field writes (assignment)
|
|
142
|
+
(assignment_expression
|
|
143
|
+
left: (field_expression
|
|
144
|
+
argument: (_) @reference.receiver
|
|
145
|
+
field: (field_identifier) @reference.name)) @reference.write
|
|
146
|
+
`;
|
|
147
|
+
let _parser = null;
|
|
148
|
+
let _query = null;
|
|
149
|
+
export function getCParser() {
|
|
150
|
+
if (_parser === null) {
|
|
151
|
+
_parser = new Parser();
|
|
152
|
+
_parser.setLanguage(C);
|
|
153
|
+
}
|
|
154
|
+
return _parser;
|
|
155
|
+
}
|
|
156
|
+
export function getCScopeQuery() {
|
|
157
|
+
if (_query === null) {
|
|
158
|
+
_query = new Parser.Query(C, C_SCOPE_QUERY);
|
|
159
|
+
}
|
|
160
|
+
return _query;
|
|
161
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ScopeResolver } from '../../scope-resolution/contract/scope-resolver.js';
|
|
2
|
+
/**
|
|
3
|
+
* C `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
4
|
+
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
5
|
+
*
|
|
6
|
+
* C is a structurally simple language for scope resolution:
|
|
7
|
+
* - No classes (structs are value types, no method dispatch)
|
|
8
|
+
* - No inheritance (no MRO needed beyond the shared first-wins default)
|
|
9
|
+
* - No overloading (arity check is simple: variadic detection only)
|
|
10
|
+
* - `#include` is wildcard import (all symbols from header are visible)
|
|
11
|
+
* - `static` functions are file-local (not exported)
|
|
12
|
+
*/
|
|
13
|
+
export declare const cScopeResolver: ScopeResolver;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { SupportedLanguages } from '../../../../_shared/index.js';
|
|
2
|
+
import { buildMro, defaultLinearize } from '../../scope-resolution/passes/mro.js';
|
|
3
|
+
import { populateClassOwnedMembers } from '../../scope-resolution/scope/walkers.js';
|
|
4
|
+
import { cProvider } from '../c-cpp.js';
|
|
5
|
+
import { cArityCompatibility, cMergeBindings, resolveCImportTarget } from './index.js';
|
|
6
|
+
import { scanHeaderFiles } from './header-scan.js';
|
|
7
|
+
import { expandCWildcardNames, isStaticName, clearStaticNames } from './static-linkage.js';
|
|
8
|
+
/**
|
|
9
|
+
* C `ScopeResolver` registered in `SCOPE_RESOLVERS` and consumed by
|
|
10
|
+
* the generic `runScopeResolution` orchestrator (RFC #909 Ring 3).
|
|
11
|
+
*
|
|
12
|
+
* C is a structurally simple language for scope resolution:
|
|
13
|
+
* - No classes (structs are value types, no method dispatch)
|
|
14
|
+
* - No inheritance (no MRO needed beyond the shared first-wins default)
|
|
15
|
+
* - No overloading (arity check is simple: variadic detection only)
|
|
16
|
+
* - `#include` is wildcard import (all symbols from header are visible)
|
|
17
|
+
* - `static` functions are file-local (not exported)
|
|
18
|
+
*/
|
|
19
|
+
export const cScopeResolver = {
|
|
20
|
+
language: SupportedLanguages.C,
|
|
21
|
+
languageProvider: cProvider,
|
|
22
|
+
importEdgeReason: 'c-scope: include',
|
|
23
|
+
loadResolutionConfig: (repoPath) => {
|
|
24
|
+
// Clear stale static-linkage data from any previous invocation to
|
|
25
|
+
// prevent cross-repo contamination in server-mode scenarios.
|
|
26
|
+
clearStaticNames();
|
|
27
|
+
return scanHeaderFiles(repoPath);
|
|
28
|
+
},
|
|
29
|
+
resolveImportTarget: (targetRaw, fromFile, allFilePaths, resolutionConfig) => {
|
|
30
|
+
// Augment allFilePaths with .h files discovered via loadResolutionConfig
|
|
31
|
+
// since the phase only passes .c files to the C resolver but #include
|
|
32
|
+
// targets .h files classified as C++ in language detection.
|
|
33
|
+
const headerPaths = resolutionConfig;
|
|
34
|
+
if (headerPaths !== undefined && headerPaths.size > 0) {
|
|
35
|
+
const augmented = new Set(allFilePaths);
|
|
36
|
+
for (const h of headerPaths)
|
|
37
|
+
augmented.add(h);
|
|
38
|
+
return resolveCImportTarget(targetRaw, fromFile, augmented);
|
|
39
|
+
}
|
|
40
|
+
return resolveCImportTarget(targetRaw, fromFile, allFilePaths);
|
|
41
|
+
},
|
|
42
|
+
expandsWildcardTo: (targetModuleScope, parsedFiles) => expandCWildcardNames(targetModuleScope, parsedFiles),
|
|
43
|
+
mergeBindings: (existing, incoming, scopeId) => cMergeBindings(existing, incoming, scopeId),
|
|
44
|
+
arityCompatibility: (callsite, def) => cArityCompatibility(def, callsite),
|
|
45
|
+
buildMro: (graph, parsedFiles, nodeLookup) => buildMro(graph, parsedFiles, nodeLookup, defaultLinearize),
|
|
46
|
+
populateOwners: (parsed) => populateClassOwnedMembers(parsed),
|
|
47
|
+
isSuperReceiver: () => false,
|
|
48
|
+
// C is statically typed — disable field fallback heuristic
|
|
49
|
+
fieldFallbackOnMethodLookup: false,
|
|
50
|
+
// C has no method return types to propagate
|
|
51
|
+
propagatesReturnTypesAcrossImports: false,
|
|
52
|
+
// C #include brings in all symbols — enable global free call fallback
|
|
53
|
+
allowGlobalFreeCallFallback: true,
|
|
54
|
+
// C `static` functions have file-local (translation-unit) linkage —
|
|
55
|
+
// exclude them from global free-call fallback cross-file resolution.
|
|
56
|
+
isFileLocalDef: (def) => {
|
|
57
|
+
const simple = def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
58
|
+
return isStaticName(def.filePath, simple);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CaptureMatch, ParsedImport, Scope, ScopeId, ScopeTree, TypeRef } from '../../../../_shared/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* C binding scope: always use default auto-hoist (null).
|
|
4
|
+
* C has no self/receiver bindings that need special scoping.
|
|
5
|
+
*/
|
|
6
|
+
export declare function cBindingScopeFor(_decl: CaptureMatch, _innermost: Scope, _tree: ScopeTree): ScopeId | null;
|
|
7
|
+
/**
|
|
8
|
+
* C import owning scope: always use default (null).
|
|
9
|
+
*/
|
|
10
|
+
export declare function cImportOwningScope(_imp: ParsedImport, _innermost: Scope, _tree: ScopeTree): ScopeId | null;
|
|
11
|
+
/**
|
|
12
|
+
* C receiver binding: always null. C has no methods or receivers.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cReceiverBinding(_functionScope: Scope): TypeRef | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* C binding scope: always use default auto-hoist (null).
|
|
3
|
+
* C has no self/receiver bindings that need special scoping.
|
|
4
|
+
*/
|
|
5
|
+
export function cBindingScopeFor(_decl, _innermost, _tree) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* C import owning scope: always use default (null).
|
|
10
|
+
*/
|
|
11
|
+
export function cImportOwningScope(_imp, _innermost, _tree) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* C receiver binding: always null. C has no methods or receivers.
|
|
16
|
+
*/
|
|
17
|
+
export function cReceiverBinding(_functionScope) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ParsedFile, ScopeId } from '../../../../_shared/index.js';
|
|
2
|
+
/** Record a symbol name as `static` (file-local linkage) for the given file. */
|
|
3
|
+
export declare function markStaticName(filePath: string, name: string): void;
|
|
4
|
+
/** Check whether a symbol name has `static` linkage in the given file. */
|
|
5
|
+
export declare function isStaticName(filePath: string, name: string): boolean;
|
|
6
|
+
/** Clear tracked static names (for testing). */
|
|
7
|
+
export declare function clearStaticNames(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Return the names visible through a C wildcard import (`#include`).
|
|
10
|
+
* All module-scope defs from the target file are visible EXCEPT those
|
|
11
|
+
* declared with `static` storage class (file-local linkage in C).
|
|
12
|
+
*/
|
|
13
|
+
export declare function expandCWildcardNames(targetModuleScope: ScopeId, parsedFiles: readonly ParsedFile[]): readonly string[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-file set of function names declared with `static` storage class.
|
|
3
|
+
* Populated during `emitCScopeCaptures` and consumed by `expandCWildcardNames`
|
|
4
|
+
* to exclude file-local symbols from cross-file wildcard import visibility.
|
|
5
|
+
*
|
|
6
|
+
* NOTE: module-level state, single-process-single-repo use only.
|
|
7
|
+
* For server-mode or multi-repo-in-one-process use cases, call
|
|
8
|
+
* `clearStaticNames()` at the start of each resolution pass to avoid
|
|
9
|
+
* stale static-linkage data from a previous invocation.
|
|
10
|
+
*
|
|
11
|
+
* Key: filePath, Value: Set of static function names.
|
|
12
|
+
*/
|
|
13
|
+
const staticNames = new Map();
|
|
14
|
+
/** Record a symbol name as `static` (file-local linkage) for the given file. */
|
|
15
|
+
export function markStaticName(filePath, name) {
|
|
16
|
+
let names = staticNames.get(filePath);
|
|
17
|
+
if (names === undefined) {
|
|
18
|
+
names = new Set();
|
|
19
|
+
staticNames.set(filePath, names);
|
|
20
|
+
}
|
|
21
|
+
names.add(name);
|
|
22
|
+
}
|
|
23
|
+
/** Check whether a symbol name has `static` linkage in the given file. */
|
|
24
|
+
export function isStaticName(filePath, name) {
|
|
25
|
+
return staticNames.get(filePath)?.has(name) ?? false;
|
|
26
|
+
}
|
|
27
|
+
/** Clear tracked static names (for testing). */
|
|
28
|
+
export function clearStaticNames() {
|
|
29
|
+
staticNames.clear();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Return the names visible through a C wildcard import (`#include`).
|
|
33
|
+
* All module-scope defs from the target file are visible EXCEPT those
|
|
34
|
+
* declared with `static` storage class (file-local linkage in C).
|
|
35
|
+
*/
|
|
36
|
+
export function expandCWildcardNames(targetModuleScope, parsedFiles) {
|
|
37
|
+
const target = parsedFiles.find((p) => p.moduleScope === targetModuleScope);
|
|
38
|
+
if (target === undefined)
|
|
39
|
+
return [];
|
|
40
|
+
const seen = new Set();
|
|
41
|
+
const names = [];
|
|
42
|
+
for (const def of target.localDefs) {
|
|
43
|
+
const name = simpleName(def);
|
|
44
|
+
if (name === '')
|
|
45
|
+
continue;
|
|
46
|
+
if (isStaticName(target.filePath, name))
|
|
47
|
+
continue;
|
|
48
|
+
if (seen.has(name))
|
|
49
|
+
continue;
|
|
50
|
+
seen.add(name);
|
|
51
|
+
names.push(name);
|
|
52
|
+
}
|
|
53
|
+
return names;
|
|
54
|
+
}
|
|
55
|
+
function simpleName(def) {
|
|
56
|
+
return def.qualifiedName?.split('.').pop() ?? def.qualifiedName ?? '';
|
|
57
|
+
}
|