distill-mcp 0.6.0-beta

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 (440) hide show
  1. package/bin/cli.js +133 -0
  2. package/dist/analytics/session-tracker.d.ts +74 -0
  3. package/dist/analytics/session-tracker.d.ts.map +1 -0
  4. package/dist/analytics/session-tracker.js +123 -0
  5. package/dist/ast/benchmark.test.d.ts +7 -0
  6. package/dist/ast/benchmark.test.d.ts.map +1 -0
  7. package/dist/ast/benchmark.test.js +175 -0
  8. package/dist/ast/go/index.d.ts +9 -0
  9. package/dist/ast/go/index.d.ts.map +1 -0
  10. package/dist/ast/go/index.js +8 -0
  11. package/dist/ast/go/parser.d.ts +31 -0
  12. package/dist/ast/go/parser.d.ts.map +1 -0
  13. package/dist/ast/go/parser.js +428 -0
  14. package/dist/ast/go/parser.test.d.ts +5 -0
  15. package/dist/ast/go/parser.test.d.ts.map +1 -0
  16. package/dist/ast/go/parser.test.js +241 -0
  17. package/dist/ast/go/queries.d.ts +51 -0
  18. package/dist/ast/go/queries.d.ts.map +1 -0
  19. package/dist/ast/go/queries.js +114 -0
  20. package/dist/ast/go/utils.d.ts +66 -0
  21. package/dist/ast/go/utils.d.ts.map +1 -0
  22. package/dist/ast/go/utils.js +140 -0
  23. package/dist/ast/index.d.ts +39 -0
  24. package/dist/ast/index.d.ts.map +1 -0
  25. package/dist/ast/index.js +245 -0
  26. package/dist/ast/php/index.d.ts +9 -0
  27. package/dist/ast/php/index.d.ts.map +1 -0
  28. package/dist/ast/php/index.js +8 -0
  29. package/dist/ast/php/parser.d.ts +31 -0
  30. package/dist/ast/php/parser.d.ts.map +1 -0
  31. package/dist/ast/php/parser.js +388 -0
  32. package/dist/ast/php/parser.test.d.ts +5 -0
  33. package/dist/ast/php/parser.test.d.ts.map +1 -0
  34. package/dist/ast/php/parser.test.js +328 -0
  35. package/dist/ast/php/queries.d.ts +61 -0
  36. package/dist/ast/php/queries.d.ts.map +1 -0
  37. package/dist/ast/php/queries.js +117 -0
  38. package/dist/ast/php/utils.d.ts +83 -0
  39. package/dist/ast/php/utils.d.ts.map +1 -0
  40. package/dist/ast/php/utils.js +246 -0
  41. package/dist/ast/python/index.d.ts +9 -0
  42. package/dist/ast/python/index.d.ts.map +1 -0
  43. package/dist/ast/python/index.js +8 -0
  44. package/dist/ast/python/parser.d.ts +32 -0
  45. package/dist/ast/python/parser.d.ts.map +1 -0
  46. package/dist/ast/python/parser.js +422 -0
  47. package/dist/ast/python/parser.test.d.ts +5 -0
  48. package/dist/ast/python/parser.test.d.ts.map +1 -0
  49. package/dist/ast/python/parser.test.js +186 -0
  50. package/dist/ast/python/queries.d.ts +73 -0
  51. package/dist/ast/python/queries.d.ts.map +1 -0
  52. package/dist/ast/python/queries.js +137 -0
  53. package/dist/ast/python/utils.d.ts +63 -0
  54. package/dist/ast/python/utils.d.ts.map +1 -0
  55. package/dist/ast/python/utils.js +159 -0
  56. package/dist/ast/quick-scan.d.ts +40 -0
  57. package/dist/ast/quick-scan.d.ts.map +1 -0
  58. package/dist/ast/quick-scan.js +287 -0
  59. package/dist/ast/rust/index.d.ts +9 -0
  60. package/dist/ast/rust/index.d.ts.map +1 -0
  61. package/dist/ast/rust/index.js +8 -0
  62. package/dist/ast/rust/parser.d.ts +31 -0
  63. package/dist/ast/rust/parser.d.ts.map +1 -0
  64. package/dist/ast/rust/parser.js +416 -0
  65. package/dist/ast/rust/parser.test.d.ts +5 -0
  66. package/dist/ast/rust/parser.test.d.ts.map +1 -0
  67. package/dist/ast/rust/parser.test.js +329 -0
  68. package/dist/ast/rust/queries.d.ts +66 -0
  69. package/dist/ast/rust/queries.d.ts.map +1 -0
  70. package/dist/ast/rust/queries.js +132 -0
  71. package/dist/ast/rust/utils.d.ts +91 -0
  72. package/dist/ast/rust/utils.d.ts.map +1 -0
  73. package/dist/ast/rust/utils.js +254 -0
  74. package/dist/ast/swift/index.d.ts +10 -0
  75. package/dist/ast/swift/index.d.ts.map +1 -0
  76. package/dist/ast/swift/index.js +8 -0
  77. package/dist/ast/swift/parser.d.ts +31 -0
  78. package/dist/ast/swift/parser.d.ts.map +1 -0
  79. package/dist/ast/swift/parser.js +554 -0
  80. package/dist/ast/swift/parser.test.d.ts +5 -0
  81. package/dist/ast/swift/parser.test.d.ts.map +1 -0
  82. package/dist/ast/swift/parser.test.js +398 -0
  83. package/dist/ast/swift/queries.d.ts +71 -0
  84. package/dist/ast/swift/queries.d.ts.map +1 -0
  85. package/dist/ast/swift/queries.js +137 -0
  86. package/dist/ast/swift/utils.d.ts +94 -0
  87. package/dist/ast/swift/utils.d.ts.map +1 -0
  88. package/dist/ast/swift/utils.js +411 -0
  89. package/dist/ast/types.d.ts +96 -0
  90. package/dist/ast/types.d.ts.map +1 -0
  91. package/dist/ast/types.js +21 -0
  92. package/dist/ast/typescript.d.ts +24 -0
  93. package/dist/ast/typescript.d.ts.map +1 -0
  94. package/dist/ast/typescript.js +357 -0
  95. package/dist/cache/file-hash.d.ts +33 -0
  96. package/dist/cache/file-hash.d.ts.map +1 -0
  97. package/dist/cache/file-hash.js +59 -0
  98. package/dist/cache/index.d.ts +9 -0
  99. package/dist/cache/index.d.ts.map +1 -0
  100. package/dist/cache/index.js +8 -0
  101. package/dist/cache/smart-cache.d.ts +68 -0
  102. package/dist/cache/smart-cache.d.ts.map +1 -0
  103. package/dist/cache/smart-cache.js +266 -0
  104. package/dist/cache/types.d.ts +102 -0
  105. package/dist/cache/types.d.ts.map +1 -0
  106. package/dist/cache/types.js +6 -0
  107. package/dist/cli/analyze.d.ts +43 -0
  108. package/dist/cli/analyze.d.ts.map +1 -0
  109. package/dist/cli/analyze.js +250 -0
  110. package/dist/cli/doctor.d.ts +2 -0
  111. package/dist/cli/doctor.d.ts.map +1 -0
  112. package/dist/cli/doctor.js +127 -0
  113. package/dist/cli/hooks.d.ts +14 -0
  114. package/dist/cli/hooks.d.ts.map +1 -0
  115. package/dist/cli/hooks.js +229 -0
  116. package/dist/cli/index.d.ts +5 -0
  117. package/dist/cli/index.d.ts.map +1 -0
  118. package/dist/cli/index.js +4 -0
  119. package/dist/cli/setup.d.ts +10 -0
  120. package/dist/cli/setup.d.ts.map +1 -0
  121. package/dist/cli/setup.js +117 -0
  122. package/dist/cli/utils.d.ts +30 -0
  123. package/dist/cli/utils.d.ts.map +1 -0
  124. package/dist/cli/utils.js +116 -0
  125. package/dist/compressors/config.d.ts +9 -0
  126. package/dist/compressors/config.d.ts.map +1 -0
  127. package/dist/compressors/config.js +183 -0
  128. package/dist/compressors/conversation.d.ts +109 -0
  129. package/dist/compressors/conversation.d.ts.map +1 -0
  130. package/dist/compressors/conversation.js +404 -0
  131. package/dist/compressors/diff.d.ts +35 -0
  132. package/dist/compressors/diff.d.ts.map +1 -0
  133. package/dist/compressors/diff.js +389 -0
  134. package/dist/compressors/generic.d.ts +9 -0
  135. package/dist/compressors/generic.d.ts.map +1 -0
  136. package/dist/compressors/generic.js +188 -0
  137. package/dist/compressors/index.d.ts +31 -0
  138. package/dist/compressors/index.d.ts.map +1 -0
  139. package/dist/compressors/index.js +82 -0
  140. package/dist/compressors/logs.d.ts +9 -0
  141. package/dist/compressors/logs.d.ts.map +1 -0
  142. package/dist/compressors/logs.js +245 -0
  143. package/dist/compressors/multifile.d.ts +106 -0
  144. package/dist/compressors/multifile.d.ts.map +1 -0
  145. package/dist/compressors/multifile.js +498 -0
  146. package/dist/compressors/semantic.d.ts +33 -0
  147. package/dist/compressors/semantic.d.ts.map +1 -0
  148. package/dist/compressors/semantic.js +233 -0
  149. package/dist/compressors/stacktrace.d.ts +9 -0
  150. package/dist/compressors/stacktrace.d.ts.map +1 -0
  151. package/dist/compressors/stacktrace.js +259 -0
  152. package/dist/compressors/types.d.ts +146 -0
  153. package/dist/compressors/types.d.ts.map +1 -0
  154. package/dist/compressors/types.js +6 -0
  155. package/dist/config/output-config.d.ts +56 -0
  156. package/dist/config/output-config.d.ts.map +1 -0
  157. package/dist/config/output-config.js +78 -0
  158. package/dist/index.d.ts +21 -0
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +27 -0
  161. package/dist/middleware/chain.d.ts +49 -0
  162. package/dist/middleware/chain.d.ts.map +1 -0
  163. package/dist/middleware/chain.js +126 -0
  164. package/dist/middleware/index.d.ts +4 -0
  165. package/dist/middleware/index.d.ts.map +1 -0
  166. package/dist/middleware/index.js +3 -0
  167. package/dist/middleware/logging.d.ts +8 -0
  168. package/dist/middleware/logging.d.ts.map +1 -0
  169. package/dist/middleware/logging.js +71 -0
  170. package/dist/middleware/types.d.ts +58 -0
  171. package/dist/middleware/types.d.ts.map +1 -0
  172. package/dist/middleware/types.js +7 -0
  173. package/dist/parsers/eslint.d.ts +8 -0
  174. package/dist/parsers/eslint.d.ts.map +1 -0
  175. package/dist/parsers/eslint.js +132 -0
  176. package/dist/parsers/generic.d.ts +8 -0
  177. package/dist/parsers/generic.d.ts.map +1 -0
  178. package/dist/parsers/generic.js +234 -0
  179. package/dist/parsers/index.d.ts +34 -0
  180. package/dist/parsers/index.d.ts.map +1 -0
  181. package/dist/parsers/index.js +216 -0
  182. package/dist/parsers/types.d.ts +84 -0
  183. package/dist/parsers/types.d.ts.map +1 -0
  184. package/dist/parsers/types.js +6 -0
  185. package/dist/parsers/typescript.d.ts +8 -0
  186. package/dist/parsers/typescript.d.ts.map +1 -0
  187. package/dist/parsers/typescript.js +107 -0
  188. package/dist/pipelines/definitions.d.ts +50 -0
  189. package/dist/pipelines/definitions.d.ts.map +1 -0
  190. package/dist/pipelines/definitions.js +206 -0
  191. package/dist/sandbox/executor.d.ts +12 -0
  192. package/dist/sandbox/executor.d.ts.map +1 -0
  193. package/dist/sandbox/executor.js +191 -0
  194. package/dist/sandbox/index.d.ts +11 -0
  195. package/dist/sandbox/index.d.ts.map +1 -0
  196. package/dist/sandbox/index.js +9 -0
  197. package/dist/sandbox/sandbox.test.d.ts +7 -0
  198. package/dist/sandbox/sandbox.test.d.ts.map +1 -0
  199. package/dist/sandbox/sandbox.test.js +202 -0
  200. package/dist/sandbox/sdk/analyze.d.ts +36 -0
  201. package/dist/sandbox/sdk/analyze.d.ts.map +1 -0
  202. package/dist/sandbox/sdk/analyze.js +413 -0
  203. package/dist/sandbox/sdk/analyze.test.d.ts +7 -0
  204. package/dist/sandbox/sdk/analyze.test.d.ts.map +1 -0
  205. package/dist/sandbox/sdk/analyze.test.js +191 -0
  206. package/dist/sandbox/sdk/code.d.ts +20 -0
  207. package/dist/sandbox/sdk/code.d.ts.map +1 -0
  208. package/dist/sandbox/sdk/code.js +104 -0
  209. package/dist/sandbox/sdk/compress.d.ts +23 -0
  210. package/dist/sandbox/sdk/compress.d.ts.map +1 -0
  211. package/dist/sandbox/sdk/compress.js +107 -0
  212. package/dist/sandbox/sdk/conversation.d.ts +148 -0
  213. package/dist/sandbox/sdk/conversation.d.ts.map +1 -0
  214. package/dist/sandbox/sdk/conversation.js +177 -0
  215. package/dist/sandbox/sdk/files.d.ts +29 -0
  216. package/dist/sandbox/sdk/files.d.ts.map +1 -0
  217. package/dist/sandbox/sdk/files.js +41 -0
  218. package/dist/sandbox/sdk/git.d.ts +37 -0
  219. package/dist/sandbox/sdk/git.d.ts.map +1 -0
  220. package/dist/sandbox/sdk/git.js +313 -0
  221. package/dist/sandbox/sdk/git.test.d.ts +8 -0
  222. package/dist/sandbox/sdk/git.test.d.ts.map +1 -0
  223. package/dist/sandbox/sdk/git.test.js +160 -0
  224. package/dist/sandbox/sdk/index.d.ts +16 -0
  225. package/dist/sandbox/sdk/index.d.ts.map +1 -0
  226. package/dist/sandbox/sdk/index.js +15 -0
  227. package/dist/sandbox/sdk/multifile.d.ts +63 -0
  228. package/dist/sandbox/sdk/multifile.d.ts.map +1 -0
  229. package/dist/sandbox/sdk/multifile.js +130 -0
  230. package/dist/sandbox/sdk/pipeline.d.ts +16 -0
  231. package/dist/sandbox/sdk/pipeline.d.ts.map +1 -0
  232. package/dist/sandbox/sdk/pipeline.js +454 -0
  233. package/dist/sandbox/sdk/pipeline.test.d.ts +7 -0
  234. package/dist/sandbox/sdk/pipeline.test.d.ts.map +1 -0
  235. package/dist/sandbox/sdk/pipeline.test.js +197 -0
  236. package/dist/sandbox/sdk/search.d.ts +36 -0
  237. package/dist/sandbox/sdk/search.d.ts.map +1 -0
  238. package/dist/sandbox/sdk/search.js +338 -0
  239. package/dist/sandbox/sdk/search.test.d.ts +7 -0
  240. package/dist/sandbox/sdk/search.test.d.ts.map +1 -0
  241. package/dist/sandbox/sdk/search.test.js +183 -0
  242. package/dist/sandbox/sdk/utils.d.ts +18 -0
  243. package/dist/sandbox/sdk/utils.d.ts.map +1 -0
  244. package/dist/sandbox/sdk/utils.js +24 -0
  245. package/dist/sandbox/security/code-analyzer.d.ts +15 -0
  246. package/dist/sandbox/security/code-analyzer.d.ts.map +1 -0
  247. package/dist/sandbox/security/code-analyzer.js +87 -0
  248. package/dist/sandbox/security/index.d.ts +6 -0
  249. package/dist/sandbox/security/index.d.ts.map +1 -0
  250. package/dist/sandbox/security/index.js +5 -0
  251. package/dist/sandbox/security/path-validator.d.ts +23 -0
  252. package/dist/sandbox/security/path-validator.d.ts.map +1 -0
  253. package/dist/sandbox/security/path-validator.js +113 -0
  254. package/dist/sandbox/types.d.ts +577 -0
  255. package/dist/sandbox/types.d.ts.map +1 -0
  256. package/dist/sandbox/types.js +14 -0
  257. package/dist/server.d.ts +36 -0
  258. package/dist/server.d.ts.map +1 -0
  259. package/dist/server.js +133 -0
  260. package/dist/summarizers/build-logs.d.ts +11 -0
  261. package/dist/summarizers/build-logs.d.ts.map +1 -0
  262. package/dist/summarizers/build-logs.js +234 -0
  263. package/dist/summarizers/generic.d.ts +11 -0
  264. package/dist/summarizers/generic.d.ts.map +1 -0
  265. package/dist/summarizers/generic.js +93 -0
  266. package/dist/summarizers/index.d.ts +20 -0
  267. package/dist/summarizers/index.d.ts.map +1 -0
  268. package/dist/summarizers/index.js +43 -0
  269. package/dist/summarizers/server-logs.d.ts +11 -0
  270. package/dist/summarizers/server-logs.d.ts.map +1 -0
  271. package/dist/summarizers/server-logs.js +215 -0
  272. package/dist/summarizers/test-logs.d.ts +11 -0
  273. package/dist/summarizers/test-logs.d.ts.map +1 -0
  274. package/dist/summarizers/test-logs.js +258 -0
  275. package/dist/summarizers/types.d.ts +146 -0
  276. package/dist/summarizers/types.d.ts.map +1 -0
  277. package/dist/summarizers/types.js +21 -0
  278. package/dist/tools/analyze-build-output.d.ts +30 -0
  279. package/dist/tools/analyze-build-output.d.ts.map +1 -0
  280. package/dist/tools/analyze-build-output.js +45 -0
  281. package/dist/tools/analyze-context.d.ts +23 -0
  282. package/dist/tools/analyze-context.d.ts.map +1 -0
  283. package/dist/tools/analyze-context.js +78 -0
  284. package/dist/tools/auto-optimize.d.ts +9 -0
  285. package/dist/tools/auto-optimize.d.ts.map +1 -0
  286. package/dist/tools/auto-optimize.js +191 -0
  287. package/dist/tools/code-execute.d.ts +9 -0
  288. package/dist/tools/code-execute.d.ts.map +1 -0
  289. package/dist/tools/code-execute.js +84 -0
  290. package/dist/tools/code-skeleton.d.ts +33 -0
  291. package/dist/tools/code-skeleton.d.ts.map +1 -0
  292. package/dist/tools/code-skeleton.js +206 -0
  293. package/dist/tools/compress-context.d.ts +33 -0
  294. package/dist/tools/compress-context.d.ts.map +1 -0
  295. package/dist/tools/compress-context.js +64 -0
  296. package/dist/tools/context-budget.d.ts +43 -0
  297. package/dist/tools/context-budget.d.ts.map +1 -0
  298. package/dist/tools/context-budget.js +260 -0
  299. package/dist/tools/context-budget.test.d.ts +5 -0
  300. package/dist/tools/context-budget.test.d.ts.map +1 -0
  301. package/dist/tools/context-budget.test.js +219 -0
  302. package/dist/tools/conversation-compress.d.ts +46 -0
  303. package/dist/tools/conversation-compress.d.ts.map +1 -0
  304. package/dist/tools/conversation-compress.js +78 -0
  305. package/dist/tools/conversation-memory.d.ts +75 -0
  306. package/dist/tools/conversation-memory.d.ts.map +1 -0
  307. package/dist/tools/conversation-memory.js +289 -0
  308. package/dist/tools/deduplicate-errors.d.ts +30 -0
  309. package/dist/tools/deduplicate-errors.d.ts.map +1 -0
  310. package/dist/tools/deduplicate-errors.js +72 -0
  311. package/dist/tools/detect-retry-loop.d.ts +40 -0
  312. package/dist/tools/detect-retry-loop.d.ts.map +1 -0
  313. package/dist/tools/detect-retry-loop.js +212 -0
  314. package/dist/tools/diff-compress.d.ts +40 -0
  315. package/dist/tools/diff-compress.d.ts.map +1 -0
  316. package/dist/tools/diff-compress.js +94 -0
  317. package/dist/tools/discover-tools.d.ts +11 -0
  318. package/dist/tools/discover-tools.d.ts.map +1 -0
  319. package/dist/tools/discover-tools.js +163 -0
  320. package/dist/tools/dynamic-loader.d.ts +131 -0
  321. package/dist/tools/dynamic-loader.d.ts.map +1 -0
  322. package/dist/tools/dynamic-loader.js +378 -0
  323. package/dist/tools/dynamic-loader.test.d.ts +10 -0
  324. package/dist/tools/dynamic-loader.test.d.ts.map +1 -0
  325. package/dist/tools/dynamic-loader.test.js +164 -0
  326. package/dist/tools/lazy-mcp.d.ts +31 -0
  327. package/dist/tools/lazy-mcp.d.ts.map +1 -0
  328. package/dist/tools/lazy-mcp.js +151 -0
  329. package/dist/tools/lazy-mcp.test.d.ts +10 -0
  330. package/dist/tools/lazy-mcp.test.d.ts.map +1 -0
  331. package/dist/tools/lazy-mcp.test.js +172 -0
  332. package/dist/tools/multifile-compress.d.ts +36 -0
  333. package/dist/tools/multifile-compress.d.ts.map +1 -0
  334. package/dist/tools/multifile-compress.js +223 -0
  335. package/dist/tools/optimization-tips.d.ts +18 -0
  336. package/dist/tools/optimization-tips.d.ts.map +1 -0
  337. package/dist/tools/optimization-tips.js +133 -0
  338. package/dist/tools/registry.d.ts +70 -0
  339. package/dist/tools/registry.d.ts.map +1 -0
  340. package/dist/tools/registry.js +169 -0
  341. package/dist/tools/semantic-compress.d.ts +39 -0
  342. package/dist/tools/semantic-compress.d.ts.map +1 -0
  343. package/dist/tools/semantic-compress.js +113 -0
  344. package/dist/tools/semantic-compress.test.d.ts +5 -0
  345. package/dist/tools/semantic-compress.test.d.ts.map +1 -0
  346. package/dist/tools/semantic-compress.test.js +182 -0
  347. package/dist/tools/session-stats.d.ts +34 -0
  348. package/dist/tools/session-stats.d.ts.map +1 -0
  349. package/dist/tools/session-stats.js +194 -0
  350. package/dist/tools/set-output-config.d.ts +38 -0
  351. package/dist/tools/set-output-config.d.ts.map +1 -0
  352. package/dist/tools/set-output-config.js +122 -0
  353. package/dist/tools/smart-cache-tool.d.ts +38 -0
  354. package/dist/tools/smart-cache-tool.d.ts.map +1 -0
  355. package/dist/tools/smart-cache-tool.js +224 -0
  356. package/dist/tools/smart-file-read.d.ts +52 -0
  357. package/dist/tools/smart-file-read.d.ts.map +1 -0
  358. package/dist/tools/smart-file-read.js +481 -0
  359. package/dist/tools/smart-pipeline.d.ts +40 -0
  360. package/dist/tools/smart-pipeline.d.ts.map +1 -0
  361. package/dist/tools/smart-pipeline.js +295 -0
  362. package/dist/tools/summarize-logs.d.ts +36 -0
  363. package/dist/tools/summarize-logs.d.ts.map +1 -0
  364. package/dist/tools/summarize-logs.js +184 -0
  365. package/dist/tools/token-budget.test.d.ts +11 -0
  366. package/dist/tools/token-budget.test.d.ts.map +1 -0
  367. package/dist/tools/token-budget.test.js +275 -0
  368. package/dist/utils/bm25.d.ts +86 -0
  369. package/dist/utils/bm25.d.ts.map +1 -0
  370. package/dist/utils/bm25.js +153 -0
  371. package/dist/utils/bm25.test.d.ts +5 -0
  372. package/dist/utils/bm25.test.d.ts.map +1 -0
  373. package/dist/utils/bm25.test.js +156 -0
  374. package/dist/utils/command-normalizer.d.ts +39 -0
  375. package/dist/utils/command-normalizer.d.ts.map +1 -0
  376. package/dist/utils/command-normalizer.js +90 -0
  377. package/dist/utils/content-detector.d.ts +27 -0
  378. package/dist/utils/content-detector.d.ts.map +1 -0
  379. package/dist/utils/content-detector.js +127 -0
  380. package/dist/utils/embeddings.d.ts +54 -0
  381. package/dist/utils/embeddings.d.ts.map +1 -0
  382. package/dist/utils/embeddings.js +97 -0
  383. package/dist/utils/embeddings.test.d.ts +8 -0
  384. package/dist/utils/embeddings.test.d.ts.map +1 -0
  385. package/dist/utils/embeddings.test.js +96 -0
  386. package/dist/utils/error-normalizer.d.ts +39 -0
  387. package/dist/utils/error-normalizer.d.ts.map +1 -0
  388. package/dist/utils/error-normalizer.js +233 -0
  389. package/dist/utils/hybrid-search.d.ts +79 -0
  390. package/dist/utils/hybrid-search.d.ts.map +1 -0
  391. package/dist/utils/hybrid-search.js +146 -0
  392. package/dist/utils/hybrid-search.test.d.ts +5 -0
  393. package/dist/utils/hybrid-search.test.d.ts.map +1 -0
  394. package/dist/utils/hybrid-search.test.js +172 -0
  395. package/dist/utils/index.d.ts +13 -0
  396. package/dist/utils/index.d.ts.map +1 -0
  397. package/dist/utils/index.js +12 -0
  398. package/dist/utils/language-detector.d.ts +27 -0
  399. package/dist/utils/language-detector.d.ts.map +1 -0
  400. package/dist/utils/language-detector.js +94 -0
  401. package/dist/utils/log-parser.d.ts +46 -0
  402. package/dist/utils/log-parser.d.ts.map +1 -0
  403. package/dist/utils/log-parser.js +287 -0
  404. package/dist/utils/output-estimator.d.ts +54 -0
  405. package/dist/utils/output-estimator.d.ts.map +1 -0
  406. package/dist/utils/output-estimator.js +119 -0
  407. package/dist/utils/output-estimator.test.d.ts +5 -0
  408. package/dist/utils/output-estimator.test.d.ts.map +1 -0
  409. package/dist/utils/output-estimator.test.js +115 -0
  410. package/dist/utils/output-similarity.d.ts +48 -0
  411. package/dist/utils/output-similarity.d.ts.map +1 -0
  412. package/dist/utils/output-similarity.js +140 -0
  413. package/dist/utils/project-detector.d.ts +16 -0
  414. package/dist/utils/project-detector.d.ts.map +1 -0
  415. package/dist/utils/project-detector.js +119 -0
  416. package/dist/utils/segment-scorer.d.ts +99 -0
  417. package/dist/utils/segment-scorer.d.ts.map +1 -0
  418. package/dist/utils/segment-scorer.js +148 -0
  419. package/dist/utils/signature-grouper.d.ts +58 -0
  420. package/dist/utils/signature-grouper.d.ts.map +1 -0
  421. package/dist/utils/signature-grouper.js +185 -0
  422. package/dist/utils/tfidf.d.ts +45 -0
  423. package/dist/utils/tfidf.d.ts.map +1 -0
  424. package/dist/utils/tfidf.js +204 -0
  425. package/dist/utils/tfidf.test.d.ts +5 -0
  426. package/dist/utils/tfidf.test.d.ts.map +1 -0
  427. package/dist/utils/tfidf.test.js +115 -0
  428. package/dist/utils/token-counter.d.ts +35 -0
  429. package/dist/utils/token-counter.d.ts.map +1 -0
  430. package/dist/utils/token-counter.js +83 -0
  431. package/dist/utils/toon-serializer.d.ts +120 -0
  432. package/dist/utils/toon-serializer.d.ts.map +1 -0
  433. package/dist/utils/toon-serializer.js +472 -0
  434. package/dist/utils/toon-serializer.test.d.ts +7 -0
  435. package/dist/utils/toon-serializer.test.d.ts.map +1 -0
  436. package/dist/utils/toon-serializer.test.js +290 -0
  437. package/package.json +63 -0
  438. package/scripts/install.ps1 +133 -0
  439. package/scripts/install.sh +183 -0
  440. package/scripts/pre-commit-hook.sh +86 -0
@@ -0,0 +1,398 @@
1
+ /**
2
+ * Swift Tree-sitter Parser Tests
3
+ */
4
+ import { describe, it, expect, beforeAll } from "vitest";
5
+ import { swiftTreeSitterParser, parseSwiftAsync, initSwiftParser, } from "./parser.js";
6
+ // Sample Swift code for testing
7
+ const SAMPLE_SWIFT = `
8
+ import Foundation
9
+ import UIKit
10
+
11
+ /// Maximum number of users allowed
12
+ let MAX_USERS = 100
13
+
14
+ /// Default timeout in seconds
15
+ var defaultTimeout: TimeInterval = 30.0
16
+
17
+ /// Represents a user in the system
18
+ protocol UserProtocol {
19
+ var name: String { get }
20
+ var email: String { get }
21
+ func greet() -> String
22
+ }
23
+
24
+ /// A type alias for user identifiers
25
+ typealias UserID = String
26
+
27
+ /// Represents a basic user
28
+ class User: UserProtocol {
29
+ /// The user's name
30
+ public var name: String
31
+
32
+ /// The user's email
33
+ private var email: String
34
+
35
+ /// The user's unique identifier
36
+ let id: UserID
37
+
38
+ /// Create a new user instance
39
+ public init(name: String, email: String) {
40
+ self.name = name
41
+ self.email = email
42
+ self.id = UUID().uuidString
43
+ }
44
+
45
+ deinit {
46
+ print("User \\(name) is being deallocated")
47
+ }
48
+
49
+ /// Get the user's greeting
50
+ public func greet() -> String {
51
+ return "Hello, \\(name)"
52
+ }
53
+
54
+ /// Check if user is valid
55
+ private func isValid() -> Bool {
56
+ return !email.isEmpty && !name.isEmpty
57
+ }
58
+
59
+ /// Async method to fetch user data
60
+ public func fetchData() async throws -> Data {
61
+ return Data()
62
+ }
63
+ }
64
+
65
+ /// Admin user with extra permissions
66
+ final class AdminUser: User {
67
+ /// The admin's permissions
68
+ var permissions: [String] = []
69
+
70
+ /// Check if admin has a permission
71
+ public func hasPermission(_ perm: String) -> Bool {
72
+ return permissions.contains(perm)
73
+ }
74
+ }
75
+
76
+ /// User status enum
77
+ enum UserStatus: String {
78
+ case active
79
+ case inactive
80
+ case suspended
81
+
82
+ /// Get status description
83
+ func description() -> String {
84
+ switch self {
85
+ case .active: return "Active"
86
+ case .inactive: return "Inactive"
87
+ case .suspended: return "Suspended"
88
+ }
89
+ }
90
+ }
91
+
92
+ /// Result type for network operations
93
+ enum NetworkResult<T> {
94
+ case success(T)
95
+ case failure(Error)
96
+ }
97
+
98
+ /// Extension adding utility methods to User
99
+ extension User {
100
+ /// Get a formatted display name
101
+ func displayName() -> String {
102
+ return name.capitalized
103
+ }
104
+
105
+ /// Static factory method
106
+ static func guest() -> User {
107
+ return User(name: "Guest", email: "guest@example.com")
108
+ }
109
+ }
110
+
111
+ /// A simple struct for coordinates
112
+ struct Point {
113
+ var x: Double
114
+ var y: Double
115
+
116
+ /// Calculate distance from origin
117
+ func distanceFromOrigin() -> Double {
118
+ return (x * x + y * y).squareRoot()
119
+ }
120
+ }
121
+
122
+ /// Top-level function to process users
123
+ func processUser(_ user: User) -> Bool {
124
+ return !user.name.isEmpty
125
+ }
126
+
127
+ /// Async function to fetch all users
128
+ func fetchAllUsers() async throws -> [User] {
129
+ return []
130
+ }
131
+ `;
132
+ describe("Swift Tree-sitter Parser", () => {
133
+ beforeAll(async () => {
134
+ await initSwiftParser();
135
+ });
136
+ describe("parseSwiftAsync", () => {
137
+ it("should parse imports correctly", async () => {
138
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
139
+ expect(result.language).toBe("swift");
140
+ expect(result.imports.length).toBeGreaterThanOrEqual(2);
141
+ const foundationImport = result.imports.find((i) => i.name === "Foundation");
142
+ expect(foundationImport).toBeDefined();
143
+ expect(foundationImport?.signature).toBe("import Foundation");
144
+ const uiKitImport = result.imports.find((i) => i.name === "UIKit");
145
+ expect(uiKitImport).toBeDefined();
146
+ });
147
+ it("should parse top-level variables correctly", async () => {
148
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
149
+ const maxUsers = result.variables.find((v) => v.name === "MAX_USERS");
150
+ expect(maxUsers).toBeDefined();
151
+ const defaultTimeout = result.variables.find((v) => v.name === "defaultTimeout");
152
+ expect(defaultTimeout).toBeDefined();
153
+ });
154
+ it("should parse protocols correctly", async () => {
155
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
156
+ const userProtocol = result.interfaces.find((i) => i.name === "UserProtocol");
157
+ expect(userProtocol).toBeDefined();
158
+ expect(userProtocol?.signature).toContain("protocol UserProtocol");
159
+ expect(userProtocol?.documentation).toContain("Represents a user");
160
+ });
161
+ it("should parse classes correctly", async () => {
162
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
163
+ const userClass = result.classes.find((c) => c.name === "User");
164
+ expect(userClass).toBeDefined();
165
+ expect(userClass?.signature).toContain("class User");
166
+ expect(userClass?.documentation).toContain("Represents a basic user");
167
+ const adminClass = result.classes.find((c) => c.name === "AdminUser");
168
+ expect(adminClass).toBeDefined();
169
+ expect(adminClass?.signature).toContain("final");
170
+ expect(adminClass?.signature).toContain("AdminUser");
171
+ });
172
+ it("should parse structs correctly", async () => {
173
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
174
+ const pointStruct = result.classes.find((c) => c.name === "Point");
175
+ expect(pointStruct).toBeDefined();
176
+ expect(pointStruct?.signature).toContain("struct Point");
177
+ });
178
+ it("should parse enums correctly", async () => {
179
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
180
+ const statusEnum = result.types.find((t) => t.name === "UserStatus");
181
+ expect(statusEnum).toBeDefined();
182
+ expect(statusEnum?.signature).toContain("enum UserStatus");
183
+ const resultEnum = result.types.find((t) => t.name === "NetworkResult");
184
+ expect(resultEnum).toBeDefined();
185
+ });
186
+ it("should parse extensions correctly", async () => {
187
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
188
+ const userExtension = result.types.find((t) => t.name === "extension User");
189
+ expect(userExtension).toBeDefined();
190
+ expect(userExtension?.signature).toContain("extension User");
191
+ });
192
+ it("should parse typealias correctly", async () => {
193
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
194
+ const userIdType = result.types.find((t) => t.name === "UserID");
195
+ expect(userIdType).toBeDefined();
196
+ expect(userIdType?.signature).toContain("typealias UserID");
197
+ });
198
+ it("should parse functions correctly", async () => {
199
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
200
+ const processUser = result.functions.find((f) => f.name === "processUser");
201
+ expect(processUser).toBeDefined();
202
+ expect(processUser?.type).toBe("function");
203
+ expect(processUser?.signature).toContain("func processUser");
204
+ const fetchAllUsers = result.functions.find((f) => f.name === "fetchAllUsers");
205
+ expect(fetchAllUsers).toBeDefined();
206
+ expect(fetchAllUsers?.isAsync).toBe(true);
207
+ });
208
+ it("should parse methods correctly", async () => {
209
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
210
+ const greetMethod = result.functions.find((f) => f.name === "greet" && f.parent === "User");
211
+ expect(greetMethod).toBeDefined();
212
+ expect(greetMethod?.type).toBe("method");
213
+ expect(greetMethod?.signature).toContain("func greet");
214
+ const fetchDataMethod = result.functions.find((f) => f.name === "fetchData");
215
+ expect(fetchDataMethod).toBeDefined();
216
+ expect(fetchDataMethod?.isAsync).toBe(true);
217
+ });
218
+ it("should parse init and deinit correctly", async () => {
219
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
220
+ const initMethod = result.functions.find((f) => f.name === "init" && f.parent === "User");
221
+ expect(initMethod).toBeDefined();
222
+ expect(initMethod?.type).toBe("method");
223
+ const deinitMethod = result.functions.find((f) => f.name === "deinit");
224
+ expect(deinitMethod).toBeDefined();
225
+ });
226
+ it("should extract documentation comments", async () => {
227
+ const result = await parseSwiftAsync(SAMPLE_SWIFT);
228
+ const userClass = result.classes.find((c) => c.name === "User");
229
+ expect(userClass?.documentation).toBeDefined();
230
+ expect(userClass?.documentation).toContain("Represents a basic user");
231
+ const greetMethod = result.functions.find((f) => f.name === "greet" && f.parent === "User");
232
+ expect(greetMethod?.documentation).toContain("Get the user's greeting");
233
+ });
234
+ });
235
+ describe("extractSwiftElement", () => {
236
+ it("should extract a specific class", async () => {
237
+ const result = await swiftTreeSitterParser.extractElement(SAMPLE_SWIFT, { type: "class", name: "User" }, { includeImports: true, includeComments: true });
238
+ expect(result).not.toBeNull();
239
+ expect(result?.elements[0]?.name).toBe("User");
240
+ expect(result?.content).toContain("class User");
241
+ });
242
+ it("should extract a specific function", async () => {
243
+ const result = await swiftTreeSitterParser.extractElement(SAMPLE_SWIFT, { type: "function", name: "processUser" }, { includeImports: false, includeComments: true });
244
+ expect(result).not.toBeNull();
245
+ expect(result?.elements[0]?.name).toBe("processUser");
246
+ expect(result?.content).toContain("func processUser");
247
+ });
248
+ it("should extract a specific protocol", async () => {
249
+ const result = await swiftTreeSitterParser.extractElement(SAMPLE_SWIFT, { type: "interface", name: "UserProtocol" }, { includeImports: false, includeComments: true });
250
+ expect(result).not.toBeNull();
251
+ expect(result?.elements[0]?.name).toBe("UserProtocol");
252
+ expect(result?.content).toContain("protocol UserProtocol");
253
+ });
254
+ it("should return null for non-existent element", async () => {
255
+ const result = await swiftTreeSitterParser.extractElement(SAMPLE_SWIFT, { type: "class", name: "NonExistent" }, { includeImports: false, includeComments: false });
256
+ expect(result).toBeNull();
257
+ });
258
+ });
259
+ describe("searchSwiftElements", () => {
260
+ it("should find elements by name", async () => {
261
+ const results = swiftTreeSitterParser.searchElements(SAMPLE_SWIFT, "user");
262
+ expect(results.length).toBeGreaterThan(0);
263
+ const names = results.map((r) => r.name.toLowerCase());
264
+ expect(names.some((n) => n.includes("user"))).toBe(true);
265
+ });
266
+ it("should find elements by signature", async () => {
267
+ const results = swiftTreeSitterParser.searchElements(SAMPLE_SWIFT, "async");
268
+ expect(results.length).toBeGreaterThan(0);
269
+ const hasAsync = results.some((r) => r.signature?.includes("async"));
270
+ expect(hasAsync).toBe(true);
271
+ });
272
+ it("should find elements by documentation", async () => {
273
+ const results = swiftTreeSitterParser.searchElements(SAMPLE_SWIFT, "greeting");
274
+ expect(results.length).toBeGreaterThan(0);
275
+ });
276
+ it("should return empty array for no matches", async () => {
277
+ const results = swiftTreeSitterParser.searchElements(SAMPLE_SWIFT, "xyznonexistent");
278
+ expect(results).toEqual([]);
279
+ });
280
+ });
281
+ describe("swiftTreeSitterParser interface", () => {
282
+ it("should have correct languages", () => {
283
+ expect(swiftTreeSitterParser.languages).toContain("swift");
284
+ });
285
+ it("should implement parse method", () => {
286
+ const result = swiftTreeSitterParser.parse(SAMPLE_SWIFT);
287
+ expect(result.language).toBe("swift");
288
+ expect(result.totalLines).toBeGreaterThan(0);
289
+ });
290
+ });
291
+ });
292
+ describe("Swift specific features", () => {
293
+ beforeAll(async () => {
294
+ await initSwiftParser();
295
+ });
296
+ it("should handle generic types", async () => {
297
+ const code = `
298
+ enum Result<Success, Failure: Error> {
299
+ case success(Success)
300
+ case failure(Failure)
301
+ }
302
+
303
+ func process<T: Codable>(_ item: T) -> T {
304
+ return item
305
+ }
306
+ `;
307
+ const result = await parseSwiftAsync(code);
308
+ const resultEnum = result.types.find((t) => t.name === "Result");
309
+ expect(resultEnum).toBeDefined();
310
+ const processFunc = result.functions.find((f) => f.name === "process");
311
+ expect(processFunc).toBeDefined();
312
+ });
313
+ it("should handle property wrappers", async () => {
314
+ const code = `
315
+ class ViewModel {
316
+ @Published var name: String = ""
317
+ @State private var count: Int = 0
318
+ }
319
+ `;
320
+ const result = await parseSwiftAsync(code);
321
+ expect(result.classes.find((c) => c.name === "ViewModel")).toBeDefined();
322
+ });
323
+ it("should handle async/await", async () => {
324
+ const code = `
325
+ func fetchData() async throws -> Data {
326
+ return Data()
327
+ }
328
+
329
+ func process() async {
330
+ do {
331
+ let data = try await fetchData()
332
+ } catch {
333
+ print("Error")
334
+ }
335
+ }
336
+ `;
337
+ const result = await parseSwiftAsync(code);
338
+ const fetchData = result.functions.find((f) => f.name === "fetchData");
339
+ expect(fetchData?.isAsync).toBe(true);
340
+ const process = result.functions.find((f) => f.name === "process");
341
+ expect(process?.isAsync).toBe(true);
342
+ });
343
+ it("should handle access modifiers", async () => {
344
+ const code = `
345
+ public class PublicClass {
346
+ public var publicVar: String = ""
347
+ private var privateVar: String = ""
348
+ fileprivate var fileprivateVar: String = ""
349
+ internal var internalVar: String = ""
350
+ }
351
+
352
+ open class OpenClass {}
353
+ `;
354
+ const result = await parseSwiftAsync(code);
355
+ const publicClass = result.classes.find((c) => c.name === "PublicClass");
356
+ expect(publicClass).toBeDefined();
357
+ expect(publicClass?.isExported).toBe(true);
358
+ const openClass = result.classes.find((c) => c.name === "OpenClass");
359
+ expect(openClass).toBeDefined();
360
+ });
361
+ it("should handle computed properties", async () => {
362
+ const code = `
363
+ struct Rectangle {
364
+ var width: Double
365
+ var height: Double
366
+
367
+ var area: Double {
368
+ return width * height
369
+ }
370
+
371
+ var perimeter: Double {
372
+ get { return 2 * (width + height) }
373
+ }
374
+ }
375
+ `;
376
+ const result = await parseSwiftAsync(code);
377
+ const rectangle = result.classes.find((c) => c.name === "Rectangle");
378
+ expect(rectangle).toBeDefined();
379
+ });
380
+ it("should handle protocol extensions", async () => {
381
+ const code = `
382
+ protocol Describable {
383
+ var description: String { get }
384
+ }
385
+
386
+ extension Describable {
387
+ func describe() {
388
+ print(description)
389
+ }
390
+ }
391
+ `;
392
+ const result = await parseSwiftAsync(code);
393
+ const describable = result.interfaces.find((i) => i.name === "Describable");
394
+ expect(describable).toBeDefined();
395
+ const extension = result.types.find((t) => t.name === "extension Describable");
396
+ expect(extension).toBeDefined();
397
+ });
398
+ });
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Swift Tree-sitter Queries
3
+ *
4
+ * S-expression queries for extracting Swift code elements.
5
+ */
6
+ /**
7
+ * Query to find all function declarations
8
+ */
9
+ export declare const FUNCTION_QUERY = "\n(function_declaration\n name: (simple_identifier) @name) @function\n";
10
+ /**
11
+ * Query to find all class declarations
12
+ */
13
+ export declare const CLASS_QUERY = "\n(class_declaration\n name: (type_identifier) @name) @class\n";
14
+ /**
15
+ * Query to find all struct declarations
16
+ */
17
+ export declare const STRUCT_QUERY = "\n(struct_declaration\n name: (type_identifier) @name) @struct\n";
18
+ /**
19
+ * Query to find all enum declarations
20
+ */
21
+ export declare const ENUM_QUERY = "\n(enum_declaration\n name: (type_identifier) @name) @enum\n";
22
+ /**
23
+ * Query to find all protocol declarations
24
+ */
25
+ export declare const PROTOCOL_QUERY = "\n(protocol_declaration\n name: (type_identifier) @name) @protocol\n";
26
+ /**
27
+ * Query to find all import declarations
28
+ */
29
+ export declare const IMPORT_QUERY = "\n(import_declaration) @import\n";
30
+ /**
31
+ * Query to find all extension declarations
32
+ */
33
+ export declare const EXTENSION_QUERY = "\n(extension_declaration) @extension\n";
34
+ /**
35
+ * Query to find all typealias declarations
36
+ */
37
+ export declare const TYPEALIAS_QUERY = "\n(typealias_declaration\n name: (type_identifier) @name) @typealias\n";
38
+ /**
39
+ * Query to find all property/variable declarations
40
+ */
41
+ export declare const VARIABLE_QUERY = "\n(property_declaration) @property\n";
42
+ /**
43
+ * Query to find initializers
44
+ */
45
+ export declare const INIT_QUERY = "\n(init_declaration) @init\n";
46
+ /**
47
+ * Query to find deinitializers
48
+ */
49
+ export declare const DEINIT_QUERY = "\n(deinit_declaration) @deinit\n";
50
+ /**
51
+ * Combined query for all definitions
52
+ */
53
+ export declare const ALL_DEFINITIONS_QUERY = "\n; Import declarations\n(import_declaration) @import_decl\n\n; Function declarations\n(function_declaration\n name: (simple_identifier) @func_name) @function\n\n; Class declarations\n(class_declaration\n name: (type_identifier) @class_name) @class\n\n; Struct declarations\n(struct_declaration\n name: (type_identifier) @struct_name) @struct\n\n; Enum declarations\n(enum_declaration\n name: (type_identifier) @enum_name) @enum\n\n; Protocol declarations\n(protocol_declaration\n name: (type_identifier) @protocol_name) @protocol\n\n; Extension declarations\n(extension_declaration) @extension\n\n; Typealias declarations\n(typealias_declaration\n name: (type_identifier) @typealias_name) @typealias\n\n; Property declarations\n(property_declaration) @property\n\n; Init declarations\n(init_declaration) @init\n\n; Deinit declarations\n(deinit_declaration) @deinit\n";
54
+ /**
55
+ * Query patterns as a single object for easy access
56
+ */
57
+ export declare const QUERIES: {
58
+ readonly function: "\n(function_declaration\n name: (simple_identifier) @name) @function\n";
59
+ readonly class: "\n(class_declaration\n name: (type_identifier) @name) @class\n";
60
+ readonly struct: "\n(struct_declaration\n name: (type_identifier) @name) @struct\n";
61
+ readonly enum: "\n(enum_declaration\n name: (type_identifier) @name) @enum\n";
62
+ readonly protocol: "\n(protocol_declaration\n name: (type_identifier) @name) @protocol\n";
63
+ readonly import: "\n(import_declaration) @import\n";
64
+ readonly extension: "\n(extension_declaration) @extension\n";
65
+ readonly typealias: "\n(typealias_declaration\n name: (type_identifier) @name) @typealias\n";
66
+ readonly variable: "\n(property_declaration) @property\n";
67
+ readonly init: "\n(init_declaration) @init\n";
68
+ readonly deinit: "\n(deinit_declaration) @deinit\n";
69
+ readonly all: "\n; Import declarations\n(import_declaration) @import_decl\n\n; Function declarations\n(function_declaration\n name: (simple_identifier) @func_name) @function\n\n; Class declarations\n(class_declaration\n name: (type_identifier) @class_name) @class\n\n; Struct declarations\n(struct_declaration\n name: (type_identifier) @struct_name) @struct\n\n; Enum declarations\n(enum_declaration\n name: (type_identifier) @enum_name) @enum\n\n; Protocol declarations\n(protocol_declaration\n name: (type_identifier) @protocol_name) @protocol\n\n; Extension declarations\n(extension_declaration) @extension\n\n; Typealias declarations\n(typealias_declaration\n name: (type_identifier) @typealias_name) @typealias\n\n; Property declarations\n(property_declaration) @property\n\n; Init declarations\n(init_declaration) @init\n\n; Deinit declarations\n(deinit_declaration) @deinit\n";
70
+ };
71
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/ast/swift/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,4EAG1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,oEAGvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,sEAGxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,kEAGtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,0EAG1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,qCAExB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,2CAE3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,4EAG3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,yCAE1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,iCAEtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,qCAExB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,82BAuCjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;CAaV,CAAC"}
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Swift Tree-sitter Queries
3
+ *
4
+ * S-expression queries for extracting Swift code elements.
5
+ */
6
+ /**
7
+ * Query to find all function declarations
8
+ */
9
+ export const FUNCTION_QUERY = `
10
+ (function_declaration
11
+ name: (simple_identifier) @name) @function
12
+ `;
13
+ /**
14
+ * Query to find all class declarations
15
+ */
16
+ export const CLASS_QUERY = `
17
+ (class_declaration
18
+ name: (type_identifier) @name) @class
19
+ `;
20
+ /**
21
+ * Query to find all struct declarations
22
+ */
23
+ export const STRUCT_QUERY = `
24
+ (struct_declaration
25
+ name: (type_identifier) @name) @struct
26
+ `;
27
+ /**
28
+ * Query to find all enum declarations
29
+ */
30
+ export const ENUM_QUERY = `
31
+ (enum_declaration
32
+ name: (type_identifier) @name) @enum
33
+ `;
34
+ /**
35
+ * Query to find all protocol declarations
36
+ */
37
+ export const PROTOCOL_QUERY = `
38
+ (protocol_declaration
39
+ name: (type_identifier) @name) @protocol
40
+ `;
41
+ /**
42
+ * Query to find all import declarations
43
+ */
44
+ export const IMPORT_QUERY = `
45
+ (import_declaration) @import
46
+ `;
47
+ /**
48
+ * Query to find all extension declarations
49
+ */
50
+ export const EXTENSION_QUERY = `
51
+ (extension_declaration) @extension
52
+ `;
53
+ /**
54
+ * Query to find all typealias declarations
55
+ */
56
+ export const TYPEALIAS_QUERY = `
57
+ (typealias_declaration
58
+ name: (type_identifier) @name) @typealias
59
+ `;
60
+ /**
61
+ * Query to find all property/variable declarations
62
+ */
63
+ export const VARIABLE_QUERY = `
64
+ (property_declaration) @property
65
+ `;
66
+ /**
67
+ * Query to find initializers
68
+ */
69
+ export const INIT_QUERY = `
70
+ (init_declaration) @init
71
+ `;
72
+ /**
73
+ * Query to find deinitializers
74
+ */
75
+ export const DEINIT_QUERY = `
76
+ (deinit_declaration) @deinit
77
+ `;
78
+ /**
79
+ * Combined query for all definitions
80
+ */
81
+ export const ALL_DEFINITIONS_QUERY = `
82
+ ; Import declarations
83
+ (import_declaration) @import_decl
84
+
85
+ ; Function declarations
86
+ (function_declaration
87
+ name: (simple_identifier) @func_name) @function
88
+
89
+ ; Class declarations
90
+ (class_declaration
91
+ name: (type_identifier) @class_name) @class
92
+
93
+ ; Struct declarations
94
+ (struct_declaration
95
+ name: (type_identifier) @struct_name) @struct
96
+
97
+ ; Enum declarations
98
+ (enum_declaration
99
+ name: (type_identifier) @enum_name) @enum
100
+
101
+ ; Protocol declarations
102
+ (protocol_declaration
103
+ name: (type_identifier) @protocol_name) @protocol
104
+
105
+ ; Extension declarations
106
+ (extension_declaration) @extension
107
+
108
+ ; Typealias declarations
109
+ (typealias_declaration
110
+ name: (type_identifier) @typealias_name) @typealias
111
+
112
+ ; Property declarations
113
+ (property_declaration) @property
114
+
115
+ ; Init declarations
116
+ (init_declaration) @init
117
+
118
+ ; Deinit declarations
119
+ (deinit_declaration) @deinit
120
+ `;
121
+ /**
122
+ * Query patterns as a single object for easy access
123
+ */
124
+ export const QUERIES = {
125
+ function: FUNCTION_QUERY,
126
+ class: CLASS_QUERY,
127
+ struct: STRUCT_QUERY,
128
+ enum: ENUM_QUERY,
129
+ protocol: PROTOCOL_QUERY,
130
+ import: IMPORT_QUERY,
131
+ extension: EXTENSION_QUERY,
132
+ typealias: TYPEALIAS_QUERY,
133
+ variable: VARIABLE_QUERY,
134
+ init: INIT_QUERY,
135
+ deinit: DEINIT_QUERY,
136
+ all: ALL_DEFINITIONS_QUERY,
137
+ };