maestro-flow 0.5.2 → 0.5.31
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/.agents/skills/insight-challenge/SKILL.md +228 -0
- package/.agents/skills/insight-challenge/specs/challenge-protocol.md +154 -0
- package/.agents/skills/insight-challenge/specs/verdict-schema.md +239 -0
- package/.agents/skills/learn-follow/SKILL.md +114 -114
- package/.agents/skills/learn-investigate/SKILL.md +138 -139
- package/.agents/skills/learn-second-opinion/SKILL.md +105 -109
- package/.agents/skills/maestro/SKILL.md +8 -16
- package/.agents/skills/maestro-amend/SKILL.md +152 -152
- package/.agents/skills/maestro-analyze/SKILL.md +201 -252
- package/.agents/skills/maestro-blueprint/SKILL.md +175 -190
- package/.agents/skills/maestro-brainstorm/SKILL.md +196 -200
- package/.agents/skills/maestro-collab/SKILL.md +159 -159
- package/.agents/skills/maestro-companion/SKILL.md +517 -517
- package/.agents/skills/maestro-composer/SKILL.md +173 -164
- package/.agents/skills/maestro-execute/SKILL.md +169 -170
- package/.agents/skills/maestro-fork/SKILL.md +97 -96
- package/.agents/skills/maestro-grill/SKILL.md +161 -162
- package/.agents/skills/maestro-guard/SKILL.md +93 -92
- package/.agents/skills/maestro-help/SKILL.md +1 -1
- package/.agents/skills/maestro-help/index/catalog.json +3 -2
- package/.agents/skills/maestro-impeccable/SKILL.md +296 -253
- package/.agents/skills/maestro-init/SKILL.md +117 -118
- package/.agents/skills/maestro-merge/SKILL.md +73 -66
- package/.agents/skills/maestro-milestone-audit/SKILL.md +4 -10
- package/.agents/skills/maestro-milestone-complete/SKILL.md +6 -7
- package/.agents/skills/maestro-milestone-release/SKILL.md +122 -131
- package/.agents/skills/maestro-next/SKILL.md +241 -245
- package/.agents/skills/maestro-overlay/SKILL.md +176 -166
- package/.agents/skills/maestro-plan/SKILL.md +211 -197
- package/.agents/skills/maestro-player/SKILL.md +167 -167
- package/.agents/skills/maestro-quick/SKILL.md +69 -63
- package/.agents/skills/maestro-ralph/SKILL.md +13 -46
- package/.agents/skills/maestro-ralph-beta/SKILL.md +861 -871
- package/.agents/skills/maestro-ralph-execute/SKILL.md +234 -234
- package/.agents/skills/maestro-roadmap/SKILL.md +159 -172
- package/.agents/skills/maestro-swarm-workflow/SKILL.md +229 -250
- package/.agents/skills/maestro-tools-execute/SKILL.md +108 -103
- package/.agents/skills/maestro-tools-register/SKILL.md +148 -143
- package/.agents/skills/maestro-ui-codify/SKILL.md +103 -86
- package/.agents/skills/maestro-universal-workflow/SKILL.md +534 -547
- package/.agents/skills/maestro-update/SKILL.md +109 -106
- package/.agents/skills/manage-codebase-rebuild/SKILL.md +73 -71
- package/.agents/skills/manage-harvest/SKILL.md +83 -81
- package/.agents/skills/manage-issue/SKILL.md +59 -60
- package/.agents/skills/manage-issue-discover/SKILL.md +70 -68
- package/.agents/skills/manage-kg-extractors/SKILL.md +130 -0
- package/.agents/skills/manage-knowhow/SKILL.md +70 -66
- package/.agents/skills/manage-knowhow-capture/SKILL.md +79 -69
- package/.agents/skills/manage-knowledge-audit/SKILL.md +91 -74
- package/.agents/skills/manage-status/SKILL.md +52 -42
- package/.agents/skills/manage-wiki/SKILL.md +69 -58
- package/.agents/skills/odyssey-debug/SKILL.md +461 -0
- package/.agents/skills/odyssey-improve/SKILL.md +493 -0
- package/.agents/skills/odyssey-planex/SKILL.md +592 -0
- package/.agents/skills/odyssey-review-test-fix/SKILL.md +416 -0
- package/.agents/skills/odyssey-ui/SKILL.md +447 -0
- package/.agents/skills/quality-auto-test/SKILL.md +140 -123
- package/.agents/skills/quality-debug/SKILL.md +145 -106
- package/.agents/skills/quality-refactor/SKILL.md +91 -53
- package/.agents/skills/quality-retrospective/SKILL.md +109 -63
- package/.agents/skills/quality-review/SKILL.md +141 -114
- package/.agents/skills/quality-sync/SKILL.md +74 -38
- package/.agents/skills/quality-test/SKILL.md +133 -103
- package/.agents/skills/security-audit/SKILL.md +217 -166
- package/.agents/skills/spec-add/SKILL.md +66 -59
- package/.agents/skills/spec-load/SKILL.md +68 -68
- package/.agents/skills/spec-remove/SKILL.md +42 -42
- package/.agents/skills/spec-setup/SKILL.md +38 -41
- package/.agy/skills/insight-challenge/SKILL.md +230 -0
- package/.agy/skills/insight-challenge/specs/challenge-protocol.md +154 -0
- package/.agy/skills/insight-challenge/specs/verdict-schema.md +239 -0
- package/.agy/skills/learn-follow/SKILL.md +114 -114
- package/.agy/skills/learn-investigate/SKILL.md +138 -139
- package/.agy/skills/learn-second-opinion/SKILL.md +105 -109
- package/.agy/skills/maestro/SKILL.md +8 -16
- package/.agy/skills/maestro-amend/SKILL.md +152 -152
- package/.agy/skills/maestro-analyze/SKILL.md +201 -252
- package/.agy/skills/maestro-blueprint/SKILL.md +175 -190
- package/.agy/skills/maestro-brainstorm/SKILL.md +196 -200
- package/.agy/skills/maestro-collab/SKILL.md +159 -159
- package/.agy/skills/maestro-companion/SKILL.md +517 -517
- package/.agy/skills/maestro-composer/SKILL.md +173 -164
- package/.agy/skills/maestro-execute/SKILL.md +169 -170
- package/.agy/skills/maestro-fork/SKILL.md +97 -96
- package/.agy/skills/maestro-grill/SKILL.md +161 -162
- package/.agy/skills/maestro-guard/SKILL.md +93 -92
- package/.agy/skills/maestro-help/SKILL.md +1 -1
- package/.agy/skills/maestro-help/index/catalog.json +3 -2
- package/.agy/skills/maestro-impeccable/SKILL.md +296 -253
- package/.agy/skills/maestro-init/SKILL.md +117 -118
- package/.agy/skills/maestro-merge/SKILL.md +73 -66
- package/.agy/skills/maestro-milestone-audit/SKILL.md +4 -10
- package/.agy/skills/maestro-milestone-complete/SKILL.md +6 -7
- package/.agy/skills/maestro-milestone-release/SKILL.md +122 -131
- package/.agy/skills/maestro-next/SKILL.md +241 -245
- package/.agy/skills/maestro-overlay/SKILL.md +176 -166
- package/.agy/skills/maestro-plan/SKILL.md +211 -197
- package/.agy/skills/maestro-player/SKILL.md +167 -167
- package/.agy/skills/maestro-quick/SKILL.md +69 -63
- package/.agy/skills/maestro-ralph/SKILL.md +13 -46
- package/.agy/skills/maestro-ralph-beta/SKILL.md +861 -871
- package/.agy/skills/maestro-ralph-execute/SKILL.md +234 -234
- package/.agy/skills/maestro-roadmap/SKILL.md +159 -172
- package/.agy/skills/maestro-swarm-workflow/SKILL.md +229 -250
- package/.agy/skills/maestro-tools-execute/SKILL.md +108 -103
- package/.agy/skills/maestro-tools-register/SKILL.md +148 -143
- package/.agy/skills/maestro-ui-codify/SKILL.md +103 -86
- package/.agy/skills/maestro-universal-workflow/SKILL.md +534 -547
- package/.agy/skills/maestro-update/SKILL.md +109 -106
- package/.agy/skills/manage-codebase-rebuild/SKILL.md +73 -71
- package/.agy/skills/manage-harvest/SKILL.md +83 -81
- package/.agy/skills/manage-issue/SKILL.md +59 -60
- package/.agy/skills/manage-issue-discover/SKILL.md +70 -68
- package/.agy/skills/manage-kg-extractors/SKILL.md +130 -0
- package/.agy/skills/manage-knowhow/SKILL.md +70 -66
- package/.agy/skills/manage-knowhow-capture/SKILL.md +79 -69
- package/.agy/skills/manage-knowledge-audit/SKILL.md +91 -74
- package/.agy/skills/manage-status/SKILL.md +52 -42
- package/.agy/skills/manage-wiki/SKILL.md +69 -58
- package/.agy/skills/odyssey-debug/SKILL.md +461 -0
- package/.agy/skills/odyssey-improve/SKILL.md +493 -0
- package/.agy/skills/odyssey-planex/SKILL.md +592 -0
- package/.agy/skills/odyssey-review-test-fix/SKILL.md +416 -0
- package/.agy/skills/odyssey-ui/SKILL.md +447 -0
- package/.agy/skills/quality-auto-test/SKILL.md +140 -123
- package/.agy/skills/quality-debug/SKILL.md +145 -106
- package/.agy/skills/quality-refactor/SKILL.md +91 -53
- package/.agy/skills/quality-retrospective/SKILL.md +109 -63
- package/.agy/skills/quality-review/SKILL.md +141 -114
- package/.agy/skills/quality-sync/SKILL.md +74 -38
- package/.agy/skills/quality-test/SKILL.md +133 -103
- package/.agy/skills/security-audit/SKILL.md +217 -166
- package/.agy/skills/spec-add/SKILL.md +66 -59
- package/.agy/skills/spec-load/SKILL.md +68 -68
- package/.agy/skills/spec-remove/SKILL.md +42 -42
- package/.agy/skills/spec-setup/SKILL.md +38 -41
- package/.claude/commands/learn-follow.md +127 -127
- package/.claude/commands/learn-investigate.md +151 -152
- package/.claude/commands/learn-second-opinion.md +118 -122
- package/.claude/commands/maestro-amend.md +164 -164
- package/.claude/commands/maestro-analyze.md +215 -266
- package/.claude/commands/maestro-blueprint.md +189 -204
- package/.claude/commands/maestro-brainstorm.md +209 -213
- package/.claude/commands/maestro-collab.md +172 -172
- package/.claude/commands/maestro-companion.md +531 -531
- package/.claude/commands/maestro-composer.md +188 -179
- package/.claude/commands/maestro-execute.md +183 -184
- package/.claude/commands/maestro-fork.md +111 -110
- package/.claude/commands/maestro-grill.md +175 -176
- package/.claude/commands/maestro-guard.md +103 -102
- package/.claude/commands/maestro-impeccable.md +311 -268
- package/.claude/commands/maestro-init.md +130 -131
- package/.claude/commands/maestro-merge.md +87 -80
- package/.claude/commands/maestro-milestone-audit.md +4 -10
- package/.claude/commands/maestro-milestone-complete.md +6 -7
- package/.claude/commands/maestro-milestone-release.md +136 -145
- package/.claude/commands/maestro-next.md +253 -257
- package/.claude/commands/maestro-overlay.md +188 -178
- package/.claude/commands/maestro-plan.md +225 -211
- package/.claude/commands/maestro-player.md +182 -182
- package/.claude/commands/maestro-quick.md +83 -77
- package/.claude/commands/maestro-ralph-beta.md +875 -885
- package/.claude/commands/maestro-ralph-execute.md +247 -247
- package/.claude/commands/maestro-ralph.md +13 -46
- package/.claude/commands/maestro-roadmap.md +173 -186
- package/.claude/commands/maestro-swarm-workflow.md +243 -264
- package/.claude/commands/maestro-tools-execute.md +122 -117
- package/.claude/commands/maestro-tools-register.md +162 -157
- package/.claude/commands/maestro-ui-codify.md +117 -100
- package/.claude/commands/maestro-universal-workflow.md +548 -561
- package/.claude/commands/maestro-update.md +122 -119
- package/.claude/commands/maestro.md +8 -16
- package/.claude/commands/manage-codebase-rebuild.md +87 -85
- package/.claude/commands/manage-harvest.md +97 -95
- package/.claude/commands/manage-issue-discover.md +83 -81
- package/.claude/commands/manage-issue.md +72 -73
- package/.claude/commands/manage-kg-extractors.md +128 -0
- package/.claude/commands/manage-knowhow-capture.md +92 -82
- package/.claude/commands/manage-knowhow.md +83 -79
- package/.claude/commands/manage-knowledge-audit.md +105 -88
- package/.claude/commands/manage-status.md +62 -52
- package/.claude/commands/manage-wiki.md +82 -71
- package/.claude/commands/odyssey-debug.md +459 -0
- package/.claude/commands/odyssey-improve.md +491 -0
- package/.claude/commands/odyssey-planex.md +590 -0
- package/.claude/commands/odyssey-review-test-fix.md +414 -0
- package/.claude/commands/odyssey-ui.md +445 -0
- package/.claude/commands/quality-auto-test.md +153 -136
- package/.claude/commands/quality-debug.md +159 -120
- package/.claude/commands/quality-refactor.md +105 -67
- package/.claude/commands/quality-retrospective.md +123 -77
- package/.claude/commands/quality-review.md +155 -128
- package/.claude/commands/quality-sync.md +88 -52
- package/.claude/commands/quality-test.md +147 -117
- package/.claude/commands/security-audit.md +230 -179
- package/.claude/commands/spec-add.md +77 -70
- package/.claude/commands/spec-load.md +78 -78
- package/.claude/commands/spec-remove.md +55 -55
- package/.claude/commands/spec-setup.md +49 -52
- package/.claude/skills/insight-challenge/SKILL.md +226 -0
- package/.claude/skills/insight-challenge/specs/challenge-protocol.md +154 -0
- package/.claude/skills/insight-challenge/specs/verdict-schema.md +239 -0
- package/.claude/skills/maestro-help/SKILL.md +1 -1
- package/.claude/skills/maestro-help/index/catalog.json +3 -2
- package/.codex/skills/codify-to-knowhow/SKILL.md +1 -1
- package/.codex/skills/maestro-companion/SKILL.md +1 -1
- package/.codex/skills/maestro-help/SKILL.md +1 -1
- package/.codex/skills/maestro-impeccable/SKILL.md +1 -1
- package/.codex/skills/maestro-next/SKILL.md +1 -1
- package/.codex/skills/maestro-ralph-beta/SKILL.md +1 -1
- package/.codex/skills/odyssey-debug/SKILL.md +456 -0
- package/.codex/skills/odyssey-improve/SKILL.md +466 -0
- package/.codex/skills/odyssey-planex/SKILL.md +409 -0
- package/.codex/skills/odyssey-review-test-fix/SKILL.md +377 -0
- package/.codex/skills/odyssey-ui/SKILL.md +411 -0
- package/dashboard/dist/assets/{ArtifactsPage-BLvAqQlQ.js → ArtifactsPage-B6z23DfG.js} +2 -2
- package/dashboard/dist/assets/{ChatInput-DU9YGZKX.js → ChatInput-tBtGKV2i.js} +1 -1
- package/dashboard/dist/assets/{ChatPage-DYHfheXC.js → ChatPage-CcggDVs4.js} +2 -2
- package/dashboard/dist/assets/{CollabPage-CSlmvEa-.js → CollabPage-FaZeqqeS.js} +1 -1
- package/dashboard/dist/assets/{ExecutionPanel-RYWf0dYC.js → ExecutionPanel-DNRwYDXp.js} +1 -1
- package/dashboard/dist/assets/{KanbanPage-N55Iv0-X.js → KanbanPage-B2xh2s_N.js} +1 -1
- package/dashboard/dist/assets/{MaestroCoordinatePage-BxwZ6yy5.js → MaestroCoordinatePage-DCMGHDAL.js} +1 -1
- package/dashboard/dist/assets/{MarkdownRenderer-ZGtOY7Ti.js → MarkdownRenderer-C3FvTqVe.js} +1 -1
- package/dashboard/dist/assets/McpPage-HKaJ8cQP.js +16 -0
- package/dashboard/dist/assets/{MeetingRoomPage-CxHRn1xx.js → MeetingRoomPage-DGN5oUXH.js} +1 -1
- package/dashboard/dist/assets/{OutputPanel-DaL8c1i5.js → OutputPanel-BiCteH5k.js} +1 -1
- package/dashboard/dist/assets/{ProblemsPanel-BQTd5812.js → ProblemsPanel-Dk4v9tol.js} +1 -1
- package/dashboard/dist/assets/{RequirementBoardPage-22y9u1qh.js → RequirementBoardPage-D10A26gi.js} +1 -1
- package/dashboard/dist/assets/{RequirementPage-_mO743Xm.js → RequirementPage-Cs-2omLz.js} +1 -1
- package/dashboard/dist/assets/{RoomsPage-CExTbOGr.js → RoomsPage-tKQQhw1W.js} +1 -1
- package/dashboard/dist/assets/SpecsPage-LK1QCtcg.js +36 -0
- package/dashboard/dist/assets/{TeamsPage-BxEXLb5g.js → TeamsPage-C-bEwB8E.js} +1 -1
- package/dashboard/dist/assets/{TreeBrowser-CVtPF5C9.js → TreeBrowser-1YP-DfTY.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPage-BoN18Lhs.js → WorkflowPage-dGHPsDDr.js} +2 -2
- package/dashboard/dist/assets/{arrow-left-C5ROg97G.js → arrow-left-BPFSEpfO.js} +1 -1
- package/dashboard/dist/assets/{check-Bs8PM0tQ.js → check-D5hOViiQ.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-SmErd_1F.js → chevron-right-D9BsXrIg.js} +1 -1
- package/dashboard/dist/assets/{circle-CjpslL_D.js → circle-Cn5fNpmp.js} +1 -1
- package/dashboard/dist/assets/{circle-alert-CuzAg2fd.js → circle-alert-CZvK3B1K.js} +1 -1
- package/dashboard/dist/assets/{circle-check-BIkDU5D5.js → circle-check-DApOBP0J.js} +1 -1
- package/dashboard/dist/assets/{circle-check-big-CYctV8bK.js → circle-check-big-Cd9ztJpl.js} +1 -1
- package/dashboard/dist/assets/{code-DoB7rfxt.js → code-C3TuHjMs.js} +1 -1
- package/dashboard/dist/assets/{columns-3-Ch5KIyRa.js → columns-3-CO2SvNJb.js} +1 -1
- package/dashboard/dist/assets/{download-DadtG2Nr.js → download-BuKGI7KX.js} +1 -1
- package/dashboard/dist/assets/{en-2h6fD0j8.js → en-BmpYsIfb.js} +1 -1
- package/dashboard/dist/assets/folder-Chwj_P4A.js +11 -0
- package/dashboard/dist/assets/folder-open-S72FbKvn.js +6 -0
- package/dashboard/dist/assets/{index-BL4h1OKY.js → index-CN0YdC9M.js} +1 -1
- package/dashboard/dist/assets/{index-DQIlX2w_.js → index-Cbs79erW.js} +5 -5
- package/dashboard/dist/assets/{index-DaFwSmVJ.js → index-CdT1WNND.js} +1 -1
- package/dashboard/dist/assets/index-DEvP8cgc.css +1 -0
- package/dashboard/dist/assets/{list-CI-XIPZh.js → list-Dg_ojUpi.js} +1 -1
- package/dashboard/dist/assets/{loader-DpdMoQvh.js → loader-CMcc73C_.js} +1 -1
- package/dashboard/dist/assets/{minus-BVbfXGrC.js → minus-KxmVOIB7.js} +1 -1
- package/dashboard/dist/assets/pen-line-D1YTNDPw.js +11 -0
- package/dashboard/dist/assets/{pencil-I7GE0y29.js → pencil-BAjxSHuh.js} +1 -1
- package/dashboard/dist/assets/{proxy-CcYyZZWI.js → proxy-BewnIei6.js} +1 -1
- package/dashboard/dist/assets/{refresh-cw-BG9V_T4R.js → refresh-cw-Chc0RcRY.js} +1 -1
- package/dashboard/dist/assets/{rows-2-DP6NjQFk.js → rows-2-DWJuw8OM.js} +1 -1
- package/dashboard/dist/assets/{search-b78eLlw2.js → search-CPGb2sEw.js} +1 -1
- package/dashboard/dist/assets/{shallow-CJEesgtu.js → shallow-Dy0-7n5s.js} +1 -1
- package/dashboard/dist/assets/{table-B_lk-a1d.js → table-VI5scWpO.js} +1 -1
- package/dashboard/dist/assets/{team-types-Se7f9LfJ.js → team-types-Cu8zCPN3.js} +1 -1
- package/dashboard/dist/assets/{terminal-DXx4tvzq.js → terminal-Bqt5c6Ny.js} +1 -1
- package/dashboard/dist/assets/{trash-2-CVh9mnRj.js → trash-2-BcTVifbw.js} +1 -1
- package/dashboard/dist/assets/{users-Da9zGME5.js → users-BhFAHz4H.js} +1 -1
- package/dashboard/dist/assets/{zap-C0zaC7gJ.js → zap-BWbLhgr6.js} +1 -1
- package/dashboard/dist/assets/{zh-CN-r3AvxxOL.js → zh-CN-BIRiTdAD.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js +1 -0
- package/dashboard/dist-server/dashboard/src/server/routes/wiki.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +14 -14
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js +188 -56
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js +1 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/stress.test.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +37 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +560 -22
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-types.d.ts +6 -2
- package/dashboard/dist-server/src/types/index.d.ts +9 -0
- package/dist/src/cli.js +4 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +50 -8
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/domain.d.ts +9 -0
- package/dist/src/commands/domain.d.ts.map +1 -0
- package/dist/src/commands/domain.js +445 -0
- package/dist/src/commands/domain.js.map +1 -0
- package/dist/src/commands/hooks.d.ts +10 -0
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +132 -22
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/install.d.ts.map +1 -1
- package/dist/src/commands/install.js +82 -204
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/commands/kg.d.ts.map +1 -1
- package/dist/src/commands/kg.js +189 -90
- package/dist/src/commands/kg.js.map +1 -1
- package/dist/src/commands/search.d.ts +15 -8
- package/dist/src/commands/search.d.ts.map +1 -1
- package/dist/src/commands/search.js +205 -59
- package/dist/src/commands/search.js.map +1 -1
- package/dist/src/commands/spec.d.ts.map +1 -1
- package/dist/src/commands/spec.js +9 -1
- package/dist/src/commands/spec.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +0 -7
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/wiki.d.ts.map +1 -1
- package/dist/src/commands/wiki.js +8 -1
- package/dist/src/commands/wiki.js.map +1 -1
- package/dist/src/commands/workspace.d.ts +12 -0
- package/dist/src/commands/workspace.d.ts.map +1 -0
- package/dist/src/commands/workspace.js +230 -0
- package/dist/src/commands/workspace.js.map +1 -0
- package/dist/src/config/cli-tools-config.d.ts +5 -0
- package/dist/src/config/cli-tools-config.d.ts.map +1 -1
- package/dist/src/config/cli-tools-config.js +31 -0
- package/dist/src/config/cli-tools-config.js.map +1 -1
- package/dist/src/config/index.d.ts +9 -1
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/index.js +35 -1
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/core/install-executor.d.ts +31 -0
- package/dist/src/core/install-executor.d.ts.map +1 -0
- package/dist/src/core/install-executor.js +231 -0
- package/dist/src/core/install-executor.js.map +1 -0
- package/dist/src/core/install-profile.d.ts +103 -0
- package/dist/src/core/install-profile.d.ts.map +1 -0
- package/dist/src/core/install-profile.js +225 -0
- package/dist/src/core/install-profile.js.map +1 -0
- package/dist/src/graph/kg/credibility.d.ts +37 -0
- package/dist/src/graph/kg/credibility.d.ts.map +1 -0
- package/dist/src/graph/kg/credibility.js +141 -0
- package/dist/src/graph/kg/credibility.js.map +1 -0
- package/dist/src/graph/kg/db/connection.d.ts +28 -0
- package/dist/src/graph/kg/db/connection.d.ts.map +1 -0
- package/dist/src/graph/kg/db/connection.js +142 -0
- package/dist/src/graph/kg/db/connection.js.map +1 -0
- package/dist/src/graph/kg/db/index.d.ts +5 -0
- package/dist/src/graph/kg/db/index.d.ts.map +1 -0
- package/dist/src/graph/kg/db/index.js +6 -0
- package/dist/src/graph/kg/db/index.js.map +1 -0
- package/dist/src/graph/kg/db/migrations.d.ts +8 -0
- package/dist/src/graph/kg/db/migrations.d.ts.map +1 -0
- package/dist/src/graph/kg/db/migrations.js +88 -0
- package/dist/src/graph/kg/db/migrations.js.map +1 -0
- package/dist/src/graph/kg/db/queries.d.ts +84 -0
- package/dist/src/graph/kg/db/queries.d.ts.map +1 -0
- package/dist/src/graph/kg/db/queries.js +471 -0
- package/dist/src/graph/kg/db/queries.js.map +1 -0
- package/dist/src/graph/kg/db/types.d.ts +123 -0
- package/dist/src/graph/kg/db/types.d.ts.map +1 -0
- package/dist/src/graph/kg/db/types.js +75 -0
- package/dist/src/graph/kg/db/types.js.map +1 -0
- package/dist/src/graph/kg/engine.d.ts +87 -0
- package/dist/src/graph/kg/engine.d.ts.map +1 -0
- package/dist/src/graph/kg/engine.js +247 -0
- package/dist/src/graph/kg/engine.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/code-extractor.d.ts +42 -0
- package/dist/src/graph/kg/extraction/code/code-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/code-extractor.js +325 -0
- package/dist/src/graph/kg/extraction/code/code-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/dfm-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/code/dfm-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/dfm-extractor.js +122 -0
- package/dist/src/graph/kg/extraction/code/dfm-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/generated-detection.d.ts +14 -0
- package/dist/src/graph/kg/extraction/code/generated-detection.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/generated-detection.js +65 -0
- package/dist/src/graph/kg/extraction/code/generated-detection.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/languages/index.d.ts +9 -0
- package/dist/src/graph/kg/extraction/code/languages/index.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/languages/index.js +2119 -0
- package/dist/src/graph/kg/extraction/code/languages/index.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/languages/typescript.d.ts +5 -0
- package/dist/src/graph/kg/extraction/code/languages/typescript.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/languages/typescript.js +191 -0
- package/dist/src/graph/kg/extraction/code/languages/typescript.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/liquid-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/code/liquid-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/liquid-extractor.js +117 -0
- package/dist/src/graph/kg/extraction/code/liquid-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/mybatis-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/code/mybatis-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/mybatis-extractor.js +84 -0
- package/dist/src/graph/kg/extraction/code/mybatis-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts +35 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.js +573 -0
- package/dist/src/graph/kg/extraction/code/plugin-engine.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.d.ts +95 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.js +5 -0
- package/dist/src/graph/kg/extraction/code/plugin-types.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/svelte-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/code/svelte-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/svelte-extractor.js +92 -0
- package/dist/src/graph/kg/extraction/code/svelte-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter-types.d.ts +61 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter-types.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter-types.js +53 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter-types.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter.d.ts +55 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter.js +227 -0
- package/dist/src/graph/kg/extraction/code/tree-sitter.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/vue-extractor.d.ts +6 -0
- package/dist/src/graph/kg/extraction/code/vue-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/vue-extractor.js +109 -0
- package/dist/src/graph/kg/extraction/code/vue-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/code/wasm-stability.d.ts +44 -0
- package/dist/src/graph/kg/extraction/code/wasm-stability.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/code/wasm-stability.js +140 -0
- package/dist/src/graph/kg/extraction/code/wasm-stability.js.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/codebase-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/knowledge/codebase-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/codebase-extractor.js +149 -0
- package/dist/src/graph/kg/extraction/knowledge/codebase-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/domain-extractor.d.ts +4 -0
- package/dist/src/graph/kg/extraction/knowledge/domain-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/domain-extractor.js +114 -0
- package/dist/src/graph/kg/extraction/knowledge/domain-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/issue-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/knowledge/issue-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/issue-extractor.js +84 -0
- package/dist/src/graph/kg/extraction/knowledge/issue-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/spec-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/knowledge/spec-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/spec-extractor.js +173 -0
- package/dist/src/graph/kg/extraction/knowledge/spec-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/wiki-extractor.d.ts +3 -0
- package/dist/src/graph/kg/extraction/knowledge/wiki-extractor.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/knowledge/wiki-extractor.js +165 -0
- package/dist/src/graph/kg/extraction/knowledge/wiki-extractor.js.map +1 -0
- package/dist/src/graph/kg/extraction/orchestrator.d.ts +6 -0
- package/dist/src/graph/kg/extraction/orchestrator.d.ts.map +1 -0
- package/dist/src/graph/kg/extraction/orchestrator.js +220 -0
- package/dist/src/graph/kg/extraction/orchestrator.js.map +1 -0
- package/dist/src/graph/kg/index.d.ts +29 -0
- package/dist/src/graph/kg/index.d.ts.map +1 -0
- package/dist/src/graph/kg/index.js +35 -0
- package/dist/src/graph/kg/index.js.map +1 -0
- package/dist/src/graph/kg/query/context-builder.d.ts +38 -0
- package/dist/src/graph/kg/query/context-builder.d.ts.map +1 -0
- package/dist/src/graph/kg/query/context-builder.js +184 -0
- package/dist/src/graph/kg/query/context-builder.js.map +1 -0
- package/dist/src/graph/kg/query/index.d.ts +8 -0
- package/dist/src/graph/kg/query/index.d.ts.map +1 -0
- package/dist/src/graph/kg/query/index.js +6 -0
- package/dist/src/graph/kg/query/index.js.map +1 -0
- package/dist/src/graph/kg/query/scoring.d.ts +19 -0
- package/dist/src/graph/kg/query/scoring.d.ts.map +1 -0
- package/dist/src/graph/kg/query/scoring.js +158 -0
- package/dist/src/graph/kg/query/scoring.js.map +1 -0
- package/dist/src/graph/kg/query/search.d.ts +59 -0
- package/dist/src/graph/kg/query/search.d.ts.map +1 -0
- package/dist/src/graph/kg/query/search.js +158 -0
- package/dist/src/graph/kg/query/search.js.map +1 -0
- package/dist/src/graph/kg/query/traversal.d.ts +75 -0
- package/dist/src/graph/kg/query/traversal.d.ts.map +1 -0
- package/dist/src/graph/kg/query/traversal.js +420 -0
- package/dist/src/graph/kg/query/traversal.js.map +1 -0
- package/dist/src/graph/kg/resolution/callback-synthesizer.d.ts +41 -0
- package/dist/src/graph/kg/resolution/callback-synthesizer.d.ts.map +1 -0
- package/dist/src/graph/kg/resolution/callback-synthesizer.js +450 -0
- package/dist/src/graph/kg/resolution/callback-synthesizer.js.map +1 -0
- package/dist/src/graph/kg/resolution/frameworks/index.d.ts +18 -0
- package/dist/src/graph/kg/resolution/frameworks/index.d.ts.map +1 -0
- package/dist/src/graph/kg/resolution/frameworks/index.js +632 -0
- package/dist/src/graph/kg/resolution/frameworks/index.js.map +1 -0
- package/dist/src/graph/kg/resolution/import-resolver.d.ts +73 -0
- package/dist/src/graph/kg/resolution/import-resolver.d.ts.map +1 -0
- package/dist/src/graph/kg/resolution/import-resolver.js +257 -0
- package/dist/src/graph/kg/resolution/import-resolver.js.map +1 -0
- package/dist/src/graph/kg/resolution/index.d.ts +11 -0
- package/dist/src/graph/kg/resolution/index.d.ts.map +1 -0
- package/dist/src/graph/kg/resolution/index.js +7 -0
- package/dist/src/graph/kg/resolution/index.js.map +1 -0
- package/dist/src/graph/kg/resolution/knowledge-resolver.d.ts +22 -0
- package/dist/src/graph/kg/resolution/knowledge-resolver.d.ts.map +1 -0
- package/dist/src/graph/kg/resolution/knowledge-resolver.js +288 -0
- package/dist/src/graph/kg/resolution/knowledge-resolver.js.map +1 -0
- package/dist/src/graph/kg/resolution/name-matcher.d.ts +25 -0
- package/dist/src/graph/kg/resolution/name-matcher.d.ts.map +1 -0
- package/dist/src/graph/kg/resolution/name-matcher.js +162 -0
- package/dist/src/graph/kg/resolution/name-matcher.js.map +1 -0
- package/dist/src/graph/kg/schema.sql +215 -0
- package/dist/src/graph/kg/surface/cli.d.ts +3 -0
- package/dist/src/graph/kg/surface/cli.d.ts.map +1 -0
- package/dist/src/graph/kg/surface/cli.js +597 -0
- package/dist/src/graph/kg/surface/cli.js.map +1 -0
- package/dist/src/graph/kg/surface/hook-injector.d.ts +33 -0
- package/dist/src/graph/kg/surface/hook-injector.d.ts.map +1 -0
- package/dist/src/graph/kg/surface/hook-injector.js +172 -0
- package/dist/src/graph/kg/surface/hook-injector.js.map +1 -0
- package/dist/src/graph/kg/surface/index.d.ts +6 -0
- package/dist/src/graph/kg/surface/index.d.ts.map +1 -0
- package/dist/src/graph/kg/surface/index.js +5 -0
- package/dist/src/graph/kg/surface/index.js.map +1 -0
- package/dist/src/graph/kg/surface/mcp-tools.d.ts +20 -0
- package/dist/src/graph/kg/surface/mcp-tools.d.ts.map +1 -0
- package/dist/src/graph/kg/surface/mcp-tools.js +253 -0
- package/dist/src/graph/kg/surface/mcp-tools.js.map +1 -0
- package/dist/src/graph/kg/sync/incremental-sync.d.ts +24 -0
- package/dist/src/graph/kg/sync/incremental-sync.d.ts.map +1 -0
- package/dist/src/graph/kg/sync/incremental-sync.js +71 -0
- package/dist/src/graph/kg/sync/incremental-sync.js.map +1 -0
- package/dist/src/graph/kg/sync/index.d.ts +5 -0
- package/dist/src/graph/kg/sync/index.d.ts.map +1 -0
- package/dist/src/graph/kg/sync/index.js +4 -0
- package/dist/src/graph/kg/sync/index.js.map +1 -0
- package/dist/src/graph/kg/sync/watch-policy.d.ts +33 -0
- package/dist/src/graph/kg/sync/watch-policy.d.ts.map +1 -0
- package/dist/src/graph/kg/sync/watch-policy.js +90 -0
- package/dist/src/graph/kg/sync/watch-policy.js.map +1 -0
- package/dist/src/hooks/constants.d.ts +0 -2
- package/dist/src/hooks/constants.d.ts.map +1 -1
- package/dist/src/hooks/constants.js +0 -2
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/keyword-spec-injector.d.ts +6 -0
- package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/keyword-spec-injector.js +157 -81
- package/dist/src/hooks/keyword-spec-injector.js.map +1 -1
- package/dist/src/hooks/kg-auto-init.d.ts +13 -0
- package/dist/src/hooks/kg-auto-init.d.ts.map +1 -0
- package/dist/src/hooks/kg-auto-init.js +38 -0
- package/dist/src/hooks/kg-auto-init.js.map +1 -0
- package/dist/src/hooks/kg-context-injector.d.ts +1 -3
- package/dist/src/hooks/kg-context-injector.d.ts.map +1 -1
- package/dist/src/hooks/kg-context-injector.js +12 -17
- package/dist/src/hooks/kg-context-injector.js.map +1 -1
- package/dist/src/hooks/kg-sync-hook.d.ts +1 -9
- package/dist/src/hooks/kg-sync-hook.d.ts.map +1 -1
- package/dist/src/hooks/kg-sync-hook.js +21 -90
- package/dist/src/hooks/kg-sync-hook.js.map +1 -1
- package/dist/src/hooks/spec-analytics.d.ts +1 -0
- package/dist/src/hooks/spec-analytics.d.ts.map +1 -1
- package/dist/src/hooks/spec-analytics.js +1 -3
- package/dist/src/hooks/spec-analytics.js.map +1 -1
- package/dist/src/hooks/spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/spec-injector.js +65 -1
- package/dist/src/hooks/spec-injector.js.map +1 -1
- package/dist/src/hooks/workspace.d.ts +4 -2
- package/dist/src/hooks/workspace.d.ts.map +1 -1
- package/dist/src/hooks/workspace.js +6 -2
- package/dist/src/hooks/workspace.js.map +1 -1
- package/dist/src/i18n/locales/en.d.ts.map +1 -1
- package/dist/src/i18n/locales/en.js +52 -9
- package/dist/src/i18n/locales/en.js.map +1 -1
- package/dist/src/i18n/locales/zh.d.ts.map +1 -1
- package/dist/src/i18n/locales/zh.js +52 -9
- package/dist/src/i18n/locales/zh.js.map +1 -1
- package/dist/src/i18n/types.d.ts +40 -4
- package/dist/src/i18n/types.d.ts.map +1 -1
- package/dist/src/tools/__tests__/domain-search-debug.d.ts +2 -0
- package/dist/src/tools/__tests__/domain-search-debug.d.ts.map +1 -0
- package/dist/src/tools/__tests__/domain-search-debug.js +32 -0
- package/dist/src/tools/__tests__/domain-search-debug.js.map +1 -0
- package/dist/src/tools/domain-loader.d.ts +63 -0
- package/dist/src/tools/domain-loader.d.ts.map +1 -0
- package/dist/src/tools/domain-loader.js +295 -0
- package/dist/src/tools/domain-loader.js.map +1 -0
- package/dist/src/tools/domain-matcher.d.ts +24 -0
- package/dist/src/tools/domain-matcher.d.ts.map +1 -0
- package/dist/src/tools/domain-matcher.js +117 -0
- package/dist/src/tools/domain-matcher.js.map +1 -0
- package/dist/src/tools/domain-scanner.d.ts +32 -0
- package/dist/src/tools/domain-scanner.d.ts.map +1 -0
- package/dist/src/tools/domain-scanner.js +263 -0
- package/dist/src/tools/domain-scanner.js.map +1 -0
- package/dist/src/tools/domain-schema.d.ts +18 -0
- package/dist/src/tools/domain-schema.d.ts.map +1 -0
- package/dist/src/tools/domain-schema.js +104 -0
- package/dist/src/tools/domain-schema.js.map +1 -0
- package/dist/src/tools/spec-entry-parser.d.ts +1 -0
- package/dist/src/tools/spec-entry-parser.d.ts.map +1 -1
- package/dist/src/tools/spec-entry-parser.js +1 -0
- package/dist/src/tools/spec-entry-parser.js.map +1 -1
- package/dist/src/tools/spec-loader.d.ts +5 -0
- package/dist/src/tools/spec-loader.d.ts.map +1 -1
- package/dist/src/tools/spec-loader.js +10 -2
- package/dist/src/tools/spec-loader.js.map +1 -1
- package/dist/src/tui/install-ui/ConfigPanel.d.ts.map +1 -1
- package/dist/src/tui/install-ui/ConfigPanel.js +9 -1
- package/dist/src/tui/install-ui/ConfigPanel.js.map +1 -1
- package/dist/src/tui/install-ui/GroupedHub.d.ts +55 -0
- package/dist/src/tui/install-ui/GroupedHub.d.ts.map +1 -0
- package/dist/src/tui/install-ui/GroupedHub.js +210 -0
- package/dist/src/tui/install-ui/GroupedHub.js.map +1 -0
- package/dist/src/tui/install-ui/HooksConfig.d.ts +10 -5
- package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -1
- package/dist/src/tui/install-ui/HooksConfig.js +83 -18
- package/dist/src/tui/install-ui/HooksConfig.js.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.d.ts +1 -30
- package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js +72 -12
- package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.d.ts +4 -21
- package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.js +89 -260
- package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts +3 -7
- package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.js +45 -267
- package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallHub.js +2 -4
- package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.js +1 -5
- package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
- package/dist/src/tui/install-ui/index.d.ts +5 -1
- package/dist/src/tui/install-ui/index.d.ts.map +1 -1
- package/dist/src/tui/install-ui/index.js +1 -0
- package/dist/src/tui/install-ui/index.js.map +1 -1
- package/dist/src/tui/install-ui/types.d.ts +39 -0
- package/dist/src/tui/install-ui/types.d.ts.map +1 -1
- package/dist/src/tui/install-ui/types.js +1 -1
- package/dist/src/tui/install-ui/types.js.map +1 -1
- package/dist/src/tui/install-ui/useInstallFlowState.d.ts +69 -0
- package/dist/src/tui/install-ui/useInstallFlowState.d.ts.map +1 -0
- package/dist/src/tui/install-ui/useInstallFlowState.js +288 -0
- package/dist/src/tui/install-ui/useInstallFlowState.js.map +1 -0
- package/dist/src/tui/shared/components.d.ts +4 -0
- package/dist/src/tui/shared/components.d.ts.map +1 -1
- package/dist/src/tui/shared/components.js +4 -0
- package/dist/src/tui/shared/components.js.map +1 -1
- package/dist/src/tui/shared/index.d.ts +1 -1
- package/dist/src/tui/shared/index.d.ts.map +1 -1
- package/dist/src/tui/shared/index.js +1 -1
- package/dist/src/tui/shared/index.js.map +1 -1
- package/dist/src/tui/shared/tokens.d.ts +5 -5
- package/dist/src/tui/shared/tokens.js +5 -5
- package/dist/src/tui/shared/tokens.js.map +1 -1
- package/dist/src/types/index.d.ts +9 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/utils/cli-format.d.ts +2 -1
- package/dist/src/utils/cli-format.d.ts.map +1 -1
- package/dist/src/utils/cli-format.js +14 -3
- package/dist/src/utils/cli-format.js.map +1 -1
- package/dist/src/utils/cooldown-guard.d.ts +17 -0
- package/dist/src/utils/cooldown-guard.d.ts.map +1 -0
- package/dist/src/utils/cooldown-guard.js +59 -0
- package/dist/src/utils/cooldown-guard.js.map +1 -0
- package/dist/src/utils/jsonl-log.d.ts.map +1 -1
- package/dist/src/utils/jsonl-log.js +2 -1
- package/dist/src/utils/jsonl-log.js.map +1 -1
- package/dist/src/utils/update-notices.js +17 -4
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +91 -92
- package/workflows/analyze.md +25 -49
- package/workflows/auto-test.md +699 -699
- package/workflows/blueprint.md +403 -431
- package/workflows/brainstorm.md +54 -195
- package/workflows/business-test.md +570 -570
- package/workflows/claude-instructions.md +23 -28
- package/workflows/codex-instructions.md +30 -58
- package/workflows/coding-philosophy.md +69 -69
- package/workflows/command-authoring.md +823 -823
- package/workflows/debug.md +43 -98
- package/workflows/delegate-usage.md +39 -241
- package/workflows/execute.md +4 -53
- package/workflows/finish-work.md +25 -0
- package/workflows/grill.md +12 -56
- package/workflows/harvest.md +22 -68
- package/workflows/init.md +148 -148
- package/workflows/instruction-authoring-guide.md +97 -0
- package/workflows/issue-execute.md +110 -110
- package/workflows/issue-gaps-analyze.codex.md +260 -260
- package/workflows/issue-gaps-analyze.md +216 -216
- package/workflows/issue-plan.md +110 -110
- package/workflows/issue.md +338 -346
- package/workflows/knowhow.md +0 -32
- package/workflows/learn.md +277 -277
- package/workflows/maestro-chain-execute.md +20 -20
- package/workflows/refactor.md +22 -44
- package/workflows/retrospective.md +16 -65
- package/workflows/review.md +446 -486
- package/workflows/roadmap.md +35 -132
- package/workflows/skill-authoring.md +265 -265
- package/workflows/spec-generate.md +470 -470
- package/workflows/specs-remove.md +104 -104
- package/workflows/sync.md +11 -41
- package/workflows/test-gen.md +226 -226
- package/workflows/test.md +385 -475
- package/workflows/ui-design.md +391 -391
- package/workflows/ui-style.md +199 -199
- package/workflows/updates/update-v3-setup.md +7 -15
- package/workflows/wiki-connect.md +151 -151
- package/workflows/wiki-digest.md +178 -178
- package/workflows/wiki-manage.md +109 -109
- package/dashboard/dist/assets/McpPage-Im6s4pGR.js +0 -21
- package/dashboard/dist/assets/SpecsPage-gr4KX51-.js +0 -36
- package/dashboard/dist/assets/folder-B8ODoZfb.js +0 -16
- package/dashboard/dist/assets/index-6-yE5Yl9.css +0 -1
- package/dashboard/dist/assets/pen-line-CR8GaHt-.js +0 -6
- package/workflows/cli-tools-usage.md +0 -252
- package/workflows/delegate-protocol.codex.md +0 -65
|
@@ -0,0 +1,2119 @@
|
|
|
1
|
+
// src/graph/kg/extraction/code/languages/index.ts
|
|
2
|
+
// 19 语言提取器注册表
|
|
3
|
+
// 参考: codegraph/src/extraction/languages/*.ts (逐文件复用)
|
|
4
|
+
import { typescriptExtractor, javascriptExtractor, tsxExtractor } from './typescript.js';
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// 基础提取器模板 — 用于尚未移植的语言 (复用通用逻辑)
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
function createGenericExtractor(language, grammarName, nodeTypeMap) {
|
|
9
|
+
return {
|
|
10
|
+
language,
|
|
11
|
+
grammarName,
|
|
12
|
+
nodeTypeMap,
|
|
13
|
+
extract(tree, sourceCode, filePath) {
|
|
14
|
+
// 通用提取: 遍历 AST, 按 nodeTypeMap 映射符号
|
|
15
|
+
const symbols = [];
|
|
16
|
+
const references = [];
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
const rootNode = tree.rootNode;
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
const walk = (node, parentQualifiedName) => {
|
|
21
|
+
const kind = nodeTypeMap[node.type];
|
|
22
|
+
const startRow = (node.startPosition?.row ?? 0) + 1;
|
|
23
|
+
const endRow = (node.endPosition?.row ?? 0) + 1;
|
|
24
|
+
if (kind) {
|
|
25
|
+
// 通用 name 提取: 查找 name/identifier 子节点
|
|
26
|
+
const nameNode = node.childForFieldName?.('name') ??
|
|
27
|
+
node.children?.find((c) => // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
28
|
+
c.type === 'identifier' || c.type === 'name' || c.type === 'type_identifier');
|
|
29
|
+
if (nameNode?.text) {
|
|
30
|
+
const name = nameNode.text;
|
|
31
|
+
const qualifiedName = parentQualifiedName ? `${parentQualifiedName}.${name}` : name;
|
|
32
|
+
symbols.push({
|
|
33
|
+
kind, name, qualifiedName, filePath, language,
|
|
34
|
+
startLine: startRow, endLine: endRow,
|
|
35
|
+
startColumn: (node.startPosition?.column ?? 0) + 1,
|
|
36
|
+
endColumn: (node.endPosition?.column ?? 0) + 1,
|
|
37
|
+
docstring: '', signature: '',
|
|
38
|
+
visibility: '', isExported: false, isAsync: false,
|
|
39
|
+
isStatic: false, isAbstract: false,
|
|
40
|
+
decorators: [], typeParameters: [],
|
|
41
|
+
});
|
|
42
|
+
// 递归子节点
|
|
43
|
+
for (const child of node.namedChildren ?? []) {
|
|
44
|
+
walk(child, qualifiedName);
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (const child of node.namedChildren ?? []) {
|
|
50
|
+
walk(child, parentQualifiedName);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
walk(rootNode, '');
|
|
54
|
+
return { symbols, references, edges: [] };
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// 语言提取器注册表
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
const EXTRACTOR_REGISTRY = new Map();
|
|
62
|
+
// 已完整移植的提取器
|
|
63
|
+
EXTRACTOR_REGISTRY.set('typescript', typescriptExtractor);
|
|
64
|
+
EXTRACTOR_REGISTRY.set('javascript', javascriptExtractor);
|
|
65
|
+
EXTRACTOR_REGISTRY.set('tsx', tsxExtractor);
|
|
66
|
+
EXTRACTOR_REGISTRY.set('jsx', { ...javascriptExtractor, language: 'jsx' });
|
|
67
|
+
/** 查找子节点 (按 field name 或 type) */
|
|
68
|
+
function findChild(node, fieldOrType) {
|
|
69
|
+
return node.childForFieldName?.(fieldOrType) ??
|
|
70
|
+
node.children?.find((c) => c.type === fieldOrType) ?? null;
|
|
71
|
+
}
|
|
72
|
+
/** 提取节点名 */
|
|
73
|
+
function nodeName(node) {
|
|
74
|
+
const n = node.childForFieldName?.('name') ??
|
|
75
|
+
node.children?.find((c) => c.type === 'identifier' || c.type === 'name' || c.type === 'type_identifier');
|
|
76
|
+
return n?.text ?? null;
|
|
77
|
+
}
|
|
78
|
+
/** 取节点第一行文本作为 signature */
|
|
79
|
+
function firstLine(node, maxLen = 200) {
|
|
80
|
+
return (node.text || '').split('\n')[0]?.trim().substring(0, maxLen) ?? '';
|
|
81
|
+
}
|
|
82
|
+
/** 检查子节点列表是否包含某个 type */
|
|
83
|
+
function hasChildType(node, type) {
|
|
84
|
+
return node.children?.some((c) => c.type === type) ?? false;
|
|
85
|
+
}
|
|
86
|
+
/** 收集所有特定 type 的子节点 text */
|
|
87
|
+
function collectChildTexts(node, type) {
|
|
88
|
+
return (node.children ?? []).filter((c) => c.type === type).map((c) => c.text);
|
|
89
|
+
}
|
|
90
|
+
/** 获取前一个兄弟节点 (comment 提取用) */
|
|
91
|
+
function prevSibling(node) {
|
|
92
|
+
return node.previousNamedSibling ?? null;
|
|
93
|
+
}
|
|
94
|
+
/** 通用 make symbol */
|
|
95
|
+
function sym(kind, name, qualifiedName, filePath, lang, node, extra = {}) {
|
|
96
|
+
return {
|
|
97
|
+
kind, name, qualifiedName, filePath, language: lang,
|
|
98
|
+
startLine: (node.startPosition?.row ?? 0) + 1,
|
|
99
|
+
endLine: (node.endPosition?.row ?? 0) + 1,
|
|
100
|
+
startColumn: (node.startPosition?.column ?? 0) + 1,
|
|
101
|
+
endColumn: (node.endPosition?.column ?? 0) + 1,
|
|
102
|
+
docstring: '', signature: '', visibility: '',
|
|
103
|
+
isExported: false, isAsync: false, isStatic: false, isAbstract: false,
|
|
104
|
+
decorators: [], typeParameters: [],
|
|
105
|
+
...extra,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** 从 modifier 列表提取可见性/标志 — Java/C#/Kotlin/PHP 等 C-family 语言通用 */
|
|
109
|
+
function extractCFamilyModifiers(node) {
|
|
110
|
+
let visibility = '', isStatic = false, isAbstract = false, isAsync = false, isExported = false;
|
|
111
|
+
const mods = node.childForFieldName?.('modifiers') ?? findChild(node, 'modifier');
|
|
112
|
+
for (const m of (mods?.children ?? mods?.namedChildren ?? [])) {
|
|
113
|
+
const t = m.type === 'modifier' ? m.text : m.type;
|
|
114
|
+
switch (t) {
|
|
115
|
+
case 'public':
|
|
116
|
+
visibility = 'public';
|
|
117
|
+
break;
|
|
118
|
+
case 'private':
|
|
119
|
+
visibility = 'private';
|
|
120
|
+
break;
|
|
121
|
+
case 'protected':
|
|
122
|
+
visibility = 'protected';
|
|
123
|
+
break;
|
|
124
|
+
case 'internal':
|
|
125
|
+
visibility = 'internal';
|
|
126
|
+
break;
|
|
127
|
+
case 'static':
|
|
128
|
+
isStatic = true;
|
|
129
|
+
break;
|
|
130
|
+
case 'abstract':
|
|
131
|
+
isAbstract = true;
|
|
132
|
+
break;
|
|
133
|
+
case 'async':
|
|
134
|
+
isAsync = true;
|
|
135
|
+
break;
|
|
136
|
+
case 'export':
|
|
137
|
+
isExported = true;
|
|
138
|
+
break;
|
|
139
|
+
case 'virtual': break; // C# virtual
|
|
140
|
+
default: break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { visibility, isStatic, isAbstract, isAsync, isExported };
|
|
144
|
+
}
|
|
145
|
+
/** 提取装饰器/注解名 — 适用于 decorator/annotation 子节点 */
|
|
146
|
+
function extractDecorators(node, decoratorType = 'decorator') {
|
|
147
|
+
const decorators = [];
|
|
148
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
149
|
+
if (c.type === decoratorType || c.type === 'annotation' || c.type === 'attribute') {
|
|
150
|
+
const nameNode = c.childForFieldName?.('name') ??
|
|
151
|
+
c.children?.find((x) => x.type === 'identifier' || x.type === 'scoped_identifier');
|
|
152
|
+
decorators.push(nameNode?.text ?? c.text);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// 也检查父 decorated_definition
|
|
156
|
+
if (node.parent?.type === 'decorated_definition') {
|
|
157
|
+
for (const c of (node.parent.namedChildren ?? [])) {
|
|
158
|
+
if (c.type === 'decorator') {
|
|
159
|
+
const nameNode = c.childForFieldName?.('name') ?? findChild(c, 'identifier');
|
|
160
|
+
decorators.push(nameNode?.text ?? c.text);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return decorators;
|
|
165
|
+
}
|
|
166
|
+
// ---------------------------------------------------------------------------
|
|
167
|
+
// 1. Python — decorators, async def, docstrings, visibility, imports
|
|
168
|
+
// ---------------------------------------------------------------------------
|
|
169
|
+
const PYTHON_NODE_MAP = {
|
|
170
|
+
'function_definition': 'function', 'class_definition': 'class',
|
|
171
|
+
'decorated_definition': '_decorated', // 中间节点, 展开处理
|
|
172
|
+
'import_statement': 'import', 'import_from_statement': 'import',
|
|
173
|
+
};
|
|
174
|
+
EXTRACTOR_REGISTRY.set('python', {
|
|
175
|
+
language: 'python', grammarName: 'python', nodeTypeMap: PYTHON_NODE_MAP,
|
|
176
|
+
extract(tree, _src, filePath) {
|
|
177
|
+
const lang = 'python';
|
|
178
|
+
const symbols = [];
|
|
179
|
+
const references = [];
|
|
180
|
+
const walk = (node, parent) => {
|
|
181
|
+
const type = node.type;
|
|
182
|
+
// decorated_definition — 展开内部定义, 收集装饰器
|
|
183
|
+
if (type === 'decorated_definition') {
|
|
184
|
+
const decos = [];
|
|
185
|
+
let inner = null;
|
|
186
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
187
|
+
if (c.type === 'decorator') {
|
|
188
|
+
const n = c.childForFieldName?.('name') ?? findChild(c, 'identifier') ?? findChild(c, 'attribute');
|
|
189
|
+
decos.push(n?.text ?? c.text.replace(/^@/, ''));
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
inner = c;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (inner) {
|
|
196
|
+
// 传递装饰器到内部处理
|
|
197
|
+
inner.__decos = decos;
|
|
198
|
+
walk(inner, parent);
|
|
199
|
+
}
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (type === 'function_definition' || type === 'class_definition') {
|
|
203
|
+
const name = nodeName(node);
|
|
204
|
+
if (!name) {
|
|
205
|
+
walkChildren(node, parent);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
209
|
+
const isMethod = type === 'function_definition' && parent !== '';
|
|
210
|
+
const kind = isMethod ? 'method' : (type === 'function_definition' ? 'function' : 'class');
|
|
211
|
+
// decorators
|
|
212
|
+
const decos = node.__decos ?? [];
|
|
213
|
+
const isAsync = hasChildType(node, 'async');
|
|
214
|
+
const isStatic = decos.includes('staticmethod') || decos.includes('classmethod');
|
|
215
|
+
const isAbstract = decos.includes('abstractmethod');
|
|
216
|
+
const isProperty = decos.includes('property');
|
|
217
|
+
const visibility = name.startsWith('__') && !name.endsWith('__') ? 'private' :
|
|
218
|
+
name.startsWith('_') ? 'protected' : 'public';
|
|
219
|
+
// docstring: first expression_statement > string in body
|
|
220
|
+
let docstring = '';
|
|
221
|
+
const body = findChild(node, 'body') ?? findChild(node, 'block');
|
|
222
|
+
if (body) {
|
|
223
|
+
const firstStmt = body.namedChildren?.[0];
|
|
224
|
+
if (firstStmt?.type === 'expression_statement') {
|
|
225
|
+
const strNode = firstStmt.namedChildren?.[0];
|
|
226
|
+
if (strNode?.type === 'string' || strNode?.type === 'concatenated_string') {
|
|
227
|
+
docstring = strNode.text.replace(/^['\"]{1,3}|['\"]{1,3}$/g, '').trim();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
symbols.push(sym(isProperty ? 'property' : kind, name, qn, filePath, lang, node, {
|
|
232
|
+
visibility, isAsync, isStatic, isAbstract,
|
|
233
|
+
decorators: decos, docstring,
|
|
234
|
+
signature: firstLine(node),
|
|
235
|
+
}));
|
|
236
|
+
walkChildren(node, qn);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
// import
|
|
240
|
+
if (type === 'import_statement' || type === 'import_from_statement') {
|
|
241
|
+
const mod = findChild(node, 'module_name') ?? findChild(node, 'dotted_name');
|
|
242
|
+
references.push({
|
|
243
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
244
|
+
referenceName: mod?.text ?? node.text, referenceKind: 'imports',
|
|
245
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
246
|
+
filePath, language: lang,
|
|
247
|
+
});
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
walkChildren(node, parent);
|
|
251
|
+
};
|
|
252
|
+
const walkChildren = (node, parent) => {
|
|
253
|
+
for (const c of (node.namedChildren ?? []))
|
|
254
|
+
walk(c, parent);
|
|
255
|
+
};
|
|
256
|
+
walk(tree.rootNode, '');
|
|
257
|
+
return { symbols, references, edges: [] };
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
// ---------------------------------------------------------------------------
|
|
261
|
+
// 2. Go — receiver methods, interfaces, structs, goroutine, imports
|
|
262
|
+
// ---------------------------------------------------------------------------
|
|
263
|
+
const GO_NODE_MAP = {
|
|
264
|
+
'function_declaration': 'function', 'method_declaration': 'method',
|
|
265
|
+
'type_declaration': 'type_alias', 'type_spec': 'type_alias',
|
|
266
|
+
'struct_type': 'struct', 'interface_type': 'interface',
|
|
267
|
+
'import_declaration': 'import', 'import_spec': 'import',
|
|
268
|
+
};
|
|
269
|
+
EXTRACTOR_REGISTRY.set('go', {
|
|
270
|
+
language: 'go', grammarName: 'go', nodeTypeMap: GO_NODE_MAP,
|
|
271
|
+
extract(tree, _src, filePath) {
|
|
272
|
+
const lang = 'go';
|
|
273
|
+
const symbols = [];
|
|
274
|
+
const references = [];
|
|
275
|
+
const walk = (node, parent) => {
|
|
276
|
+
const type = node.type;
|
|
277
|
+
if (type === 'function_declaration') {
|
|
278
|
+
const name = nodeName(node);
|
|
279
|
+
if (!name) {
|
|
280
|
+
walkChildren(node, parent);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
284
|
+
const isExported = name[0] === name[0].toUpperCase() && name[0] !== '_';
|
|
285
|
+
symbols.push(sym('function', name, qn, filePath, lang, node, {
|
|
286
|
+
isExported, visibility: isExported ? 'public' : 'package',
|
|
287
|
+
signature: firstLine(node),
|
|
288
|
+
}));
|
|
289
|
+
walkChildren(node, qn);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (type === 'method_declaration') {
|
|
293
|
+
const name = nodeName(node);
|
|
294
|
+
if (!name) {
|
|
295
|
+
walkChildren(node, parent);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
// 提取 receiver type: func (r *ReceiverType) Name()
|
|
299
|
+
const receiver = node.childForFieldName?.('receiver');
|
|
300
|
+
let receiverType = '';
|
|
301
|
+
if (receiver) {
|
|
302
|
+
const paramList = receiver.namedChildren ?? [];
|
|
303
|
+
for (const p of paramList) {
|
|
304
|
+
const typeNode = p.childForFieldName?.('type') ?? findChild(p, 'type_identifier') ?? findChild(p, 'pointer_type');
|
|
305
|
+
if (typeNode) {
|
|
306
|
+
receiverType = typeNode.text.replace(/^\*/, '');
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const qn = receiverType ? `${receiverType}.${name}` : (parent ? `${parent}.${name}` : name);
|
|
312
|
+
const isExported = name[0] === name[0].toUpperCase() && name[0] !== '_';
|
|
313
|
+
symbols.push(sym('method', name, qn, filePath, lang, node, {
|
|
314
|
+
isExported, visibility: isExported ? 'public' : 'package',
|
|
315
|
+
signature: firstLine(node),
|
|
316
|
+
}));
|
|
317
|
+
walkChildren(node, qn);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (type === 'type_spec') {
|
|
321
|
+
const name = nodeName(node);
|
|
322
|
+
if (!name) {
|
|
323
|
+
walkChildren(node, parent);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
327
|
+
const isExported = name[0] === name[0].toUpperCase() && name[0] !== '_';
|
|
328
|
+
// 判断 struct vs interface vs type_alias
|
|
329
|
+
const bodyType = node.namedChildren?.find((c) => c.type === 'struct_type' || c.type === 'interface_type');
|
|
330
|
+
const kind = bodyType?.type === 'struct_type' ? 'struct' :
|
|
331
|
+
bodyType?.type === 'interface_type' ? 'interface' : 'type_alias';
|
|
332
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
333
|
+
isExported, visibility: isExported ? 'public' : 'package',
|
|
334
|
+
signature: firstLine(node),
|
|
335
|
+
}));
|
|
336
|
+
// 遍历 struct/interface 内部 field
|
|
337
|
+
if (bodyType)
|
|
338
|
+
walkChildren(bodyType, qn);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (type === 'import_spec') {
|
|
342
|
+
const path = findChild(node, 'path') ?? node.namedChildren?.[node.namedChildren.length - 1];
|
|
343
|
+
references.push({
|
|
344
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
345
|
+
referenceName: (path?.text ?? '').replace(/"/g, ''),
|
|
346
|
+
referenceKind: 'imports',
|
|
347
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
348
|
+
filePath, language: lang,
|
|
349
|
+
});
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
// go func() — goroutine detection
|
|
353
|
+
if (type === 'go_statement') {
|
|
354
|
+
const fnNode = findChild(node, 'func_literal') ?? findChild(node, 'call_expression');
|
|
355
|
+
if (fnNode) {
|
|
356
|
+
symbols.push(sym('function', '<goroutine>', parent ? `${parent}.<goroutine>` : '<goroutine>', filePath, lang, node, { isAsync: true, signature: firstLine(node) }));
|
|
357
|
+
}
|
|
358
|
+
walkChildren(node, parent);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
walkChildren(node, parent);
|
|
362
|
+
};
|
|
363
|
+
const walkChildren = (node, parent) => {
|
|
364
|
+
for (const c of (node.namedChildren ?? []))
|
|
365
|
+
walk(c, parent);
|
|
366
|
+
};
|
|
367
|
+
walk(tree.rootNode, '');
|
|
368
|
+
return { symbols, references, edges: [] };
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
// ---------------------------------------------------------------------------
|
|
372
|
+
// 3. Java — annotations, visibility, extends/implements, generics, imports
|
|
373
|
+
// ---------------------------------------------------------------------------
|
|
374
|
+
const JAVA_NODE_MAP = {
|
|
375
|
+
'method_declaration': 'method', 'constructor_declaration': 'method',
|
|
376
|
+
'class_declaration': 'class', 'interface_declaration': 'interface',
|
|
377
|
+
'enum_declaration': 'enum', 'enum_constant': 'enum_member',
|
|
378
|
+
'annotation_type_declaration': 'interface',
|
|
379
|
+
'import_declaration': 'import', 'field_declaration': 'field',
|
|
380
|
+
'record_declaration': 'class',
|
|
381
|
+
};
|
|
382
|
+
EXTRACTOR_REGISTRY.set('java', {
|
|
383
|
+
language: 'java', grammarName: 'java', nodeTypeMap: JAVA_NODE_MAP,
|
|
384
|
+
extract(tree, _src, filePath) {
|
|
385
|
+
const lang = 'java';
|
|
386
|
+
const symbols = [];
|
|
387
|
+
const references = [];
|
|
388
|
+
const edges = [];
|
|
389
|
+
const walk = (node, parent) => {
|
|
390
|
+
const type = node.type;
|
|
391
|
+
const kind = JAVA_NODE_MAP[type];
|
|
392
|
+
if (kind === 'import') {
|
|
393
|
+
const scopedId = findChild(node, 'scoped_identifier');
|
|
394
|
+
references.push({
|
|
395
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
396
|
+
referenceName: scopedId?.text ?? node.text.replace(/^import\s+|;$/g, '').trim(),
|
|
397
|
+
referenceKind: 'imports',
|
|
398
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
399
|
+
filePath, language: lang,
|
|
400
|
+
});
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
if (kind && kind !== 'import') {
|
|
404
|
+
const name = nodeName(node);
|
|
405
|
+
if (!name) {
|
|
406
|
+
walkChildren(node, parent);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
410
|
+
const mods = extractCFamilyModifiers(node);
|
|
411
|
+
const decos = extractDecorators(node, 'marker_annotation');
|
|
412
|
+
// Also check 'annotation' type
|
|
413
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
414
|
+
if (c.type === 'annotation' || c.type === 'marker_annotation') {
|
|
415
|
+
const dn = c.childForFieldName?.('name') ?? findChild(c, 'identifier');
|
|
416
|
+
if (dn?.text && !decos.includes(dn.text))
|
|
417
|
+
decos.push(dn.text);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// generic type parameters
|
|
421
|
+
const typeParams = [];
|
|
422
|
+
const tpNode = findChild(node, 'type_parameters');
|
|
423
|
+
if (tpNode)
|
|
424
|
+
typeParams.push(tpNode.text);
|
|
425
|
+
// extends / implements edges
|
|
426
|
+
const superclass = findChild(node, 'superclass');
|
|
427
|
+
if (superclass) {
|
|
428
|
+
const superName = findChild(superclass, 'type_identifier')?.text ?? superclass.text;
|
|
429
|
+
edges.push({ source: qn, target: superName, kind: 'extends', line: (node.startPosition?.row ?? 0) + 1 });
|
|
430
|
+
}
|
|
431
|
+
const interfaces = findChild(node, 'interfaces') ?? findChild(node, 'super_interfaces');
|
|
432
|
+
if (interfaces) {
|
|
433
|
+
for (const iface of (interfaces.namedChildren ?? [])) {
|
|
434
|
+
const ifaceName = findChild(iface, 'type_identifier')?.text ?? iface.text;
|
|
435
|
+
edges.push({ source: qn, target: ifaceName, kind: 'implements', line: (node.startPosition?.row ?? 0) + 1 });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
// docstring from preceding comment
|
|
439
|
+
let docstring = '';
|
|
440
|
+
const prev = prevSibling(node);
|
|
441
|
+
if (prev?.type === 'block_comment' || prev?.type === 'comment') {
|
|
442
|
+
docstring = prev.text.replace(/^\/\*\*?|\*\/$/g, '').replace(/^\s*\*\s?/gm, '').trim();
|
|
443
|
+
}
|
|
444
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
445
|
+
...mods, decorators: decos, typeParameters: typeParams,
|
|
446
|
+
signature: firstLine(node), docstring,
|
|
447
|
+
}));
|
|
448
|
+
walkChildren(node, qn);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
walkChildren(node, parent);
|
|
452
|
+
};
|
|
453
|
+
const walkChildren = (node, parent) => {
|
|
454
|
+
for (const c of (node.namedChildren ?? []))
|
|
455
|
+
walk(c, parent);
|
|
456
|
+
};
|
|
457
|
+
walk(tree.rootNode, '');
|
|
458
|
+
return { symbols, references, edges };
|
|
459
|
+
},
|
|
460
|
+
});
|
|
461
|
+
// ---------------------------------------------------------------------------
|
|
462
|
+
// 4. Rust — impl blocks, pub visibility, traits, async fn, use, derive
|
|
463
|
+
// ---------------------------------------------------------------------------
|
|
464
|
+
const RUST_NODE_MAP = {
|
|
465
|
+
'function_item': 'function', 'struct_item': 'struct', 'enum_item': 'enum',
|
|
466
|
+
'trait_item': 'trait', 'impl_item': '_impl', 'type_item': 'type_alias',
|
|
467
|
+
'use_declaration': 'import', 'mod_item': 'module',
|
|
468
|
+
'const_item': 'variable', 'static_item': 'variable',
|
|
469
|
+
'macro_definition': 'function',
|
|
470
|
+
};
|
|
471
|
+
EXTRACTOR_REGISTRY.set('rust', {
|
|
472
|
+
language: 'rust', grammarName: 'rust', nodeTypeMap: RUST_NODE_MAP,
|
|
473
|
+
extract(tree, _src, filePath) {
|
|
474
|
+
const lang = 'rust';
|
|
475
|
+
const symbols = [];
|
|
476
|
+
const references = [];
|
|
477
|
+
const edges = [];
|
|
478
|
+
const walk = (node, parent) => {
|
|
479
|
+
const type = node.type;
|
|
480
|
+
if (type === 'use_declaration') {
|
|
481
|
+
const arg = findChild(node, 'use_list') ?? findChild(node, 'scoped_identifier') ?? findChild(node, 'identifier');
|
|
482
|
+
references.push({
|
|
483
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
484
|
+
referenceName: arg?.text ?? node.text.replace(/^use\s+|;$/g, '').trim(),
|
|
485
|
+
referenceKind: 'imports',
|
|
486
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
487
|
+
filePath, language: lang,
|
|
488
|
+
});
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (type === 'impl_item') {
|
|
492
|
+
// impl Type { ... } or impl Trait for Type { ... }
|
|
493
|
+
const typeName = node.childForFieldName?.('type')?.text?.replace(/^\*/, '') ?? '';
|
|
494
|
+
const traitNode = node.childForFieldName?.('trait');
|
|
495
|
+
const implParent = typeName || parent;
|
|
496
|
+
if (traitNode) {
|
|
497
|
+
edges.push({ source: typeName, target: traitNode.text, kind: 'implements',
|
|
498
|
+
line: (node.startPosition?.row ?? 0) + 1 });
|
|
499
|
+
}
|
|
500
|
+
// 遍历 impl body
|
|
501
|
+
const body = findChild(node, 'declaration_list');
|
|
502
|
+
if (body) {
|
|
503
|
+
for (const c of (body.namedChildren ?? []))
|
|
504
|
+
walk(c, implParent);
|
|
505
|
+
}
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
if (type === 'function_item') {
|
|
509
|
+
const name = nodeName(node);
|
|
510
|
+
if (!name) {
|
|
511
|
+
walkChildren(node, parent);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
515
|
+
const kind = parent ? 'method' : 'function';
|
|
516
|
+
// visibility
|
|
517
|
+
const visNode = findChild(node, 'visibility_modifier');
|
|
518
|
+
const visibility = visNode ? (visNode.text === 'pub' ? 'public' : visNode.text.includes('crate') ? 'pub(crate)' : visNode.text) : '';
|
|
519
|
+
const isExported = visibility === 'public';
|
|
520
|
+
const isAsync = hasChildType(node, 'async');
|
|
521
|
+
// derive/attribute decorators on parent or self
|
|
522
|
+
const decos = extractDecorators(node, 'attribute_item');
|
|
523
|
+
// doc comment
|
|
524
|
+
let docstring = '';
|
|
525
|
+
const prev = prevSibling(node);
|
|
526
|
+
if (prev?.type === 'line_comment' && prev.text.startsWith('///')) {
|
|
527
|
+
docstring = prev.text.replace(/^\/\/\/\s?/, '').trim();
|
|
528
|
+
}
|
|
529
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
530
|
+
visibility, isExported, isAsync, decorators: decos,
|
|
531
|
+
signature: firstLine(node), docstring,
|
|
532
|
+
}));
|
|
533
|
+
walkChildren(node, qn);
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (type === 'struct_item' || type === 'enum_item' || type === 'trait_item' || type === 'mod_item') {
|
|
537
|
+
const name = nodeName(node);
|
|
538
|
+
if (!name) {
|
|
539
|
+
walkChildren(node, parent);
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
543
|
+
const kind = type === 'struct_item' ? 'struct' : type === 'enum_item' ? 'enum' :
|
|
544
|
+
type === 'trait_item' ? 'trait' : 'module';
|
|
545
|
+
const visNode = findChild(node, 'visibility_modifier');
|
|
546
|
+
const visibility = visNode ? (visNode.text === 'pub' ? 'public' : visNode.text) : '';
|
|
547
|
+
const isExported = visibility === 'public';
|
|
548
|
+
// derive macros as decorators
|
|
549
|
+
const decos = [];
|
|
550
|
+
const prev = prevSibling(node);
|
|
551
|
+
if (prev?.type === 'attribute_item' && prev.text.includes('derive')) {
|
|
552
|
+
const match = prev.text.match(/derive\(([^)]+)\)/);
|
|
553
|
+
if (match)
|
|
554
|
+
decos.push(...match[1].split(',').map((s) => s.trim()));
|
|
555
|
+
}
|
|
556
|
+
// generic type params
|
|
557
|
+
const typeParams = [];
|
|
558
|
+
const tpNode = findChild(node, 'type_parameters');
|
|
559
|
+
if (tpNode)
|
|
560
|
+
typeParams.push(tpNode.text);
|
|
561
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
562
|
+
visibility, isExported, decorators: decos, typeParameters: typeParams,
|
|
563
|
+
signature: firstLine(node),
|
|
564
|
+
}));
|
|
565
|
+
walkChildren(node, qn);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
walkChildren(node, parent);
|
|
569
|
+
};
|
|
570
|
+
const walkChildren = (node, parent) => {
|
|
571
|
+
for (const c of (node.namedChildren ?? []))
|
|
572
|
+
walk(c, parent);
|
|
573
|
+
};
|
|
574
|
+
walk(tree.rootNode, '');
|
|
575
|
+
return { symbols, references, edges };
|
|
576
|
+
},
|
|
577
|
+
});
|
|
578
|
+
// ---------------------------------------------------------------------------
|
|
579
|
+
// 5. C# — visibility, modifiers, attributes, namespace, using, properties
|
|
580
|
+
// ---------------------------------------------------------------------------
|
|
581
|
+
const CSHARP_NODE_MAP = {
|
|
582
|
+
'method_declaration': 'method', 'constructor_declaration': 'method',
|
|
583
|
+
'class_declaration': 'class', 'interface_declaration': 'interface',
|
|
584
|
+
'enum_declaration': 'enum', 'struct_declaration': 'struct',
|
|
585
|
+
'namespace_declaration': 'namespace', 'record_declaration': 'class',
|
|
586
|
+
'property_declaration': 'property', 'field_declaration': 'field',
|
|
587
|
+
'using_directive': 'import', 'delegate_declaration': 'type_alias',
|
|
588
|
+
'event_declaration': 'property',
|
|
589
|
+
};
|
|
590
|
+
EXTRACTOR_REGISTRY.set('csharp', {
|
|
591
|
+
language: 'csharp', grammarName: 'c_sharp', nodeTypeMap: CSHARP_NODE_MAP,
|
|
592
|
+
extract(tree, _src, filePath) {
|
|
593
|
+
const lang = 'csharp';
|
|
594
|
+
const symbols = [];
|
|
595
|
+
const references = [];
|
|
596
|
+
const walk = (node, parent) => {
|
|
597
|
+
const type = node.type;
|
|
598
|
+
const kind = CSHARP_NODE_MAP[type];
|
|
599
|
+
if (type === 'using_directive') {
|
|
600
|
+
const nameNode = findChild(node, 'qualified_name') ?? findChild(node, 'identifier');
|
|
601
|
+
references.push({
|
|
602
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
603
|
+
referenceName: nameNode?.text ?? node.text.replace(/^using\s+|;$/g, '').trim(),
|
|
604
|
+
referenceKind: 'imports',
|
|
605
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
606
|
+
filePath, language: lang,
|
|
607
|
+
});
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (kind && kind !== 'import') {
|
|
611
|
+
const name = nodeName(node);
|
|
612
|
+
if (!name) {
|
|
613
|
+
walkChildren(node, parent);
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
617
|
+
const mods = extractCFamilyModifiers(node);
|
|
618
|
+
// attributes as decorators [Attribute]
|
|
619
|
+
const decos = [];
|
|
620
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
621
|
+
if (c.type === 'attribute_list') {
|
|
622
|
+
for (const attr of (c.namedChildren ?? [])) {
|
|
623
|
+
const attrName = findChild(attr, 'identifier') ?? findChild(attr, 'qualified_name');
|
|
624
|
+
if (attrName)
|
|
625
|
+
decos.push(attrName.text);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
// async Task methods
|
|
630
|
+
let isAsync = mods.isAsync;
|
|
631
|
+
if (!isAsync && type === 'method_declaration') {
|
|
632
|
+
const returnType = node.childForFieldName?.('type')?.text ?? '';
|
|
633
|
+
if (returnType.startsWith('Task') || returnType.startsWith('ValueTask') || returnType.startsWith('async')) {
|
|
634
|
+
isAsync = true;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
// doc comment
|
|
638
|
+
let docstring = '';
|
|
639
|
+
const prev = prevSibling(node);
|
|
640
|
+
if (prev?.type === 'comment' && prev.text.startsWith('///')) {
|
|
641
|
+
docstring = prev.text.replace(/\/\/\/\s?/g, '').trim();
|
|
642
|
+
}
|
|
643
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
644
|
+
...mods, isAsync, decorators: decos,
|
|
645
|
+
signature: firstLine(node), docstring,
|
|
646
|
+
}));
|
|
647
|
+
walkChildren(node, qn);
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
walkChildren(node, parent);
|
|
651
|
+
};
|
|
652
|
+
const walkChildren = (node, parent) => {
|
|
653
|
+
for (const c of (node.namedChildren ?? []))
|
|
654
|
+
walk(c, parent);
|
|
655
|
+
};
|
|
656
|
+
walk(tree.rootNode, '');
|
|
657
|
+
return { symbols, references, edges: [] };
|
|
658
|
+
},
|
|
659
|
+
});
|
|
660
|
+
// ---------------------------------------------------------------------------
|
|
661
|
+
// 6. Ruby — attr_*, module, def self., include/extend, visibility sections
|
|
662
|
+
// ---------------------------------------------------------------------------
|
|
663
|
+
const RUBY_NODE_MAP = {
|
|
664
|
+
'method': 'method', 'singleton_method': 'method',
|
|
665
|
+
'class': 'class', 'module': 'module',
|
|
666
|
+
'call': '_call', // include/extend/attr_* 检测
|
|
667
|
+
'assignment': 'variable',
|
|
668
|
+
};
|
|
669
|
+
EXTRACTOR_REGISTRY.set('ruby', {
|
|
670
|
+
language: 'ruby', grammarName: 'ruby', nodeTypeMap: RUBY_NODE_MAP,
|
|
671
|
+
extract(tree, _src, filePath) {
|
|
672
|
+
const lang = 'ruby';
|
|
673
|
+
const symbols = [];
|
|
674
|
+
const references = [];
|
|
675
|
+
let currentVisibility = 'public';
|
|
676
|
+
const walk = (node, parent) => {
|
|
677
|
+
const type = node.type;
|
|
678
|
+
if (type === 'class' || type === 'module') {
|
|
679
|
+
const name = nodeName(node) ?? findChild(node, 'constant')?.text;
|
|
680
|
+
if (!name) {
|
|
681
|
+
walkChildren(node, parent);
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
685
|
+
const kind = type === 'class' ? 'class' : 'module';
|
|
686
|
+
const savedVis = currentVisibility;
|
|
687
|
+
currentVisibility = 'public';
|
|
688
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, { signature: firstLine(node) }));
|
|
689
|
+
walkChildren(node, qn);
|
|
690
|
+
currentVisibility = savedVis;
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
if (type === 'method') {
|
|
694
|
+
const name = nodeName(node);
|
|
695
|
+
if (!name) {
|
|
696
|
+
walkChildren(node, parent);
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
700
|
+
// doc comment
|
|
701
|
+
let docstring = '';
|
|
702
|
+
const prev = prevSibling(node);
|
|
703
|
+
if (prev?.type === 'comment') {
|
|
704
|
+
docstring = prev.text.replace(/^#\s?/, '').trim();
|
|
705
|
+
}
|
|
706
|
+
symbols.push(sym('method', name, qn, filePath, lang, node, {
|
|
707
|
+
visibility: currentVisibility, signature: firstLine(node), docstring,
|
|
708
|
+
}));
|
|
709
|
+
walkChildren(node, qn);
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
if (type === 'singleton_method') {
|
|
713
|
+
const name = nodeName(node);
|
|
714
|
+
if (!name) {
|
|
715
|
+
walkChildren(node, parent);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
719
|
+
symbols.push(sym('method', name, qn, filePath, lang, node, {
|
|
720
|
+
isStatic: true, visibility: 'public', signature: firstLine(node),
|
|
721
|
+
}));
|
|
722
|
+
walkChildren(node, qn);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
if (type === 'call' || type === 'identifier') {
|
|
726
|
+
const methodName = nodeName(node) ?? node.text;
|
|
727
|
+
// visibility modifiers
|
|
728
|
+
if (['private', 'protected', 'public'].includes(methodName)) {
|
|
729
|
+
currentVisibility = methodName;
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
// attr_accessor/reader/writer → properties
|
|
733
|
+
if (['attr_accessor', 'attr_reader', 'attr_writer'].includes(methodName)) {
|
|
734
|
+
const args = findChild(node, 'argument_list');
|
|
735
|
+
for (const arg of (args?.namedChildren ?? [])) {
|
|
736
|
+
if (arg.type === 'simple_symbol' || arg.type === 'symbol') {
|
|
737
|
+
const propName = arg.text.replace(/^:/, '');
|
|
738
|
+
symbols.push(sym('property', propName, parent ? `${parent}.${propName}` : propName, filePath, lang, node, { visibility: currentVisibility }));
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
// include/extend/prepend → import references
|
|
744
|
+
if (['include', 'extend', 'prepend', 'require', 'require_relative'].includes(methodName)) {
|
|
745
|
+
const args = findChild(node, 'argument_list');
|
|
746
|
+
for (const arg of (args?.namedChildren ?? [])) {
|
|
747
|
+
references.push({
|
|
748
|
+
fromSymbolName: parent || '<module>', fromSymbolId: `${filePath}:${parent || '<module>'}`,
|
|
749
|
+
referenceName: arg.text.replace(/['"]/g, '').replace(/^:/, ''),
|
|
750
|
+
referenceKind: methodName === 'include' || methodName === 'extend' ? 'mixes_in' : 'imports',
|
|
751
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
752
|
+
filePath, language: lang,
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
walkChildren(node, parent);
|
|
759
|
+
};
|
|
760
|
+
const walkChildren = (node, parent) => {
|
|
761
|
+
for (const c of (node.namedChildren ?? []))
|
|
762
|
+
walk(c, parent);
|
|
763
|
+
};
|
|
764
|
+
walk(tree.rootNode, '');
|
|
765
|
+
return { symbols, references, edges: [] };
|
|
766
|
+
},
|
|
767
|
+
});
|
|
768
|
+
// ---------------------------------------------------------------------------
|
|
769
|
+
// 7. Swift — visibility, modifiers, protocols, decorators, async, imports
|
|
770
|
+
// ---------------------------------------------------------------------------
|
|
771
|
+
const SWIFT_NODE_MAP = {
|
|
772
|
+
'function_declaration': 'function', 'class_declaration': 'class',
|
|
773
|
+
'struct_declaration': 'struct', 'protocol_declaration': 'protocol',
|
|
774
|
+
'enum_declaration': 'enum', 'extension_declaration': 'class',
|
|
775
|
+
'typealias_declaration': 'type_alias', 'variable_declaration': 'property',
|
|
776
|
+
'import_declaration': 'import', 'init_declaration': 'method',
|
|
777
|
+
'deinit_declaration': 'method', 'subscript_declaration': 'method',
|
|
778
|
+
};
|
|
779
|
+
EXTRACTOR_REGISTRY.set('swift', {
|
|
780
|
+
language: 'swift', grammarName: 'swift', nodeTypeMap: SWIFT_NODE_MAP,
|
|
781
|
+
extract(tree, _src, filePath) {
|
|
782
|
+
const lang = 'swift';
|
|
783
|
+
const symbols = [];
|
|
784
|
+
const references = [];
|
|
785
|
+
const walk = (node, parent) => {
|
|
786
|
+
const type = node.type;
|
|
787
|
+
const kind = SWIFT_NODE_MAP[type];
|
|
788
|
+
if (type === 'import_declaration') {
|
|
789
|
+
const mod = node.namedChildren?.find((c) => c.type === 'identifier');
|
|
790
|
+
references.push({
|
|
791
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
792
|
+
referenceName: mod?.text ?? node.text.replace(/^import\s+/, '').trim(),
|
|
793
|
+
referenceKind: 'imports',
|
|
794
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
795
|
+
filePath, language: lang,
|
|
796
|
+
});
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
if (kind && kind !== 'import') {
|
|
800
|
+
const name = nodeName(node) ?? (type === 'init_declaration' ? 'init' : type === 'deinit_declaration' ? 'deinit' : null);
|
|
801
|
+
if (!name) {
|
|
802
|
+
walkChildren(node, parent);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
806
|
+
const isMethod = parent !== '' && (type === 'function_declaration' || type === 'init_declaration' || type === 'deinit_declaration' || type === 'subscript_declaration');
|
|
807
|
+
const finalKind = isMethod ? 'method' : kind;
|
|
808
|
+
// modifiers: public/private/fileprivate/internal/static/class
|
|
809
|
+
let visibility = '', isStatic = false, isAsync = false;
|
|
810
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
811
|
+
const modText = c.type === 'modifier' ? c.text : c.type;
|
|
812
|
+
if (['public', 'private', 'fileprivate', 'internal', 'open'].includes(modText))
|
|
813
|
+
visibility = modText;
|
|
814
|
+
if (modText === 'static' || modText === 'class')
|
|
815
|
+
isStatic = true;
|
|
816
|
+
if (modText === 'async')
|
|
817
|
+
isAsync = true;
|
|
818
|
+
}
|
|
819
|
+
// @objc, @IBAction etc. as decorators
|
|
820
|
+
const decos = [];
|
|
821
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
822
|
+
if (c.type === 'attribute') {
|
|
823
|
+
const attrName = findChild(c, 'user_type') ?? findChild(c, 'identifier');
|
|
824
|
+
decos.push(attrName?.text ?? c.text.replace(/^@/, ''));
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
// protocol conformance
|
|
828
|
+
const conformance = findChild(node, 'type_inheritance_clause');
|
|
829
|
+
if (conformance) {
|
|
830
|
+
for (const t of (conformance.namedChildren ?? [])) {
|
|
831
|
+
if (t.type === 'user_type' || t.type === 'type_identifier') {
|
|
832
|
+
// recorded as edge later if needed
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
// doc comment
|
|
837
|
+
let docstring = '';
|
|
838
|
+
const prev = prevSibling(node);
|
|
839
|
+
if (prev?.type === 'comment' && prev.text.startsWith('///')) {
|
|
840
|
+
docstring = prev.text.replace(/\/\/\/\s?/g, '').trim();
|
|
841
|
+
}
|
|
842
|
+
symbols.push(sym(finalKind, name, qn, filePath, lang, node, {
|
|
843
|
+
visibility, isStatic, isAsync, decorators: decos,
|
|
844
|
+
signature: firstLine(node), docstring,
|
|
845
|
+
}));
|
|
846
|
+
walkChildren(node, qn);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
walkChildren(node, parent);
|
|
850
|
+
};
|
|
851
|
+
const walkChildren = (node, parent) => {
|
|
852
|
+
for (const c of (node.namedChildren ?? []))
|
|
853
|
+
walk(c, parent);
|
|
854
|
+
};
|
|
855
|
+
walk(tree.rootNode, '');
|
|
856
|
+
return { symbols, references, edges: [] };
|
|
857
|
+
},
|
|
858
|
+
});
|
|
859
|
+
// ---------------------------------------------------------------------------
|
|
860
|
+
// 8. Kotlin — fun, data class, object, suspend, annotations, override
|
|
861
|
+
// ---------------------------------------------------------------------------
|
|
862
|
+
const KOTLIN_NODE_MAP = {
|
|
863
|
+
'function_declaration': 'function', 'class_declaration': 'class',
|
|
864
|
+
'object_declaration': 'class', 'interface_declaration': 'interface',
|
|
865
|
+
'companion_object': 'class', 'property_declaration': 'property',
|
|
866
|
+
'import_header': 'import', 'enum_entry': 'enum_member',
|
|
867
|
+
'type_alias': 'type_alias',
|
|
868
|
+
};
|
|
869
|
+
EXTRACTOR_REGISTRY.set('kotlin', {
|
|
870
|
+
language: 'kotlin', grammarName: 'kotlin', nodeTypeMap: KOTLIN_NODE_MAP,
|
|
871
|
+
extract(tree, _src, filePath) {
|
|
872
|
+
const lang = 'kotlin';
|
|
873
|
+
const symbols = [];
|
|
874
|
+
const references = [];
|
|
875
|
+
const walk = (node, parent) => {
|
|
876
|
+
const type = node.type;
|
|
877
|
+
const kind = KOTLIN_NODE_MAP[type];
|
|
878
|
+
if (type === 'import_header') {
|
|
879
|
+
const id = findChild(node, 'identifier') ?? findChild(node, 'scoped_identifier');
|
|
880
|
+
references.push({
|
|
881
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
882
|
+
referenceName: id?.text ?? node.text.replace(/^import\s+/, '').trim(),
|
|
883
|
+
referenceKind: 'imports',
|
|
884
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
885
|
+
filePath, language: lang,
|
|
886
|
+
});
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
if (kind && kind !== 'import') {
|
|
890
|
+
const name = nodeName(node) ?? (type === 'companion_object' ? 'Companion' : null);
|
|
891
|
+
if (!name) {
|
|
892
|
+
walkChildren(node, parent);
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
896
|
+
const isMethod = parent !== '' && type === 'function_declaration';
|
|
897
|
+
const finalKind = isMethod ? 'method' : kind;
|
|
898
|
+
// modifiers: visibility, suspend, override, data, abstract
|
|
899
|
+
let visibility = '', isAsync = false, isStatic = false, isAbstract = false;
|
|
900
|
+
const decos = [];
|
|
901
|
+
for (const c of (node.namedChildren ?? [])) {
|
|
902
|
+
if (c.type === 'modifiers' || c.type === 'modifier') {
|
|
903
|
+
for (const m of (c.namedChildren ?? [c])) {
|
|
904
|
+
const mt = m.type === 'visibility_modifier' ? m.text :
|
|
905
|
+
m.type === 'inheritance_modifier' ? m.text : m.text;
|
|
906
|
+
if (['public', 'private', 'protected', 'internal'].includes(mt))
|
|
907
|
+
visibility = mt;
|
|
908
|
+
if (mt === 'suspend')
|
|
909
|
+
isAsync = true;
|
|
910
|
+
if (mt === 'abstract')
|
|
911
|
+
isAbstract = true;
|
|
912
|
+
if (mt === 'override')
|
|
913
|
+
decos.push('override');
|
|
914
|
+
if (mt === 'data')
|
|
915
|
+
decos.push('data');
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
if (c.type === 'annotation') {
|
|
919
|
+
const aName = findChild(c, 'user_type') ?? findChild(c, 'identifier');
|
|
920
|
+
decos.push(aName?.text ?? c.text.replace(/^@/, ''));
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
// doc comment
|
|
924
|
+
let docstring = '';
|
|
925
|
+
const prev = prevSibling(node);
|
|
926
|
+
if (prev?.type === 'multiline_comment' && prev.text.startsWith('/**')) {
|
|
927
|
+
docstring = prev.text.replace(/^\/\*\*|\*\/$/g, '').replace(/^\s*\*\s?/gm, '').trim();
|
|
928
|
+
}
|
|
929
|
+
symbols.push(sym(finalKind, name, qn, filePath, lang, node, {
|
|
930
|
+
visibility, isAsync, isStatic, isAbstract, decorators: decos,
|
|
931
|
+
signature: firstLine(node), docstring,
|
|
932
|
+
}));
|
|
933
|
+
walkChildren(node, qn);
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
walkChildren(node, parent);
|
|
937
|
+
};
|
|
938
|
+
const walkChildren = (node, parent) => {
|
|
939
|
+
for (const c of (node.namedChildren ?? []))
|
|
940
|
+
walk(c, parent);
|
|
941
|
+
};
|
|
942
|
+
walk(tree.rootNode, '');
|
|
943
|
+
return { symbols, references, edges: [] };
|
|
944
|
+
},
|
|
945
|
+
});
|
|
946
|
+
// ---------------------------------------------------------------------------
|
|
947
|
+
// 9. PHP — visibility, modifiers, namespace, use, traits, docblocks
|
|
948
|
+
// ---------------------------------------------------------------------------
|
|
949
|
+
const PHP_NODE_MAP = {
|
|
950
|
+
'function_definition': 'function', 'method_declaration': 'method',
|
|
951
|
+
'class_declaration': 'class', 'interface_declaration': 'interface',
|
|
952
|
+
'trait_declaration': 'trait', 'enum_declaration': 'enum',
|
|
953
|
+
'namespace_definition': 'namespace', 'property_declaration': 'property',
|
|
954
|
+
'const_declaration': 'variable', 'enum_case': 'enum_member',
|
|
955
|
+
'use_declaration': 'import', 'namespace_use_declaration': 'import',
|
|
956
|
+
};
|
|
957
|
+
EXTRACTOR_REGISTRY.set('php', {
|
|
958
|
+
language: 'php', grammarName: 'php', nodeTypeMap: PHP_NODE_MAP,
|
|
959
|
+
extract(tree, _src, filePath) {
|
|
960
|
+
const lang = 'php';
|
|
961
|
+
const symbols = [];
|
|
962
|
+
const references = [];
|
|
963
|
+
const walk = (node, parent) => {
|
|
964
|
+
const type = node.type;
|
|
965
|
+
const kind = PHP_NODE_MAP[type];
|
|
966
|
+
if (type === 'namespace_use_declaration' || type === 'use_declaration') {
|
|
967
|
+
const nameNode = findChild(node, 'qualified_name') ?? findChild(node, 'name');
|
|
968
|
+
references.push({
|
|
969
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
970
|
+
referenceName: nameNode?.text ?? node.text.replace(/^use\s+|;$/g, '').trim(),
|
|
971
|
+
referenceKind: 'imports',
|
|
972
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
973
|
+
filePath, language: lang,
|
|
974
|
+
});
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
if (kind && kind !== 'import') {
|
|
978
|
+
const name = nodeName(node);
|
|
979
|
+
if (!name) {
|
|
980
|
+
walkChildren(node, parent);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
984
|
+
const mods = extractCFamilyModifiers(node);
|
|
985
|
+
// docblock
|
|
986
|
+
let docstring = '';
|
|
987
|
+
const prev = prevSibling(node);
|
|
988
|
+
if (prev?.type === 'comment' && prev.text.startsWith('/**')) {
|
|
989
|
+
const raw = prev.text.replace(/^\/\*\*|\*\/$/g, '').replace(/^\s*\*\s?/gm, '').trim();
|
|
990
|
+
docstring = raw;
|
|
991
|
+
}
|
|
992
|
+
// class traits (use TraitName;)
|
|
993
|
+
if (type === 'class_declaration' || type === 'trait_declaration') {
|
|
994
|
+
const body = findChild(node, 'declaration_list');
|
|
995
|
+
if (body) {
|
|
996
|
+
for (const c of (body.namedChildren ?? [])) {
|
|
997
|
+
if (c.type === 'use_declaration') {
|
|
998
|
+
const traitName = findChild(c, 'qualified_name') ?? findChild(c, 'name');
|
|
999
|
+
references.push({
|
|
1000
|
+
fromSymbolName: qn, fromSymbolId: `${filePath}:${qn}`,
|
|
1001
|
+
referenceName: traitName?.text ?? c.text.replace(/^use\s+|;$/g, '').trim(),
|
|
1002
|
+
referenceKind: 'mixes_in',
|
|
1003
|
+
line: (c.startPosition?.row ?? 0) + 1, col: (c.startPosition?.column ?? 0) + 1,
|
|
1004
|
+
filePath, language: lang,
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
1011
|
+
...mods, signature: firstLine(node), docstring,
|
|
1012
|
+
}));
|
|
1013
|
+
walkChildren(node, qn);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
walkChildren(node, parent);
|
|
1017
|
+
};
|
|
1018
|
+
const walkChildren = (node, parent) => {
|
|
1019
|
+
for (const c of (node.namedChildren ?? []))
|
|
1020
|
+
walk(c, parent);
|
|
1021
|
+
};
|
|
1022
|
+
walk(tree.rootNode, '');
|
|
1023
|
+
return { symbols, references, edges: [] };
|
|
1024
|
+
},
|
|
1025
|
+
});
|
|
1026
|
+
// ---------------------------------------------------------------------------
|
|
1027
|
+
// 10. C — functions, structs, enums, unions, typedefs, macros, static visibility
|
|
1028
|
+
// ---------------------------------------------------------------------------
|
|
1029
|
+
const C_NODE_MAP = {
|
|
1030
|
+
'function_definition': 'function', 'struct_specifier': 'struct',
|
|
1031
|
+
'enum_specifier': 'enum', 'union_specifier': 'struct',
|
|
1032
|
+
'type_definition': 'type_alias', 'preproc_function_def': 'function',
|
|
1033
|
+
'preproc_def': 'constant', 'declaration': '_decl',
|
|
1034
|
+
};
|
|
1035
|
+
EXTRACTOR_REGISTRY.set('c', {
|
|
1036
|
+
language: 'c', grammarName: 'c', nodeTypeMap: C_NODE_MAP,
|
|
1037
|
+
extract(tree, _src, filePath) {
|
|
1038
|
+
const lang = 'c';
|
|
1039
|
+
const symbols = [];
|
|
1040
|
+
const references = [];
|
|
1041
|
+
const walk = (node, parent) => {
|
|
1042
|
+
const type = node.type;
|
|
1043
|
+
// #include → import reference
|
|
1044
|
+
if (type === 'preproc_include') {
|
|
1045
|
+
const path = findChild(node, 'string_literal') ?? findChild(node, 'system_lib_string');
|
|
1046
|
+
references.push({
|
|
1047
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1048
|
+
referenceName: (path?.text ?? '').replace(/[<>"]/g, ''),
|
|
1049
|
+
referenceKind: 'imports',
|
|
1050
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
1051
|
+
filePath, language: lang,
|
|
1052
|
+
});
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
// #define NAME value → constant
|
|
1056
|
+
if (type === 'preproc_def') {
|
|
1057
|
+
const name = nodeName(node);
|
|
1058
|
+
if (!name)
|
|
1059
|
+
return;
|
|
1060
|
+
// skip header guards (e.g. #define FOO_H_)
|
|
1061
|
+
if (name.endsWith('_H') || name.endsWith('_H_') || name.endsWith('_INCLUDED'))
|
|
1062
|
+
return;
|
|
1063
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1064
|
+
symbols.push(sym('constant', name, qn, filePath, lang, node, {
|
|
1065
|
+
isExported: true, signature: firstLine(node),
|
|
1066
|
+
}));
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
// #define NAME(...) → macro function
|
|
1070
|
+
if (type === 'preproc_function_def') {
|
|
1071
|
+
const name = nodeName(node);
|
|
1072
|
+
if (!name)
|
|
1073
|
+
return;
|
|
1074
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1075
|
+
symbols.push(sym('function', name, qn, filePath, lang, node, {
|
|
1076
|
+
isExported: true, signature: firstLine(node),
|
|
1077
|
+
decorators: ['macro'],
|
|
1078
|
+
}));
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
if (type === 'function_definition') {
|
|
1082
|
+
const declarator = findChild(node, 'declarator') ?? node;
|
|
1083
|
+
const name = nodeName(declarator);
|
|
1084
|
+
if (!name) {
|
|
1085
|
+
walkChildren(node, parent);
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1089
|
+
// static → file-local (private)
|
|
1090
|
+
const isStatic = node.text?.trimStart().startsWith('static') ?? false;
|
|
1091
|
+
const visibility = isStatic ? 'private' : 'public';
|
|
1092
|
+
// doc comment
|
|
1093
|
+
let docstring = '';
|
|
1094
|
+
const prev = prevSibling(node);
|
|
1095
|
+
if (prev?.type === 'comment')
|
|
1096
|
+
docstring = prev.text.replace(/^\/\*\*?|\*\/$/g, '').replace(/^\s*\*\s?/gm, '').trim();
|
|
1097
|
+
symbols.push(sym('function', name, qn, filePath, lang, node, {
|
|
1098
|
+
visibility, isStatic, isExported: !isStatic,
|
|
1099
|
+
signature: firstLine(node), docstring,
|
|
1100
|
+
}));
|
|
1101
|
+
walkChildren(node, qn);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
if (type === 'struct_specifier' || type === 'union_specifier' || type === 'enum_specifier') {
|
|
1105
|
+
const name = nodeName(node);
|
|
1106
|
+
if (!name) {
|
|
1107
|
+
walkChildren(node, parent);
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1111
|
+
const kind = type === 'enum_specifier' ? 'enum' : 'struct';
|
|
1112
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
1113
|
+
isExported: true, signature: firstLine(node),
|
|
1114
|
+
}));
|
|
1115
|
+
walkChildren(node, qn);
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
// typedef — detect function pointer typedefs
|
|
1119
|
+
if (type === 'type_definition') {
|
|
1120
|
+
const declarator = findChild(node, 'type_identifier') ?? findChild(node, 'declarator');
|
|
1121
|
+
const name = declarator?.text ?? nodeName(node);
|
|
1122
|
+
if (!name) {
|
|
1123
|
+
walkChildren(node, parent);
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1127
|
+
const isFnPtr = node.text?.includes('(*)') ?? false;
|
|
1128
|
+
symbols.push(sym('type_alias', name, qn, filePath, lang, node, {
|
|
1129
|
+
isExported: true, signature: firstLine(node),
|
|
1130
|
+
decorators: isFnPtr ? ['function_pointer'] : [],
|
|
1131
|
+
}));
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
walkChildren(node, parent);
|
|
1135
|
+
};
|
|
1136
|
+
const walkChildren = (node, parent) => {
|
|
1137
|
+
for (const c of (node.namedChildren ?? []))
|
|
1138
|
+
walk(c, parent);
|
|
1139
|
+
};
|
|
1140
|
+
walk(tree.rootNode, '');
|
|
1141
|
+
return { symbols, references, edges: [] };
|
|
1142
|
+
},
|
|
1143
|
+
});
|
|
1144
|
+
// ---------------------------------------------------------------------------
|
|
1145
|
+
// 11. C++ — classes, templates, namespaces, public/private/protected, virtual
|
|
1146
|
+
// ---------------------------------------------------------------------------
|
|
1147
|
+
const CPP_NODE_MAP = {
|
|
1148
|
+
'function_definition': 'function', 'class_specifier': 'class',
|
|
1149
|
+
'struct_specifier': 'struct', 'enum_specifier': 'enum',
|
|
1150
|
+
'namespace_definition': 'namespace', 'template_declaration': '_template',
|
|
1151
|
+
'field_declaration': 'field', 'type_definition': 'type_alias',
|
|
1152
|
+
'declaration': '_decl',
|
|
1153
|
+
};
|
|
1154
|
+
EXTRACTOR_REGISTRY.set('cpp', {
|
|
1155
|
+
language: 'cpp', grammarName: 'cpp', nodeTypeMap: CPP_NODE_MAP,
|
|
1156
|
+
extract(tree, _src, filePath) {
|
|
1157
|
+
const lang = 'cpp';
|
|
1158
|
+
const symbols = [];
|
|
1159
|
+
const references = [];
|
|
1160
|
+
const edges = [];
|
|
1161
|
+
const walk = (node, parent, sectionVisibility) => {
|
|
1162
|
+
const type = node.type;
|
|
1163
|
+
// #include → import
|
|
1164
|
+
if (type === 'preproc_include') {
|
|
1165
|
+
const path = findChild(node, 'string_literal') ?? findChild(node, 'system_lib_string');
|
|
1166
|
+
references.push({
|
|
1167
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1168
|
+
referenceName: (path?.text ?? '').replace(/[<>"]/g, ''),
|
|
1169
|
+
referenceKind: 'imports',
|
|
1170
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
1171
|
+
filePath, language: lang,
|
|
1172
|
+
});
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
// namespace
|
|
1176
|
+
if (type === 'namespace_definition') {
|
|
1177
|
+
const name = nodeName(node) ?? '<anonymous>';
|
|
1178
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1179
|
+
symbols.push(sym('namespace', name, qn, filePath, lang, node, { signature: firstLine(node) }));
|
|
1180
|
+
const body = findChild(node, 'declaration_list');
|
|
1181
|
+
if (body)
|
|
1182
|
+
for (const c of (body.namedChildren ?? []))
|
|
1183
|
+
walk(c, qn);
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
// template_declaration — unwrap, pass template params to inner
|
|
1187
|
+
if (type === 'template_declaration') {
|
|
1188
|
+
const params = findChild(node, 'template_parameter_list');
|
|
1189
|
+
const inner = node.namedChildren?.find((c) => c.type === 'function_definition' || c.type === 'class_specifier' || c.type === 'struct_specifier' || c.type === 'declaration');
|
|
1190
|
+
if (inner) {
|
|
1191
|
+
inner.__templateParams = params?.text ?? '';
|
|
1192
|
+
walk(inner, parent, sectionVisibility);
|
|
1193
|
+
}
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
// class / struct
|
|
1197
|
+
if (type === 'class_specifier' || type === 'struct_specifier') {
|
|
1198
|
+
const name = nodeName(node);
|
|
1199
|
+
if (!name) {
|
|
1200
|
+
walkChildren(node, parent);
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1204
|
+
const kind = type === 'class_specifier' ? 'class' : 'struct';
|
|
1205
|
+
const typeParams = node.__templateParams ? [node.__templateParams] : [];
|
|
1206
|
+
// base class clause
|
|
1207
|
+
const baseClause = findChild(node, 'base_class_clause');
|
|
1208
|
+
if (baseClause) {
|
|
1209
|
+
for (const base of (baseClause.namedChildren ?? [])) {
|
|
1210
|
+
const baseName = findChild(base, 'type_identifier')?.text ?? base.text?.replace(/\b(public|private|protected|virtual)\s+/g, '').trim();
|
|
1211
|
+
if (baseName)
|
|
1212
|
+
edges.push({ source: qn, target: baseName, kind: 'extends', line: (node.startPosition?.row ?? 0) + 1 });
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
1216
|
+
isExported: true, typeParameters: typeParams, signature: firstLine(node),
|
|
1217
|
+
}));
|
|
1218
|
+
// walk body with access specifier tracking (default: private for class, public for struct)
|
|
1219
|
+
const body = findChild(node, 'field_declaration_list');
|
|
1220
|
+
let curVis = type === 'class_specifier' ? 'private' : 'public';
|
|
1221
|
+
if (body) {
|
|
1222
|
+
for (const c of (body.namedChildren ?? [])) {
|
|
1223
|
+
if (c.type === 'access_specifier') {
|
|
1224
|
+
curVis = c.text.replace(':', '').trim();
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
walk(c, qn, curVis);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
// function definition / method
|
|
1233
|
+
if (type === 'function_definition') {
|
|
1234
|
+
const declarator = findChild(node, 'declarator') ?? node;
|
|
1235
|
+
const name = nodeName(declarator);
|
|
1236
|
+
if (!name) {
|
|
1237
|
+
walkChildren(node, parent);
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1241
|
+
const isMethod = !!parent && sectionVisibility !== undefined;
|
|
1242
|
+
const kind = isMethod ? 'method' : 'function';
|
|
1243
|
+
const isStatic = node.text?.trimStart().startsWith('static') ?? false;
|
|
1244
|
+
const isVirtual = node.text?.includes('virtual ') ?? false;
|
|
1245
|
+
const isOverride = node.text?.includes(' override') ?? false;
|
|
1246
|
+
const decos = [];
|
|
1247
|
+
if (isVirtual)
|
|
1248
|
+
decos.push('virtual');
|
|
1249
|
+
if (isOverride)
|
|
1250
|
+
decos.push('override');
|
|
1251
|
+
const typeParams = node.__templateParams ? [node.__templateParams] : [];
|
|
1252
|
+
// constructor/destructor detection
|
|
1253
|
+
const isConstructor = name === parent?.split('.').pop();
|
|
1254
|
+
const isDestructor = name.startsWith('~');
|
|
1255
|
+
if (isConstructor)
|
|
1256
|
+
decos.push('constructor');
|
|
1257
|
+
if (isDestructor)
|
|
1258
|
+
decos.push('destructor');
|
|
1259
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
1260
|
+
visibility: sectionVisibility ?? (isStatic ? 'private' : ''),
|
|
1261
|
+
isStatic, isExported: !isStatic,
|
|
1262
|
+
decorators: decos, typeParameters: typeParams,
|
|
1263
|
+
signature: firstLine(node),
|
|
1264
|
+
}));
|
|
1265
|
+
walkChildren(node, qn);
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
walkChildren(node, parent);
|
|
1269
|
+
};
|
|
1270
|
+
const walkChildren = (node, parent) => {
|
|
1271
|
+
for (const c of (node.namedChildren ?? []))
|
|
1272
|
+
walk(c, parent);
|
|
1273
|
+
};
|
|
1274
|
+
walk(tree.rootNode, '');
|
|
1275
|
+
return { symbols, references, edges };
|
|
1276
|
+
},
|
|
1277
|
+
});
|
|
1278
|
+
// ---------------------------------------------------------------------------
|
|
1279
|
+
// 12. Dart — class with mixins/implements, factory, async, annotations, imports
|
|
1280
|
+
// ---------------------------------------------------------------------------
|
|
1281
|
+
const DART_NODE_MAP = {
|
|
1282
|
+
'function_signature': 'function', 'method_signature': 'method',
|
|
1283
|
+
'class_definition': 'class', 'enum_declaration': 'enum',
|
|
1284
|
+
'mixin_declaration': 'trait', 'extension_declaration': 'class',
|
|
1285
|
+
'type_alias': 'type_alias', 'function_body': '_skip',
|
|
1286
|
+
};
|
|
1287
|
+
EXTRACTOR_REGISTRY.set('dart', {
|
|
1288
|
+
language: 'dart', grammarName: 'dart', nodeTypeMap: DART_NODE_MAP,
|
|
1289
|
+
extract(tree, sourceCode, filePath) {
|
|
1290
|
+
const lang = 'dart';
|
|
1291
|
+
const symbols = [];
|
|
1292
|
+
const references = [];
|
|
1293
|
+
// Dart tree-sitter grammars vary; also scan source lines for import/part/export
|
|
1294
|
+
const lines = sourceCode.split('\n');
|
|
1295
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1296
|
+
const line = lines[i].trim();
|
|
1297
|
+
const importMatch = line.match(/^(?:import|export|part|part\s+of)\s+['"]([^'"]+)['"]/);
|
|
1298
|
+
if (importMatch) {
|
|
1299
|
+
references.push({
|
|
1300
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1301
|
+
referenceName: importMatch[1], referenceKind: 'imports',
|
|
1302
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
const walk = (node, parent) => {
|
|
1307
|
+
const type = node.type;
|
|
1308
|
+
if (type === 'class_definition' || type === 'mixin_declaration' || type === 'enum_declaration' || type === 'extension_declaration') {
|
|
1309
|
+
const name = nodeName(node);
|
|
1310
|
+
if (!name) {
|
|
1311
|
+
walkChildren(node, parent);
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1315
|
+
const kind = type === 'mixin_declaration' ? 'trait' : type === 'enum_declaration' ? 'enum' : 'class';
|
|
1316
|
+
// annotations (@override, @deprecated, etc.)
|
|
1317
|
+
const decos = extractDecorators(node, 'annotation');
|
|
1318
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
1319
|
+
isExported: !name.startsWith('_'), decorators: decos,
|
|
1320
|
+
visibility: name.startsWith('_') ? 'private' : 'public',
|
|
1321
|
+
signature: firstLine(node),
|
|
1322
|
+
}));
|
|
1323
|
+
walkChildren(node, qn);
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
// function / method declarations (tree-sitter may use different node types)
|
|
1327
|
+
if (type === 'function_signature' || type === 'method_signature' ||
|
|
1328
|
+
type === 'function_declaration' || type === 'method_declaration') {
|
|
1329
|
+
const name = nodeName(node);
|
|
1330
|
+
if (!name) {
|
|
1331
|
+
walkChildren(node, parent);
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1335
|
+
const isMethod = parent !== '' || type.includes('method');
|
|
1336
|
+
// factory / async / async* / sync* detection from source text
|
|
1337
|
+
const text = node.text ?? '';
|
|
1338
|
+
const isFactory = text.trimStart().startsWith('factory');
|
|
1339
|
+
const isAsync = text.includes('async');
|
|
1340
|
+
const decos = extractDecorators(node, 'annotation');
|
|
1341
|
+
if (isFactory)
|
|
1342
|
+
decos.push('factory');
|
|
1343
|
+
symbols.push(sym(isMethod ? 'method' : 'function', name, qn, filePath, lang, node, {
|
|
1344
|
+
visibility: name.startsWith('_') ? 'private' : 'public',
|
|
1345
|
+
isExported: !name.startsWith('_'), isAsync, decorators: decos,
|
|
1346
|
+
signature: firstLine(node),
|
|
1347
|
+
}));
|
|
1348
|
+
walkChildren(node, qn);
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
// field declarations: late final Type name;
|
|
1352
|
+
if (type === 'declaration' || type === 'initialized_variable_definition') {
|
|
1353
|
+
if (parent) {
|
|
1354
|
+
const name = nodeName(node);
|
|
1355
|
+
if (name) {
|
|
1356
|
+
const qn = `${parent}.${name}`;
|
|
1357
|
+
const text = node.text ?? '';
|
|
1358
|
+
const isLate = text.includes('late ');
|
|
1359
|
+
const isFinal = text.includes('final ');
|
|
1360
|
+
const isStatic = text.includes('static ');
|
|
1361
|
+
const decos = [];
|
|
1362
|
+
if (isLate)
|
|
1363
|
+
decos.push('late');
|
|
1364
|
+
if (isFinal)
|
|
1365
|
+
decos.push('final');
|
|
1366
|
+
symbols.push(sym('property', name, qn, filePath, lang, node, {
|
|
1367
|
+
visibility: name.startsWith('_') ? 'private' : 'public',
|
|
1368
|
+
isStatic, decorators: decos, signature: firstLine(node),
|
|
1369
|
+
}));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
walkChildren(node, parent);
|
|
1374
|
+
};
|
|
1375
|
+
const walkChildren = (node, parent) => {
|
|
1376
|
+
for (const c of (node.namedChildren ?? []))
|
|
1377
|
+
walk(c, parent);
|
|
1378
|
+
};
|
|
1379
|
+
walk(tree.rootNode, '');
|
|
1380
|
+
return { symbols, references, edges: [] };
|
|
1381
|
+
},
|
|
1382
|
+
});
|
|
1383
|
+
// ---------------------------------------------------------------------------
|
|
1384
|
+
// 13. Svelte — script block functions, exported props, reactive $:, imports
|
|
1385
|
+
// ---------------------------------------------------------------------------
|
|
1386
|
+
const SVELTE_NODE_MAP = {
|
|
1387
|
+
'element': 'component', 'script_element': '_script',
|
|
1388
|
+
};
|
|
1389
|
+
EXTRACTOR_REGISTRY.set('svelte', {
|
|
1390
|
+
language: 'svelte', grammarName: 'svelte', nodeTypeMap: SVELTE_NODE_MAP,
|
|
1391
|
+
extract(tree, sourceCode, filePath) {
|
|
1392
|
+
const lang = 'svelte';
|
|
1393
|
+
const symbols = [];
|
|
1394
|
+
const references = [];
|
|
1395
|
+
// Svelte tree-sitter is limited — scan source for JS patterns inside <script>
|
|
1396
|
+
const lines = sourceCode.split('\n');
|
|
1397
|
+
let inScript = false;
|
|
1398
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1399
|
+
const line = lines[i].trim();
|
|
1400
|
+
if (line.startsWith('<script')) {
|
|
1401
|
+
inScript = true;
|
|
1402
|
+
continue;
|
|
1403
|
+
}
|
|
1404
|
+
if (line.startsWith('</script')) {
|
|
1405
|
+
inScript = false;
|
|
1406
|
+
continue;
|
|
1407
|
+
}
|
|
1408
|
+
if (!inScript)
|
|
1409
|
+
continue;
|
|
1410
|
+
// import statements
|
|
1411
|
+
const importMatch = line.match(/^import\s+.+\s+from\s+['"]([^'"]+)['"]/);
|
|
1412
|
+
if (importMatch) {
|
|
1413
|
+
references.push({
|
|
1414
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1415
|
+
referenceName: importMatch[1], referenceKind: 'imports',
|
|
1416
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
1417
|
+
});
|
|
1418
|
+
continue;
|
|
1419
|
+
}
|
|
1420
|
+
// export let propName — component prop
|
|
1421
|
+
const propMatch = line.match(/^export\s+let\s+(\w+)/);
|
|
1422
|
+
if (propMatch) {
|
|
1423
|
+
symbols.push(sym('property', propMatch[1], propMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { isExported: true, visibility: 'public', decorators: ['prop'] }));
|
|
1424
|
+
continue;
|
|
1425
|
+
}
|
|
1426
|
+
// function declarations
|
|
1427
|
+
const fnMatch = line.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);
|
|
1428
|
+
if (fnMatch) {
|
|
1429
|
+
symbols.push(sym('function', fnMatch[1], fnMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { isExported: line.startsWith('export'), isAsync: line.includes('async '),
|
|
1430
|
+
signature: line }));
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
// reactive $: statement
|
|
1434
|
+
const reactiveMatch = line.match(/^\$:\s+(?:let\s+)?(\w+)/);
|
|
1435
|
+
if (reactiveMatch) {
|
|
1436
|
+
symbols.push(sym('variable', reactiveMatch[1], reactiveMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: ['reactive'] }));
|
|
1437
|
+
continue;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
// Also walk the AST for component elements
|
|
1441
|
+
const walkAst = (node) => {
|
|
1442
|
+
if (node.type === 'element') {
|
|
1443
|
+
const tag = findChild(node, 'start_tag') ?? findChild(node, 'self_closing_tag');
|
|
1444
|
+
const tagName = findChild(tag, 'tag_name')?.text;
|
|
1445
|
+
if (tagName && tagName[0] === tagName[0].toUpperCase()) {
|
|
1446
|
+
symbols.push(sym('component', tagName, tagName, filePath, lang, node, { signature: firstLine(node) }));
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
for (const c of (node.namedChildren ?? []))
|
|
1450
|
+
walkAst(c);
|
|
1451
|
+
};
|
|
1452
|
+
walkAst(tree.rootNode);
|
|
1453
|
+
return { symbols, references, edges: [] };
|
|
1454
|
+
},
|
|
1455
|
+
});
|
|
1456
|
+
// ---------------------------------------------------------------------------
|
|
1457
|
+
// 14. Vue — script setup, defineProps/defineEmits, ref/reactive/computed, imports
|
|
1458
|
+
// ---------------------------------------------------------------------------
|
|
1459
|
+
const VUE_NODE_MAP = {
|
|
1460
|
+
'element': 'component', 'start_tag': '_tag',
|
|
1461
|
+
};
|
|
1462
|
+
EXTRACTOR_REGISTRY.set('vue', {
|
|
1463
|
+
language: 'vue', grammarName: 'vue', nodeTypeMap: VUE_NODE_MAP,
|
|
1464
|
+
extract(tree, sourceCode, filePath) {
|
|
1465
|
+
const lang = 'vue';
|
|
1466
|
+
const symbols = [];
|
|
1467
|
+
const references = [];
|
|
1468
|
+
// Vue tree-sitter coverage is limited — scan source for patterns
|
|
1469
|
+
const lines = sourceCode.split('\n');
|
|
1470
|
+
let inScript = false;
|
|
1471
|
+
let isSetup = false;
|
|
1472
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1473
|
+
const line = lines[i].trim();
|
|
1474
|
+
if (line.match(/<script[^>]*>/)) {
|
|
1475
|
+
inScript = true;
|
|
1476
|
+
isSetup = line.includes('setup');
|
|
1477
|
+
continue;
|
|
1478
|
+
}
|
|
1479
|
+
if (line.startsWith('</script')) {
|
|
1480
|
+
inScript = false;
|
|
1481
|
+
continue;
|
|
1482
|
+
}
|
|
1483
|
+
if (!inScript)
|
|
1484
|
+
continue;
|
|
1485
|
+
// import statements
|
|
1486
|
+
const importMatch = line.match(/^import\s+.+\s+from\s+['"]([^'"]+)['"]/);
|
|
1487
|
+
if (importMatch) {
|
|
1488
|
+
references.push({
|
|
1489
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1490
|
+
referenceName: importMatch[1], referenceKind: 'imports',
|
|
1491
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
1492
|
+
});
|
|
1493
|
+
continue;
|
|
1494
|
+
}
|
|
1495
|
+
// defineProps / defineEmits / defineExpose
|
|
1496
|
+
const defineMatch = line.match(/(?:const\s+\w+\s*=\s*)?(defineProps|defineEmits|defineExpose)\s*[<(]/);
|
|
1497
|
+
if (defineMatch) {
|
|
1498
|
+
symbols.push(sym('function', defineMatch[1], defineMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: ['component_contract'], signature: line }));
|
|
1499
|
+
continue;
|
|
1500
|
+
}
|
|
1501
|
+
// ref / reactive / computed declarations
|
|
1502
|
+
const reactiveMatch = line.match(/(?:const|let)\s+(\w+)\s*=\s*(ref|reactive|computed)\s*[<(]/);
|
|
1503
|
+
if (reactiveMatch) {
|
|
1504
|
+
symbols.push(sym('variable', reactiveMatch[1], reactiveMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: [reactiveMatch[2]], signature: line }));
|
|
1505
|
+
continue;
|
|
1506
|
+
}
|
|
1507
|
+
// composables (use* functions)
|
|
1508
|
+
const composableMatch = line.match(/(?:const|let)\s+(\w+)\s*=\s+(use\w+)\s*\(/);
|
|
1509
|
+
if (composableMatch) {
|
|
1510
|
+
references.push({
|
|
1511
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1512
|
+
referenceName: composableMatch[2], referenceKind: 'calls',
|
|
1513
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
1514
|
+
});
|
|
1515
|
+
continue;
|
|
1516
|
+
}
|
|
1517
|
+
// function declarations inside script
|
|
1518
|
+
const fnMatch = line.match(/^(?:async\s+)?function\s+(\w+)/);
|
|
1519
|
+
if (fnMatch) {
|
|
1520
|
+
symbols.push(sym('function', fnMatch[1], fnMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { isAsync: line.includes('async '), signature: line }));
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
// Mark component as script setup if detected
|
|
1525
|
+
if (isSetup) {
|
|
1526
|
+
symbols.push(sym('component', '<script setup>', '<script setup>', filePath, lang, { startPosition: { row: 0, column: 0 }, endPosition: { row: lines.length - 1, column: 0 } }, { decorators: ['script_setup'] }));
|
|
1527
|
+
}
|
|
1528
|
+
return { symbols, references, edges: [] };
|
|
1529
|
+
},
|
|
1530
|
+
});
|
|
1531
|
+
// ---------------------------------------------------------------------------
|
|
1532
|
+
// 15. Liquid — template tags: render/include, section, assign/capture, schema
|
|
1533
|
+
// ---------------------------------------------------------------------------
|
|
1534
|
+
const LIQUID_NODE_MAP = {
|
|
1535
|
+
'tag': '_tag', 'raw_tag': '_tag',
|
|
1536
|
+
};
|
|
1537
|
+
EXTRACTOR_REGISTRY.set('liquid', {
|
|
1538
|
+
language: 'liquid', grammarName: 'liquid', nodeTypeMap: LIQUID_NODE_MAP,
|
|
1539
|
+
extract(_tree, sourceCode, filePath) {
|
|
1540
|
+
const lang = 'liquid';
|
|
1541
|
+
const symbols = [];
|
|
1542
|
+
const references = [];
|
|
1543
|
+
// Liquid has limited tree-sitter support — regex-based extraction
|
|
1544
|
+
const lines = sourceCode.split('\n');
|
|
1545
|
+
let inSchema = false;
|
|
1546
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1547
|
+
const line = lines[i].trim();
|
|
1548
|
+
// {% render 'snippet' %} / {% include 'snippet' %} → import
|
|
1549
|
+
const renderMatch = line.match(/\{%[-]?\s*(render|include)\s+['"]([^'"]+)['"]/);
|
|
1550
|
+
if (renderMatch) {
|
|
1551
|
+
references.push({
|
|
1552
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1553
|
+
referenceName: renderMatch[2], referenceKind: 'imports',
|
|
1554
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
1555
|
+
});
|
|
1556
|
+
continue;
|
|
1557
|
+
}
|
|
1558
|
+
// {% section 'name' %} → component/module
|
|
1559
|
+
const sectionMatch = line.match(/\{%[-]?\s*section\s+['"]([^'"]+)['"]/);
|
|
1560
|
+
if (sectionMatch) {
|
|
1561
|
+
symbols.push(sym('component', sectionMatch[1], sectionMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: ['section'], signature: line }));
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1564
|
+
// {% assign name = ... %} → variable
|
|
1565
|
+
const assignMatch = line.match(/\{%[-]?\s*assign\s+(\w+)\s*=/);
|
|
1566
|
+
if (assignMatch) {
|
|
1567
|
+
symbols.push(sym('variable', assignMatch[1], assignMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { signature: line }));
|
|
1568
|
+
continue;
|
|
1569
|
+
}
|
|
1570
|
+
// {% capture name %} → variable
|
|
1571
|
+
const captureMatch = line.match(/\{%[-]?\s*capture\s+(\w+)/);
|
|
1572
|
+
if (captureMatch) {
|
|
1573
|
+
symbols.push(sym('variable', captureMatch[1], captureMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: ['capture'], signature: line }));
|
|
1574
|
+
continue;
|
|
1575
|
+
}
|
|
1576
|
+
// {% schema %} JSON block detection
|
|
1577
|
+
if (line.match(/\{%[-]?\s*schema\s*[-]?%\}/)) {
|
|
1578
|
+
inSchema = true;
|
|
1579
|
+
symbols.push(sym('variable', '<schema>', '<schema>', filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: ['schema_block'] }));
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
if (line.match(/\{%[-]?\s*endschema\s*[-]?%\}/)) {
|
|
1583
|
+
inSchema = false;
|
|
1584
|
+
continue;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
return { symbols, references, edges: [] };
|
|
1588
|
+
},
|
|
1589
|
+
});
|
|
1590
|
+
// ---------------------------------------------------------------------------
|
|
1591
|
+
// 16. Pascal — procedure/function, unit/program, uses, class/record/interface
|
|
1592
|
+
// ---------------------------------------------------------------------------
|
|
1593
|
+
const PASCAL_NODE_MAP = {
|
|
1594
|
+
'procedure_declaration': 'function', 'function_declaration': 'function',
|
|
1595
|
+
'class_declaration': 'class', 'record_declaration': 'struct',
|
|
1596
|
+
'interface_declaration': 'interface',
|
|
1597
|
+
};
|
|
1598
|
+
EXTRACTOR_REGISTRY.set('pascal', {
|
|
1599
|
+
language: 'pascal', grammarName: 'pascal', nodeTypeMap: PASCAL_NODE_MAP,
|
|
1600
|
+
extract(_tree, sourceCode, filePath) {
|
|
1601
|
+
const lang = 'pascal';
|
|
1602
|
+
const symbols = [];
|
|
1603
|
+
const references = [];
|
|
1604
|
+
// Pascal tree-sitter is immature — regex-based extraction
|
|
1605
|
+
const lines = sourceCode.split('\n');
|
|
1606
|
+
let currentClass = '';
|
|
1607
|
+
let currentVisibility = 'public';
|
|
1608
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1609
|
+
const line = lines[i].trim();
|
|
1610
|
+
// unit/program/library → module
|
|
1611
|
+
const unitMatch = line.match(/^(unit|program|library)\s+(\w+)/i);
|
|
1612
|
+
if (unitMatch) {
|
|
1613
|
+
symbols.push(sym('module', unitMatch[2], unitMatch[2], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { decorators: [unitMatch[1].toLowerCase()], signature: line }));
|
|
1614
|
+
continue;
|
|
1615
|
+
}
|
|
1616
|
+
// uses clause → imports
|
|
1617
|
+
const usesMatch = line.match(/^uses\s+(.+)/i);
|
|
1618
|
+
if (usesMatch) {
|
|
1619
|
+
const units = usesMatch[1].replace(/;$/, '').split(',').map(s => s.trim()).filter(Boolean);
|
|
1620
|
+
for (const u of units) {
|
|
1621
|
+
references.push({
|
|
1622
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1623
|
+
referenceName: u, referenceKind: 'imports',
|
|
1624
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
continue;
|
|
1628
|
+
}
|
|
1629
|
+
// class / record / interface (object)
|
|
1630
|
+
const classMatch = line.match(/^(\w+)\s*=\s*(class|record|interface)\b/i);
|
|
1631
|
+
if (classMatch) {
|
|
1632
|
+
const name = classMatch[1];
|
|
1633
|
+
const kind = classMatch[2].toLowerCase() === 'class' ? 'class' :
|
|
1634
|
+
classMatch[2].toLowerCase() === 'interface' ? 'interface' : 'struct';
|
|
1635
|
+
currentClass = name;
|
|
1636
|
+
currentVisibility = 'public';
|
|
1637
|
+
symbols.push(sym(kind, name, name, filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { signature: line }));
|
|
1638
|
+
continue;
|
|
1639
|
+
}
|
|
1640
|
+
// visibility sections inside class
|
|
1641
|
+
if (/^\b(public|private|protected|published)\b/i.test(line)) {
|
|
1642
|
+
currentVisibility = line.replace(/\s*$/, '').toLowerCase();
|
|
1643
|
+
continue;
|
|
1644
|
+
}
|
|
1645
|
+
// end of class
|
|
1646
|
+
if (currentClass && /^end\s*;/i.test(line)) {
|
|
1647
|
+
currentClass = '';
|
|
1648
|
+
continue;
|
|
1649
|
+
}
|
|
1650
|
+
// procedure / function
|
|
1651
|
+
const fnMatch = line.match(/^(procedure|function|constructor|destructor)\s+(?:(\w+)\.)?(\w+)/i);
|
|
1652
|
+
if (fnMatch) {
|
|
1653
|
+
const fnType = fnMatch[1].toLowerCase();
|
|
1654
|
+
const owner = fnMatch[2] || currentClass;
|
|
1655
|
+
const name = fnMatch[3];
|
|
1656
|
+
const qn = owner ? `${owner}.${name}` : name;
|
|
1657
|
+
const kind = owner ? 'method' : 'function';
|
|
1658
|
+
const decos = [];
|
|
1659
|
+
if (fnType === 'constructor')
|
|
1660
|
+
decos.push('constructor');
|
|
1661
|
+
if (fnType === 'destructor')
|
|
1662
|
+
decos.push('destructor');
|
|
1663
|
+
symbols.push(sym(kind, name, qn, filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { visibility: owner ? currentVisibility : '', decorators: decos, signature: line }));
|
|
1664
|
+
continue;
|
|
1665
|
+
}
|
|
1666
|
+
// type declarations (simple: TFoo = Integer)
|
|
1667
|
+
const typeMatch = line.match(/^(\w+)\s*=\s*(?!class\b|record\b|interface\b)(\w+)/i);
|
|
1668
|
+
if (typeMatch && !currentClass) {
|
|
1669
|
+
symbols.push(sym('type_alias', typeMatch[1], typeMatch[1], filePath, lang, { startPosition: { row: i, column: 0 }, endPosition: { row: i, column: line.length } }, { signature: line }));
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
return { symbols, references, edges: [] };
|
|
1673
|
+
},
|
|
1674
|
+
});
|
|
1675
|
+
// ---------------------------------------------------------------------------
|
|
1676
|
+
// 17. Scala — def/val/var, object, trait, case class, implicit/lazy, imports
|
|
1677
|
+
// ---------------------------------------------------------------------------
|
|
1678
|
+
const SCALA_NODE_MAP = {
|
|
1679
|
+
'function_definition': 'function', 'class_definition': 'class',
|
|
1680
|
+
'object_definition': 'class', 'trait_definition': 'trait',
|
|
1681
|
+
'val_definition': 'property', 'var_definition': 'property',
|
|
1682
|
+
'type_definition': 'type_alias', 'import_declaration': 'import',
|
|
1683
|
+
};
|
|
1684
|
+
EXTRACTOR_REGISTRY.set('scala', {
|
|
1685
|
+
language: 'scala', grammarName: 'scala', nodeTypeMap: SCALA_NODE_MAP,
|
|
1686
|
+
extract(tree, _src, filePath) {
|
|
1687
|
+
const lang = 'scala';
|
|
1688
|
+
const symbols = [];
|
|
1689
|
+
const references = [];
|
|
1690
|
+
const walk = (node, parent) => {
|
|
1691
|
+
const type = node.type;
|
|
1692
|
+
// import
|
|
1693
|
+
if (type === 'import_declaration') {
|
|
1694
|
+
const path = node.namedChildren?.[0];
|
|
1695
|
+
references.push({
|
|
1696
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1697
|
+
referenceName: path?.text ?? node.text.replace(/^import\s+/, '').trim(),
|
|
1698
|
+
referenceKind: 'imports',
|
|
1699
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
1700
|
+
filePath, language: lang,
|
|
1701
|
+
});
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
// class / object / trait
|
|
1705
|
+
if (type === 'class_definition' || type === 'object_definition' || type === 'trait_definition') {
|
|
1706
|
+
const name = nodeName(node);
|
|
1707
|
+
if (!name) {
|
|
1708
|
+
walkChildren(node, parent);
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1712
|
+
const kind = type === 'trait_definition' ? 'trait' :
|
|
1713
|
+
type === 'object_definition' ? 'class' : 'class';
|
|
1714
|
+
const text = node.text ?? '';
|
|
1715
|
+
const isCaseClass = text.trimStart().startsWith('case class');
|
|
1716
|
+
const decos = [];
|
|
1717
|
+
if (isCaseClass)
|
|
1718
|
+
decos.push('case');
|
|
1719
|
+
if (type === 'object_definition')
|
|
1720
|
+
decos.push('object');
|
|
1721
|
+
// annotations
|
|
1722
|
+
decos.push(...extractDecorators(node, 'annotation'));
|
|
1723
|
+
// modifiers
|
|
1724
|
+
const isAbstract = text.includes('abstract ');
|
|
1725
|
+
const isSealed = text.includes('sealed ');
|
|
1726
|
+
if (isSealed)
|
|
1727
|
+
decos.push('sealed');
|
|
1728
|
+
symbols.push(sym(kind, name, qn, filePath, lang, node, {
|
|
1729
|
+
isAbstract, decorators: decos, isStatic: type === 'object_definition',
|
|
1730
|
+
signature: firstLine(node),
|
|
1731
|
+
}));
|
|
1732
|
+
walkChildren(node, qn);
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
// def (function / method)
|
|
1736
|
+
if (type === 'function_definition') {
|
|
1737
|
+
const name = nodeName(node);
|
|
1738
|
+
if (!name) {
|
|
1739
|
+
walkChildren(node, parent);
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1743
|
+
const isMethod = parent !== '';
|
|
1744
|
+
const text = node.text ?? '';
|
|
1745
|
+
const isImplicit = text.includes('implicit ');
|
|
1746
|
+
const decos = [];
|
|
1747
|
+
if (isImplicit)
|
|
1748
|
+
decos.push('implicit');
|
|
1749
|
+
decos.push(...extractDecorators(node, 'annotation'));
|
|
1750
|
+
const visibility = text.includes('private ') ? 'private' :
|
|
1751
|
+
text.includes('protected ') ? 'protected' : 'public';
|
|
1752
|
+
symbols.push(sym(isMethod ? 'method' : 'function', name, qn, filePath, lang, node, {
|
|
1753
|
+
visibility, decorators: decos, signature: firstLine(node),
|
|
1754
|
+
}));
|
|
1755
|
+
walkChildren(node, qn);
|
|
1756
|
+
return;
|
|
1757
|
+
}
|
|
1758
|
+
// val / var
|
|
1759
|
+
if (type === 'val_definition' || type === 'var_definition') {
|
|
1760
|
+
const name = nodeName(node);
|
|
1761
|
+
if (!name) {
|
|
1762
|
+
walkChildren(node, parent);
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1766
|
+
const text = node.text ?? '';
|
|
1767
|
+
const isLazy = text.includes('lazy ');
|
|
1768
|
+
const isImplicit = text.includes('implicit ');
|
|
1769
|
+
const decos = [];
|
|
1770
|
+
if (isLazy)
|
|
1771
|
+
decos.push('lazy');
|
|
1772
|
+
if (isImplicit)
|
|
1773
|
+
decos.push('implicit');
|
|
1774
|
+
if (type === 'var_definition')
|
|
1775
|
+
decos.push('var');
|
|
1776
|
+
symbols.push(sym('property', name, qn, filePath, lang, node, {
|
|
1777
|
+
decorators: decos, signature: firstLine(node),
|
|
1778
|
+
}));
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
walkChildren(node, parent);
|
|
1782
|
+
};
|
|
1783
|
+
const walkChildren = (node, parent) => {
|
|
1784
|
+
for (const c of (node.namedChildren ?? []))
|
|
1785
|
+
walk(c, parent);
|
|
1786
|
+
};
|
|
1787
|
+
walk(tree.rootNode, '');
|
|
1788
|
+
return { symbols, references, edges: [] };
|
|
1789
|
+
},
|
|
1790
|
+
});
|
|
1791
|
+
// ---------------------------------------------------------------------------
|
|
1792
|
+
// 18. Lua — function (global/local), require, module pattern, tables
|
|
1793
|
+
// ---------------------------------------------------------------------------
|
|
1794
|
+
const LUA_NODE_MAP = {
|
|
1795
|
+
'function_declaration': 'function', 'function_definition': 'function',
|
|
1796
|
+
'local_function': 'function', 'assignment_statement': '_assign',
|
|
1797
|
+
'local_variable_declaration': '_local',
|
|
1798
|
+
};
|
|
1799
|
+
EXTRACTOR_REGISTRY.set('lua', {
|
|
1800
|
+
language: 'lua', grammarName: 'lua', nodeTypeMap: LUA_NODE_MAP,
|
|
1801
|
+
extract(tree, _src, filePath) {
|
|
1802
|
+
const lang = 'lua';
|
|
1803
|
+
const symbols = [];
|
|
1804
|
+
const references = [];
|
|
1805
|
+
const walk = (node, parent) => {
|
|
1806
|
+
const type = node.type;
|
|
1807
|
+
// function declarations (global and local)
|
|
1808
|
+
if (type === 'function_declaration' || type === 'local_function') {
|
|
1809
|
+
const name = nodeName(node);
|
|
1810
|
+
if (!name) {
|
|
1811
|
+
walkChildren(node, parent);
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1815
|
+
const isLocal = type === 'local_function';
|
|
1816
|
+
symbols.push(sym('function', name, qn, filePath, lang, node, {
|
|
1817
|
+
visibility: isLocal ? 'private' : 'public',
|
|
1818
|
+
isExported: !isLocal, signature: firstLine(node),
|
|
1819
|
+
}));
|
|
1820
|
+
walkChildren(node, qn);
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
// require('module') → import
|
|
1824
|
+
if (type === 'function_call' || type === 'call') {
|
|
1825
|
+
const fnName = nodeName(node) ?? findChild(node, 'identifier')?.text;
|
|
1826
|
+
if (fnName === 'require') {
|
|
1827
|
+
const args = findChild(node, 'arguments') ?? findChild(node, 'argument_list');
|
|
1828
|
+
const strArg = args?.namedChildren?.[0] ?? findChild(node, 'string');
|
|
1829
|
+
references.push({
|
|
1830
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1831
|
+
referenceName: (strArg?.text ?? '').replace(/['"]/g, ''),
|
|
1832
|
+
referenceKind: 'imports',
|
|
1833
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
1834
|
+
filePath, language: lang,
|
|
1835
|
+
});
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
// assignment: M = {} (module pattern) or M.fn = function()
|
|
1840
|
+
if (type === 'assignment_statement') {
|
|
1841
|
+
const lhs = node.namedChildren?.[0];
|
|
1842
|
+
const rhs = node.namedChildren?.[1] ?? findChild(node, 'expression_list')?.namedChildren?.[0];
|
|
1843
|
+
if (rhs?.type === 'function_definition' || rhs?.type === 'function') {
|
|
1844
|
+
// M.fn = function(...) → method
|
|
1845
|
+
const name = lhs?.text ?? '';
|
|
1846
|
+
if (name.includes('.')) {
|
|
1847
|
+
const parts = name.split('.');
|
|
1848
|
+
const fnName = parts.pop() ?? '';
|
|
1849
|
+
const ownerName = parts.join('.');
|
|
1850
|
+
symbols.push(sym('method', fnName, name, filePath, lang, node, {
|
|
1851
|
+
signature: firstLine(node),
|
|
1852
|
+
}));
|
|
1853
|
+
}
|
|
1854
|
+
else if (name) {
|
|
1855
|
+
symbols.push(sym('function', name, name, filePath, lang, node, {
|
|
1856
|
+
signature: firstLine(node),
|
|
1857
|
+
}));
|
|
1858
|
+
}
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
// M = {} table constructor → module pattern
|
|
1862
|
+
if (rhs?.type === 'table_constructor' && lhs?.type === 'identifier') {
|
|
1863
|
+
symbols.push(sym('module', lhs.text, lhs.text, filePath, lang, node, {
|
|
1864
|
+
decorators: ['module_table'], signature: firstLine(node),
|
|
1865
|
+
}));
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
// return M at top level — module export indicator (skip, already captured)
|
|
1870
|
+
walkChildren(node, parent);
|
|
1871
|
+
};
|
|
1872
|
+
const walkChildren = (node, parent) => {
|
|
1873
|
+
for (const c of (node.namedChildren ?? []))
|
|
1874
|
+
walk(c, parent);
|
|
1875
|
+
};
|
|
1876
|
+
walk(tree.rootNode, '');
|
|
1877
|
+
return { symbols, references, edges: [] };
|
|
1878
|
+
},
|
|
1879
|
+
});
|
|
1880
|
+
// ---------------------------------------------------------------------------
|
|
1881
|
+
// 19. Luau — Lua + type declarations, export type, strict mode
|
|
1882
|
+
// ---------------------------------------------------------------------------
|
|
1883
|
+
const LUAU_NODE_MAP = {
|
|
1884
|
+
'function_declaration': 'function', 'function_definition': 'function',
|
|
1885
|
+
'local_function': 'function', 'assignment_statement': '_assign',
|
|
1886
|
+
'local_variable_declaration': '_local',
|
|
1887
|
+
'type_declaration': 'type_alias',
|
|
1888
|
+
};
|
|
1889
|
+
EXTRACTOR_REGISTRY.set('luau', {
|
|
1890
|
+
language: 'luau', grammarName: 'luau', nodeTypeMap: LUAU_NODE_MAP,
|
|
1891
|
+
extract(tree, sourceCode, filePath) {
|
|
1892
|
+
const lang = 'luau';
|
|
1893
|
+
const symbols = [];
|
|
1894
|
+
const references = [];
|
|
1895
|
+
// Detect strict mode from first line
|
|
1896
|
+
const firstSrcLine = sourceCode.split('\n')[0]?.trim() ?? '';
|
|
1897
|
+
const isStrict = firstSrcLine.includes('--!strict');
|
|
1898
|
+
const walk = (node, parent) => {
|
|
1899
|
+
const type = node.type;
|
|
1900
|
+
// function declarations
|
|
1901
|
+
if (type === 'function_declaration' || type === 'local_function') {
|
|
1902
|
+
const name = nodeName(node);
|
|
1903
|
+
if (!name) {
|
|
1904
|
+
walkChildren(node, parent);
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1907
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1908
|
+
const isLocal = type === 'local_function';
|
|
1909
|
+
symbols.push(sym('function', name, qn, filePath, lang, node, {
|
|
1910
|
+
visibility: isLocal ? 'private' : 'public',
|
|
1911
|
+
isExported: !isLocal, signature: firstLine(node),
|
|
1912
|
+
decorators: isStrict ? ['strict'] : [],
|
|
1913
|
+
}));
|
|
1914
|
+
walkChildren(node, qn);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
// type declaration (Luau-specific)
|
|
1918
|
+
if (type === 'type_declaration') {
|
|
1919
|
+
const name = nodeName(node);
|
|
1920
|
+
if (!name) {
|
|
1921
|
+
walkChildren(node, parent);
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
1925
|
+
const text = node.text ?? '';
|
|
1926
|
+
const isExportType = text.trimStart().startsWith('export type');
|
|
1927
|
+
symbols.push(sym('type_alias', name, qn, filePath, lang, node, {
|
|
1928
|
+
isExported: isExportType,
|
|
1929
|
+
visibility: isExportType ? 'public' : 'private',
|
|
1930
|
+
decorators: isExportType ? ['export_type'] : [],
|
|
1931
|
+
signature: firstLine(node),
|
|
1932
|
+
}));
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1935
|
+
// require
|
|
1936
|
+
if (type === 'function_call' || type === 'call') {
|
|
1937
|
+
const fnName = nodeName(node) ?? findChild(node, 'identifier')?.text;
|
|
1938
|
+
if (fnName === 'require') {
|
|
1939
|
+
const args = findChild(node, 'arguments') ?? findChild(node, 'argument_list');
|
|
1940
|
+
const strArg = args?.namedChildren?.[0] ?? findChild(node, 'string');
|
|
1941
|
+
references.push({
|
|
1942
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
1943
|
+
referenceName: (strArg?.text ?? '').replace(/['"]/g, ''),
|
|
1944
|
+
referenceKind: 'imports',
|
|
1945
|
+
line: (node.startPosition?.row ?? 0) + 1, col: (node.startPosition?.column ?? 0) + 1,
|
|
1946
|
+
filePath, language: lang,
|
|
1947
|
+
});
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
// assignment: M.fn = function() or M = {}
|
|
1952
|
+
if (type === 'assignment_statement') {
|
|
1953
|
+
const lhs = node.namedChildren?.[0];
|
|
1954
|
+
const rhs = node.namedChildren?.[1] ?? findChild(node, 'expression_list')?.namedChildren?.[0];
|
|
1955
|
+
if (rhs?.type === 'function_definition' || rhs?.type === 'function') {
|
|
1956
|
+
const name = lhs?.text ?? '';
|
|
1957
|
+
if (name.includes('.')) {
|
|
1958
|
+
const parts = name.split('.');
|
|
1959
|
+
const fnName = parts.pop() ?? '';
|
|
1960
|
+
symbols.push(sym('method', fnName, name, filePath, lang, node, { signature: firstLine(node) }));
|
|
1961
|
+
}
|
|
1962
|
+
else if (name) {
|
|
1963
|
+
symbols.push(sym('function', name, name, filePath, lang, node, { signature: firstLine(node) }));
|
|
1964
|
+
}
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
if (rhs?.type === 'table_constructor' && lhs?.type === 'identifier') {
|
|
1968
|
+
symbols.push(sym('module', lhs.text, lhs.text, filePath, lang, node, {
|
|
1969
|
+
decorators: ['module_table'], signature: firstLine(node),
|
|
1970
|
+
}));
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
walkChildren(node, parent);
|
|
1975
|
+
};
|
|
1976
|
+
const walkChildren = (node, parent) => {
|
|
1977
|
+
for (const c of (node.namedChildren ?? []))
|
|
1978
|
+
walk(c, parent);
|
|
1979
|
+
};
|
|
1980
|
+
walk(tree.rootNode, '');
|
|
1981
|
+
return { symbols, references, edges: [] };
|
|
1982
|
+
},
|
|
1983
|
+
});
|
|
1984
|
+
// ---------------------------------------------------------------------------
|
|
1985
|
+
// 20. Obj-C — @interface/@implementation/@protocol, -/+ methods, @property, #import
|
|
1986
|
+
// ---------------------------------------------------------------------------
|
|
1987
|
+
const OBJC_NODE_MAP = {
|
|
1988
|
+
'class_interface': 'class', 'class_implementation': 'class',
|
|
1989
|
+
'protocol_declaration': 'interface', 'category_interface': 'class',
|
|
1990
|
+
'category_implementation': 'class',
|
|
1991
|
+
'method_declaration': 'method', 'method_definition': 'method',
|
|
1992
|
+
'property_declaration': 'property',
|
|
1993
|
+
};
|
|
1994
|
+
EXTRACTOR_REGISTRY.set('objc', {
|
|
1995
|
+
language: 'objc', grammarName: 'objc', nodeTypeMap: OBJC_NODE_MAP,
|
|
1996
|
+
extract(tree, sourceCode, filePath) {
|
|
1997
|
+
const lang = 'objc';
|
|
1998
|
+
const symbols = [];
|
|
1999
|
+
const references = [];
|
|
2000
|
+
// #import / @import from source lines (tree-sitter coverage varies)
|
|
2001
|
+
const lines = sourceCode.split('\n');
|
|
2002
|
+
for (let i = 0; i < lines.length; i++) {
|
|
2003
|
+
const line = lines[i].trim();
|
|
2004
|
+
const importMatch = line.match(/^(?:#import|@import|#include)\s+[<"]([^>"]+)[>"]/);
|
|
2005
|
+
if (importMatch) {
|
|
2006
|
+
references.push({
|
|
2007
|
+
fromSymbolName: '<module>', fromSymbolId: `${filePath}:<module>`,
|
|
2008
|
+
referenceName: importMatch[1], referenceKind: 'imports',
|
|
2009
|
+
line: i + 1, col: 1, filePath, language: lang,
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
const walk = (node, parent) => {
|
|
2014
|
+
const type = node.type;
|
|
2015
|
+
// @interface ClassName (Category) / @interface ClassName / @implementation / @protocol
|
|
2016
|
+
if (type === 'class_interface' || type === 'class_implementation' ||
|
|
2017
|
+
type === 'protocol_declaration' || type === 'category_interface' ||
|
|
2018
|
+
type === 'category_implementation') {
|
|
2019
|
+
const name = nodeName(node);
|
|
2020
|
+
if (!name) {
|
|
2021
|
+
walkChildren(node, parent);
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
// detect category: ClassName (CategoryName)
|
|
2025
|
+
const categoryName = findChild(node, 'category_name')?.text;
|
|
2026
|
+
const displayName = categoryName ? `${name} (${categoryName})` : name;
|
|
2027
|
+
const qn = parent ? `${parent}.${displayName}` : displayName;
|
|
2028
|
+
const kind = type === 'protocol_declaration' ? 'interface' : 'class';
|
|
2029
|
+
const decos = [];
|
|
2030
|
+
if (categoryName)
|
|
2031
|
+
decos.push('category');
|
|
2032
|
+
if (type === 'class_implementation' || type === 'category_implementation')
|
|
2033
|
+
decos.push('implementation');
|
|
2034
|
+
symbols.push(sym(kind, displayName, qn, filePath, lang, node, {
|
|
2035
|
+
isExported: true, decorators: decos, signature: firstLine(node),
|
|
2036
|
+
}));
|
|
2037
|
+
walkChildren(node, qn);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
// method: - (void)instanceMethod or + (void)classMethod
|
|
2041
|
+
if (type === 'method_declaration' || type === 'method_definition') {
|
|
2042
|
+
// method name from selector
|
|
2043
|
+
const selector = findChild(node, 'selector') ?? findChild(node, 'keyword_selector');
|
|
2044
|
+
const name = selector?.text ?? nodeName(node) ?? '<method>';
|
|
2045
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
2046
|
+
// - or + prefix for instance vs class method
|
|
2047
|
+
const text = (node.text ?? '').trimStart();
|
|
2048
|
+
const isStatic = text.startsWith('+');
|
|
2049
|
+
const isInstance = text.startsWith('-');
|
|
2050
|
+
symbols.push(sym('method', name, qn, filePath, lang, node, {
|
|
2051
|
+
isStatic, visibility: 'public',
|
|
2052
|
+
decorators: isInstance ? ['instance'] : isStatic ? ['class_method'] : [],
|
|
2053
|
+
signature: firstLine(node),
|
|
2054
|
+
}));
|
|
2055
|
+
return;
|
|
2056
|
+
}
|
|
2057
|
+
// @property
|
|
2058
|
+
if (type === 'property_declaration') {
|
|
2059
|
+
const name = nodeName(node);
|
|
2060
|
+
if (!name) {
|
|
2061
|
+
walkChildren(node, parent);
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
const qn = parent ? `${parent}.${name}` : name;
|
|
2065
|
+
symbols.push(sym('property', name, qn, filePath, lang, node, {
|
|
2066
|
+
visibility: 'public', signature: firstLine(node),
|
|
2067
|
+
}));
|
|
2068
|
+
return;
|
|
2069
|
+
}
|
|
2070
|
+
walkChildren(node, parent);
|
|
2071
|
+
};
|
|
2072
|
+
const walkChildren = (node, parent) => {
|
|
2073
|
+
for (const c of (node.namedChildren ?? []))
|
|
2074
|
+
walk(c, parent);
|
|
2075
|
+
};
|
|
2076
|
+
walk(tree.rootNode, '');
|
|
2077
|
+
return { symbols, references, edges: [] };
|
|
2078
|
+
},
|
|
2079
|
+
});
|
|
2080
|
+
// ---------------------------------------------------------------------------
|
|
2081
|
+
// 查询 API
|
|
2082
|
+
// ---------------------------------------------------------------------------
|
|
2083
|
+
export function getExtractor(language) {
|
|
2084
|
+
return EXTRACTOR_REGISTRY.get(language) ?? null;
|
|
2085
|
+
}
|
|
2086
|
+
export function getAllExtractors() {
|
|
2087
|
+
return EXTRACTOR_REGISTRY;
|
|
2088
|
+
}
|
|
2089
|
+
export function getSupportedLanguages() {
|
|
2090
|
+
return [...EXTRACTOR_REGISTRY.keys()];
|
|
2091
|
+
}
|
|
2092
|
+
// 文件扩展名 → 语言映射
|
|
2093
|
+
const EXTENSION_TO_LANGUAGE = {
|
|
2094
|
+
'.ts': 'typescript', '.tsx': 'tsx', '.js': 'javascript', '.jsx': 'jsx',
|
|
2095
|
+
'.mjs': 'javascript', '.cjs': 'javascript', '.mts': 'typescript', '.cts': 'typescript',
|
|
2096
|
+
'.py': 'python', '.pyi': 'python',
|
|
2097
|
+
'.go': 'go', '.rs': 'rust', '.java': 'java',
|
|
2098
|
+
'.c': 'c', '.h': 'c', '.cpp': 'cpp', '.cc': 'cpp', '.cxx': 'cpp', '.hpp': 'cpp', '.hh': 'cpp',
|
|
2099
|
+
'.cs': 'csharp', '.php': 'php', '.rb': 'ruby',
|
|
2100
|
+
'.swift': 'swift', '.kt': 'kotlin', '.kts': 'kotlin', '.dart': 'dart',
|
|
2101
|
+
'.svelte': 'svelte', '.vue': 'vue', '.liquid': 'liquid',
|
|
2102
|
+
'.pas': 'pascal', '.scala': 'scala', '.sc': 'scala',
|
|
2103
|
+
'.lua': 'lua', '.m': 'objc', '.mm': 'objc',
|
|
2104
|
+
'.yaml': 'yaml', '.yml': 'yaml', '.twig': 'twig',
|
|
2105
|
+
'.xml': 'xml', '.properties': 'properties',
|
|
2106
|
+
};
|
|
2107
|
+
export function detectLanguageFromPath(filePath) {
|
|
2108
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
2109
|
+
const ext = normalized.substring(normalized.lastIndexOf('.')).toLowerCase();
|
|
2110
|
+
return EXTENSION_TO_LANGUAGE[ext] ?? 'unknown';
|
|
2111
|
+
}
|
|
2112
|
+
// file-level-only 语言 (无 tree-sitter grammar, 但仍索引文件级)
|
|
2113
|
+
export const FILE_LEVEL_ONLY_LANGUAGES = new Set([
|
|
2114
|
+
'yaml', 'twig', 'properties',
|
|
2115
|
+
]);
|
|
2116
|
+
export function isFileLevelOnlyLanguage(language) {
|
|
2117
|
+
return FILE_LEVEL_ONLY_LANGUAGES.has(language);
|
|
2118
|
+
}
|
|
2119
|
+
//# sourceMappingURL=index.js.map
|