@ltm-alpha/alpha-cs 1.6.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 (1107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +972 -0
  3. package/dist/bin/command-supervision.d.ts +49 -0
  4. package/dist/bin/command-supervision.d.ts.map +1 -0
  5. package/dist/bin/command-supervision.js +95 -0
  6. package/dist/bin/command-supervision.js.map +1 -0
  7. package/dist/bin/fatal-handler.d.ts +20 -0
  8. package/dist/bin/fatal-handler.d.ts.map +1 -0
  9. package/dist/bin/fatal-handler.js +118 -0
  10. package/dist/bin/fatal-handler.js.map +1 -0
  11. package/dist/bin/ltm-alpha-cs.d.ts +27 -0
  12. package/dist/bin/ltm-alpha-cs.d.ts.map +1 -0
  13. package/dist/bin/ltm-alpha-cs.js +2643 -0
  14. package/dist/bin/ltm-alpha-cs.js.map +1 -0
  15. package/dist/bin/node-version-check.d.ts +37 -0
  16. package/dist/bin/node-version-check.d.ts.map +1 -0
  17. package/dist/bin/node-version-check.js +79 -0
  18. package/dist/bin/node-version-check.js.map +1 -0
  19. package/dist/bin/uninstall.d.ts +14 -0
  20. package/dist/bin/uninstall.d.ts.map +1 -0
  21. package/dist/bin/uninstall.js +36 -0
  22. package/dist/bin/uninstall.js.map +1 -0
  23. package/dist/context/formatter.d.ts +36 -0
  24. package/dist/context/formatter.d.ts.map +1 -0
  25. package/dist/context/formatter.js +269 -0
  26. package/dist/context/formatter.js.map +1 -0
  27. package/dist/context/index.d.ts +131 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/context/index.js +1378 -0
  30. package/dist/context/index.js.map +1 -0
  31. package/dist/context/markers.d.ts +19 -0
  32. package/dist/context/markers.d.ts.map +1 -0
  33. package/dist/context/markers.js +22 -0
  34. package/dist/context/markers.js.map +1 -0
  35. package/dist/db/index.d.ts +385 -0
  36. package/dist/db/index.d.ts.map +1 -0
  37. package/dist/db/index.js +902 -0
  38. package/dist/db/index.js.map +1 -0
  39. package/dist/db/migrations.d.ts +44 -0
  40. package/dist/db/migrations.d.ts.map +1 -0
  41. package/dist/db/migrations.js +236 -0
  42. package/dist/db/migrations.js.map +1 -0
  43. package/dist/db/queries.d.ts +1095 -0
  44. package/dist/db/queries.d.ts.map +1 -0
  45. package/dist/db/queries.js +3285 -0
  46. package/dist/db/queries.js.map +1 -0
  47. package/dist/db/schema.sql +207 -0
  48. package/dist/db/sqlite-adapter.d.ts +55 -0
  49. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  50. package/dist/db/sqlite-adapter.js +135 -0
  51. package/dist/db/sqlite-adapter.js.map +1 -0
  52. package/dist/db/wal-valve.d.ts +139 -0
  53. package/dist/db/wal-valve.d.ts.map +1 -0
  54. package/dist/db/wal-valve.js +333 -0
  55. package/dist/db/wal-valve.js.map +1 -0
  56. package/dist/directory.d.ts +232 -0
  57. package/dist/directory.d.ts.map +1 -0
  58. package/dist/directory.js +877 -0
  59. package/dist/directory.js.map +1 -0
  60. package/dist/errors.d.ts +150 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +234 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/extraction/astro-extractor.d.ts +79 -0
  65. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  66. package/dist/extraction/astro-extractor.js +320 -0
  67. package/dist/extraction/astro-extractor.js.map +1 -0
  68. package/dist/extraction/cfml-extractor.d.ts +107 -0
  69. package/dist/extraction/cfml-extractor.d.ts.map +1 -0
  70. package/dist/extraction/cfml-extractor.js +505 -0
  71. package/dist/extraction/cfml-extractor.js.map +1 -0
  72. package/dist/extraction/dfm-extractor.d.ts +31 -0
  73. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  74. package/dist/extraction/dfm-extractor.js +151 -0
  75. package/dist/extraction/dfm-extractor.js.map +1 -0
  76. package/dist/extraction/extraction-version.d.ts +25 -0
  77. package/dist/extraction/extraction-version.d.ts.map +1 -0
  78. package/dist/extraction/extraction-version.js +28 -0
  79. package/dist/extraction/extraction-version.js.map +1 -0
  80. package/dist/extraction/function-ref.d.ts +118 -0
  81. package/dist/extraction/function-ref.d.ts.map +1 -0
  82. package/dist/extraction/function-ref.js +746 -0
  83. package/dist/extraction/function-ref.js.map +1 -0
  84. package/dist/extraction/generated-detection.d.ts +66 -0
  85. package/dist/extraction/generated-detection.d.ts.map +1 -0
  86. package/dist/extraction/generated-detection.js +248 -0
  87. package/dist/extraction/generated-detection.js.map +1 -0
  88. package/dist/extraction/grammars.d.ts +148 -0
  89. package/dist/extraction/grammars.d.ts.map +1 -0
  90. package/dist/extraction/grammars.js +743 -0
  91. package/dist/extraction/grammars.js.map +1 -0
  92. package/dist/extraction/index.d.ts +455 -0
  93. package/dist/extraction/index.d.ts.map +1 -0
  94. package/dist/extraction/index.js +3208 -0
  95. package/dist/extraction/index.js.map +1 -0
  96. package/dist/extraction/kernel/decode.d.ts +9 -0
  97. package/dist/extraction/kernel/decode.d.ts.map +1 -0
  98. package/dist/extraction/kernel/decode.js +162 -0
  99. package/dist/extraction/kernel/decode.js.map +1 -0
  100. package/dist/extraction/kernel/index.d.ts +64 -0
  101. package/dist/extraction/kernel/index.d.ts.map +1 -0
  102. package/dist/extraction/kernel/index.js +279 -0
  103. package/dist/extraction/kernel/index.js.map +1 -0
  104. package/dist/extraction/kernel/layout.d.ts +101 -0
  105. package/dist/extraction/kernel/layout.d.ts.map +1 -0
  106. package/dist/extraction/kernel/layout.js +104 -0
  107. package/dist/extraction/kernel/layout.js.map +1 -0
  108. package/dist/extraction/kernel/loader.d.ts +103 -0
  109. package/dist/extraction/kernel/loader.d.ts.map +1 -0
  110. package/dist/extraction/kernel/loader.js +146 -0
  111. package/dist/extraction/kernel/loader.js.map +1 -0
  112. package/dist/extraction/languages/arkts.d.ts +3 -0
  113. package/dist/extraction/languages/arkts.d.ts.map +1 -0
  114. package/dist/extraction/languages/arkts.js +127 -0
  115. package/dist/extraction/languages/arkts.js.map +1 -0
  116. package/dist/extraction/languages/c-cpp.d.ts +167 -0
  117. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  118. package/dist/extraction/languages/c-cpp.js +1850 -0
  119. package/dist/extraction/languages/c-cpp.js.map +1 -0
  120. package/dist/extraction/languages/cfquery.d.ts +12 -0
  121. package/dist/extraction/languages/cfquery.d.ts.map +1 -0
  122. package/dist/extraction/languages/cfquery.js +28 -0
  123. package/dist/extraction/languages/cfquery.js.map +1 -0
  124. package/dist/extraction/languages/cfscript.d.ts +3 -0
  125. package/dist/extraction/languages/cfscript.d.ts.map +1 -0
  126. package/dist/extraction/languages/cfscript.js +73 -0
  127. package/dist/extraction/languages/cfscript.js.map +1 -0
  128. package/dist/extraction/languages/cobol.d.ts +33 -0
  129. package/dist/extraction/languages/cobol.d.ts.map +1 -0
  130. package/dist/extraction/languages/cobol.js +499 -0
  131. package/dist/extraction/languages/cobol.js.map +1 -0
  132. package/dist/extraction/languages/csharp.d.ts +25 -0
  133. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  134. package/dist/extraction/languages/csharp.js +175 -0
  135. package/dist/extraction/languages/csharp.js.map +1 -0
  136. package/dist/extraction/languages/dart.d.ts +3 -0
  137. package/dist/extraction/languages/dart.d.ts.map +1 -0
  138. package/dist/extraction/languages/dart.js +374 -0
  139. package/dist/extraction/languages/dart.js.map +1 -0
  140. package/dist/extraction/languages/erlang.d.ts +3 -0
  141. package/dist/extraction/languages/erlang.d.ts.map +1 -0
  142. package/dist/extraction/languages/erlang.js +386 -0
  143. package/dist/extraction/languages/erlang.js.map +1 -0
  144. package/dist/extraction/languages/go.d.ts +3 -0
  145. package/dist/extraction/languages/go.d.ts.map +1 -0
  146. package/dist/extraction/languages/go.js +111 -0
  147. package/dist/extraction/languages/go.js.map +1 -0
  148. package/dist/extraction/languages/index.d.ts +10 -0
  149. package/dist/extraction/languages/index.d.ts.map +1 -0
  150. package/dist/extraction/languages/index.js +71 -0
  151. package/dist/extraction/languages/index.js.map +1 -0
  152. package/dist/extraction/languages/java.d.ts +3 -0
  153. package/dist/extraction/languages/java.d.ts.map +1 -0
  154. package/dist/extraction/languages/java.js +315 -0
  155. package/dist/extraction/languages/java.js.map +1 -0
  156. package/dist/extraction/languages/javascript.d.ts +3 -0
  157. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  158. package/dist/extraction/languages/javascript.js +106 -0
  159. package/dist/extraction/languages/javascript.js.map +1 -0
  160. package/dist/extraction/languages/kotlin.d.ts +3 -0
  161. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  162. package/dist/extraction/languages/kotlin.js +512 -0
  163. package/dist/extraction/languages/kotlin.js.map +1 -0
  164. package/dist/extraction/languages/lua.d.ts +3 -0
  165. package/dist/extraction/languages/lua.d.ts.map +1 -0
  166. package/dist/extraction/languages/lua.js +153 -0
  167. package/dist/extraction/languages/lua.js.map +1 -0
  168. package/dist/extraction/languages/luau.d.ts +3 -0
  169. package/dist/extraction/languages/luau.d.ts.map +1 -0
  170. package/dist/extraction/languages/luau.js +37 -0
  171. package/dist/extraction/languages/luau.js.map +1 -0
  172. package/dist/extraction/languages/nix.d.ts +3 -0
  173. package/dist/extraction/languages/nix.d.ts.map +1 -0
  174. package/dist/extraction/languages/nix.js +294 -0
  175. package/dist/extraction/languages/nix.js.map +1 -0
  176. package/dist/extraction/languages/objc.d.ts +3 -0
  177. package/dist/extraction/languages/objc.d.ts.map +1 -0
  178. package/dist/extraction/languages/objc.js +179 -0
  179. package/dist/extraction/languages/objc.js.map +1 -0
  180. package/dist/extraction/languages/pascal.d.ts +3 -0
  181. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  182. package/dist/extraction/languages/pascal.js +77 -0
  183. package/dist/extraction/languages/pascal.js.map +1 -0
  184. package/dist/extraction/languages/php.d.ts +3 -0
  185. package/dist/extraction/languages/php.d.ts.map +1 -0
  186. package/dist/extraction/languages/php.js +196 -0
  187. package/dist/extraction/languages/php.js.map +1 -0
  188. package/dist/extraction/languages/python.d.ts +3 -0
  189. package/dist/extraction/languages/python.d.ts.map +1 -0
  190. package/dist/extraction/languages/python.js +56 -0
  191. package/dist/extraction/languages/python.js.map +1 -0
  192. package/dist/extraction/languages/r.d.ts +3 -0
  193. package/dist/extraction/languages/r.d.ts.map +1 -0
  194. package/dist/extraction/languages/r.js +314 -0
  195. package/dist/extraction/languages/r.js.map +1 -0
  196. package/dist/extraction/languages/ruby.d.ts +3 -0
  197. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  198. package/dist/extraction/languages/ruby.js +149 -0
  199. package/dist/extraction/languages/ruby.js.map +1 -0
  200. package/dist/extraction/languages/rust.d.ts +23 -0
  201. package/dist/extraction/languages/rust.d.ts.map +1 -0
  202. package/dist/extraction/languages/rust.js +172 -0
  203. package/dist/extraction/languages/rust.js.map +1 -0
  204. package/dist/extraction/languages/scala.d.ts +3 -0
  205. package/dist/extraction/languages/scala.d.ts.map +1 -0
  206. package/dist/extraction/languages/scala.js +219 -0
  207. package/dist/extraction/languages/scala.js.map +1 -0
  208. package/dist/extraction/languages/solidity.d.ts +3 -0
  209. package/dist/extraction/languages/solidity.d.ts.map +1 -0
  210. package/dist/extraction/languages/solidity.js +293 -0
  211. package/dist/extraction/languages/solidity.js.map +1 -0
  212. package/dist/extraction/languages/swift.d.ts +3 -0
  213. package/dist/extraction/languages/swift.d.ts.map +1 -0
  214. package/dist/extraction/languages/swift.js +152 -0
  215. package/dist/extraction/languages/swift.js.map +1 -0
  216. package/dist/extraction/languages/terraform.d.ts +3 -0
  217. package/dist/extraction/languages/terraform.d.ts.map +1 -0
  218. package/dist/extraction/languages/terraform.js +641 -0
  219. package/dist/extraction/languages/terraform.js.map +1 -0
  220. package/dist/extraction/languages/typescript.d.ts +16 -0
  221. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  222. package/dist/extraction/languages/typescript.js +174 -0
  223. package/dist/extraction/languages/typescript.js.map +1 -0
  224. package/dist/extraction/languages/vbnet.d.ts +11 -0
  225. package/dist/extraction/languages/vbnet.d.ts.map +1 -0
  226. package/dist/extraction/languages/vbnet.js +141 -0
  227. package/dist/extraction/languages/vbnet.js.map +1 -0
  228. package/dist/extraction/liquid-extractor.d.ts +59 -0
  229. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  230. package/dist/extraction/liquid-extractor.js +357 -0
  231. package/dist/extraction/liquid-extractor.js.map +1 -0
  232. package/dist/extraction/mybatis-extractor.d.ts +68 -0
  233. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  234. package/dist/extraction/mybatis-extractor.js +300 -0
  235. package/dist/extraction/mybatis-extractor.js.map +1 -0
  236. package/dist/extraction/parse-pool.d.ts +167 -0
  237. package/dist/extraction/parse-pool.d.ts.map +1 -0
  238. package/dist/extraction/parse-pool.js +421 -0
  239. package/dist/extraction/parse-pool.js.map +1 -0
  240. package/dist/extraction/parse-worker.d.ts +8 -0
  241. package/dist/extraction/parse-worker.d.ts.map +1 -0
  242. package/dist/extraction/parse-worker.js +138 -0
  243. package/dist/extraction/parse-worker.js.map +1 -0
  244. package/dist/extraction/razor-extractor.d.ts +42 -0
  245. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  246. package/dist/extraction/razor-extractor.js +285 -0
  247. package/dist/extraction/razor-extractor.js.map +1 -0
  248. package/dist/extraction/store-worker.d.ts +24 -0
  249. package/dist/extraction/store-worker.d.ts.map +1 -0
  250. package/dist/extraction/store-worker.js +139 -0
  251. package/dist/extraction/store-worker.js.map +1 -0
  252. package/dist/extraction/store-writer.d.ts +63 -0
  253. package/dist/extraction/store-writer.d.ts.map +1 -0
  254. package/dist/extraction/store-writer.js +174 -0
  255. package/dist/extraction/store-writer.js.map +1 -0
  256. package/dist/extraction/svelte-extractor.d.ts +56 -0
  257. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  258. package/dist/extraction/svelte-extractor.js +275 -0
  259. package/dist/extraction/svelte-extractor.js.map +1 -0
  260. package/dist/extraction/syntax-tokens.d.ts +103 -0
  261. package/dist/extraction/syntax-tokens.d.ts.map +1 -0
  262. package/dist/extraction/syntax-tokens.js +381 -0
  263. package/dist/extraction/syntax-tokens.js.map +1 -0
  264. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  265. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  266. package/dist/extraction/tree-sitter-helpers.js +153 -0
  267. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  268. package/dist/extraction/tree-sitter-types.d.ts +279 -0
  269. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  270. package/dist/extraction/tree-sitter-types.js +10 -0
  271. package/dist/extraction/tree-sitter-types.js.map +1 -0
  272. package/dist/extraction/tree-sitter.d.ts +766 -0
  273. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  274. package/dist/extraction/tree-sitter.js +7138 -0
  275. package/dist/extraction/tree-sitter.js.map +1 -0
  276. package/dist/extraction/vue-extractor.d.ts +51 -0
  277. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  278. package/dist/extraction/vue-extractor.js +254 -0
  279. package/dist/extraction/vue-extractor.js.map +1 -0
  280. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  281. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  282. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  283. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  284. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  285. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  286. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  287. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  288. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  289. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  290. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  291. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  292. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  293. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  294. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  295. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  296. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  297. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  298. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  299. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  300. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  301. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  302. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  303. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  304. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  305. package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  306. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  307. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  308. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  309. package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  310. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  311. package/dist/extraction/wasm-runtime-flags.js +130 -0
  312. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  313. package/dist/graph/branch-guards.d.ts +248 -0
  314. package/dist/graph/branch-guards.d.ts.map +1 -0
  315. package/dist/graph/branch-guards.js +2231 -0
  316. package/dist/graph/branch-guards.js.map +1 -0
  317. package/dist/graph/dead-code.d.ts +251 -0
  318. package/dist/graph/dead-code.d.ts.map +1 -0
  319. package/dist/graph/dead-code.js +756 -0
  320. package/dist/graph/dead-code.js.map +1 -0
  321. package/dist/graph/dynamic-boundary-report.d.ts +121 -0
  322. package/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  323. package/dist/graph/dynamic-boundary-report.js +283 -0
  324. package/dist/graph/dynamic-boundary-report.js.map +1 -0
  325. package/dist/graph/index.d.ts +12 -0
  326. package/dist/graph/index.d.ts.map +1 -0
  327. package/dist/graph/index.js +28 -0
  328. package/dist/graph/index.js.map +1 -0
  329. package/dist/graph/named-symbol-flow.d.ts +125 -0
  330. package/dist/graph/named-symbol-flow.d.ts.map +1 -0
  331. package/dist/graph/named-symbol-flow.js +552 -0
  332. package/dist/graph/named-symbol-flow.js.map +1 -0
  333. package/dist/graph/queries.d.ts +106 -0
  334. package/dist/graph/queries.d.ts.map +1 -0
  335. package/dist/graph/queries.js +341 -0
  336. package/dist/graph/queries.js.map +1 -0
  337. package/dist/graph/symbol-lookup.d.ts +83 -0
  338. package/dist/graph/symbol-lookup.d.ts.map +1 -0
  339. package/dist/graph/symbol-lookup.js +181 -0
  340. package/dist/graph/symbol-lookup.js.map +1 -0
  341. package/dist/graph/traversal.d.ts +127 -0
  342. package/dist/graph/traversal.d.ts.map +1 -0
  343. package/dist/graph/traversal.js +599 -0
  344. package/dist/graph/traversal.js.map +1 -0
  345. package/dist/graph/type-hierarchy.d.ts +155 -0
  346. package/dist/graph/type-hierarchy.d.ts.map +1 -0
  347. package/dist/graph/type-hierarchy.js +382 -0
  348. package/dist/graph/type-hierarchy.js.map +1 -0
  349. package/dist/index.d.ts +874 -0
  350. package/dist/index.d.ts.map +1 -0
  351. package/dist/index.js +2005 -0
  352. package/dist/index.js.map +1 -0
  353. package/dist/installer/config-writer.d.ts +28 -0
  354. package/dist/installer/config-writer.d.ts.map +1 -0
  355. package/dist/installer/config-writer.js +91 -0
  356. package/dist/installer/config-writer.js.map +1 -0
  357. package/dist/installer/index.d.ts +143 -0
  358. package/dist/installer/index.d.ts.map +1 -0
  359. package/dist/installer/index.js +621 -0
  360. package/dist/installer/index.js.map +1 -0
  361. package/dist/installer/instructions-template.d.ts +41 -0
  362. package/dist/installer/instructions-template.d.ts.map +1 -0
  363. package/dist/installer/instructions-template.js +53 -0
  364. package/dist/installer/instructions-template.js.map +1 -0
  365. package/dist/installer/targets/antigravity.d.ts +57 -0
  366. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  367. package/dist/installer/targets/antigravity.js +308 -0
  368. package/dist/installer/targets/antigravity.js.map +1 -0
  369. package/dist/installer/targets/claude.d.ts +65 -0
  370. package/dist/installer/targets/claude.d.ts.map +1 -0
  371. package/dist/installer/targets/claude.js +514 -0
  372. package/dist/installer/targets/claude.js.map +1 -0
  373. package/dist/installer/targets/codex.d.ts +33 -0
  374. package/dist/installer/targets/codex.d.ts.map +1 -0
  375. package/dist/installer/targets/codex.js +212 -0
  376. package/dist/installer/targets/codex.js.map +1 -0
  377. package/dist/installer/targets/copilot-cli.d.ts +32 -0
  378. package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  379. package/dist/installer/targets/copilot-cli.js +215 -0
  380. package/dist/installer/targets/copilot-cli.js.map +1 -0
  381. package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  382. package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  383. package/dist/installer/targets/copilot-jetbrains.js +238 -0
  384. package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  385. package/dist/installer/targets/copilot-vscode.d.ts +47 -0
  386. package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  387. package/dist/installer/targets/copilot-vscode.js +219 -0
  388. package/dist/installer/targets/copilot-vscode.js.map +1 -0
  389. package/dist/installer/targets/cursor.d.ts +35 -0
  390. package/dist/installer/targets/cursor.d.ts.map +1 -0
  391. package/dist/installer/targets/cursor.js +254 -0
  392. package/dist/installer/targets/cursor.js.map +1 -0
  393. package/dist/installer/targets/gemini.d.ts +26 -0
  394. package/dist/installer/targets/gemini.d.ts.map +1 -0
  395. package/dist/installer/targets/gemini.js +165 -0
  396. package/dist/installer/targets/gemini.js.map +1 -0
  397. package/dist/installer/targets/hermes.d.ts +18 -0
  398. package/dist/installer/targets/hermes.d.ts.map +1 -0
  399. package/dist/installer/targets/hermes.js +359 -0
  400. package/dist/installer/targets/hermes.js.map +1 -0
  401. package/dist/installer/targets/kiro.d.ts +27 -0
  402. package/dist/installer/targets/kiro.d.ts.map +1 -0
  403. package/dist/installer/targets/kiro.js +178 -0
  404. package/dist/installer/targets/kiro.js.map +1 -0
  405. package/dist/installer/targets/opencode.d.ts +49 -0
  406. package/dist/installer/targets/opencode.d.ts.map +1 -0
  407. package/dist/installer/targets/opencode.js +339 -0
  408. package/dist/installer/targets/opencode.js.map +1 -0
  409. package/dist/installer/targets/registry.d.ts +35 -0
  410. package/dist/installer/targets/registry.d.ts.map +1 -0
  411. package/dist/installer/targets/registry.js +97 -0
  412. package/dist/installer/targets/registry.js.map +1 -0
  413. package/dist/installer/targets/shared.d.ts +101 -0
  414. package/dist/installer/targets/shared.d.ts.map +1 -0
  415. package/dist/installer/targets/shared.js +264 -0
  416. package/dist/installer/targets/shared.js.map +1 -0
  417. package/dist/installer/targets/toml.d.ts +53 -0
  418. package/dist/installer/targets/toml.d.ts.map +1 -0
  419. package/dist/installer/targets/toml.js +226 -0
  420. package/dist/installer/targets/toml.js.map +1 -0
  421. package/dist/installer/targets/types.d.ts +108 -0
  422. package/dist/installer/targets/types.d.ts.map +1 -0
  423. package/dist/installer/targets/types.js +16 -0
  424. package/dist/installer/targets/types.js.map +1 -0
  425. package/dist/mcp/daemon-manager.d.ts +42 -0
  426. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  427. package/dist/mcp/daemon-manager.js +141 -0
  428. package/dist/mcp/daemon-manager.js.map +1 -0
  429. package/dist/mcp/daemon-paths.d.ts +81 -0
  430. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  431. package/dist/mcp/daemon-paths.js +228 -0
  432. package/dist/mcp/daemon-paths.js.map +1 -0
  433. package/dist/mcp/daemon-registry.d.ts +57 -0
  434. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  435. package/dist/mcp/daemon-registry.js +323 -0
  436. package/dist/mcp/daemon-registry.js.map +1 -0
  437. package/dist/mcp/daemon.d.ts +294 -0
  438. package/dist/mcp/daemon.d.ts.map +1 -0
  439. package/dist/mcp/daemon.js +897 -0
  440. package/dist/mcp/daemon.js.map +1 -0
  441. package/dist/mcp/dynamic-boundaries.d.ts +32 -0
  442. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  443. package/dist/mcp/dynamic-boundaries.js +323 -0
  444. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  445. package/dist/mcp/early-ppid.d.ts +26 -0
  446. package/dist/mcp/early-ppid.d.ts.map +1 -0
  447. package/dist/mcp/early-ppid.js +29 -0
  448. package/dist/mcp/early-ppid.js.map +1 -0
  449. package/dist/mcp/engine.d.ts +133 -0
  450. package/dist/mcp/engine.d.ts.map +1 -0
  451. package/dist/mcp/engine.js +421 -0
  452. package/dist/mcp/engine.js.map +1 -0
  453. package/dist/mcp/explore-dedup.d.ts +140 -0
  454. package/dist/mcp/explore-dedup.d.ts.map +1 -0
  455. package/dist/mcp/explore-dedup.js +239 -0
  456. package/dist/mcp/explore-dedup.js.map +1 -0
  457. package/dist/mcp/explore-diagnostics.d.ts +289 -0
  458. package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  459. package/dist/mcp/explore-diagnostics.js +558 -0
  460. package/dist/mcp/explore-diagnostics.js.map +1 -0
  461. package/dist/mcp/explore-session-state.d.ts +217 -0
  462. package/dist/mcp/explore-session-state.d.ts.map +1 -0
  463. package/dist/mcp/explore-session-state.js +322 -0
  464. package/dist/mcp/explore-session-state.js.map +1 -0
  465. package/dist/mcp/index.d.ts +139 -0
  466. package/dist/mcp/index.d.ts.map +1 -0
  467. package/dist/mcp/index.js +636 -0
  468. package/dist/mcp/index.js.map +1 -0
  469. package/dist/mcp/liveness-watchdog.d.ts +35 -0
  470. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  471. package/dist/mcp/liveness-watchdog.js +269 -0
  472. package/dist/mcp/liveness-watchdog.js.map +1 -0
  473. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  474. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  475. package/dist/mcp/ppid-watchdog.js +64 -0
  476. package/dist/mcp/ppid-watchdog.js.map +1 -0
  477. package/dist/mcp/proxy.d.ts +87 -0
  478. package/dist/mcp/proxy.d.ts.map +1 -0
  479. package/dist/mcp/proxy.js +672 -0
  480. package/dist/mcp/proxy.js.map +1 -0
  481. package/dist/mcp/query-pool.d.ts +108 -0
  482. package/dist/mcp/query-pool.d.ts.map +1 -0
  483. package/dist/mcp/query-pool.js +315 -0
  484. package/dist/mcp/query-pool.js.map +1 -0
  485. package/dist/mcp/query-worker.d.ts +24 -0
  486. package/dist/mcp/query-worker.d.ts.map +1 -0
  487. package/dist/mcp/query-worker.js +87 -0
  488. package/dist/mcp/query-worker.js.map +1 -0
  489. package/dist/mcp/server-instructions.d.ts +34 -0
  490. package/dist/mcp/server-instructions.d.ts.map +1 -0
  491. package/dist/mcp/server-instructions.js +113 -0
  492. package/dist/mcp/server-instructions.js.map +1 -0
  493. package/dist/mcp/session.d.ts +109 -0
  494. package/dist/mcp/session.d.ts.map +1 -0
  495. package/dist/mcp/session.js +380 -0
  496. package/dist/mcp/session.js.map +1 -0
  497. package/dist/mcp/startup-handshake.d.ts +44 -0
  498. package/dist/mcp/startup-handshake.d.ts.map +1 -0
  499. package/dist/mcp/startup-handshake.js +73 -0
  500. package/dist/mcp/startup-handshake.js.map +1 -0
  501. package/dist/mcp/stdin-teardown.d.ts +27 -0
  502. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  503. package/dist/mcp/stdin-teardown.js +49 -0
  504. package/dist/mcp/stdin-teardown.js.map +1 -0
  505. package/dist/mcp/tools.d.ts +936 -0
  506. package/dist/mcp/tools.d.ts.map +1 -0
  507. package/dist/mcp/tools.js +6611 -0
  508. package/dist/mcp/tools.js.map +1 -0
  509. package/dist/mcp/transport.d.ts +188 -0
  510. package/dist/mcp/transport.d.ts.map +1 -0
  511. package/dist/mcp/transport.js +377 -0
  512. package/dist/mcp/transport.js.map +1 -0
  513. package/dist/mcp/version.d.ts +19 -0
  514. package/dist/mcp/version.d.ts.map +1 -0
  515. package/dist/mcp/version.js +71 -0
  516. package/dist/mcp/version.js.map +1 -0
  517. package/dist/mcp/writer-lock.d.ts +47 -0
  518. package/dist/mcp/writer-lock.d.ts.map +1 -0
  519. package/dist/mcp/writer-lock.js +218 -0
  520. package/dist/mcp/writer-lock.js.map +1 -0
  521. package/dist/project-config.d.ts +117 -0
  522. package/dist/project-config.d.ts.map +1 -0
  523. package/dist/project-config.js +409 -0
  524. package/dist/project-config.js.map +1 -0
  525. package/dist/resolution/alias-binding.d.ts +56 -0
  526. package/dist/resolution/alias-binding.d.ts.map +1 -0
  527. package/dist/resolution/alias-binding.js +118 -0
  528. package/dist/resolution/alias-binding.js.map +1 -0
  529. package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  530. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  531. package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
  532. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  533. package/dist/resolution/callback-synthesizer.d.ts +78 -0
  534. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  535. package/dist/resolution/callback-synthesizer.js +4105 -0
  536. package/dist/resolution/callback-synthesizer.js.map +1 -0
  537. package/dist/resolution/cooperative-yield.d.ts +40 -0
  538. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  539. package/dist/resolution/cooperative-yield.js +44 -0
  540. package/dist/resolution/cooperative-yield.js.map +1 -0
  541. package/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  542. package/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  543. package/dist/resolution/expo-router-synthesizer.js +189 -0
  544. package/dist/resolution/expo-router-synthesizer.js.map +1 -0
  545. package/dist/resolution/frameworks/astro.d.ts +9 -0
  546. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  547. package/dist/resolution/frameworks/astro.js +169 -0
  548. package/dist/resolution/frameworks/astro.js.map +1 -0
  549. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  550. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  551. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  552. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  553. package/dist/resolution/frameworks/cics.d.ts +20 -0
  554. package/dist/resolution/frameworks/cics.d.ts.map +1 -0
  555. package/dist/resolution/frameworks/cics.js +90 -0
  556. package/dist/resolution/frameworks/cics.js.map +1 -0
  557. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  558. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  559. package/dist/resolution/frameworks/csharp.js +335 -0
  560. package/dist/resolution/frameworks/csharp.js.map +1 -0
  561. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  562. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  563. package/dist/resolution/frameworks/drupal.js +367 -0
  564. package/dist/resolution/frameworks/drupal.js.map +1 -0
  565. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  566. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  567. package/dist/resolution/frameworks/expo-modules.js +148 -0
  568. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  569. package/dist/resolution/frameworks/expo-router.d.ts +189 -0
  570. package/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  571. package/dist/resolution/frameworks/expo-router.js +785 -0
  572. package/dist/resolution/frameworks/expo-router.js.map +1 -0
  573. package/dist/resolution/frameworks/express.d.ts +8 -0
  574. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  575. package/dist/resolution/frameworks/express.js +540 -0
  576. package/dist/resolution/frameworks/express.js.map +1 -0
  577. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  578. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  579. package/dist/resolution/frameworks/fabric.js +354 -0
  580. package/dist/resolution/frameworks/fabric.js.map +1 -0
  581. package/dist/resolution/frameworks/go.d.ts +8 -0
  582. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  583. package/dist/resolution/frameworks/go.js +184 -0
  584. package/dist/resolution/frameworks/go.js.map +1 -0
  585. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  586. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  587. package/dist/resolution/frameworks/goframe.js +112 -0
  588. package/dist/resolution/frameworks/goframe.js.map +1 -0
  589. package/dist/resolution/frameworks/index.d.ts +55 -0
  590. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  591. package/dist/resolution/frameworks/index.js +203 -0
  592. package/dist/resolution/frameworks/index.js.map +1 -0
  593. package/dist/resolution/frameworks/java.d.ts +8 -0
  594. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  595. package/dist/resolution/frameworks/java.js +539 -0
  596. package/dist/resolution/frameworks/java.js.map +1 -0
  597. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  598. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  599. package/dist/resolution/frameworks/laravel.js +257 -0
  600. package/dist/resolution/frameworks/laravel.js.map +1 -0
  601. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  602. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  603. package/dist/resolution/frameworks/nestjs.js +690 -0
  604. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  605. package/dist/resolution/frameworks/nextjs.d.ts +76 -0
  606. package/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  607. package/dist/resolution/frameworks/nextjs.js +328 -0
  608. package/dist/resolution/frameworks/nextjs.js.map +1 -0
  609. package/dist/resolution/frameworks/object-literal.d.ts +32 -0
  610. package/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  611. package/dist/resolution/frameworks/object-literal.js +139 -0
  612. package/dist/resolution/frameworks/object-literal.js.map +1 -0
  613. package/dist/resolution/frameworks/package-deps.d.ts +14 -0
  614. package/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  615. package/dist/resolution/frameworks/package-deps.js +78 -0
  616. package/dist/resolution/frameworks/package-deps.js.map +1 -0
  617. package/dist/resolution/frameworks/play.d.ts +19 -0
  618. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  619. package/dist/resolution/frameworks/play.js +111 -0
  620. package/dist/resolution/frameworks/play.js.map +1 -0
  621. package/dist/resolution/frameworks/python.d.ts +10 -0
  622. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  623. package/dist/resolution/frameworks/python.js +566 -0
  624. package/dist/resolution/frameworks/python.js.map +1 -0
  625. package/dist/resolution/frameworks/react-native.d.ts +29 -0
  626. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  627. package/dist/resolution/frameworks/react-native.js +549 -0
  628. package/dist/resolution/frameworks/react-native.js.map +1 -0
  629. package/dist/resolution/frameworks/react-router.d.ts +46 -0
  630. package/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  631. package/dist/resolution/frameworks/react-router.js +187 -0
  632. package/dist/resolution/frameworks/react-router.js.map +1 -0
  633. package/dist/resolution/frameworks/react.d.ts +9 -0
  634. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  635. package/dist/resolution/frameworks/react.js +257 -0
  636. package/dist/resolution/frameworks/react.js.map +1 -0
  637. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  638. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  639. package/dist/resolution/frameworks/ruby.js +302 -0
  640. package/dist/resolution/frameworks/ruby.js.map +1 -0
  641. package/dist/resolution/frameworks/rust.d.ts +8 -0
  642. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  643. package/dist/resolution/frameworks/rust.js +304 -0
  644. package/dist/resolution/frameworks/rust.js.map +1 -0
  645. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  646. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  647. package/dist/resolution/frameworks/svelte.js +258 -0
  648. package/dist/resolution/frameworks/svelte.js.map +1 -0
  649. package/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  650. package/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  651. package/dist/resolution/frameworks/sveltekit-router.js +156 -0
  652. package/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  653. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  654. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  655. package/dist/resolution/frameworks/swift-objc.js +252 -0
  656. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  657. package/dist/resolution/frameworks/swift.d.ts +10 -0
  658. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  659. package/dist/resolution/frameworks/swift.js +410 -0
  660. package/dist/resolution/frameworks/swift.js.map +1 -0
  661. package/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  662. package/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  663. package/dist/resolution/frameworks/tanstack-router.js +437 -0
  664. package/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  665. package/dist/resolution/frameworks/terraform.d.ts +38 -0
  666. package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  667. package/dist/resolution/frameworks/terraform.js +277 -0
  668. package/dist/resolution/frameworks/terraform.js.map +1 -0
  669. package/dist/resolution/frameworks/vue-router.d.ts +82 -0
  670. package/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  671. package/dist/resolution/frameworks/vue-router.js +377 -0
  672. package/dist/resolution/frameworks/vue-router.js.map +1 -0
  673. package/dist/resolution/frameworks/vue.d.ts +9 -0
  674. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  675. package/dist/resolution/frameworks/vue.js +303 -0
  676. package/dist/resolution/frameworks/vue.js.map +1 -0
  677. package/dist/resolution/go-module.d.ts +26 -0
  678. package/dist/resolution/go-module.d.ts.map +1 -0
  679. package/dist/resolution/go-module.js +78 -0
  680. package/dist/resolution/go-module.js.map +1 -0
  681. package/dist/resolution/goframe-synthesizer.d.ts +29 -0
  682. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  683. package/dist/resolution/goframe-synthesizer.js +163 -0
  684. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  685. package/dist/resolution/import-resolver.d.ts +122 -0
  686. package/dist/resolution/import-resolver.d.ts.map +1 -0
  687. package/dist/resolution/import-resolver.js +2490 -0
  688. package/dist/resolution/import-resolver.js.map +1 -0
  689. package/dist/resolution/index.d.ts +402 -0
  690. package/dist/resolution/index.d.ts.map +1 -0
  691. package/dist/resolution/index.js +2581 -0
  692. package/dist/resolution/index.js.map +1 -0
  693. package/dist/resolution/js-builtins.d.ts +11 -0
  694. package/dist/resolution/js-builtins.d.ts.map +1 -0
  695. package/dist/resolution/js-builtins.js +23 -0
  696. package/dist/resolution/js-builtins.js.map +1 -0
  697. package/dist/resolution/lru-cache.d.ts +24 -0
  698. package/dist/resolution/lru-cache.d.ts.map +1 -0
  699. package/dist/resolution/lru-cache.js +62 -0
  700. package/dist/resolution/lru-cache.js.map +1 -0
  701. package/dist/resolution/memory-budget.d.ts +48 -0
  702. package/dist/resolution/memory-budget.d.ts.map +1 -0
  703. package/dist/resolution/memory-budget.js +162 -0
  704. package/dist/resolution/memory-budget.js.map +1 -0
  705. package/dist/resolution/name-matcher.d.ts +196 -0
  706. package/dist/resolution/name-matcher.d.ts.map +1 -0
  707. package/dist/resolution/name-matcher.js +3484 -0
  708. package/dist/resolution/name-matcher.js.map +1 -0
  709. package/dist/resolution/next-router-synthesizer.d.ts +27 -0
  710. package/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  711. package/dist/resolution/next-router-synthesizer.js +113 -0
  712. package/dist/resolution/next-router-synthesizer.js.map +1 -0
  713. package/dist/resolution/path-aliases.d.ts +70 -0
  714. package/dist/resolution/path-aliases.d.ts.map +1 -0
  715. package/dist/resolution/path-aliases.js +346 -0
  716. package/dist/resolution/path-aliases.js.map +1 -0
  717. package/dist/resolution/react-router-synthesizer.d.ts +33 -0
  718. package/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  719. package/dist/resolution/react-router-synthesizer.js +126 -0
  720. package/dist/resolution/react-router-synthesizer.js.map +1 -0
  721. package/dist/resolution/resolver-pool.d.ts +106 -0
  722. package/dist/resolution/resolver-pool.d.ts.map +1 -0
  723. package/dist/resolution/resolver-pool.js +344 -0
  724. package/dist/resolution/resolver-pool.js.map +1 -0
  725. package/dist/resolution/resolver-worker.d.ts +17 -0
  726. package/dist/resolution/resolver-worker.d.ts.map +1 -0
  727. package/dist/resolution/resolver-worker.js +141 -0
  728. package/dist/resolution/resolver-worker.js.map +1 -0
  729. package/dist/resolution/strip-comments.d.ts +33 -0
  730. package/dist/resolution/strip-comments.d.ts.map +1 -0
  731. package/dist/resolution/strip-comments.js +550 -0
  732. package/dist/resolution/strip-comments.js.map +1 -0
  733. package/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  734. package/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  735. package/dist/resolution/sveltekit-synthesizer.js +173 -0
  736. package/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  737. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  738. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  739. package/dist/resolution/swift-objc-bridge.js +256 -0
  740. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  741. package/dist/resolution/synth-utils.d.ts +26 -0
  742. package/dist/resolution/synth-utils.d.ts.map +1 -0
  743. package/dist/resolution/synth-utils.js +75 -0
  744. package/dist/resolution/synth-utils.js.map +1 -0
  745. package/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  746. package/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  747. package/dist/resolution/tanstack-router-synthesizer.js +114 -0
  748. package/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  749. package/dist/resolution/tier-synthesizer.d.ts +48 -0
  750. package/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  751. package/dist/resolution/tier-synthesizer.js +907 -0
  752. package/dist/resolution/tier-synthesizer.js.map +1 -0
  753. package/dist/resolution/types.d.ts +323 -0
  754. package/dist/resolution/types.d.ts.map +1 -0
  755. package/dist/resolution/types.js +58 -0
  756. package/dist/resolution/types.js.map +1 -0
  757. package/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  758. package/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  759. package/dist/resolution/vue-router-synthesizer.js +115 -0
  760. package/dist/resolution/vue-router-synthesizer.js.map +1 -0
  761. package/dist/resolution/workspace-packages.d.ts +58 -0
  762. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  763. package/dist/resolution/workspace-packages.js +346 -0
  764. package/dist/resolution/workspace-packages.js.map +1 -0
  765. package/dist/search/identifier-segments.d.ts +70 -0
  766. package/dist/search/identifier-segments.d.ts.map +1 -0
  767. package/dist/search/identifier-segments.js +205 -0
  768. package/dist/search/identifier-segments.js.map +1 -0
  769. package/dist/search/query-parser.d.ts +57 -0
  770. package/dist/search/query-parser.d.ts.map +1 -0
  771. package/dist/search/query-parser.js +177 -0
  772. package/dist/search/query-parser.js.map +1 -0
  773. package/dist/search/query-paths.d.ts +57 -0
  774. package/dist/search/query-paths.d.ts.map +1 -0
  775. package/dist/search/query-paths.js +298 -0
  776. package/dist/search/query-paths.js.map +1 -0
  777. package/dist/search/query-utils.d.ts +102 -0
  778. package/dist/search/query-utils.d.ts.map +1 -0
  779. package/dist/search/query-utils.js +487 -0
  780. package/dist/search/query-utils.js.map +1 -0
  781. package/dist/sync/git-hooks.d.ts +45 -0
  782. package/dist/sync/git-hooks.d.ts.map +1 -0
  783. package/dist/sync/git-hooks.js +227 -0
  784. package/dist/sync/git-hooks.js.map +1 -0
  785. package/dist/sync/index.d.ts +19 -0
  786. package/dist/sync/index.d.ts.map +1 -0
  787. package/dist/sync/index.js +35 -0
  788. package/dist/sync/index.js.map +1 -0
  789. package/dist/sync/watch-policy.d.ts +48 -0
  790. package/dist/sync/watch-policy.d.ts.map +1 -0
  791. package/dist/sync/watch-policy.js +124 -0
  792. package/dist/sync/watch-policy.js.map +1 -0
  793. package/dist/sync/watcher.d.ts +402 -0
  794. package/dist/sync/watcher.d.ts.map +1 -0
  795. package/dist/sync/watcher.js +978 -0
  796. package/dist/sync/watcher.js.map +1 -0
  797. package/dist/sync/worktree.d.ts +63 -0
  798. package/dist/sync/worktree.d.ts.map +1 -0
  799. package/dist/sync/worktree.js +182 -0
  800. package/dist/sync/worktree.js.map +1 -0
  801. package/dist/telemetry/index.d.ts +145 -0
  802. package/dist/telemetry/index.d.ts.map +1 -0
  803. package/dist/telemetry/index.js +592 -0
  804. package/dist/telemetry/index.js.map +1 -0
  805. package/dist/types.d.ts +473 -0
  806. package/dist/types.d.ts.map +1 -0
  807. package/dist/types.js +118 -0
  808. package/dist/types.js.map +1 -0
  809. package/dist/ui/color.d.ts +21 -0
  810. package/dist/ui/color.d.ts.map +1 -0
  811. package/dist/ui/color.js +42 -0
  812. package/dist/ui/color.js.map +1 -0
  813. package/dist/ui/glyphs.d.ts +67 -0
  814. package/dist/ui/glyphs.d.ts.map +1 -0
  815. package/dist/ui/glyphs.js +125 -0
  816. package/dist/ui/glyphs.js.map +1 -0
  817. package/dist/ui/shimmer-progress.d.ts +11 -0
  818. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  819. package/dist/ui/shimmer-progress.js +164 -0
  820. package/dist/ui/shimmer-progress.js.map +1 -0
  821. package/dist/ui/shimmer-worker.d.ts +2 -0
  822. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  823. package/dist/ui/shimmer-worker.js +126 -0
  824. package/dist/ui/shimmer-worker.js.map +1 -0
  825. package/dist/ui/types.d.ts +15 -0
  826. package/dist/ui/types.d.ts.map +1 -0
  827. package/dist/ui/types.js +3 -0
  828. package/dist/ui/types.js.map +1 -0
  829. package/dist/ui-server/api/deadcode.d.ts +84 -0
  830. package/dist/ui-server/api/deadcode.d.ts.map +1 -0
  831. package/dist/ui-server/api/deadcode.js +136 -0
  832. package/dist/ui-server/api/deadcode.js.map +1 -0
  833. package/dist/ui-server/api/effects.d.ts +87 -0
  834. package/dist/ui-server/api/effects.d.ts.map +1 -0
  835. package/dist/ui-server/api/effects.js +499 -0
  836. package/dist/ui-server/api/effects.js.map +1 -0
  837. package/dist/ui-server/api/entrypoints.d.ts +86 -0
  838. package/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  839. package/dist/ui-server/api/entrypoints.js +279 -0
  840. package/dist/ui-server/api/entrypoints.js.map +1 -0
  841. package/dist/ui-server/api/events.d.ts +183 -0
  842. package/dist/ui-server/api/events.d.ts.map +1 -0
  843. package/dist/ui-server/api/events.js +430 -0
  844. package/dist/ui-server/api/events.js.map +1 -0
  845. package/dist/ui-server/api/file.d.ts +66 -0
  846. package/dist/ui-server/api/file.d.ts.map +1 -0
  847. package/dist/ui-server/api/file.js +235 -0
  848. package/dist/ui-server/api/file.js.map +1 -0
  849. package/dist/ui-server/api/filecode.d.ts +126 -0
  850. package/dist/ui-server/api/filecode.d.ts.map +1 -0
  851. package/dist/ui-server/api/filecode.js +205 -0
  852. package/dist/ui-server/api/filecode.js.map +1 -0
  853. package/dist/ui-server/api/flow.d.ts +226 -0
  854. package/dist/ui-server/api/flow.d.ts.map +1 -0
  855. package/dist/ui-server/api/flow.js +611 -0
  856. package/dist/ui-server/api/flow.js.map +1 -0
  857. package/dist/ui-server/api/hierarchy.d.ts +81 -0
  858. package/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  859. package/dist/ui-server/api/hierarchy.js +92 -0
  860. package/dist/ui-server/api/hierarchy.js.map +1 -0
  861. package/dist/ui-server/api/index.d.ts +90 -0
  862. package/dist/ui-server/api/index.d.ts.map +1 -0
  863. package/dist/ui-server/api/index.js +332 -0
  864. package/dist/ui-server/api/index.js.map +1 -0
  865. package/dist/ui-server/api/map.d.ts +238 -0
  866. package/dist/ui-server/api/map.d.ts.map +1 -0
  867. package/dist/ui-server/api/map.js +681 -0
  868. package/dist/ui-server/api/map.js.map +1 -0
  869. package/dist/ui-server/api/node.d.ts +81 -0
  870. package/dist/ui-server/api/node.d.ts.map +1 -0
  871. package/dist/ui-server/api/node.js +388 -0
  872. package/dist/ui-server/api/node.js.map +1 -0
  873. package/dist/ui-server/api/nodes.d.ts +25 -0
  874. package/dist/ui-server/api/nodes.d.ts.map +1 -0
  875. package/dist/ui-server/api/nodes.js +45 -0
  876. package/dist/ui-server/api/nodes.js.map +1 -0
  877. package/dist/ui-server/api/program.d.ts +139 -0
  878. package/dist/ui-server/api/program.d.ts.map +1 -0
  879. package/dist/ui-server/api/program.js +315 -0
  880. package/dist/ui-server/api/program.js.map +1 -0
  881. package/dist/ui-server/api/respond.d.ts +76 -0
  882. package/dist/ui-server/api/respond.d.ts.map +1 -0
  883. package/dist/ui-server/api/respond.js +186 -0
  884. package/dist/ui-server/api/respond.js.map +1 -0
  885. package/dist/ui-server/api/route-roots.d.ts +39 -0
  886. package/dist/ui-server/api/route-roots.d.ts.map +1 -0
  887. package/dist/ui-server/api/route-roots.js +96 -0
  888. package/dist/ui-server/api/route-roots.js.map +1 -0
  889. package/dist/ui-server/api/routes.d.ts +59 -0
  890. package/dist/ui-server/api/routes.d.ts.map +1 -0
  891. package/dist/ui-server/api/routes.js +112 -0
  892. package/dist/ui-server/api/routes.js.map +1 -0
  893. package/dist/ui-server/api/screens.d.ts +117 -0
  894. package/dist/ui-server/api/screens.d.ts.map +1 -0
  895. package/dist/ui-server/api/screens.js +611 -0
  896. package/dist/ui-server/api/screens.js.map +1 -0
  897. package/dist/ui-server/api/search.d.ts +29 -0
  898. package/dist/ui-server/api/search.d.ts.map +1 -0
  899. package/dist/ui-server/api/search.js +232 -0
  900. package/dist/ui-server/api/search.js.map +1 -0
  901. package/dist/ui-server/api/session.d.ts +52 -0
  902. package/dist/ui-server/api/session.d.ts.map +1 -0
  903. package/dist/ui-server/api/session.js +199 -0
  904. package/dist/ui-server/api/session.js.map +1 -0
  905. package/dist/ui-server/api/source.d.ts +200 -0
  906. package/dist/ui-server/api/source.d.ts.map +1 -0
  907. package/dist/ui-server/api/source.js +419 -0
  908. package/dist/ui-server/api/source.js.map +1 -0
  909. package/dist/ui-server/api/stats.d.ts +27 -0
  910. package/dist/ui-server/api/stats.d.ts.map +1 -0
  911. package/dist/ui-server/api/stats.js +164 -0
  912. package/dist/ui-server/api/stats.js.map +1 -0
  913. package/dist/ui-server/api/steps.d.ts +274 -0
  914. package/dist/ui-server/api/steps.d.ts.map +1 -0
  915. package/dist/ui-server/api/steps.js +1446 -0
  916. package/dist/ui-server/api/steps.js.map +1 -0
  917. package/dist/ui-server/api/trail-store.d.ts +142 -0
  918. package/dist/ui-server/api/trail-store.d.ts.map +1 -0
  919. package/dist/ui-server/api/trail-store.js +323 -0
  920. package/dist/ui-server/api/trail-store.js.map +1 -0
  921. package/dist/ui-server/api/trails.d.ts +163 -0
  922. package/dist/ui-server/api/trails.d.ts.map +1 -0
  923. package/dist/ui-server/api/trails.js +369 -0
  924. package/dist/ui-server/api/trails.js.map +1 -0
  925. package/dist/ui-server/api/when.d.ts +125 -0
  926. package/dist/ui-server/api/when.d.ts.map +1 -0
  927. package/dist/ui-server/api/when.js +251 -0
  928. package/dist/ui-server/api/when.js.map +1 -0
  929. package/dist/ui-server/api/wire.d.ts +179 -0
  930. package/dist/ui-server/api/wire.d.ts.map +1 -0
  931. package/dist/ui-server/api/wire.js +231 -0
  932. package/dist/ui-server/api/wire.js.map +1 -0
  933. package/dist/ui-server/assets.d.ts +40 -0
  934. package/dist/ui-server/assets.d.ts.map +1 -0
  935. package/dist/ui-server/assets.js +110 -0
  936. package/dist/ui-server/assets.js.map +1 -0
  937. package/dist/ui-server/constants.d.ts +32 -0
  938. package/dist/ui-server/constants.d.ts.map +1 -0
  939. package/dist/ui-server/constants.js +35 -0
  940. package/dist/ui-server/constants.js.map +1 -0
  941. package/dist/ui-server/highlight/index.d.ts +113 -0
  942. package/dist/ui-server/highlight/index.d.ts.map +1 -0
  943. package/dist/ui-server/highlight/index.js +307 -0
  944. package/dist/ui-server/highlight/index.js.map +1 -0
  945. package/dist/ui-server/highlight/languages.d.ts +36 -0
  946. package/dist/ui-server/highlight/languages.d.ts.map +1 -0
  947. package/dist/ui-server/highlight/languages.js +50 -0
  948. package/dist/ui-server/highlight/languages.js.map +1 -0
  949. package/dist/ui-server/index.d.ts +92 -0
  950. package/dist/ui-server/index.d.ts.map +1 -0
  951. package/dist/ui-server/index.js +399 -0
  952. package/dist/ui-server/index.js.map +1 -0
  953. package/dist/ui-server/open-browser.d.ts +31 -0
  954. package/dist/ui-server/open-browser.d.ts.map +1 -0
  955. package/dist/ui-server/open-browser.js +79 -0
  956. package/dist/ui-server/open-browser.js.map +1 -0
  957. package/dist/ui-server/security.d.ts +127 -0
  958. package/dist/ui-server/security.d.ts.map +1 -0
  959. package/dist/ui-server/security.js +332 -0
  960. package/dist/ui-server/security.js.map +1 -0
  961. package/dist/ui-server/static.d.ts +45 -0
  962. package/dist/ui-server/static.d.ts.map +1 -0
  963. package/dist/ui-server/static.js +165 -0
  964. package/dist/ui-server/static.js.map +1 -0
  965. package/dist/upgrade/index.d.ts +164 -0
  966. package/dist/upgrade/index.d.ts.map +1 -0
  967. package/dist/upgrade/index.js +649 -0
  968. package/dist/upgrade/index.js.map +1 -0
  969. package/dist/upgrade/remove-binary.d.ts +87 -0
  970. package/dist/upgrade/remove-binary.d.ts.map +1 -0
  971. package/dist/upgrade/remove-binary.js +289 -0
  972. package/dist/upgrade/remove-binary.js.map +1 -0
  973. package/dist/upgrade/update-check.d.ts +92 -0
  974. package/dist/upgrade/update-check.d.ts.map +1 -0
  975. package/dist/upgrade/update-check.js +258 -0
  976. package/dist/upgrade/update-check.js.map +1 -0
  977. package/dist/utils.d.ts +238 -0
  978. package/dist/utils.d.ts.map +1 -0
  979. package/dist/utils.js +601 -0
  980. package/dist/utils.js.map +1 -0
  981. package/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  982. package/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  983. package/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  984. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  985. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  986. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  987. package/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  988. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  989. package/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  990. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  991. package/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  992. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  993. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  994. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  995. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  996. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  997. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  998. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  999. package/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  1000. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  1001. package/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  1002. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  1003. package/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  1004. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  1005. package/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  1006. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  1007. package/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  1008. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  1009. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  1010. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  1011. package/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  1012. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  1013. package/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  1014. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  1015. package/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  1016. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  1017. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  1018. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  1019. package/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  1020. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  1021. package/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  1022. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  1023. package/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  1024. package/dist/viewer/assets/index-2LG7iXtP.js +97 -0
  1025. package/dist/viewer/assets/index-AtMBttuU.css +1 -0
  1026. package/dist/viewer/index.html +16 -0
  1027. package/package.json +69 -0
  1028. package/scripts/add-lang/bench.sh +60 -0
  1029. package/scripts/add-lang/check-grammar.mjs +75 -0
  1030. package/scripts/add-lang/dump-ast.mjs +103 -0
  1031. package/scripts/add-lang/verify-extraction.mjs +70 -0
  1032. package/scripts/agent-eval/ab-adoption.sh +91 -0
  1033. package/scripts/agent-eval/ab-hook.sh +86 -0
  1034. package/scripts/agent-eval/ab-impl.sh +78 -0
  1035. package/scripts/agent-eval/ab-new-vs-baseline.sh +161 -0
  1036. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  1037. package/scripts/agent-eval/allocation-fixtures.json +344 -0
  1038. package/scripts/agent-eval/arms-F.sh +21 -0
  1039. package/scripts/agent-eval/arms-matrix.sh +37 -0
  1040. package/scripts/agent-eval/audit.sh +68 -0
  1041. package/scripts/agent-eval/bench-readme.sh +48 -0
  1042. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  1043. package/scripts/agent-eval/block-read-hook.sh +19 -0
  1044. package/scripts/agent-eval/compare-arms.mjs +209 -0
  1045. package/scripts/agent-eval/diff-index-drift.mjs +102 -0
  1046. package/scripts/agent-eval/hook-settings.json +15 -0
  1047. package/scripts/agent-eval/itrun.sh +120 -0
  1048. package/scripts/agent-eval/no-cli-shim.sh +96 -0
  1049. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  1050. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  1051. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  1052. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  1053. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  1054. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  1055. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  1056. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  1057. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  1058. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  1059. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  1060. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  1061. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  1062. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  1063. package/scripts/agent-eval/offload-eval.md +76 -0
  1064. package/scripts/agent-eval/parse-arms.mjs +116 -0
  1065. package/scripts/agent-eval/parse-bench-readme.mjs +238 -0
  1066. package/scripts/agent-eval/parse-run.mjs +1401 -0
  1067. package/scripts/agent-eval/parse-session.mjs +130 -0
  1068. package/scripts/agent-eval/probe-allocation.mjs +335 -0
  1069. package/scripts/agent-eval/probe-context.mjs +21 -0
  1070. package/scripts/agent-eval/probe-decl-only.mjs +198 -0
  1071. package/scripts/agent-eval/probe-explore.mjs +40 -0
  1072. package/scripts/agent-eval/probe-factory-closure.mjs +147 -0
  1073. package/scripts/agent-eval/probe-file-spend.mjs +195 -0
  1074. package/scripts/agent-eval/probe-named-symbol.mjs +163 -0
  1075. package/scripts/agent-eval/probe-node.mjs +20 -0
  1076. package/scripts/agent-eval/probe-suite-envelope.mjs +124 -0
  1077. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  1078. package/scripts/agent-eval/probe-trace.mjs +20 -0
  1079. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  1080. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  1081. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  1082. package/scripts/agent-eval/run-agent.sh +34 -0
  1083. package/scripts/agent-eval/run-all.sh +149 -0
  1084. package/scripts/agent-eval/run-arms.sh +56 -0
  1085. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  1086. package/scripts/benchmarks/measure-index.cjs +128 -0
  1087. package/scripts/benchmarks/observe-index.py +91 -0
  1088. package/scripts/build-bundle.sh +154 -0
  1089. package/scripts/build-kernel.sh +87 -0
  1090. package/scripts/check-ui-build.mjs +157 -0
  1091. package/scripts/check-ui-package.mjs +192 -0
  1092. package/scripts/clean-remaining.mjs +243 -0
  1093. package/scripts/count-codegraph.mjs +26 -0
  1094. package/scripts/deep-clean.mjs +66 -0
  1095. package/scripts/dump-graph.mjs +57 -0
  1096. package/scripts/extract-release-notes.mjs +130 -0
  1097. package/scripts/final-codegraph-cleanup.mjs +57 -0
  1098. package/scripts/go-rebrand.mjs +114 -0
  1099. package/scripts/kernel-parity.mjs +283 -0
  1100. package/scripts/local-install.sh +41 -0
  1101. package/scripts/npm-sdk.js +75 -0
  1102. package/scripts/npm-shim.js +279 -0
  1103. package/scripts/pack-npm.sh +123 -0
  1104. package/scripts/prepare-release.mjs +270 -0
  1105. package/scripts/rebrand.mjs +129 -0
  1106. package/scripts/sync-ui-version.mjs +47 -0
  1107. package/scripts/try-repo.sh +112 -0
@@ -0,0 +1,1850 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cppExtractor = exports.cExtractor = void 0;
4
+ exports.normalizeCppReturnType = normalizeCppReturnType;
5
+ exports.stripCppTemplateArgs = stripCppTemplateArgs;
6
+ exports.isCppPureVirtualMethodDecl = isCppPureVirtualMethodDecl;
7
+ exports.blankCppExportMacros = blankCppExportMacros;
8
+ exports.blankCppInlineMacros = blankCppInlineMacros;
9
+ exports.recoverMangledCppName = recoverMangledCppName;
10
+ exports.blankMetalAttributes = blankMetalAttributes;
11
+ exports.blankCppAnnotationMacroCalls = blankCppAnnotationMacroCalls;
12
+ exports.blankLoneMacroLines = blankLoneMacroLines;
13
+ exports.blankCppApiPrefixMacros = blankCppApiPrefixMacros;
14
+ exports.blankCppInlineAnnotationMacros = blankCppInlineAnnotationMacros;
15
+ exports.blankCudaConstructs = blankCudaConstructs;
16
+ exports.blankCLeadingAttrMacros = blankCLeadingAttrMacros;
17
+ exports.blankCCplusplusGuardBodies = blankCCplusplusGuardBodies;
18
+ exports.blankCStatementMacroCalls = blankCStatementMacroCalls;
19
+ exports.blankCSandwichedAnnotations = blankCSandwichedAnnotations;
20
+ exports.blankCAutoInference = blankCAutoInference;
21
+ exports.blankCTrailingParamAttrMacros = blankCTrailingParamAttrMacros;
22
+ exports.blankCKernelAnnotations = blankCKernelAnnotations;
23
+ exports.blankCParameterizedAnnotationMacros = blankCParameterizedAnnotationMacros;
24
+ exports.blankCTypeKeywordArgs = blankCTypeKeywordArgs;
25
+ exports.blankCFileScopePrefixedDeclMacros = blankCFileScopePrefixedDeclMacros;
26
+ exports.rewriteCPrefixedDeclMacroInitializers = rewriteCPrefixedDeclMacroInitializers;
27
+ exports.blankCVaArgQualifiedTypeArgs = blankCVaArgQualifiedTypeArgs;
28
+ exports.blankCNamedVariadicDefineDots = blankCNamedVariadicDefineDots;
29
+ exports.blankCDesignatedMacroArgs = blankCDesignatedMacroArgs;
30
+ const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
31
+ /**
32
+ * Find the function NAME's `qualified_identifier` (`Foo::bar`) inside a
33
+ * declarator, skipping the `parameter_list` — a parameter with a qualified type
34
+ * (`const std::string& x`) must NOT be mistaken for the method name. Without the
35
+ * skip, a plain free function `std::string TableFileName(const std::string&...)`
36
+ * was named `string` (from the parameter type), so calls to it never resolved
37
+ * and its file looked like nothing depended on it.
38
+ */
39
+ function findDeclaratorQualifiedId(declarator) {
40
+ const queue = [declarator];
41
+ while (queue.length > 0) {
42
+ const current = queue.shift();
43
+ if (current.type === 'qualified_identifier')
44
+ return current;
45
+ for (let i = 0; i < current.namedChildCount; i++) {
46
+ const child = current.namedChild(i);
47
+ // Don't descend into parameters or the trailing return type — their types
48
+ // (`const std::string&`, `-> std::string`) aren't the function name.
49
+ if (child && child.type !== 'parameter_list' && child.type !== 'trailing_return_type') {
50
+ queue.push(child);
51
+ }
52
+ }
53
+ }
54
+ return undefined;
55
+ }
56
+ /**
57
+ * Recover the real function name from the macro-definition idiom
58
+ * `MACRO_NAME(real_name, typed args…) { body }` — flash-attention's
59
+ * `DEFINE_FLASH_FORWARD_KERNEL(flash_fwd_kernel, bool Is_dropout, …) { … }`
60
+ * being the motivating case: tree-sitter parses the invocation as a
61
+ * function_definition NAMED after the macro, so every such kernel shared one
62
+ * name (`DEFINE_FLASH_FORWARD_KERNEL`) and the launch sites' calls to the real
63
+ * names (`flash_fwd_kernel<…><<<…>>>`) could never resolve.
64
+ *
65
+ * Deliberately narrow so name-in-first-arg is unambiguous — ALL of:
66
+ * - the parsed name is macro-shaped: ALL-CAPS with at least one underscore
67
+ * (`TEST` never matches; K&R C definitions have lowercase names);
68
+ * - the first "parameter" is a LONE identifier (no type, no declarator)
69
+ * containing a lowercase letter — the name being defined;
70
+ * - at least one more parameter follows and NONE of them is another lone
71
+ * identifier — a second bare arg means the first isn't the name (gtest's
72
+ * `TEST_F(Fixture, Name)`, `PYBIND11_MODULE(ext, m)`,
73
+ * google-benchmark's `BENCHMARK_DEFINE_F(Fix, name)` all bail here).
74
+ */
75
+ function recoverCppMacroDefinedName(node, source) {
76
+ if (node.type !== 'function_definition')
77
+ return undefined;
78
+ const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
79
+ if (declarator?.type !== 'function_declarator')
80
+ return undefined;
81
+ const inner = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'declarator');
82
+ if (inner?.type !== 'identifier')
83
+ return undefined;
84
+ const macroName = (0, tree_sitter_helpers_1.getNodeText)(inner, source);
85
+ if (!/^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/.test(macroName))
86
+ return undefined;
87
+ const params = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'parameters');
88
+ if (!params || params.namedChildCount < 2)
89
+ return undefined;
90
+ const loneIdentText = (p) => p.type === 'parameter_declaration' &&
91
+ p.namedChildCount === 1 &&
92
+ p.namedChild(0)?.type === 'type_identifier'
93
+ ? (0, tree_sitter_helpers_1.getNodeText)(p.namedChild(0), source)
94
+ : null;
95
+ const first = params.namedChild(0);
96
+ const name = first ? loneIdentText(first) : null;
97
+ if (!name || !/[a-z]/.test(name))
98
+ return undefined;
99
+ for (let i = 1; i < params.namedChildCount; i++) {
100
+ const p = params.namedChild(i);
101
+ if (p && loneIdentText(p) !== null)
102
+ return undefined;
103
+ }
104
+ return name;
105
+ }
106
+ function extractCppQualifiedMethodName(node, source) {
107
+ const macroDefined = recoverCppMacroDefinedName(node, source);
108
+ if (macroDefined)
109
+ return macroDefined;
110
+ const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
111
+ if (!declarator)
112
+ return undefined;
113
+ const qid = findDeclaratorQualifiedId(declarator);
114
+ if (!qid)
115
+ return undefined;
116
+ const parts = (0, tree_sitter_helpers_1.getNodeText)(qid, source).trim().split('::').filter(Boolean);
117
+ return parts[parts.length - 1];
118
+ }
119
+ function extractCppReceiverType(node, source) {
120
+ const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
121
+ if (!declarator)
122
+ return undefined;
123
+ const qid = findDeclaratorQualifiedId(declarator);
124
+ if (!qid)
125
+ return undefined;
126
+ const parts = (0, tree_sitter_helpers_1.getNodeText)(qid, source).trim().split('::').filter(Boolean);
127
+ if (parts.length <= 1)
128
+ return undefined;
129
+ // An out-of-line template method definition carries the class's template
130
+ // parameter list in the qualifier (`template<typename T> T Box<T>::get()`),
131
+ // but the class node is indexed as bare `Box` — strip `<…>` so the receiver
132
+ // matches it, the same normalization #1043 applies to base-class refs.
133
+ // Multi-line parameter lists otherwise leak whole `<…>` blocks (newlines
134
+ // included) into qualified_name, which can exceed NAME_MAX (#1286).
135
+ const receiver = stripCppTemplateArgs(parts.slice(0, -1).join('::'));
136
+ return receiver || undefined;
137
+ }
138
+ /**
139
+ * Built-in / non-class return types that can never be a method receiver. We
140
+ * store no `returnType` for these so resolution never tries to resolve a method
141
+ * on `void` / `int` / etc.
142
+ */
143
+ const CPP_NON_CLASS_RETURN = new Set([
144
+ 'void', 'bool', 'char', 'short', 'int', 'long', 'float', 'double', 'unsigned',
145
+ 'signed', 'size_t', 'ssize_t', 'auto', 'wchar_t', 'char8_t', 'char16_t',
146
+ 'char32_t', 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t', 'uint16_t',
147
+ 'uint32_t', 'uint64_t', 'intptr_t', 'uintptr_t', 'nullptr_t',
148
+ ]);
149
+ /**
150
+ * Normalize a C++ return type to the bare class name a method could be called
151
+ * on. Unwraps smart-pointer / optional wrappers to their element type
152
+ * (`std::unique_ptr<Widget>` → `Widget`) so a factory's `->method()` resolves on
153
+ * the pointee. Strips cv-qualifiers, `&`/`*`, namespace qualifiers, and other
154
+ * template args. Returns undefined for primitives / void / `auto` / empty.
155
+ */
156
+ function normalizeCppReturnType(raw) {
157
+ let t = raw.trim();
158
+ if (!t)
159
+ return undefined;
160
+ // Unwrap smart pointers / optional to their pointee (the thing you call `->` on).
161
+ const wrapper = t.match(/\b(?:std\s*::\s*)?(?:unique_ptr|shared_ptr|weak_ptr|optional)\s*<\s*([^,>]+?)\s*>/);
162
+ if (wrapper && wrapper[1])
163
+ t = wrapper[1];
164
+ t = t
165
+ .replace(/\b(?:const|volatile|typename|struct|class|enum)\b/g, ' ')
166
+ .replace(/<[^>]*>/g, ' ')
167
+ .replace(/[*&]+/g, ' ')
168
+ .replace(/\s+/g, ' ')
169
+ .trim();
170
+ if (!t)
171
+ return undefined;
172
+ const last = t.split('::').filter(Boolean).pop();
173
+ if (!last)
174
+ return undefined;
175
+ if (CPP_NON_CLASS_RETURN.has(last))
176
+ return undefined;
177
+ if (!/^[A-Za-z_]\w*$/.test(last))
178
+ return undefined;
179
+ return last;
180
+ }
181
+ /**
182
+ * Strip C++ template arguments from a base-type reference name so it matches the
183
+ * bare class/struct the template was DEFINED as. `template<typename T> class
184
+ * Base { … }` is indexed as a node named `Base`, but a derived class
185
+ * `class D : public Base<int>` records its base as the full `Base<int>` (and
186
+ * `class Q : public ns::Tpl<int>` as `ns::Tpl<int>`) — neither name-matches
187
+ * `Base` / `ns::Tpl`, so the `extends` edge never resolves and the derived class
188
+ * looks like it inherits from nothing (#1043).
189
+ *
190
+ * Removes every balanced `<…>` group regardless of nesting or position, so
191
+ * `Base<int>` → `Base`, `ns::Tpl<Foo<int>>` → `ns::Tpl`, and the rare
192
+ * `Outer<int>::Inner` → `Outer::Inner`. The remaining qualified head is exactly
193
+ * what the non-templated base case already produces, so resolution treats them
194
+ * identically. A name with no template args passes through unchanged.
195
+ */
196
+ function stripCppTemplateArgs(name) {
197
+ if (!name.includes('<'))
198
+ return name;
199
+ let out = '';
200
+ let depth = 0;
201
+ for (const ch of name) {
202
+ if (ch === '<')
203
+ depth++;
204
+ else if (ch === '>') {
205
+ if (depth > 0)
206
+ depth--;
207
+ }
208
+ else if (depth === 0)
209
+ out += ch;
210
+ }
211
+ return out.trim();
212
+ }
213
+ /**
214
+ * Is this C++ `field_declaration` a pure-virtual method (`virtual int read(int key) = 0;`)?
215
+ * tree-sitter-cpp shapes those as a field_declaration whose declarator unwraps to a
216
+ * `function_declarator`, with the pure-virtual `= 0` as a DIRECT `number_literal` "0"
217
+ * child of the field_declaration (default-arg `= 0` lives inside parameter_declaration
218
+ * and must not match). Bodiless method prototypes (`int foo();`) and data members
219
+ * (`int x = 0;`) are excluded — prototypes usually have an out-of-line definition that
220
+ * already mints the method node; pure virtuals never do (#1727).
221
+ */
222
+ function isCppPureVirtualMethodDecl(node) {
223
+ if (node.type !== 'field_declaration')
224
+ return false;
225
+ let declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
226
+ if (!declarator)
227
+ return false;
228
+ while (declarator.type === 'pointer_declarator' ||
229
+ declarator.type === 'reference_declarator') {
230
+ const inner = (0, tree_sitter_helpers_1.getChildByField)(declarator, 'declarator') || declarator.namedChild(0);
231
+ if (!inner)
232
+ return false;
233
+ declarator = inner;
234
+ }
235
+ if (declarator.type !== 'function_declarator')
236
+ return false;
237
+ return node.namedChildren.some((c) => c.type === 'number_literal' && c.text === '0');
238
+ }
239
+ /**
240
+ * A function/method's return type lives in the `function_definition`'s `type`
241
+ * field (`Metrics& Metrics::instance()` → `Metrics`). Constructors, destructors,
242
+ * and conversion operators have no `type` field → undefined.
243
+ */
244
+ function extractCppReturnType(node, source) {
245
+ const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
246
+ if (!typeNode)
247
+ return undefined;
248
+ return normalizeCppReturnType((0, tree_sitter_helpers_1.getNodeText)(typeNode, source));
249
+ }
250
+ exports.cExtractor = {
251
+ // CUDA in C-detected headers (content-gated blank; see preParseCSource).
252
+ preParse: preParseCSource,
253
+ // Universal net: recover a real name from any macro-mangled function name.
254
+ recoverMangledName: recoverMangledCppName,
255
+ functionTypes: ['function_definition'],
256
+ classTypes: [],
257
+ methodTypes: [],
258
+ interfaceTypes: [],
259
+ structTypes: ['struct_specifier'],
260
+ // A bodiless `union U;` is a forward declaration; the aggregate extractor
261
+ // applies the same body requirement it uses for C structs.
262
+ unionTypes: ['union_specifier'],
263
+ enumTypes: ['enum_specifier'],
264
+ enumMemberTypes: ['enumerator'],
265
+ typeAliasTypes: ['type_definition'], // typedef
266
+ importTypes: ['preproc_include'],
267
+ callTypes: ['call_expression'],
268
+ variableTypes: ['declaration'],
269
+ nameField: 'declarator',
270
+ bodyField: 'body',
271
+ paramsField: 'parameters',
272
+ // A `const`/`static const` file-scope declaration carries a `type_qualifier`
273
+ // child reading "const" — extract those as `constant`, plain globals as
274
+ // `variable`.
275
+ isConst: (node) => node.namedChildren.some((c) => c.type === 'type_qualifier' && c.text === 'const'),
276
+ getReturnType: extractCppReturnType,
277
+ resolveTypeAliasKind: (node, _source) => {
278
+ // C typedef: `typedef enum { ... } name;` or `typedef struct { ... } name;`
279
+ // The inner enum_specifier/struct_specifier is anonymous, but we want the typedef name
280
+ // to become the enum/struct node name. `typedef union { ... } name;` takes the
281
+ // same route — otherwise the union body would mint a second, `<anonymous>` node
282
+ // beside the alias.
283
+ for (let i = 0; i < node.namedChildCount; i++) {
284
+ const child = node.namedChild(i);
285
+ if (!child)
286
+ continue;
287
+ if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
288
+ return 'enum';
289
+ if (child.type === 'struct_specifier' &&
290
+ (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
291
+ return 'struct';
292
+ if (child.type === 'union_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
293
+ return 'union';
294
+ }
295
+ return undefined;
296
+ },
297
+ extractImport: (node, source) => {
298
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
299
+ // C includes: #include <stdio.h>, #include "myheader.h"
300
+ const systemLib = node.namedChildren.find((c) => c.type === 'system_lib_string');
301
+ if (systemLib) {
302
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(systemLib, source).replace(/^<|>$/g, ''), signature: importText };
303
+ }
304
+ const stringLiteral = node.namedChildren.find((c) => c.type === 'string_literal');
305
+ if (stringLiteral) {
306
+ const stringContent = stringLiteral.namedChildren.find((c) => c.type === 'string_content');
307
+ if (stringContent) {
308
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(stringContent, source), signature: importText };
309
+ }
310
+ }
311
+ return null;
312
+ },
313
+ };
314
+ /**
315
+ * Detect tree-sitter's misparse of a macro-annotated class/struct, e.g.
316
+ * `class MACRO Name { … }` or `class MACRO Name : public Base { … }` (#946).
317
+ * Not knowing `MACRO` is a macro, tree-sitter reads `class MACRO` as an
318
+ * *elaborated type specifier* (a bodyless `class_specifier`/`struct_specifier`
319
+ * whose "type name" is the macro) and the rest as a function: `Name` becomes the
320
+ * declarator and the `{ … }` a function body — so the whole declaration surfaces
321
+ * as a `function_definition` named after the class, with a line range spanning
322
+ * the entire class body. (A base clause, when present, additionally lands in an
323
+ * `ERROR` node, but it isn't required — the leading macro alone triggers this.)
324
+ *
325
+ * Two structural signals pin it down with no risk to genuine code:
326
+ * - the `type` field is a *bodyless* class/struct specifier — an elaborated
327
+ * type, not a real inline-defined return type like
328
+ * `struct P { int x; } makeP() { … }` (which carries a field list); and
329
+ * - the declarator is not a `function_declarator` — a real function definition
330
+ * always has one, which also leaves the legal-but-rare `class Foo f() { … }`
331
+ * (an elaborated return type on a genuine function) alone.
332
+ *
333
+ * The class body is mangled by the same misparse and is unrecoverable, so —
334
+ * matching how macro-prefixed C prototypes are handled — we drop the spurious
335
+ * node rather than mint a misleading whole-body `function` that pollutes
336
+ * callers/impact and skews kind statistics.
337
+ */
338
+ function isMacroMisparsedTypeDecl(node) {
339
+ const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
340
+ if (!typeNode)
341
+ return false;
342
+ if (typeNode.type !== 'class_specifier' && typeNode.type !== 'struct_specifier')
343
+ return false;
344
+ if (typeNode.namedChildren.some((c) => c.type === 'field_declaration_list'))
345
+ return false;
346
+ const declarator = (0, tree_sitter_helpers_1.getChildByField)(node, 'declarator');
347
+ if (declarator && declarator.type === 'function_declarator')
348
+ return false;
349
+ return true;
350
+ }
351
+ /**
352
+ * Blank an export/visibility macro in a `class/struct EXPORT_MACRO Name …`
353
+ * *definition* header before parsing. Not knowing the macro, tree-sitter reads
354
+ * `class EXPORT_MACRO` as an elaborated type specifier and the rest as a
355
+ * function, so the whole class — its name, base clause, and members — drops out
356
+ * of the index (#946 catches the resulting phantom function but can't recover
357
+ * the class), which silently breaks type-hierarchy / inheritance-impact queries
358
+ * for effectively every Unreal-Engine (`*_API`), Qt/Boost (`*_EXPORT`), LLVM
359
+ * (`*_ABI`), … class. Replacing the macro with equal-length spaces preserves
360
+ * every byte offset (and thus line/column), so the declaration then parses as a
361
+ * normal class_specifier and the existing extraction emits the node, members,
362
+ * and `extends` edge. (#1061, follow-up to #946.)
363
+ *
364
+ * Matched tightly so it can't touch the same macro used as an ordinary value
365
+ * elsewhere (`int x = SOME_API;`): the macro is the ALL-CAPS token sitting
366
+ * *between* `class`/`struct` and the type name, and the trailing `[:{]`
367
+ * definition-guard fires only when a base clause or body follows — the only
368
+ * shape that misparses. That guard also leaves elaborated-type variable
369
+ * declarations (`struct FOO var;`, `class FOO obj = …`) untouched, since those
370
+ * end in `;` / `=` / `[`, never `:` / `{`. C++-only (wired into cppExtractor),
371
+ * so C's heavier use of `struct TAG var;` never reaches it.
372
+ */
373
+ function blankCppExportMacros(source) {
374
+ if (source.indexOf('class') === -1 && source.indexOf('struct') === -1)
375
+ return source;
376
+ return source.replace(/\b(class|struct)(\s+)([A-Z][A-Z0-9_]+)(?=\s+[A-Za-z_]\w*(?:\s+final)?\s*[:{])/g, (_m, kw, ws, macro) => kw + ws + ' '.repeat(macro.length));
377
+ }
378
+ /**
379
+ * Blank a known inline-specifier macro sitting in front of a function's return
380
+ * type (`FORCEINLINE FString GetName(…)`), before parsing. Not knowing the
381
+ * macro, tree-sitter can't reconcile `MACRO <return-type> <name>(` — an extra
382
+ * type-like token before the name — and drops into error recovery: the macro
383
+ * becomes the return type and, for a non-primitive return, the return type gets
384
+ * glued onto the name (`GetName` → `"FString GetName"`), so the function can't
385
+ * be found by name and its callers don't link. This is pervasive in Unreal
386
+ * Engine (`FORCEINLINE <ret> <name>(…)`) and in vendored third-party libraries
387
+ * that define their own inline macro (pugixml's `PUGI__FN`, Godot's
388
+ * `_FORCE_INLINE_`, Boost's `BOOST_FORCEINLINE`, …). Replacing the macro with
389
+ * equal-length spaces preserves every byte offset (so line/column stay exact)
390
+ * and the declaration then parses as an ordinary function — recovering the real
391
+ * name AND the return type — mirroring how `blankCppExportMacros` recovers
392
+ * macro-annotated classes (#946/#1061).
393
+ *
394
+ * Matched tightly so it can't touch an ordinary identifier: only the exact,
395
+ * curated inline-specifier tokens below (never an arbitrary all-caps token, so a
396
+ * real return type like `HRESULT DoIt()` is untouched), and only in specifier
397
+ * position — immediately followed by whitespace and the identifier that starts
398
+ * the return type or name. That lookahead leaves value/expression uses
399
+ * (`x = FORCEINLINE ? …`), string literals, and longer words
400
+ * (`FORCEINLINE_SOMETHINGELSE`, word-boundary) alone. To cover a new codebase's
401
+ * inline macro, add its exact token to the list.
402
+ */
403
+ const CPP_INLINE_MACROS = [
404
+ // Unreal Engine
405
+ 'FORCEINLINE_DEBUGGABLE', 'FORCENOINLINE', 'FORCEINLINE',
406
+ // pugixml (ubiquitous vendored XML parser): `#define PUGI__FN inline` before
407
+ // the return type, plus `PUGIXML_FUNCTION` (linkage macro) between the return
408
+ // type and the name — the blank mechanism handles both positions.
409
+ 'PUGI__FN_NO_INLINE', 'PUGI__FN', 'PUGIXML_FUNCTION',
410
+ // Godot
411
+ '_ALWAYS_INLINE_', '_FORCE_INLINE_',
412
+ // Boost
413
+ 'BOOST_FORCEINLINE', 'BOOST_NOINLINE',
414
+ // Qt (per-method markers + inline)
415
+ 'Q_INVOKABLE', 'Q_SCRIPTABLE', 'Q_ALWAYS_INLINE', 'Q_SLOT', 'Q_SIGNAL',
416
+ // Folly / Abseil / LLVM / V8 / Eigen / rapidjson
417
+ 'FOLLY_ALWAYS_INLINE', 'FOLLY_NOINLINE',
418
+ 'ABSL_ATTRIBUTE_ALWAYS_INLINE', 'ABSL_ATTRIBUTE_NOINLINE',
419
+ 'LLVM_ATTRIBUTE_ALWAYS_INLINE', 'LLVM_ATTRIBUTE_NOINLINE',
420
+ 'V8_INLINE', 'V8_NOINLINE',
421
+ 'EIGEN_STRONG_INLINE', 'EIGEN_ALWAYS_INLINE', 'EIGEN_DEVICE_FUNC',
422
+ 'RAPIDJSON_FORCEINLINE',
423
+ // Mozilla / SpiderMonkey
424
+ 'MOZ_ALWAYS_INLINE', 'MOZ_NEVER_INLINE',
425
+ // Protocol Buffers
426
+ 'PROTOBUF_ALWAYS_INLINE', 'PROTOBUF_NOINLINE',
427
+ // {fmt} / spdlog
428
+ 'FMT_CONSTEXPR20', 'FMT_CONSTEXPR', 'FMT_INLINE',
429
+ // Hedley + nlohmann/json (bundles Hedley)
430
+ 'JSON_HEDLEY_ALWAYS_INLINE', 'JSON_HEDLEY_NEVER_INLINE',
431
+ 'HEDLEY_ALWAYS_INLINE', 'HEDLEY_NEVER_INLINE',
432
+ // GLM (graphics math — pervasive in games/rendering)
433
+ 'GLM_FUNC_QUALIFIER', 'GLM_FUNC_DECL', 'GLM_CONSTEXPR', 'GLM_INLINE',
434
+ // Bullet Physics / Skia / OpenCV / EASTL / Cocos2d-x / Chromium-WebKit
435
+ 'SIMD_FORCE_INLINE',
436
+ 'SK_ALWAYS_INLINE',
437
+ 'CV_ALWAYS_INLINE', 'CV_INLINE',
438
+ 'EA_FORCE_INLINE', 'EA_NOINLINE',
439
+ 'CC_INLINE',
440
+ 'NEVER_INLINE',
441
+ // C libraries: GLib, SQLite (internal linkage)
442
+ 'G_INLINE_FUNC', 'SQLITE_PRIVATE', 'SQLITE_API',
443
+ // Windows calling conventions (linkage position — recover the return type; the
444
+ // name is salvaged regardless). Only the unambiguous, non-word-like ones.
445
+ 'STDMETHODCALLTYPE', 'WINAPIV', 'WINAPI', 'APIENTRY',
446
+ // Common cross-ecosystem inline/attribute hints
447
+ 'ALWAYS_INLINE', 'FORCE_INLINE', 'NOINLINE',
448
+ ];
449
+ // One alternation, longest token first so a longer macro wins over a prefix.
450
+ const CPP_INLINE_MACRO_RE = new RegExp(`\\b(${[...CPP_INLINE_MACROS].sort((a, b) => b.length - a.length).join('|')})\\b(?=\\s+[A-Za-z_])`, 'g');
451
+ function blankCppInlineMacros(source) {
452
+ if (!CPP_INLINE_MACROS.some((m) => source.indexOf(m) !== -1))
453
+ return source;
454
+ return source.replace(CPP_INLINE_MACRO_RE, (m) => ' '.repeat(m.length));
455
+ }
456
+ // Bare C/C++ type/qualifier tokens that must never be taken as a recovered
457
+ // function name (guards `recoverMangledCppName` against the `Ret (name)` idiom,
458
+ // where the token before the params is the return type, not the name).
459
+ const CPP_PRIMITIVE_NAMES = new Set([
460
+ 'bool', 'void', 'int', 'char', 'short', 'long', 'float', 'double', 'unsigned',
461
+ 'signed', 'wchar_t', 'char8_t', 'char16_t', 'char32_t', 'char_t', 'size_t',
462
+ 'auto', 'const', 'struct', 'class', 'enum', 'union', 'typename',
463
+ ]);
464
+ /**
465
+ * Universal fallback (any macro, no list) for a C/C++ function name still mangled
466
+ * because a macro we don't blank sat in front of the return type: `MACRO Ret
467
+ * name(…)` / `Ret MACRO name(…)` misparse so the return type is glued onto the
468
+ * name ("Ret name", "char_t* to_str(double v)"). Recover the real identifier —
469
+ * the token immediately before the parameter list (or the last token). This runs
470
+ * AFTER the curated pre-parse blank, so it only ever sees the residual tail that
471
+ * blanking didn't already fix cleanly (which also recovers the return type).
472
+ *
473
+ * Safe by construction: only touches an ALREADY-mangled name — one with an
474
+ * internal space that isn't a legit `operator …`/destructor — so a well-formed
475
+ * name is returned unchanged. Guarded against the two ways it could mis-pick:
476
+ * the `Ret (name)` parenthesized-name idiom (left as-is, ambiguous), and a token
477
+ * that is a bare primitive/keyword rather than a real identifier.
478
+ */
479
+ function recoverMangledCppName(name) {
480
+ if (!/\s/.test(name) || name.startsWith('operator') || name.startsWith('~'))
481
+ return name;
482
+ if (/^\S+\s+\([A-Za-z_]\w*\)/.test(name))
483
+ return name; // `Ret (name)` idiom — leave alone
484
+ const beforeParams = name.includes('(') ? name.slice(0, name.indexOf('(')) : name;
485
+ const tokens = beforeParams.trim().split(/\s+/);
486
+ const candidate = tokens[tokens.length - 1];
487
+ if (!candidate || !/^[A-Za-z_]\w*$/.test(candidate) || CPP_PRIMITIVE_NAMES.has(candidate))
488
+ return name;
489
+ return candidate;
490
+ }
491
+ /**
492
+ * Blank Metal Shading Language `[[attribute]]` annotations before parsing.
493
+ * MSL (≈ C++14) puts attributes AFTER the declarator — `float4 position
494
+ * [[position]];`, `constant Uniforms &u [[buffer(0)]]` — a position
495
+ * tree-sitter-cpp can't reconcile: a struct field with a trailing attribute
496
+ * misparses into a shape that emits a spurious `extends` reference from the
497
+ * struct to the field's *type* (`VertexIn extends float3`), which becomes a
498
+ * wrong inheritance edge whenever the repo defines that type itself (simd
499
+ * typedefs in a shared ShaderTypes.h are common). Replacing the attribute with
500
+ * equal-length spaces preserves every byte offset and lets fields and
501
+ * parameters parse as ordinary declarations, mirroring the macro blanks above.
502
+ *
503
+ * Matched tightly to the attribute shape — `[[ident]]`, `[[ident(args)]]`, and
504
+ * comma-separated lists (`[[buffer(0), raster_order_group(0)]]`) — so a
505
+ * subscripted lambda call (`arr[[]{ … }()]`, the only other way `[[` appears in
506
+ * C++-family source) can never match: after `[[` a lambda continues with `]`,
507
+ * never an identifier followed by `]]`. Applied ONLY to `.metal` files — in
508
+ * regular C++ the pre-declarator attribute position (`[[nodiscard]] int f()`)
509
+ * is legal syntax the grammar parses natively, and blanking it would be pure
510
+ * blast radius. (#1121)
511
+ */
512
+ const METAL_ATTRIBUTE_RE = /\[\[\s*[A-Za-z_]\w*(?:\s*\([^()\n]*\))?(?:\s*,\s*[A-Za-z_]\w*(?:\s*\([^()\n]*\))?)*\s*\]\]/g;
513
+ function blankMetalAttributes(source) {
514
+ if (source.indexOf('[[') === -1)
515
+ return source;
516
+ return source.replace(METAL_ATTRIBUTE_RE, (m) => ' '.repeat(m.length));
517
+ }
518
+ /**
519
+ * Hide C++ raw literals from the offset-preserving preParse scans (#1505).
520
+ * Neither macro-shaped text in a raw body nor its `)delim"` closer is code.
521
+ * Mask the whole literal with non-whitespace, non-paren tokens, keeping line
522
+ * endings, so even line-based scanners treat a multiline raw argument as opaque.
523
+ * Restore untouched bytes afterward; a real enclosing annotation can still be
524
+ * removed in full. The pipeline masks once, and individual paren blankers also
525
+ * use this helper so they are safe when called directly.
526
+ */
527
+ function maskCppRawStrings(source) {
528
+ const unchanged = { source, restore: (blanked) => blanked };
529
+ if (source.indexOf('R"') === -1)
530
+ return unchanged;
531
+ // Skip comments and ordinary literals before looking for a raw opener. The
532
+ // char-literal boundary leaves numeric digit separators (1'000) alone.
533
+ const re = /\/\/[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$)|\b(?:u8|[LuU])?R"([^ \t\v\f\r\n()\\]{0,16})\(|"(?:\\[\s\S]|[^"\\])*(?:"|$)|(?<!\w)(?:u8|[LuU])?'(?:\\[\s\S]|[^'\\])*(?:'|$)/g;
534
+ const spans = [];
535
+ const parts = [];
536
+ let last = 0;
537
+ let m;
538
+ while ((m = re.exec(source)) !== null) {
539
+ if (m[1] === undefined)
540
+ continue;
541
+ const closer = `)${m[1]}"`;
542
+ const close = source.indexOf(closer, re.lastIndex);
543
+ // An unterminated raw literal owns the rest of the file too.
544
+ const end = close < 0 ? source.length : close + closer.length;
545
+ spans.push({ start: m.index, end });
546
+ parts.push(source.slice(last, m.index), source.slice(m.index, end).replace(/[^\r\n]/g, '\0'));
547
+ last = re.lastIndex = end;
548
+ }
549
+ if (spans.length === 0)
550
+ return unchanged;
551
+ parts.push(source.slice(last));
552
+ const masked = parts.join('');
553
+ return {
554
+ source: masked,
555
+ restore(blanked) {
556
+ // A length-changing rewrite cannot be restored at the original offsets.
557
+ if (blanked === masked || blanked.length !== source.length)
558
+ return source;
559
+ const chars = blanked.split('');
560
+ for (const { start, end } of spans) {
561
+ for (let i = start; i < end; i++) {
562
+ if (chars[i] === '\0')
563
+ chars[i] = source[i];
564
+ }
565
+ }
566
+ return chars.join('');
567
+ },
568
+ };
569
+ }
570
+ /**
571
+ * Blank annotation-style macro invocations that decorate a declaration but carry
572
+ * NO terminating semicolon — the pervasive Unreal-Engine reflection markup
573
+ * (`UPROPERTY(...)`, `UFUNCTION(...)`, `UCLASS(...)`, `GENERATED_BODY()`,
574
+ * `UE_DEPRECATED_FORGAME(...)`, `DECLARE_DELEGATE_*(...)`, …) that sits on its
575
+ * own line right before a member/type. tree-sitter's C++ grammar doesn't know
576
+ * these are macros, so each one drops into error recovery; in a big reflected
577
+ * class (`CharacterMovementComponent.h` has ~240 of them) the errors accumulate
578
+ * until the enclosing `class_specifier` can't close and collapses into an ERROR
579
+ * node — the whole class definition, its members, and its `extends` edges vanish
580
+ * from the graph. Neither `blankCppExportMacros` (class-header export macros) nor
581
+ * `blankCppInlineMacros` (return-type inline specifiers) touches these in-body
582
+ * markup macros. Replacing each with equal-length spaces preserves every byte
583
+ * offset (so line/column stay exact) and the class then parses normally.
584
+ *
585
+ * Deliberately name-list-FREE — UE alone has hundreds of such macros and projects
586
+ * add their own — so it keys on structure, not a curated list, matched tightly to
587
+ * avoid touching legitimate C++:
588
+ * - the macro must be the FIRST non-whitespace token on its line (`^[ \t]*`),
589
+ * which is where declaration markup lives — so a macro used inside an
590
+ * expression or condition (`if (CHECK(x))`, `x = MACRO(a) + b`) is never
591
+ * matched (it isn't line-leading);
592
+ * - the name must be ALL-CAPS (`[A-Z][A-Z0-9_]{2,}`), since ordinary
593
+ * function/type names called at line start are lower/mixed case;
594
+ * - the char after the balanced `(...)` must START A DECLARATION — a letter,
595
+ * `_`, `~` (destructor), or `#` (a following directive). Declaration markup is
596
+ * always followed by the thing it decorates (`UPROPERTY(...)\n float X;`,
597
+ * `UE_DEPRECATED(...) UPROPERTY(...)`), whereas a statement call is followed by
598
+ * `;` (`FOO(x);`), an init-list item by `,`/`{`, and an expression fragment by
599
+ * an operator (`MAKE(a) + 1`) — all rejected. String/char literals inside the
600
+ * args are skipped so an embedded `)` can't mis-close the balance.
601
+ *
602
+ * C++-only (wired into cppExtractor). A blanked macro inside a block comment is
603
+ * harmless (comments don't parse), and the rare line-leading no-semicolon
604
+ * ALL-CAPS call that isn't markup only loses that one annotation, never a whole
605
+ * class.
606
+ */
607
+ function blankCppAnnotationMacroCalls(source) {
608
+ if (!/^[ \t]*[A-Z][A-Z0-9_]{2,}\s*\(/m.test(source))
609
+ return source;
610
+ const rawStrings = maskCppRawStrings(source);
611
+ source = rawStrings.source;
612
+ const chars = source.split('');
613
+ const re = /^([ \t]*)([A-Z][A-Z0-9_]{2,})(\s*)\(/gm;
614
+ let m;
615
+ while ((m = re.exec(source)) !== null) {
616
+ const macroStart = m.index + (m[1] ?? '').length; // skip leading indent
617
+ let i = m.index + m[0].length - 1; // index of the opening '('
618
+ let depth = 0;
619
+ let end = -1;
620
+ for (; i < source.length; i++) {
621
+ const c = source[i];
622
+ if (c === '"' || c === "'") {
623
+ const quote = c;
624
+ i++;
625
+ while (i < source.length && source[i] !== quote) {
626
+ if (source[i] === '\\')
627
+ i++;
628
+ i++;
629
+ }
630
+ continue;
631
+ }
632
+ if (c === '(')
633
+ depth++;
634
+ else if (c === ')') {
635
+ depth--;
636
+ if (depth === 0) {
637
+ end = i + 1;
638
+ break;
639
+ }
640
+ }
641
+ }
642
+ if (end < 0)
643
+ continue;
644
+ let j = end;
645
+ while (j < source.length && /\s/.test(source[j]))
646
+ j++;
647
+ const after = source[j];
648
+ // Only markup is followed by the declaration it decorates; a statement call
649
+ // (`;`), init-list item (`,`/`{`), or expression fragment (operator) is not.
650
+ if (!after || !/[A-Za-z_~#]/.test(after))
651
+ continue;
652
+ for (let k = macroStart; k < end; k++) {
653
+ if (chars[k] !== '\n' && chars[k] !== '\r')
654
+ chars[k] = ' ';
655
+ }
656
+ re.lastIndex = end;
657
+ }
658
+ return rawStrings.restore(chars.join(''));
659
+ }
660
+ /**
661
+ * Blank a macro that is the ONLY token on its line — no parens, no semicolon:
662
+ * namespace-management macros (`FMT_BEGIN_NAMESPACE`, `FMT_END_EXPORT`,
663
+ * `JEMALLOC_DIAGNOSTIC_DISABLE_SPURIOUS`), Qt's `Q_OBJECT`, and friends. A
664
+ * bare identifier is not a statement or declaration in C or C++, so
665
+ * tree-sitter drops into error recovery at every one — and since the kernel
666
+ * path defers ANY erroring file to wasm, this single idiom deferred 13/73 fmt
667
+ * files and a comparable share of jemalloc, forfeiting the native-parse win
668
+ * on exactly the header-heavy trees it targets (the wasm path also mis-nests
669
+ * scopes around them today). Replacing the token with equal-length spaces
670
+ * preserves every byte offset and the surrounding declarations parse clean.
671
+ *
672
+ * Matched tightly so a real identifier can never be touched — ALL of:
673
+ * - the line consists of ONE ALL-CAPS token (≥4 chars, with `_`), optionally
674
+ * followed by a same-line comment — a lone lowercase identifier or any
675
+ * second token disqualifies;
676
+ * - the PREVIOUS non-blank line does not end in a continuation character
677
+ * (`=`, an operator, `,`, `(`, `?`, `:`, or a `\` macro-definition
678
+ * continuation) — so an ALL-CAPS operand split onto its own line inside a
679
+ * multi-line expression (`int x =\n SOME_CONST\n | OTHER;`) is left
680
+ * alone; and
681
+ * - the NEXT non-blank line starts like a declaration/scope token
682
+ * (letter, `_`, `#`, `{`, `}`, or `~`) or the file ends — an operator,
683
+ * string literal, or `;` continuation rejects the match.
684
+ * Shared by C and C++ (the idiom is identical in both).
685
+ */
686
+ const LONE_MACRO_LINE_RE = /^[ \t]*([A-Z][A-Z0-9_]{3,})[ \t]*(?:\/\/[^\n\r]*|\/\*[^\n\r]*\*\/[ \t]*)?\r?$/;
687
+ const LONE_MACRO_CONTINUATION_END_RE = /[=+\-*/%&|^<>?:,(\\]$/;
688
+ function blankLoneMacroLines(source) {
689
+ if (!/^[ \t]*[A-Z][A-Z0-9_]{3,}[ \t]*\r?$/m.test(source))
690
+ return source;
691
+ const lines = source.split('\n');
692
+ const content = (l) => l.replace(/\r$/, '').trim();
693
+ let changed = false;
694
+ for (let i = 0; i < lines.length; i++) {
695
+ const line = lines[i];
696
+ const m = LONE_MACRO_LINE_RE.exec(line);
697
+ if (!m)
698
+ continue;
699
+ // Underscore requirement rides the macro convention (FMT_BEGIN_NAMESPACE,
700
+ // Q_OBJECT); a solid all-caps word (`NDEBUG`-style) alone is too risky.
701
+ if (!m[1].includes('_'))
702
+ continue;
703
+ let prev = i - 1;
704
+ while (prev >= 0 && content(lines[prev]) === '')
705
+ prev--;
706
+ if (prev >= 0 && LONE_MACRO_CONTINUATION_END_RE.test(content(lines[prev])))
707
+ continue;
708
+ let next = i + 1;
709
+ while (next < lines.length && content(lines[next]) === '')
710
+ next++;
711
+ if (next < lines.length) {
712
+ const first = content(lines[next])[0];
713
+ if (!first || !/[A-Za-z_#{}~]/.test(first))
714
+ continue;
715
+ }
716
+ const start = line.indexOf(m[1]);
717
+ lines[i] =
718
+ line.slice(0, start) + ' '.repeat(m[1].length) + line.slice(start + m[1].length);
719
+ changed = true;
720
+ }
721
+ return changed ? lines.join('\n') : source;
722
+ }
723
+ /**
724
+ * Blank an export/visibility macro sitting in front of a *member* or *method*
725
+ * declaration inside a class/namespace (`ENGINE_API virtual void Tick(…)`,
726
+ * `static ENGINE_API void AddReferencedObjects(…)`, `UE_API FVector GetVel()
727
+ * const`), before parsing. `blankCppExportMacros` only recovers the macro in a
728
+ * `class MACRO Name` *header*; the very same macro also prefixes almost every
729
+ * exported member of a big Unreal-Engine class, and tree-sitter — not knowing
730
+ * it's a macro — reads `MACRO <return-type> <name>(` as an extra type token and
731
+ * drops each such declaration into error recovery. In a heavily-exported header
732
+ * (`Actor.h`, `World.h`, …) hundreds of these accumulate: the return types pile
733
+ * up as orphan ERROR tokens and, combined with other markup, can still tip the
734
+ * enclosing class into collapse. Replacing the macro with equal-length spaces
735
+ * preserves every byte offset (line/column stay exact) and each member parses
736
+ * as an ordinary declaration.
737
+ *
738
+ * Matched tightly so it can't touch the same token used as a value
739
+ * (`int x = SOME_API;`, `if (mode == FOO_API)`): the token must be ALL-CAPS AND
740
+ * end in the conventional visibility-macro suffix `_API` / `_EXPORT` / `_ABI`
741
+ * (Unreal `*_API`, Qt/Boost `*_EXPORT`, LLVM `*_ABI`) — ordinary identifiers
742
+ * effectively never carry these suffixes — and must be immediately followed by
743
+ * whitespace then a declaration token (`\s+[A-Za-z_]`: a type, `virtual`,
744
+ * `static`, or the name). A value use is instead followed by `;`, `)`, `,`,
745
+ * `=`, `::`, or an operator, all of which fail the look-ahead. C++-only (wired
746
+ * into cppExtractor).
747
+ */
748
+ const CPP_API_PREFIX_RE = /\b[A-Z][A-Z0-9_]*(?:_API|_EXPORT|_ABI)\b(?=\s+[A-Za-z_])/g;
749
+ function blankCppApiPrefixMacros(source) {
750
+ if (!/_(?:API|EXPORT|ABI)\b/.test(source))
751
+ return source;
752
+ return source.replace(CPP_API_PREFIX_RE, (m) => ' '.repeat(m.length));
753
+ }
754
+ /**
755
+ * Blank an Unreal-Engine annotation macro that appears MID-LINE (not
756
+ * line-leading, so `blankCppAnnotationMacroCalls` never sees it) inside a
757
+ * declaration: an enum value's `UMETA(DisplayName="…")`, a parameter's
758
+ * `UPARAM(ref)`, or a deprecation tag wedged into a `using`/member declaration
759
+ * (`using FOnNetTick UE_DEPRECATED(5.5, "…") = TMulticastDelegate<void(float)>;`
760
+ * in `World.h`, which otherwise collapses `UWorld`). tree-sitter can't reconcile
761
+ * these embedded macro calls and drops into error recovery, and a mid-line one
762
+ * inside a big enum or a class-scope `using` can cascade into the whole enum /
763
+ * class being lost. Replacing the entire `MACRO(...)` (balanced parens, string
764
+ * literals skipped so an embedded `)` can't mis-close) with equal-length spaces
765
+ * preserves every byte offset and the declaration parses normally.
766
+ *
767
+ * Keyed on an explicit UE-only name list (`UMETA`, `UPARAM`, and the
768
+ * `UE_DEPRECATED*` family) — these identifiers are exclusive to Unreal's
769
+ * reflection layer and appear in no standard-C++ or other-library code, so
770
+ * blanking them is zero-risk to non-UE sources. (The line-LEADING forms of
771
+ * `UE_DEPRECATED(...)` are already handled by `blankCppAnnotationMacroCalls`;
772
+ * this covers the mid-line forms it structurally can't.) C++-only.
773
+ */
774
+ const CPP_INLINE_ANNOTATION_RE = /\b(?:UMETA|UPARAM|UE_DEPRECATED\w*)\s*\(/g;
775
+ function blankCppInlineAnnotationMacros(source) {
776
+ if (!/\b(?:UMETA|UPARAM|UE_DEPRECATED)/.test(source))
777
+ return source;
778
+ const rawStrings = maskCppRawStrings(source);
779
+ source = rawStrings.source;
780
+ const chars = source.split('');
781
+ const re = new RegExp(CPP_INLINE_ANNOTATION_RE.source, 'g');
782
+ let m;
783
+ while ((m = re.exec(source)) !== null) {
784
+ let i = m.index + m[0].length - 1; // index of the opening '('
785
+ let depth = 0;
786
+ let end = -1;
787
+ for (; i < source.length; i++) {
788
+ const c = source[i];
789
+ if (c === '"' || c === "'") {
790
+ const quote = c;
791
+ i++;
792
+ while (i < source.length && source[i] !== quote) {
793
+ if (source[i] === '\\')
794
+ i++;
795
+ i++;
796
+ }
797
+ continue;
798
+ }
799
+ if (c === '(')
800
+ depth++;
801
+ else if (c === ')') {
802
+ depth--;
803
+ if (depth === 0) {
804
+ end = i + 1;
805
+ break;
806
+ }
807
+ }
808
+ }
809
+ if (end < 0)
810
+ continue;
811
+ for (let k = m.index; k < end; k++) {
812
+ if (chars[k] !== '\n' && chars[k] !== '\r')
813
+ chars[k] = ' ';
814
+ }
815
+ re.lastIndex = end;
816
+ }
817
+ return rawStrings.restore(chars.join(''));
818
+ }
819
+ /**
820
+ * Blank CUDA-specific constructs before parsing `.cu`/`.cuh` files (parsed with
821
+ * the C++ grammar). Three shapes tree-sitter-cpp can't reconcile, each replaced
822
+ * with equal-length whitespace so every byte offset survives (#387):
823
+ *
824
+ * 1. Execution-space / storage specifiers: in `__global__ void step(…)` or
825
+ * `__shared__ float tile[256]` the specifier parses as the declaration's
826
+ * TYPE and shunts the real return/value type into an ERROR node — mangling
827
+ * signatures and, for `__shared__` arrays, the declared name itself. Blanked
828
+ * unconditionally (no following-token lookahead) so extended lambdas
829
+ * (`[=] __device__ (int i) { … }`) recover too. `__restrict__` is deliberately
830
+ * absent: the grammar already parses it natively as a type_qualifier.
831
+ * 2. `__launch_bounds__(…)` between specifier and declarator — same misparse.
832
+ * The parenthesized form is blanked first; a bare leftover token is caught
833
+ * by the specifier list.
834
+ * 3. Kernel-launch configs `step<<<grid, block, smem, stream>>>(args)`: the
835
+ * chevrons lex as shift operators around an empty-named template, so no
836
+ * call_expression exists and the host→kernel call edge — the main reason to
837
+ * index CUDA at all — is lost. Blanking the `<<<…>>>` span leaves
838
+ * `step (args)`, a plain call the grammar
839
+ * parses natively (templated launches `k<T, 256><<<…>>>(…)` included).
840
+ *
841
+ * The launch-config match is deliberately bounded — statement/brace characters
842
+ * excluded, span capped, newlines preserved by the replacer — so a stray `<<<`
843
+ * (a committed merge-conflict marker, a string literal) can never blank a run
844
+ * of real code: an unmatched launch degrades to the status quo for that call
845
+ * site (no call edge), never to corruption. Applied to `.cu`/`.cuh` files and —
846
+ * because much real CUDA lives in extension-less headers (cutlass launches the
847
+ * majority of its kernels from `.h`; flash-attention's launch templates are
848
+ * `.h`; llm.c keeps device helpers in C-detected `.h`) — to any C/C++-family
849
+ * file whose CONTENT carries a strong CUDA marker (`looksLikeCudaSource`).
850
+ * Unlike Metal's `[[attribute]]` (legal C++ syntax elsewhere, hence Metal's
851
+ * strict extension gate), no CUDA marker is valid C++ anywhere: `<<<` isn't
852
+ * legal syntax and the dunder specifiers are implementation-reserved names no
853
+ * real codebase defines — so a content-triggered blank on a non-CUDA file can
854
+ * only ever whitespace tokens inside comments or strings, which parse the same.
855
+ */
856
+ const CUDA_LAUNCH_BOUNDS_RE = /\b__launch_bounds__\s*\([^()\n]*\)/g;
857
+ const CUDA_SPECIFIER_RE = /\b__(?:global|device|host|constant|shared|managed|grid_constant|forceinline|noinline|launch_bounds)__\b/g;
858
+ // `;` stays excluded (launch configs are expressions; a stray `<<<` spanning
859
+ // real statements always crosses one) and the span is capped. Braces are
860
+ // allowed through the regex — `k<<<dim3{1,1,1}, dim3{256,1,1}>>>(…)` is a real
861
+ // launch shape — but the replacer only blanks a BALANCED match: a merge
862
+ // conflict's `<<<<<<< … >>>>>>>` region that dodges every `;` still opens
863
+ // braces it never closes, so it fails the balance check and stays untouched.
864
+ const CUDA_LAUNCH_CONFIG_RE = /<<<[^;]{0,400}?>>>/g;
865
+ function blankCudaConstructs(source) {
866
+ let out = source;
867
+ if (out.indexOf('__') !== -1) {
868
+ out = out
869
+ .replace(CUDA_LAUNCH_BOUNDS_RE, (m) => ' '.repeat(m.length))
870
+ .replace(CUDA_SPECIFIER_RE, (m) => ' '.repeat(m.length));
871
+ }
872
+ if (out.indexOf('<<<') !== -1) {
873
+ out = out.replace(CUDA_LAUNCH_CONFIG_RE, (m) => {
874
+ let depth = 0;
875
+ for (let i = 0; i < m.length; i++) {
876
+ const ch = m.charCodeAt(i);
877
+ if (ch === 0x7b /* { */)
878
+ depth++;
879
+ else if (ch === 0x7d /* } */ && --depth < 0)
880
+ return m;
881
+ }
882
+ return depth === 0 ? m.replace(/[^\n]/g, ' ') : m;
883
+ });
884
+ }
885
+ return out;
886
+ }
887
+ /** Strong content markers for CUDA source in files without a CUDA extension
888
+ * (headers). The dunders are execution-space specifiers that only nvcc defines;
889
+ * `cudaStream_t` is the runtime's stream handle, pervasive in launcher headers
890
+ * that themselves declare no kernel. Deliberately excludes weak markers (`dim3`,
891
+ * `<<<`) that could plausibly appear in non-CUDA text. */
892
+ function looksLikeCudaSource(source) {
893
+ return (source.indexOf('__global__') !== -1 ||
894
+ source.indexOf('__device__') !== -1 ||
895
+ source.indexOf('__constant__') !== -1 ||
896
+ source.indexOf('cudaStream_t') !== -1);
897
+ }
898
+ /**
899
+ * Restore preprocessor-directive lines to their original bytes after the
900
+ * blanking passes ran. The token-level blanks match on shape, not context, so
901
+ * a macro name that happens to sit inside a DIRECTIVE gets blanked too — and
902
+ * blanking the name position of `#define FMT_API FMT_VISIBILITY("default")`
903
+ * leaves a nameless `# define FMT_VISIBILITY(…)`, which is a parse
904
+ * ERROR (fmt's base.h carries several). Inside a directive the blanks were
905
+ * never useful anyway: tree-sitter stores `#define` bodies as raw
906
+ * preproc_arg text it doesn't parse, so blanking there can only ever break
907
+ * the directive itself. Copying the original directive lines back (including
908
+ * `\`-continuation lines of multi-line defines) is offset-preserving by
909
+ * construction and strictly reduces parse errors on both extraction arms.
910
+ */
911
+ function restoreDirectiveLines(original, blanked) {
912
+ if (blanked === original || original.indexOf('#') === -1)
913
+ return blanked;
914
+ const o = original.split('\n');
915
+ const b = blanked.split('\n');
916
+ let changed = false;
917
+ let continuation = false;
918
+ for (let i = 0; i < o.length && i < b.length; i++) {
919
+ const line = o[i];
920
+ const isDirective = continuation || /^[ \t]*#/.test(line);
921
+ if (isDirective && b[i] !== line) {
922
+ b[i] = line;
923
+ changed = true;
924
+ }
925
+ continuation = isDirective && /\\\s*$/.test(line.replace(/\r$/, ''));
926
+ }
927
+ return changed ? b.join('\n') : blanked;
928
+ }
929
+ /** C/C++ source pre-processing before tree-sitter: recover macro-annotated class
930
+ * definitions, macro-prefixed function definitions, macro-prefixed members, and
931
+ * macro-decorated members (Unreal-Engine reflection markup) — plus the non-C++
932
+ * surface of the dialects parsed with the C++ grammar: `.metal` MSL attribute
933
+ * annotations, and CUDA specifiers + launch syntax (by `.cu`/`.cuh` extension
934
+ * or by content, for CUDA living in `.h`/`.hpp` headers). Offset-preserving;
935
+ * directive lines are restored at the end (see restoreDirectiveLines). */
936
+ function preParseCppSource(source, filePath) {
937
+ const rawStrings = maskCppRawStrings(source);
938
+ source = rawStrings.source;
939
+ // blankCLeadingAttrMacros runs AFTER the api-prefix blank so a stacked
940
+ // `FMT_NORETURN FMT_API void f(…)` reduces to the `MACRO Ret name(` shape
941
+ // it matches (the _API token is already spaces by then).
942
+ let blanked = blankLoneMacroLines(blankCLeadingAttrMacros(blankCppAnnotationMacroCalls(blankCppInlineAnnotationMacros(blankCppApiPrefixMacros(blankCppInlineMacros(blankCppExportMacros(source)))))));
943
+ const lower = filePath ? filePath.toLowerCase() : '';
944
+ if (lower.endsWith('.metal')) {
945
+ blanked = blankMetalAttributes(blanked);
946
+ }
947
+ else if (lower.endsWith('.cu') || lower.endsWith('.cuh') || looksLikeCudaSource(source)) {
948
+ blanked = blankCudaConstructs(blanked);
949
+ }
950
+ return rawStrings.restore(restoreDirectiveLines(source, blanked));
951
+ }
952
+ /**
953
+ * Blank an unknown attribute macro sitting in front of a C function
954
+ * definition's return type: `SEC_ATTR UINT32 LostName(VOID) { … }` (macro
955
+ * wrapping `__attribute__((…))`, common in embedded/kernel C). tree-sitter's
956
+ * C grammar reads the macro as the declaration's type, the real return type
957
+ * as the declarator, and stores the PARAMETER LIST as the function name —
958
+ * `LostName` indexes as `"(VOID)"` and is unfindable (#1211). The C++ grammar
959
+ * recovers this shape differently (glued name, salvaged post-hoc by
960
+ * `recoverMangledCppName`), but in C the real name never reaches the mangled
961
+ * string, so only a pre-parse blank can recover it.
962
+ *
963
+ * Attribute macros are project-specific (`SEC_ATTR`, `INIT_TEXT`, …), so this
964
+ * keys on structure, not a curated list, matched tightly:
965
+ * - line-leading (`^[ \t]*`) — declaration position, never an expression use;
966
+ * - ALL-CAPS token of ≥3 chars (`[A-Z][A-Z0-9_]{2,}`) — ordinary C types in
967
+ * definitions are rarely spelled this way, and when they are (`UINT32 f()`)
968
+ * they're followed by ONE identifier + `(`, which the lookahead rejects;
969
+ * - followed by TWO identifier tokens (return type, then name — `*` allowed
970
+ * for pointer returns) and then `(` — i.e. exactly the
971
+ * `MACRO Ret name(` definition shape. `MACRO name(` calls, `#define`
972
+ * lines (start with `#`), and multi-word builtin returns
973
+ * (`MACRO unsigned int f(` — where the C grammar already keeps the name)
974
+ * are all left untouched.
975
+ * Equal-length spaces preserve every byte offset, like the C++ blanks above.
976
+ */
977
+ const C_LEADING_ATTR_MACRO_RE = /^([ \t]*)([A-Z][A-Z0-9_]{2,})(?=\s+[A-Za-z_]\w*[\s*]+[A-Za-z_]\w*\s*\()/gm;
978
+ function blankCLeadingAttrMacros(source) {
979
+ return source.replace(C_LEADING_ATTR_MACRO_RE, (_m, ws, macro) => ws + ' '.repeat(macro.length));
980
+ }
981
+ /**
982
+ * Blank the body of `#ifdef __cplusplus … #endif` guard regions in C sources.
983
+ * The ubiquitous C-header compatibility idiom
984
+ *
985
+ * #ifdef __cplusplus
986
+ * extern "C" {
987
+ * #endif
988
+ *
989
+ * is NOT valid C — `extern "C" {` (and any other C++-only line under the
990
+ * guard) drops tree-sitter-c into error recovery, so effectively every public
991
+ * C header carries parse errors. The wasm path shrugs (recovery keeps the
992
+ * rest); the kernel path defers EVERY erroring file to wasm by policy — so
993
+ * this one idiom pushed C-header deferral to ~32% on redis (vs the <10%
994
+ * gate) and forfeited the native-parse win exactly where C repos have the
995
+ * most files. A C compiler never sees the guarded lines (`__cplusplus` is
996
+ * only defined for C++), so blanking the region BODY mirrors the
997
+ * preprocessor's own view of the file.
998
+ *
999
+ * Matched conservatively, line-based and offset-preserving:
1000
+ * - the opener must be `#ifdef __cplusplus` / `#if defined(__cplusplus)`;
1001
+ * - the body may contain NO other preprocessor directive (a nested `#if`,
1002
+ * `#else`, or `#define` bails the whole region — those need real
1003
+ * preprocessing, so the file keeps its current behavior);
1004
+ * - the region must close with `#endif` within a few lines (guards are
1005
+ * tiny; a giant region is something else).
1006
+ * The `#ifdef`/`#endif` directive lines themselves are kept — an empty
1007
+ * preproc_ifdef parses clean — and every blanked byte becomes a space with
1008
+ * `\r` preserved, so offsets, lines, and columns survive on CRLF checkouts.
1009
+ */
1010
+ const C_CPLUSPLUS_GUARD_OPEN_RE = /^[ \t]*#[ \t]*(?:ifdef[ \t]+__cplusplus\b|if[ \t]+defined[ \t]*\(?[ \t]*__cplusplus[ \t]*\)?)/;
1011
+ const C_PREPROC_DIRECTIVE_RE = /^[ \t]*#/;
1012
+ const C_PREPROC_ENDIF_RE = /^[ \t]*#[ \t]*endif\b/;
1013
+ const C_CPLUSPLUS_GUARD_MAX_BODY_LINES = 40;
1014
+ function blankCCplusplusGuardBodies(source) {
1015
+ if (source.indexOf('__cplusplus') === -1)
1016
+ return source;
1017
+ const lines = source.split('\n');
1018
+ const stripCr = (l) => (l.endsWith('\r') ? l.slice(0, -1) : l);
1019
+ let changed = false;
1020
+ for (let i = 0; i < lines.length; i++) {
1021
+ if (!C_CPLUSPLUS_GUARD_OPEN_RE.test(stripCr(lines[i])))
1022
+ continue;
1023
+ let end = -1;
1024
+ for (let j = i + 1; j < lines.length && j - i - 1 <= C_CPLUSPLUS_GUARD_MAX_BODY_LINES; j++) {
1025
+ const line = stripCr(lines[j]);
1026
+ if (C_PREPROC_ENDIF_RE.test(line)) {
1027
+ end = j;
1028
+ break;
1029
+ }
1030
+ if (C_PREPROC_DIRECTIVE_RE.test(line))
1031
+ break; // nested directive — bail
1032
+ }
1033
+ if (end < 0)
1034
+ continue;
1035
+ for (let k = i + 1; k < end; k++) {
1036
+ lines[k] = lines[k].replace(/[^\r]/g, ' ');
1037
+ }
1038
+ changed = true;
1039
+ i = end;
1040
+ }
1041
+ return changed ? lines.join('\n') : source;
1042
+ }
1043
+ /**
1044
+ * Blank a C iterator-macro call in STATEMENT position — `ql_foreach(iter,
1045
+ * &arena->tcache_ql, link) { … }` (jemalloc), `for_each_string_list_item(item,
1046
+ * &list) { … }` (git), `list_for_each_entry(pos, head, member) { … }` (the
1047
+ * Linux kernel's core iteration idiom). A call followed by a brace block is
1048
+ * not a C statement, so tree-sitter-c drops into error recovery at every use —
1049
+ * these macros are the single largest source of parse errors in macro-heavy C
1050
+ * trees (git: ~39% of files error; the kernel path defers each one to wasm).
1051
+ * Blanking JUST the macro call leaves the brace block as a bare compound
1052
+ * statement — valid C — so the body's calls/locals extract normally on both
1053
+ * arms instead of riding error recovery.
1054
+ *
1055
+ * C-ONLY, and matched tightly:
1056
+ * - the call must be INDENTED (statement position; file-scope definitions
1057
+ * start at column 0, and an unbraced file-scope `name(args) { }` is a
1058
+ * valid implicit-int function definition that must not be touched);
1059
+ * - lowercase-led identifier (iterator macros are lowercase by convention;
1060
+ * this also excludes constructors if the file is really C++) that is not a
1061
+ * control keyword;
1062
+ * - the parens balance ON the line (string literals skipped), and after
1063
+ * them only `{` or end-of-line may follow — a `;` (a real call statement),
1064
+ * an operator, or any other token disqualifies;
1065
+ * - when the line ends at `)`, the NEXT non-blank line must begin with `{`.
1066
+ * C++ deliberately does NOT get this pass: an indented snake_case
1067
+ * constructor (`basic_string_view(const Char* s) : … {`) is exactly this
1068
+ * shape, and blanking it would corrupt every STL-style class.
1069
+ */
1070
+ const C_STMT_MACRO_KEYWORDS = new Set([
1071
+ 'if', 'while', 'for', 'switch', 'return', 'do', 'else', 'sizeof',
1072
+ ]);
1073
+ function blankCStatementMacroCalls(source) {
1074
+ const rawStrings = maskCppRawStrings(source);
1075
+ source = rawStrings.source;
1076
+ const lines = source.split('\n');
1077
+ let changed = false;
1078
+ const content = (l) => l.replace(/\r$/, '').trim();
1079
+ for (let i = 0; i < lines.length; i++) {
1080
+ const line = lines[i];
1081
+ const m = /^[ \t]+([a-z_][a-z0-9_]*)[ \t]*\(/.exec(line);
1082
+ if (!m || C_STMT_MACRO_KEYWORDS.has(m[1]))
1083
+ continue;
1084
+ const open = line.indexOf('(', m[0].length - 1);
1085
+ let depth = 0;
1086
+ let close = -1;
1087
+ for (let k = open; k < line.length; k++) {
1088
+ const ch = line[k];
1089
+ if (ch === '"' || ch === "'") {
1090
+ const quote = ch;
1091
+ k++;
1092
+ while (k < line.length && line[k] !== quote) {
1093
+ if (line[k] === '\\')
1094
+ k++;
1095
+ k++;
1096
+ }
1097
+ continue;
1098
+ }
1099
+ if (ch === '(')
1100
+ depth++;
1101
+ else if (ch === ')') {
1102
+ depth--;
1103
+ if (depth === 0) {
1104
+ close = k;
1105
+ break;
1106
+ }
1107
+ }
1108
+ }
1109
+ let endLine = i;
1110
+ if (close < 0) {
1111
+ // Parens don't balance on the head line — the kernel wraps iterator
1112
+ // macros (`hlist_for_each_entry_rcu(p, head, hlist,\n\t\t
1113
+ // lockdep_is_held(&kprobe_mutex)) {`). Continue the same
1114
+ // string-skipping paren scan over a few continuation lines. A `;` or
1115
+ // a brace anywhere in the span means a real statement or compound
1116
+ // literal — bail (missing a blank is safe; corrupting one is not).
1117
+ if (line.indexOf(';') !== -1)
1118
+ continue;
1119
+ for (let j = i + 1; j <= i + 5 && j < lines.length && close < 0; j++) {
1120
+ const cont = lines[j];
1121
+ let bail = false;
1122
+ for (let k = 0; k < cont.length; k++) {
1123
+ const ch = cont[k];
1124
+ if (ch === '"' || ch === "'") {
1125
+ const quote = ch;
1126
+ k++;
1127
+ while (k < cont.length && cont[k] !== quote) {
1128
+ if (cont[k] === '\\')
1129
+ k++;
1130
+ k++;
1131
+ }
1132
+ continue;
1133
+ }
1134
+ if (ch === ';' || ch === '{' || ch === '}') {
1135
+ bail = true;
1136
+ break;
1137
+ }
1138
+ if (ch === '(')
1139
+ depth++;
1140
+ else if (ch === ')') {
1141
+ depth--;
1142
+ if (depth === 0) {
1143
+ close = k;
1144
+ endLine = j;
1145
+ break;
1146
+ }
1147
+ }
1148
+ }
1149
+ if (bail)
1150
+ break;
1151
+ }
1152
+ if (close < 0)
1153
+ continue;
1154
+ }
1155
+ const endLineStr = lines[endLine];
1156
+ const after = endLineStr.slice(close + 1).replace(/\r$/, '').trim();
1157
+ if (after === '') {
1158
+ // Brace on the next line (`ql_foreach(…)\n{`) or a brace-less
1159
+ // single-statement body (`for_each_subsys(ss, i)\n\tstmt;` — blanking
1160
+ // leaves the bare statement, valid C). A next line starting with an
1161
+ // operator/string/`;` is an expression continuation — bail.
1162
+ let next = endLine + 1;
1163
+ while (next < lines.length && content(lines[next]) === '')
1164
+ next++;
1165
+ if (next >= lines.length)
1166
+ continue;
1167
+ const first = content(lines[next])[0];
1168
+ if (!first || !/[A-Za-z_{]/.test(first))
1169
+ continue;
1170
+ }
1171
+ else if (after !== '{') {
1172
+ continue;
1173
+ }
1174
+ const identStart = line.indexOf(m[1]);
1175
+ if (endLine === i) {
1176
+ lines[i] =
1177
+ line.slice(0, identStart) +
1178
+ ' '.repeat(close + 1 - identStart) +
1179
+ line.slice(close + 1);
1180
+ }
1181
+ else {
1182
+ lines[i] = line.slice(0, identStart) + line.slice(identStart).replace(/[^\r]/g, ' ');
1183
+ for (let j = i + 1; j < endLine; j++) {
1184
+ lines[j] = lines[j].replace(/[^\r]/g, ' ');
1185
+ }
1186
+ lines[endLine] =
1187
+ endLineStr.slice(0, close + 1).replace(/[^\r]/g, ' ') + endLineStr.slice(close + 1);
1188
+ i = endLine; // the blanked span can't host another head
1189
+ }
1190
+ changed = true;
1191
+ }
1192
+ return rawStrings.restore(changed ? lines.join('\n') : source);
1193
+ }
1194
+ /**
1195
+ * Blank a lowercase compiler-annotation word SANDWICHED between a storage
1196
+ * class and the rest of a declaration — `static notrace void tick(…)`,
1197
+ * `static nokprobe_inline void arm(…)` (kernel compiler.h markers). The
1198
+ * dunder word-list can't carry these bare-word forms: `notrace` is a
1199
+ * plausible identifier. The sandwich IS the guard — the token counts only
1200
+ * when directly preceded by `static`/`extern`/`inline` AND followed by
1201
+ * another word, a position where it cannot be a variable name (an archaic
1202
+ * implicit-int `static notrace = 1;` fails the following-word requirement).
1203
+ * C-only.
1204
+ */
1205
+ const C_SANDWICHED_ANNOTATIONS = [
1206
+ 'noinline_for_stack', 'nokprobe_inline', 'noinline', 'notrace', 'noinstr',
1207
+ ];
1208
+ const C_SANDWICH_RE = new RegExp(`\\b(static|extern|inline)([ \\t]+)(${C_SANDWICHED_ANNOTATIONS.join('|')})\\b(?=[ \\t]+[A-Za-z_])`, 'g');
1209
+ function blankCSandwichedAnnotations(source) {
1210
+ C_SANDWICH_RE.lastIndex = 0;
1211
+ if (!C_SANDWICH_RE.test(source))
1212
+ return source;
1213
+ C_SANDWICH_RE.lastIndex = 0;
1214
+ return source.replace(C_SANDWICH_RE, (_m, storage, ws, ann) => storage + ws + ' '.repeat(ann.length));
1215
+ }
1216
+ /**
1217
+ * Blank a C23 `auto` type-inference keyword — `auto hb = hbr.hb;` (the
1218
+ * futex code; tree-sitter-c predates C23 auto and errors the enclosing
1219
+ * function). The old storage-class reading (`auto int x = 1;`) has a TYPE
1220
+ * between `auto` and the `=` and is untouched — the match requires
1221
+ * `auto IDENT =` directly, which only the C23 form exhibits. Blanking
1222
+ * leaves a plain assignment statement. C-only.
1223
+ */
1224
+ const C_AUTO_INFER_RE = /\bauto(?=[ \t]+[A-Za-z_]\w*[ \t]*=)/g;
1225
+ function blankCAutoInference(source) {
1226
+ C_AUTO_INFER_RE.lastIndex = 0;
1227
+ if (!C_AUTO_INFER_RE.test(source))
1228
+ return source;
1229
+ C_AUTO_INFER_RE.lastIndex = 0;
1230
+ return source.replace(C_AUTO_INFER_RE, () => ' ');
1231
+ }
1232
+ /**
1233
+ * Blank a trailing parameter-attribute macro — `int argc UNUSED,` /
1234
+ * `struct repository *repo UNUSED)` — git's house style for
1235
+ * `__attribute__((unused))` on nearly every callback parameter (and the same
1236
+ * shape as `MAYBE_UNUSED`/`G_GNUC_UNUSED` elsewhere). tree-sitter-c can't
1237
+ * parse a second identifier after the parameter name, so every such
1238
+ * SIGNATURE drops into error recovery — the single largest deferral bucket
1239
+ * on git (~150 files). Blanking the macro leaves an ordinary parameter.
1240
+ *
1241
+ * Matched tightly: an identifier, whitespace, then an ALL-CAPS ≥3-char token
1242
+ * immediately before `,` or `)`. Two juxtaposed identifiers in that position
1243
+ * have no other valid-C reading — in a CALL the would-be macro is preceded
1244
+ * by `,`/`(`, an operator, or a literal, never by a bare identifier. C-only:
1245
+ * C++ grammars accept more juxtapositions (user-defined suffixes, macro'd
1246
+ * `final`/`override`), so cpp keeps its existing recovery there.
1247
+ */
1248
+ const C_TRAILING_PARAM_ATTR_RE = /\b([A-Za-z_]\w*)([ \t]+)([A-Z][A-Z0-9_]{2,})(?=[ \t]*[,)])/g;
1249
+ function blankCTrailingParamAttrMacros(source) {
1250
+ if (!C_TRAILING_PARAM_ATTR_RE.test(source)) {
1251
+ C_TRAILING_PARAM_ATTR_RE.lastIndex = 0;
1252
+ return source;
1253
+ }
1254
+ C_TRAILING_PARAM_ATTR_RE.lastIndex = 0;
1255
+ return source.replace(C_TRAILING_PARAM_ATTR_RE, (_m, name, ws, macro) => name + ws + ' '.repeat(macro.length));
1256
+ }
1257
+ /**
1258
+ * Blank the Linux-kernel/sparse declaration-annotation macros — `static int
1259
+ * __init audit_init(void)`, `void __user *buf`, `__bpf_kfunc void f(…)`,
1260
+ * `int x __ro_after_init;`. These lowercase double-underscore annotations sit
1261
+ * between storage/type tokens and the declarator, a position tree-sitter-c
1262
+ * can't reconcile, and they blanket the Linux tree: measured on the kernel's
1263
+ * own `kernel/` + `mm/` subtrees, they are the largest single deferral cause
1264
+ * (the `__init` family alone heads ~37% of erroring files).
1265
+ *
1266
+ * A structural match is IMPOSSIBLE here: `__u32 count` (a real typedef) and
1267
+ * `__init foo` (an annotation) are byte-shape identical — so unlike the
1268
+ * shape-keyed blanks above, this is a CURATED list (the CPP_INLINE_MACROS
1269
+ * precedent) of well-known sparse/section/compiler annotations that are
1270
+ * reserved-namespace macros in every codebase that spells them. Whole-word,
1271
+ * equal-length spaces, C-only (the C++ grammar's kernel exposure is
1272
+ * negligible and cpp keeps its narrower blank set).
1273
+ */
1274
+ const C_KERNEL_ANNOTATIONS = [
1275
+ '__init', '__exit', '__initdata', '__initconst', '__exitdata',
1276
+ '__devinit', '__devexit', '__cpuinit', '__meminit', '__meminitdata',
1277
+ '__net_init', '__net_exit', '__net_initdata', '__init_or_module',
1278
+ '__user', '__kernel', '__iomem', '__percpu', '__rcu', '__force', '__nocast',
1279
+ '__must_check', '__maybe_unused', '__always_unused', '__used', '__cold',
1280
+ '__hot', '__weak', '__pure', '__sched', '__malloc', '__visible',
1281
+ '__deprecated', '__ro_after_init', '__read_mostly', '__refdata',
1282
+ '__latent_entropy', '__randomize_layout', '__no_randomize_layout',
1283
+ '__bpf_kfunc', '__function_aligned', '__always_inline', '__noreturn',
1284
+ // Round-2 additions, each measured heading first-error lines on the
1285
+ // v7.2-rc2 kernel/+mm/ census (2026-07-17): cacheline placement, sparse
1286
+ // lock/section markers, and bpf/typecheck annotations. Real dunder TYPES
1287
+ // (`__u32`, `__s64`) and operators (`__alignof__`) are deliberately absent.
1288
+ '__cacheline_aligned_in_smp', '__cacheline_aligned',
1289
+ '__cacheline_internodealigned_in_smp', '____cacheline_aligned_in_smp',
1290
+ '____cacheline_aligned', '____cacheline_internodealigned_in_smp',
1291
+ '__noclone', '__lockfunc', '__ref', '__private', '__bitwise',
1292
+ '__nosavedata', '__no_kcsan', '__cpuidle', '__ksym',
1293
+ '__initdata_memblock', '__initdata_or_meminfo',
1294
+ ];
1295
+ // `(?!\s*\()` keeps the parameterized annotations (`__printf(1, 2)`,
1296
+ // `__aligned(8)`, `__section("x")`) intact — blanking just their name would
1297
+ // strand the argument list as a floating parenthesis and CREATE an error.
1298
+ const C_KERNEL_ANNOTATION_RE = new RegExp(`\\b(${[...C_KERNEL_ANNOTATIONS].sort((a, b) => b.length - a.length).join('|')})\\b(?!\\s*\\()`, 'g');
1299
+ function blankCKernelAnnotations(source) {
1300
+ if (source.indexOf('__') === -1)
1301
+ return source;
1302
+ C_KERNEL_ANNOTATION_RE.lastIndex = 0;
1303
+ if (!C_KERNEL_ANNOTATION_RE.test(source))
1304
+ return source;
1305
+ let out = source.replace(C_KERNEL_ANNOTATION_RE, (m) => ' '.repeat(m.length));
1306
+ // `container_of(ptr, struct T, member)` — the type-keyword argument is the
1307
+ // one call shape tree-sitter-c cannot read (a macro taking a TYPE), and it
1308
+ // is pervasive across the Linux tree. Blanking just the `struct`/`union`
1309
+ // keyword leaves `container_of(ptr, T, member)` — a plain
1310
+ // identifier argument the grammar parses natively. Keyed to the macro name
1311
+ // so no other `struct` keyword anywhere is ever touched.
1312
+ if (out.indexOf('container_of') !== -1) {
1313
+ out = out.replace(/(\bcontainer_of\s*\([^;()]*?,\s*)(struct|union)(\s+)/g, (_m, head, kw, ws) => head + ' '.repeat(kw.length) + ws);
1314
+ }
1315
+ return out;
1316
+ }
1317
+ /**
1318
+ * Blank the PARAMETERIZED sparse/compiler annotations whole — name AND
1319
+ * argument list — `struct file *f __free(fput) = NULL;`, `static void
1320
+ * __printf(4, 0) log_it(…)`, `} owners[] __counted_by(count);`,
1321
+ * `__bpf_md_ptr(struct bpf_iter_meta *, meta);`. The word-list blank above
1322
+ * deliberately skips these via `(?!\s*\()` because blanking just the NAME
1323
+ * strands `(args)` as a floating parenthesis — so every such file kept
1324
+ * deferring (the v7.2-rc2 kernel/+mm/ census puts `__free`/`__printf`/
1325
+ * `__counted_by`/`__aligned` at the head of 39 first-error lines). Blanking
1326
+ * the whole `__name(args)` span leaves an ordinary declaration.
1327
+ *
1328
+ * CURATED for the same reason as the word list: `__aligned(8)` (annotation)
1329
+ * and `__hash(key)` (a real static helper call) are byte-shape identical, so
1330
+ * only reserved-namespace names that are annotations in every codebase that
1331
+ * spells them are listed. One nesting level of parens is allowed
1332
+ * (`__aligned(sizeof(struct x))`); newlines inside the span survive so byte
1333
+ * offsets are preserved. C-only.
1334
+ */
1335
+ const C_PARAMETERIZED_ANNOTATIONS = [
1336
+ '__free', '__printf', '__scanf', '__counted_by', '__counted_by_le',
1337
+ '__counted_by_be', '__guarded_by', '__pt_guarded_by', '__acquires',
1338
+ '__releases', '__must_hold', '__cleanup', '__aligned', '__section',
1339
+ '__bpf_md_ptr', '__assume_aligned',
1340
+ ];
1341
+ const C_PARAM_ANNOTATION_RE = new RegExp(`\\b(${[...C_PARAMETERIZED_ANNOTATIONS].sort((a, b) => b.length - a.length).join('|')})[ \\t]*\\((?:[^()]|\\([^()]*\\))*\\)`, 'g');
1342
+ function blankCParameterizedAnnotationMacros(source) {
1343
+ if (source.indexOf('__') === -1)
1344
+ return source;
1345
+ const rawStrings = maskCppRawStrings(source);
1346
+ source = rawStrings.source;
1347
+ C_PARAM_ANNOTATION_RE.lastIndex = 0;
1348
+ let result = '';
1349
+ let last = 0;
1350
+ let m;
1351
+ while ((m = C_PARAM_ANNOTATION_RE.exec(source)) !== null) {
1352
+ const start = m.index;
1353
+ let end = start + m[0].length;
1354
+ // Field-position form — `__bpf_md_ptr(struct bpf_iter_meta *, meta);` as
1355
+ // the whole line: a lone `;` field is ITSELF a parse error (measured;
1356
+ // an empty struct body is fine), so the semicolon blanks with it. A
1357
+ // mid-line match (`… __free(fput) = NULL;`) keeps its statement tail.
1358
+ const lineStart = source.lastIndexOf('\n', start - 1) + 1;
1359
+ if (/^[ \t]*$/.test(source.slice(lineStart, start))) {
1360
+ const after = /^[ \t]*;/.exec(source.slice(end));
1361
+ if (after)
1362
+ end += after[0].length;
1363
+ }
1364
+ result += source.slice(last, start) + source.slice(start, end).replace(/[^\n\r]/g, ' ');
1365
+ last = end;
1366
+ }
1367
+ return rawStrings.restore(result + source.slice(last));
1368
+ }
1369
+ /**
1370
+ * Blank a bare `struct`/`union`/`enum` TYPE-keyword argument inside a macro
1371
+ * call — `kzalloc_obj(struct bpf_mount_opts)`, `alloc_percpu(struct irqstat)`,
1372
+ * `list_first_entry(&pending,\n\t\tstruct async_entry, domain_list)` — the
1373
+ * `container_of` disease generalized (that blank stays as the keyed
1374
+ * precedent). A bare type is never a valid C expression argument, so
1375
+ * tree-sitter drops into error recovery at every such call; removing just the
1376
+ * keyword leaves a plain identifier argument the grammar parses natively.
1377
+ * This single shape heads ~35 first-error lines on the kernel/+mm/ census
1378
+ * (kzalloc_obj/list_entry/alloc_percpu + multi-line continuations).
1379
+ *
1380
+ * Guarded three ways, because `f(struct T)` has VALID look-alikes:
1381
+ * - head exclusions: `sizeof(struct T)` / `offsetof(struct T, m)` /
1382
+ * `_Generic(x, struct T *: …)` all parse natively (probed) and must keep
1383
+ * their keyword; `va_arg` gets its own dedicated blank below.
1384
+ * - call-vs-declaration: in `int wf(struct a, struct b);` (a wrapped
1385
+ * prototype — valid C) the head is preceded by a TYPE, so any identifier
1386
+ * or `*` before the head rejects the match — except the word `return`,
1387
+ * which precedes real calls. Newline/`=`/`,`/`(`/`;`/`{`/`>` etc. accept.
1388
+ * - the keyword must OPEN a top-level argument and the argument must be
1389
+ * exactly `struct T` (optionally `struct T *`, whose stars blank too —
1390
+ * `DEFINE_PER_CPU(struct task_struct *, ksoftirqd)` leaves two plain
1391
+ * identifier arguments): a cast (`f((struct T *)p)`) opens a nested
1392
+ * group, and a declaration argument (`TP_PROTO(struct foo *bar)`) trails
1393
+ * an extra identifier — neither matches.
1394
+ * A hand-rolled bounded scanner rather than a nested-alternation regex:
1395
+ * preceding args may themselves contain calls
1396
+ * (`hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(&d->h)),\n
1397
+ * struct bpf_dtab_netdev, index_hlist)`), and lazy nested regex groups over
1398
+ * untrusted repo text invite catastrophic backtracking. C-only.
1399
+ */
1400
+ const C_TYPE_ARG_HEAD_EXCLUSIONS = new Set([
1401
+ 'sizeof', 'alignof', '_Alignof', 'typeof', '__typeof__', '__typeof',
1402
+ 'offsetof', '_Generic', 'va_arg', 'if', 'while', 'for', 'switch', 'case',
1403
+ ]);
1404
+ const C_TYPE_ARG_HEAD_RE = /\b([A-Za-z_]\w*)[ \t]*\(/g;
1405
+ const C_TYPE_ARG_OPENER_RE = /^(struct|union|enum)([ \t\r\n]+)([A-Za-z_]\w*)([ \t\r\n]*\*+)?(?=[ \t\r\n]*[,)])/;
1406
+ const C_TYPE_ARG_SCAN_CAP = 600;
1407
+ function blankCTypeKeywordArgs(source) {
1408
+ if (!/\b(?:struct|union|enum)[ \t\r\n]/.test(source))
1409
+ return source;
1410
+ const rawStrings = maskCppRawStrings(source);
1411
+ source = rawStrings.source;
1412
+ let chars = null;
1413
+ C_TYPE_ARG_HEAD_RE.lastIndex = 0;
1414
+ let m;
1415
+ while ((m = C_TYPE_ARG_HEAD_RE.exec(source)) !== null) {
1416
+ const head = m[1];
1417
+ if (C_TYPE_ARG_HEAD_EXCLUSIONS.has(head))
1418
+ continue;
1419
+ // Reject declaration shapes: an identifier or `*` (a return/field type)
1420
+ // immediately before the head — unless that word is `return`.
1421
+ let j = m.index - 1;
1422
+ while (j >= 0 && (source[j] === ' ' || source[j] === '\t'))
1423
+ j--;
1424
+ const prev = j >= 0 ? source[j] : '';
1425
+ if (/[\w*]/.test(prev)) {
1426
+ let w = j;
1427
+ while (w >= 0 && /\w/.test(source[w]))
1428
+ w--;
1429
+ if (source.slice(w + 1, j + 1) !== 'return')
1430
+ continue;
1431
+ }
1432
+ const open = m.index + m[0].length - 1;
1433
+ let depth = 1;
1434
+ let atArgStart = true;
1435
+ for (let k = open + 1; k < source.length && k - open <= C_TYPE_ARG_SCAN_CAP; k++) {
1436
+ const ch = source[k];
1437
+ if (ch === '"' || ch === "'") {
1438
+ const quote = ch;
1439
+ k++;
1440
+ while (k < source.length && source[k] !== quote) {
1441
+ if (source[k] === '\\')
1442
+ k++;
1443
+ k++;
1444
+ }
1445
+ atArgStart = false;
1446
+ continue;
1447
+ }
1448
+ if (ch === ' ' || ch === '\t' || ch === '\n' || ch === '\r')
1449
+ continue;
1450
+ if (ch === '(') {
1451
+ depth++;
1452
+ atArgStart = false;
1453
+ continue;
1454
+ }
1455
+ if (ch === ')') {
1456
+ depth--;
1457
+ if (depth === 0)
1458
+ break;
1459
+ atArgStart = false;
1460
+ continue;
1461
+ }
1462
+ if (ch === ';' || ch === '{' || ch === '}')
1463
+ break; // not an argument list
1464
+ if (ch === ',') {
1465
+ if (depth === 1)
1466
+ atArgStart = true;
1467
+ continue;
1468
+ }
1469
+ if (depth === 1 && atArgStart) {
1470
+ const opener = C_TYPE_ARG_OPENER_RE.exec(source.slice(k, k + 160));
1471
+ if (opener) {
1472
+ chars ??= [...source];
1473
+ const kw = opener[1];
1474
+ for (let b = k; b < k + kw.length; b++)
1475
+ chars[b] = ' ';
1476
+ if (opener[4]) {
1477
+ const tail = opener[4];
1478
+ const stars = /\*+$/.exec(tail)[0].length;
1479
+ const starsStart = k + kw.length + opener[2].length + opener[3].length + (tail.length - stars);
1480
+ for (let b = starsStart; b < starsStart + stars; b++)
1481
+ chars[b] = ' ';
1482
+ }
1483
+ k += opener[0].length - 1;
1484
+ }
1485
+ }
1486
+ atArgStart = false;
1487
+ }
1488
+ }
1489
+ return rawStrings.restore(chars ? chars.join('') : source);
1490
+ }
1491
+ /**
1492
+ * Blank a file-scope `static`/`extern`-prefixed ALL-CAPS declaration macro —
1493
+ * `static DEFINE_PER_CPU(struct llist_head, rstat_backlog_list);`,
1494
+ * `static DECLARE_WORK(init_free_wq, do_free_init);`,
1495
+ * `static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);` — the single
1496
+ * largest deferral family on the kernel/+mm/ census (~45 first-error lines
1497
+ * across the DEFINE_/DECLARE_ variants). A storage-class specifier followed
1498
+ * by a call expression is never valid C, so every one errors; the whole line
1499
+ * blanks to spaces (the macro-declared variable was invisible to extraction
1500
+ * anyway, and the file's remaining symbols recover).
1501
+ *
1502
+ * The UNPREFIXED form (`EXPORT_SYMBOL(x);`, `DEFINE_MUTEX(lock);` at column
1503
+ * 0) parses natively as a K&R implicit-int declaration (probed) — extraction
1504
+ * ignores declarations, so those lines are left alone; the type-keyword-arg
1505
+ * blank above already recovers the `DEFINE_PER_CPU(struct T, x);` bare form.
1506
+ * Matched tightly: `static`/`extern` first on the line (indentation allowed —
1507
+ * `static DEFINE_RATELIMIT_STATE(…)` appears at BLOCK scope too, and the
1508
+ * storage-class-plus-call shape is invalid at every scope), CAPS macro name,
1509
+ * parens balancing ON the line (string literals skipped), then exactly `;`
1510
+ * to end of line. Initializer forms (`… ) = { …`) are deliberately not
1511
+ * matched — blanking the head would strand the brace block. C-only.
1512
+ */
1513
+ const C_PREFIXED_DECL_MACRO_RE = /^[ \t]*(?:static|extern)[ \t]+[A-Z][A-Z0-9_]{2,}[ \t]*\(/;
1514
+ function blankCFileScopePrefixedDeclMacros(source) {
1515
+ if (!/^[ \t]*(?:static|extern)[ \t]+[A-Z]/m.test(source))
1516
+ return source;
1517
+ const rawStrings = maskCppRawStrings(source);
1518
+ source = rawStrings.source;
1519
+ const lines = source.split('\n');
1520
+ let changed = false;
1521
+ for (let i = 0; i < lines.length; i++) {
1522
+ const line = lines[i];
1523
+ const m = C_PREFIXED_DECL_MACRO_RE.exec(line);
1524
+ if (!m)
1525
+ continue;
1526
+ const open = line.indexOf('(', m[0].length - 1);
1527
+ let depth = 0;
1528
+ let close = -1;
1529
+ for (let k = open; k < line.length; k++) {
1530
+ const ch = line[k];
1531
+ if (ch === '"' || ch === "'") {
1532
+ const quote = ch;
1533
+ k++;
1534
+ while (k < line.length && line[k] !== quote) {
1535
+ if (line[k] === '\\')
1536
+ k++;
1537
+ k++;
1538
+ }
1539
+ continue;
1540
+ }
1541
+ if (ch === '(')
1542
+ depth++;
1543
+ else if (ch === ')') {
1544
+ depth--;
1545
+ if (depth === 0) {
1546
+ close = k;
1547
+ break;
1548
+ }
1549
+ }
1550
+ }
1551
+ if (close < 0)
1552
+ continue; // spans lines — leave for a future round
1553
+ if (line.slice(close + 1).replace(/\r$/, '').trim() !== ';')
1554
+ continue;
1555
+ lines[i] = line.replace(/[^\n\r]/g, ' ');
1556
+ changed = true;
1557
+ }
1558
+ return rawStrings.restore(changed ? lines.join('\n') : source);
1559
+ }
1560
+ /**
1561
+ * REWRITE (the one non-blank pass in this family — it moves a token) a
1562
+ * 2-argument `static CAPS_MACRO(type, name) = {`-style initialized
1563
+ * declaration macro into the declaration it expands to — `static
1564
+ * DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = {` becomes `static
1565
+ * struct cpuhp_cpu_state cpuhp_state) …` → `static struct
1566
+ * cpuhp_cpu_state` + padding + `cpuhp_state` + padding + `= {`. The blank
1567
+ * family can't help here: blanking the head strands the brace block, and
1568
+ * dropping the whole span would discard the initializer's function
1569
+ * references (`.startup.single = bringup_cpu` — real cFnPtr wiring). The
1570
+ * NAME keeps its exact original column and the `= {` tail keeps its exact
1571
+ * offsets (`d`-flag group indices); only the TYPE token sits left of where
1572
+ * the macro name was, and type tokens contribute strings, not positions.
1573
+ * Only the two-argument `(<type-ish>, <ident>)` form with an `=` tail
1574
+ * matches; three-argument macros and `;`-terminated forms (the blank above)
1575
+ * never do. C-only.
1576
+ */
1577
+ const C_PREFIXED_DECL_MACRO_INIT_RE = /^([ \t]*)static[ \t]+[A-Z][A-Z0-9_]{2,}[ \t]*\(([^();'"]*?),[ \t]*([A-Za-z_]\w*)[ \t]*\)([ \t]*=[ \t]*\{?[ \t]*\r?)$/d;
1578
+ function rewriteCPrefixedDeclMacroInitializers(source) {
1579
+ if (!/^[ \t]*static[ \t]+[A-Z]/m.test(source))
1580
+ return source;
1581
+ const lines = source.split('\n');
1582
+ let changed = false;
1583
+ for (let i = 0; i < lines.length; i++) {
1584
+ const line = lines[i];
1585
+ const m = C_PREFIXED_DECL_MACRO_INIT_RE.exec(line);
1586
+ if (!m)
1587
+ continue;
1588
+ const indices = m.indices;
1589
+ const arg1 = m[2].trim().replace(/[ \t]+/g, ' ');
1590
+ if (!/^[A-Za-z_][\w \t*]*$/.test(arg1))
1591
+ continue; // a type-token run only
1592
+ const name = m[3];
1593
+ const nameStart = indices[3][0];
1594
+ const tailStart = indices[4][0];
1595
+ const prefix = m[1] + 'static ' + arg1;
1596
+ if (prefix.length + 1 > nameStart)
1597
+ continue; // rewrite must fit left of the name
1598
+ lines[i] =
1599
+ prefix +
1600
+ ' '.repeat(nameStart - prefix.length) +
1601
+ name +
1602
+ ' '.repeat(tailStart - nameStart - name.length) +
1603
+ line.slice(tailStart);
1604
+ changed = true;
1605
+ }
1606
+ return changed ? lines.join('\n') : source;
1607
+ }
1608
+ /**
1609
+ * Blank a QUALIFIED/POINTER type argument of `va_arg` — `va_arg(ap, const
1610
+ * char *)`, `va_arg(args, unsigned long)`. tree-sitter-c parses the
1611
+ * single-token forms (`va_arg(ap, int)`, `va_arg(ap, foo_t)`) natively
1612
+ * (probed), but multi-token type descriptors error the whole enclosing
1613
+ * function. Blanking the comma and the entire second argument leaves
1614
+ * `va_arg(ap )` — a one-argument call the grammar accepts.
1615
+ * Function-pointer types (`va_arg(ap, void (*)(int))`) contain parens and
1616
+ * are deliberately unmatched. C-only.
1617
+ */
1618
+ const C_VA_ARG_RE = /\bva_arg[ \t]*\(([^(),]+)(,[^()]*)\)/g;
1619
+ function blankCVaArgQualifiedTypeArgs(source) {
1620
+ if (source.indexOf('va_arg') === -1)
1621
+ return source;
1622
+ C_VA_ARG_RE.lastIndex = 0;
1623
+ return source.replace(C_VA_ARG_RE, (m, arg1, rest) => {
1624
+ if (/^,[ \t]*[A-Za-z_]\w*[ \t]*$/.test(rest))
1625
+ return m; // single token — parses natively
1626
+ return `va_arg(${arg1}${rest.replace(/[^\n\r]/g, ' ')})`;
1627
+ });
1628
+ }
1629
+ /**
1630
+ * Blank the DOTS of a GNU NAMED-variadic function-like `#define` parameter —
1631
+ * `#define verbose(env, fmt, args...) …` → `#define verbose(env, fmt,
1632
+ * args ) …`. The `ident...` parameter form (unlike standard `...`) errors
1633
+ * the DIRECTIVE itself (measured — and so does trailing whitespace after a
1634
+ * bare `#define NAME`, which is why the tail is NOT blanked wholesale); with
1635
+ * just the dots blanked the params parse as ordinary identifiers and the
1636
+ * body (`##args` included — the preproc body is opaque to the grammar) is
1637
+ * untouched. `restoreDirectiveLines` exists to keep directives out of the
1638
+ * other blanks' blast radius, so this pass runs AFTER the restore and edits
1639
+ * the directive deliberately. Multi-line bodies are fine — the params always
1640
+ * sit on the `#define` line. C-only (the census hits are the kernel's bpf
1641
+ * verifier headers).
1642
+ */
1643
+ const C_NAMED_VARIADIC_DEFINE_RE = /^([ \t]*#[ \t]*define[ \t]+[A-Za-z_]\w*\([^()\n]*?\b\w+)\.\.\./;
1644
+ function blankCNamedVariadicDefineDots(source) {
1645
+ if (source.indexOf('...') === -1)
1646
+ return source;
1647
+ const lines = source.split('\n');
1648
+ let changed = false;
1649
+ for (let i = 0; i < lines.length; i++) {
1650
+ const line = lines[i];
1651
+ const m = C_NAMED_VARIADIC_DEFINE_RE.exec(line);
1652
+ if (!m)
1653
+ continue;
1654
+ const keep = m[1];
1655
+ lines[i] = keep + ' ' + line.slice(keep.length + 3);
1656
+ changed = true;
1657
+ }
1658
+ return changed ? lines.join('\n') : source;
1659
+ }
1660
+ /** C source pre-processing: neutralize `#ifdef __cplusplus` compat-guard
1661
+ * bodies (invisible to a C compiler; `extern "C" {` otherwise errors every
1662
+ * public header), blank declaration-markup macro calls and lone macro lines
1663
+ * (`REDIS_NO_SANITIZE("bounds")` before a definition, jemalloc's diagnostic
1664
+ * toggles — the same structural shapes the C++ side already blanks), recover
1665
+ * functions hidden behind a leading attribute macro (#1211), then — for
1666
+ * C-detected headers in CUDA projects (llm.c keeps `__device__` helpers and
1667
+ * kernel prototypes in plain `.h`) — the same content-gated CUDA blank as
1668
+ * C++. Offset-preserving. */
1669
+ /**
1670
+ * Blank the argument list of a statement-level `MACRO( … );` call whose
1671
+ * arguments are designated initializers — betaflight's
1672
+ *
1673
+ * RESET_CONFIG(pidProfile_t, pidProfile,
1674
+ * .pid = { [PID_ROLL] = PID_ROLL_DEFAULT, … },
1675
+ * .pidSumLimit = PIDSUM_LIMIT,
1676
+ * …
1677
+ * );
1678
+ *
1679
+ * tree-sitter-c has no rule for `.field = value` as a call argument. Even a
1680
+ * small statement-level `M(a, b, .x = 1, .y = { 1, 2 },);` with a trailing
1681
+ * comma recovers by extending the enclosing `function_definition` to EOF —
1682
+ * the next function vanishes and later ones nest under the first (#1729 —
1683
+ * 310 functions in 73 files on a betaflight tree, which name matching then
1684
+ * treated as unreachable closures). Emptying the argument list to spaces,
1685
+ * newlines kept, leaves `RESET_CONFIG(\n\n…\n);` — a call the grammar parses
1686
+ * cleanly — at the cost of the references inside the initializer, which the
1687
+ * broken parse was not yielding either. Statement-level only (`);` follows),
1688
+ * macro-cased name only, offsets preserved. Runs before the kernel route
1689
+ * point, so both the wasm and kernel C arms see the same bytes.
1690
+ */
1691
+ function blankCDesignatedMacroArgs(source) {
1692
+ if (source.indexOf('=') === -1)
1693
+ return source;
1694
+ const rawStrings = maskCppRawStrings(source);
1695
+ source = rawStrings.source;
1696
+ const out = source.split('');
1697
+ const re = /^[ \t]*([A-Z_][A-Z0-9_]*)\s*\(/gm;
1698
+ let m;
1699
+ while ((m = re.exec(source))) {
1700
+ const open = m.index + m[0].length - 1;
1701
+ let depth = 1;
1702
+ let i = open + 1;
1703
+ for (; i < source.length && depth > 0; i++) {
1704
+ const c = source[i];
1705
+ if (c === '(')
1706
+ depth++;
1707
+ else if (c === ')')
1708
+ depth--;
1709
+ }
1710
+ if (depth !== 0)
1711
+ continue;
1712
+ const close = i - 1;
1713
+ const args = source.slice(open + 1, close);
1714
+ // A designator at argument depth: `.name =` or `[index] =`.
1715
+ if (!/(^|[,{(\s])(\.[A-Za-z_]\w*|\[[^\]]+\])\s*=[^=]/.test(args))
1716
+ continue;
1717
+ if (!/^\s*;/.test(source.slice(close + 1)))
1718
+ continue;
1719
+ for (let k = open + 1; k < close; k++)
1720
+ if (out[k] !== '\n')
1721
+ out[k] = ' ';
1722
+ re.lastIndex = close;
1723
+ }
1724
+ return rawStrings.restore(out.join(''));
1725
+ }
1726
+ function preParseCSource(source) {
1727
+ const rawStrings = maskCppRawStrings(source);
1728
+ source = rawStrings.source;
1729
+ const inner = blankCDesignatedMacroArgs(blankCKernelAnnotations(blankCCplusplusGuardBodies(source)));
1730
+ let blanked = blankCLeadingAttrMacros(blankLoneMacroLines(blankCStatementMacroCalls(blankCTrailingParamAttrMacros(blankCppAnnotationMacroCalls(rewriteCPrefixedDeclMacroInitializers(blankCFileScopePrefixedDeclMacros(blankCVaArgQualifiedTypeArgs(blankCTypeKeywordArgs(blankCParameterizedAnnotationMacros(blankCAutoInference(blankCSandwichedAnnotations(inner))))))))))));
1731
+ if (looksLikeCudaSource(blanked))
1732
+ blanked = blankCudaConstructs(blanked);
1733
+ // The named-variadic `#define` pass runs AFTER the directive restore — it
1734
+ // deliberately edits directive lines (see its doc comment).
1735
+ return rawStrings.restore(blankCNamedVariadicDefineDots(restoreDirectiveLines(source, blanked)));
1736
+ }
1737
+ exports.cppExtractor = {
1738
+ // Recover macro-annotated class/struct definitions (`class MYMODULE_API Foo : Base`,
1739
+ // #1061/#946) and macro-prefixed functions (`FORCEINLINE FString Foo()`, #1093
1740
+ // follow-up) that tree-sitter otherwise misparses.
1741
+ preParse: preParseCppSource,
1742
+ // Universal net for any macro the curated blank list misses.
1743
+ recoverMangledName: recoverMangledCppName,
1744
+ functionTypes: ['function_definition'],
1745
+ classTypes: ['class_specifier'],
1746
+ // A bodiless `class_specifier` is a forward declaration (`class Foo;`) or an
1747
+ // elaborated type reference, not a definition. Skip it so dozens of forward
1748
+ // decls across headers don't mint phantom `class` nodes that crowd out — and
1749
+ // get picked as the blast-radius representative over — the single real
1750
+ // definition, exactly as bodiless struct/enum specifiers are already skipped. (#1093)
1751
+ skipBodilessClass: true,
1752
+ // `function_definition` covers inline / out-of-line bodies; `field_declaration`
1753
+ // covers pure-virtual methods (`virtual int read(int key) = 0;`), which have no
1754
+ // body and would otherwise mint no node — so calls through the abstract base and
1755
+ // cpp-override synthesis had nothing to attach to (#1727). classifyMethodNode
1756
+ // keeps ordinary data members / prototypes on the children-walk path.
1757
+ methodTypes: ['function_definition', 'field_declaration'],
1758
+ classifyMethodNode: (node) => {
1759
+ if (node.type !== 'field_declaration')
1760
+ return 'method';
1761
+ return isCppPureVirtualMethodDecl(node) ? 'method' : 'skip';
1762
+ },
1763
+ isAbstract: (node) => (isCppPureVirtualMethodDecl(node) ? true : undefined),
1764
+ interfaceTypes: [],
1765
+ structTypes: ['struct_specifier'],
1766
+ // C++ unions additionally carry member functions, which extract through the
1767
+ // same aggregate-body walk as structs while preserving their distinct kind.
1768
+ unionTypes: ['union_specifier'],
1769
+ enumTypes: ['enum_specifier'],
1770
+ enumMemberTypes: ['enumerator'],
1771
+ typeAliasTypes: ['type_definition', 'alias_declaration'], // typedef and using
1772
+ importTypes: ['preproc_include'],
1773
+ callTypes: ['call_expression'],
1774
+ variableTypes: ['declaration'],
1775
+ nameField: 'declarator',
1776
+ bodyField: 'body',
1777
+ paramsField: 'parameters',
1778
+ resolveName: extractCppQualifiedMethodName,
1779
+ getReceiverType: extractCppReceiverType,
1780
+ getReturnType: extractCppReturnType,
1781
+ getVisibility: (node) => {
1782
+ // Check for access specifier in parent
1783
+ const parent = node.parent;
1784
+ if (parent) {
1785
+ for (let i = 0; i < parent.childCount; i++) {
1786
+ const child = parent.child(i);
1787
+ if (child?.type === 'access_specifier') {
1788
+ const text = child.text;
1789
+ if (text.includes('public'))
1790
+ return 'public';
1791
+ if (text.includes('private'))
1792
+ return 'private';
1793
+ if (text.includes('protected'))
1794
+ return 'protected';
1795
+ }
1796
+ }
1797
+ }
1798
+ return undefined;
1799
+ },
1800
+ resolveTypeAliasKind: (node, _source) => {
1801
+ // C++ typedef: `typedef enum { ... } name;`, `typedef struct { ... } name;`,
1802
+ // or `typedef union { ... } name;` — see the C extractor.
1803
+ for (let i = 0; i < node.namedChildCount; i++) {
1804
+ const child = node.namedChild(i);
1805
+ if (!child)
1806
+ continue;
1807
+ if (child.type === 'enum_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
1808
+ return 'enum';
1809
+ if (child.type === 'struct_specifier' &&
1810
+ (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
1811
+ return 'struct';
1812
+ if (child.type === 'union_specifier' && (0, tree_sitter_helpers_1.getChildByField)(child, 'body'))
1813
+ return 'union';
1814
+ }
1815
+ return undefined;
1816
+ },
1817
+ isMisparsedFunction: (name, node) => {
1818
+ // C++ macros like NLOHMANN_JSON_NAMESPACE_BEGIN cause tree-sitter to misparse
1819
+ // namespace blocks as function_definitions (e.g. name = "namespace detail").
1820
+ // Also filter C++ keywords that tree-sitter occasionally misinterprets as
1821
+ // function/method names (e.g. switch statements inside macro-confused scopes).
1822
+ if (name.startsWith('namespace'))
1823
+ return true;
1824
+ const cppKeywords = ['switch', 'if', 'for', 'while', 'do', 'case', 'return'];
1825
+ if (cppKeywords.includes(name))
1826
+ return true;
1827
+ // `class MACRO Name : public Base { … }` misparses to a function_definition
1828
+ // named after the class. `blankCppExportMacros` (preParse) recovers the
1829
+ // common ALL-CAPS export-macro shape; this drop is the fallback for any
1830
+ // residual misparse it doesn't blank — still no phantom function (#1061/#946).
1831
+ return isMacroMisparsedTypeDecl(node);
1832
+ },
1833
+ extractImport: (node, source) => {
1834
+ const importText = source.substring(node.startIndex, node.endIndex).trim();
1835
+ // C++ includes: #include <iostream>, #include "myheader.h"
1836
+ const systemLib = node.namedChildren.find((c) => c.type === 'system_lib_string');
1837
+ if (systemLib) {
1838
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(systemLib, source).replace(/^<|>$/g, ''), signature: importText };
1839
+ }
1840
+ const stringLiteral = node.namedChildren.find((c) => c.type === 'string_literal');
1841
+ if (stringLiteral) {
1842
+ const stringContent = stringLiteral.namedChildren.find((c) => c.type === 'string_content');
1843
+ if (stringContent) {
1844
+ return { moduleName: (0, tree_sitter_helpers_1.getNodeText)(stringContent, source), signature: importText };
1845
+ }
1846
+ }
1847
+ return null;
1848
+ },
1849
+ };
1850
+ //# sourceMappingURL=c-cpp.js.map