@opencodehub/ingestion 0.1.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 (563) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +69 -0
  3. package/dist/extract/index.d.ts +8 -0
  4. package/dist/extract/index.d.ts.map +1 -0
  5. package/dist/extract/index.js +6 -0
  6. package/dist/extract/index.js.map +1 -0
  7. package/dist/extract/orm-detector.d.ts +19 -0
  8. package/dist/extract/orm-detector.d.ts.map +1 -0
  9. package/dist/extract/orm-detector.js +209 -0
  10. package/dist/extract/orm-detector.js.map +1 -0
  11. package/dist/extract/property-access.d.ts +76 -0
  12. package/dist/extract/property-access.d.ts.map +1 -0
  13. package/dist/extract/property-access.js +260 -0
  14. package/dist/extract/property-access.js.map +1 -0
  15. package/dist/extract/receiver-resolver.d.ts +86 -0
  16. package/dist/extract/receiver-resolver.d.ts.map +1 -0
  17. package/dist/extract/receiver-resolver.js +77 -0
  18. package/dist/extract/receiver-resolver.js.map +1 -0
  19. package/dist/extract/route-detector-java.d.ts +29 -0
  20. package/dist/extract/route-detector-java.d.ts.map +1 -0
  21. package/dist/extract/route-detector-java.js +190 -0
  22. package/dist/extract/route-detector-java.js.map +1 -0
  23. package/dist/extract/route-detector-nestjs.d.ts +30 -0
  24. package/dist/extract/route-detector-nestjs.d.ts.map +1 -0
  25. package/dist/extract/route-detector-nestjs.js +134 -0
  26. package/dist/extract/route-detector-nestjs.js.map +1 -0
  27. package/dist/extract/route-detector-python.d.ts +28 -0
  28. package/dist/extract/route-detector-python.d.ts.map +1 -0
  29. package/dist/extract/route-detector-python.js +100 -0
  30. package/dist/extract/route-detector-python.js.map +1 -0
  31. package/dist/extract/route-detector-rails.d.ts +28 -0
  32. package/dist/extract/route-detector-rails.d.ts.map +1 -0
  33. package/dist/extract/route-detector-rails.js +162 -0
  34. package/dist/extract/route-detector-rails.js.map +1 -0
  35. package/dist/extract/route-detector.d.ts +45 -0
  36. package/dist/extract/route-detector.d.ts.map +1 -0
  37. package/dist/extract/route-detector.js +467 -0
  38. package/dist/extract/route-detector.js.map +1 -0
  39. package/dist/extract/tool-detector.d.ts +26 -0
  40. package/dist/extract/tool-detector.d.ts.map +1 -0
  41. package/dist/extract/tool-detector.js +364 -0
  42. package/dist/extract/tool-detector.js.map +1 -0
  43. package/dist/extract/types.d.ts +89 -0
  44. package/dist/extract/types.d.ts.map +1 -0
  45. package/dist/extract/types.js +11 -0
  46. package/dist/extract/types.js.map +1 -0
  47. package/dist/index.d.ts +10 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +10 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/parse/cobol-regex.d.ts +85 -0
  52. package/dist/parse/cobol-regex.d.ts.map +1 -0
  53. package/dist/parse/cobol-regex.js +355 -0
  54. package/dist/parse/cobol-regex.js.map +1 -0
  55. package/dist/parse/grammar-registry.d.ts +115 -0
  56. package/dist/parse/grammar-registry.d.ts.map +1 -0
  57. package/dist/parse/grammar-registry.js +278 -0
  58. package/dist/parse/grammar-registry.js.map +1 -0
  59. package/dist/parse/index.d.ts +14 -0
  60. package/dist/parse/index.d.ts.map +1 -0
  61. package/dist/parse/index.js +10 -0
  62. package/dist/parse/index.js.map +1 -0
  63. package/dist/parse/language-detector.d.ts +17 -0
  64. package/dist/parse/language-detector.d.ts.map +1 -0
  65. package/dist/parse/language-detector.js +104 -0
  66. package/dist/parse/language-detector.js.map +1 -0
  67. package/dist/parse/parse-worker.d.ts +24 -0
  68. package/dist/parse/parse-worker.d.ts.map +1 -0
  69. package/dist/parse/parse-worker.js +230 -0
  70. package/dist/parse/parse-worker.js.map +1 -0
  71. package/dist/parse/types.d.ts +49 -0
  72. package/dist/parse/types.d.ts.map +1 -0
  73. package/dist/parse/types.js +11 -0
  74. package/dist/parse/types.js.map +1 -0
  75. package/dist/parse/unified-queries.d.ts +37 -0
  76. package/dist/parse/unified-queries.d.ts.map +1 -0
  77. package/dist/parse/unified-queries.js +623 -0
  78. package/dist/parse/unified-queries.js.map +1 -0
  79. package/dist/parse/wasm-fallback.d.ts +88 -0
  80. package/dist/parse/wasm-fallback.d.ts.map +1 -0
  81. package/dist/parse/wasm-fallback.js +258 -0
  82. package/dist/parse/wasm-fallback.js.map +1 -0
  83. package/dist/parse/worker-pool.d.ts +48 -0
  84. package/dist/parse/worker-pool.d.ts.map +1 -0
  85. package/dist/parse/worker-pool.js +97 -0
  86. package/dist/parse/worker-pool.js.map +1 -0
  87. package/dist/pipeline/dep-parsers/go.d.ts +25 -0
  88. package/dist/pipeline/dep-parsers/go.d.ts.map +1 -0
  89. package/dist/pipeline/dep-parsers/go.js +146 -0
  90. package/dist/pipeline/dep-parsers/go.js.map +1 -0
  91. package/dist/pipeline/dep-parsers/index.d.ts +17 -0
  92. package/dist/pipeline/dep-parsers/index.d.ts.map +1 -0
  93. package/dist/pipeline/dep-parsers/index.js +16 -0
  94. package/dist/pipeline/dep-parsers/index.js.map +1 -0
  95. package/dist/pipeline/dep-parsers/maven.d.ts +24 -0
  96. package/dist/pipeline/dep-parsers/maven.d.ts.map +1 -0
  97. package/dist/pipeline/dep-parsers/maven.js +131 -0
  98. package/dist/pipeline/dep-parsers/maven.js.map +1 -0
  99. package/dist/pipeline/dep-parsers/npm.d.ts +30 -0
  100. package/dist/pipeline/dep-parsers/npm.d.ts.map +1 -0
  101. package/dist/pipeline/dep-parsers/npm.js +309 -0
  102. package/dist/pipeline/dep-parsers/npm.js.map +1 -0
  103. package/dist/pipeline/dep-parsers/nuget.d.ts +24 -0
  104. package/dist/pipeline/dep-parsers/nuget.d.ts.map +1 -0
  105. package/dist/pipeline/dep-parsers/nuget.js +178 -0
  106. package/dist/pipeline/dep-parsers/nuget.js.map +1 -0
  107. package/dist/pipeline/dep-parsers/python.d.ts +21 -0
  108. package/dist/pipeline/dep-parsers/python.d.ts.map +1 -0
  109. package/dist/pipeline/dep-parsers/python.js +369 -0
  110. package/dist/pipeline/dep-parsers/python.js.map +1 -0
  111. package/dist/pipeline/dep-parsers/rust.d.ts +18 -0
  112. package/dist/pipeline/dep-parsers/rust.d.ts.map +1 -0
  113. package/dist/pipeline/dep-parsers/rust.js +134 -0
  114. package/dist/pipeline/dep-parsers/rust.js.map +1 -0
  115. package/dist/pipeline/dep-parsers/spdx-normalize.d.ts +15 -0
  116. package/dist/pipeline/dep-parsers/spdx-normalize.d.ts.map +1 -0
  117. package/dist/pipeline/dep-parsers/spdx-normalize.js +31 -0
  118. package/dist/pipeline/dep-parsers/spdx-normalize.js.map +1 -0
  119. package/dist/pipeline/dep-parsers/types.d.ts +63 -0
  120. package/dist/pipeline/dep-parsers/types.d.ts.map +1 -0
  121. package/dist/pipeline/dep-parsers/types.js +56 -0
  122. package/dist/pipeline/dep-parsers/types.js.map +1 -0
  123. package/dist/pipeline/gitignore-stack.d.ts +44 -0
  124. package/dist/pipeline/gitignore-stack.d.ts.map +1 -0
  125. package/dist/pipeline/gitignore-stack.js +69 -0
  126. package/dist/pipeline/gitignore-stack.js.map +1 -0
  127. package/dist/pipeline/gitignore.d.ts +67 -0
  128. package/dist/pipeline/gitignore.d.ts.map +1 -0
  129. package/dist/pipeline/gitignore.js +210 -0
  130. package/dist/pipeline/gitignore.js.map +1 -0
  131. package/dist/pipeline/index.d.ts +53 -0
  132. package/dist/pipeline/index.d.ts.map +1 -0
  133. package/dist/pipeline/index.js +29 -0
  134. package/dist/pipeline/index.js.map +1 -0
  135. package/dist/pipeline/orchestrator.d.ts +105 -0
  136. package/dist/pipeline/orchestrator.d.ts.map +1 -0
  137. package/dist/pipeline/orchestrator.js +175 -0
  138. package/dist/pipeline/orchestrator.js.map +1 -0
  139. package/dist/pipeline/ownership-helpers/drift.d.ts +41 -0
  140. package/dist/pipeline/ownership-helpers/drift.d.ts.map +1 -0
  141. package/dist/pipeline/ownership-helpers/drift.js +122 -0
  142. package/dist/pipeline/ownership-helpers/drift.js.map +1 -0
  143. package/dist/pipeline/ownership-helpers/gini-community.d.ts +24 -0
  144. package/dist/pipeline/ownership-helpers/gini-community.d.ts.map +1 -0
  145. package/dist/pipeline/ownership-helpers/gini-community.js +32 -0
  146. package/dist/pipeline/ownership-helpers/gini-community.js.map +1 -0
  147. package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts +71 -0
  148. package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts.map +1 -0
  149. package/dist/pipeline/ownership-helpers/git-blame-batcher.js +178 -0
  150. package/dist/pipeline/ownership-helpers/git-blame-batcher.js.map +1 -0
  151. package/dist/pipeline/ownership-helpers/line-overlap.d.ts +35 -0
  152. package/dist/pipeline/ownership-helpers/line-overlap.d.ts.map +1 -0
  153. package/dist/pipeline/ownership-helpers/line-overlap.js +62 -0
  154. package/dist/pipeline/ownership-helpers/line-overlap.js.map +1 -0
  155. package/dist/pipeline/ownership-helpers/orphan.d.ts +73 -0
  156. package/dist/pipeline/ownership-helpers/orphan.d.ts.map +1 -0
  157. package/dist/pipeline/ownership-helpers/orphan.js +117 -0
  158. package/dist/pipeline/ownership-helpers/orphan.js.map +1 -0
  159. package/dist/pipeline/phases/accesses.d.ts +44 -0
  160. package/dist/pipeline/phases/accesses.d.ts.map +1 -0
  161. package/dist/pipeline/phases/accesses.js +194 -0
  162. package/dist/pipeline/phases/accesses.js.map +1 -0
  163. package/dist/pipeline/phases/annotate.d.ts +28 -0
  164. package/dist/pipeline/phases/annotate.d.ts.map +1 -0
  165. package/dist/pipeline/phases/annotate.js +60 -0
  166. package/dist/pipeline/phases/annotate.js.map +1 -0
  167. package/dist/pipeline/phases/cochange.d.ts +42 -0
  168. package/dist/pipeline/phases/cochange.d.ts.map +1 -0
  169. package/dist/pipeline/phases/cochange.js +0 -0
  170. package/dist/pipeline/phases/cochange.js.map +1 -0
  171. package/dist/pipeline/phases/communities.d.ts +34 -0
  172. package/dist/pipeline/phases/communities.d.ts.map +1 -0
  173. package/dist/pipeline/phases/communities.js +412 -0
  174. package/dist/pipeline/phases/communities.js.map +1 -0
  175. package/dist/pipeline/phases/complexity.d.ts +50 -0
  176. package/dist/pipeline/phases/complexity.d.ts.map +1 -0
  177. package/dist/pipeline/phases/complexity.js +794 -0
  178. package/dist/pipeline/phases/complexity.js.map +1 -0
  179. package/dist/pipeline/phases/confidence-demote.d.ts +23 -0
  180. package/dist/pipeline/phases/confidence-demote.d.ts.map +1 -0
  181. package/dist/pipeline/phases/confidence-demote.js +113 -0
  182. package/dist/pipeline/phases/confidence-demote.js.map +1 -0
  183. package/dist/pipeline/phases/content-cache.d.ts +166 -0
  184. package/dist/pipeline/phases/content-cache.d.ts.map +1 -0
  185. package/dist/pipeline/phases/content-cache.js +323 -0
  186. package/dist/pipeline/phases/content-cache.js.map +1 -0
  187. package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts +25 -0
  188. package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts.map +1 -0
  189. package/dist/pipeline/phases/coverage-parsers/cobertura.js +139 -0
  190. package/dist/pipeline/phases/coverage-parsers/cobertura.js.map +1 -0
  191. package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts +25 -0
  192. package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts.map +1 -0
  193. package/dist/pipeline/phases/coverage-parsers/coverage-py.js +51 -0
  194. package/dist/pipeline/phases/coverage-parsers/coverage-py.js.map +1 -0
  195. package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts +32 -0
  196. package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts.map +1 -0
  197. package/dist/pipeline/phases/coverage-parsers/jacoco.js +98 -0
  198. package/dist/pipeline/phases/coverage-parsers/jacoco.js.map +1 -0
  199. package/dist/pipeline/phases/coverage-parsers/lcov.d.ts +21 -0
  200. package/dist/pipeline/phases/coverage-parsers/lcov.d.ts.map +1 -0
  201. package/dist/pipeline/phases/coverage-parsers/lcov.js +104 -0
  202. package/dist/pipeline/phases/coverage-parsers/lcov.js.map +1 -0
  203. package/dist/pipeline/phases/coverage-parsers/types.d.ts +27 -0
  204. package/dist/pipeline/phases/coverage-parsers/types.d.ts.map +1 -0
  205. package/dist/pipeline/phases/coverage-parsers/types.js +39 -0
  206. package/dist/pipeline/phases/coverage-parsers/types.js.map +1 -0
  207. package/dist/pipeline/phases/coverage.d.ts +39 -0
  208. package/dist/pipeline/phases/coverage.d.ts.map +1 -0
  209. package/dist/pipeline/phases/coverage.js +154 -0
  210. package/dist/pipeline/phases/coverage.js.map +1 -0
  211. package/dist/pipeline/phases/cross-file.d.ts +40 -0
  212. package/dist/pipeline/phases/cross-file.d.ts.map +1 -0
  213. package/dist/pipeline/phases/cross-file.js +411 -0
  214. package/dist/pipeline/phases/cross-file.js.map +1 -0
  215. package/dist/pipeline/phases/dead-code.d.ts +28 -0
  216. package/dist/pipeline/phases/dead-code.d.ts.map +1 -0
  217. package/dist/pipeline/phases/dead-code.js +157 -0
  218. package/dist/pipeline/phases/dead-code.js.map +1 -0
  219. package/dist/pipeline/phases/default-set.d.ts +24 -0
  220. package/dist/pipeline/phases/default-set.d.ts.map +1 -0
  221. package/dist/pipeline/phases/default-set.js +133 -0
  222. package/dist/pipeline/phases/default-set.js.map +1 -0
  223. package/dist/pipeline/phases/dependencies.d.ts +59 -0
  224. package/dist/pipeline/phases/dependencies.d.ts.map +1 -0
  225. package/dist/pipeline/phases/dependencies.js +281 -0
  226. package/dist/pipeline/phases/dependencies.js.map +1 -0
  227. package/dist/pipeline/phases/embedder-pool.d.ts +31 -0
  228. package/dist/pipeline/phases/embedder-pool.d.ts.map +1 -0
  229. package/dist/pipeline/phases/embedder-pool.js +79 -0
  230. package/dist/pipeline/phases/embedder-pool.js.map +1 -0
  231. package/dist/pipeline/phases/embedder-worker.d.ts +28 -0
  232. package/dist/pipeline/phases/embedder-worker.d.ts.map +1 -0
  233. package/dist/pipeline/phases/embedder-worker.js +43 -0
  234. package/dist/pipeline/phases/embedder-worker.js.map +1 -0
  235. package/dist/pipeline/phases/embeddings.d.ts +117 -0
  236. package/dist/pipeline/phases/embeddings.d.ts.map +1 -0
  237. package/dist/pipeline/phases/embeddings.js +697 -0
  238. package/dist/pipeline/phases/embeddings.js.map +1 -0
  239. package/dist/pipeline/phases/fetches.d.ts +47 -0
  240. package/dist/pipeline/phases/fetches.d.ts.map +1 -0
  241. package/dist/pipeline/phases/fetches.js +207 -0
  242. package/dist/pipeline/phases/fetches.js.map +1 -0
  243. package/dist/pipeline/phases/incremental-helper.d.ts +96 -0
  244. package/dist/pipeline/phases/incremental-helper.d.ts.map +1 -0
  245. package/dist/pipeline/phases/incremental-helper.js +125 -0
  246. package/dist/pipeline/phases/incremental-helper.js.map +1 -0
  247. package/dist/pipeline/phases/incremental-scope.d.ts +67 -0
  248. package/dist/pipeline/phases/incremental-scope.d.ts.map +1 -0
  249. package/dist/pipeline/phases/incremental-scope.js +225 -0
  250. package/dist/pipeline/phases/incremental-scope.js.map +1 -0
  251. package/dist/pipeline/phases/markdown.d.ts +29 -0
  252. package/dist/pipeline/phases/markdown.d.ts.map +1 -0
  253. package/dist/pipeline/phases/markdown.js +298 -0
  254. package/dist/pipeline/phases/markdown.js.map +1 -0
  255. package/dist/pipeline/phases/mro.d.ts +24 -0
  256. package/dist/pipeline/phases/mro.d.ts.map +1 -0
  257. package/dist/pipeline/phases/mro.js +303 -0
  258. package/dist/pipeline/phases/mro.js.map +1 -0
  259. package/dist/pipeline/phases/openapi.d.ts +52 -0
  260. package/dist/pipeline/phases/openapi.d.ts.map +1 -0
  261. package/dist/pipeline/phases/openapi.js +285 -0
  262. package/dist/pipeline/phases/openapi.js.map +1 -0
  263. package/dist/pipeline/phases/orm.d.ts +26 -0
  264. package/dist/pipeline/phases/orm.d.ts.map +1 -0
  265. package/dist/pipeline/phases/orm.js +183 -0
  266. package/dist/pipeline/phases/orm.js.map +1 -0
  267. package/dist/pipeline/phases/ownership.d.ts +88 -0
  268. package/dist/pipeline/phases/ownership.d.ts.map +1 -0
  269. package/dist/pipeline/phases/ownership.js +479 -0
  270. package/dist/pipeline/phases/ownership.js.map +1 -0
  271. package/dist/pipeline/phases/parse.d.ts +63 -0
  272. package/dist/pipeline/phases/parse.d.ts.map +1 -0
  273. package/dist/pipeline/phases/parse.js +994 -0
  274. package/dist/pipeline/phases/parse.js.map +1 -0
  275. package/dist/pipeline/phases/processes.d.ts +47 -0
  276. package/dist/pipeline/phases/processes.d.ts.map +1 -0
  277. package/dist/pipeline/phases/processes.js +620 -0
  278. package/dist/pipeline/phases/processes.js.map +1 -0
  279. package/dist/pipeline/phases/profile.d.ts +33 -0
  280. package/dist/pipeline/phases/profile.d.ts.map +1 -0
  281. package/dist/pipeline/phases/profile.js +91 -0
  282. package/dist/pipeline/phases/profile.js.map +1 -0
  283. package/dist/pipeline/phases/repo-node.d.ts +112 -0
  284. package/dist/pipeline/phases/repo-node.d.ts.map +1 -0
  285. package/dist/pipeline/phases/repo-node.js +272 -0
  286. package/dist/pipeline/phases/repo-node.js.map +1 -0
  287. package/dist/pipeline/phases/risk-snapshot.d.ts +34 -0
  288. package/dist/pipeline/phases/risk-snapshot.d.ts.map +1 -0
  289. package/dist/pipeline/phases/risk-snapshot.js +63 -0
  290. package/dist/pipeline/phases/risk-snapshot.js.map +1 -0
  291. package/dist/pipeline/phases/routes.d.ts +31 -0
  292. package/dist/pipeline/phases/routes.d.ts.map +1 -0
  293. package/dist/pipeline/phases/routes.js +262 -0
  294. package/dist/pipeline/phases/routes.js.map +1 -0
  295. package/dist/pipeline/phases/sbom.d.ts +45 -0
  296. package/dist/pipeline/phases/sbom.d.ts.map +1 -0
  297. package/dist/pipeline/phases/sbom.js +289 -0
  298. package/dist/pipeline/phases/sbom.js.map +1 -0
  299. package/dist/pipeline/phases/scan.d.ts +54 -0
  300. package/dist/pipeline/phases/scan.d.ts.map +1 -0
  301. package/dist/pipeline/phases/scan.js +340 -0
  302. package/dist/pipeline/phases/scan.js.map +1 -0
  303. package/dist/pipeline/phases/scip-index.d.ts +54 -0
  304. package/dist/pipeline/phases/scip-index.d.ts.map +1 -0
  305. package/dist/pipeline/phases/scip-index.js +469 -0
  306. package/dist/pipeline/phases/scip-index.js.map +1 -0
  307. package/dist/pipeline/phases/structure.d.ts +21 -0
  308. package/dist/pipeline/phases/structure.d.ts.map +1 -0
  309. package/dist/pipeline/phases/structure.js +115 -0
  310. package/dist/pipeline/phases/structure.js.map +1 -0
  311. package/dist/pipeline/phases/summarize.d.ts +126 -0
  312. package/dist/pipeline/phases/summarize.d.ts.map +1 -0
  313. package/dist/pipeline/phases/summarize.js +401 -0
  314. package/dist/pipeline/phases/summarize.js.map +1 -0
  315. package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts +42 -0
  316. package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts.map +1 -0
  317. package/dist/pipeline/phases/temporal-helpers/branch-divergence.js +96 -0
  318. package/dist/pipeline/phases/temporal-helpers/branch-divergence.js.map +1 -0
  319. package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts +22 -0
  320. package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts.map +1 -0
  321. package/dist/pipeline/phases/temporal-helpers/churn-decay.js +32 -0
  322. package/dist/pipeline/phases/temporal-helpers/churn-decay.js.map +1 -0
  323. package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts +21 -0
  324. package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts.map +1 -0
  325. package/dist/pipeline/phases/temporal-helpers/conventional-commits.js +37 -0
  326. package/dist/pipeline/phases/temporal-helpers/conventional-commits.js.map +1 -0
  327. package/dist/pipeline/phases/temporal-helpers/gini.d.ts +32 -0
  328. package/dist/pipeline/phases/temporal-helpers/gini.d.ts.map +1 -0
  329. package/dist/pipeline/phases/temporal-helpers/gini.js +78 -0
  330. package/dist/pipeline/phases/temporal-helpers/gini.js.map +1 -0
  331. package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts +14 -0
  332. package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts.map +1 -0
  333. package/dist/pipeline/phases/temporal-helpers/revert-detect.js +25 -0
  334. package/dist/pipeline/phases/temporal-helpers/revert-detect.js.map +1 -0
  335. package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts +18 -0
  336. package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts.map +1 -0
  337. package/dist/pipeline/phases/temporal-helpers/test-pair.js +119 -0
  338. package/dist/pipeline/phases/temporal-helpers/test-pair.js.map +1 -0
  339. package/dist/pipeline/phases/temporal.d.ts +65 -0
  340. package/dist/pipeline/phases/temporal.d.ts.map +1 -0
  341. package/dist/pipeline/phases/temporal.js +621 -0
  342. package/dist/pipeline/phases/temporal.js.map +1 -0
  343. package/dist/pipeline/phases/tools.d.ts +21 -0
  344. package/dist/pipeline/phases/tools.d.ts.map +1 -0
  345. package/dist/pipeline/phases/tools.js +118 -0
  346. package/dist/pipeline/phases/tools.js.map +1 -0
  347. package/dist/pipeline/profile-detectors/api-contracts.d.ts +18 -0
  348. package/dist/pipeline/profile-detectors/api-contracts.d.ts.map +1 -0
  349. package/dist/pipeline/profile-detectors/api-contracts.js +78 -0
  350. package/dist/pipeline/profile-detectors/api-contracts.js.map +1 -0
  351. package/dist/pipeline/profile-detectors/framework-detector.d.ts +11 -0
  352. package/dist/pipeline/profile-detectors/framework-detector.d.ts.map +1 -0
  353. package/dist/pipeline/profile-detectors/framework-detector.js +11 -0
  354. package/dist/pipeline/profile-detectors/framework-detector.js.map +1 -0
  355. package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts +7 -0
  356. package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts.map +1 -0
  357. package/dist/pipeline/profile-detectors/frameworks-catalog.js +7 -0
  358. package/dist/pipeline/profile-detectors/frameworks-catalog.js.map +1 -0
  359. package/dist/pipeline/profile-detectors/frameworks.d.ts +7 -0
  360. package/dist/pipeline/profile-detectors/frameworks.d.ts.map +1 -0
  361. package/dist/pipeline/profile-detectors/frameworks.js +7 -0
  362. package/dist/pipeline/profile-detectors/frameworks.js.map +1 -0
  363. package/dist/pipeline/profile-detectors/iac.d.ts +22 -0
  364. package/dist/pipeline/profile-detectors/iac.d.ts.map +1 -0
  365. package/dist/pipeline/profile-detectors/iac.js +97 -0
  366. package/dist/pipeline/profile-detectors/iac.js.map +1 -0
  367. package/dist/pipeline/profile-detectors/languages.d.ts +18 -0
  368. package/dist/pipeline/profile-detectors/languages.d.ts.map +1 -0
  369. package/dist/pipeline/profile-detectors/languages.js +60 -0
  370. package/dist/pipeline/profile-detectors/languages.js.map +1 -0
  371. package/dist/pipeline/profile-detectors/manifests.d.ts +7 -0
  372. package/dist/pipeline/profile-detectors/manifests.d.ts.map +1 -0
  373. package/dist/pipeline/profile-detectors/manifests.js +7 -0
  374. package/dist/pipeline/profile-detectors/manifests.js.map +1 -0
  375. package/dist/pipeline/profile-detectors/src-dirs.d.ts +17 -0
  376. package/dist/pipeline/profile-detectors/src-dirs.d.ts.map +1 -0
  377. package/dist/pipeline/profile-detectors/src-dirs.js +89 -0
  378. package/dist/pipeline/profile-detectors/src-dirs.js.map +1 -0
  379. package/dist/pipeline/profile-detectors/variant-detectors.d.ts +7 -0
  380. package/dist/pipeline/profile-detectors/variant-detectors.d.ts.map +1 -0
  381. package/dist/pipeline/profile-detectors/variant-detectors.js +7 -0
  382. package/dist/pipeline/profile-detectors/variant-detectors.js.map +1 -0
  383. package/dist/pipeline/runner.d.ts +54 -0
  384. package/dist/pipeline/runner.d.ts.map +1 -0
  385. package/dist/pipeline/runner.js +247 -0
  386. package/dist/pipeline/runner.js.map +1 -0
  387. package/dist/pipeline/types.d.ts +235 -0
  388. package/dist/pipeline/types.d.ts.map +1 -0
  389. package/dist/pipeline/types.js +15 -0
  390. package/dist/pipeline/types.js.map +1 -0
  391. package/dist/providers/c.d.ts +3 -0
  392. package/dist/providers/c.d.ts.map +1 -0
  393. package/dist/providers/c.js +162 -0
  394. package/dist/providers/c.js.map +1 -0
  395. package/dist/providers/cobol.d.ts +19 -0
  396. package/dist/providers/cobol.d.ts.map +1 -0
  397. package/dist/providers/cobol.js +44 -0
  398. package/dist/providers/cobol.js.map +1 -0
  399. package/dist/providers/cpp.d.ts +3 -0
  400. package/dist/providers/cpp.d.ts.map +1 -0
  401. package/dist/providers/cpp.js +200 -0
  402. package/dist/providers/cpp.js.map +1 -0
  403. package/dist/providers/csharp.d.ts +3 -0
  404. package/dist/providers/csharp.d.ts.map +1 -0
  405. package/dist/providers/csharp.js +292 -0
  406. package/dist/providers/csharp.js.map +1 -0
  407. package/dist/providers/dart.d.ts +3 -0
  408. package/dist/providers/dart.d.ts.map +1 -0
  409. package/dist/providers/dart.js +214 -0
  410. package/dist/providers/dart.js.map +1 -0
  411. package/dist/providers/definition-ids.d.ts +18 -0
  412. package/dist/providers/definition-ids.d.ts.map +1 -0
  413. package/dist/providers/definition-ids.js +23 -0
  414. package/dist/providers/definition-ids.js.map +1 -0
  415. package/dist/providers/extract-helpers.d.ts +60 -0
  416. package/dist/providers/extract-helpers.d.ts.map +1 -0
  417. package/dist/providers/extract-helpers.js +296 -0
  418. package/dist/providers/extract-helpers.js.map +1 -0
  419. package/dist/providers/extraction-types.d.ts +85 -0
  420. package/dist/providers/extraction-types.d.ts.map +1 -0
  421. package/dist/providers/extraction-types.js +13 -0
  422. package/dist/providers/extraction-types.js.map +1 -0
  423. package/dist/providers/go.d.ts +3 -0
  424. package/dist/providers/go.d.ts.map +1 -0
  425. package/dist/providers/go.js +359 -0
  426. package/dist/providers/go.js.map +1 -0
  427. package/dist/providers/http-detect.d.ts +44 -0
  428. package/dist/providers/http-detect.d.ts.map +1 -0
  429. package/dist/providers/http-detect.js +307 -0
  430. package/dist/providers/http-detect.js.map +1 -0
  431. package/dist/providers/index.d.ts +38 -0
  432. package/dist/providers/index.d.ts.map +1 -0
  433. package/dist/providers/index.js +33 -0
  434. package/dist/providers/index.js.map +1 -0
  435. package/dist/providers/java.d.ts +3 -0
  436. package/dist/providers/java.d.ts.map +1 -0
  437. package/dist/providers/java.js +259 -0
  438. package/dist/providers/java.js.map +1 -0
  439. package/dist/providers/javascript.d.ts +3 -0
  440. package/dist/providers/javascript.d.ts.map +1 -0
  441. package/dist/providers/javascript.js +139 -0
  442. package/dist/providers/javascript.js.map +1 -0
  443. package/dist/providers/kotlin.d.ts +3 -0
  444. package/dist/providers/kotlin.d.ts.map +1 -0
  445. package/dist/providers/kotlin.js +175 -0
  446. package/dist/providers/kotlin.js.map +1 -0
  447. package/dist/providers/php.d.ts +3 -0
  448. package/dist/providers/php.d.ts.map +1 -0
  449. package/dist/providers/php.js +218 -0
  450. package/dist/providers/php.js.map +1 -0
  451. package/dist/providers/python-accesses.d.ts +9 -0
  452. package/dist/providers/python-accesses.d.ts.map +1 -0
  453. package/dist/providers/python-accesses.js +22 -0
  454. package/dist/providers/python-accesses.js.map +1 -0
  455. package/dist/providers/python.d.ts +3 -0
  456. package/dist/providers/python.d.ts.map +1 -0
  457. package/dist/providers/python.js +323 -0
  458. package/dist/providers/python.js.map +1 -0
  459. package/dist/providers/registry.d.ts +4 -0
  460. package/dist/providers/registry.d.ts.map +1 -0
  461. package/dist/providers/registry.js +46 -0
  462. package/dist/providers/registry.js.map +1 -0
  463. package/dist/providers/resolution/c3.d.ts +6 -0
  464. package/dist/providers/resolution/c3.d.ts.map +1 -0
  465. package/dist/providers/resolution/c3.js +76 -0
  466. package/dist/providers/resolution/c3.js.map +1 -0
  467. package/dist/providers/resolution/context.d.ts +38 -0
  468. package/dist/providers/resolution/context.d.ts.map +1 -0
  469. package/dist/providers/resolution/context.js +45 -0
  470. package/dist/providers/resolution/context.js.map +1 -0
  471. package/dist/providers/resolution/first-wins.d.ts +3 -0
  472. package/dist/providers/resolution/first-wins.d.ts.map +1 -0
  473. package/dist/providers/resolution/first-wins.js +27 -0
  474. package/dist/providers/resolution/first-wins.js.map +1 -0
  475. package/dist/providers/resolution/mro.d.ts +16 -0
  476. package/dist/providers/resolution/mro.d.ts.map +1 -0
  477. package/dist/providers/resolution/mro.js +14 -0
  478. package/dist/providers/resolution/mro.js.map +1 -0
  479. package/dist/providers/resolution/none.d.ts +3 -0
  480. package/dist/providers/resolution/none.d.ts.map +1 -0
  481. package/dist/providers/resolution/none.js +11 -0
  482. package/dist/providers/resolution/none.js.map +1 -0
  483. package/dist/providers/resolution/python-all-filter.d.ts +25 -0
  484. package/dist/providers/resolution/python-all-filter.d.ts.map +1 -0
  485. package/dist/providers/resolution/python-all-filter.js +64 -0
  486. package/dist/providers/resolution/python-all-filter.js.map +1 -0
  487. package/dist/providers/resolution/resolver-strategy.d.ts +42 -0
  488. package/dist/providers/resolution/resolver-strategy.d.ts.map +1 -0
  489. package/dist/providers/resolution/resolver-strategy.js +50 -0
  490. package/dist/providers/resolution/resolver-strategy.js.map +1 -0
  491. package/dist/providers/resolution/single-inheritance.d.ts +3 -0
  492. package/dist/providers/resolution/single-inheritance.d.ts.map +1 -0
  493. package/dist/providers/resolution/single-inheritance.js +21 -0
  494. package/dist/providers/resolution/single-inheritance.js.map +1 -0
  495. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts +16 -0
  496. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts.map +1 -0
  497. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js +50 -0
  498. package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js.map +1 -0
  499. package/dist/providers/resolution/stack-graphs/glue.d.ts +15 -0
  500. package/dist/providers/resolution/stack-graphs/glue.d.ts.map +1 -0
  501. package/dist/providers/resolution/stack-graphs/glue.js +44 -0
  502. package/dist/providers/resolution/stack-graphs/glue.js.map +1 -0
  503. package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts +30 -0
  504. package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts.map +1 -0
  505. package/dist/providers/resolution/stack-graphs/node-edge-builder.js +366 -0
  506. package/dist/providers/resolution/stack-graphs/node-edge-builder.js.map +1 -0
  507. package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts +9 -0
  508. package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts.map +1 -0
  509. package/dist/providers/resolution/stack-graphs/partial-path-engine.js +152 -0
  510. package/dist/providers/resolution/stack-graphs/partial-path-engine.js.map +1 -0
  511. package/dist/providers/resolution/stack-graphs/rule-parser.d.ts +11 -0
  512. package/dist/providers/resolution/stack-graphs/rule-parser.d.ts.map +1 -0
  513. package/dist/providers/resolution/stack-graphs/rule-parser.js +247 -0
  514. package/dist/providers/resolution/stack-graphs/rule-parser.js.map +1 -0
  515. package/dist/providers/resolution/stack-graphs/types.d.ts +93 -0
  516. package/dist/providers/resolution/stack-graphs/types.d.ts.map +1 -0
  517. package/dist/providers/resolution/stack-graphs/types.js +11 -0
  518. package/dist/providers/resolution/stack-graphs/types.js.map +1 -0
  519. package/dist/providers/resolution/stack-graphs-python.d.ts +27 -0
  520. package/dist/providers/resolution/stack-graphs-python.d.ts.map +1 -0
  521. package/dist/providers/resolution/stack-graphs-python.js +104 -0
  522. package/dist/providers/resolution/stack-graphs-python.js.map +1 -0
  523. package/dist/providers/resolution/stack-graphs-ts.d.ts +134 -0
  524. package/dist/providers/resolution/stack-graphs-ts.d.ts.map +1 -0
  525. package/dist/providers/resolution/stack-graphs-ts.js +372 -0
  526. package/dist/providers/resolution/stack-graphs-ts.js.map +1 -0
  527. package/dist/providers/ruby.d.ts +3 -0
  528. package/dist/providers/ruby.d.ts.map +1 -0
  529. package/dist/providers/ruby.js +259 -0
  530. package/dist/providers/ruby.js.map +1 -0
  531. package/dist/providers/rust.d.ts +3 -0
  532. package/dist/providers/rust.d.ts.map +1 -0
  533. package/dist/providers/rust.js +318 -0
  534. package/dist/providers/rust.js.map +1 -0
  535. package/dist/providers/swift.d.ts +3 -0
  536. package/dist/providers/swift.d.ts.map +1 -0
  537. package/dist/providers/swift.js +177 -0
  538. package/dist/providers/swift.js.map +1 -0
  539. package/dist/providers/test-helpers.d.ts +24 -0
  540. package/dist/providers/test-helpers.d.ts.map +1 -0
  541. package/dist/providers/test-helpers.js +33 -0
  542. package/dist/providers/test-helpers.js.map +1 -0
  543. package/dist/providers/ts-shared.d.ts +30 -0
  544. package/dist/providers/ts-shared.d.ts.map +1 -0
  545. package/dist/providers/ts-shared.js +328 -0
  546. package/dist/providers/ts-shared.js.map +1 -0
  547. package/dist/providers/tsx.d.ts +7 -0
  548. package/dist/providers/tsx.d.ts.map +1 -0
  549. package/dist/providers/tsx.js +79 -0
  550. package/dist/providers/tsx.js.map +1 -0
  551. package/dist/providers/types.d.ts +166 -0
  552. package/dist/providers/types.d.ts.map +1 -0
  553. package/dist/providers/types.js +7 -0
  554. package/dist/providers/types.js.map +1 -0
  555. package/dist/providers/typescript-family-accesses.d.ts +14 -0
  556. package/dist/providers/typescript-family-accesses.d.ts.map +1 -0
  557. package/dist/providers/typescript-family-accesses.js +27 -0
  558. package/dist/providers/typescript-family-accesses.js.map +1 -0
  559. package/dist/providers/typescript.d.ts +9 -0
  560. package/dist/providers/typescript.d.ts.map +1 -0
  561. package/dist/providers/typescript.js +84 -0
  562. package/dist/providers/typescript.js.map +1 -0
  563. package/package.json +108 -0
@@ -0,0 +1,364 @@
1
+ /**
2
+ * MCP / JSON-RPC tool detector.
3
+ *
4
+ * The heuristic is intentionally coarse: many agent frameworks (MCP, LangChain
5
+ * tools, OpenAI function schemas) converge on a `{ name, description, ... }`
6
+ * object literal for each tool. At MVP we only claim a match when the file
7
+ * path *also* signals "tool-ness", which eliminates the majority of false
8
+ * positives coming from generic config blocks.
9
+ *
10
+ * Pattern authored fresh — no external regex reused.
11
+ */
12
+ /** Path-based gate: file must look like a tool definition. */
13
+ function filePathLooksLikeTool(filePath) {
14
+ const normalized = filePath.replace(/\\/g, "/").toLowerCase();
15
+ if (normalized.includes("/tool"))
16
+ return true;
17
+ const basename = normalized.slice(normalized.lastIndexOf("/") + 1);
18
+ // `*-tool.ts`, `*_tool.ts`, or `*tool*.ts` (and JS/MJS siblings).
19
+ if (/(^|[-_])tool([-_.]|s?\.)/.test(basename))
20
+ return true;
21
+ if (/tool/.test(basename))
22
+ return true;
23
+ return false;
24
+ }
25
+ /**
26
+ * Match `name: "..."`, `"name": '...'`, `name: \`...\`` (no interpolation).
27
+ * The key itself is captured so the same regex can harvest `description:`.
28
+ */
29
+ const STRING_PROP_RE = /(?:^|[\s,{(])(?:"([a-zA-Z_][\w]*)"|'([a-zA-Z_][\w]*)'|([a-zA-Z_][\w]*))\s*:\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|`([^`$]*)`)/g;
30
+ function collectStringProps(content, keyName) {
31
+ const hits = [];
32
+ STRING_PROP_RE.lastIndex = 0;
33
+ let match = STRING_PROP_RE.exec(content);
34
+ while (match !== null) {
35
+ const key = match[1] ?? match[2] ?? match[3];
36
+ const value = match[4] ?? match[5] ?? match[6];
37
+ const idx = match.index;
38
+ match = STRING_PROP_RE.exec(content);
39
+ if (key !== keyName || value === undefined)
40
+ continue;
41
+ // Count newlines in prefix to convert byte-offset -> 1-based line number.
42
+ let line = 1;
43
+ for (let i = 0; i < idx; i++) {
44
+ if (content.charCodeAt(i) === 10)
45
+ line += 1;
46
+ }
47
+ hits.push({ line, value });
48
+ }
49
+ return hits;
50
+ }
51
+ /**
52
+ * Match `inputSchema:` followed by a `{ ... }` object literal. The capture
53
+ * begins at the opening brace; the closing brace is resolved by
54
+ * {@link findBalancedObjectEnd} so nested objects and strings don't confuse
55
+ * the match.
56
+ */
57
+ const INPUT_SCHEMA_RE = /(?:^|[\s,{(])(?:"inputSchema"|'inputSchema'|inputSchema)\s*:\s*\{/g;
58
+ function collectInputSchemaLiterals(content) {
59
+ const hits = [];
60
+ INPUT_SCHEMA_RE.lastIndex = 0;
61
+ let match = INPUT_SCHEMA_RE.exec(content);
62
+ while (match !== null) {
63
+ const openBrace = match.index + match[0].length - 1;
64
+ const close = findBalancedObjectEnd(content, openBrace);
65
+ const idx = match.index;
66
+ // Resume scanning after the open brace so a malformed literal cannot
67
+ // wedge the loop.
68
+ INPUT_SCHEMA_RE.lastIndex = openBrace + 1;
69
+ match = INPUT_SCHEMA_RE.exec(content);
70
+ if (close === -1)
71
+ continue;
72
+ const rawObjectLiteral = content.slice(openBrace, close + 1);
73
+ let line = 1;
74
+ for (let i = 0; i < idx; i++) {
75
+ if (content.charCodeAt(i) === 10)
76
+ line += 1;
77
+ }
78
+ hits.push({ line, rawObjectLiteral });
79
+ }
80
+ return hits;
81
+ }
82
+ /**
83
+ * Walk forward from `start` (pointing at `{`) and return the index of the
84
+ * matching `}`, or -1 when the brace is unbalanced / the source runs out.
85
+ * Single-, double-, and backtick-string literals are skipped so a brace
86
+ * inside a string doesn't fool depth counting.
87
+ */
88
+ function findBalancedObjectEnd(source, start) {
89
+ if (source.charCodeAt(start) !== 0x7b /* { */)
90
+ return -1;
91
+ let depth = 0;
92
+ let i = start;
93
+ const n = source.length;
94
+ while (i < n) {
95
+ const ch = source.charCodeAt(i);
96
+ if (ch === 0x22 /* " */ || ch === 0x27 /* ' */ || ch === 0x60 /* ` */) {
97
+ const next = skipString(source, i, ch);
98
+ if (next === -1)
99
+ return -1;
100
+ i = next;
101
+ continue;
102
+ }
103
+ if (ch === 0x7b /* { */) {
104
+ depth += 1;
105
+ }
106
+ else if (ch === 0x7d /* } */) {
107
+ depth -= 1;
108
+ if (depth === 0)
109
+ return i;
110
+ }
111
+ i += 1;
112
+ }
113
+ return -1;
114
+ }
115
+ function skipString(source, start, quote) {
116
+ const n = source.length;
117
+ let i = start + 1;
118
+ while (i < n) {
119
+ const ch = source.charCodeAt(i);
120
+ if (ch === 0x5c /* \ */) {
121
+ // Skip escape sequence (conservatively consume one trailing char).
122
+ i += 2;
123
+ continue;
124
+ }
125
+ if (ch === quote)
126
+ return i + 1;
127
+ i += 1;
128
+ }
129
+ return -1;
130
+ }
131
+ /**
132
+ * Translate an object literal written in relaxed JS syntax (single quotes,
133
+ * unquoted keys, trailing commas) into strict canonical JSON sorted by key.
134
+ * Returns `undefined` when the literal is too exotic to normalize safely
135
+ * (template strings, bareword values, computed keys).
136
+ */
137
+ export function canonicalizeObjectLiteral(literal) {
138
+ const jsonLike = relaxedToJson(literal);
139
+ if (jsonLike === undefined)
140
+ return undefined;
141
+ let parsed;
142
+ try {
143
+ parsed = JSON.parse(jsonLike);
144
+ }
145
+ catch {
146
+ return undefined;
147
+ }
148
+ return stableStringify(parsed);
149
+ }
150
+ function stableStringify(value) {
151
+ if (value === null || typeof value !== "object") {
152
+ return JSON.stringify(value);
153
+ }
154
+ if (Array.isArray(value)) {
155
+ return `[${value.map((v) => stableStringify(v)).join(",")}]`;
156
+ }
157
+ const entries = Object.entries(value)
158
+ .filter(([, v]) => v !== undefined)
159
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
160
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
161
+ }
162
+ /**
163
+ * Rewrite a JS-ish object/array literal so `JSON.parse` accepts it:
164
+ * - single-quoted strings to double-quoted.
165
+ * - unquoted identifier keys to double-quoted keys.
166
+ * - trailing commas stripped.
167
+ * Template strings and bareword values produce `undefined` so the caller
168
+ * falls back to "no schema captured".
169
+ */
170
+ function relaxedToJson(literal) {
171
+ let out = "";
172
+ let i = 0;
173
+ const n = literal.length;
174
+ while (i < n) {
175
+ const ch = literal[i];
176
+ if (ch === '"') {
177
+ const end = findStringEnd(literal, i, 0x22);
178
+ if (end === -1)
179
+ return undefined;
180
+ out += literal.slice(i, end + 1);
181
+ i = end + 1;
182
+ continue;
183
+ }
184
+ if (ch === "'") {
185
+ const end = findStringEnd(literal, i, 0x27);
186
+ if (end === -1)
187
+ return undefined;
188
+ out += `"${jsSingleQuotedToJsonInner(literal.slice(i + 1, end))}"`;
189
+ i = end + 1;
190
+ continue;
191
+ }
192
+ if (ch === "`")
193
+ return undefined;
194
+ if (ch !== undefined && /[A-Za-z_$]/.test(ch)) {
195
+ let j = i;
196
+ while (j < n) {
197
+ const cj = literal[j];
198
+ if (cj === undefined || !/[A-Za-z0-9_$]/.test(cj))
199
+ break;
200
+ j += 1;
201
+ }
202
+ const ident = literal.slice(i, j);
203
+ if (ident === "true" || ident === "false" || ident === "null") {
204
+ out += ident;
205
+ i = j;
206
+ continue;
207
+ }
208
+ let k = j;
209
+ while (k < n && /\s/.test(literal[k] ?? ""))
210
+ k += 1;
211
+ if (literal[k] === ":") {
212
+ out += `"${ident}"`;
213
+ i = j;
214
+ continue;
215
+ }
216
+ return undefined;
217
+ }
218
+ if (ch === ",") {
219
+ let k = i + 1;
220
+ while (k < n && /\s/.test(literal[k] ?? ""))
221
+ k += 1;
222
+ const next = literal[k];
223
+ if (next === "}" || next === "]") {
224
+ i = k;
225
+ continue;
226
+ }
227
+ }
228
+ out += ch ?? "";
229
+ i += 1;
230
+ }
231
+ return out;
232
+ }
233
+ /**
234
+ * Translate the *inside* of a JS single-quoted string literal into the
235
+ * inside of a JSON double-quoted string literal, character by character:
236
+ *
237
+ * - `\'` (a JS-only escape) becomes `'` — not legal inside a JSON
238
+ * double-quoted string.
239
+ * - JSON-recognized escapes (`\"`, `\\`, `\/`, `\b`, `\f`, `\n`, `\r`,
240
+ * `\t`, `\uXXXX`) pass through unchanged.
241
+ * - Any other `\X` JS escape that JSON does not understand has its
242
+ * leading backslash doubled so the parser sees the literal characters.
243
+ * - A bare `"` is escaped to `\"`.
244
+ *
245
+ * The character-by-character pass replaces a chained `replace()` sequence
246
+ * that doubled every `\` and broke valid escapes like `\n`. Without the
247
+ * pass, an input containing `\"` would have produced malformed JSON —
248
+ * the js/incomplete-sanitization defect.
249
+ */
250
+ function jsSingleQuotedToJsonInner(inner) {
251
+ const JSON_SIMPLE_ESCAPE = /^["\\/bfnrt]$/;
252
+ const HEX = /^[0-9a-fA-F]$/;
253
+ let out = "";
254
+ for (let i = 0; i < inner.length; i += 1) {
255
+ const ch = inner[i];
256
+ if (ch === "\\") {
257
+ const next = inner[i + 1] ?? "";
258
+ if (next === "'") {
259
+ // JS-only escape — drop the backslash, keep the quote.
260
+ out += "'";
261
+ i += 1;
262
+ continue;
263
+ }
264
+ if (JSON_SIMPLE_ESCAPE.test(next)) {
265
+ // Pass `\\`, `\"`, `\/`, `\b`, `\f`, `\n`, `\r`, `\t` through.
266
+ out += `\\${next}`;
267
+ i += 1;
268
+ continue;
269
+ }
270
+ if (next === "u" &&
271
+ HEX.test(inner[i + 2] ?? "") &&
272
+ HEX.test(inner[i + 3] ?? "") &&
273
+ HEX.test(inner[i + 4] ?? "") &&
274
+ HEX.test(inner[i + 5] ?? "")) {
275
+ out += inner.slice(i, i + 6);
276
+ i += 5;
277
+ continue;
278
+ }
279
+ // Unknown JS escape (e.g. `\x41`, `\0`) or a stray backslash —
280
+ // double it so the literal `\` survives the JSON parser.
281
+ out += "\\\\";
282
+ continue;
283
+ }
284
+ if (ch === '"') {
285
+ out += '\\"';
286
+ continue;
287
+ }
288
+ out += ch;
289
+ }
290
+ return out;
291
+ }
292
+ function findStringEnd(src, start, quote) {
293
+ let i = start + 1;
294
+ const n = src.length;
295
+ while (i < n) {
296
+ const ch = src.charCodeAt(i);
297
+ if (ch === 0x5c /* \ */) {
298
+ i += 2;
299
+ continue;
300
+ }
301
+ if (ch === quote)
302
+ return i;
303
+ i += 1;
304
+ }
305
+ return -1;
306
+ }
307
+ /**
308
+ * Emit one `ExtractedTool` per `{ name, description }` literal pair found in
309
+ * the same 5-line window. Duplicates (same `toolName` + `description`) are
310
+ * de-duplicated per file; cross-file de-duplication is a later phase concern.
311
+ */
312
+ export function detectMcpTools(input) {
313
+ const { filePath, content } = input;
314
+ if (!filePathLooksLikeTool(filePath))
315
+ return [];
316
+ if (!/\bname\b/.test(content) || !/\bdescription\b/.test(content))
317
+ return [];
318
+ const names = collectStringProps(content, "name");
319
+ const descriptions = collectStringProps(content, "description");
320
+ if (names.length === 0 || descriptions.length === 0)
321
+ return [];
322
+ const schemas = collectInputSchemaLiterals(content);
323
+ const seen = new Set();
324
+ const out = [];
325
+ for (const name of names) {
326
+ // Pick the nearest description within 5 lines in either direction.
327
+ let best;
328
+ let bestDistance = Number.POSITIVE_INFINITY;
329
+ for (const desc of descriptions) {
330
+ const distance = Math.abs(desc.line - name.line);
331
+ if (distance <= 5 && distance < bestDistance) {
332
+ best = desc;
333
+ bestDistance = distance;
334
+ }
335
+ }
336
+ if (best === undefined)
337
+ continue;
338
+ const key = `${name.value}\u0000${best.value}`;
339
+ if (seen.has(key))
340
+ continue;
341
+ seen.add(key);
342
+ // Pair the nearest inputSchema literal within a 10-line window. Schemas
343
+ // often live a few lines below the name/description pair so we allow a
344
+ // wider span than description pairing.
345
+ let bestSchema;
346
+ let bestSchemaDistance = Number.POSITIVE_INFINITY;
347
+ for (const s of schemas) {
348
+ const distance = Math.abs(s.line - name.line);
349
+ if (distance <= 10 && distance < bestSchemaDistance) {
350
+ bestSchema = s;
351
+ bestSchemaDistance = distance;
352
+ }
353
+ }
354
+ const inputSchemaJson = bestSchema !== undefined ? canonicalizeObjectLiteral(bestSchema.rawObjectLiteral) : undefined;
355
+ out.push({
356
+ toolName: name.value,
357
+ handlerFile: filePath,
358
+ description: best.value,
359
+ ...(inputSchemaJson !== undefined ? { inputSchemaJson } : {}),
360
+ });
361
+ }
362
+ return out;
363
+ }
364
+ //# sourceMappingURL=tool-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-detector.js","sourceRoot":"","sources":["../../src/extract/tool-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,8DAA8D;AAC9D,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,kEAAkE;IAClE,IAAI,0BAA0B,CAAC,IAAI,C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AAI,CAAC,KAAK,EAAE,CAAC;QAC/C,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,wEAAwE;QACxE,uEAAuE;QACvE,uCAAuC;QACvC,IAAI,UAAsC,CAAC;QAC3C,IAAI,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAClD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,IAAI,QAAQ,IAAI,EAAE,IAAI,QAAQ,GAAG,kBAAkB,EAAE,CAAC;gBACpD,UAAU,GAAG,CAAC,CAAC;gBACf,kBAAkB,GAAG,QAAQ,CAAC;YAChC,CAAC;QACH,CAAC;QACD,MAAM,eAAe,GACnB,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAChG,GAAG,CAAC,IAAI,CAAC;YACP,QAAQ,EAAE,IAAI,CAAC,KAAK;YACpB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,IAAI,CAAC,KAAK;YACvB,GAAG,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Shared extraction result shapes for the route / tool / ORM detectors.
3
+ *
4
+ * These types are deliberately minimal: they describe the evidence a detector
5
+ * has discovered in a single file (or, for filesystem-routed frameworks, a
6
+ * group of files) without taking any dependency on the graph schema. The
7
+ * routes / tools / orm pipeline phases turn these records into graph nodes
8
+ * and edges.
9
+ */
10
+ /** A handler-to-URL mapping discovered by a route detector. */
11
+ export interface ExtractedRoute {
12
+ /** Canonical URL path with `{param}` / `{+catchAll}` placeholders. */
13
+ readonly url: string;
14
+ /** HTTP method in uppercase, or `undefined` for filesystem pages. */
15
+ readonly method?: string;
16
+ /** Repo-relative path to the file that declared the route. */
17
+ readonly handlerFile: string;
18
+ /** Middleware identifiers observed on the route chain, in source order. */
19
+ readonly middleware?: readonly string[];
20
+ /** Response payload keys scraped from the handler body (best effort). */
21
+ readonly responseKeys?: readonly string[];
22
+ /** Framework the detector is claiming. */
23
+ readonly framework: "nextjs" | "express" | "fastapi" | "spring" | "nestjs" | "rails" | "unknown";
24
+ }
25
+ /** A single tool definition (MCP / JSON-RPC) discovered by heuristic scan. */
26
+ export interface ExtractedTool {
27
+ /** Name string from the tool definition literal. */
28
+ readonly toolName: string;
29
+ /** Repo-relative path to the file that declared the tool. */
30
+ readonly handlerFile: string;
31
+ /** Description string from the tool definition literal, if present. */
32
+ readonly description?: string;
33
+ /**
34
+ * Canonical (key-sorted) JSON-encoded `inputSchema` literal harvested
35
+ * from the tool definition object, when present. Absent when the
36
+ * detector can't find a parseable literal nearby.
37
+ */
38
+ readonly inputSchemaJson?: string;
39
+ }
40
+ /** A file -> ORM model call edge discovered by regex scan. */
41
+ export interface ExtractedOrmEdge {
42
+ /** Repo-relative path to the caller. */
43
+ readonly callerFile: string;
44
+ /** Model / table identifier as written in source. */
45
+ readonly modelName: string;
46
+ /** Operation identifier (e.g. "findMany", "create", "select"). */
47
+ readonly operation: string;
48
+ /** ORM family this edge belongs to. */
49
+ readonly orm: "prisma" | "supabase";
50
+ /** Detector confidence in [0, 1]. */
51
+ readonly confidence: number;
52
+ /**
53
+ * Provenance tag: `"receiver-confirmed"` when the receiver type was
54
+ * confirmed via import graph or ts-morph, `"heuristic"` when the emit
55
+ * was based on regex alone (legacy behavior, used only when
56
+ * `strictDetectors` is false and no import map is available).
57
+ */
58
+ readonly reason?: "receiver-confirmed" | "heuristic";
59
+ }
60
+ /**
61
+ * Input bundle passed to file-scoped detectors. The `captures` field is
62
+ * reserved for a future AST-driven path and is unused at MVP; detectors rely
63
+ * on the file path and raw UTF-8 content.
64
+ *
65
+ * `importsByFile` + `tsMorphProject` are the P06 plumbing used by the
66
+ * receiver resolver to confirm that a call's receiver truly originates
67
+ * from the framework the detector claims. Both are optional — when
68
+ * absent, detectors fall back to the pre-P06 regex-only behavior unless
69
+ * `strictDetectors` is set.
70
+ */
71
+ export interface ExtractInput {
72
+ readonly filePath: string;
73
+ readonly content: string;
74
+ readonly captures?: readonly unknown[];
75
+ /**
76
+ * Per-file import declarations the parse phase already extracted.
77
+ * Used by the receiver resolver's fast path.
78
+ */
79
+ readonly importsByFile?: ReadonlyMap<string, readonly import("./receiver-resolver.js").ImportedSymbol[]>;
80
+ /** Optional ts-morph project for the receiver resolver's type-check path. */
81
+ readonly tsMorphProject?: import("./receiver-resolver.js").TsMorphProject;
82
+ /**
83
+ * When `true`, drop heuristic-only matches entirely — detectors emit
84
+ * only records whose receiver resolved successfully. Exposed through
85
+ * the `codehub analyze --strict-detectors` flag.
86
+ */
87
+ readonly strictDetectors?: boolean;
88
+ }
89
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/extract/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;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,CAAC,EAAE,OAAO,wBAAwB,EAAE,cAAc,CAAC;IAC1E;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Shared extraction result shapes for the route / tool / ORM detectors.
3
+ *
4
+ * These types are deliberately minimal: they describe the evidence a detector
5
+ * has discovered in a single file (or, for filesystem-routed frameworks, a
6
+ * group of files) without taking any dependency on the graph schema. The
7
+ * routes / tools / orm pipeline phases turn these records into graph nodes
8
+ * and edges.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/extract/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @opencodehub/ingestion — indexing pipeline root barrel.
3
+ *
4
+ * Exports the `parse`, `providers`, and `pipeline` subsystems. Extending
5
+ * the default phase set does not change the exported shape.
6
+ */
7
+ export * as parse from "./parse/index.js";
8
+ export * as pipeline from "./pipeline/index.js";
9
+ export * as providers from "./providers/index.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @opencodehub/ingestion — indexing pipeline root barrel.
3
+ *
4
+ * Exports the `parse`, `providers`, and `pipeline` subsystems. Extending
5
+ * the default phase set does not change the exported shape.
6
+ */
7
+ export * as parse from "./parse/index.js";
8
+ export * as pipeline from "./pipeline/index.js";
9
+ export * as providers from "./providers/index.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * COBOL regex hot path.
3
+ *
4
+ * Pure-function extractor for fixed-format COBOL files (`.cbl`, `.cob`,
5
+ * `.cpy`). Emits {@link CobolElement} records for the five targets that a
6
+ * human reader would use to navigate a legacy mainframe program:
7
+ *
8
+ * - `program-id` — `PROGRAM-ID. <name>.`, one per file
9
+ * - `paragraph` — labels in Area A: `^[ ]{7}[A-Z0-9][A-Z0-9-]*\.`
10
+ * - `perform` — `PERFORM <identifier>`, each occurrence (heuristic
11
+ * CALL-like reference; the enclosing paragraph is the
12
+ * caller)
13
+ * - `copy` — `COPY <name>`, each occurrence (copybook inclusion)
14
+ * - `cics` — `EXEC CICS ... END-EXEC` spans (multi-line aware)
15
+ *
16
+ * ## Fixed-format COBOL refresher
17
+ *
18
+ * Columns 1-6 sequence numbers (ignored)
19
+ * Column 7 indicator area: `*` or `/` = comment line, `-` =
20
+ * continuation, `D` = debugging aid, ` ` = normal
21
+ * Columns 8-11 Area A: divisions, sections, paragraphs
22
+ * Columns 12-72 Area B: statements
23
+ * Columns 73-80 identification (ignored)
24
+ *
25
+ * The default parse path runs at ≤ 1 ms on 1000-line fixtures; a p50
26
+ * regression in that number is a graph-ingestion regression.
27
+ *
28
+ * ## Anti-goals
29
+ *
30
+ * - NOT a full parse: `PERFORM ... THRU ... VARYING`, `COPY ... REPLACING
31
+ * ==tag== BY ==value==`, and nested `EXEC SQL` blocks are all resolved
32
+ * heuristically. The deep-parse path (ProLeap, when wired in) owns the
33
+ * precise AST.
34
+ * - NOT free-format aware: the 99% legacy estate is fixed-format;
35
+ * free-format COBOL (column-0 start) lands with the ProLeap backend.
36
+ * - NO filesystem I/O, NO subprocesses, NO external deps. The function
37
+ * is pure over `(path, content)`.
38
+ *
39
+ * ## Author's note
40
+ *
41
+ * The regex vocabulary here (PROGRAM-ID, PARAGRAPH, PERFORM, COPY, CICS) is
42
+ * explicitly allow-listed in `scripts/check-banned-strings.sh` (U2 in spec
43
+ * 004) because it's the standard public COBOL surface.
44
+ */
45
+ import type { LanguageId } from "./types.js";
46
+ /** Tag for the kind of construct a {@link CobolElement} describes. */
47
+ export type CobolElementKind = "program-id" | "paragraph" | "perform" | "copy" | "cics";
48
+ /**
49
+ * One element extracted from a COBOL file. The pipeline maps these to
50
+ * `CodeElement` graph nodes downstream (see `pipeline/phases/parse.ts`).
51
+ *
52
+ * Line numbers are 1-indexed. `endLine` equals `startLine` for the
53
+ * single-line PROGRAM-ID, paragraph, PERFORM, and COPY markers; CICS
54
+ * spans cover the `EXEC CICS` → `END-EXEC` range.
55
+ */
56
+ export interface CobolElement {
57
+ readonly kind: CobolElementKind;
58
+ /** Program name, paragraph label, target identifier, or copybook name. */
59
+ readonly name: string;
60
+ readonly filePath: string;
61
+ readonly startLine: number;
62
+ readonly endLine: number;
63
+ readonly language: LanguageId;
64
+ /** Regex extraction is not a parse; the confidence tier says so. */
65
+ readonly confidence: "heuristic";
66
+ /**
67
+ * Optional human-readable snippet — the matched line (or first line of a
68
+ * multi-line CICS block), whitespace-trimmed. Kept short so graph-node
69
+ * payloads stay deterministic and compact.
70
+ */
71
+ readonly snippet?: string;
72
+ }
73
+ export interface CobolRegexResult {
74
+ readonly elements: readonly CobolElement[];
75
+ /** Every `COPY <name>` target referenced by this file, deduped + sorted. */
76
+ readonly copybookRefs: readonly string[];
77
+ /** Non-fatal notes (e.g. malformed CICS block). Empty on happy path. */
78
+ readonly diagnostics: readonly string[];
79
+ }
80
+ /**
81
+ * Parse a COBOL file and return the extracted element set. Pure function;
82
+ * safe to call from any thread / worker.
83
+ */
84
+ export declare function parseCobolFile(path: string, content: string): CobolRegexResult;
85
+ //# sourceMappingURL=cobol-regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cobol-regex.d.ts","sourceRoot":"","sources":["../../src/parse/cobol-regex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAExF;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC;AAgED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA8K9E"}