@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,118 @@
1
+ /**
2
+ * Tools phase — materialises MCP / JSON-RPC tool definitions as graph
3
+ * nodes and edges.
4
+ *
5
+ * For every scanned JS/TS file we run the heuristic MCP tool detector; each
6
+ * `{ name, description }` pair it returns becomes a `Tool` node keyed by
7
+ * handler file + tool name. `HANDLES_TOOL` edges connect each declaring
8
+ * File node to the tool with confidence 0.85.
9
+ *
10
+ * Duplicate tool names across files are tallied and warned globally — a
11
+ * common sign that two modules registered the same slug, which agent
12
+ * runtimes will reject at dispatch time.
13
+ */
14
+ import { promises as fs } from "node:fs";
15
+ import { makeNodeId } from "@opencodehub/core-types";
16
+ import { detectMcpTools } from "../../extract/tool-detector.js";
17
+ import { PARSE_PHASE_NAME } from "./parse.js";
18
+ import { SCAN_PHASE_NAME } from "./scan.js";
19
+ const JS_TS_EXTS = new Set([
20
+ ".ts",
21
+ ".tsx",
22
+ ".mts",
23
+ ".cts",
24
+ ".js",
25
+ ".jsx",
26
+ ".mjs",
27
+ ".cjs",
28
+ ]);
29
+ export const TOOLS_PHASE_NAME = "tools";
30
+ export const toolsPhase = {
31
+ name: TOOLS_PHASE_NAME,
32
+ deps: [PARSE_PHASE_NAME],
33
+ async run(ctx) {
34
+ const scan = ctx.phaseOutputs.get(SCAN_PHASE_NAME);
35
+ if (scan === undefined) {
36
+ throw new Error("tools: scan output missing from phase outputs");
37
+ }
38
+ return runTools(ctx, scan);
39
+ },
40
+ };
41
+ async function runTools(ctx, scan) {
42
+ const candidates = scan.files.filter((f) => JS_TS_EXTS.has(extLower(f.relPath)));
43
+ const collected = [];
44
+ for (const f of candidates) {
45
+ let content;
46
+ try {
47
+ const buf = await fs.readFile(f.absPath);
48
+ content = buf.toString("utf8");
49
+ }
50
+ catch (err) {
51
+ ctx.onProgress?.({
52
+ phase: TOOLS_PHASE_NAME,
53
+ kind: "warn",
54
+ message: `tools: cannot read ${f.relPath}: ${err.message}`,
55
+ });
56
+ continue;
57
+ }
58
+ for (const t of detectMcpTools({ filePath: f.relPath, content })) {
59
+ collected.push(t);
60
+ }
61
+ }
62
+ // Global duplicate detection keyed purely on tool name.
63
+ const nameCounts = new Map();
64
+ for (const t of collected) {
65
+ nameCounts.set(t.toolName, (nameCounts.get(t.toolName) ?? 0) + 1);
66
+ }
67
+ // Stable order for byte-identical graph output.
68
+ const ordered = [...collected].sort(compareTool);
69
+ let duplicateCount = 0;
70
+ const warnedNames = new Set();
71
+ let toolCount = 0;
72
+ for (const t of ordered) {
73
+ const toolId = makeNodeId("Tool", t.handlerFile, t.toolName);
74
+ const node = {
75
+ id: toolId,
76
+ kind: "Tool",
77
+ name: t.toolName,
78
+ filePath: t.handlerFile,
79
+ toolName: t.toolName,
80
+ ...(t.description !== undefined ? { description: t.description } : {}),
81
+ ...(t.inputSchemaJson !== undefined ? { inputSchemaJson: t.inputSchemaJson } : {}),
82
+ };
83
+ ctx.graph.addNode(node);
84
+ toolCount += 1;
85
+ const fileId = makeNodeId("File", t.handlerFile, t.handlerFile);
86
+ ctx.graph.addEdge({
87
+ from: fileId,
88
+ to: toolId,
89
+ type: "HANDLES_TOOL",
90
+ confidence: 0.85,
91
+ reason: "mcp-tool-definition",
92
+ });
93
+ if ((nameCounts.get(t.toolName) ?? 0) > 1 && !warnedNames.has(t.toolName)) {
94
+ warnedNames.add(t.toolName);
95
+ duplicateCount += 1;
96
+ ctx.onProgress?.({
97
+ phase: TOOLS_PHASE_NAME,
98
+ kind: "warn",
99
+ message: `tools: duplicate tool name '${t.toolName}' declared in multiple files`,
100
+ });
101
+ }
102
+ }
103
+ return { toolCount, duplicateCount };
104
+ }
105
+ function compareTool(a, b) {
106
+ if (a.handlerFile !== b.handlerFile)
107
+ return a.handlerFile < b.handlerFile ? -1 : 1;
108
+ if (a.toolName !== b.toolName)
109
+ return a.toolName < b.toolName ? -1 : 1;
110
+ return 0;
111
+ }
112
+ function extLower(relPath) {
113
+ const idx = relPath.lastIndexOf(".");
114
+ if (idx < 0)
115
+ return "";
116
+ return relPath.slice(idx).toLowerCase();
117
+ }
118
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/pipeline/phases/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAmB,MAAM,WAAW,CAAC;AAE7D,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC;IAC9C,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,gBAAgB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AC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe;IAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * API contract detection.
3
+ *
4
+ * Four categories:
5
+ * - openapi — `openapi.{yaml,json}` / `swagger.{yaml,json}` at a known
6
+ * location, OR any YAML/JSON file whose header contains
7
+ * `openapi: 3.` or `swagger: 2.`.
8
+ * - graphql — any `.graphql` / `.gql` file OR `schema.graphql`.
9
+ * - grpc — any `.proto` file.
10
+ * - asyncapi — `asyncapi.yaml`.
11
+ *
12
+ * Content sniffing is capped the same way as `iac.ts`.
13
+ *
14
+ * Determinism: sorted list of category names.
15
+ */
16
+ import type { ScannedFile } from "../phases/scan.js";
17
+ export declare function detectApiContracts(repoRoot: string, files: readonly ScannedFile[]): Promise<readonly string[]>;
18
+ //# sourceMappingURL=api-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-contracts.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/api-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CA0D5B"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * API contract detection.
3
+ *
4
+ * Four categories:
5
+ * - openapi — `openapi.{yaml,json}` / `swagger.{yaml,json}` at a known
6
+ * location, OR any YAML/JSON file whose header contains
7
+ * `openapi: 3.` or `swagger: 2.`.
8
+ * - graphql — any `.graphql` / `.gql` file OR `schema.graphql`.
9
+ * - grpc — any `.proto` file.
10
+ * - asyncapi — `asyncapi.yaml`.
11
+ *
12
+ * Content sniffing is capped the same way as `iac.ts`.
13
+ *
14
+ * Determinism: sorted list of category names.
15
+ */
16
+ import { promises as fs } from "node:fs";
17
+ import path from "node:path";
18
+ /** Maximum YAML/JSON files we sniff for an OpenAPI / Swagger marker. */
19
+ const CONTENT_SNIFF_CAP = 40;
20
+ const SNIFF_BYTES = 1000;
21
+ const OPENAPI_FILENAME_RE = /^(?:[^/]*\/)*(openapi|swagger)\.(ya?ml|json)$/i;
22
+ export async function detectApiContracts(repoRoot, files) {
23
+ const hits = new Set();
24
+ for (const f of files) {
25
+ const rel = f.relPath;
26
+ const lowered = rel.toLowerCase();
27
+ if (lowered.endsWith(".graphql") || lowered.endsWith(".gql")) {
28
+ hits.add("graphql");
29
+ }
30
+ if (lowered.endsWith(".proto")) {
31
+ hits.add("grpc");
32
+ }
33
+ if (rel === "asyncapi.yaml" || rel === "asyncapi.yml") {
34
+ hits.add("asyncapi");
35
+ }
36
+ if (OPENAPI_FILENAME_RE.test(rel)) {
37
+ hits.add("openapi");
38
+ }
39
+ }
40
+ // Content sniff for openapi / swagger markers if we did not already detect
41
+ // one via filename. This picks up hand-named schema files (e.g.
42
+ // `docs/api-spec.yaml`).
43
+ if (!hits.has("openapi")) {
44
+ const candidates = files
45
+ .filter((f) => {
46
+ const l = f.relPath.toLowerCase();
47
+ return l.endsWith(".yaml") || l.endsWith(".yml") || l.endsWith(".json");
48
+ })
49
+ .slice(0, CONTENT_SNIFF_CAP);
50
+ for (const f of candidates) {
51
+ let header = "";
52
+ try {
53
+ const fh = await fs.open(path.join(repoRoot, f.relPath), "r");
54
+ try {
55
+ const buf = new Uint8Array(SNIFF_BYTES);
56
+ const { bytesRead } = await fh.read(buf, 0, SNIFF_BYTES, 0);
57
+ header = Buffer.from(buf.buffer, buf.byteOffset, bytesRead).toString("utf8");
58
+ }
59
+ finally {
60
+ await fh.close();
61
+ }
62
+ }
63
+ catch {
64
+ continue;
65
+ }
66
+ if (/"?openapi"?\s*:\s*"?3\./.test(header) || /^\s*openapi\s*:\s*['"]?3\./m.test(header)) {
67
+ hits.add("openapi");
68
+ break;
69
+ }
70
+ if (/"?swagger"?\s*:\s*"?2\./.test(header) || /^\s*swagger\s*:\s*['"]?2\./m.test(header)) {
71
+ hits.add("openapi");
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ return [...hits].sort();
77
+ }
78
+ //# sourceMappingURL=api-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-contracts.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/api-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,wEAAwE;AACxE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,MAAM,mBAAmB,GAAG,gDAAgD,CAAC;AAE7E,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,KAA6B;IAE7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC;QACtB,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAElC,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,OAAO,CAAC,QAAQ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,EAAE,CAAC,CAAC,CAAC;oBAC5D,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAC/E,CAAC;wBAAS,CAAC;oBACT,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;gBACnB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,SAAS;YACX,CAAC;YACD,IAAI,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzF,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACpB,MAAM;YACR,CAAC;YACD,IAAI,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzF,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACpB,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Back-compat shim for `framework-detector`.
3
+ *
4
+ * Re-exports the framework dispatcher from `@opencodehub/frameworks` so
5
+ * callers that still import from the old profile-detectors path continue
6
+ * to compile. Slated for removal after one release.
7
+ *
8
+ * @deprecated Import from `@opencodehub/frameworks` instead.
9
+ */
10
+ export { detectFrameworksStructured, type FrameworkDetectorInput, } from "@opencodehub/frameworks";
11
+ //# sourceMappingURL=framework-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-detector.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/framework-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Back-compat shim for `framework-detector`.
3
+ *
4
+ * Re-exports the framework dispatcher from `@opencodehub/frameworks` so
5
+ * callers that still import from the old profile-detectors path continue
6
+ * to compile. Slated for removal after one release.
7
+ *
8
+ * @deprecated Import from `@opencodehub/frameworks` instead.
9
+ */
10
+ export { detectFrameworksStructured, } from "@opencodehub/frameworks";
11
+ //# sourceMappingURL=framework-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-detector.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/framework-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,0BAA0B,GAE3B,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Back-compat shim for the legacy `frameworks-catalog` module.
3
+ *
4
+ * @deprecated Import from `@opencodehub/frameworks` instead.
5
+ */
6
+ export { FRAMEWORK_CATALOG, type FrameworkEcosystem, type FrameworkRule, type FrameworkTier, type ManifestKey, type VariantDefinition, } from "@opencodehub/frameworks";
7
+ //# sourceMappingURL=frameworks-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks-catalog.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/frameworks-catalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Back-compat shim for the legacy `frameworks-catalog` module.
3
+ *
4
+ * @deprecated Import from `@opencodehub/frameworks` instead.
5
+ */
6
+ export { FRAMEWORK_CATALOG, } from "@opencodehub/frameworks";
7
+ //# sourceMappingURL=frameworks-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks-catalog.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/frameworks-catalog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,GAMlB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Back-compat shim for the legacy `frameworks` entrypoints.
3
+ *
4
+ * @deprecated Import from `@opencodehub/frameworks` instead.
5
+ */
6
+ export { detectFrameworks, detectFrameworksDetailed, type FrameworkDetectionInput, type FrameworkFileInput, } from "@opencodehub/frameworks";
7
+ //# sourceMappingURL=frameworks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/frameworks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Back-compat shim for the legacy `frameworks` entrypoints.
3
+ *
4
+ * @deprecated Import from `@opencodehub/frameworks` instead.
5
+ */
6
+ export { detectFrameworks, detectFrameworksDetailed, } from "@opencodehub/frameworks";
7
+ //# sourceMappingURL=frameworks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/frameworks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GAGzB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * IaC (Infrastructure-as-Code) detection.
3
+ *
4
+ * Seven categories in priority order:
5
+ * - terraform — any `.tf` or `.tf.json`
6
+ * - docker-compose — `docker-compose.yml` / `compose.yaml`
7
+ * - docker — `Dockerfile` or `Dockerfile.*`
8
+ * - kubernetes — YAML with `apiVersion:` + `kind:` at top
9
+ * - cloudformation — YAML/JSON with `AWSTemplateFormatVersion:`
10
+ * - cdk — `cdk.json` at repo root
11
+ * - pulumi — `Pulumi.yaml`
12
+ *
13
+ * Kubernetes/CloudFormation are content-sniffed (we read the first 1000
14
+ * bytes) because their file extensions (.yaml/.yml/.json) are ambiguous and
15
+ * collide with every other YAML/JSON artifact in the repo. To bound IO cost
16
+ * we cap the number of YAML/JSON files we peek at per category.
17
+ *
18
+ * Determinism: the output is a sorted list of IaC category names.
19
+ */
20
+ import type { ScannedFile } from "../phases/scan.js";
21
+ export declare function detectIaCTypes(repoRoot: string, files: readonly ScannedFile[]): Promise<readonly string[]>;
22
+ //# sourceMappingURL=iac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iac.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/iac.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUrD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CA8E5B"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * IaC (Infrastructure-as-Code) detection.
3
+ *
4
+ * Seven categories in priority order:
5
+ * - terraform — any `.tf` or `.tf.json`
6
+ * - docker-compose — `docker-compose.yml` / `compose.yaml`
7
+ * - docker — `Dockerfile` or `Dockerfile.*`
8
+ * - kubernetes — YAML with `apiVersion:` + `kind:` at top
9
+ * - cloudformation — YAML/JSON with `AWSTemplateFormatVersion:`
10
+ * - cdk — `cdk.json` at repo root
11
+ * - pulumi — `Pulumi.yaml`
12
+ *
13
+ * Kubernetes/CloudFormation are content-sniffed (we read the first 1000
14
+ * bytes) because their file extensions (.yaml/.yml/.json) are ambiguous and
15
+ * collide with every other YAML/JSON artifact in the repo. To bound IO cost
16
+ * we cap the number of YAML/JSON files we peek at per category.
17
+ *
18
+ * Determinism: the output is a sorted list of IaC category names.
19
+ */
20
+ import { promises as fs } from "node:fs";
21
+ import path from "node:path";
22
+ /** Maximum YAML/JSON files we sniff for k8s/CloudFormation headers. */
23
+ const CONTENT_SNIFF_CAP = 40;
24
+ /** Bytes we read from each sniffed file. */
25
+ const SNIFF_BYTES = 1000;
26
+ const DOCKERFILE_RE = /^(?:[^/]*\/)*Dockerfile(?:\..+)?$/;
27
+ const COMPOSE_RE = /^(docker-compose\.ya?ml|compose\.ya?ml)$/;
28
+ export async function detectIaCTypes(repoRoot, files) {
29
+ const hits = new Set();
30
+ for (const f of files) {
31
+ const rel = f.relPath;
32
+ const lowered = rel.toLowerCase();
33
+ // terraform: any .tf or .tf.json
34
+ if (lowered.endsWith(".tf") || lowered.endsWith(".tf.json")) {
35
+ hits.add("terraform");
36
+ }
37
+ // docker-compose (root-only, composes nested in examples are ignored)
38
+ if (!rel.includes("/") && COMPOSE_RE.test(rel)) {
39
+ hits.add("docker-compose");
40
+ }
41
+ // docker
42
+ if (DOCKERFILE_RE.test(rel)) {
43
+ hits.add("docker");
44
+ }
45
+ // cdk
46
+ if (rel === "cdk.json") {
47
+ hits.add("cdk");
48
+ }
49
+ // pulumi
50
+ if (rel === "Pulumi.yaml") {
51
+ hits.add("pulumi");
52
+ }
53
+ }
54
+ // kubernetes + cloudformation need content sniffing. Collect YAML/JSON
55
+ // candidates, sort for determinism, cap total reads.
56
+ const sniffCandidates = files
57
+ .filter((f) => {
58
+ const l = f.relPath.toLowerCase();
59
+ return l.endsWith(".yaml") || l.endsWith(".yml") || l.endsWith(".json");
60
+ })
61
+ .filter(
62
+ // Skip files already covered by exact-match rules so we do not
63
+ // waste reads on `docker-compose.yml` or `Pulumi.yaml` / `cdk.json`.
64
+ (f) => f.relPath !== "Pulumi.yaml" && f.relPath !== "cdk.json" && !COMPOSE_RE.test(f.relPath))
65
+ .slice(0, CONTENT_SNIFF_CAP);
66
+ for (const f of sniffCandidates) {
67
+ let header = "";
68
+ try {
69
+ const fh = await fs.open(path.join(repoRoot, f.relPath), "r");
70
+ try {
71
+ const buf = new Uint8Array(SNIFF_BYTES);
72
+ const { bytesRead } = await fh.read(buf, 0, SNIFF_BYTES, 0);
73
+ header = Buffer.from(buf.buffer, buf.byteOffset, bytesRead).toString("utf8");
74
+ }
75
+ finally {
76
+ await fh.close();
77
+ }
78
+ }
79
+ catch {
80
+ continue;
81
+ }
82
+ if (header.includes("AWSTemplateFormatVersion")) {
83
+ hits.add("cloudformation");
84
+ continue;
85
+ }
86
+ // Kubernetes manifests carry `apiVersion:` and `kind:` near the top.
87
+ // Both must be present (CloudFormation templates also have `Resources:`
88
+ // but not `apiVersion:`).
89
+ const hasApiVersion = /^\s*apiVersion\s*:/m.test(header);
90
+ const hasKind = /^\s*kind\s*:/m.test(header);
91
+ if (hasApiVersion && hasKind) {
92
+ hits.add("kubernetes");
93
+ }
94
+ }
95
+ return [...hits].sort();
96
+ }
97
+ //# sourceMappingURL=iac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iac.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/iac.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,uEAAuE;AACvE,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,4CAA4C;AAC5C,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,MAAM,aAAa,GAAG,mCAAmC,CAAC;AAC1D,MAAM,UAAU,GAAG,0CAA0C,CAAC;AAE9D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,KAA6B;IAE7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,CAAC,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,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Language detection — counts scanned files per extension and emits the
3
+ * languages that clear either threshold:
4
+ * - ≥ 5 files of that language, OR
5
+ * - ≥ 1% of the total scanned files.
6
+ *
7
+ * The scan phase already attaches a `LanguageId` to every file whose
8
+ * extension resolves to one of the MVP tree-sitter grammars; we lift those
9
+ * into language *names* here (spelled-out keys for the ProjectProfile
10
+ * schema) so downstream scanners can match on strings like "typescript"
11
+ * or "python" without having to learn about `LanguageId`.
12
+ *
13
+ * Determinism: sorted by (count desc, name asc). Tied file counts keep
14
+ * deterministic output across runs.
15
+ */
16
+ import type { ScannedFile } from "../phases/scan.js";
17
+ export declare function detectLanguages(files: readonly ScannedFile[]): readonly string[];
18
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsBrD,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,MAAM,EAAE,CAyBhF"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Language detection — counts scanned files per extension and emits the
3
+ * languages that clear either threshold:
4
+ * - ≥ 5 files of that language, OR
5
+ * - ≥ 1% of the total scanned files.
6
+ *
7
+ * The scan phase already attaches a `LanguageId` to every file whose
8
+ * extension resolves to one of the MVP tree-sitter grammars; we lift those
9
+ * into language *names* here (spelled-out keys for the ProjectProfile
10
+ * schema) so downstream scanners can match on strings like "typescript"
11
+ * or "python" without having to learn about `LanguageId`.
12
+ *
13
+ * Determinism: sorted by (count desc, name asc). Tied file counts keep
14
+ * deterministic output across runs.
15
+ */
16
+ const LANGUAGE_NAME_BY_ID = {
17
+ typescript: "typescript",
18
+ tsx: "typescript",
19
+ javascript: "javascript",
20
+ python: "python",
21
+ go: "go",
22
+ rust: "rust",
23
+ java: "java",
24
+ csharp: "csharp",
25
+ // Extended-language names used by the ProjectProfile schema + downstream scanners.
26
+ c: "c",
27
+ cpp: "cpp",
28
+ ruby: "ruby",
29
+ kotlin: "kotlin",
30
+ swift: "swift",
31
+ php: "php",
32
+ dart: "dart",
33
+ cobol: "cobol",
34
+ };
35
+ export function detectLanguages(files) {
36
+ if (files.length === 0)
37
+ return [];
38
+ const total = files.length;
39
+ const counts = new Map();
40
+ for (const f of files) {
41
+ if (f.language === undefined)
42
+ continue;
43
+ const name = LANGUAGE_NAME_BY_ID[f.language];
44
+ counts.set(name, (counts.get(name) ?? 0) + 1);
45
+ }
46
+ const onePctThreshold = Math.max(1, Math.ceil(total * 0.01));
47
+ const qualifying = [];
48
+ for (const [name, count] of counts) {
49
+ if (count >= 5 || count >= onePctThreshold) {
50
+ qualifying.push([name, count]);
51
+ }
52
+ }
53
+ qualifying.sort((a, b) => {
54
+ if (b[1] !== a[1])
55
+ return b[1] - a[1];
56
+ return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
57
+ });
58
+ return qualifying.map(([name]) => name);
59
+ }
60
+ //# sourceMappingURL=languages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/languages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,mBAAmB,GAAyC;IAChE,UAAU,EAAE,YAAY;IACxB,GAAG,EAAE,YAAY;IACjB,UAAU,EAAE,YAAY;IACxB,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAA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K,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Back-compat shim for the legacy `manifests` module.
3
+ *
4
+ * @deprecated Import from `@opencodehub/frameworks` instead.
5
+ */
6
+ export { detectManifests } from "@opencodehub/frameworks";
7
+ //# sourceMappingURL=manifests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifests.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/manifests.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Back-compat shim for the legacy `manifests` module.
3
+ *
4
+ * @deprecated Import from `@opencodehub/frameworks` instead.
5
+ */
6
+ export { detectManifests } from "@opencodehub/frameworks";
7
+ //# sourceMappingURL=manifests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifests.js","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/manifests.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Source-directory detection.
3
+ *
4
+ * Heuristic: walk the top 2 levels of the repo. A directory qualifies as a
5
+ * "src dir" when it contains > 10 code files directly underneath (recursive
6
+ * descendants count). Common build/cache/vcs folders are excluded via a
7
+ * stop-list so we don't return `node_modules`, `.git`, or `dist`.
8
+ *
9
+ * The scan phase has already applied the repo's gitignore so most noise is
10
+ * filtered before this point, but the stop-list is still applied
11
+ * defensively.
12
+ *
13
+ * Determinism: output is sorted alphabetically.
14
+ */
15
+ import type { ScannedFile } from "../phases/scan.js";
16
+ export declare function detectSrcDirs(files: readonly ScannedFile[]): readonly string[];
17
+ //# sourceMappingURL=src-dirs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-dirs.d.ts","sourceRoot":"","sources":["../../../src/pipeline/profile-detectors/src-dirs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAyDrD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,SAAS,MAAM,EAAE,CAkB9E"}