@kkvcrobatz107/codegraph 0.9.6-pkm.1

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 (501) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +595 -0
  3. package/dist/bin/codegraph.d.ts +25 -0
  4. package/dist/bin/codegraph.d.ts.map +1 -0
  5. package/dist/bin/codegraph.js +1563 -0
  6. package/dist/bin/codegraph.js.map +1 -0
  7. package/dist/bin/node-version-check.d.ts +37 -0
  8. package/dist/bin/node-version-check.d.ts.map +1 -0
  9. package/dist/bin/node-version-check.js +79 -0
  10. package/dist/bin/node-version-check.js.map +1 -0
  11. package/dist/bin/uninstall.d.ts +14 -0
  12. package/dist/bin/uninstall.d.ts.map +1 -0
  13. package/dist/bin/uninstall.js +36 -0
  14. package/dist/bin/uninstall.js.map +1 -0
  15. package/dist/context/formatter.d.ts +30 -0
  16. package/dist/context/formatter.d.ts.map +1 -0
  17. package/dist/context/formatter.js +244 -0
  18. package/dist/context/formatter.js.map +1 -0
  19. package/dist/context/index.d.ts +110 -0
  20. package/dist/context/index.d.ts.map +1 -0
  21. package/dist/context/index.js +1169 -0
  22. package/dist/context/index.js.map +1 -0
  23. package/dist/db/index.d.ts +101 -0
  24. package/dist/db/index.d.ts.map +1 -0
  25. package/dist/db/index.js +251 -0
  26. package/dist/db/index.js.map +1 -0
  27. package/dist/db/migrations.d.ts +44 -0
  28. package/dist/db/migrations.d.ts.map +1 -0
  29. package/dist/db/migrations.js +131 -0
  30. package/dist/db/migrations.js.map +1 -0
  31. package/dist/db/queries.d.ts +281 -0
  32. package/dist/db/queries.d.ts.map +1 -0
  33. package/dist/db/queries.js +1300 -0
  34. package/dist/db/queries.js.map +1 -0
  35. package/dist/db/schema.sql +151 -0
  36. package/dist/db/sqlite-adapter.d.ts +46 -0
  37. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  38. package/dist/db/sqlite-adapter.js +114 -0
  39. package/dist/db/sqlite-adapter.js.map +1 -0
  40. package/dist/directory.d.ts +57 -0
  41. package/dist/directory.d.ts.map +1 -0
  42. package/dist/directory.js +264 -0
  43. package/dist/directory.js.map +1 -0
  44. package/dist/errors.d.ts +136 -0
  45. package/dist/errors.d.ts.map +1 -0
  46. package/dist/errors.js +219 -0
  47. package/dist/errors.js.map +1 -0
  48. package/dist/extraction/dfm-extractor.d.ts +31 -0
  49. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  50. package/dist/extraction/dfm-extractor.js +151 -0
  51. package/dist/extraction/dfm-extractor.js.map +1 -0
  52. package/dist/extraction/grammars.d.ts +90 -0
  53. package/dist/extraction/grammars.d.ts.map +1 -0
  54. package/dist/extraction/grammars.js +407 -0
  55. package/dist/extraction/grammars.js.map +1 -0
  56. package/dist/extraction/index.d.ts +138 -0
  57. package/dist/extraction/index.d.ts.map +1 -0
  58. package/dist/extraction/index.js +1378 -0
  59. package/dist/extraction/index.js.map +1 -0
  60. package/dist/extraction/languages/c-cpp.d.ts +4 -0
  61. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  62. package/dist/extraction/languages/c-cpp.js +171 -0
  63. package/dist/extraction/languages/c-cpp.js.map +1 -0
  64. package/dist/extraction/languages/csharp.d.ts +3 -0
  65. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  66. package/dist/extraction/languages/csharp.js +73 -0
  67. package/dist/extraction/languages/csharp.js.map +1 -0
  68. package/dist/extraction/languages/dart.d.ts +3 -0
  69. package/dist/extraction/languages/dart.d.ts.map +1 -0
  70. package/dist/extraction/languages/dart.js +192 -0
  71. package/dist/extraction/languages/dart.js.map +1 -0
  72. package/dist/extraction/languages/go.d.ts +3 -0
  73. package/dist/extraction/languages/go.d.ts.map +1 -0
  74. package/dist/extraction/languages/go.js +70 -0
  75. package/dist/extraction/languages/go.js.map +1 -0
  76. package/dist/extraction/languages/index.d.ts +10 -0
  77. package/dist/extraction/languages/index.d.ts.map +1 -0
  78. package/dist/extraction/languages/index.js +51 -0
  79. package/dist/extraction/languages/index.js.map +1 -0
  80. package/dist/extraction/languages/java.d.ts +3 -0
  81. package/dist/extraction/languages/java.d.ts.map +1 -0
  82. package/dist/extraction/languages/java.js +70 -0
  83. package/dist/extraction/languages/java.js.map +1 -0
  84. package/dist/extraction/languages/javascript.d.ts +3 -0
  85. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  86. package/dist/extraction/languages/javascript.js +90 -0
  87. package/dist/extraction/languages/javascript.js.map +1 -0
  88. package/dist/extraction/languages/kotlin.d.ts +3 -0
  89. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  90. package/dist/extraction/languages/kotlin.js +259 -0
  91. package/dist/extraction/languages/kotlin.js.map +1 -0
  92. package/dist/extraction/languages/lua.d.ts +3 -0
  93. package/dist/extraction/languages/lua.d.ts.map +1 -0
  94. package/dist/extraction/languages/lua.js +150 -0
  95. package/dist/extraction/languages/lua.js.map +1 -0
  96. package/dist/extraction/languages/luau.d.ts +3 -0
  97. package/dist/extraction/languages/luau.d.ts.map +1 -0
  98. package/dist/extraction/languages/luau.js +37 -0
  99. package/dist/extraction/languages/luau.js.map +1 -0
  100. package/dist/extraction/languages/objc.d.ts +3 -0
  101. package/dist/extraction/languages/objc.d.ts.map +1 -0
  102. package/dist/extraction/languages/objc.js +133 -0
  103. package/dist/extraction/languages/objc.js.map +1 -0
  104. package/dist/extraction/languages/pascal.d.ts +3 -0
  105. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  106. package/dist/extraction/languages/pascal.js +66 -0
  107. package/dist/extraction/languages/pascal.js.map +1 -0
  108. package/dist/extraction/languages/php.d.ts +3 -0
  109. package/dist/extraction/languages/php.d.ts.map +1 -0
  110. package/dist/extraction/languages/php.js +107 -0
  111. package/dist/extraction/languages/php.js.map +1 -0
  112. package/dist/extraction/languages/python.d.ts +3 -0
  113. package/dist/extraction/languages/python.d.ts.map +1 -0
  114. package/dist/extraction/languages/python.js +56 -0
  115. package/dist/extraction/languages/python.js.map +1 -0
  116. package/dist/extraction/languages/ruby.d.ts +3 -0
  117. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  118. package/dist/extraction/languages/ruby.js +114 -0
  119. package/dist/extraction/languages/ruby.js.map +1 -0
  120. package/dist/extraction/languages/rust.d.ts +3 -0
  121. package/dist/extraction/languages/rust.d.ts.map +1 -0
  122. package/dist/extraction/languages/rust.js +109 -0
  123. package/dist/extraction/languages/rust.js.map +1 -0
  124. package/dist/extraction/languages/scala.d.ts +3 -0
  125. package/dist/extraction/languages/scala.d.ts.map +1 -0
  126. package/dist/extraction/languages/scala.js +139 -0
  127. package/dist/extraction/languages/scala.js.map +1 -0
  128. package/dist/extraction/languages/swift.d.ts +3 -0
  129. package/dist/extraction/languages/swift.d.ts.map +1 -0
  130. package/dist/extraction/languages/swift.js +91 -0
  131. package/dist/extraction/languages/swift.js.map +1 -0
  132. package/dist/extraction/languages/typescript.d.ts +3 -0
  133. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  134. package/dist/extraction/languages/typescript.js +129 -0
  135. package/dist/extraction/languages/typescript.js.map +1 -0
  136. package/dist/extraction/liquid-extractor.d.ts +52 -0
  137. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  138. package/dist/extraction/liquid-extractor.js +313 -0
  139. package/dist/extraction/liquid-extractor.js.map +1 -0
  140. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  141. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  142. package/dist/extraction/mybatis-extractor.js +198 -0
  143. package/dist/extraction/mybatis-extractor.js.map +1 -0
  144. package/dist/extraction/parse-worker.d.ts +8 -0
  145. package/dist/extraction/parse-worker.d.ts.map +1 -0
  146. package/dist/extraction/parse-worker.js +94 -0
  147. package/dist/extraction/parse-worker.js.map +1 -0
  148. package/dist/extraction/svelte-extractor.d.ts +56 -0
  149. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  150. package/dist/extraction/svelte-extractor.js +272 -0
  151. package/dist/extraction/svelte-extractor.js.map +1 -0
  152. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  153. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  154. package/dist/extraction/tree-sitter-helpers.js +103 -0
  155. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  156. package/dist/extraction/tree-sitter-types.d.ts +193 -0
  157. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  158. package/dist/extraction/tree-sitter-types.js +10 -0
  159. package/dist/extraction/tree-sitter-types.js.map +1 -0
  160. package/dist/extraction/tree-sitter.d.ts +291 -0
  161. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  162. package/dist/extraction/tree-sitter.js +2961 -0
  163. package/dist/extraction/tree-sitter.js.map +1 -0
  164. package/dist/extraction/vue-extractor.d.ts +36 -0
  165. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  166. package/dist/extraction/vue-extractor.js +163 -0
  167. package/dist/extraction/vue-extractor.js.map +1 -0
  168. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  169. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  170. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  171. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  172. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  173. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  174. package/dist/extraction/wasm-runtime-flags.js +105 -0
  175. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  176. package/dist/graph/index.d.ts +8 -0
  177. package/dist/graph/index.d.ts.map +1 -0
  178. package/dist/graph/index.js +13 -0
  179. package/dist/graph/index.js.map +1 -0
  180. package/dist/graph/queries.d.ts +106 -0
  181. package/dist/graph/queries.d.ts.map +1 -0
  182. package/dist/graph/queries.js +366 -0
  183. package/dist/graph/queries.js.map +1 -0
  184. package/dist/graph/traversal.d.ts +127 -0
  185. package/dist/graph/traversal.d.ts.map +1 -0
  186. package/dist/graph/traversal.js +528 -0
  187. package/dist/graph/traversal.js.map +1 -0
  188. package/dist/index.d.ts +460 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +863 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/installer/claude-md-template.d.ts +14 -0
  193. package/dist/installer/claude-md-template.d.ts.map +1 -0
  194. package/dist/installer/claude-md-template.js +21 -0
  195. package/dist/installer/claude-md-template.js.map +1 -0
  196. package/dist/installer/config-writer.d.ts +29 -0
  197. package/dist/installer/config-writer.d.ts.map +1 -0
  198. package/dist/installer/config-writer.js +111 -0
  199. package/dist/installer/config-writer.js.map +1 -0
  200. package/dist/installer/index.d.ts +117 -0
  201. package/dist/installer/index.d.ts.map +1 -0
  202. package/dist/installer/index.js +528 -0
  203. package/dist/installer/index.js.map +1 -0
  204. package/dist/installer/instructions-template.d.ts +28 -0
  205. package/dist/installer/instructions-template.d.ts.map +1 -0
  206. package/dist/installer/instructions-template.js +65 -0
  207. package/dist/installer/instructions-template.js.map +1 -0
  208. package/dist/installer/targets/antigravity.d.ts +57 -0
  209. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  210. package/dist/installer/targets/antigravity.js +307 -0
  211. package/dist/installer/targets/antigravity.js.map +1 -0
  212. package/dist/installer/targets/claude.d.ts +47 -0
  213. package/dist/installer/targets/claude.d.ts.map +1 -0
  214. package/dist/installer/targets/claude.js +401 -0
  215. package/dist/installer/targets/claude.js.map +1 -0
  216. package/dist/installer/targets/codex.d.ts +18 -0
  217. package/dist/installer/targets/codex.d.ts.map +1 -0
  218. package/dist/installer/targets/codex.js +185 -0
  219. package/dist/installer/targets/codex.js.map +1 -0
  220. package/dist/installer/targets/cursor.d.ts +35 -0
  221. package/dist/installer/targets/cursor.d.ts.map +1 -0
  222. package/dist/installer/targets/cursor.js +283 -0
  223. package/dist/installer/targets/cursor.js.map +1 -0
  224. package/dist/installer/targets/gemini.d.ts +26 -0
  225. package/dist/installer/targets/gemini.d.ts.map +1 -0
  226. package/dist/installer/targets/gemini.js +165 -0
  227. package/dist/installer/targets/gemini.js.map +1 -0
  228. package/dist/installer/targets/hermes.d.ts +18 -0
  229. package/dist/installer/targets/hermes.d.ts.map +1 -0
  230. package/dist/installer/targets/hermes.js +359 -0
  231. package/dist/installer/targets/hermes.js.map +1 -0
  232. package/dist/installer/targets/kiro.d.ts +27 -0
  233. package/dist/installer/targets/kiro.d.ts.map +1 -0
  234. package/dist/installer/targets/kiro.js +196 -0
  235. package/dist/installer/targets/kiro.js.map +1 -0
  236. package/dist/installer/targets/opencode.d.ts +30 -0
  237. package/dist/installer/targets/opencode.d.ts.map +1 -0
  238. package/dist/installer/targets/opencode.js +235 -0
  239. package/dist/installer/targets/opencode.js.map +1 -0
  240. package/dist/installer/targets/registry.d.ts +35 -0
  241. package/dist/installer/targets/registry.d.ts.map +1 -0
  242. package/dist/installer/targets/registry.js +91 -0
  243. package/dist/installer/targets/registry.js.map +1 -0
  244. package/dist/installer/targets/shared.d.ts +77 -0
  245. package/dist/installer/targets/shared.d.ts.map +1 -0
  246. package/dist/installer/targets/shared.js +246 -0
  247. package/dist/installer/targets/shared.js.map +1 -0
  248. package/dist/installer/targets/toml.d.ts +52 -0
  249. package/dist/installer/targets/toml.d.ts.map +1 -0
  250. package/dist/installer/targets/toml.js +147 -0
  251. package/dist/installer/targets/toml.js.map +1 -0
  252. package/dist/installer/targets/types.d.ts +116 -0
  253. package/dist/installer/targets/types.d.ts.map +1 -0
  254. package/dist/installer/targets/types.js +16 -0
  255. package/dist/installer/targets/types.js.map +1 -0
  256. package/dist/mcp/daemon-paths.d.ts +46 -0
  257. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  258. package/dist/mcp/daemon-paths.js +125 -0
  259. package/dist/mcp/daemon-paths.js.map +1 -0
  260. package/dist/mcp/daemon.d.ts +161 -0
  261. package/dist/mcp/daemon.d.ts.map +1 -0
  262. package/dist/mcp/daemon.js +403 -0
  263. package/dist/mcp/daemon.js.map +1 -0
  264. package/dist/mcp/engine.d.ts +100 -0
  265. package/dist/mcp/engine.d.ts.map +1 -0
  266. package/dist/mcp/engine.js +291 -0
  267. package/dist/mcp/engine.js.map +1 -0
  268. package/dist/mcp/index.d.ts +109 -0
  269. package/dist/mcp/index.d.ts.map +1 -0
  270. package/dist/mcp/index.js +470 -0
  271. package/dist/mcp/index.js.map +1 -0
  272. package/dist/mcp/proxy.d.ts +46 -0
  273. package/dist/mcp/proxy.d.ts.map +1 -0
  274. package/dist/mcp/proxy.js +276 -0
  275. package/dist/mcp/proxy.js.map +1 -0
  276. package/dist/mcp/server-instructions.d.ts +19 -0
  277. package/dist/mcp/server-instructions.d.ts.map +1 -0
  278. package/dist/mcp/server-instructions.js +73 -0
  279. package/dist/mcp/server-instructions.js.map +1 -0
  280. package/dist/mcp/session.d.ts +67 -0
  281. package/dist/mcp/session.d.ts.map +1 -0
  282. package/dist/mcp/session.js +276 -0
  283. package/dist/mcp/session.js.map +1 -0
  284. package/dist/mcp/tools.d.ts +385 -0
  285. package/dist/mcp/tools.d.ts.map +1 -0
  286. package/dist/mcp/tools.js +2545 -0
  287. package/dist/mcp/tools.js.map +1 -0
  288. package/dist/mcp/transport.d.ts +188 -0
  289. package/dist/mcp/transport.d.ts.map +1 -0
  290. package/dist/mcp/transport.js +343 -0
  291. package/dist/mcp/transport.js.map +1 -0
  292. package/dist/mcp/version.d.ts +19 -0
  293. package/dist/mcp/version.d.ts.map +1 -0
  294. package/dist/mcp/version.js +71 -0
  295. package/dist/mcp/version.js.map +1 -0
  296. package/dist/resolution/callback-synthesizer.d.ts +10 -0
  297. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  298. package/dist/resolution/callback-synthesizer.js +924 -0
  299. package/dist/resolution/callback-synthesizer.js.map +1 -0
  300. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  301. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  302. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  303. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  304. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  305. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  306. package/dist/resolution/frameworks/csharp.js +241 -0
  307. package/dist/resolution/frameworks/csharp.js.map +1 -0
  308. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  309. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  310. package/dist/resolution/frameworks/drupal.js +367 -0
  311. package/dist/resolution/frameworks/drupal.js.map +1 -0
  312. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  313. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  314. package/dist/resolution/frameworks/expo-modules.js +143 -0
  315. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  316. package/dist/resolution/frameworks/express.d.ts +8 -0
  317. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  318. package/dist/resolution/frameworks/express.js +308 -0
  319. package/dist/resolution/frameworks/express.js.map +1 -0
  320. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  321. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  322. package/dist/resolution/frameworks/fabric.js +354 -0
  323. package/dist/resolution/frameworks/fabric.js.map +1 -0
  324. package/dist/resolution/frameworks/go.d.ts +8 -0
  325. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  326. package/dist/resolution/frameworks/go.js +161 -0
  327. package/dist/resolution/frameworks/go.js.map +1 -0
  328. package/dist/resolution/frameworks/index.d.ts +48 -0
  329. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  330. package/dist/resolution/frameworks/index.js +161 -0
  331. package/dist/resolution/frameworks/index.js.map +1 -0
  332. package/dist/resolution/frameworks/java.d.ts +8 -0
  333. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  334. package/dist/resolution/frameworks/java.js +504 -0
  335. package/dist/resolution/frameworks/java.js.map +1 -0
  336. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  337. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  338. package/dist/resolution/frameworks/laravel.js +257 -0
  339. package/dist/resolution/frameworks/laravel.js.map +1 -0
  340. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  341. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  342. package/dist/resolution/frameworks/nestjs.js +698 -0
  343. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  344. package/dist/resolution/frameworks/play.d.ts +19 -0
  345. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  346. package/dist/resolution/frameworks/play.js +111 -0
  347. package/dist/resolution/frameworks/play.js.map +1 -0
  348. package/dist/resolution/frameworks/python.d.ts +10 -0
  349. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  350. package/dist/resolution/frameworks/python.js +396 -0
  351. package/dist/resolution/frameworks/python.js.map +1 -0
  352. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  353. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  354. package/dist/resolution/frameworks/react-native.js +360 -0
  355. package/dist/resolution/frameworks/react-native.js.map +1 -0
  356. package/dist/resolution/frameworks/react.d.ts +8 -0
  357. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  358. package/dist/resolution/frameworks/react.js +365 -0
  359. package/dist/resolution/frameworks/react.js.map +1 -0
  360. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  361. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  362. package/dist/resolution/frameworks/ruby.js +302 -0
  363. package/dist/resolution/frameworks/ruby.js.map +1 -0
  364. package/dist/resolution/frameworks/rust.d.ts +8 -0
  365. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  366. package/dist/resolution/frameworks/rust.js +304 -0
  367. package/dist/resolution/frameworks/rust.js.map +1 -0
  368. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  369. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  370. package/dist/resolution/frameworks/svelte.js +249 -0
  371. package/dist/resolution/frameworks/svelte.js.map +1 -0
  372. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  373. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  374. package/dist/resolution/frameworks/swift-objc.js +252 -0
  375. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  376. package/dist/resolution/frameworks/swift.d.ts +10 -0
  377. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  378. package/dist/resolution/frameworks/swift.js +400 -0
  379. package/dist/resolution/frameworks/swift.js.map +1 -0
  380. package/dist/resolution/frameworks/vue.d.ts +9 -0
  381. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  382. package/dist/resolution/frameworks/vue.js +306 -0
  383. package/dist/resolution/frameworks/vue.js.map +1 -0
  384. package/dist/resolution/go-module.d.ts +26 -0
  385. package/dist/resolution/go-module.d.ts.map +1 -0
  386. package/dist/resolution/go-module.js +78 -0
  387. package/dist/resolution/go-module.js.map +1 -0
  388. package/dist/resolution/import-resolver.d.ts +68 -0
  389. package/dist/resolution/import-resolver.d.ts.map +1 -0
  390. package/dist/resolution/import-resolver.js +1231 -0
  391. package/dist/resolution/import-resolver.js.map +1 -0
  392. package/dist/resolution/index.d.ts +116 -0
  393. package/dist/resolution/index.d.ts.map +1 -0
  394. package/dist/resolution/index.js +878 -0
  395. package/dist/resolution/index.js.map +1 -0
  396. package/dist/resolution/lru-cache.d.ts +24 -0
  397. package/dist/resolution/lru-cache.d.ts.map +1 -0
  398. package/dist/resolution/lru-cache.js +62 -0
  399. package/dist/resolution/lru-cache.js.map +1 -0
  400. package/dist/resolution/name-matcher.d.ts +32 -0
  401. package/dist/resolution/name-matcher.d.ts.map +1 -0
  402. package/dist/resolution/name-matcher.js +596 -0
  403. package/dist/resolution/name-matcher.js.map +1 -0
  404. package/dist/resolution/path-aliases.d.ts +68 -0
  405. package/dist/resolution/path-aliases.d.ts.map +1 -0
  406. package/dist/resolution/path-aliases.js +238 -0
  407. package/dist/resolution/path-aliases.js.map +1 -0
  408. package/dist/resolution/strip-comments.d.ts +27 -0
  409. package/dist/resolution/strip-comments.d.ts.map +1 -0
  410. package/dist/resolution/strip-comments.js +441 -0
  411. package/dist/resolution/strip-comments.js.map +1 -0
  412. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  413. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  414. package/dist/resolution/swift-objc-bridge.js +256 -0
  415. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  416. package/dist/resolution/types.d.ts +209 -0
  417. package/dist/resolution/types.d.ts.map +1 -0
  418. package/dist/resolution/types.js +8 -0
  419. package/dist/resolution/types.js.map +1 -0
  420. package/dist/search/query-parser.d.ts +57 -0
  421. package/dist/search/query-parser.d.ts.map +1 -0
  422. package/dist/search/query-parser.js +177 -0
  423. package/dist/search/query-parser.js.map +1 -0
  424. package/dist/search/query-utils.d.ts +53 -0
  425. package/dist/search/query-utils.d.ts.map +1 -0
  426. package/dist/search/query-utils.js +350 -0
  427. package/dist/search/query-utils.js.map +1 -0
  428. package/dist/sync/git-hooks.d.ts +45 -0
  429. package/dist/sync/git-hooks.d.ts.map +1 -0
  430. package/dist/sync/git-hooks.js +223 -0
  431. package/dist/sync/git-hooks.js.map +1 -0
  432. package/dist/sync/index.d.ts +19 -0
  433. package/dist/sync/index.d.ts.map +1 -0
  434. package/dist/sync/index.js +35 -0
  435. package/dist/sync/index.js.map +1 -0
  436. package/dist/sync/watch-policy.d.ts +48 -0
  437. package/dist/sync/watch-policy.d.ts.map +1 -0
  438. package/dist/sync/watch-policy.js +124 -0
  439. package/dist/sync/watch-policy.js.map +1 -0
  440. package/dist/sync/watcher.d.ts +191 -0
  441. package/dist/sync/watcher.d.ts.map +1 -0
  442. package/dist/sync/watcher.js +398 -0
  443. package/dist/sync/watcher.js.map +1 -0
  444. package/dist/sync/worktree.d.ts +54 -0
  445. package/dist/sync/worktree.d.ts.map +1 -0
  446. package/dist/sync/worktree.js +136 -0
  447. package/dist/sync/worktree.js.map +1 -0
  448. package/dist/types.d.ts +369 -0
  449. package/dist/types.d.ts.map +1 -0
  450. package/dist/types.js +78 -0
  451. package/dist/types.js.map +1 -0
  452. package/dist/ui/glyphs.d.ts +42 -0
  453. package/dist/ui/glyphs.d.ts.map +1 -0
  454. package/dist/ui/glyphs.js +78 -0
  455. package/dist/ui/glyphs.js.map +1 -0
  456. package/dist/ui/shimmer-progress.d.ts +11 -0
  457. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  458. package/dist/ui/shimmer-progress.js +90 -0
  459. package/dist/ui/shimmer-progress.js.map +1 -0
  460. package/dist/ui/shimmer-worker.d.ts +2 -0
  461. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  462. package/dist/ui/shimmer-worker.js +118 -0
  463. package/dist/ui/shimmer-worker.js.map +1 -0
  464. package/dist/ui/types.d.ts +17 -0
  465. package/dist/ui/types.d.ts.map +1 -0
  466. package/dist/ui/types.js +3 -0
  467. package/dist/ui/types.js.map +1 -0
  468. package/dist/utils.d.ts +205 -0
  469. package/dist/utils.d.ts.map +1 -0
  470. package/dist/utils.js +549 -0
  471. package/dist/utils.js.map +1 -0
  472. package/package.json +59 -0
  473. package/scripts/add-lang/bench.sh +60 -0
  474. package/scripts/add-lang/check-grammar.mjs +75 -0
  475. package/scripts/add-lang/dump-ast.mjs +103 -0
  476. package/scripts/add-lang/verify-extraction.mjs +70 -0
  477. package/scripts/agent-eval/arms-F.sh +21 -0
  478. package/scripts/agent-eval/arms-matrix.sh +37 -0
  479. package/scripts/agent-eval/audit.sh +68 -0
  480. package/scripts/agent-eval/bench-readme.sh +28 -0
  481. package/scripts/agent-eval/block-read-hook.sh +19 -0
  482. package/scripts/agent-eval/hook-settings.json +15 -0
  483. package/scripts/agent-eval/itrun.sh +107 -0
  484. package/scripts/agent-eval/parse-arms.mjs +116 -0
  485. package/scripts/agent-eval/parse-bench-readme.mjs +67 -0
  486. package/scripts/agent-eval/parse-run.mjs +45 -0
  487. package/scripts/agent-eval/parse-session.mjs +93 -0
  488. package/scripts/agent-eval/probe-context.mjs +21 -0
  489. package/scripts/agent-eval/probe-explore.mjs +40 -0
  490. package/scripts/agent-eval/probe-node.mjs +20 -0
  491. package/scripts/agent-eval/probe-trace.mjs +20 -0
  492. package/scripts/agent-eval/run-agent.sh +34 -0
  493. package/scripts/agent-eval/run-all.sh +67 -0
  494. package/scripts/agent-eval/run-arms.sh +56 -0
  495. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  496. package/scripts/build-bundle.sh +118 -0
  497. package/scripts/extract-release-notes.mjs +130 -0
  498. package/scripts/local-install.sh +41 -0
  499. package/scripts/npm-shim.js +246 -0
  500. package/scripts/pack-npm.sh +95 -0
  501. package/scripts/prepare-release.mjs +270 -0
@@ -0,0 +1,698 @@
1
+ "use strict";
2
+ /**
3
+ * NestJS Framework Resolver
4
+ *
5
+ * Handles NestJS decorator-based routing across its transport layers:
6
+ * - HTTP: @Controller(prefix) + @Get/@Post/@Put/@Patch/@Delete/@Head/@Options/@All
7
+ * - GraphQL: @Resolver + @Query/@Mutation/@Subscription
8
+ * - Microservices: @MessagePattern / @EventPattern
9
+ * - WebSockets: @WebSocketGateway(namespace) + @SubscribeMessage(event)
10
+ *
11
+ * Like the other framework extractors this is regex-over-source (comment-
12
+ * stripped), not AST traversal. NestJS differs from Spring/ASP.NET in two ways
13
+ * that this resolver has to account for:
14
+ *
15
+ * 1. An HTTP route's path is split across TWO decorators — the class-level
16
+ * `@Controller` prefix and the method-level `@Get`/`@Post` path — and both
17
+ * are frequently empty (`@Controller()`, `@Get()`). We pair each method
18
+ * decorator with its enclosing class and join the two paths.
19
+ *
20
+ * 2. `@Query()` is overloaded: it's a GraphQL *method* decorator (from
21
+ * `@nestjs/graphql`) AND a REST *parameter* decorator (from
22
+ * `@nestjs/common`). We only treat it as GraphQL when it sits inside an
23
+ * `@Resolver` class, which is what disambiguates the two.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.nestjsResolver = void 0;
27
+ const strip_comments_1 = require("../strip-comments");
28
+ const HTTP_METHODS = ['Get', 'Post', 'Put', 'Patch', 'Delete', 'Head', 'Options', 'All'];
29
+ const GQL_OPS = ['Query', 'Mutation', 'Subscription'];
30
+ exports.nestjsResolver = {
31
+ name: 'nestjs',
32
+ languages: ['typescript', 'javascript'],
33
+ detect(context) {
34
+ // Primary, fast path: any @nestjs/* dependency in package.json.
35
+ const packageJson = context.readFile('package.json');
36
+ if (packageJson) {
37
+ try {
38
+ const pkg = JSON.parse(packageJson);
39
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
40
+ if (Object.keys(deps).some((k) => k.startsWith('@nestjs/'))) {
41
+ return true;
42
+ }
43
+ }
44
+ catch {
45
+ // Invalid JSON — fall through to the source scan.
46
+ }
47
+ }
48
+ // Fallback: NestJS-specific decorators in conventionally named files.
49
+ const allFiles = context.getAllFiles();
50
+ for (const file of allFiles) {
51
+ if (file.endsWith('.controller.ts') ||
52
+ file.endsWith('.controller.js') ||
53
+ file.endsWith('.module.ts') ||
54
+ file.endsWith('.resolver.ts') ||
55
+ file.endsWith('.gateway.ts')) {
56
+ const content = context.readFile(file);
57
+ if (content &&
58
+ (content.includes('@nestjs/') ||
59
+ content.includes('@Controller') ||
60
+ content.includes('@Module(') ||
61
+ content.includes('@Resolver(') ||
62
+ content.includes('@WebSocketGateway('))) {
63
+ return true;
64
+ }
65
+ }
66
+ }
67
+ return false;
68
+ },
69
+ resolve(ref, context) {
70
+ // Resolve provider/controller references (e.g. constructor-injected
71
+ // `UsersService`) to their class, preferring the Nest file-name
72
+ // convention (`*.service.ts`, `*.controller.ts`, …).
73
+ for (const [suffix, convention] of PROVIDER_CONVENTIONS) {
74
+ if (!suffix.test(ref.referenceName))
75
+ continue;
76
+ const candidates = context
77
+ .getNodesByName(ref.referenceName)
78
+ .filter((n) => n.kind === 'class');
79
+ if (candidates.length === 0)
80
+ return null;
81
+ const preferred = candidates.find((n) => n.filePath.includes(convention));
82
+ const target = preferred ?? candidates[0];
83
+ return {
84
+ original: ref,
85
+ targetNodeId: target.id,
86
+ confidence: preferred ? 0.85 : 0.7,
87
+ resolvedBy: 'framework',
88
+ };
89
+ }
90
+ return null;
91
+ },
92
+ extract(filePath, content) {
93
+ if (!/\.(m?js|tsx?|cjs)$/.test(filePath))
94
+ return { nodes: [], references: [] };
95
+ const nodes = [];
96
+ const references = [];
97
+ const now = Date.now();
98
+ const lang = detectLanguage(filePath);
99
+ const safe = (0, strip_comments_1.stripCommentsForRegex)(content, lang);
100
+ const addRoute = (index, method, path, length, handler) => {
101
+ const line = lineAt(safe, index);
102
+ const node = {
103
+ id: `route:${filePath}:${line}:${method}:${path}`,
104
+ kind: 'route',
105
+ name: `${method} ${path}`,
106
+ qualifiedName: `${filePath}::${method}:${path}`,
107
+ filePath,
108
+ startLine: line,
109
+ endLine: line,
110
+ startColumn: 0,
111
+ endColumn: length,
112
+ language: lang,
113
+ updatedAt: now,
114
+ };
115
+ nodes.push(node);
116
+ if (handler) {
117
+ references.push({
118
+ fromNodeId: node.id,
119
+ referenceName: handler,
120
+ referenceKind: 'references',
121
+ line,
122
+ column: 0,
123
+ filePath,
124
+ language: lang,
125
+ });
126
+ }
127
+ };
128
+ const scopes = buildClassScopes(safe);
129
+ // HTTP routes: method decorator path joined onto the enclosing controller's prefix.
130
+ for (const hit of findDecorators(safe, HTTP_METHODS)) {
131
+ const scope = scopeFor(scopes, hit.index);
132
+ const prefix = scope && scope.kind === 'controller' ? scope.prefix : '';
133
+ const path = joinHttpPath(prefix, parseStringArg(hit.args));
134
+ addRoute(hit.index, hit.name.toUpperCase(), path, hit.length, methodNameAfter(safe, hit.end));
135
+ }
136
+ // GraphQL operations: only inside an @Resolver class (disambiguates the
137
+ // REST `@Query()` parameter decorator, which lives inside @Controller classes).
138
+ for (const hit of findDecorators(safe, GQL_OPS)) {
139
+ const scope = scopeFor(scopes, hit.index);
140
+ if (!scope || scope.kind !== 'resolver')
141
+ continue;
142
+ const handler = methodNameAfter(safe, hit.end);
143
+ const name = parseGraphqlName(hit.args, handler);
144
+ addRoute(hit.index, hit.name.toUpperCase(), name, hit.length, handler);
145
+ }
146
+ // Microservice message/event handlers.
147
+ for (const hit of findDecorators(safe, ['MessagePattern', 'EventPattern'])) {
148
+ const verb = hit.name === 'EventPattern' ? 'EVENT' : 'MESSAGE';
149
+ const handler = methodNameAfter(safe, hit.end);
150
+ addRoute(hit.index, verb, parseStringArg(hit.args) || handler || '', hit.length, handler);
151
+ }
152
+ // WebSocket message handlers, prefixed with the gateway namespace when present.
153
+ for (const hit of findDecorators(safe, ['SubscribeMessage'])) {
154
+ const scope = scopeFor(scopes, hit.index);
155
+ const namespace = scope && scope.kind === 'gateway' ? scope.prefix : '';
156
+ const handler = methodNameAfter(safe, hit.end);
157
+ const event = parseStringArg(hit.args) || handler || '';
158
+ addRoute(hit.index, 'WS', namespace ? `${namespace}:${event}` : event, hit.length, handler);
159
+ }
160
+ return { nodes, references };
161
+ },
162
+ /**
163
+ * Cross-file finalization for `RouterModule.register([...])`. The per-file
164
+ * extract() above only sees `@Controller(prefix) + @Get(path)` — it can't
165
+ * learn about the route prefix supplied by a sibling `app.module.ts` like:
166
+ *
167
+ * RouterModule.register([
168
+ * { path: 'admin', module: AdminModule, children: [
169
+ * { path: 'users', module: UsersModule } ] } ])
170
+ *
171
+ * This pass scans every `*.module.{ts,js}` file, walks the registration
172
+ * tree to build a `Module → /full/prefix` map, walks each `@Module({
173
+ * controllers: [...] })` to build a `Controller → Module` map, and rewrites
174
+ * affected route nodes so `GET /` becomes `GET /admin/users` (and
175
+ * `@Controller('foo') + @Get(':id')` under that same module becomes
176
+ * `GET /admin/users/foo/:id`).
177
+ *
178
+ * The route node's `id` and `qualifiedName` are deliberately preserved
179
+ * across the update: `id` because existing route→handler edges reference
180
+ * it, `qualifiedName` because it still encodes the *original* in-file
181
+ * `method:path` — which keeps this pass idempotent (a second run recovers
182
+ * the same input regardless of how many times it has already prefixed).
183
+ */
184
+ postExtract(context) {
185
+ const moduleToPrefix = new Map();
186
+ const controllerToModule = new Map();
187
+ for (const filePath of context.getAllFiles()) {
188
+ if (!/\.module\.(m?[jt]s|cjs)$/.test(filePath))
189
+ continue;
190
+ const content = context.readFile(filePath);
191
+ if (!content)
192
+ continue;
193
+ const safe = (0, strip_comments_1.stripCommentsForRegex)(content, detectLanguage(filePath));
194
+ collectRouterModuleRegistrations(safe, moduleToPrefix);
195
+ collectModuleControllers(safe, controllerToModule);
196
+ }
197
+ const controllerToPrefix = new Map();
198
+ for (const [controller, module] of controllerToModule) {
199
+ const prefix = moduleToPrefix.get(module);
200
+ // `''` and `'/'` are no-op prefixes; skip them so we don't run updates
201
+ // that would set name to the value it already has.
202
+ if (prefix && prefix !== '' && prefix !== '/') {
203
+ controllerToPrefix.set(controller, prefix);
204
+ }
205
+ }
206
+ if (controllerToPrefix.size === 0)
207
+ return [];
208
+ const updates = [];
209
+ for (const [controllerName, prefix] of controllerToPrefix) {
210
+ const classes = context
211
+ .getNodesByName(controllerName)
212
+ .filter((n) => n.kind === 'class');
213
+ for (const cls of classes) {
214
+ const routes = context
215
+ .getNodesInFile(cls.filePath)
216
+ .filter((n) => n.kind === 'route');
217
+ for (const route of routes) {
218
+ // Multiple controllers can live in one file (covered by the
219
+ // existing "attributes methods to the right controller" test);
220
+ // each route must be associated with the controller whose line
221
+ // range contains it.
222
+ if (route.startLine < cls.startLine || route.startLine > cls.endLine) {
223
+ continue;
224
+ }
225
+ const updated = applyModulePrefix(route, prefix);
226
+ if (updated && updated.name !== route.name)
227
+ updates.push(updated);
228
+ }
229
+ }
230
+ }
231
+ return updates;
232
+ },
233
+ };
234
+ // ---------------------------------------------------------------------------
235
+ // Provider resolution conventions
236
+ // ---------------------------------------------------------------------------
237
+ const PROVIDER_CONVENTIONS = [
238
+ [/Service$/, '.service.'],
239
+ [/Controller$/, '.controller.'],
240
+ [/Resolver$/, '.resolver.'],
241
+ [/Gateway$/, '.gateway.'],
242
+ [/Repository$/, '.repository.'],
243
+ [/Guard$/, '.guard.'],
244
+ [/Interceptor$/, '.interceptor.'],
245
+ [/Pipe$/, '.pipe.'],
246
+ [/Module$/, '.module.'],
247
+ ];
248
+ /**
249
+ * Find every `@Name(...)` decorator whose name is in `names`. Uses a
250
+ * string-aware balanced-paren reader for the argument list so type thunks
251
+ * like `@Query(() => [User])` are captured whole rather than truncated at the
252
+ * inner `()`.
253
+ */
254
+ function findDecorators(safe, names) {
255
+ const hits = [];
256
+ const re = new RegExp(`@(${names.join('|')})\\s*\\(`, 'g');
257
+ let m;
258
+ while ((m = re.exec(safe)) !== null) {
259
+ const openIndex = m.index + m[0].length - 1; // position of '('
260
+ const parsed = readArgs(safe, openIndex);
261
+ if (!parsed)
262
+ continue;
263
+ hits.push({
264
+ name: m[1],
265
+ args: parsed.args,
266
+ index: m.index,
267
+ end: parsed.end,
268
+ length: parsed.end - m.index,
269
+ });
270
+ re.lastIndex = parsed.end; // resume past the args so nested text isn't re-scanned
271
+ }
272
+ return hits;
273
+ }
274
+ /**
275
+ * Read a balanced `(...)` starting at `openIndex` (which must point at `(`).
276
+ * String-aware, so parens inside string literals don't unbalance the count.
277
+ * Returns the inner text and the index just past the closing `)`.
278
+ */
279
+ function readArgs(s, openIndex) {
280
+ if (s[openIndex] !== '(')
281
+ return null;
282
+ let depth = 0;
283
+ let inStr = null;
284
+ for (let i = openIndex; i < s.length; i++) {
285
+ const ch = s[i];
286
+ if (inStr) {
287
+ if (ch === '\\') {
288
+ i++;
289
+ continue;
290
+ }
291
+ if (ch === inStr)
292
+ inStr = null;
293
+ continue;
294
+ }
295
+ if (ch === '"' || ch === "'" || ch === '`') {
296
+ inStr = ch;
297
+ continue;
298
+ }
299
+ if (ch === '(')
300
+ depth++;
301
+ else if (ch === ')') {
302
+ depth--;
303
+ if (depth === 0)
304
+ return { args: s.slice(openIndex + 1, i), end: i + 1 };
305
+ }
306
+ }
307
+ return null;
308
+ }
309
+ /**
310
+ * Starting just after a method decorator's `)`, return the name of the method
311
+ * it decorates. Skips any further stacked decorators (`@UseGuards(...)`,
312
+ * `@HttpCode(204)`, …) and access/async modifiers in between.
313
+ */
314
+ function methodNameAfter(safe, start) {
315
+ let i = start;
316
+ const ws = /\s*/y;
317
+ const decoName = /@[\w.]+/y;
318
+ const modifier = /(?:public|private|protected|async|static)\b/y;
319
+ const ident = /([A-Za-z_$][\w$]*)\s*\(/y;
320
+ const eatWs = () => {
321
+ ws.lastIndex = i;
322
+ if (ws.exec(safe))
323
+ i = ws.lastIndex;
324
+ };
325
+ // Skip stacked decorators.
326
+ for (;;) {
327
+ eatWs();
328
+ if (safe[i] !== '@')
329
+ break;
330
+ decoName.lastIndex = i;
331
+ if (!decoName.exec(safe))
332
+ break;
333
+ i = decoName.lastIndex;
334
+ eatWs();
335
+ if (safe[i] === '(') {
336
+ const parsed = readArgs(safe, i);
337
+ if (!parsed)
338
+ return null;
339
+ i = parsed.end;
340
+ }
341
+ }
342
+ // Skip access/async/static modifiers.
343
+ for (;;) {
344
+ eatWs();
345
+ modifier.lastIndex = i;
346
+ if (modifier.exec(safe) && modifier.lastIndex > i) {
347
+ i = modifier.lastIndex;
348
+ continue;
349
+ }
350
+ break;
351
+ }
352
+ eatWs();
353
+ ident.lastIndex = i;
354
+ const m = ident.exec(safe);
355
+ return m ? m[1] : null;
356
+ }
357
+ /**
358
+ * Build the list of class-level decorator scopes, sorted by position. Each
359
+ * scope runs from its decorator up to the next class decorator (of any kind),
360
+ * which lets a method decorator find its enclosing class regardless of how
361
+ * many classes share a file.
362
+ */
363
+ function buildClassScopes(safe) {
364
+ const defs = [
365
+ { kind: 'controller', name: 'Controller', prefixOf: parseControllerPrefix },
366
+ { kind: 'resolver', name: 'Resolver', prefixOf: () => '' },
367
+ { kind: 'gateway', name: 'WebSocketGateway', prefixOf: parseGatewayNamespace },
368
+ { kind: 'other', name: 'Injectable', prefixOf: () => '' },
369
+ { kind: 'other', name: 'Module', prefixOf: () => '' },
370
+ { kind: 'other', name: 'Catch', prefixOf: () => '' },
371
+ ];
372
+ const raw = [];
373
+ for (const def of defs) {
374
+ for (const hit of findDecorators(safe, [def.name])) {
375
+ raw.push({ kind: def.kind, prefix: def.prefixOf(hit.args), index: hit.index });
376
+ }
377
+ }
378
+ raw.sort((a, b) => a.index - b.index);
379
+ return raw.map((r, i) => ({
380
+ kind: r.kind,
381
+ prefix: r.prefix,
382
+ start: r.index,
383
+ end: i + 1 < raw.length ? raw[i + 1].index : safe.length,
384
+ }));
385
+ }
386
+ function scopeFor(scopes, index) {
387
+ for (const s of scopes) {
388
+ if (index >= s.start && index < s.end)
389
+ return s;
390
+ }
391
+ return null;
392
+ }
393
+ // ---------------------------------------------------------------------------
394
+ // Argument parsing
395
+ // ---------------------------------------------------------------------------
396
+ /** First string literal anywhere in the args, or '' (covers `'x'`, `{ k: 'x' }`). */
397
+ function parseStringArg(args) {
398
+ const m = args.match(/['"`]([^'"`]*)['"`]/);
399
+ return m ? m[1] : '';
400
+ }
401
+ /** `@Controller('users')` | `@Controller({ path: 'users', host })` | `@Controller(['a','b'])` | `@Controller()`. */
402
+ function parseControllerPrefix(args) {
403
+ const obj = args.match(/path\s*:\s*['"`]([^'"`]*)['"`]/);
404
+ if (obj)
405
+ return obj[1];
406
+ return parseStringArg(args);
407
+ }
408
+ /** `@WebSocketGateway({ namespace: 'chat' })` | `@WebSocketGateway(81, { namespace: '/chat' })` | `@WebSocketGateway()`. */
409
+ function parseGatewayNamespace(args) {
410
+ const m = args.match(/namespace\s*:\s*['"`]([^'"`]*)['"`]/);
411
+ return m ? m[1] : '';
412
+ }
413
+ /**
414
+ * GraphQL operation name. Prefers an explicit `{ name: 'x' }` or a leading
415
+ * string literal (`@Query('users')`); otherwise the field name defaults to the
416
+ * handler method name. Avoids mistaking a `description` string for the name.
417
+ */
418
+ function parseGraphqlName(args, handler) {
419
+ const named = args.match(/name\s*:\s*['"`]([^'"`]*)['"`]/);
420
+ if (named)
421
+ return named[1];
422
+ const lead = args.match(/^\s*['"`]([^'"`]*)['"`]/);
423
+ if (lead)
424
+ return lead[1];
425
+ return handler ?? '';
426
+ }
427
+ // ---------------------------------------------------------------------------
428
+ // Path helpers
429
+ // ---------------------------------------------------------------------------
430
+ /** Join a controller prefix and method path into a single normalised `/path`. */
431
+ function joinHttpPath(prefix, sub) {
432
+ const parts = [prefix, sub]
433
+ .map((p) => p.trim().replace(/^\/+|\/+$/g, ''))
434
+ .filter((p) => p.length > 0);
435
+ return '/' + parts.join('/');
436
+ }
437
+ function lineAt(safe, index) {
438
+ return safe.slice(0, index).split('\n').length;
439
+ }
440
+ function detectLanguage(filePath) {
441
+ if (filePath.endsWith('.ts') || filePath.endsWith('.tsx'))
442
+ return 'typescript';
443
+ return 'javascript';
444
+ }
445
+ // ---------------------------------------------------------------------------
446
+ // RouterModule + @Module walkers (used by postExtract above)
447
+ // ---------------------------------------------------------------------------
448
+ /**
449
+ * Walk every `RouterModule.register([...])` call (and the equivalent
450
+ * `RouterModule.forRoot([...])` and `forChild([...])` aliases) and populate
451
+ * `out` with `Module → /full/prefix`. Recursive `children` arrays inherit
452
+ * their parent's prefix.
453
+ *
454
+ * First-write-wins: if the same module appears in two registrations we keep
455
+ * the first prefix seen rather than overwriting. NestJS itself does the same.
456
+ */
457
+ function collectRouterModuleRegistrations(safe, out) {
458
+ const re = /\bRouterModule\s*\.\s*(?:register|forRoot|forChild)\s*\(/g;
459
+ let m;
460
+ while ((m = re.exec(safe)) !== null) {
461
+ const openIndex = m.index + m[0].length - 1;
462
+ const parsed = readArgs(safe, openIndex);
463
+ if (!parsed)
464
+ continue;
465
+ const items = parseRoutesArray(parsed.args);
466
+ walkRoutesTree(items, '', out);
467
+ re.lastIndex = parsed.end;
468
+ }
469
+ }
470
+ /**
471
+ * Parse a `[ {...}, {...} ]` argument list into a list of `RouteItem`s. The
472
+ * args are expected to be an inline literal — references to a `const routes:
473
+ * Routes = [...]` declared earlier in the file aren't followed (rare in
474
+ * practice; the registration is usually inline).
475
+ */
476
+ function parseRoutesArray(args) {
477
+ const trimmed = args.trim();
478
+ if (!trimmed.startsWith('['))
479
+ return [];
480
+ // Strip outer [ ... ] respecting balanced brackets.
481
+ const close = matchingClose(trimmed, 0);
482
+ if (close < 0)
483
+ return [];
484
+ return parseRouteObjects(trimmed.slice(1, close));
485
+ }
486
+ function parseRouteObjects(s) {
487
+ const items = [];
488
+ for (const obj of splitTopLevelObjects(s)) {
489
+ const path = parseStringField(obj, 'path');
490
+ const moduleName = parseIdentField(obj, 'module');
491
+ const childrenStr = parseArrayField(obj, 'children');
492
+ const children = childrenStr ? parseRouteObjects(childrenStr) : [];
493
+ items.push({ path, moduleName, children });
494
+ }
495
+ return items;
496
+ }
497
+ function walkRoutesTree(items, parentPrefix, out) {
498
+ for (const item of items) {
499
+ const myPrefix = joinHttpPath(parentPrefix, item.path);
500
+ if (item.moduleName && !out.has(item.moduleName)) {
501
+ out.set(item.moduleName, myPrefix);
502
+ }
503
+ if (item.children.length > 0) {
504
+ walkRoutesTree(item.children, myPrefix, out);
505
+ }
506
+ }
507
+ }
508
+ /**
509
+ * Walk every `@Module(...)` decorator and populate `out` with
510
+ * `Controller → enclosingModuleClassName`, based on the decorator's
511
+ * `controllers: [...]` field and the class declaration that follows the
512
+ * decorator (skipping stacked decorators and export/default/abstract
513
+ * modifiers).
514
+ */
515
+ function collectModuleControllers(safe, out) {
516
+ for (const hit of findDecorators(safe, ['Module'])) {
517
+ const className = classNameAfter(safe, hit.end);
518
+ if (!className)
519
+ continue;
520
+ for (const controller of parseControllersField(hit.args)) {
521
+ // First-write-wins, same as RouterModule, so a controller listed in two
522
+ // modules picks up the one declared earliest in source.
523
+ if (!out.has(controller))
524
+ out.set(controller, className);
525
+ }
526
+ }
527
+ }
528
+ function parseControllersField(args) {
529
+ const inner = parseArrayField(args, 'controllers');
530
+ if (inner === null)
531
+ return [];
532
+ return inner
533
+ .split(',')
534
+ .map((s) => s.trim())
535
+ .filter((s) => /^[A-Za-z_$][\w$]*$/.test(s));
536
+ }
537
+ /**
538
+ * Starting just after a class decorator's `)`, return the name of the class
539
+ * it decorates. Mirrors `methodNameAfter` for methods: skips stacked
540
+ * decorators and `export`/`default`/`abstract` modifiers.
541
+ */
542
+ function classNameAfter(safe, start) {
543
+ let i = start;
544
+ const ws = /\s*/y;
545
+ const decoName = /@[\w.]+/y;
546
+ const classDecl = /(?:export\s+)?(?:default\s+)?(?:abstract\s+)?class\s+([A-Za-z_$][\w$]*)/y;
547
+ const eatWs = () => {
548
+ ws.lastIndex = i;
549
+ if (ws.exec(safe))
550
+ i = ws.lastIndex;
551
+ };
552
+ for (;;) {
553
+ eatWs();
554
+ if (safe[i] !== '@')
555
+ break;
556
+ decoName.lastIndex = i;
557
+ if (!decoName.exec(safe))
558
+ break;
559
+ i = decoName.lastIndex;
560
+ eatWs();
561
+ if (safe[i] === '(') {
562
+ const parsed = readArgs(safe, i);
563
+ if (!parsed)
564
+ return null;
565
+ i = parsed.end;
566
+ }
567
+ }
568
+ eatWs();
569
+ classDecl.lastIndex = i;
570
+ const m = classDecl.exec(safe);
571
+ return m ? m[1] : null;
572
+ }
573
+ /**
574
+ * Recompute a route node's `name` by prepending `prefix` to the *original*
575
+ * in-file path. The original is recovered from `qualifiedName`, which the
576
+ * per-file extract emits as `${filePath}::${method}:${path}` and which this
577
+ * pass deliberately never mutates — that's what keeps the update idempotent.
578
+ */
579
+ function applyModulePrefix(route, prefix) {
580
+ const sep = '::';
581
+ const idx = route.qualifiedName.indexOf(sep);
582
+ if (idx < 0)
583
+ return null;
584
+ const tail = route.qualifiedName.slice(idx + sep.length);
585
+ const colon = tail.indexOf(':');
586
+ if (colon < 0)
587
+ return null;
588
+ const method = tail.slice(0, colon);
589
+ const original = tail.slice(colon + 1);
590
+ const newName = `${method} ${joinHttpPath(prefix, original)}`;
591
+ return { ...route, name: newName, updatedAt: Date.now() };
592
+ }
593
+ // ---------------------------------------------------------------------------
594
+ // Small string utilities (object/array literal splitters)
595
+ // ---------------------------------------------------------------------------
596
+ /** Return the index of the bracket that closes the one at `open`, or -1. */
597
+ function matchingClose(s, open) {
598
+ const opener = s[open];
599
+ if (opener !== '[' && opener !== '{' && opener !== '(')
600
+ return -1;
601
+ let depth = 0;
602
+ let inStr = null;
603
+ for (let i = open; i < s.length; i++) {
604
+ const ch = s[i];
605
+ if (inStr) {
606
+ if (ch === '\\') {
607
+ i++;
608
+ continue;
609
+ }
610
+ if (ch === inStr)
611
+ inStr = null;
612
+ continue;
613
+ }
614
+ if (ch === '"' || ch === "'" || ch === '`') {
615
+ inStr = ch;
616
+ continue;
617
+ }
618
+ if (ch === '{' || ch === '[' || ch === '(')
619
+ depth++;
620
+ else if (ch === '}' || ch === ']' || ch === ')') {
621
+ depth--;
622
+ if (depth === 0)
623
+ return i;
624
+ }
625
+ }
626
+ return -1;
627
+ }
628
+ /**
629
+ * Split `s` into the contents of each top-level object literal. Brackets and
630
+ * string literals are balanced so nested arrays/objects/strings inside an
631
+ * object don't cause an early split.
632
+ */
633
+ function splitTopLevelObjects(s) {
634
+ const out = [];
635
+ let depth = 0;
636
+ let objStart = -1;
637
+ let inStr = null;
638
+ for (let i = 0; i < s.length; i++) {
639
+ const ch = s[i];
640
+ if (inStr) {
641
+ if (ch === '\\') {
642
+ i++;
643
+ continue;
644
+ }
645
+ if (ch === inStr)
646
+ inStr = null;
647
+ continue;
648
+ }
649
+ if (ch === '"' || ch === "'" || ch === '`') {
650
+ inStr = ch;
651
+ continue;
652
+ }
653
+ if (depth === 0 && ch === '{') {
654
+ depth = 1;
655
+ objStart = i;
656
+ continue;
657
+ }
658
+ if (ch === '{' || ch === '[' || ch === '(')
659
+ depth++;
660
+ else if (ch === '}' || ch === ']' || ch === ')') {
661
+ depth--;
662
+ if (depth === 0 && objStart >= 0 && ch === '}') {
663
+ out.push(s.slice(objStart + 1, i));
664
+ objStart = -1;
665
+ }
666
+ }
667
+ }
668
+ return out;
669
+ }
670
+ /**
671
+ * Read a string-valued field — `key: 'value'` — out of one object literal's
672
+ * body. Returns `''` if not present. The leading character class guards
673
+ * against matching a field whose name *contains* the target as a suffix.
674
+ */
675
+ function parseStringField(obj, name) {
676
+ const re = new RegExp(`(?:^|[,{\\s])${name}\\s*:\\s*['"\`]([^'"\`]*)['"\`]`);
677
+ const m = obj.match(re);
678
+ return m ? m[1] : '';
679
+ }
680
+ /** Read an identifier-valued field — `key: SomeIdent` — out of one object body. */
681
+ function parseIdentField(obj, name) {
682
+ const re = new RegExp(`(?:^|[,{\\s])${name}\\s*:\\s*([A-Za-z_$][\\w$]*)`);
683
+ const m = obj.match(re);
684
+ return m ? m[1] : null;
685
+ }
686
+ /** Read an array-valued field — `key: [ ... ]` — as the raw inner text. */
687
+ function parseArrayField(obj, name) {
688
+ const re = new RegExp(`(?:^|[,{\\s])${name}\\s*:\\s*\\[`);
689
+ const m = re.exec(obj);
690
+ if (!m)
691
+ return null;
692
+ const open = m.index + m[0].length - 1;
693
+ const close = matchingClose(obj, open);
694
+ if (close < 0)
695
+ return null;
696
+ return obj.slice(open + 1, close);
697
+ }
698
+ //# sourceMappingURL=nestjs.js.map