codesift-mcp 0.14.0 → 0.15.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 (454) hide show
  1. package/README.md +5 -1
  2. package/dist/cli/commands-admin.d.ts +18 -0
  3. package/dist/cli/commands-admin.d.ts.map +1 -0
  4. package/dist/cli/commands-admin.js +187 -0
  5. package/dist/cli/commands-admin.js.map +1 -0
  6. package/dist/cli/commands-daemon.d.ts +42 -0
  7. package/dist/cli/commands-daemon.d.ts.map +1 -0
  8. package/dist/cli/commands-daemon.js +163 -0
  9. package/dist/cli/commands-daemon.js.map +1 -0
  10. package/dist/cli/commands-index.d.ts +12 -0
  11. package/dist/cli/commands-index.d.ts.map +1 -0
  12. package/dist/cli/commands-index.js +133 -0
  13. package/dist/cli/commands-index.js.map +1 -0
  14. package/dist/cli/commands-maintenance.d.ts +12 -0
  15. package/dist/cli/commands-maintenance.d.ts.map +1 -0
  16. package/dist/cli/commands-maintenance.js +409 -0
  17. package/dist/cli/commands-maintenance.js.map +1 -0
  18. package/dist/cli/commands-query.d.ts +21 -0
  19. package/dist/cli/commands-query.d.ts.map +1 -0
  20. package/dist/cli/commands-query.js +270 -0
  21. package/dist/cli/commands-query.js.map +1 -0
  22. package/dist/cli/commands.d.ts +2 -36
  23. package/dist/cli/commands.d.ts.map +1 -1
  24. package/dist/cli/commands.js +8 -867
  25. package/dist/cli/commands.js.map +1 -1
  26. package/dist/cli/embed-child.js +13 -2
  27. package/dist/cli/embed-child.js.map +1 -1
  28. package/dist/instructions.d.ts +1 -1
  29. package/dist/instructions.d.ts.map +1 -1
  30. package/dist/instructions.js +5 -2
  31. package/dist/instructions.js.map +1 -1
  32. package/dist/parser/extractors/php-class-metadata.d.ts +10 -0
  33. package/dist/parser/extractors/php-class-metadata.d.ts.map +1 -0
  34. package/dist/parser/extractors/php-class-metadata.js +65 -0
  35. package/dist/parser/extractors/php-class-metadata.js.map +1 -0
  36. package/dist/parser/extractors/php-doc.d.ts +13 -0
  37. package/dist/parser/extractors/php-doc.d.ts.map +1 -0
  38. package/dist/parser/extractors/php-doc.js +39 -0
  39. package/dist/parser/extractors/php-doc.js.map +1 -0
  40. package/dist/parser/extractors/php-node-metadata.d.ts +26 -0
  41. package/dist/parser/extractors/php-node-metadata.d.ts.map +1 -0
  42. package/dist/parser/extractors/php-node-metadata.js +132 -0
  43. package/dist/parser/extractors/php-node-metadata.js.map +1 -0
  44. package/dist/parser/extractors/php-symbol-builders.d.ts +13 -0
  45. package/dist/parser/extractors/php-symbol-builders.d.ts.map +1 -0
  46. package/dist/parser/extractors/php-symbol-builders.js +58 -0
  47. package/dist/parser/extractors/php-symbol-builders.js.map +1 -0
  48. package/dist/parser/extractors/php-walker.d.ts +4 -0
  49. package/dist/parser/extractors/php-walker.d.ts.map +1 -0
  50. package/dist/parser/extractors/php-walker.js +238 -0
  51. package/dist/parser/extractors/php-walker.js.map +1 -0
  52. package/dist/parser/extractors/php.d.ts +2 -33
  53. package/dist/parser/extractors/php.d.ts.map +1 -1
  54. package/dist/parser/extractors/php.js +2 -747
  55. package/dist/parser/extractors/php.js.map +1 -1
  56. package/dist/register-tool-loaders.d.ts +11 -11
  57. package/dist/register-tool-loaders.d.ts.map +1 -1
  58. package/dist/register-tools/runtime.d.ts +11 -0
  59. package/dist/register-tools/runtime.d.ts.map +1 -1
  60. package/dist/register-tools/runtime.js +40 -0
  61. package/dist/register-tools/runtime.js.map +1 -1
  62. package/dist/register-tools.d.ts.map +1 -1
  63. package/dist/register-tools.js +5 -1
  64. package/dist/register-tools.js.map +1 -1
  65. package/dist/retrieval/semantic-handlers.d.ts.map +1 -1
  66. package/dist/retrieval/semantic-handlers.js +10 -3
  67. package/dist/retrieval/semantic-handlers.js.map +1 -1
  68. package/dist/search/semantic.d.ts +2 -0
  69. package/dist/search/semantic.d.ts.map +1 -1
  70. package/dist/search/semantic.js +41 -9
  71. package/dist/search/semantic.js.map +1 -1
  72. package/dist/storage/chunk-store.d.ts +14 -2
  73. package/dist/storage/chunk-store.d.ts.map +1 -1
  74. package/dist/storage/chunk-store.js +214 -34
  75. package/dist/storage/chunk-store.js.map +1 -1
  76. package/dist/storage/embedding-store.d.ts +0 -12
  77. package/dist/storage/embedding-store.d.ts.map +1 -1
  78. package/dist/storage/embedding-store.js +69 -9
  79. package/dist/storage/embedding-store.js.map +1 -1
  80. package/dist/storage/index-cache.d.ts +12 -0
  81. package/dist/storage/index-cache.d.ts.map +1 -0
  82. package/dist/storage/index-cache.js +89 -0
  83. package/dist/storage/index-cache.js.map +1 -0
  84. package/dist/storage/index-json-mutations.d.ts +11 -0
  85. package/dist/storage/index-json-mutations.d.ts.map +1 -0
  86. package/dist/storage/index-json-mutations.js +93 -0
  87. package/dist/storage/index-json-mutations.js.map +1 -0
  88. package/dist/storage/index-migration.d.ts +22 -0
  89. package/dist/storage/index-migration.d.ts.map +1 -0
  90. package/dist/storage/index-migration.js +80 -0
  91. package/dist/storage/index-migration.js.map +1 -0
  92. package/dist/storage/index-store.d.ts +5 -61
  93. package/dist/storage/index-store.d.ts.map +1 -1
  94. package/dist/storage/index-store.js +33 -414
  95. package/dist/storage/index-store.js.map +1 -1
  96. package/dist/storage/index-version.d.ts +39 -0
  97. package/dist/storage/index-version.d.ts.map +1 -0
  98. package/dist/storage/index-version.js +87 -0
  99. package/dist/storage/index-version.js.map +1 -0
  100. package/dist/storage/registry.d.ts +9 -1
  101. package/dist/storage/registry.d.ts.map +1 -1
  102. package/dist/storage/registry.js +169 -8
  103. package/dist/storage/registry.js.map +1 -1
  104. package/dist/storage/shared-embedding-cache.d.ts +23 -3
  105. package/dist/storage/shared-embedding-cache.d.ts.map +1 -1
  106. package/dist/storage/shared-embedding-cache.js +300 -45
  107. package/dist/storage/shared-embedding-cache.js.map +1 -1
  108. package/dist/storage/telemetry/config.d.ts.map +1 -1
  109. package/dist/storage/telemetry/config.js +3 -2
  110. package/dist/storage/telemetry/config.js.map +1 -1
  111. package/dist/storage/telemetry/retro-aggregator.d.ts +21 -0
  112. package/dist/storage/telemetry/retro-aggregator.d.ts.map +1 -1
  113. package/dist/storage/telemetry/retro-aggregator.js +58 -16
  114. package/dist/storage/telemetry/retro-aggregator.js.map +1 -1
  115. package/dist/storage/telemetry/sanitizer.d.ts +16 -0
  116. package/dist/storage/telemetry/sanitizer.d.ts.map +1 -1
  117. package/dist/storage/telemetry/sanitizer.js +2 -0
  118. package/dist/storage/telemetry/sanitizer.js.map +1 -1
  119. package/dist/storage/telemetry/uploader.d.ts +3 -1
  120. package/dist/storage/telemetry/uploader.d.ts.map +1 -1
  121. package/dist/storage/telemetry/uploader.js +158 -21
  122. package/dist/storage/telemetry/uploader.js.map +1 -1
  123. package/dist/tools/cross-repo-contract-adapters.d.ts +39 -0
  124. package/dist/tools/cross-repo-contract-adapters.d.ts.map +1 -0
  125. package/dist/tools/cross-repo-contract-adapters.js +70 -0
  126. package/dist/tools/cross-repo-contract-adapters.js.map +1 -0
  127. package/dist/tools/cross-repo-contract-group.d.ts +17 -0
  128. package/dist/tools/cross-repo-contract-group.d.ts.map +1 -0
  129. package/dist/tools/cross-repo-contract-group.js +89 -0
  130. package/dist/tools/cross-repo-contract-group.js.map +1 -0
  131. package/dist/tools/cross-repo-contract-matcher.d.ts +24 -0
  132. package/dist/tools/cross-repo-contract-matcher.d.ts.map +1 -0
  133. package/dist/tools/cross-repo-contract-matcher.js +134 -0
  134. package/dist/tools/cross-repo-contract-matcher.js.map +1 -0
  135. package/dist/tools/cross-repo-contract-resolver.d.ts +9 -0
  136. package/dist/tools/cross-repo-contract-resolver.d.ts.map +1 -0
  137. package/dist/tools/cross-repo-contract-resolver.js +86 -0
  138. package/dist/tools/cross-repo-contract-resolver.js.map +1 -0
  139. package/dist/tools/cross-repo-contract-tools.d.ts +12 -135
  140. package/dist/tools/cross-repo-contract-tools.d.ts.map +1 -1
  141. package/dist/tools/cross-repo-contract-tools.js +8 -589
  142. package/dist/tools/cross-repo-contract-tools.js.map +1 -1
  143. package/dist/tools/cross-repo-contract-types.d.ts +30 -0
  144. package/dist/tools/cross-repo-contract-types.d.ts.map +1 -0
  145. package/dist/tools/cross-repo-contract-types.js +3 -0
  146. package/dist/tools/cross-repo-contract-types.js.map +1 -0
  147. package/dist/tools/cross-repo-outbound-calls.d.ts +28 -0
  148. package/dist/tools/cross-repo-outbound-calls.d.ts.map +1 -0
  149. package/dist/tools/cross-repo-outbound-calls.js +347 -0
  150. package/dist/tools/cross-repo-outbound-calls.js.map +1 -0
  151. package/dist/tools/cross-repo-outbound-lexer/call-detectors.d.ts.map +1 -1
  152. package/dist/tools/cross-repo-outbound-lexer/call-detectors.js +2 -0
  153. package/dist/tools/cross-repo-outbound-lexer/call-detectors.js.map +1 -1
  154. package/dist/tools/cross-repo-outbound-lexer/types.d.ts +2 -0
  155. package/dist/tools/cross-repo-outbound-lexer/types.d.ts.map +1 -1
  156. package/dist/tools/index-tools/file-indexer.js +3 -3
  157. package/dist/tools/index-tools/file-indexer.js.map +1 -1
  158. package/dist/tools/index-tools/folder-indexer.d.ts.map +1 -1
  159. package/dist/tools/index-tools/folder-indexer.js +47 -2
  160. package/dist/tools/index-tools/folder-indexer.js.map +1 -1
  161. package/dist/tools/index-tools/parse.d.ts +12 -3
  162. package/dist/tools/index-tools/parse.d.ts.map +1 -1
  163. package/dist/tools/index-tools/parse.js +33 -8
  164. package/dist/tools/index-tools/parse.js.map +1 -1
  165. package/dist/tools/index-tools/registry.d.ts +19 -0
  166. package/dist/tools/index-tools/registry.d.ts.map +1 -1
  167. package/dist/tools/index-tools/registry.js +88 -2
  168. package/dist/tools/index-tools/registry.js.map +1 -1
  169. package/dist/tools/index-tools/state.d.ts +31 -0
  170. package/dist/tools/index-tools/state.d.ts.map +1 -1
  171. package/dist/tools/index-tools/state.js +53 -0
  172. package/dist/tools/index-tools/state.js.map +1 -1
  173. package/dist/tools/index-tools/types.d.ts +9 -0
  174. package/dist/tools/index-tools/types.d.ts.map +1 -1
  175. package/dist/tools/index-tools/watcher.js +3 -3
  176. package/dist/tools/index-tools/watcher.js.map +1 -1
  177. package/dist/tools/index-tools/worktree-seed.d.ts +44 -0
  178. package/dist/tools/index-tools/worktree-seed.d.ts.map +1 -0
  179. package/dist/tools/index-tools/worktree-seed.js +302 -0
  180. package/dist/tools/index-tools/worktree-seed.js.map +1 -0
  181. package/dist/tools/index-tools.d.ts.map +1 -1
  182. package/dist/tools/index-tools.js +3 -1
  183. package/dist/tools/index-tools.js.map +1 -1
  184. package/dist/tools/nest-ext-tools/graphql.d.ts +17 -0
  185. package/dist/tools/nest-ext-tools/graphql.d.ts.map +1 -0
  186. package/dist/tools/nest-ext-tools/graphql.js +54 -0
  187. package/dist/tools/nest-ext-tools/graphql.js.map +1 -0
  188. package/dist/tools/nest-ext-tools/microservice.d.ts +17 -0
  189. package/dist/tools/nest-ext-tools/microservice.d.ts.map +1 -0
  190. package/dist/tools/nest-ext-tools/microservice.js +51 -0
  191. package/dist/tools/nest-ext-tools/microservice.js.map +1 -0
  192. package/dist/tools/nest-ext-tools/openapi.d.ts +81 -0
  193. package/dist/tools/nest-ext-tools/openapi.d.ts.map +1 -0
  194. package/dist/tools/nest-ext-tools/openapi.js +254 -0
  195. package/dist/tools/nest-ext-tools/openapi.js.map +1 -0
  196. package/dist/tools/nest-ext-tools/queue.d.ts +27 -0
  197. package/dist/tools/nest-ext-tools/queue.d.ts.map +1 -0
  198. package/dist/tools/nest-ext-tools/queue.js +95 -0
  199. package/dist/tools/nest-ext-tools/queue.js.map +1 -0
  200. package/dist/tools/nest-ext-tools/schedule.d.ts +19 -0
  201. package/dist/tools/nest-ext-tools/schedule.d.ts.map +1 -0
  202. package/dist/tools/nest-ext-tools/schedule.js +89 -0
  203. package/dist/tools/nest-ext-tools/schedule.js.map +1 -0
  204. package/dist/tools/nest-ext-tools/scope.d.ts +19 -0
  205. package/dist/tools/nest-ext-tools/scope.d.ts.map +1 -0
  206. package/dist/tools/nest-ext-tools/scope.js +151 -0
  207. package/dist/tools/nest-ext-tools/scope.js.map +1 -0
  208. package/dist/tools/nest-ext-tools/shared.d.ts +33 -0
  209. package/dist/tools/nest-ext-tools/shared.d.ts.map +1 -0
  210. package/dist/tools/nest-ext-tools/shared.js +279 -0
  211. package/dist/tools/nest-ext-tools/shared.js.map +1 -0
  212. package/dist/tools/nest-ext-tools/typeorm.d.ts +22 -0
  213. package/dist/tools/nest-ext-tools/typeorm.d.ts.map +1 -0
  214. package/dist/tools/nest-ext-tools/typeorm.js +59 -0
  215. package/dist/tools/nest-ext-tools/typeorm.js.map +1 -0
  216. package/dist/tools/nest-ext-tools/websocket.d.ts +21 -0
  217. package/dist/tools/nest-ext-tools/websocket.d.ts.map +1 -0
  218. package/dist/tools/nest-ext-tools/websocket.js +70 -0
  219. package/dist/tools/nest-ext-tools/websocket.js.map +1 -0
  220. package/dist/tools/nest-ext-tools.d.ts +10 -204
  221. package/dist/tools/nest-ext-tools.d.ts.map +1 -1
  222. package/dist/tools/nest-ext-tools.js +10 -749
  223. package/dist/tools/nest-ext-tools.js.map +1 -1
  224. package/dist/tools/perf-tools.js +2 -2
  225. package/dist/tools/python-audit/checks/dead-code.d.ts +1 -1
  226. package/dist/tools/python-audit/checks/dead-code.d.ts.map +1 -1
  227. package/dist/tools/python-constants/constant-match.d.ts +5 -0
  228. package/dist/tools/python-constants/constant-match.d.ts.map +1 -0
  229. package/dist/tools/python-constants/constant-match.js +24 -0
  230. package/dist/tools/python-constants/constant-match.js.map +1 -0
  231. package/dist/tools/python-constants/file-context.d.ts +5 -0
  232. package/dist/tools/python-constants/file-context.d.ts.map +1 -0
  233. package/dist/tools/python-constants/file-context.js +91 -0
  234. package/dist/tools/python-constants/file-context.js.map +1 -0
  235. package/dist/tools/python-constants/function-defaults.d.ts +5 -0
  236. package/dist/tools/python-constants/function-defaults.d.ts.map +1 -0
  237. package/dist/tools/python-constants/function-defaults.js +98 -0
  238. package/dist/tools/python-constants/function-defaults.js.map +1 -0
  239. package/dist/tools/python-constants/model.d.ts +78 -0
  240. package/dist/tools/python-constants/model.d.ts.map +1 -0
  241. package/dist/tools/python-constants/model.js +2 -0
  242. package/dist/tools/python-constants/model.js.map +1 -0
  243. package/dist/tools/python-constants/syntax.d.ts +22 -0
  244. package/dist/tools/python-constants/syntax.d.ts.map +1 -0
  245. package/dist/tools/python-constants/syntax.js +93 -0
  246. package/dist/tools/python-constants/syntax.js.map +1 -0
  247. package/dist/tools/python-constants/value-resolver.d.ts +6 -0
  248. package/dist/tools/python-constants/value-resolver.d.ts.map +1 -0
  249. package/dist/tools/python-constants/value-resolver.js +320 -0
  250. package/dist/tools/python-constants/value-resolver.js.map +1 -0
  251. package/dist/tools/python-constants-tools.d.ts +3 -45
  252. package/dist/tools/python-constants-tools.d.ts.map +1 -1
  253. package/dist/tools/python-constants-tools.js +2 -505
  254. package/dist/tools/python-constants-tools.js.map +1 -1
  255. package/dist/tools/route-tools/django.d.ts +8 -0
  256. package/dist/tools/route-tools/django.d.ts.map +1 -0
  257. package/dist/tools/route-tools/django.js +52 -0
  258. package/dist/tools/route-tools/django.js.map +1 -0
  259. package/dist/tools/route-tools/express.d.ts +5 -0
  260. package/dist/tools/route-tools/express.d.ts.map +1 -0
  261. package/dist/tools/route-tools/express.js +33 -0
  262. package/dist/tools/route-tools/express.js.map +1 -0
  263. package/dist/tools/route-tools/file-sources.d.ts +7 -0
  264. package/dist/tools/route-tools/file-sources.d.ts.map +1 -0
  265. package/dist/tools/route-tools/file-sources.js +15 -0
  266. package/dist/tools/route-tools/file-sources.js.map +1 -0
  267. package/dist/tools/route-tools/handler-discovery.d.ts +4 -0
  268. package/dist/tools/route-tools/handler-discovery.d.ts.map +1 -0
  269. package/dist/tools/route-tools/handler-discovery.js +38 -0
  270. package/dist/tools/route-tools/handler-discovery.js.map +1 -0
  271. package/dist/tools/route-tools/hono.d.ts +5 -0
  272. package/dist/tools/route-tools/hono.d.ts.map +1 -0
  273. package/dist/tools/route-tools/hono.js +61 -0
  274. package/dist/tools/route-tools/hono.js.map +1 -0
  275. package/dist/tools/route-tools/ktor.d.ts +5 -0
  276. package/dist/tools/route-tools/ktor.d.ts.map +1 -0
  277. package/dist/tools/route-tools/ktor.js +76 -0
  278. package/dist/tools/route-tools/ktor.js.map +1 -0
  279. package/dist/tools/route-tools/laravel.d.ts +5 -0
  280. package/dist/tools/route-tools/laravel.d.ts.map +1 -0
  281. package/dist/tools/route-tools/laravel.js +45 -0
  282. package/dist/tools/route-tools/laravel.js.map +1 -0
  283. package/dist/tools/route-tools/mermaid-call-chain.d.ts +3 -0
  284. package/dist/tools/route-tools/mermaid-call-chain.d.ts.map +1 -0
  285. package/dist/tools/route-tools/mermaid-call-chain.js +50 -0
  286. package/dist/tools/route-tools/mermaid-call-chain.js.map +1 -0
  287. package/dist/tools/route-tools/nest.d.ts +5 -0
  288. package/dist/tools/route-tools/nest.d.ts.map +1 -0
  289. package/dist/tools/route-tools/nest.js +75 -0
  290. package/dist/tools/route-tools/nest.js.map +1 -0
  291. package/dist/tools/route-tools/next-trace.d.ts +4 -0
  292. package/dist/tools/route-tools/next-trace.d.ts.map +1 -0
  293. package/dist/tools/route-tools/next-trace.js +48 -0
  294. package/dist/tools/route-tools/next-trace.js.map +1 -0
  295. package/dist/tools/route-tools/next.d.ts +7 -0
  296. package/dist/tools/route-tools/next.d.ts.map +1 -0
  297. package/dist/tools/route-tools/next.js +77 -0
  298. package/dist/tools/route-tools/next.js.map +1 -0
  299. package/dist/tools/route-tools/python-decorators.d.ts +7 -0
  300. package/dist/tools/route-tools/python-decorators.d.ts.map +1 -0
  301. package/dist/tools/route-tools/python-decorators.js +53 -0
  302. package/dist/tools/route-tools/python-decorators.js.map +1 -0
  303. package/dist/tools/route-tools/route-mermaid.d.ts +4 -0
  304. package/dist/tools/route-tools/route-mermaid.d.ts.map +1 -0
  305. package/dist/tools/route-tools/route-mermaid.js +53 -0
  306. package/dist/tools/route-tools/route-mermaid.js.map +1 -0
  307. package/dist/tools/route-tools/spring-kotlin.d.ts +5 -0
  308. package/dist/tools/route-tools/spring-kotlin.d.ts.map +1 -0
  309. package/dist/tools/route-tools/spring-kotlin.js +52 -0
  310. package/dist/tools/route-tools/spring-kotlin.js.map +1 -0
  311. package/dist/tools/route-tools/trace-analysis.d.ts +4 -0
  312. package/dist/tools/route-tools/trace-analysis.d.ts.map +1 -0
  313. package/dist/tools/route-tools/trace-analysis.js +37 -0
  314. package/dist/tools/route-tools/trace-analysis.js.map +1 -0
  315. package/dist/tools/route-tools/trace-route.d.ts +6 -0
  316. package/dist/tools/route-tools/trace-route.d.ts.map +1 -0
  317. package/dist/tools/route-tools/trace-route.js +53 -0
  318. package/dist/tools/route-tools/trace-route.js.map +1 -0
  319. package/dist/tools/route-tools/types.d.ts +35 -0
  320. package/dist/tools/route-tools/types.d.ts.map +1 -0
  321. package/dist/tools/route-tools/types.js +2 -0
  322. package/dist/tools/route-tools/types.js.map +1 -0
  323. package/dist/tools/route-tools/yii2.d.ts +5 -0
  324. package/dist/tools/route-tools/yii2.d.ts.map +1 -0
  325. package/dist/tools/route-tools/yii2.js +73 -0
  326. package/dist/tools/route-tools/yii2.js.map +1 -0
  327. package/dist/tools/route-tools.d.ts +7 -49
  328. package/dist/tools/route-tools.d.ts.map +1 -1
  329. package/dist/tools/route-tools.js +5 -978
  330. package/dist/tools/route-tools.js.map +1 -1
  331. package/dist/tools/symbol-analysis-tools.d.ts +81 -0
  332. package/dist/tools/symbol-analysis-tools.d.ts.map +1 -0
  333. package/dist/tools/symbol-analysis-tools.js +327 -0
  334. package/dist/tools/symbol-analysis-tools.js.map +1 -0
  335. package/dist/tools/symbol-context-tools.d.ts +68 -0
  336. package/dist/tools/symbol-context-tools.d.ts.map +1 -0
  337. package/dist/tools/symbol-context-tools.js +232 -0
  338. package/dist/tools/symbol-context-tools.js.map +1 -0
  339. package/dist/tools/symbol-lookup-tools.d.ts +77 -0
  340. package/dist/tools/symbol-lookup-tools.d.ts.map +1 -0
  341. package/dist/tools/symbol-lookup-tools.js +305 -0
  342. package/dist/tools/symbol-lookup-tools.js.map +1 -0
  343. package/dist/tools/symbol-reference-tools.d.ts +38 -0
  344. package/dist/tools/symbol-reference-tools.d.ts.map +1 -0
  345. package/dist/tools/symbol-reference-tools.js +253 -0
  346. package/dist/tools/symbol-reference-tools.js.map +1 -0
  347. package/dist/tools/symbol-tool-internals.d.ts +9 -0
  348. package/dist/tools/symbol-tool-internals.d.ts.map +1 -0
  349. package/dist/tools/symbol-tool-internals.js +47 -0
  350. package/dist/tools/symbol-tool-internals.js.map +1 -0
  351. package/dist/tools/symbol-tools.d.ts +11 -270
  352. package/dist/tools/symbol-tools.d.ts.map +1 -1
  353. package/dist/tools/symbol-tools.js +7 -1131
  354. package/dist/tools/symbol-tools.js.map +1 -1
  355. package/dist/tools/taint/python-context.d.ts +10 -0
  356. package/dist/tools/taint/python-context.d.ts.map +1 -0
  357. package/dist/tools/taint/python-context.js +150 -0
  358. package/dist/tools/taint/python-context.js.map +1 -0
  359. package/dist/tools/taint/taint-analyzer.d.ts +2 -0
  360. package/dist/tools/taint/taint-analyzer.d.ts.map +1 -0
  361. package/dist/tools/taint/taint-analyzer.js +2 -0
  362. package/dist/tools/taint/taint-analyzer.js.map +1 -0
  363. package/dist/tools/taint/taint-expression.d.ts +18 -0
  364. package/dist/tools/taint/taint-expression.d.ts.map +1 -0
  365. package/dist/tools/taint/taint-expression.js +265 -0
  366. package/dist/tools/taint/taint-expression.js.map +1 -0
  367. package/dist/tools/taint/taint-flow.d.ts +10 -0
  368. package/dist/tools/taint/taint-flow.d.ts.map +1 -0
  369. package/dist/tools/taint/taint-flow.js +178 -0
  370. package/dist/tools/taint/taint-flow.js.map +1 -0
  371. package/dist/tools/taint/taint-model.d.ts +113 -0
  372. package/dist/tools/taint/taint-model.d.ts.map +1 -0
  373. package/dist/tools/taint/taint-model.js +277 -0
  374. package/dist/tools/taint/taint-model.js.map +1 -0
  375. package/dist/tools/taint-tools.d.ts +2 -34
  376. package/dist/tools/taint-tools.d.ts.map +1 -1
  377. package/dist/tools/taint-tools.js +2 -852
  378. package/dist/tools/taint-tools.js.map +1 -1
  379. package/dist/tools/typescript-constants/file-context.d.ts +7 -0
  380. package/dist/tools/typescript-constants/file-context.d.ts.map +1 -0
  381. package/dist/tools/typescript-constants/file-context.js +219 -0
  382. package/dist/tools/typescript-constants/file-context.js.map +1 -0
  383. package/dist/tools/typescript-constants/symbol-resolver.d.ts +7 -0
  384. package/dist/tools/typescript-constants/symbol-resolver.d.ts.map +1 -0
  385. package/dist/tools/typescript-constants/symbol-resolver.js +165 -0
  386. package/dist/tools/typescript-constants/symbol-resolver.js.map +1 -0
  387. package/dist/tools/typescript-constants/types.d.ts +44 -0
  388. package/dist/tools/typescript-constants/types.d.ts.map +1 -0
  389. package/dist/tools/typescript-constants/types.js +2 -0
  390. package/dist/tools/typescript-constants/types.js.map +1 -0
  391. package/dist/tools/typescript-constants/value-evaluator.d.ts +8 -0
  392. package/dist/tools/typescript-constants/value-evaluator.d.ts.map +1 -0
  393. package/dist/tools/typescript-constants/value-evaluator.js +404 -0
  394. package/dist/tools/typescript-constants/value-evaluator.js.map +1 -0
  395. package/dist/tools/typescript-constants-tools.d.ts.map +1 -1
  396. package/dist/tools/typescript-constants-tools.js +19 -709
  397. package/dist/tools/typescript-constants-tools.js.map +1 -1
  398. package/dist/utils/import-graph/collect.d.ts +5 -0
  399. package/dist/utils/import-graph/collect.d.ts.map +1 -0
  400. package/dist/utils/import-graph/collect.js +47 -0
  401. package/dist/utils/import-graph/collect.js.map +1 -0
  402. package/dist/utils/import-graph/edge-accumulator.d.ts +7 -0
  403. package/dist/utils/import-graph/edge-accumulator.d.ts.map +1 -0
  404. package/dist/utils/import-graph/edge-accumulator.js +47 -0
  405. package/dist/utils/import-graph/edge-accumulator.js.map +1 -0
  406. package/dist/utils/import-graph/language-imports.d.ts +6 -0
  407. package/dist/utils/import-graph/language-imports.d.ts.map +1 -0
  408. package/dist/utils/import-graph/language-imports.js +84 -0
  409. package/dist/utils/import-graph/language-imports.js.map +1 -0
  410. package/dist/utils/import-graph/metrics.d.ts +6 -0
  411. package/dist/utils/import-graph/metrics.d.ts.map +1 -0
  412. package/dist/utils/import-graph/metrics.js +51 -0
  413. package/dist/utils/import-graph/metrics.js.map +1 -0
  414. package/dist/utils/import-graph/path-map.d.ts +7 -0
  415. package/dist/utils/import-graph/path-map.d.ts.map +1 -0
  416. package/dist/utils/import-graph/path-map.js +56 -0
  417. package/dist/utils/import-graph/path-map.js.map +1 -0
  418. package/dist/utils/import-graph/python-php-edge-collectors.d.ts +5 -0
  419. package/dist/utils/import-graph/python-php-edge-collectors.d.ts.map +1 -0
  420. package/dist/utils/import-graph/python-php-edge-collectors.js +56 -0
  421. package/dist/utils/import-graph/python-php-edge-collectors.js.map +1 -0
  422. package/dist/utils/import-graph/source-edge-collector.d.ts +13 -0
  423. package/dist/utils/import-graph/source-edge-collector.d.ts.map +1 -0
  424. package/dist/utils/import-graph/source-edge-collector.js +42 -0
  425. package/dist/utils/import-graph/source-edge-collector.js.map +1 -0
  426. package/dist/utils/import-graph/source-imports.d.ts +5 -0
  427. package/dist/utils/import-graph/source-imports.d.ts.map +1 -0
  428. package/dist/utils/import-graph/source-imports.js +33 -0
  429. package/dist/utils/import-graph/source-imports.js.map +1 -0
  430. package/dist/utils/import-graph/types.d.ts +15 -0
  431. package/dist/utils/import-graph/types.d.ts.map +1 -0
  432. package/dist/utils/import-graph/types.js +2 -0
  433. package/dist/utils/import-graph/types.js.map +1 -0
  434. package/dist/utils/import-graph/typescript-edge-collector.d.ts +7 -0
  435. package/dist/utils/import-graph/typescript-edge-collector.d.ts.map +1 -0
  436. package/dist/utils/import-graph/typescript-edge-collector.js +58 -0
  437. package/dist/utils/import-graph/typescript-edge-collector.js.map +1 -0
  438. package/dist/utils/import-graph/workspace-alias.d.ts +7 -0
  439. package/dist/utils/import-graph/workspace-alias.d.ts.map +1 -0
  440. package/dist/utils/import-graph/workspace-alias.js +95 -0
  441. package/dist/utils/import-graph/workspace-alias.js.map +1 -0
  442. package/dist/utils/import-graph/workspace-entry.d.ts +3 -0
  443. package/dist/utils/import-graph/workspace-entry.d.ts.map +1 -0
  444. package/dist/utils/import-graph/workspace-entry.js +81 -0
  445. package/dist/utils/import-graph/workspace-entry.js.map +1 -0
  446. package/dist/utils/import-graph.d.ts +10 -94
  447. package/dist/utils/import-graph.d.ts.map +1 -1
  448. package/dist/utils/import-graph.js +6 -702
  449. package/dist/utils/import-graph.js.map +1 -1
  450. package/package.json +1 -1
  451. package/rules/codesift.md +11 -2
  452. package/rules/codesift.mdc +11 -2
  453. package/rules/codex.md +11 -2
  454. package/rules/gemini.md +11 -2
@@ -0,0 +1,38 @@
1
+ import type { Reference } from "../types.js";
2
+ /**
3
+ * What a reference scan actually looked at.
4
+ *
5
+ * `find_references` returning `[]` is the input to "nobody uses this, safe to rename or delete".
6
+ * That inference is only valid if the scan saw everywhere a reference could be. It routinely does
7
+ * not: generated and vendored paths are skipped by default, files can be unreadable, and per
8
+ * symbol the collection stops at MAX_REFERENCES. None of that was visible in the result.
9
+ *
10
+ * Filled through a caller-supplied sink so the `Record<string, Reference[]>` return shape — which
11
+ * several call sites slice and re-key — stays untouched.
12
+ */
13
+ export interface ReferenceScanCoverage {
14
+ /** `unknown` is the honest default when the scan did not report — never assume `complete`. */
15
+ status: "complete" | "partial" | "unknown";
16
+ files_indexed: number;
17
+ files_scanned: number;
18
+ /** Generated/vendored paths skipped because no file_pattern was given. */
19
+ files_skipped_noise?: number;
20
+ files_unreadable?: number;
21
+ /** Symbols whose reference list hit MAX_REFERENCES — their counts are floors, not totals. */
22
+ capped_symbols?: string[];
23
+ detail?: string;
24
+ }
25
+ export interface ReferenceScanSink {
26
+ coverage?: ReferenceScanCoverage;
27
+ }
28
+ /**
29
+ * Batch find references for multiple symbols in one pass.
30
+ * Reads each file once instead of N times — critical for large repos.
31
+ */
32
+ export declare function findReferencesBatch(repo: string, symbolNames: string[], filePattern?: string, sink?: ReferenceScanSink): Promise<Record<string, Reference[]>>;
33
+ /**
34
+ * Find references to a symbol name across indexed files.
35
+ * Matches whole words only using word-boundary regex.
36
+ */
37
+ export declare function findReferences(repo: string, symbolName: string, filePattern?: string): Promise<Reference[]>;
38
+ //# sourceMappingURL=symbol-reference-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-reference-tools.d.ts","sourceRoot":"","sources":["../../src/tools/symbol-reference-tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAU7C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CA6FtC;AAiGD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,SAAS,EAAE,CAAC,CAyDtB"}
@@ -0,0 +1,253 @@
1
+ import { execFile, execFileSync } from "node:child_process";
2
+ import { readFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { promisify } from "node:util";
5
+ import { findReferencesLsp } from "../lsp/lsp-tools.js";
6
+ import { matchFilePattern } from "../utils/glob.js";
7
+ import { isNoisePath, MAX_CONTEXT_LENGTH, MAX_REFERENCES, requireCodeIndex, wordBoundaryPattern, } from "./symbol-tool-internals.js";
8
+ /**
9
+ * Batch find references for multiple symbols in one pass.
10
+ * Reads each file once instead of N times — critical for large repos.
11
+ */
12
+ export async function findReferencesBatch(repo, symbolNames, filePattern, sink) {
13
+ const index = await requireCodeIndex(repo);
14
+ const uniqueNames = [...new Set(symbolNames)];
15
+ const patterns = uniqueNames.map((name) => ({
16
+ name,
17
+ regex: wordBoundaryPattern(name),
18
+ }));
19
+ const result = {};
20
+ for (const name of uniqueNames)
21
+ result[name] = [];
22
+ let filesScanned = 0;
23
+ let filesSkippedNoise = 0;
24
+ let filesUnreadable = 0;
25
+ let timedOut = false;
26
+ const searchStart = Date.now();
27
+ for (const fileEntry of index.files) {
28
+ if (Date.now() - searchStart > SEARCH_TIMEOUT_MS) {
29
+ timedOut = true;
30
+ break;
31
+ }
32
+ if (filePattern && !matchFilePattern(fileEntry.path, filePattern))
33
+ continue;
34
+ if (!filePattern && isNoisePath(fileEntry.path)) {
35
+ // Sensible default — but it means "no references" really means "none outside generated
36
+ // and vendored code", and the caller could not tell that scoping had happened.
37
+ filesSkippedNoise++;
38
+ continue;
39
+ }
40
+ let content;
41
+ try {
42
+ content = await readFile(join(index.root, fileEntry.path), "utf-8");
43
+ filesScanned++;
44
+ }
45
+ catch {
46
+ // A reference living only in a file we could not read is invisible here, and the symbol
47
+ // then looks unused.
48
+ filesUnreadable++;
49
+ continue;
50
+ }
51
+ const lines = content.split("\n");
52
+ for (let i = 0; i < lines.length; i++) {
53
+ const line = lines[i];
54
+ if (line === undefined)
55
+ continue;
56
+ for (const { name, regex } of patterns) {
57
+ const refs = result[name];
58
+ if (refs.length >= MAX_REFERENCES)
59
+ continue;
60
+ const match = regex.exec(line);
61
+ if (match) {
62
+ const rawContext = line.trimEnd();
63
+ refs.push({
64
+ file: fileEntry.path,
65
+ line: i + 1,
66
+ col: match.index + 1,
67
+ context: rawContext.length > MAX_CONTEXT_LENGTH
68
+ ? rawContext.slice(0, MAX_CONTEXT_LENGTH) + "..."
69
+ : rawContext,
70
+ });
71
+ }
72
+ }
73
+ }
74
+ }
75
+ if (sink) {
76
+ const capped = uniqueNames.filter((n) => (result[n]?.length ?? 0) >= MAX_REFERENCES);
77
+ const complete = !timedOut && filesSkippedNoise === 0 && filesUnreadable === 0 && capped.length === 0;
78
+ const reasons = [];
79
+ if (filesSkippedNoise > 0) {
80
+ reasons.push(`${filesSkippedNoise} generated/vendored files skipped (pass file_pattern to include them)`);
81
+ }
82
+ if (filesUnreadable > 0)
83
+ reasons.push(`${filesUnreadable} files could not be read`);
84
+ if (timedOut)
85
+ reasons.push(`scan exceeded ${SEARCH_TIMEOUT_MS}ms`);
86
+ if (capped.length > 0)
87
+ reasons.push(`${capped.length} symbol(s) hit the ${MAX_REFERENCES}-reference cap`);
88
+ sink.coverage = {
89
+ status: complete ? "complete" : "partial",
90
+ files_indexed: index.files.length,
91
+ files_scanned: filesScanned,
92
+ ...(filesSkippedNoise > 0 ? { files_skipped_noise: filesSkippedNoise } : {}),
93
+ ...(filesUnreadable > 0 ? { files_unreadable: filesUnreadable } : {}),
94
+ ...(capped.length > 0 ? { capped_symbols: capped } : {}),
95
+ ...(complete
96
+ ? {}
97
+ : {
98
+ detail: `${reasons.join("; ")} — an empty or short result is about what was scanned, ` +
99
+ `not proof the symbol is unused`,
100
+ }),
101
+ };
102
+ }
103
+ return result;
104
+ }
105
+ const SEARCH_TIMEOUT_MS = 30_000;
106
+ /** Directories to exclude from ripgrep reference search */
107
+ const RG_EXCLUDE_DIRS = [
108
+ "node_modules", ".git", ".next", "dist", ".codesift", "coverage",
109
+ ".playwright-mcp", "__pycache__", "__snapshots__",
110
+ ];
111
+ /** Detect whether `rg` (ripgrep) is available. Cached at module level. */
112
+ let rgAvailable = null;
113
+ function hasRipgrep() {
114
+ if (rgAvailable !== null)
115
+ return rgAvailable;
116
+ try {
117
+ execFileSync("rg", ["--version"], { stdio: "pipe", timeout: 2000 });
118
+ rgAvailable = true;
119
+ }
120
+ catch {
121
+ rgAvailable = false;
122
+ }
123
+ return rgAvailable;
124
+ }
125
+ const execFileAsync = promisify(execFile);
126
+ /**
127
+ * Find references using ripgrep with word-boundary matching.
128
+ * Returns compact `file:line: context` string when results ≤ threshold.
129
+ */
130
+ async function findReferencesWithRipgrep(root, symbolName, maxResults, filePattern) {
131
+ const args = [
132
+ "-n", "--no-heading", "-F",
133
+ "--max-columns", String(MAX_CONTEXT_LENGTH),
134
+ "--max-columns-preview",
135
+ "--max-count", String(Math.min(maxResults * 2, 5000)),
136
+ ];
137
+ if (filePattern) {
138
+ args.push("--glob", filePattern);
139
+ }
140
+ else {
141
+ for (const dir of RG_EXCLUDE_DIRS)
142
+ args.push("--glob", `!${dir}`);
143
+ for (const ext of [".snap", ".lock", ".map", ".svg", ".png", ".jpg", ".ico", ".woff", ".woff2", ".md", ".json", ".yaml", ".yml", ".toml", ".css", ".scss", ".html"]) {
144
+ args.push("--glob", `!*${ext}`);
145
+ }
146
+ // Default to code files only (matches what agent would grep for)
147
+ args.push("--type-add", "code:*.{ts,tsx,js,jsx,py,go,rs,java,kt,kts,rb,php,vue,svelte}");
148
+ args.push("--type", "code");
149
+ }
150
+ args.push("--", symbolName, root);
151
+ let stdout;
152
+ try {
153
+ const result = await execFileAsync("rg", args, {
154
+ encoding: "utf-8",
155
+ maxBuffer: 20 * 1024 * 1024,
156
+ timeout: SEARCH_TIMEOUT_MS,
157
+ });
158
+ stdout = result.stdout;
159
+ }
160
+ catch (err) {
161
+ if (err && typeof err === "object" && "code" in err && err.code === 1)
162
+ return [];
163
+ return null;
164
+ }
165
+ const rootPrefix = root.endsWith("/") ? root : root + "/";
166
+ const lines = stdout.split("\n").filter(Boolean);
167
+ const refs = [];
168
+ const identifierPattern = wordBoundaryPattern(symbolName);
169
+ for (const rawLine of lines) {
170
+ if (refs.length >= maxResults)
171
+ break;
172
+ const match = rawLine.match(/^(.+?):(\d+):(.*)/);
173
+ if (!match || !match[1] || !match[2] || match[3] === undefined)
174
+ continue;
175
+ const absPath = match[1];
176
+ const relPath = absPath.startsWith(rootPrefix) ? absPath.slice(rootPrefix.length) : absPath;
177
+ if (!filePattern && isNoisePath(relPath))
178
+ continue;
179
+ // `rg -w` is incorrect for valid identifiers such as `$store` and `#handler`. The literal
180
+ // search keeps metacharacters safe; this Unicode-aware filter supplies language boundaries.
181
+ if (!identifierPattern.test(match[3]))
182
+ continue;
183
+ refs.push({
184
+ file: relPath,
185
+ line: parseInt(match[2], 10),
186
+ context: match[3].length > MAX_CONTEXT_LENGTH ? match[3].slice(0, MAX_CONTEXT_LENGTH) + "..." : match[3],
187
+ });
188
+ }
189
+ return refs;
190
+ }
191
+ /**
192
+ * Find references to a symbol name across indexed files.
193
+ * Matches whole words only using word-boundary regex.
194
+ */
195
+ export async function findReferences(repo, symbolName, filePattern) {
196
+ // Try LSP first (type-safe, no false positives)
197
+ if (!filePattern) {
198
+ const lspRefs = await findReferencesLsp(repo, symbolName);
199
+ if (lspRefs !== null)
200
+ return lspRefs;
201
+ }
202
+ // Use ripgrep when available (10x+ faster than Node.js file walk)
203
+ if (!filePattern && hasRipgrep()) {
204
+ const index = await requireCodeIndex(repo);
205
+ const result = await findReferencesWithRipgrep(index.root, symbolName, MAX_REFERENCES, filePattern);
206
+ if (result !== null)
207
+ return result;
208
+ // Any rg failure other than its explicit no-match exit falls through to the index-backed scan.
209
+ }
210
+ // Node.js fallback
211
+ const index = await requireCodeIndex(repo);
212
+ const pattern = wordBoundaryPattern(symbolName);
213
+ const searchStart = Date.now();
214
+ const refs = [];
215
+ for (const fileEntry of index.files) {
216
+ if (refs.length >= MAX_REFERENCES)
217
+ break;
218
+ if (Date.now() - searchStart > SEARCH_TIMEOUT_MS)
219
+ break;
220
+ if (filePattern && !matchFilePattern(fileEntry.path, filePattern))
221
+ continue;
222
+ if (!filePattern && isNoisePath(fileEntry.path))
223
+ continue;
224
+ let content;
225
+ try {
226
+ content = await readFile(join(index.root, fileEntry.path), "utf-8");
227
+ }
228
+ catch {
229
+ continue;
230
+ }
231
+ const lines = content.split("\n");
232
+ for (let i = 0; i < lines.length; i++) {
233
+ if (refs.length >= MAX_REFERENCES)
234
+ break;
235
+ const line = lines[i];
236
+ if (line === undefined)
237
+ continue;
238
+ const match = pattern.exec(line);
239
+ if (match) {
240
+ const rawContext = line.trimEnd();
241
+ refs.push({
242
+ file: fileEntry.path,
243
+ line: i + 1,
244
+ context: rawContext.length > MAX_CONTEXT_LENGTH
245
+ ? rawContext.slice(0, MAX_CONTEXT_LENGTH) + "..."
246
+ : rawContext,
247
+ });
248
+ }
249
+ }
250
+ }
251
+ return refs;
252
+ }
253
+ //# sourceMappingURL=symbol-reference-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-reference-tools.js","sourceRoot":"","sources":["../../src/tools/symbol-reference-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AA8BpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,WAAqB,EACrB,WAAoB,EACpB,IAAwB;IAExB,MAAM,KAAK,GAAG,MAAM,gBAAg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types.js";
3
+ export declare const MAX_REFERENCES = 100;
4
+ export declare const MAX_CONTEXT_LENGTH = 200;
5
+ export declare function isNoisePath(filePath: string): boolean;
6
+ export declare function requireCodeIndex(repo: string): Promise<CodeIndex>;
7
+ export declare function requireBM25Index(repo: string): Promise<BM25Index>;
8
+ export declare function wordBoundaryPattern(name: string): RegExp;
9
+ //# sourceMappingURL=symbol-tool-internals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-tool-internals.d.ts","sourceRoot":"","sources":["../../src/tools/symbol-tool-internals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAsBtC,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIrD;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAMvE;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAMvE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxD"}
@@ -0,0 +1,47 @@
1
+ import { getBM25Index, getCodeIndex } from "./index-tools.js";
2
+ export const MAX_REFERENCES = 100;
3
+ export const MAX_CONTEXT_LENGTH = 200;
4
+ const NOISE_PATH_PREFIXES = [
5
+ ".next/",
6
+ "dist/",
7
+ "build/",
8
+ "coverage/",
9
+ "node_modules/",
10
+ "__snapshots__/",
11
+ ];
12
+ const NOISE_EXTENSIONS = new Set([
13
+ ".snap",
14
+ ".lock",
15
+ ".map",
16
+ ".svg",
17
+ ".png",
18
+ ".jpg",
19
+ ".ico",
20
+ ".woff",
21
+ ".woff2",
22
+ ]);
23
+ export function isNoisePath(filePath) {
24
+ if (NOISE_PATH_PREFIXES.some((prefix) => filePath.startsWith(prefix)))
25
+ return true;
26
+ const dot = filePath.lastIndexOf(".");
27
+ return dot >= 0 && NOISE_EXTENSIONS.has(filePath.slice(dot));
28
+ }
29
+ export async function requireCodeIndex(repo) {
30
+ const index = await getCodeIndex(repo);
31
+ if (!index) {
32
+ throw new Error(`Repository "${repo}" not found. Index it first with index_folder.`);
33
+ }
34
+ return index;
35
+ }
36
+ export async function requireBM25Index(repo) {
37
+ const index = await getBM25Index(repo);
38
+ if (!index) {
39
+ throw new Error(`Repository "${repo}" not found. Index it first with index_folder.`);
40
+ }
41
+ return index;
42
+ }
43
+ export function wordBoundaryPattern(name) {
44
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
45
+ return new RegExp(`(?<![$_\\p{ID_Continue}])${escaped}(?![$_\\u200C\\u200D\\p{ID_Continue}])`, "u");
46
+ }
47
+ //# sourceMappingURL=symbol-tool-internals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbol-tool-internals.js","sourceRoot":"","sources":["../../src/tools/symbol-tool-internals.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,MAAM,mBAAmB,GAAG;IAC1B,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,eAAe;IACf,gBAAgB;CACjB,CAAC;AACF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;CACT,CAAC,CAAC;AAEH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACnF,MAAM,GAAG,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,GAAG,IAAI,CAAC,IAAI,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY;IACjD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,gDAAgD,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY;IACjD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,eAAe,IAAI,gDAAgD,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC5D,OAAO,IAAI,MAAM,CAAC,4BAA4B,OAAO,wCAAwC,EAAE,GAAG,CAAC,CAAC;AACtG,CAAC"}
@@ -1,274 +1,15 @@
1
- import type { CodeSymbol, Reference, SymbolKind } from "../types.js";
2
1
  /**
3
- * Find symbols with names similar to the requested ID. Used to recover from
4
- * hallucinated symbol IDs (telemetry shows 24-26% of get_symbol/get_symbols
5
- * calls return zero results). Extracts a name candidate from the requested
6
- * ID and returns up to `limit` symbols whose name matches case-insensitively.
7
- */
8
- /**
9
- * Resolve a non-canonical symbol reference to a real symbol ID when it is
10
- * UNAMBIGUOUS.
11
- *
12
- * Symbol IDs are `repo:file:name:line` — they embed the declaration line, so no
13
- * caller can construct one by hand. Agents therefore pass a bare name
14
- * ("getOptions") or a half-remembered path, and the lookup returns null; the
15
- * measured miss rate was 24% of get_symbol calls and 26% of get_symbols. The old
16
- * behaviour answered with a suggestion list, which is a second round trip for a
17
- * question we can already answer.
2
+ * Stable public facade for symbol-oriented tools.
18
3
  *
19
- * Only an EXACT, SINGLE name match resolves. Two symbols named `handler` must
20
- * stay ambiguous — silently picking one would return the wrong source with no
21
- * signal, which is worse than the miss it replaces.
22
- */
23
- /**
24
- * Best-effort symbol NAME out of whatever the caller passed.
25
- *
26
- * Symbol IDs end in the declaration line (`repo:file:name:LINE`), so naively
27
- * taking the last segment yields "42" and matches nothing — every suggestion for
28
- * a well-formed-but-stale id was silently useless. Skip trailing numeric
29
- * segments, then fall back to the last non-empty one.
30
- */
31
- export declare function extractSymbolNameGuess(requestedId: string): string;
32
- export declare function resolveSymbolIdExact(repo: string, requestedId: string): Promise<string | null>;
33
- export declare function findSimilarSymbols(repo: string, requestedId: string, limit?: number): Promise<Array<{
34
- id: string;
35
- name: string;
36
- kind: string;
37
- file: string;
38
- start_line: number;
39
- }>>;
40
- /**
41
- * Retrieve a single symbol by ID with fresh source from disk.
42
- * When include_related is true (default), auto-prefetches:
43
- * - children (for classes/interfaces) — saves follow-up get_symbols call
44
- * - symbols in the same file that reference this symbol — saves find_references call
45
- */
46
- /**
47
- * Raised when one id maps to several distinct symbols.
48
- *
49
- * A named type rather than a bare `Error` because two callers must tell this apart from a real
50
- * failure, and matching on message text would break the moment the wording changes. Structural
51
- * check, not `instanceof`: a duplicated module instance across a worker or bundler boundary makes
52
- * `instanceof` false for an object that is in every observable way the right error — the same
53
- * trap `isIndexStorageError` documents in the storage layer.
54
- */
55
- export declare class AmbiguousSymbolIdError extends Error {
56
- constructor(message: string);
57
- }
58
- export declare function isAmbiguousSymbolIdError(err: unknown): err is AmbiguousSymbolIdError;
59
- /**
60
- * Resolve a search hit to its full symbol, tolerating an ambiguous id.
61
- *
62
- * `getSymbol` throwing on a colliding id is right when a caller supplies one: it named a specific
63
- * symbol and must not silently receive a different one. Here nobody supplied it — the id was read
64
- * back off a BM25 hit whose symbol this function already holds. Failing an entire search because
65
- * its top hit happens to sit in a minified bundle would make the collision a worse answer than the
66
- * silent substitution it replaced, and it would hit `find_and_show` and `get_context_bundle`, the
67
- * two tools the H7/H8 hints steer agents toward. Falling back to the hit is not a guess: it is the
68
- * result the search actually returned.
69
- */
70
- export interface SymbolIdAmbiguity {
71
- /** Always present. `ambiguous` means the answer is the search's top hit, not a unique resolution. */
72
- status: "unique" | "ambiguous";
73
- /** Set only when ambiguous: how many distinct symbols share the id. */
74
- shared_by?: number;
75
- /** Set only when ambiguous: the other candidates, so the caller can pick deliberately. */
76
- candidates?: Array<{
77
- name: string;
78
- kind: SymbolKind;
79
- file: string;
80
- start_line: number;
81
- }>;
82
- }
83
- export declare function getSymbol(repo: string, symbolId: string, options?: {
84
- include_related?: boolean;
85
- }): Promise<{
86
- symbol: CodeSymbol;
87
- related?: CodeSymbol[];
88
- } | null>;
89
- /**
90
- * Retrieve multiple symbols by ID with fresh source from disk.
91
- * Groups reads by file to minimize disk I/O.
92
- */
93
- export declare function getSymbols(repo: string, symbolIds: string[]): Promise<CodeSymbol[]>;
94
- /**
95
- * Find references to a symbol name across indexed files.
96
- * Matches whole words only using word-boundary regex.
97
- */
98
- /**
99
- * Batch find references for multiple symbols in one pass.
100
- * Reads each file once instead of N times — critical for large repos.
101
- */
102
- /**
103
- * What a reference scan actually looked at.
104
- *
105
- * `find_references` returning `[]` is the input to "nobody uses this, safe to rename or delete".
106
- * That inference is only valid if the scan saw everywhere a reference could be. It routinely does
107
- * not: generated and vendored paths are skipped by default, files can be unreadable, and per
108
- * symbol the collection stops at MAX_REFERENCES. None of that was visible in the result.
109
- *
110
- * Filled through a caller-supplied sink so the `Record<string, Reference[]>` return shape — which
111
- * several call sites slice and re-key — stays untouched.
112
- */
113
- export interface ReferenceScanCoverage {
114
- /** `unknown` is the honest default when the scan did not report — never assume `complete`. */
115
- status: "complete" | "partial" | "unknown";
116
- files_indexed: number;
117
- files_scanned: number;
118
- /** Generated/vendored paths skipped because no file_pattern was given. */
119
- files_skipped_noise?: number;
120
- files_unreadable?: number;
121
- /** Symbols whose reference list hit MAX_REFERENCES — their counts are floors, not totals. */
122
- capped_symbols?: string[];
123
- detail?: string;
124
- }
125
- export interface ReferenceScanSink {
126
- coverage?: ReferenceScanCoverage;
127
- }
128
- export declare function findReferencesBatch(repo: string, symbolNames: string[], filePattern?: string, sink?: ReferenceScanSink): Promise<Record<string, Reference[]>>;
129
- export declare function findReferences(repo: string, symbolName: string, filePattern?: string): Promise<Reference[]>;
130
- /** Format references as compact string for MCP output. Groups by file to avoid repeating paths. */
131
- export declare function formatRefsCompact(refs: Reference[]): string;
132
- /** Format a CodeSymbol as compact text: header line + source. ~70% less tokens than JSON. */
133
- export declare function formatSymbolCompact(sym: CodeSymbol): string;
134
- /** Format multiple CodeSymbols as compact text, separated by blank lines. */
135
- export declare function formatSymbolsCompact(syms: CodeSymbol[]): string;
136
- /** Format ContextBundle as compact text. */
137
- export declare function formatBundleCompact(bundle: {
138
- symbol: CodeSymbol;
139
- imports: string[];
140
- siblings: Array<{
141
- name: string;
142
- kind: string;
143
- start_line: number;
144
- end_line: number;
145
- }>;
146
- types_used: string[];
147
- }): string;
148
- /**
149
- * Search for a symbol by query and return it with full source.
150
- * Optionally includes references across the codebase.
151
- */
152
- export declare function findAndShow(repo: string, query: string, includeRefs?: boolean): Promise<{
153
- symbol: CodeSymbol;
154
- references?: Reference[];
155
- id_ambiguity: SymbolIdAmbiguity;
156
- } | null>;
157
- export interface ReactContext {
158
- /** Props type name extracted from the component's parameter type annotation */
159
- props_type: string | null;
160
- /** Source of the props interface/type declaration when found in the index (Tier 4 — Item 16) */
161
- props_interface_source: string | null;
162
- /** React hooks called inside this component (use*() patterns) */
163
- hooks_used: Array<{
164
- name: string;
165
- is_stdlib: boolean;
166
- }>;
167
- /** Child components rendered via JSX (<PascalCase>) */
168
- child_components: string[];
169
- /** Parent components that render this one via JSX */
170
- parent_components: string[];
171
- /** Detected wrapper pattern (memo, forwardRef, lazy) or null */
172
- wrapper: "memo" | "forwardRef" | "lazy" | null;
173
- }
174
- export interface ContextBundle {
175
- symbol: CodeSymbol;
176
- imports: string[];
177
- siblings: Array<{
178
- name: string;
179
- kind: SymbolKind;
180
- start_line: number;
181
- end_line: number;
182
- }>;
183
- types_used: string[];
184
- /** Only populated when symbol.kind === "component" */
185
- react_context?: ReactContext;
186
- /** Always present. Says whether `symbol` is a unique resolution or the search's top hit among
187
- * several sharing one id — a distinction the caller cannot otherwise make from the result. */
188
- id_ambiguity: SymbolIdAmbiguity;
189
- }
190
- /**
191
- * Get a symbol with its file's imports and sibling symbols in one call.
192
- * Saves 2-3 round-trips vs get_symbol + search_text(imports) + get_file_outline.
193
- */
194
- export declare function getContextBundle(repo: string, symbolName: string): Promise<ContextBundle | null>;
195
- export interface DeadCodeCandidate {
196
- name: string;
197
- kind: SymbolKind;
198
- file: string;
199
- start_line: number;
200
- end_line: number;
201
- reason: string;
202
- }
203
- export interface DeadCodeResult {
204
- candidates: DeadCodeCandidate[];
205
- scanned_symbols: number;
206
- scanned_files: number;
207
- /**
208
- * The RESULT LIST was cut short — there are more dead-looking symbols than are shown.
209
- * The listed candidates are still as trustworthy as `coverage` says; there are just more.
210
- */
211
- truncated?: boolean;
212
- /**
213
- * Whether the reference scan actually saw the whole repository.
214
- *
215
- * This is the field that decides whether a candidate may be deleted. "Dead" here means
216
- * "no reference found in the files I read" — if some files were never read, a symbol used
217
- * only from those files looks exactly like a genuinely unused one. `truncated` used to carry
218
- * this meaning as well as the list-length one; an agent reading a single boolean naturally
219
- * takes the harmless reading ("the list is cut off") and acts on the candidates, which is
220
- * the wrong call precisely when the scan was short.
221
- *
222
- * `complete` is the only status under which an empty or short candidate list is evidence
223
- * about the code rather than about the scan.
224
- */
225
- coverage: {
226
- status: "complete" | "partial";
227
- files_indexed: number;
228
- files_read: number;
229
- /** Files the scan stopped before reaching (MAX_SCAN_FILES cap). */
230
- files_skipped_by_cap?: number;
231
- /** Files that were indexed but could not be read now (deleted, permissions, races). */
232
- files_unreadable?: number;
233
- detail?: string;
234
- };
235
- }
236
- /**
237
- * Find potentially dead code: exported symbols with 0 references outside their own file.
238
- * Scans all indexed files for word-boundary matches of each exported symbol name.
239
- *
240
- * F14 fixes (2026-05-05):
241
- * - Test files are now ALWAYS scanned for references regardless of
242
- * `include_tests`. The flag now gates only candidate selection (whether
243
- * test-internal exports can themselves be flagged dead). Symbols used
244
- * only in tests are no longer false-positive dead.
245
- * - Re-exports via `export * from './x'` and `export { Y } from './x'`
246
- * now mark `./x` as live; previously the lack of textual mention in the
247
- * barrel made every barrel-forwarded symbol look dead.
248
- * - MAX_SCAN_FILES raised 2000 → 5000; truncation now surfaces in the
249
- * `truncated` field so callers can react.
250
- */
251
- export declare function findDeadCode(repo: string, options?: {
252
- file_pattern?: string | undefined;
253
- include_tests?: boolean | undefined;
254
- }): Promise<DeadCodeResult>;
255
- export interface UnusedImport {
256
- file: string;
257
- line: number;
258
- import_text: string;
259
- imported_name: string;
260
- }
261
- export interface UnusedImportsResult {
262
- unused: UnusedImport[];
263
- scanned_files: number;
264
- truncated?: boolean;
265
- }
266
- /**
267
- * Find imports whose imported names are never referenced in the file body.
268
- * Supports ES module named imports: import { A, B } from '...'
4
+ * Deferred tool loaders and external consumers import this exact module path.
5
+ * Keep exports explicit so internal split helpers cannot accidentally become public.
269
6
  */
270
- export declare function findUnusedImports(repo: string, options?: {
271
- file_pattern?: string;
272
- include_tests?: boolean;
273
- }): Promise<UnusedImportsResult>;
7
+ export { AmbiguousSymbolIdError, extractSymbolNameGuess, findSimilarSymbols, getSymbol, getSymbols, isAmbiguousSymbolIdError, resolveSymbolIdExact, } from "./symbol-lookup-tools.js";
8
+ export type { SymbolIdAmbiguity } from "./symbol-lookup-tools.js";
9
+ export { findReferences, findReferencesBatch, } from "./symbol-reference-tools.js";
10
+ export type { ReferenceScanCoverage, ReferenceScanSink, } from "./symbol-reference-tools.js";
11
+ export { findAndShow, formatBundleCompact, formatRefsCompact, formatSymbolCompact, formatSymbolsCompact, getContextBundle, } from "./symbol-context-tools.js";
12
+ export type { ContextBundle, ReactContext, } from "./symbol-context-tools.js";
13
+ export { findDeadCode, findUnusedImports, } from "./symbol-analysis-tools.js";
14
+ export type { DeadCodeCandidate, DeadCodeResult, UnusedImport, UnusedImportsResult, } from "./symbol-analysis-tools.js";
274
15
  //# sourceMappingURL=symbol-tools.d.ts.map