@saluzi/codegraph 0.1.0 → 0.2.0

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.
Files changed (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +885 -0
  3. package/package.json +42 -10
  4. package/scripts/add-lang/bench.sh +60 -0
  5. package/scripts/add-lang/check-grammar.mjs +75 -0
  6. package/scripts/add-lang/dump-ast.mjs +103 -0
  7. package/scripts/add-lang/verify-extraction.mjs +70 -0
  8. package/scripts/agent-eval/ab-adoption.sh +91 -0
  9. package/scripts/agent-eval/ab-hook.sh +86 -0
  10. package/scripts/agent-eval/ab-impl.sh +78 -0
  11. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
  12. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  13. package/scripts/agent-eval/arms-F.sh +21 -0
  14. package/scripts/agent-eval/arms-matrix.sh +37 -0
  15. package/scripts/agent-eval/audit.sh +68 -0
  16. package/scripts/agent-eval/bench-readme.sh +28 -0
  17. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  18. package/scripts/agent-eval/block-read-hook.sh +19 -0
  19. package/scripts/agent-eval/hook-settings.json +15 -0
  20. package/scripts/agent-eval/itrun.sh +120 -0
  21. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  22. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  23. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  24. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  25. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  26. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  27. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  28. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  29. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  30. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  31. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  32. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  33. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  34. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  35. package/scripts/agent-eval/offload-eval.md +76 -0
  36. package/scripts/agent-eval/parse-arms.mjs +116 -0
  37. package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
  38. package/scripts/agent-eval/parse-run.mjs +45 -0
  39. package/scripts/agent-eval/parse-session.mjs +93 -0
  40. package/scripts/agent-eval/probe-context.mjs +21 -0
  41. package/scripts/agent-eval/probe-explore.mjs +40 -0
  42. package/scripts/agent-eval/probe-node.mjs +20 -0
  43. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  44. package/scripts/agent-eval/probe-trace.mjs +20 -0
  45. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  46. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  47. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  48. package/scripts/agent-eval/run-agent.sh +34 -0
  49. package/scripts/agent-eval/run-all.sh +75 -0
  50. package/scripts/agent-eval/run-arms.sh +56 -0
  51. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  52. package/scripts/build-bundle.sh +123 -0
  53. package/scripts/extract-release-notes.mjs +130 -0
  54. package/scripts/local-install.sh +41 -0
  55. package/scripts/npm-sdk.js +75 -0
  56. package/scripts/npm-shim.js +275 -0
  57. package/scripts/pack-npm.sh +119 -0
  58. package/scripts/prepare-release.mjs +270 -0
  59. package/dist/bin/codegraph.d.ts +0 -25
  60. package/dist/bin/node-version-check.d.ts +0 -37
  61. package/dist/bin/uninstall.d.ts +0 -14
  62. package/dist/context/formatter.d.ts +0 -33
  63. package/dist/context/formatter.js +0 -244
  64. package/dist/context/index.d.ts +0 -117
  65. package/dist/context/index.js +0 -1050
  66. package/dist/db/index.d.ts +0 -101
  67. package/dist/db/index.js +0 -250
  68. package/dist/db/migrations.d.ts +0 -47
  69. package/dist/db/migrations.js +0 -131
  70. package/dist/db/queries.d.ts +0 -291
  71. package/dist/db/queries.js +0 -1349
  72. package/dist/db/schema.sql +0 -151
  73. package/dist/db/sqlite-adapter.d.ts +0 -49
  74. package/dist/db/sqlite-adapter.js +0 -141
  75. package/dist/directory.d.ts +0 -62
  76. package/dist/directory.js +0 -264
  77. package/dist/errors.d.ts +0 -149
  78. package/dist/errors.js +0 -219
  79. package/dist/extraction/dfm-extractor.d.ts +0 -31
  80. package/dist/extraction/dfm-extractor.js +0 -151
  81. package/dist/extraction/grammars.d.ts +0 -94
  82. package/dist/extraction/grammars.js +0 -357
  83. package/dist/extraction/index.d.ts +0 -148
  84. package/dist/extraction/index.js +0 -1286
  85. package/dist/extraction/languages/c-cpp.d.ts +0 -4
  86. package/dist/extraction/languages/c-cpp.js +0 -126
  87. package/dist/extraction/languages/csharp.d.ts +0 -3
  88. package/dist/extraction/languages/csharp.js +0 -72
  89. package/dist/extraction/languages/dart.d.ts +0 -3
  90. package/dist/extraction/languages/dart.js +0 -192
  91. package/dist/extraction/languages/go.d.ts +0 -3
  92. package/dist/extraction/languages/go.js +0 -58
  93. package/dist/extraction/languages/index.d.ts +0 -10
  94. package/dist/extraction/languages/index.js +0 -49
  95. package/dist/extraction/languages/java.d.ts +0 -3
  96. package/dist/extraction/languages/java.js +0 -64
  97. package/dist/extraction/languages/javascript.d.ts +0 -3
  98. package/dist/extraction/languages/javascript.js +0 -90
  99. package/dist/extraction/languages/kotlin.d.ts +0 -3
  100. package/dist/extraction/languages/kotlin.js +0 -253
  101. package/dist/extraction/languages/lua.d.ts +0 -3
  102. package/dist/extraction/languages/lua.js +0 -150
  103. package/dist/extraction/languages/luau.d.ts +0 -3
  104. package/dist/extraction/languages/luau.js +0 -37
  105. package/dist/extraction/languages/pascal.d.ts +0 -3
  106. package/dist/extraction/languages/pascal.js +0 -66
  107. package/dist/extraction/languages/php.d.ts +0 -3
  108. package/dist/extraction/languages/php.js +0 -107
  109. package/dist/extraction/languages/python.d.ts +0 -3
  110. package/dist/extraction/languages/python.js +0 -56
  111. package/dist/extraction/languages/ruby.d.ts +0 -3
  112. package/dist/extraction/languages/ruby.js +0 -114
  113. package/dist/extraction/languages/rust.d.ts +0 -3
  114. package/dist/extraction/languages/rust.js +0 -109
  115. package/dist/extraction/languages/scala.d.ts +0 -3
  116. package/dist/extraction/languages/scala.js +0 -139
  117. package/dist/extraction/languages/swift.d.ts +0 -3
  118. package/dist/extraction/languages/swift.js +0 -91
  119. package/dist/extraction/languages/typescript.d.ts +0 -3
  120. package/dist/extraction/languages/typescript.js +0 -129
  121. package/dist/extraction/liquid-extractor.d.ts +0 -52
  122. package/dist/extraction/liquid-extractor.js +0 -313
  123. package/dist/extraction/parse-worker.d.ts +0 -8
  124. package/dist/extraction/parse-worker.js +0 -94
  125. package/dist/extraction/svelte-extractor.d.ts +0 -56
  126. package/dist/extraction/svelte-extractor.js +0 -272
  127. package/dist/extraction/tree-sitter-helpers.d.ts +0 -39
  128. package/dist/extraction/tree-sitter-helpers.js +0 -103
  129. package/dist/extraction/tree-sitter-types.d.ts +0 -191
  130. package/dist/extraction/tree-sitter-types.js +0 -10
  131. package/dist/extraction/tree-sitter.d.ts +0 -238
  132. package/dist/extraction/tree-sitter.js +0 -2430
  133. package/dist/extraction/vue-extractor.d.ts +0 -36
  134. package/dist/extraction/vue-extractor.js +0 -163
  135. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  136. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  137. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  138. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  139. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  140. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  141. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  142. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  143. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  144. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  145. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  146. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  147. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  148. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  149. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  150. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  151. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  152. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  153. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  154. package/dist/extraction/wasm-runtime-flags.d.ts +0 -46
  155. package/dist/extraction/wasm-runtime-flags.js +0 -105
  156. package/dist/graph/index.d.ts +0 -8
  157. package/dist/graph/index.js +0 -13
  158. package/dist/graph/queries.d.ts +0 -109
  159. package/dist/graph/queries.js +0 -366
  160. package/dist/graph/traversal.d.ts +0 -137
  161. package/dist/graph/traversal.js +0 -528
  162. package/dist/index.d.ts +0 -509
  163. package/dist/index.js +0 -800
  164. package/dist/installer/claude-md-template.d.ts +0 -19
  165. package/dist/installer/config-writer.d.ts +0 -29
  166. package/dist/installer/index.d.ts +0 -140
  167. package/dist/installer/instructions-template.d.ts +0 -30
  168. package/dist/installer/targets/claude.d.ts +0 -55
  169. package/dist/installer/targets/codex.d.ts +0 -18
  170. package/dist/installer/targets/cursor.d.ts +0 -35
  171. package/dist/installer/targets/hermes.d.ts +0 -18
  172. package/dist/installer/targets/opencode.d.ts +0 -30
  173. package/dist/installer/targets/registry.d.ts +0 -38
  174. package/dist/installer/targets/shared.d.ts +0 -92
  175. package/dist/installer/targets/toml.d.ts +0 -64
  176. package/dist/installer/targets/types.d.ts +0 -122
  177. package/dist/mcp/index.d.ts +0 -98
  178. package/dist/mcp/server-instructions.d.ts +0 -20
  179. package/dist/mcp/tools.d.ts +0 -269
  180. package/dist/mcp/transport.d.ts +0 -117
  181. package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -20
  182. package/dist/resolution/frameworks/cargo-workspace.js +0 -225
  183. package/dist/resolution/frameworks/csharp.d.ts +0 -8
  184. package/dist/resolution/frameworks/csharp.js +0 -213
  185. package/dist/resolution/frameworks/drupal.d.ts +0 -51
  186. package/dist/resolution/frameworks/drupal.js +0 -335
  187. package/dist/resolution/frameworks/express.d.ts +0 -8
  188. package/dist/resolution/frameworks/express.js +0 -225
  189. package/dist/resolution/frameworks/go.d.ts +0 -8
  190. package/dist/resolution/frameworks/go.js +0 -158
  191. package/dist/resolution/frameworks/index.d.ts +0 -52
  192. package/dist/resolution/frameworks/index.js +0 -137
  193. package/dist/resolution/frameworks/java.d.ts +0 -8
  194. package/dist/resolution/frameworks/java.js +0 -177
  195. package/dist/resolution/frameworks/laravel.d.ts +0 -13
  196. package/dist/resolution/frameworks/laravel.js +0 -248
  197. package/dist/resolution/frameworks/nestjs.d.ts +0 -26
  198. package/dist/resolution/frameworks/nestjs.js +0 -374
  199. package/dist/resolution/frameworks/python.d.ts +0 -10
  200. package/dist/resolution/frameworks/python.js +0 -278
  201. package/dist/resolution/frameworks/react.d.ts +0 -8
  202. package/dist/resolution/frameworks/react.js +0 -272
  203. package/dist/resolution/frameworks/ruby.d.ts +0 -8
  204. package/dist/resolution/frameworks/ruby.js +0 -198
  205. package/dist/resolution/frameworks/rust.d.ts +0 -8
  206. package/dist/resolution/frameworks/rust.js +0 -207
  207. package/dist/resolution/frameworks/svelte.d.ts +0 -9
  208. package/dist/resolution/frameworks/svelte.js +0 -249
  209. package/dist/resolution/frameworks/swift.d.ts +0 -10
  210. package/dist/resolution/frameworks/swift.js +0 -376
  211. package/dist/resolution/frameworks/vue.d.ts +0 -9
  212. package/dist/resolution/frameworks/vue.js +0 -306
  213. package/dist/resolution/import-resolver.d.ts +0 -61
  214. package/dist/resolution/import-resolver.js +0 -663
  215. package/dist/resolution/index.d.ts +0 -118
  216. package/dist/resolution/index.js +0 -744
  217. package/dist/resolution/lru-cache.d.ts +0 -24
  218. package/dist/resolution/lru-cache.js +0 -62
  219. package/dist/resolution/name-matcher.d.ts +0 -50
  220. package/dist/resolution/name-matcher.js +0 -384
  221. package/dist/resolution/path-aliases.d.ts +0 -72
  222. package/dist/resolution/path-aliases.js +0 -238
  223. package/dist/resolution/strip-comments.d.ts +0 -40
  224. package/dist/resolution/strip-comments.js +0 -441
  225. package/dist/resolution/types.d.ts +0 -181
  226. package/dist/resolution/types.js +0 -8
  227. package/dist/search/query-parser.d.ts +0 -61
  228. package/dist/search/query-parser.js +0 -177
  229. package/dist/search/query-utils.d.ts +0 -59
  230. package/dist/search/query-utils.js +0 -383
  231. package/dist/sync/git-hooks.d.ts +0 -54
  232. package/dist/sync/git-hooks.js +0 -223
  233. package/dist/sync/index.d.ts +0 -25
  234. package/dist/sync/index.js +0 -28
  235. package/dist/sync/watch-policy.d.ts +0 -51
  236. package/dist/sync/watch-policy.js +0 -124
  237. package/dist/sync/watcher.d.ts +0 -83
  238. package/dist/sync/watcher.js +0 -192
  239. package/dist/types.d.ts +0 -433
  240. package/dist/types.js +0 -75
  241. package/dist/ui/glyphs.d.ts +0 -42
  242. package/dist/ui/shimmer-progress.d.ts +0 -11
  243. package/dist/ui/shimmer-worker.d.ts +0 -2
  244. package/dist/ui/types.d.ts +0 -20
  245. package/dist/utils.d.ts +0 -231
  246. package/dist/utils.js +0 -549
@@ -1,376 +0,0 @@
1
- "use strict";
2
- /**
3
- * Swift Framework Resolver
4
- *
5
- * Handles SwiftUI, UIKit, and Vapor (server-side Swift) patterns.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.vaporResolver = exports.uikitResolver = exports.swiftUIResolver = void 0;
9
- const strip_comments_1 = require("../strip-comments");
10
- exports.swiftUIResolver = {
11
- name: 'swiftui',
12
- languages: ['swift'],
13
- detect(context) {
14
- // Check for SwiftUI imports in Swift files
15
- const allFiles = context.getAllFiles();
16
- for (const file of allFiles) {
17
- if (file.endsWith('.swift')) {
18
- const content = context.readFile(file);
19
- if (content && content.includes('import SwiftUI')) {
20
- return true;
21
- }
22
- }
23
- }
24
- // Check for Xcode project with SwiftUI
25
- for (const file of allFiles) {
26
- if (file.endsWith('.xcodeproj') || file.endsWith('.xcworkspace')) {
27
- return true;
28
- }
29
- }
30
- return false;
31
- },
32
- resolve(ref, context) {
33
- // Pattern 1: View references (SwiftUI views are PascalCase ending in View)
34
- if (ref.referenceName.endsWith('View') && /^[A-Z]/.test(ref.referenceName)) {
35
- const result = resolveByNameAndKind(ref.referenceName, VIEW_KINDS, VIEW_DIRS, context);
36
- if (result) {
37
- return {
38
- original: ref,
39
- targetNodeId: result,
40
- confidence: 0.85,
41
- resolvedBy: 'framework',
42
- };
43
- }
44
- }
45
- // Pattern 2: ViewModel/ObservableObject references
46
- if (ref.referenceName.endsWith('ViewModel') || ref.referenceName.endsWith('Store') || ref.referenceName.endsWith('Manager')) {
47
- const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, VIEWMODEL_DIRS, context);
48
- if (result) {
49
- return {
50
- original: ref,
51
- targetNodeId: result,
52
- confidence: 0.85,
53
- resolvedBy: 'framework',
54
- };
55
- }
56
- }
57
- // Pattern 3: Model references
58
- if (/^[A-Z][a-zA-Z]+$/.test(ref.referenceName)) {
59
- const result = resolveByNameAndKind(ref.referenceName, MODEL_KINDS, MODEL_DIRS, context);
60
- if (result) {
61
- return {
62
- original: ref,
63
- targetNodeId: result,
64
- confidence: 0.7,
65
- resolvedBy: 'framework',
66
- };
67
- }
68
- }
69
- return null;
70
- },
71
- extract(filePath, content) {
72
- if (!filePath.endsWith('.swift'))
73
- return { nodes: [], references: [] };
74
- const nodes = [];
75
- const now = Date.now();
76
- const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'swift');
77
- // Extract SwiftUI View structs
78
- // struct ContentView: View { ... }
79
- const viewPattern = /struct\s+(\w+)\s*:\s*(?:\w+\s*,\s*)*View/g;
80
- let match;
81
- while ((match = viewPattern.exec(safe)) !== null) {
82
- const [, viewName] = match;
83
- const line = safe.slice(0, match.index).split('\n').length;
84
- nodes.push({
85
- id: `view:${filePath}:${viewName}:${line}`,
86
- kind: 'component',
87
- name: viewName,
88
- qualifiedName: `${filePath}::${viewName}`,
89
- filePath,
90
- startLine: line,
91
- endLine: line,
92
- startColumn: 0,
93
- endColumn: match[0].length,
94
- language: 'swift',
95
- updatedAt: now,
96
- });
97
- }
98
- // Extract @main App entry point
99
- const appPattern = /@main\s+struct\s+(\w+)\s*:\s*App/g;
100
- while ((match = appPattern.exec(safe)) !== null) {
101
- const [, appName] = match;
102
- const line = safe.slice(0, match.index).split('\n').length;
103
- nodes.push({
104
- id: `app:${filePath}:${appName}:${line}`,
105
- kind: 'class',
106
- name: appName,
107
- qualifiedName: `${filePath}::${appName}`,
108
- filePath,
109
- startLine: line,
110
- endLine: line,
111
- startColumn: 0,
112
- endColumn: match[0].length,
113
- language: 'swift',
114
- updatedAt: now,
115
- });
116
- }
117
- return { nodes, references: [] };
118
- },
119
- };
120
- exports.uikitResolver = {
121
- name: 'uikit',
122
- languages: ['swift'],
123
- detect(context) {
124
- const allFiles = context.getAllFiles();
125
- for (const file of allFiles) {
126
- if (file.endsWith('.swift')) {
127
- const content = context.readFile(file);
128
- if (content && (content.includes('import UIKit') ||
129
- content.includes('UIViewController') ||
130
- content.includes('UIView'))) {
131
- return true;
132
- }
133
- }
134
- }
135
- return false;
136
- },
137
- resolve(ref, context) {
138
- // Pattern 1: ViewController references
139
- if (ref.referenceName.endsWith('ViewController')) {
140
- const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, VC_DIRS, context);
141
- if (result) {
142
- return {
143
- original: ref,
144
- targetNodeId: result,
145
- confidence: 0.85,
146
- resolvedBy: 'framework',
147
- };
148
- }
149
- }
150
- // Pattern 2: UIView subclass references
151
- if (ref.referenceName.endsWith('View') && !ref.referenceName.endsWith('ViewController')) {
152
- const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, UIVIEW_DIRS, context);
153
- if (result) {
154
- return {
155
- original: ref,
156
- targetNodeId: result,
157
- confidence: 0.8,
158
- resolvedBy: 'framework',
159
- };
160
- }
161
- }
162
- // Pattern 3: Cell references
163
- if (ref.referenceName.endsWith('Cell')) {
164
- const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, CELL_DIRS, context);
165
- if (result) {
166
- return {
167
- original: ref,
168
- targetNodeId: result,
169
- confidence: 0.85,
170
- resolvedBy: 'framework',
171
- };
172
- }
173
- }
174
- // Pattern 4: Delegate/DataSource references
175
- if (ref.referenceName.endsWith('Delegate') || ref.referenceName.endsWith('DataSource')) {
176
- const result = resolveByNameAndKind(ref.referenceName, PROTOCOL_KINDS, [], context);
177
- if (result) {
178
- return {
179
- original: ref,
180
- targetNodeId: result,
181
- confidence: 0.8,
182
- resolvedBy: 'framework',
183
- };
184
- }
185
- }
186
- return null;
187
- },
188
- extract(filePath, content) {
189
- if (!filePath.endsWith('.swift'))
190
- return { nodes: [], references: [] };
191
- const nodes = [];
192
- const now = Date.now();
193
- const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'swift');
194
- // Extract UIViewController subclasses
195
- const vcPattern = /class\s+(\w+)\s*:\s*(?:\w+\s*,\s*)*UIViewController/g;
196
- let match;
197
- while ((match = vcPattern.exec(safe)) !== null) {
198
- const [, vcName] = match;
199
- const line = safe.slice(0, match.index).split('\n').length;
200
- nodes.push({
201
- id: `viewcontroller:${filePath}:${vcName}:${line}`,
202
- kind: 'class',
203
- name: vcName,
204
- qualifiedName: `${filePath}::${vcName}`,
205
- filePath,
206
- startLine: line,
207
- endLine: line,
208
- startColumn: 0,
209
- endColumn: match[0].length,
210
- language: 'swift',
211
- updatedAt: now,
212
- });
213
- }
214
- // Extract UIView subclasses
215
- const viewPattern = /class\s+(\w+)\s*:\s*(?:\w+\s*,\s*)*UIView[^C]/g;
216
- while ((match = viewPattern.exec(safe)) !== null) {
217
- const [, viewName] = match;
218
- const line = safe.slice(0, match.index).split('\n').length;
219
- nodes.push({
220
- id: `uiview:${filePath}:${viewName}:${line}`,
221
- kind: 'class',
222
- name: viewName,
223
- qualifiedName: `${filePath}::${viewName}`,
224
- filePath,
225
- startLine: line,
226
- endLine: line,
227
- startColumn: 0,
228
- endColumn: match[0].length,
229
- language: 'swift',
230
- updatedAt: now,
231
- });
232
- }
233
- return { nodes, references: [] };
234
- },
235
- };
236
- exports.vaporResolver = {
237
- name: 'vapor',
238
- languages: ['swift'],
239
- detect(context) {
240
- // Check for Package.swift with Vapor dependency
241
- const packageSwift = context.readFile('Package.swift');
242
- if (packageSwift && packageSwift.includes('vapor')) {
243
- return true;
244
- }
245
- // Check for Vapor imports
246
- const allFiles = context.getAllFiles();
247
- for (const file of allFiles) {
248
- if (file.endsWith('.swift')) {
249
- const content = context.readFile(file);
250
- if (content && content.includes('import Vapor')) {
251
- return true;
252
- }
253
- }
254
- }
255
- return false;
256
- },
257
- resolve(ref, context) {
258
- // Pattern 1: Controller references
259
- if (ref.referenceName.endsWith('Controller')) {
260
- const result = resolveByNameAndKind(ref.referenceName, VAPOR_CONTROLLER_KINDS, VAPOR_CONTROLLER_DIRS, context);
261
- if (result) {
262
- return {
263
- original: ref,
264
- targetNodeId: result,
265
- confidence: 0.85,
266
- resolvedBy: 'framework',
267
- };
268
- }
269
- }
270
- // Pattern 2: Model references (Fluent)
271
- if (/^[A-Z][a-zA-Z]+$/.test(ref.referenceName)) {
272
- const result = resolveByNameAndKind(ref.referenceName, CLASS_KINDS, FLUENT_MODEL_DIRS, context);
273
- if (result) {
274
- return {
275
- original: ref,
276
- targetNodeId: result,
277
- confidence: 0.75,
278
- resolvedBy: 'framework',
279
- };
280
- }
281
- }
282
- // Pattern 3: Middleware references
283
- if (ref.referenceName.endsWith('Middleware')) {
284
- const result = resolveByNameAndKind(ref.referenceName, VAPOR_CONTROLLER_KINDS, VAPOR_MIDDLEWARE_DIRS, context);
285
- if (result) {
286
- return {
287
- original: ref,
288
- targetNodeId: result,
289
- confidence: 0.8,
290
- resolvedBy: 'framework',
291
- };
292
- }
293
- }
294
- return null;
295
- },
296
- extract(filePath, content) {
297
- if (!filePath.endsWith('.swift'))
298
- return { nodes: [], references: [] };
299
- const nodes = [];
300
- const references = [];
301
- const now = Date.now();
302
- const safe = (0, strip_comments_1.stripCommentsForRegex)(content, 'swift');
303
- // Vapor: (app|router|routes).METHOD("path", use: handler)
304
- const routeRegex = /\b(?:app|router|routes)\.(get|post|put|patch|delete)\s*\(\s*"([^"]+)"\s*,\s*use:\s*([A-Za-z_][A-Za-z0-9_.]*)/g;
305
- let match;
306
- while ((match = routeRegex.exec(safe)) !== null) {
307
- const [, method, routePath, handlerExpr] = match;
308
- const line = safe.slice(0, match.index).split('\n').length;
309
- const upper = method.toUpperCase();
310
- const routeNode = {
311
- id: `route:${filePath}:${line}:${upper}:${routePath}`,
312
- kind: 'route',
313
- name: `${upper} ${routePath}`,
314
- qualifiedName: `${filePath}::route:${routePath}`,
315
- filePath,
316
- startLine: line,
317
- endLine: line,
318
- startColumn: 0,
319
- endColumn: match[0].length,
320
- language: 'swift',
321
- updatedAt: now,
322
- };
323
- nodes.push(routeNode);
324
- // Last segment of dotted path (e.g. UserController.list -> list)
325
- const parts = handlerExpr.split('.');
326
- const handlerName = parts[parts.length - 1];
327
- if (handlerName) {
328
- references.push({
329
- fromNodeId: routeNode.id,
330
- referenceName: handlerName,
331
- referenceKind: 'references',
332
- line,
333
- column: 0,
334
- filePath,
335
- language: 'swift',
336
- });
337
- }
338
- }
339
- return { nodes, references };
340
- },
341
- };
342
- // Directory patterns
343
- const VIEW_DIRS = ['/Views/', '/View/', '/Screens/', '/Components/', '/UI/'];
344
- const VIEWMODEL_DIRS = ['/ViewModels/', '/ViewModel/', '/Stores/', '/Managers/', '/Services/'];
345
- const MODEL_DIRS = ['/Models/', '/Model/', '/Entities/', '/Domain/'];
346
- const VC_DIRS = ['/ViewControllers/', '/ViewController/', '/Controllers/', '/Screens/'];
347
- const UIVIEW_DIRS = ['/Views/', '/View/', '/UI/', '/Components/'];
348
- const CELL_DIRS = ['/Cells/', '/Cell/', '/Views/', '/TableViewCells/', '/CollectionViewCells/'];
349
- const VAPOR_CONTROLLER_DIRS = ['/Controllers/', '/Controller/', '/Routes/'];
350
- const FLUENT_MODEL_DIRS = ['/Models/', '/Model/', '/Entities/', '/Database/'];
351
- const VAPOR_MIDDLEWARE_DIRS = ['/Middleware/', '/Middlewares/'];
352
- const VIEW_KINDS = new Set(['struct', 'component']);
353
- const CLASS_KINDS = new Set(['class']);
354
- const MODEL_KINDS = new Set(['struct', 'class']);
355
- const PROTOCOL_KINDS = new Set(['protocol']);
356
- const VAPOR_CONTROLLER_KINDS = new Set(['class', 'struct']);
357
- /**
358
- * Resolve a symbol by name using indexed queries instead of scanning all files.
359
- */
360
- function resolveByNameAndKind(name, kinds, preferredDirPatterns, context) {
361
- const candidates = context.getNodesByName(name);
362
- if (candidates.length === 0)
363
- return null;
364
- const kindFiltered = candidates.filter((n) => kinds.has(n.kind));
365
- if (kindFiltered.length === 0)
366
- return null;
367
- // Prefer candidates in framework-conventional directories
368
- if (preferredDirPatterns.length > 0) {
369
- const preferred = kindFiltered.filter((n) => preferredDirPatterns.some((d) => n.filePath.includes(d)));
370
- if (preferred.length > 0)
371
- return preferred[0].id;
372
- }
373
- // Fall back to any match
374
- return kindFiltered[0].id;
375
- }
376
- //# sourceMappingURL=swift.js.map
@@ -1,9 +0,0 @@
1
- /**
2
- * Vue / Nuxt Framework Resolver
3
- *
4
- * Handles Vue component references, compiler macros (defineProps, etc.),
5
- * Nuxt auto-imports, and Nuxt file-based routing patterns.
6
- */
7
- import { FrameworkResolver } from '../types'
8
- export declare const vueResolver: FrameworkResolver
9
- //# sourceMappingURL=vue.d.ts.map
@@ -1,306 +0,0 @@
1
- "use strict";
2
- /**
3
- * Vue / Nuxt Framework Resolver
4
- *
5
- * Handles Vue component references, compiler macros (defineProps, etc.),
6
- * Nuxt auto-imports, and Nuxt file-based routing patterns.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.vueResolver = void 0;
10
- /**
11
- * Vue 3 compiler macros — compiler-provided, not user code
12
- */
13
- const VUE_COMPILER_MACROS = new Set([
14
- 'defineProps',
15
- 'defineEmits',
16
- 'defineExpose',
17
- 'defineOptions',
18
- 'defineSlots',
19
- 'defineModel',
20
- 'withDefaults',
21
- ]);
22
- /**
23
- * Nuxt auto-imported composables and utilities
24
- */
25
- const NUXT_AUTO_IMPORTS = new Set([
26
- // Routing
27
- 'useRoute',
28
- 'useRouter',
29
- 'navigateTo',
30
- 'abortNavigation',
31
- // Data fetching
32
- 'useFetch',
33
- 'useAsyncData',
34
- 'useLazyFetch',
35
- 'useLazyAsyncData',
36
- 'refreshNuxtData',
37
- // State
38
- 'useState',
39
- 'clearNuxtState',
40
- // Head
41
- 'useHead',
42
- 'useSeoMeta',
43
- 'useServerSeoMeta',
44
- // Runtime
45
- 'useRuntimeConfig',
46
- 'useAppConfig',
47
- 'useNuxtApp',
48
- // Cookies
49
- 'useCookie',
50
- // Error
51
- 'useError',
52
- 'createError',
53
- 'showError',
54
- 'clearError',
55
- // Page/layout
56
- 'definePageMeta',
57
- 'defineNuxtConfig',
58
- 'defineNuxtPlugin',
59
- 'defineNuxtRouteMiddleware',
60
- // Request
61
- 'useRequestHeaders',
62
- 'useRequestEvent',
63
- 'useRequestFetch',
64
- 'useRequestURL',
65
- ]);
66
- /**
67
- * Nuxt virtual module prefixes (auto-import namespaces)
68
- */
69
- const NUXT_VIRTUAL_MODULES = [
70
- '#imports',
71
- '#components',
72
- '#app',
73
- '#build',
74
- '#head',
75
- ];
76
- exports.vueResolver = {
77
- name: 'vue',
78
- detect(context) {
79
- // Check for vue or nuxt in package.json
80
- const packageJson = context.readFile('package.json');
81
- if (packageJson) {
82
- try {
83
- const pkg = JSON.parse(packageJson);
84
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
85
- if (deps.vue || deps.nuxt || deps['@nuxt/kit']) {
86
- return true;
87
- }
88
- }
89
- catch {
90
- // Invalid JSON
91
- }
92
- }
93
- // Check for .vue files in project
94
- const allFiles = context.getAllFiles();
95
- return allFiles.some((f) => f.endsWith('.vue'));
96
- },
97
- resolve(ref, context) {
98
- // Pattern 1: Vue compiler macros (defineProps, defineEmits, etc.)
99
- if (VUE_COMPILER_MACROS.has(ref.referenceName)) {
100
- return {
101
- original: ref,
102
- targetNodeId: ref.fromNodeId,
103
- confidence: 1.0,
104
- resolvedBy: 'framework',
105
- };
106
- }
107
- // Pattern 2: Nuxt auto-imported composables
108
- if (NUXT_AUTO_IMPORTS.has(ref.referenceName)) {
109
- return {
110
- original: ref,
111
- targetNodeId: ref.fromNodeId,
112
- confidence: 1.0,
113
- resolvedBy: 'framework',
114
- };
115
- }
116
- // Pattern 3: Nuxt virtual module imports (#imports, #components, etc.)
117
- if (ref.referenceKind === 'imports' && ref.referenceName.startsWith('#')) {
118
- if (NUXT_VIRTUAL_MODULES.some((prefix) => ref.referenceName.startsWith(prefix))) {
119
- return {
120
- original: ref,
121
- targetNodeId: ref.fromNodeId,
122
- confidence: 1.0,
123
- resolvedBy: 'framework',
124
- };
125
- }
126
- }
127
- // Pattern 4: @ alias imports (@/components/Foo -> src/components/Foo)
128
- if (ref.referenceKind === 'imports' && ref.referenceName.startsWith('@/')) {
129
- const aliasPath = ref.referenceName.replace('@/', 'src/');
130
- for (const ext of ['', '.ts', '.js', '.vue', '/index.ts', '/index.js', '/index.vue']) {
131
- const fullPath = aliasPath + ext;
132
- if (context.fileExists(fullPath)) {
133
- const nodes = context.getNodesInFile(fullPath);
134
- if (nodes.length > 0) {
135
- return {
136
- original: ref,
137
- targetNodeId: nodes[0].id,
138
- confidence: 0.9,
139
- resolvedBy: 'framework',
140
- };
141
- }
142
- }
143
- }
144
- }
145
- // Pattern 5: ~ alias imports (~/components/Foo -> src/components/Foo, Nuxt convention)
146
- if (ref.referenceKind === 'imports' && ref.referenceName.startsWith('~/')) {
147
- const aliasPath = ref.referenceName.replace('~/', 'src/');
148
- for (const ext of ['', '.ts', '.js', '.vue', '/index.ts', '/index.js', '/index.vue']) {
149
- const fullPath = aliasPath + ext;
150
- if (context.fileExists(fullPath)) {
151
- const nodes = context.getNodesInFile(fullPath);
152
- if (nodes.length > 0) {
153
- return {
154
- original: ref,
155
- targetNodeId: nodes[0].id,
156
- confidence: 0.9,
157
- resolvedBy: 'framework',
158
- };
159
- }
160
- }
161
- }
162
- }
163
- // Pattern 6: Component references (PascalCase) — resolve to .vue files
164
- if (isPascalCase(ref.referenceName) && ref.referenceKind === 'calls') {
165
- const result = resolveComponent(ref.referenceName, ref.filePath, context);
166
- if (result) {
167
- return {
168
- original: ref,
169
- targetNodeId: result,
170
- confidence: 0.8,
171
- resolvedBy: 'framework',
172
- };
173
- }
174
- }
175
- return null;
176
- },
177
- extract(filePath, _content) {
178
- const nodes = [];
179
- const now = Date.now();
180
- // Normalize to forward slashes
181
- const normalized = filePath.replace(/\\/g, '/');
182
- // Detect Nuxt page routes (pages/ directory)
183
- const pagesIndex = normalized.indexOf('/pages/');
184
- if (pagesIndex !== -1 && normalized.endsWith('.vue')) {
185
- const routePath = filePathToNuxtRoute(normalized, pagesIndex + '/pages/'.length);
186
- if (routePath !== null) {
187
- nodes.push({
188
- id: `route:${filePath}:${routePath}:1`,
189
- kind: 'route',
190
- name: routePath,
191
- qualifiedName: `${filePath}::route:${routePath}`,
192
- filePath,
193
- startLine: 1,
194
- endLine: 1,
195
- startColumn: 0,
196
- endColumn: 0,
197
- language: 'vue',
198
- updatedAt: now,
199
- });
200
- }
201
- }
202
- // Detect Nuxt API routes (server/api/ directory)
203
- const apiIndex = normalized.indexOf('/server/api/');
204
- if (apiIndex !== -1) {
205
- const afterApi = normalized.substring(apiIndex + '/server/api/'.length);
206
- const routeName = afterApi
207
- .replace(/\.[^/.]+$/, '') // Remove extension
208
- .replace(/\/index$/, ''); // index -> parent path
209
- const apiRoute = '/api/' + routeName;
210
- nodes.push({
211
- id: `route:${filePath}:${apiRoute}:1`,
212
- kind: 'route',
213
- name: apiRoute,
214
- qualifiedName: `${filePath}::route:${apiRoute}`,
215
- filePath,
216
- startLine: 1,
217
- endLine: 1,
218
- startColumn: 0,
219
- endColumn: 0,
220
- language: normalized.endsWith('.vue') ? 'vue' : 'typescript',
221
- updatedAt: now,
222
- });
223
- }
224
- // Detect Nuxt middleware (middleware/ directory)
225
- const middlewareIndex = normalized.indexOf('/middleware/');
226
- if (middlewareIndex !== -1) {
227
- const afterMiddleware = normalized.substring(middlewareIndex + '/middleware/'.length);
228
- const middlewareName = afterMiddleware.replace(/\.[^/.]+$/, '');
229
- nodes.push({
230
- id: `middleware:${filePath}:${middlewareName}:1`,
231
- kind: 'function',
232
- name: middlewareName,
233
- qualifiedName: `${filePath}::middleware:${middlewareName}`,
234
- filePath,
235
- startLine: 1,
236
- endLine: 1,
237
- startColumn: 0,
238
- endColumn: 0,
239
- language: normalized.endsWith('.vue') ? 'vue' : 'typescript',
240
- updatedAt: now,
241
- });
242
- }
243
- return { nodes, references: [] };
244
- },
245
- };
246
- /**
247
- * Check if string is PascalCase
248
- */
249
- function isPascalCase(str) {
250
- return /^[A-Z][a-zA-Z0-9]*$/.test(str);
251
- }
252
- /**
253
- * Resolve a Vue component reference to its .vue file
254
- */
255
- function resolveComponent(name, fromFile, context) {
256
- const allFiles = context.getAllFiles();
257
- const vueFiles = allFiles.filter((f) => f.endsWith('.vue'));
258
- // Check for exact name match (Button -> Button.vue)
259
- for (const file of vueFiles) {
260
- const fileName = file.split(/[/\\]/).pop() || '';
261
- const componentName = fileName.replace(/\.vue$/, '');
262
- if (componentName === name) {
263
- const nodes = context.getNodesInFile(file);
264
- const component = nodes.find((n) => n.kind === 'component' && n.name === name);
265
- if (component) {
266
- return component.id;
267
- }
268
- }
269
- }
270
- // Check same directory first for better specificity
271
- const fromDir = fromFile.substring(0, fromFile.lastIndexOf('/'));
272
- for (const file of vueFiles) {
273
- if (file.startsWith(fromDir)) {
274
- const fileName = file.split(/[/\\]/).pop() || '';
275
- const componentName = fileName.replace(/\.vue$/, '');
276
- if (componentName === name) {
277
- const nodes = context.getNodesInFile(file);
278
- const component = nodes.find((n) => n.kind === 'component');
279
- if (component) {
280
- return component.id;
281
- }
282
- }
283
- }
284
- }
285
- return null;
286
- }
287
- /**
288
- * Convert a file path to a Nuxt route path
289
- */
290
- function filePathToNuxtRoute(normalized, afterPagesStart) {
291
- const afterPages = normalized.substring(afterPagesStart);
292
- // Remove the .vue extension
293
- const withoutExt = afterPages.replace(/\.vue$/, '');
294
- // Remove /index suffix (index.vue -> parent route)
295
- const withoutIndex = withoutExt.replace(/\/index$/, '');
296
- // Convert Nuxt param syntax [param] to :param
297
- let route = '/' + withoutIndex
298
- .replace(/\[\.\.\.([^\]]+)\]/g, '*$1') // [...slug] -> *slug (catch-all)
299
- .replace(/\[{2}([^\]]+)\]{2}/g, ':$1?') // [[optional]] -> :optional?
300
- .replace(/\[([^\]]+)\]/g, ':$1'); // [param] -> :param
301
- if (route === '/')
302
- return '/';
303
- // Remove trailing slash
304
- return route.replace(/\/$/, '');
305
- }
306
- //# sourceMappingURL=vue.js.map