@backthread/extractor 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 (379) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/dist/cluster/domain-grouping.d.ts +113 -0
  4. package/dist/cluster/domain-grouping.d.ts.map +1 -0
  5. package/dist/cluster/domain-grouping.js +277 -0
  6. package/dist/cluster/domain-grouping.js.map +1 -0
  7. package/dist/cluster/grouping-gate.d.ts +54 -0
  8. package/dist/cluster/grouping-gate.d.ts.map +1 -0
  9. package/dist/cluster/grouping-gate.js +0 -0
  10. package/dist/cluster/grouping-gate.js.map +1 -0
  11. package/dist/cluster/louvain.d.ts +88 -0
  12. package/dist/cluster/louvain.d.ts.map +1 -0
  13. package/dist/cluster/louvain.js +674 -0
  14. package/dist/cluster/louvain.js.map +1 -0
  15. package/dist/cluster/overrides.d.ts +19 -0
  16. package/dist/cluster/overrides.d.ts.map +1 -0
  17. package/dist/cluster/overrides.js +32 -0
  18. package/dist/cluster/overrides.js.map +1 -0
  19. package/dist/cluster/subsystem.d.ts +45 -0
  20. package/dist/cluster/subsystem.d.ts.map +1 -0
  21. package/dist/cluster/subsystem.js +299 -0
  22. package/dist/cluster/subsystem.js.map +1 -0
  23. package/dist/cluster/workspaces.d.ts +64 -0
  24. package/dist/cluster/workspaces.d.ts.map +1 -0
  25. package/dist/cluster/workspaces.js +739 -0
  26. package/dist/cluster/workspaces.js.map +1 -0
  27. package/dist/extract.d.ts +52 -0
  28. package/dist/extract.d.ts.map +1 -0
  29. package/dist/extract.js +48 -0
  30. package/dist/extract.js.map +1 -0
  31. package/dist/framework/celery/celery.d.ts +17 -0
  32. package/dist/framework/celery/celery.d.ts.map +1 -0
  33. package/dist/framework/celery/celery.js +524 -0
  34. package/dist/framework/celery/celery.js.map +1 -0
  35. package/dist/framework/contribute-step.d.ts +38 -0
  36. package/dist/framework/contribute-step.d.ts.map +1 -0
  37. package/dist/framework/contribute-step.js +403 -0
  38. package/dist/framework/contribute-step.js.map +1 -0
  39. package/dist/framework/detect-step.d.ts +8 -0
  40. package/dist/framework/detect-step.d.ts.map +1 -0
  41. package/dist/framework/detect-step.js +54 -0
  42. package/dist/framework/detect-step.js.map +1 -0
  43. package/dist/framework/detect-util.d.ts +24 -0
  44. package/dist/framework/detect-util.d.ts.map +1 -0
  45. package/dist/framework/detect-util.js +59 -0
  46. package/dist/framework/detect-util.js.map +1 -0
  47. package/dist/framework/django/django.d.ts +22 -0
  48. package/dist/framework/django/django.d.ts.map +1 -0
  49. package/dist/framework/django/django.js +940 -0
  50. package/dist/framework/django/django.js.map +1 -0
  51. package/dist/framework/fastapi/fastapi.d.ts +27 -0
  52. package/dist/framework/fastapi/fastapi.d.ts.map +1 -0
  53. package/dist/framework/fastapi/fastapi.js +477 -0
  54. package/dist/framework/fastapi/fastapi.js.map +1 -0
  55. package/dist/framework/faststream/faststream.d.ts +19 -0
  56. package/dist/framework/faststream/faststream.d.ts.map +1 -0
  57. package/dist/framework/faststream/faststream.js +765 -0
  58. package/dist/framework/faststream/faststream.js.map +1 -0
  59. package/dist/framework/flask/flask.d.ts +17 -0
  60. package/dist/framework/flask/flask.d.ts.map +1 -0
  61. package/dist/framework/flask/flask.js +507 -0
  62. package/dist/framework/flask/flask.js.map +1 -0
  63. package/dist/framework/graphql/graphql.d.ts +17 -0
  64. package/dist/framework/graphql/graphql.d.ts.map +1 -0
  65. package/dist/framework/graphql/graphql.js +708 -0
  66. package/dist/framework/graphql/graphql.js.map +1 -0
  67. package/dist/framework/grpc/grpc.d.ts +22 -0
  68. package/dist/framework/grpc/grpc.d.ts.map +1 -0
  69. package/dist/framework/grpc/grpc.js +618 -0
  70. package/dist/framework/grpc/grpc.js.map +1 -0
  71. package/dist/framework/litestar/litestar.d.ts +17 -0
  72. package/dist/framework/litestar/litestar.d.ts.map +1 -0
  73. package/dist/framework/litestar/litestar.js +536 -0
  74. package/dist/framework/litestar/litestar.js.map +1 -0
  75. package/dist/framework/nest/nest.d.ts +19 -0
  76. package/dist/framework/nest/nest.d.ts.map +1 -0
  77. package/dist/framework/nest/nest.js +613 -0
  78. package/dist/framework/nest/nest.js.map +1 -0
  79. package/dist/framework/next/next.d.ts +22 -0
  80. package/dist/framework/next/next.d.ts.map +1 -0
  81. package/dist/framework/next/next.js +449 -0
  82. package/dist/framework/next/next.js.map +1 -0
  83. package/dist/framework/node/node.d.ts +24 -0
  84. package/dist/framework/node/node.d.ts.map +1 -0
  85. package/dist/framework/node/node.js +1009 -0
  86. package/dist/framework/node/node.js.map +1 -0
  87. package/dist/framework/orchestrator/orchestrator.d.ts +34 -0
  88. package/dist/framework/orchestrator/orchestrator.d.ts.map +1 -0
  89. package/dist/framework/orchestrator/orchestrator.js +691 -0
  90. package/dist/framework/orchestrator/orchestrator.js.map +1 -0
  91. package/dist/framework/orm/orm.d.ts +61 -0
  92. package/dist/framework/orm/orm.d.ts.map +1 -0
  93. package/dist/framework/orm/orm.js +620 -0
  94. package/dist/framework/orm/orm.js.map +1 -0
  95. package/dist/framework/python/analyze.d.ts +38 -0
  96. package/dist/framework/python/analyze.d.ts.map +1 -0
  97. package/dist/framework/python/analyze.js +98 -0
  98. package/dist/framework/python/analyze.js.map +1 -0
  99. package/dist/framework/python/py-ast.d.ts +130 -0
  100. package/dist/framework/python/py-ast.d.ts.map +1 -0
  101. package/dist/framework/python/py-ast.js +344 -0
  102. package/dist/framework/python/py-ast.js.map +1 -0
  103. package/dist/framework/python-orm/python-orm.d.ts +19 -0
  104. package/dist/framework/python-orm/python-orm.d.ts.map +1 -0
  105. package/dist/framework/python-orm/python-orm.js +516 -0
  106. package/dist/framework/python-orm/python-orm.js.map +1 -0
  107. package/dist/framework/react-native/react-native.d.ts +35 -0
  108. package/dist/framework/react-native/react-native.d.ts.map +1 -0
  109. package/dist/framework/react-native/react-native.js +1181 -0
  110. package/dist/framework/react-native/react-native.js.map +1 -0
  111. package/dist/framework/register.d.ts +2 -0
  112. package/dist/framework/register.d.ts.map +1 -0
  113. package/dist/framework/register.js +59 -0
  114. package/dist/framework/register.js.map +1 -0
  115. package/dist/framework/registry.d.ts +31 -0
  116. package/dist/framework/registry.d.ts.map +1 -0
  117. package/dist/framework/registry.js +70 -0
  118. package/dist/framework/registry.js.map +1 -0
  119. package/dist/framework/routing/expo-router.d.ts +31 -0
  120. package/dist/framework/routing/expo-router.d.ts.map +1 -0
  121. package/dist/framework/routing/expo-router.js +356 -0
  122. package/dist/framework/routing/expo-router.js.map +1 -0
  123. package/dist/framework/routing/index.d.ts +4 -0
  124. package/dist/framework/routing/index.d.ts.map +1 -0
  125. package/dist/framework/routing/index.js +16 -0
  126. package/dist/framework/routing/index.js.map +1 -0
  127. package/dist/framework/routing/next-router.d.ts +45 -0
  128. package/dist/framework/routing/next-router.d.ts.map +1 -0
  129. package/dist/framework/routing/next-router.js +378 -0
  130. package/dist/framework/routing/next-router.js.map +1 -0
  131. package/dist/framework/routing/route-tree.d.ts +73 -0
  132. package/dist/framework/routing/route-tree.d.ts.map +1 -0
  133. package/dist/framework/routing/route-tree.js +120 -0
  134. package/dist/framework/routing/route-tree.js.map +1 -0
  135. package/dist/framework/types.d.ts +230 -0
  136. package/dist/framework/types.d.ts.map +1 -0
  137. package/dist/framework/types.js +25 -0
  138. package/dist/framework/types.js.map +1 -0
  139. package/dist/graph/cross-language.d.ts +11 -0
  140. package/dist/graph/cross-language.d.ts.map +1 -0
  141. package/dist/graph/cross-language.js +123 -0
  142. package/dist/graph/cross-language.js.map +1 -0
  143. package/dist/graph/extract.d.ts +13 -0
  144. package/dist/graph/extract.d.ts.map +1 -0
  145. package/dist/graph/extract.js +79 -0
  146. package/dist/graph/extract.js.map +1 -0
  147. package/dist/graph/file-graph.d.ts +186 -0
  148. package/dist/graph/file-graph.d.ts.map +1 -0
  149. package/dist/graph/file-graph.js +427 -0
  150. package/dist/graph/file-graph.js.map +1 -0
  151. package/dist/graph/http-callsites.d.ts +14 -0
  152. package/dist/graph/http-callsites.d.ts.map +1 -0
  153. package/dist/graph/http-callsites.js +107 -0
  154. package/dist/graph/http-callsites.js.map +1 -0
  155. package/dist/graph/incremental.d.ts +122 -0
  156. package/dist/graph/incremental.d.ts.map +1 -0
  157. package/dist/graph/incremental.js +448 -0
  158. package/dist/graph/incremental.js.map +1 -0
  159. package/dist/graph/language.d.ts +31 -0
  160. package/dist/graph/language.d.ts.map +1 -0
  161. package/dist/graph/language.js +146 -0
  162. package/dist/graph/language.js.map +1 -0
  163. package/dist/graph/noise-filter.d.ts +46 -0
  164. package/dist/graph/noise-filter.d.ts.map +1 -0
  165. package/dist/graph/noise-filter.js +199 -0
  166. package/dist/graph/noise-filter.js.map +1 -0
  167. package/dist/graph/python-adapter.d.ts +36 -0
  168. package/dist/graph/python-adapter.d.ts.map +1 -0
  169. package/dist/graph/python-adapter.js +402 -0
  170. package/dist/graph/python-adapter.js.map +1 -0
  171. package/dist/graph/python-manifest.d.ts +22 -0
  172. package/dist/graph/python-manifest.d.ts.map +1 -0
  173. package/dist/graph/python-manifest.js +137 -0
  174. package/dist/graph/python-manifest.js.map +1 -0
  175. package/dist/graph/python-stdlib.d.ts +2 -0
  176. package/dist/graph/python-stdlib.d.ts.map +1 -0
  177. package/dist/graph/python-stdlib.js +53 -0
  178. package/dist/graph/python-stdlib.js.map +1 -0
  179. package/dist/graph/ts-morph-adapter.d.ts +65 -0
  180. package/dist/graph/ts-morph-adapter.d.ts.map +1 -0
  181. package/dist/graph/ts-morph-adapter.js +265 -0
  182. package/dist/graph/ts-morph-adapter.js.map +1 -0
  183. package/dist/graph/types.d.ts +37 -0
  184. package/dist/graph/types.d.ts.map +1 -0
  185. package/dist/graph/types.js +50 -0
  186. package/dist/graph/types.js.map +1 -0
  187. package/dist/index.d.ts +45 -0
  188. package/dist/index.d.ts.map +1 -0
  189. package/dist/index.js +51 -0
  190. package/dist/index.js.map +1 -0
  191. package/dist/infra/aws/aws-parse.d.ts +39 -0
  192. package/dist/infra/aws/aws-parse.d.ts.map +1 -0
  193. package/dist/infra/aws/aws-parse.js +149 -0
  194. package/dist/infra/aws/aws-parse.js.map +1 -0
  195. package/dist/infra/aws/aws.d.ts +6 -0
  196. package/dist/infra/aws/aws.d.ts.map +1 -0
  197. package/dist/infra/aws/aws.js +425 -0
  198. package/dist/infra/aws/aws.js.map +1 -0
  199. package/dist/infra/azure/azure-parse.d.ts +73 -0
  200. package/dist/infra/azure/azure-parse.d.ts.map +1 -0
  201. package/dist/infra/azure/azure-parse.js +178 -0
  202. package/dist/infra/azure/azure-parse.js.map +1 -0
  203. package/dist/infra/azure/azure.d.ts +12 -0
  204. package/dist/infra/azure/azure.d.ts.map +1 -0
  205. package/dist/infra/azure/azure.js +673 -0
  206. package/dist/infra/azure/azure.js.map +1 -0
  207. package/dist/infra/cloudflare/cloudflare.d.ts +50 -0
  208. package/dist/infra/cloudflare/cloudflare.d.ts.map +1 -0
  209. package/dist/infra/cloudflare/cloudflare.js +382 -0
  210. package/dist/infra/cloudflare/cloudflare.js.map +1 -0
  211. package/dist/infra/cloudflare/wrangler-parse.d.ts +6 -0
  212. package/dist/infra/cloudflare/wrangler-parse.d.ts.map +1 -0
  213. package/dist/infra/cloudflare/wrangler-parse.js +278 -0
  214. package/dist/infra/cloudflare/wrangler-parse.js.map +1 -0
  215. package/dist/infra/compose/compose-parse.d.ts +24 -0
  216. package/dist/infra/compose/compose-parse.d.ts.map +1 -0
  217. package/dist/infra/compose/compose-parse.js +77 -0
  218. package/dist/infra/compose/compose-parse.js.map +1 -0
  219. package/dist/infra/compose/compose.d.ts +12 -0
  220. package/dist/infra/compose/compose.d.ts.map +1 -0
  221. package/dist/infra/compose/compose.js +201 -0
  222. package/dist/infra/compose/compose.js.map +1 -0
  223. package/dist/infra/convex/convex-parse.d.ts +28 -0
  224. package/dist/infra/convex/convex-parse.d.ts.map +1 -0
  225. package/dist/infra/convex/convex-parse.js +74 -0
  226. package/dist/infra/convex/convex-parse.js.map +1 -0
  227. package/dist/infra/convex/convex.d.ts +18 -0
  228. package/dist/infra/convex/convex.d.ts.map +1 -0
  229. package/dist/infra/convex/convex.js +199 -0
  230. package/dist/infra/convex/convex.js.map +1 -0
  231. package/dist/infra/digitalocean/digitalocean.d.ts +33 -0
  232. package/dist/infra/digitalocean/digitalocean.d.ts.map +1 -0
  233. package/dist/infra/digitalocean/digitalocean.js +204 -0
  234. package/dist/infra/digitalocean/digitalocean.js.map +1 -0
  235. package/dist/infra/firebase/firebase.d.ts +43 -0
  236. package/dist/infra/firebase/firebase.d.ts.map +1 -0
  237. package/dist/infra/firebase/firebase.js +271 -0
  238. package/dist/infra/firebase/firebase.js.map +1 -0
  239. package/dist/infra/fly/fly-parse.d.ts +52 -0
  240. package/dist/infra/fly/fly-parse.d.ts.map +1 -0
  241. package/dist/infra/fly/fly-parse.js +114 -0
  242. package/dist/infra/fly/fly-parse.js.map +1 -0
  243. package/dist/infra/fly/fly.d.ts +15 -0
  244. package/dist/infra/fly/fly.d.ts.map +1 -0
  245. package/dist/infra/fly/fly.js +265 -0
  246. package/dist/infra/fly/fly.js.map +1 -0
  247. package/dist/infra/gcp/gcp-parse.d.ts +24 -0
  248. package/dist/infra/gcp/gcp-parse.d.ts.map +1 -0
  249. package/dist/infra/gcp/gcp-parse.js +123 -0
  250. package/dist/infra/gcp/gcp-parse.js.map +1 -0
  251. package/dist/infra/gcp/gcp.d.ts +10 -0
  252. package/dist/infra/gcp/gcp.d.ts.map +1 -0
  253. package/dist/infra/gcp/gcp.js +502 -0
  254. package/dist/infra/gcp/gcp.js.map +1 -0
  255. package/dist/infra/heroku/heroku-parse.d.ts +33 -0
  256. package/dist/infra/heroku/heroku-parse.d.ts.map +1 -0
  257. package/dist/infra/heroku/heroku-parse.js +63 -0
  258. package/dist/infra/heroku/heroku-parse.js.map +1 -0
  259. package/dist/infra/heroku/heroku.d.ts +24 -0
  260. package/dist/infra/heroku/heroku.d.ts.map +1 -0
  261. package/dist/infra/heroku/heroku.js +253 -0
  262. package/dist/infra/heroku/heroku.js.map +1 -0
  263. package/dist/infra/image-resolve.d.ts +56 -0
  264. package/dist/infra/image-resolve.d.ts.map +1 -0
  265. package/dist/infra/image-resolve.js +229 -0
  266. package/dist/infra/image-resolve.js.map +1 -0
  267. package/dist/infra/infra-step.d.ts +39 -0
  268. package/dist/infra/infra-step.d.ts.map +1 -0
  269. package/dist/infra/infra-step.js +57 -0
  270. package/dist/infra/infra-step.js.map +1 -0
  271. package/dist/infra/k8s/index.d.ts +78 -0
  272. package/dist/infra/k8s/index.d.ts.map +1 -0
  273. package/dist/infra/k8s/index.js +251 -0
  274. package/dist/infra/k8s/index.js.map +1 -0
  275. package/dist/infra/kamal/kamal-parse.d.ts +23 -0
  276. package/dist/infra/kamal/kamal-parse.d.ts.map +1 -0
  277. package/dist/infra/kamal/kamal-parse.js +66 -0
  278. package/dist/infra/kamal/kamal-parse.js.map +1 -0
  279. package/dist/infra/kamal/kamal.d.ts +17 -0
  280. package/dist/infra/kamal/kamal.d.ts.map +1 -0
  281. package/dist/infra/kamal/kamal.js +162 -0
  282. package/dist/infra/kamal/kamal.js.map +1 -0
  283. package/dist/infra/netlify/netlify.d.ts +33 -0
  284. package/dist/infra/netlify/netlify.d.ts.map +1 -0
  285. package/dist/infra/netlify/netlify.js +247 -0
  286. package/dist/infra/netlify/netlify.js.map +1 -0
  287. package/dist/infra/opentofu/opentofu.d.ts +3 -0
  288. package/dist/infra/opentofu/opentofu.d.ts.map +1 -0
  289. package/dist/infra/opentofu/opentofu.js +157 -0
  290. package/dist/infra/opentofu/opentofu.js.map +1 -0
  291. package/dist/infra/pulumi/pulumi-parse.d.ts +60 -0
  292. package/dist/infra/pulumi/pulumi-parse.d.ts.map +1 -0
  293. package/dist/infra/pulumi/pulumi-parse.js +155 -0
  294. package/dist/infra/pulumi/pulumi-parse.js.map +1 -0
  295. package/dist/infra/pulumi/pulumi.d.ts +23 -0
  296. package/dist/infra/pulumi/pulumi.d.ts.map +1 -0
  297. package/dist/infra/pulumi/pulumi.js +260 -0
  298. package/dist/infra/pulumi/pulumi.js.map +1 -0
  299. package/dist/infra/railway/railway-parse.d.ts +54 -0
  300. package/dist/infra/railway/railway-parse.d.ts.map +1 -0
  301. package/dist/infra/railway/railway-parse.js +200 -0
  302. package/dist/infra/railway/railway-parse.js.map +1 -0
  303. package/dist/infra/railway/railway.d.ts +19 -0
  304. package/dist/infra/railway/railway.d.ts.map +1 -0
  305. package/dist/infra/railway/railway.js +397 -0
  306. package/dist/infra/railway/railway.js.map +1 -0
  307. package/dist/infra/register.d.ts +2 -0
  308. package/dist/infra/register.d.ts.map +1 -0
  309. package/dist/infra/register.js +81 -0
  310. package/dist/infra/register.js.map +1 -0
  311. package/dist/infra/registry.d.ts +64 -0
  312. package/dist/infra/registry.d.ts.map +1 -0
  313. package/dist/infra/registry.js +205 -0
  314. package/dist/infra/registry.js.map +1 -0
  315. package/dist/infra/relevance.d.ts +16 -0
  316. package/dist/infra/relevance.d.ts.map +1 -0
  317. package/dist/infra/relevance.js +132 -0
  318. package/dist/infra/relevance.js.map +1 -0
  319. package/dist/infra/render/render-parse.d.ts +76 -0
  320. package/dist/infra/render/render-parse.d.ts.map +1 -0
  321. package/dist/infra/render/render-parse.js +155 -0
  322. package/dist/infra/render/render-parse.js.map +1 -0
  323. package/dist/infra/render/render.d.ts +11 -0
  324. package/dist/infra/render/render.d.ts.map +1 -0
  325. package/dist/infra/render/render.js +303 -0
  326. package/dist/infra/render/render.js.map +1 -0
  327. package/dist/infra/sst/sst-parse.d.ts +25 -0
  328. package/dist/infra/sst/sst-parse.d.ts.map +1 -0
  329. package/dist/infra/sst/sst-parse.js +45 -0
  330. package/dist/infra/sst/sst-parse.js.map +1 -0
  331. package/dist/infra/sst/sst.d.ts +19 -0
  332. package/dist/infra/sst/sst.d.ts.map +1 -0
  333. package/dist/infra/sst/sst.js +236 -0
  334. package/dist/infra/sst/sst.js.map +1 -0
  335. package/dist/infra/supabase/supabase-parse.d.ts +34 -0
  336. package/dist/infra/supabase/supabase-parse.d.ts.map +1 -0
  337. package/dist/infra/supabase/supabase-parse.js +113 -0
  338. package/dist/infra/supabase/supabase-parse.js.map +1 -0
  339. package/dist/infra/supabase/supabase.d.ts +15 -0
  340. package/dist/infra/supabase/supabase.d.ts.map +1 -0
  341. package/dist/infra/supabase/supabase.js +198 -0
  342. package/dist/infra/supabase/supabase.js.map +1 -0
  343. package/dist/infra/terraform/hcl-parse.d.ts +34 -0
  344. package/dist/infra/terraform/hcl-parse.d.ts.map +1 -0
  345. package/dist/infra/terraform/hcl-parse.js +203 -0
  346. package/dist/infra/terraform/hcl-parse.js.map +1 -0
  347. package/dist/infra/terraform/terraform.d.ts +14 -0
  348. package/dist/infra/terraform/terraform.d.ts.map +1 -0
  349. package/dist/infra/terraform/terraform.js +264 -0
  350. package/dist/infra/terraform/terraform.js.map +1 -0
  351. package/dist/infra/types.d.ts +151 -0
  352. package/dist/infra/types.d.ts.map +1 -0
  353. package/dist/infra/types.js +14 -0
  354. package/dist/infra/types.js.map +1 -0
  355. package/dist/infra/vercel/vercel-parse.d.ts +70 -0
  356. package/dist/infra/vercel/vercel-parse.d.ts.map +1 -0
  357. package/dist/infra/vercel/vercel-parse.js +194 -0
  358. package/dist/infra/vercel/vercel-parse.js.map +1 -0
  359. package/dist/infra/vercel/vercel.d.ts +30 -0
  360. package/dist/infra/vercel/vercel.d.ts.map +1 -0
  361. package/dist/infra/vercel/vercel.js +523 -0
  362. package/dist/infra/vercel/vercel.js.map +1 -0
  363. package/dist/infra/walk.d.ts +36 -0
  364. package/dist/infra/walk.d.ts.map +1 -0
  365. package/dist/infra/walk.js +85 -0
  366. package/dist/infra/walk.js.map +1 -0
  367. package/dist/safety.d.ts +13 -0
  368. package/dist/safety.d.ts.map +1 -0
  369. package/dist/safety.js +67 -0
  370. package/dist/safety.js.map +1 -0
  371. package/dist/types.d.ts +47 -0
  372. package/dist/types.d.ts.map +1 -0
  373. package/dist/types.js +111 -0
  374. package/dist/types.js.map +1 -0
  375. package/dist/version.d.ts +2 -0
  376. package/dist/version.d.ts.map +1 -0
  377. package/dist/version.js +35 -0
  378. package/dist/version.js.map +1 -0
  379. package/package.json +65 -0
@@ -0,0 +1,278 @@
1
+ // wrangler config parser (JSONC + a TOML subset).
2
+ //
3
+ // The Cloudflare adapter targets BOTH `wrangler.jsonc` (the newer default, and
4
+ // what the example-ingest-worker dogfood uses) and `wrangler.toml` (the historical
5
+ // default, still the majority of repos in the wild). Both describe the same
6
+ // binding model, so we normalize each into the same plain JS object shape that
7
+ // `cloudflare.ts` reads — a JSON-faithful tree of tables / arrays / scalars.
8
+ //
9
+ // DEPENDENCY-FREE on purpose (only the standard library): same invariant as
10
+ // classify/env-vars.ts — a pure parser stays unit-testable without dragging the
11
+ // Supabase/Anthropic import chain in (vitest doesn't rewrite the `.js` suffixes
12
+ // those modules carry). The TOML support is a deliberate SUBSET: tables,
13
+ // array-of-tables, inline tables/arrays, and scalar strings/ints/floats/bools —
14
+ // everything wrangler.toml actually uses. Heredocs, dotted-key assignment, and
15
+ // datetime literals are not supported (wrangler configs don't use them); a line
16
+ // the subset can't parse is skipped rather than throwing, so a slightly-exotic
17
+ // config degrades to a partial graph instead of failing the whole ingest.
18
+ // ---------------------------------------------------------------------------
19
+ // JSONC — JSON with `//` line comments and `/* */` block comments + trailing
20
+ // commas. Strip comments (string-aware) and trailing commas, then JSON.parse.
21
+ export function parseJsonc(text) {
22
+ const parsed = JSON.parse(stripJsoncComments(text));
23
+ if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
24
+ throw new Error('wrangler jsonc: top-level value must be an object');
25
+ }
26
+ return parsed;
27
+ }
28
+ // Strip `//` + `/* */` comments AND trailing commas, all inside ONE string-aware
29
+ // pass. PR #9 review: the old post-hoc global `replace(/,(\s*[}\]])/g, …)` ran
30
+ // over the whole document including string VALUES, so a literal like `"x,}"`
31
+ // silently lost its comma. Trailing-comma removal must be string-aware too —
32
+ // here we only drop a `,` when not inside a string and the next non-whitespace
33
+ // char is `}`/`]`.
34
+ function stripJsoncComments(text) {
35
+ let out = '';
36
+ let inString = false;
37
+ let escaped = false;
38
+ for (let i = 0; i < text.length; i++) {
39
+ const c = text[i];
40
+ const next = text[i + 1];
41
+ if (inString) {
42
+ out += c;
43
+ if (escaped)
44
+ escaped = false;
45
+ else if (c === '\\')
46
+ escaped = true;
47
+ else if (c === '"')
48
+ inString = false;
49
+ continue;
50
+ }
51
+ if (c === '"') {
52
+ inString = true;
53
+ out += c;
54
+ continue;
55
+ }
56
+ if (c === '/' && next === '/') {
57
+ while (i < text.length && text[i] !== '\n')
58
+ i++;
59
+ out += '\n';
60
+ continue;
61
+ }
62
+ if (c === '/' && next === '*') {
63
+ i += 2;
64
+ while (i < text.length && !(text[i] === '*' && text[i + 1] === '/'))
65
+ i++;
66
+ i++; // land on the '/', loop's i++ steps past it
67
+ continue;
68
+ }
69
+ if (c === ',') {
70
+ // Trailing comma? Peek past whitespace/comments-free run for `}`/`]`.
71
+ let j = i + 1;
72
+ while (j < text.length && /\s/.test(text[j]))
73
+ j++;
74
+ if (text[j] === '}' || text[j] === ']')
75
+ continue; // drop the comma
76
+ }
77
+ out += c;
78
+ }
79
+ return out;
80
+ }
81
+ // ---------------------------------------------------------------------------
82
+ // TOML subset. Walks lines, tracking the current table context. `[a.b]`
83
+ // descends into nested tables; `[[a.b]]` pushes a new element onto an
84
+ // array-of-tables. Scalars and inline arrays/tables parse via a small
85
+ // recursive value reader.
86
+ export function parseTomlSubset(text) {
87
+ const root = {};
88
+ let current = root;
89
+ for (const rawLine of text.split('\n')) {
90
+ const line = stripTomlComment(rawLine).trim();
91
+ if (!line)
92
+ continue;
93
+ const arrayTable = line.match(/^\[\[\s*([^\]]+?)\s*\]\]$/);
94
+ if (arrayTable) {
95
+ current = descendArrayTable(root, arrayTable[1].trim());
96
+ continue;
97
+ }
98
+ const table = line.match(/^\[\s*([^\]]+?)\s*\]$/);
99
+ if (table) {
100
+ current = descendTable(root, table[1].trim());
101
+ continue;
102
+ }
103
+ const eq = line.indexOf('=');
104
+ if (eq === -1)
105
+ continue; // unparseable line — skip rather than throw
106
+ const key = line.slice(0, eq).trim().replace(/^["']|["']$/g, '');
107
+ const value = parseTomlValue(line.slice(eq + 1).trim());
108
+ if (key)
109
+ current[key] = value;
110
+ }
111
+ return root;
112
+ }
113
+ function stripTomlComment(line) {
114
+ let inString = false;
115
+ let quote = '';
116
+ for (let i = 0; i < line.length; i++) {
117
+ const c = line[i];
118
+ if (inString) {
119
+ if (c === quote && line[i - 1] !== '\\')
120
+ inString = false;
121
+ }
122
+ else if (c === '"' || c === "'") {
123
+ inString = true;
124
+ quote = c;
125
+ }
126
+ else if (c === '#') {
127
+ return line.slice(0, i);
128
+ }
129
+ }
130
+ return line;
131
+ }
132
+ // Walk/create a dotted-path table, returning the leaf table object.
133
+ function descendTable(root, path) {
134
+ const segments = splitDottedPath(path);
135
+ let node = root;
136
+ for (const seg of segments) {
137
+ const existing = node[seg];
138
+ if (Array.isArray(existing)) {
139
+ // dotted key into an array-of-tables addresses its last element
140
+ node = existing[existing.length - 1];
141
+ }
142
+ else if (existing && typeof existing === 'object') {
143
+ node = existing;
144
+ }
145
+ else {
146
+ const created = {};
147
+ node[seg] = created;
148
+ node = created;
149
+ }
150
+ }
151
+ return node;
152
+ }
153
+ // Walk to the parent of the array, append a fresh element, return it.
154
+ function descendArrayTable(root, path) {
155
+ const segments = splitDottedPath(path);
156
+ const last = segments.pop();
157
+ let node = root;
158
+ for (const seg of segments) {
159
+ const existing = node[seg];
160
+ if (Array.isArray(existing))
161
+ node = existing[existing.length - 1];
162
+ else if (existing && typeof existing === 'object')
163
+ node = existing;
164
+ else {
165
+ const created = {};
166
+ node[seg] = created;
167
+ node = created;
168
+ }
169
+ }
170
+ if (!Array.isArray(node[last]))
171
+ node[last] = [];
172
+ const arr = node[last];
173
+ const element = {};
174
+ arr.push(element);
175
+ return element;
176
+ }
177
+ // Split `a.b."c.d"` on unquoted dots.
178
+ function splitDottedPath(path) {
179
+ const out = [];
180
+ let buf = '';
181
+ let inString = false;
182
+ let quote = '';
183
+ for (const c of path) {
184
+ if (inString) {
185
+ if (c === quote)
186
+ inString = false;
187
+ else
188
+ buf += c;
189
+ }
190
+ else if (c === '"' || c === "'") {
191
+ inString = true;
192
+ quote = c;
193
+ }
194
+ else if (c === '.') {
195
+ out.push(buf.trim());
196
+ buf = '';
197
+ }
198
+ else
199
+ buf += c;
200
+ }
201
+ if (buf.trim())
202
+ out.push(buf.trim());
203
+ return out;
204
+ }
205
+ function parseTomlValue(raw) {
206
+ const v = raw.trim();
207
+ if (v.startsWith('['))
208
+ return parseInlineArray(v);
209
+ if (v.startsWith('{'))
210
+ return parseInlineTable(v);
211
+ if (v.startsWith('"') || v.startsWith("'"))
212
+ return v.slice(1, -1);
213
+ if (v === 'true')
214
+ return true;
215
+ if (v === 'false')
216
+ return false;
217
+ if (/^-?\d+$/.test(v))
218
+ return Number(v);
219
+ if (/^-?\d*\.\d+$/.test(v))
220
+ return Number(v);
221
+ return v; // bare string fallback (e.g. unquoted enum)
222
+ }
223
+ // Split top-level comma items respecting nested brackets/braces and strings.
224
+ function splitTopLevel(inner) {
225
+ const items = [];
226
+ let depth = 0;
227
+ let buf = '';
228
+ let inString = false;
229
+ let quote = '';
230
+ for (const c of inner) {
231
+ if (inString) {
232
+ buf += c;
233
+ if (c === quote)
234
+ inString = false;
235
+ continue;
236
+ }
237
+ if (c === '"' || c === "'") {
238
+ inString = true;
239
+ quote = c;
240
+ buf += c;
241
+ continue;
242
+ }
243
+ if (c === '[' || c === '{')
244
+ depth++;
245
+ if (c === ']' || c === '}')
246
+ depth--;
247
+ if (c === ',' && depth === 0) {
248
+ if (buf.trim())
249
+ items.push(buf.trim());
250
+ buf = '';
251
+ continue;
252
+ }
253
+ buf += c;
254
+ }
255
+ if (buf.trim())
256
+ items.push(buf.trim());
257
+ return items;
258
+ }
259
+ function parseInlineArray(v) {
260
+ return splitTopLevel(v.slice(1, -1)).map(parseTomlValue);
261
+ }
262
+ function parseInlineTable(v) {
263
+ const obj = {};
264
+ for (const item of splitTopLevel(v.slice(1, -1))) {
265
+ const eq = item.indexOf('=');
266
+ if (eq === -1)
267
+ continue;
268
+ const key = item.slice(0, eq).trim().replace(/^["']|["']$/g, '');
269
+ obj[key] = parseTomlValue(item.slice(eq + 1).trim());
270
+ }
271
+ return obj;
272
+ }
273
+ // ---------------------------------------------------------------------------
274
+ // Dispatch by extension.
275
+ export function parseWranglerConfig(text, filename) {
276
+ return /\.toml$/i.test(filename) ? parseTomlSubset(text) : parseJsonc(text);
277
+ }
278
+ //# sourceMappingURL=wrangler-parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler-parse.js","sourceRoot":"","sources":["../../../src/infra/cloudflare/wrangler-parse.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,mFAAmF;AACnF,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,gFAAgF;AAChF,yEAAyE;AACzE,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,0EAA0E;AAK1E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAE9E,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAsB,CAAC;AAChC,CAAC;AAED,iFAAiF;AACjF,+EAA+E;AAC/E,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,mBAAmB;AACnB,SAAS,kBAAkB,CAAC,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AE,KAAK,CAAC,CAAC;YAAE,SAAS;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QACjE,GAAG,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8EAA8E;AAC9E,yBAAyB;AAEzB,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,QAAgB;IAChE,OAAO,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,24 @@
1
+ export interface ComposeBuild {
2
+ /**
3
+ * The build CONTEXT — the dir Docker sends to the daemon = the source this
4
+ * container deploys. Relative to the compose file's location. Defaults to '.'
5
+ * (the compose file's own dir) when `build` is a mapping without `context`.
6
+ */
7
+ context: string;
8
+ /** Optional Dockerfile path (metadata only; the context dir is the source root). */
9
+ dockerfile?: string;
10
+ }
11
+ export interface ComposeService {
12
+ name: string;
13
+ /** Present iff the service builds from in-repo source (→ a unit that runs your code). */
14
+ build?: ComposeBuild;
15
+ /** Present iff the service runs a prebuilt image (→ pulled; classify by role, no source). */
16
+ image?: string;
17
+ /** Normalized list of service names this one depends_on (both list + map forms). */
18
+ dependsOn: string[];
19
+ }
20
+ export interface ComposeConfig {
21
+ services: ComposeService[];
22
+ }
23
+ export declare function parseComposeConfig(yamlText: string): ComposeConfig;
24
+ //# sourceMappingURL=compose-parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-parse.d.ts","sourceRoot":"","sources":["../../../src/infra/compose/compose-parse.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,yFAAyF;IACzF,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAgDD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAgBlE"}
@@ -0,0 +1,77 @@
1
+ // docker-compose parser + typed shape extractor.
2
+ //
3
+ // docker-compose files are YAML (the Compose Spec), so we reuse the `yaml`
4
+ // package (already a devDependency, like render-parse.ts / gcp-parse.ts). This
5
+ // module maps the raw YAML tree into a typed ComposeConfig — keeping the parse
6
+ // logic separated from the graph builder (the render-parse.ts ↔ render.ts pattern).
7
+ //
8
+ // Covered:
9
+ // services.<name>:
10
+ // build — string short-form (the context dir) OR { context, dockerfile }
11
+ // image — a prebuilt image ref (no build → pulled, not your code)
12
+ // depends_on — list form [a, b] OR map form { a: {condition}, b: {} }
13
+ //
14
+ // Compose Spec: https://github.com/compose-spec/compose-spec/blob/master/spec.md
15
+ import { parse as parseYaml } from 'yaml';
16
+ // ---------------------------------------------------------------------------
17
+ // Helpers
18
+ function str(v) {
19
+ return typeof v === 'string' && v ? v : undefined;
20
+ }
21
+ function obj(v) {
22
+ return v && typeof v === 'object' && !Array.isArray(v) ? v : undefined;
23
+ }
24
+ /** Normalize a `depends_on` value (list of names, or a map keyed by name). */
25
+ function parseDependsOn(v) {
26
+ if (Array.isArray(v)) {
27
+ return v.filter((x) => typeof x === 'string' && x.length > 0);
28
+ }
29
+ const m = obj(v);
30
+ if (m)
31
+ return Object.keys(m);
32
+ return [];
33
+ }
34
+ /** Normalize a `build` value (string short-form, or a `{ context, dockerfile }` map). */
35
+ function parseBuild(v) {
36
+ const s = str(v);
37
+ if (s)
38
+ return { context: s };
39
+ const m = obj(v);
40
+ if (m) {
41
+ // A `build:` mapping without `context` defaults to the compose file's dir ('.').
42
+ return { context: str(m.context) ?? '.', dockerfile: str(m.dockerfile) };
43
+ }
44
+ return undefined;
45
+ }
46
+ function parseService(name, raw) {
47
+ const svc = { name, dependsOn: parseDependsOn(raw.depends_on) };
48
+ const build = parseBuild(raw.build);
49
+ if (build)
50
+ svc.build = build;
51
+ const image = str(raw.image);
52
+ if (image)
53
+ svc.image = image;
54
+ return svc;
55
+ }
56
+ // ---------------------------------------------------------------------------
57
+ // Main parse function: raw YAML string → ComposeConfig.
58
+ // Throws on YAML syntax errors (caller wraps in try/catch + warns).
59
+ export function parseComposeConfig(yamlText) {
60
+ const raw = parseYaml(yamlText, { logLevel: 'silent' });
61
+ if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
62
+ throw new Error('compose file: top-level value must be a mapping');
63
+ }
64
+ const tree = raw;
65
+ const servicesRaw = obj(tree.services);
66
+ if (!servicesRaw)
67
+ return { services: [] };
68
+ const services = [];
69
+ for (const [name, value] of Object.entries(servicesRaw)) {
70
+ const svcRaw = obj(value);
71
+ if (!name || !svcRaw)
72
+ continue; // skip nameless / non-mapping entries
73
+ services.push(parseService(name, svcRaw));
74
+ }
75
+ return { services };
76
+ }
77
+ //# sourceMappingURL=compose-parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-parse.js","sourceRoot":"","sources":["../../../src/infra/compose/compose-parse.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC/E,oFAAoF;AACpF,EAAE;AACF,WAAW;AACX,qBAAqB;AACrB,kFAAkF;AAClF,2EAA2E;AAC3E,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AM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM;YAAE,SAAS,CAAC,sCAAsC;QACtE,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { InfraModuleKind } from '../../types.js';
2
+ import type { InfraAdapter, InfraGraph } from '../types.js';
3
+ import { type ComposeConfig } from './compose-parse.js';
4
+ export declare function classifyImage(image: string): InfraModuleKind;
5
+ export interface ComposeConfigEntry {
6
+ config: ComposeConfig;
7
+ /** Repo-relative path of the compose file (provenance + context base). */
8
+ file: string;
9
+ }
10
+ export declare function buildComposeGraph(entries: ComposeConfigEntry[], root: string): InfraGraph;
11
+ export declare const dockerComposeAdapter: InfraAdapter;
12
+ //# sourceMappingURL=compose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../src/infra/compose/compose.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAa,UAAU,EAAa,MAAM,aAAa,CAAC;AAElF,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAyD5E,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAK5D;AAWD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,aAAa,CAAC;IACtB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAgFzF;AAKD,eAAO,MAAM,oBAAoB,EAAE,YAqBlC,CAAC"}
@@ -0,0 +1,201 @@
1
+ // the docker-compose InfraAdapter.
2
+ //
3
+ // Surfaces the self-hosted container topology a Compose file declares — the
4
+ // shape of the typical ICP microservices repo (and marola's). Entirely
5
+ // `declared` provenance: the compose file literally names every service, its
6
+ // build context, and its dependencies. No LLM (classificationsNeeded: []).
7
+ //
8
+ // Kind mapping (locked 8-kind InfraModuleKind enum — map onto it, never weaken):
9
+ // service with `build:` → container (your code, built from a context dir)
10
+ // service with `image:` only:
11
+ // postgres/mysql/mongo/redis/…→ datastore (a pulled data store)
12
+ // kafka/rabbitmq/nats/… → queue (a pulled message bus)
13
+ // anything else → container (a self-hosted prebuilt workload)
14
+ // service with neither → container (defensive; topology not lost)
15
+ //
16
+ // Edge taxonomy (8-verb EdgeKind — FORBIDDEN: imports/depends-on/uses):
17
+ // depends_on a datastore → stores-in
18
+ // depends_on a queue → publishes (compose can't tell produce vs consume; a
19
+ // dependent typically produces — honest default)
20
+ // depends_on else → calls
21
+ //
22
+ // sourceRoots: for a `build:` service, the build CONTEXT dir is exactly
23
+ // "what this container deploys" — Docker sends that dir to the daemon. We resolve
24
+ // it repo-relative (against the compose file's location). An image-only service
25
+ // pulls a prebuilt image → runs no code of yours → no source root. A context that
26
+ // resolves to the repo root ('') is dropped (not a catch-all that swallows all code).
27
+ //
28
+ // Zone label: "Docker Compose" (PROVIDER_ZONE_LABEL['compose'] in zones.ts) — the
29
+ // honest "where it runs" = your own container host, not a cloud provider.
30
+ //
31
+ // v0 scope (deferred, tracked under ): shared-networks edges (too noisy —
32
+ // every service shares the default network); per-service Dockerfile COPY refinement
33
+ // of the source root (the build context dir is the documented, sufficient signal).
34
+ import { readFileSync } from 'node:fs';
35
+ import { relative } from 'node:path';
36
+ import { findFiles } from '../walk.js';
37
+ import { parseComposeConfig } from './compose-parse.js';
38
+ // A compose file basename: `docker-compose.yml`, `compose.yaml`,
39
+ // `docker-compose.prod.yml`, `compose.override.yaml`, … but NOT `composer.yaml`.
40
+ const COMPOSE_RE = /^(docker-compose|compose)(\.[A-Za-z0-9_-]+)?\.ya?ml$/i;
41
+ function findComposeFiles(repoDir) {
42
+ return findFiles(repoDir, (_abs, e) => COMPOSE_RE.test(e.name), { maxDepth: 5 });
43
+ }
44
+ // ---------------------------------------------------------------------------
45
+ // Path helpers (repo-relative, normalized). Compose `build.context` is relative
46
+ // to the compose file's own dir and may contain `./` and `../`.
47
+ /** The repo-relative directory of a repo-relative file path ('' = repo root). */
48
+ function dirOf(relPath) {
49
+ const i = relPath.lastIndexOf('/');
50
+ return i === -1 ? '' : relPath.slice(0, i);
51
+ }
52
+ /** Resolve `rel` (may contain `./`/`../`) against repo-relative `baseDir` → normalized. */
53
+ function resolveRel(baseDir, rel) {
54
+ const parts = (baseDir ? baseDir.split('/') : []).concat(rel.split('/'));
55
+ const out = [];
56
+ for (const p of parts) {
57
+ if (p === '' || p === '.')
58
+ continue;
59
+ if (p === '..')
60
+ out.pop();
61
+ else
62
+ out.push(p);
63
+ }
64
+ return out.join('/');
65
+ }
66
+ // ---------------------------------------------------------------------------
67
+ // Image-role classification (image-only services). Heuristic on the image's base
68
+ // name (after the last `/`, before the `:tag`/`@digest`) — covers the common
69
+ // data-store / message-bus images so they render as the right kind instead of an
70
+ // undifferentiated container.
71
+ const DATASTORE_TOKENS = [
72
+ 'postgres', 'postgis', 'mysql', 'mariadb', 'mongo', 'redis', 'valkey', 'keydb',
73
+ 'memcached', 'elasticsearch', 'opensearch', 'clickhouse', 'cassandra', 'scylla',
74
+ 'cockroach', 'influxdb', 'neo4j', 'couchdb', 'rethinkdb', 'minio', 'timescale',
75
+ ];
76
+ const QUEUE_TOKENS = [
77
+ 'rabbitmq', 'kafka', 'redpanda', 'nats', 'zookeeper', 'activemq', 'pulsar',
78
+ 'mosquitto', 'emqx',
79
+ ];
80
+ function imageBase(image) {
81
+ const noTag = image.split('@')[0].split(':')[0];
82
+ const parts = noTag.split('/');
83
+ return (parts[parts.length - 1] ?? '').toLowerCase();
84
+ }
85
+ // Exported so the Kamal adapter reuses the same image-role token map
86
+ // for classifying its accessory images (postgres→datastore, kafka→queue, …)
87
+ // instead of duplicating the token lists a third time.
88
+ export function classifyImage(image) {
89
+ const base = imageBase(image);
90
+ if (DATASTORE_TOKENS.some((t) => base.includes(t)))
91
+ return 'datastore';
92
+ if (QUEUE_TOKENS.some((t) => base.includes(t)))
93
+ return 'queue';
94
+ return 'container';
95
+ }
96
+ // ---------------------------------------------------------------------------
97
+ // Node-id helpers (adapter-local; registry prefixes `compose:` at merge time).
98
+ const serviceId = (name) => `service:${name}`;
99
+ export function buildComposeGraph(entries, root) {
100
+ const nodes = new Map();
101
+ const edges = [];
102
+ const kindByService = new Map();
103
+ const addNode = (n) => {
104
+ // First declaration wins (a service redefined by an override file keeps its
105
+ // base node) — same pattern as cloudflare.ts / render.ts.
106
+ if (!nodes.has(n.id))
107
+ nodes.set(n.id, n);
108
+ };
109
+ // Pass 1: nodes. Every service becomes a node; remember each service's kind so
110
+ // pass-2 edges can pick the right verb.
111
+ for (const { config, file } of entries) {
112
+ const composeDir = dirOf(file);
113
+ for (const svc of config.services) {
114
+ const id = serviceId(svc.name);
115
+ if (svc.build) {
116
+ // Builds from source → a container that runs YOUR code. The build context
117
+ // dir is the source root (dropped if it resolves to the repo root).
118
+ const context = resolveRel(composeDir, svc.build.context);
119
+ const node = {
120
+ id,
121
+ label: svc.name,
122
+ kind: 'container',
123
+ provenance: 'declared',
124
+ metadata: {
125
+ provider: 'compose',
126
+ config: file,
127
+ build: svc.build.context,
128
+ ...(svc.build.dockerfile ? { dockerfile: svc.build.dockerfile } : {}),
129
+ ...(svc.image ? { image: svc.image } : {}),
130
+ },
131
+ ...(context ? { sourceRoots: [context] } : {}),
132
+ };
133
+ addNode(node);
134
+ if (!kindByService.has(svc.name))
135
+ kindByService.set(svc.name, 'container');
136
+ continue;
137
+ }
138
+ // Image-only (or neither): pulled/prebuilt → classify by role, no source root.
139
+ const kind = svc.image ? classifyImage(svc.image) : 'container';
140
+ addNode({
141
+ id,
142
+ label: svc.name,
143
+ kind,
144
+ provenance: 'declared',
145
+ metadata: { provider: 'compose', config: file, ...(svc.image ? { image: svc.image } : {}) },
146
+ });
147
+ if (!kindByService.has(svc.name))
148
+ kindByService.set(svc.name, kind);
149
+ }
150
+ }
151
+ // Pass 2: depends_on edges. Verb keyed by the TARGET's kind (now fully known).
152
+ const edgeKeys = new Set();
153
+ for (const { config, file } of entries) {
154
+ for (const svc of config.services) {
155
+ for (const dep of svc.dependsOn) {
156
+ if (!kindByService.has(dep))
157
+ continue; // dep not a declared service → skip
158
+ const depKind = kindByService.get(dep);
159
+ const kind = depKind === 'datastore' ? 'stores-in' : depKind === 'queue' ? 'publishes' : 'calls';
160
+ const source = serviceId(svc.name);
161
+ const target = serviceId(dep);
162
+ const key = `${source}→${target}:${kind}`;
163
+ if (edgeKeys.has(key))
164
+ continue;
165
+ edgeKeys.add(key);
166
+ edges.push({ source, target, kind, metadata: { via: 'depends_on', config: file } });
167
+ }
168
+ }
169
+ }
170
+ return {
171
+ root,
172
+ adapter: 'compose',
173
+ nodes: [...nodes.values()],
174
+ edges,
175
+ classificationsNeeded: [], // compose's model maps statically — no LLM
176
+ };
177
+ }
178
+ // ---------------------------------------------------------------------------
179
+ // Adapter.
180
+ export const dockerComposeAdapter = {
181
+ name: 'compose',
182
+ async detect(repoDir) {
183
+ return findComposeFiles(repoDir).length > 0;
184
+ },
185
+ async extract(repoDir) {
186
+ const files = findComposeFiles(repoDir);
187
+ const entries = [];
188
+ for (const file of files) {
189
+ try {
190
+ const config = parseComposeConfig(readFileSync(file, 'utf8'));
191
+ entries.push({ config, file: (relative(repoDir, file) || file).split('\\').join('/') });
192
+ }
193
+ catch (err) {
194
+ // A single malformed compose file shouldn't sink the whole infra layer.
195
+ console.warn(` [compose] skipping unparseable ${file}: ${err.message}`);
196
+ }
197
+ }
198
+ return buildComposeGraph(entries, repoDir);
199
+ },
200
+ };
201
+ //# sourceMappingURL=compose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.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