@geekmidas/cli 10.0.0-alpha.12 → 10.0.0-alpha.120

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 (517) hide show
  1. package/README.md +310 -377
  2. package/bin/adjacent-tsconfig.mjs +46 -8
  3. package/bin/gkm.mjs +11 -3
  4. package/bin/owning-tsconfig-jsx-register.mjs +18 -0
  5. package/bin/owning-tsconfig-jsx.mjs +108 -0
  6. package/dist/EndpointGenerator-BDa6pPgE.cjs +1090 -0
  7. package/dist/EndpointGenerator-BDa6pPgE.cjs.map +1 -0
  8. package/dist/EndpointGenerator-CP_z_E3e.mjs +1031 -0
  9. package/dist/EndpointGenerator-CP_z_E3e.mjs.map +1 -0
  10. package/dist/GoDaddyProvider-3C8U_tVu.cjs +388 -0
  11. package/dist/GoDaddyProvider-3C8U_tVu.cjs.map +1 -0
  12. package/dist/GoDaddyProvider-D0MQoOM4.mjs +388 -0
  13. package/dist/GoDaddyProvider-D0MQoOM4.mjs.map +1 -0
  14. package/dist/{HostingerProvider-BcyFRbqV.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
  15. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
  16. package/dist/{HostingerProvider-BOvsgATO.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
  17. package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
  18. package/dist/LegacyStateStore-CRi7TosX.mjs +124 -0
  19. package/dist/LegacyStateStore-CRi7TosX.mjs.map +1 -0
  20. package/dist/LegacyStateStore-DHsoQGOo.cjs +124 -0
  21. package/dist/LegacyStateStore-DHsoQGOo.cjs.map +1 -0
  22. package/dist/LocalStateStore-BQXTkeoS.cjs +178 -0
  23. package/dist/LocalStateStore-BQXTkeoS.cjs.map +1 -0
  24. package/dist/LocalStateStore-Dkth0jXX.mjs +167 -0
  25. package/dist/LocalStateStore-Dkth0jXX.mjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-CsrukCE-.mjs +536 -0
  27. package/dist/OpenApiTsGenerator-CsrukCE-.mjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-FNhY7Ssz.cjs +541 -0
  29. package/dist/OpenApiTsGenerator-FNhY7Ssz.cjs.map +1 -0
  30. package/dist/{Route53Provider-CH9XH7bz.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
  31. package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
  32. package/dist/{Route53Provider-C0xmer8U.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
  33. package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
  34. package/dist/S3StateStore-DGKZgyKz.cjs +222 -0
  35. package/dist/S3StateStore-DGKZgyKz.cjs.map +1 -0
  36. package/dist/S3StateStore-pZZnLLBd.mjs +223 -0
  37. package/dist/S3StateStore-pZZnLLBd.mjs.map +1 -0
  38. package/dist/SSMStateStore-CZRMERDA.mjs +205 -0
  39. package/dist/SSMStateStore-CZRMERDA.mjs.map +1 -0
  40. package/dist/SSMStateStore-DzkyjQ5D.cjs +204 -0
  41. package/dist/SSMStateStore-DzkyjQ5D.cjs.map +1 -0
  42. package/dist/SubscriberGenerator-C8CPxrCK.cjs +592 -0
  43. package/dist/SubscriberGenerator-C8CPxrCK.cjs.map +1 -0
  44. package/dist/SubscriberGenerator-y3pncae_.mjs +533 -0
  45. package/dist/SubscriberGenerator-y3pncae_.mjs.map +1 -0
  46. package/dist/add-C0kXOsWS.mjs +717 -0
  47. package/dist/add-C0kXOsWS.mjs.map +1 -0
  48. package/dist/add-Df8cmz0H.cjs +719 -0
  49. package/dist/add-Df8cmz0H.cjs.map +1 -0
  50. package/dist/appPorts-BoXMwolc.mjs +249 -0
  51. package/dist/appPorts-BoXMwolc.mjs.map +1 -0
  52. package/dist/appPorts-IW-OZmRi.cjs +296 -0
  53. package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
  54. package/dist/aws-8QQ8n-t6.mjs +89 -0
  55. package/dist/aws-8QQ8n-t6.mjs.map +1 -0
  56. package/dist/aws-DY9NqQIT.cjs +100 -0
  57. package/dist/aws-DY9NqQIT.cjs.map +1 -0
  58. package/dist/awsStore-Bx5nCFnS.mjs +121 -0
  59. package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
  60. package/dist/awsStore-u3ehhMoY.cjs +138 -0
  61. package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
  62. package/dist/{backup-provisioner-DXXg6FIL.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-cE2PuCTb.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
  65. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  66. package/dist/backups/runner.cjs +519 -0
  67. package/dist/backups/runner.cjs.map +1 -0
  68. package/dist/backups/runner.d.cts +102 -0
  69. package/dist/backups/runner.d.cts.map +1 -0
  70. package/dist/backups/runner.d.mts +102 -0
  71. package/dist/backups/runner.d.mts.map +1 -0
  72. package/dist/backups/runner.mjs +506 -0
  73. package/dist/backups/runner.mjs.map +1 -0
  74. package/dist/{bundler-Bux2iF-v.mjs → bundler-B-I4Du99.mjs} +35 -16
  75. package/dist/bundler-B-I4Du99.mjs.map +1 -0
  76. package/dist/{bundler-BMekgx7a.cjs → bundler-Dx_grUmc.cjs} +37 -19
  77. package/dist/bundler-Dx_grUmc.cjs.map +1 -0
  78. package/dist/cli-Cd9exatJ.cjs +71 -0
  79. package/dist/cli-Cd9exatJ.cjs.map +1 -0
  80. package/dist/cli-DL7GxGAe.mjs +71 -0
  81. package/dist/cli-DL7GxGAe.mjs.map +1 -0
  82. package/dist/compose-C43c03WZ.mjs +3284 -0
  83. package/dist/compose-C43c03WZ.mjs.map +1 -0
  84. package/dist/compose-Mdgea4Yt.cjs +3427 -0
  85. package/dist/compose-Mdgea4Yt.cjs.map +1 -0
  86. package/dist/config-D48erO2j.d.mts +269 -0
  87. package/dist/config-D48erO2j.d.mts.map +1 -0
  88. package/dist/config-DHDtsQrB.d.cts +269 -0
  89. package/dist/config-DHDtsQrB.d.cts.map +1 -0
  90. package/dist/config.cjs +421 -11
  91. package/dist/config.cjs.map +1 -0
  92. package/dist/config.d.cts +4 -120
  93. package/dist/config.d.mts +4 -120
  94. package/dist/config.mjs +405 -4
  95. package/dist/config.mjs.map +1 -0
  96. package/dist/credentialSchemas-B67WJOOm.cjs +272 -0
  97. package/dist/credentialSchemas-B67WJOOm.cjs.map +1 -0
  98. package/dist/credentialSchemas-DDOLRCLF.mjs +237 -0
  99. package/dist/credentialSchemas-DDOLRCLF.mjs.map +1 -0
  100. package/dist/credentials-B5N5yKk6.mjs +267 -0
  101. package/dist/credentials-B5N5yKk6.mjs.map +1 -0
  102. package/dist/credentials-Zqr3QQYB.cjs +350 -0
  103. package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
  104. package/dist/databases-BPOgTn1u.mjs +522 -0
  105. package/dist/databases-BPOgTn1u.mjs.map +1 -0
  106. package/dist/databases-fOaoBInm.cjs +625 -0
  107. package/dist/databases-fOaoBInm.cjs.map +1 -0
  108. package/dist/define-6poNqm5O.mjs +106 -0
  109. package/dist/define-6poNqm5O.mjs.map +1 -0
  110. package/dist/define-crmMcXFS.cjs +153 -0
  111. package/dist/define-crmMcXFS.cjs.map +1 -0
  112. package/dist/deploy/public.cjs +212 -0
  113. package/dist/deploy/public.cjs.map +1 -0
  114. package/dist/deploy/public.d.cts +654 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +654 -0
  117. package/dist/deploy/public.d.mts.map +1 -0
  118. package/dist/deploy/public.mjs +145 -0
  119. package/dist/deploy/public.mjs.map +1 -0
  120. package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
  121. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  122. package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
  123. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  124. package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
  125. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  126. package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
  127. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  128. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  129. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  130. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  131. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  132. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  133. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  134. package/dist/deploy/sniffer-hooks.cjs +13 -7
  135. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  136. package/dist/deploy/sniffer-hooks.d.cts +1 -2
  137. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  138. package/dist/deploy/sniffer-hooks.d.mts +1 -2
  139. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  140. package/dist/deploy/sniffer-hooks.mjs +10 -3
  141. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  142. package/dist/deploy/sniffer-loader.cjs +16 -7
  143. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  144. package/dist/deploy/sniffer-loader.d.cts +1 -1
  145. package/dist/deploy/sniffer-loader.d.mts +1 -1
  146. package/dist/deploy/sniffer-loader.mjs +14 -3
  147. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  148. package/dist/deploy/sniffer-routes-worker.cjs +11 -11
  149. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  150. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  151. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  152. package/dist/deploy/sniffer-routes-worker.mjs +4 -4
  153. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  154. package/dist/deploy/sniffer-worker.cjs +15 -6
  155. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  156. package/dist/deploy/sniffer-worker.d.cts +1 -3
  157. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  158. package/dist/deploy/sniffer-worker.d.mts +1 -3
  159. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  160. package/dist/deploy/sniffer-worker.mjs +15 -4
  161. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  162. package/dist/deploy-BMM2hx-K.cjs +2401 -0
  163. package/dist/deploy-BMM2hx-K.cjs.map +1 -0
  164. package/dist/deploy-D5YhwDng.mjs +2328 -0
  165. package/dist/deploy-D5YhwDng.mjs.map +1 -0
  166. package/dist/derive-B4vDpzgP.mjs +150 -0
  167. package/dist/derive-B4vDpzgP.mjs.map +1 -0
  168. package/dist/derive-DAbo49sm.cjs +161 -0
  169. package/dist/derive-DAbo49sm.cjs.map +1 -0
  170. package/dist/discover-C5roJuc9.mjs +560 -0
  171. package/dist/discover-C5roJuc9.mjs.map +1 -0
  172. package/dist/discover-CSW_BMWa.d.cts +125 -0
  173. package/dist/discover-CSW_BMWa.d.cts.map +1 -0
  174. package/dist/discover-DozUKs8f.cjs +639 -0
  175. package/dist/discover-DozUKs8f.cjs.map +1 -0
  176. package/dist/discover-xtT7fgWg.d.mts +125 -0
  177. package/dist/discover-xtT7fgWg.d.mts.map +1 -0
  178. package/dist/dns-BIYf20p7.cjs +1057 -0
  179. package/dist/dns-BIYf20p7.cjs.map +1 -0
  180. package/dist/dns-agf2VCdV.mjs +926 -0
  181. package/dist/dns-agf2VCdV.mjs.map +1 -0
  182. package/dist/dokploy-2p4PK6ej.mjs +38 -0
  183. package/dist/dokploy-2p4PK6ej.mjs.map +1 -0
  184. package/dist/dokploy-BANMTroy.cjs +38 -0
  185. package/dist/dokploy-BANMTroy.cjs.map +1 -0
  186. package/dist/drivers-BjGDYfnC.mjs +195 -0
  187. package/dist/drivers-BjGDYfnC.mjs.map +1 -0
  188. package/dist/drivers-DbjiYpW6.cjs +224 -0
  189. package/dist/drivers-DbjiYpW6.cjs.map +1 -0
  190. package/dist/eas-CNi16SoO.cjs +337 -0
  191. package/dist/eas-CNi16SoO.cjs.map +1 -0
  192. package/dist/eas-iT2JDHCh.mjs +334 -0
  193. package/dist/eas-iT2JDHCh.mjs.map +1 -0
  194. package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
  195. package/dist/emit-C1e8qD08.mjs.map +1 -0
  196. package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
  197. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  198. package/dist/encryption-DkXVbyZc.mjs +89 -0
  199. package/dist/encryption-DkXVbyZc.mjs.map +1 -0
  200. package/dist/encryption-d2lLtkYx.cjs +90 -0
  201. package/dist/encryption-d2lLtkYx.cjs.map +1 -0
  202. package/dist/engine-CatKW6E-.mjs +3089 -0
  203. package/dist/engine-CatKW6E-.mjs.map +1 -0
  204. package/dist/engine-DlEHexED.cjs +3202 -0
  205. package/dist/engine-DlEHexED.cjs.map +1 -0
  206. package/dist/errors-D8Gwp5kU.mjs +23 -0
  207. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  208. package/dist/errors-DMC4Umsb.cjs +34 -0
  209. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  210. package/dist/github-BAeaC1Pl.cjs +833 -0
  211. package/dist/github-BAeaC1Pl.cjs.map +1 -0
  212. package/dist/github-DErsqKGN.mjs +832 -0
  213. package/dist/github-DErsqKGN.mjs.map +1 -0
  214. package/dist/googlePlay-BVcfFWRO.cjs +931 -0
  215. package/dist/googlePlay-BVcfFWRO.cjs.map +1 -0
  216. package/dist/googlePlay-BXJ5ZjMK.mjs +931 -0
  217. package/dist/googlePlay-BXJ5ZjMK.mjs.map +1 -0
  218. package/dist/identity-CBXr4wNi.mjs +129 -0
  219. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  220. package/dist/identity-CbLfgQNT.cjs +182 -0
  221. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  222. package/dist/{index-BzJ7QJ9c.d.mts → index-8OfpOtSI.d.cts} +39 -20
  223. package/dist/index-8OfpOtSI.d.cts.map +1 -0
  224. package/dist/{index-CfMjtdVC.d.cts → index-Dpji6Bxq.d.mts} +39 -20
  225. package/dist/index-Dpji6Bxq.d.mts.map +1 -0
  226. package/dist/index.cjs +14291 -11898
  227. package/dist/index.cjs.map +1 -1
  228. package/dist/index.d.cts +1 -1
  229. package/dist/index.d.mts +1 -1
  230. package/dist/index.mjs +13938 -11560
  231. package/dist/index.mjs.map +1 -1
  232. package/dist/local-BwC2v2Y8.mjs +224 -0
  233. package/dist/local-BwC2v2Y8.mjs.map +1 -0
  234. package/dist/local-DNhnkugT.cjs +241 -0
  235. package/dist/local-DNhnkugT.cjs.map +1 -0
  236. package/dist/migrate-Bb1MmGHl.mjs +181 -0
  237. package/dist/migrate-Bb1MmGHl.mjs.map +1 -0
  238. package/dist/migrate-D79GI0XM.cjs +271 -0
  239. package/dist/migrate-D79GI0XM.cjs.map +1 -0
  240. package/dist/migrate-L4a273dY.cjs +181 -0
  241. package/dist/migrate-L4a273dY.cjs.map +1 -0
  242. package/dist/migrate-s4QizIoM.mjs +266 -0
  243. package/dist/migrate-s4QizIoM.mjs.map +1 -0
  244. package/dist/openapi.cjs +214 -10
  245. package/dist/openapi.cjs.map +1 -0
  246. package/dist/openapi.d.cts +38 -17
  247. package/dist/openapi.d.cts.map +1 -1
  248. package/dist/openapi.d.mts +38 -17
  249. package/dist/openapi.d.mts.map +1 -1
  250. package/dist/openapi.mjs +208 -5
  251. package/dist/openapi.mjs.map +1 -0
  252. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  253. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  254. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  255. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  256. package/dist/provider-BqpjG9QM.cjs +57 -0
  257. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  258. package/dist/provider-CEOKk8NS.mjs +46 -0
  259. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  260. package/dist/publish-CcTlmJT6.mjs +123 -0
  261. package/dist/publish-CcTlmJT6.mjs.map +1 -0
  262. package/dist/publish-ydscCYsW.cjs +124 -0
  263. package/dist/publish-ydscCYsW.cjs.map +1 -0
  264. package/dist/ready-BFFP838V.cjs +404 -0
  265. package/dist/ready-BFFP838V.cjs.map +1 -0
  266. package/dist/ready-BOfogqzr.mjs +375 -0
  267. package/dist/ready-BOfogqzr.mjs.map +1 -0
  268. package/dist/reconcile/public.cjs +3 -5
  269. package/dist/reconcile/public.d.cts +11 -87
  270. package/dist/reconcile/public.d.cts.map +1 -1
  271. package/dist/reconcile/public.d.mts +11 -87
  272. package/dist/reconcile/public.d.mts.map +1 -1
  273. package/dist/reconcile/public.mjs +3 -4
  274. package/dist/{reconcile-BI0tWkwz.mjs → reconcile--I7V4Klj.mjs} +4 -7
  275. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  276. package/dist/{reconcile-Bhw5fmKu.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  277. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  278. package/dist/resolve-BLp2trep.mjs +263 -0
  279. package/dist/resolve-BLp2trep.mjs.map +1 -0
  280. package/dist/resolve-BgL-brF9.cjs +316 -0
  281. package/dist/resolve-BgL-brF9.cjs.map +1 -0
  282. package/dist/rollback-2cyLXEH1.cjs +165 -0
  283. package/dist/rollback-2cyLXEH1.cjs.map +1 -0
  284. package/dist/rollback-DwqZ8zzj.mjs +136 -0
  285. package/dist/rollback-DwqZ8zzj.mjs.map +1 -0
  286. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  287. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  288. package/dist/run-BJLIerMM.mjs +133 -0
  289. package/dist/run-BJLIerMM.mjs.map +1 -0
  290. package/dist/run-fVZ-rLnc.cjs +174 -0
  291. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  292. package/dist/runtime-ACdfK59n.d.cts +82 -0
  293. package/dist/runtime-ACdfK59n.d.cts.map +1 -0
  294. package/dist/runtime-YyQuekxi.d.mts +82 -0
  295. package/dist/runtime-YyQuekxi.d.mts.map +1 -0
  296. package/dist/s3-CrPoA89T.cjs +215 -0
  297. package/dist/s3-CrPoA89T.cjs.map +1 -0
  298. package/dist/s3-DQXZdmCM.mjs +215 -0
  299. package/dist/s3-DQXZdmCM.mjs.map +1 -0
  300. package/dist/sandbox/config-worker.cjs +43 -0
  301. package/dist/sandbox/config-worker.cjs.map +1 -0
  302. package/dist/sandbox/config-worker.d.cts +1 -0
  303. package/dist/sandbox/config-worker.d.mts +1 -0
  304. package/dist/sandbox/config-worker.mjs +44 -0
  305. package/dist/sandbox/config-worker.mjs.map +1 -0
  306. package/dist/sandbox/credentials-worker.cjs +54 -0
  307. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  308. package/dist/sandbox/credentials-worker.d.cts +1 -0
  309. package/dist/sandbox/credentials-worker.d.mts +1 -0
  310. package/dist/sandbox/credentials-worker.mjs +55 -0
  311. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  312. package/dist/sandbox/discover-worker.cjs +50 -0
  313. package/dist/sandbox/discover-worker.cjs.map +1 -0
  314. package/dist/sandbox/discover-worker.d.cts +1 -0
  315. package/dist/sandbox/discover-worker.d.mts +1 -0
  316. package/dist/sandbox/discover-worker.mjs +51 -0
  317. package/dist/sandbox/discover-worker.mjs.map +1 -0
  318. package/dist/sandbox/migrate-worker.cjs +75 -0
  319. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  320. package/dist/sandbox/migrate-worker.d.cts +1 -0
  321. package/dist/sandbox/migrate-worker.d.mts +1 -0
  322. package/dist/sandbox/migrate-worker.mjs +76 -0
  323. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  324. package/dist/sandbox-C4g1eG31.d.mts +104 -0
  325. package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
  326. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  327. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  328. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  329. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  330. package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
  331. package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
  332. package/dist/{workspace-DPV7FtAv.cjs → schemas-BCwKKA42.mjs} +958 -1816
  333. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  334. package/dist/{workspace-CtnZnWsa.mjs → schemas-BQ_v0lEX.cjs} +1048 -1626
  335. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  336. package/dist/secretsManager-CQORubp9.mjs +97 -0
  337. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  338. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  339. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  340. package/dist/seeds-C2w4UqVP.cjs +9347 -0
  341. package/dist/seeds-C2w4UqVP.cjs.map +1 -0
  342. package/dist/seeds-Cwtv-U9-.mjs +8350 -0
  343. package/dist/seeds-Cwtv-U9-.mjs.map +1 -0
  344. package/dist/serverSetup-CKs4K9gD.cjs +630 -0
  345. package/dist/serverSetup-CKs4K9gD.cjs.map +1 -0
  346. package/dist/serverSetup-P68H5Lal.mjs +630 -0
  347. package/dist/serverSetup-P68H5Lal.mjs.map +1 -0
  348. package/dist/sniffer-8C4q6Szd.mjs +1825 -0
  349. package/dist/sniffer-8C4q6Szd.mjs.map +1 -0
  350. package/dist/sniffer-CF7wNxMo.cjs +1998 -0
  351. package/dist/sniffer-CF7wNxMo.cjs.map +1 -0
  352. package/dist/sst-B-Uz4cvm.cjs +464 -0
  353. package/dist/sst-B-Uz4cvm.cjs.map +1 -0
  354. package/dist/sst-C1pxbFEd.mjs +441 -0
  355. package/dist/sst-C1pxbFEd.mjs.map +1 -0
  356. package/dist/stage-BvM_u2z4.mjs +302 -0
  357. package/dist/stage-BvM_u2z4.mjs.map +1 -0
  358. package/dist/stage-DEQJGW3r.cjs +313 -0
  359. package/dist/stage-DEQJGW3r.cjs.map +1 -0
  360. package/dist/stages-Cb9rqRbN.mjs +190 -0
  361. package/dist/stages-Cb9rqRbN.mjs.map +1 -0
  362. package/dist/stages-D4SnG5yl.cjs +190 -0
  363. package/dist/stages-D4SnG5yl.cjs.map +1 -0
  364. package/dist/target/public.cjs +15 -0
  365. package/dist/target/public.d.cts +28 -0
  366. package/dist/target/public.d.cts.map +1 -0
  367. package/dist/target/public.d.mts +28 -0
  368. package/dist/target/public.d.mts.map +1 -0
  369. package/dist/target/public.mjs +4 -0
  370. package/dist/terminal-CW_dWeTe.mjs +85 -0
  371. package/dist/terminal-CW_dWeTe.mjs.map +1 -0
  372. package/dist/terminal-DJlqcW_U.cjs +85 -0
  373. package/dist/terminal-DJlqcW_U.cjs.map +1 -0
  374. package/dist/types-B6UXlEkf.d.cts +7650 -0
  375. package/dist/types-B6UXlEkf.d.cts.map +1 -0
  376. package/dist/types-HqVPddRK.d.mts +7649 -0
  377. package/dist/types-HqVPddRK.d.mts.map +1 -0
  378. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  379. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  380. package/dist/utils-D_fxUqvU.mjs +156 -0
  381. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  382. package/dist/vitest.cjs +65 -0
  383. package/dist/vitest.cjs.map +1 -0
  384. package/dist/vitest.d.cts +29 -0
  385. package/dist/vitest.d.cts.map +1 -0
  386. package/dist/vitest.d.mts +29 -0
  387. package/dist/vitest.d.mts.map +1 -0
  388. package/dist/vitest.mjs +65 -0
  389. package/dist/vitest.mjs.map +1 -0
  390. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  391. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  392. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  393. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  394. package/dist/workspace/index.cjs +8 -4
  395. package/dist/workspace/index.d.cts +3 -3
  396. package/dist/workspace/index.d.mts +3 -3
  397. package/dist/workspace/index.mjs +2 -3
  398. package/dist/workspace-BwqQnool.cjs +2806 -0
  399. package/dist/workspace-BwqQnool.cjs.map +1 -0
  400. package/dist/workspace-D1QbNd55.mjs +2394 -0
  401. package/dist/workspace-D1QbNd55.mjs.map +1 -0
  402. package/package.json +54 -22
  403. package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
  404. package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
  405. package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
  406. package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
  407. package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
  408. package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
  409. package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
  410. package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
  411. package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
  412. package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
  413. package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
  414. package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
  415. package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
  416. package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
  417. package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
  418. package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
  419. package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
  420. package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
  421. package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
  422. package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
  423. package/dist/bundler-BMekgx7a.cjs.map +0 -1
  424. package/dist/bundler-Bux2iF-v.mjs.map +0 -1
  425. package/dist/chunk-Duj1WY3L.mjs +0 -7
  426. package/dist/config-DTsVjKZD.mjs +0 -402
  427. package/dist/config-DTsVjKZD.mjs.map +0 -1
  428. package/dist/config-RYR9j6EF.cjs +0 -462
  429. package/dist/config-RYR9j6EF.cjs.map +0 -1
  430. package/dist/config.d.cts.map +0 -1
  431. package/dist/config.d.mts.map +0 -1
  432. package/dist/credentials-B5zRHdAl.mjs +0 -141
  433. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  434. package/dist/credentials-BapzjyV5.cjs +0 -195
  435. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  436. package/dist/credentials-DQRvPz2S.cjs +0 -2769
  437. package/dist/credentials-DQRvPz2S.cjs.map +0 -1
  438. package/dist/credentials-jMJC63qs.mjs +0 -2625
  439. package/dist/credentials-jMJC63qs.mjs.map +0 -1
  440. package/dist/discover-BYHQwQqu.mjs +0 -242
  441. package/dist/discover-BYHQwQqu.mjs.map +0 -1
  442. package/dist/discover-DmW9Bscc.cjs +0 -290
  443. package/dist/discover-DmW9Bscc.cjs.map +0 -1
  444. package/dist/dokploy-api-5cK2InBm.cjs +0 -3
  445. package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
  446. package/dist/dokploy-api-pdaBryoY.mjs +0 -706
  447. package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
  448. package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
  449. package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
  450. package/dist/emit-CIlvnDvV.mjs.map +0 -1
  451. package/dist/emit-CUD1BWls.cjs.map +0 -1
  452. package/dist/encryption-D2pL3tHH.cjs +0 -54
  453. package/dist/encryption-D2pL3tHH.cjs.map +0 -1
  454. package/dist/encryption-YDsXXi6w.mjs +0 -3
  455. package/dist/encryption-_4zwjOAR.mjs +0 -42
  456. package/dist/encryption-_4zwjOAR.mjs.map +0 -1
  457. package/dist/encryption-sQ2Oxx0d.cjs +0 -4
  458. package/dist/fullstack-secrets-B6KBHf-g.mjs +0 -87
  459. package/dist/fullstack-secrets-B6KBHf-g.mjs.map +0 -1
  460. package/dist/fullstack-secrets-DL8v0y4D.cjs +0 -99
  461. package/dist/fullstack-secrets-DL8v0y4D.cjs.map +0 -1
  462. package/dist/generator-CNzBw7g5.cjs +0 -289
  463. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  464. package/dist/generator-VE2JrFlY.mjs +0 -253
  465. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  466. package/dist/github-BThvbf2W.cjs +0 -197
  467. package/dist/github-BThvbf2W.cjs.map +0 -1
  468. package/dist/github-DpMZurEK.mjs +0 -196
  469. package/dist/github-DpMZurEK.mjs.map +0 -1
  470. package/dist/index-BzJ7QJ9c.d.mts.map +0 -1
  471. package/dist/index-CfMjtdVC.d.cts.map +0 -1
  472. package/dist/keystore-C9rint2E.cjs +0 -101
  473. package/dist/keystore-C9rint2E.cjs.map +0 -1
  474. package/dist/keystore-TxeYM7an.mjs +0 -83
  475. package/dist/keystore-TxeYM7an.mjs.map +0 -1
  476. package/dist/openapi-Bs3-5q_r.mjs +0 -2021
  477. package/dist/openapi-Bs3-5q_r.mjs.map +0 -1
  478. package/dist/openapi-DWLTsYLL.cjs +0 -2075
  479. package/dist/openapi-DWLTsYLL.cjs.map +0 -1
  480. package/dist/openapi-react-query-Byltvm_7.mjs +0 -167
  481. package/dist/openapi-react-query-Byltvm_7.mjs.map +0 -1
  482. package/dist/openapi-react-query-CmJ1xDbn.cjs +0 -173
  483. package/dist/openapi-react-query-CmJ1xDbn.cjs.map +0 -1
  484. package/dist/openapi-react-query.cjs +0 -4
  485. package/dist/openapi-react-query.d.cts +0 -11
  486. package/dist/openapi-react-query.d.cts.map +0 -1
  487. package/dist/openapi-react-query.d.mts +0 -11
  488. package/dist/openapi-react-query.d.mts.map +0 -1
  489. package/dist/openapi-react-query.mjs +0 -4
  490. package/dist/reconcile-BI0tWkwz.mjs.map +0 -1
  491. package/dist/reconcile-Bhw5fmKu.cjs.map +0 -1
  492. package/dist/setup-BmLoNrDX.mjs +0 -12
  493. package/dist/setup-BrR1_xGy.cjs +0 -12
  494. package/dist/setup-BsNR2LBG.cjs +0 -467
  495. package/dist/setup-BsNR2LBG.cjs.map +0 -1
  496. package/dist/setup-D5-JMknk.mjs +0 -437
  497. package/dist/setup-D5-JMknk.mjs.map +0 -1
  498. package/dist/storage-B020InPW.mjs +0 -222
  499. package/dist/storage-B020InPW.mjs.map +0 -1
  500. package/dist/storage-CSNplaJn.cjs +0 -282
  501. package/dist/storage-CSNplaJn.cjs.map +0 -1
  502. package/dist/storage-DGBzMLZa.mjs +0 -4
  503. package/dist/storage-DlVol_oj.cjs +0 -8
  504. package/dist/sync-0ILCb-1S.cjs +0 -93
  505. package/dist/sync-0ILCb-1S.cjs.map +0 -1
  506. package/dist/sync-CzHXiR9c.mjs +0 -76
  507. package/dist/sync-CzHXiR9c.mjs.map +0 -1
  508. package/dist/sync-DYENfOt4.cjs +0 -4
  509. package/dist/sync-HAau6h_R.mjs +0 -3
  510. package/dist/types-DVIx8I1N.d.mts +0 -1950
  511. package/dist/types-DVIx8I1N.d.mts.map +0 -1
  512. package/dist/types-PMP_qXRY.d.cts +0 -1950
  513. package/dist/types-PMP_qXRY.d.cts.map +0 -1
  514. package/dist/workspace-Cji6lE8E.cjs +0 -10
  515. package/dist/workspace-CkJAtRIX.mjs +0 -9
  516. package/dist/workspace-CtnZnWsa.mjs.map +0 -1
  517. package/dist/workspace-DPV7FtAv.cjs.map +0 -1
@@ -0,0 +1,833 @@
1
+ const require_errors = require("./errors-DMC4Umsb.cjs");
2
+ const require_workspace = require("./workspace-BwqQnool.cjs");
3
+ const require_dns = require("./dns-BIYf20p7.cjs");
4
+ const require_seeds = require("./seeds-C2w4UqVP.cjs");
5
+ const require_identity = require("./identity-CbLfgQNT.cjs");
6
+ const require_discover = require("./discover-DozUKs8f.cjs");
7
+ const require_config = require("./config.cjs");
8
+ const require_deploy = require("./deploy-BMM2hx-K.cjs");
9
+ const require_projectBucket = require("./projectBucket-BBbQ1lHF.cjs");
10
+ const require_aws = require("./aws-DY9NqQIT.cjs");
11
+ const require_secretsManager = require("./secretsManager-RAGcEDX1.cjs");
12
+ let node_child_process = require("node:child_process");
13
+ let _aws_sdk_client_iam = require("@aws-sdk/client-iam");
14
+ //#region src/deploy/githubOidc.ts
15
+ /**
16
+ * The `sub` GitHub puts in a deploy job's OIDC token — what the deploy role's
17
+ * trust policy has to match exactly.
18
+ *
19
+ * It is not always `repo:<owner>/<name>:environment:<stage>`. A repository
20
+ * (or its organisation) decides the format, and says which through
21
+ * `GET /repos/{owner}/{repo}/actions/oidc/customization/sub`:
22
+ *
23
+ * - the default: `repo:<owner>/<name>:environment:<stage>`;
24
+ * - the immutable subject — the default for repositories created after
25
+ * 15 July 2026, opt-in before — puts the owner's and the repository's ids in
26
+ * the `repo` segment: `repo:<owner>@<ownerId>/<name>@<repoId>:environment:<stage>`.
27
+ * The API hands that segment back as `sub_claim_prefix`;
28
+ * - a custom template (`use_default: false`) builds the `sub` from
29
+ * `include_claim_keys`, in order, each as `<key>:<value>` joined by `:`,
30
+ * where `context` is `environment:<stage>` in an environment job.
31
+ *
32
+ * A `:` inside a value is sent as `%3A`.
33
+ *
34
+ * See https://docs.github.com/en/actions/reference/security/oidc.
35
+ */
36
+ /**
37
+ * Template keys whose values are known for a repository's environment job
38
+ * before the job runs. Anything else — `job_workflow_ref`, `ref`, `sha`,
39
+ * `run_id`, `workflow`, `actor`, a custom property — depends on the run.
40
+ */
41
+ const SUPPORTED_CLAIM_KEYS = [
42
+ "repo",
43
+ "context",
44
+ "environment",
45
+ "repository",
46
+ "repository_owner",
47
+ "repository_owner_id",
48
+ "repository_id",
49
+ "repository_visibility"
50
+ ];
51
+ const NEEDS_FACTS = /* @__PURE__ */ new Set([
52
+ "repository_owner_id",
53
+ "repository_id",
54
+ "repository_visibility"
55
+ ]);
56
+ /** A `:` inside a claim value is sent as `%3A`. */
57
+ function claim(value) {
58
+ return value.replaceAll(":", "%3A");
59
+ }
60
+ /** Whether {@link oidcSubject} needs the repository's ids or visibility. */
61
+ function needsRepoFacts(customization) {
62
+ const immutableWithoutPrefix = customization.use_immutable_subject === true && !customization.sub_claim_prefix;
63
+ if (customization.use_default) return immutableWithoutPrefix;
64
+ return (customization.include_claim_keys ?? []).some((key) => NEEDS_FACTS.has(key) || key === "repo" && immutableWithoutPrefix);
65
+ }
66
+ /**
67
+ * The exact `sub` of a job in `repo`'s `stage` environment.
68
+ *
69
+ * @throws OidcSubjectNotSupported when a custom template includes a claim
70
+ * whose value depends on the run, so no one subject can be trusted.
71
+ */
72
+ function oidcSubject(repo, stage, customization, facts) {
73
+ const [owner = "", name = ""] = repo.split("/");
74
+ const environment = `environment:${claim(stage)}`;
75
+ const repoSegment = () => {
76
+ if (customization.sub_claim_prefix) return customization.sub_claim_prefix;
77
+ if (customization.use_immutable_subject) {
78
+ if (!facts) throw new RepoFactsRequired(repo);
79
+ return `repo:${owner}@${facts.ownerId}/${name}@${facts.repoId}`;
80
+ }
81
+ return `repo:${repo}`;
82
+ };
83
+ const immutable = customization.use_immutable_subject === true || customization.sub_claim_prefix !== void 0;
84
+ if (customization.use_default) return {
85
+ subject: `${repoSegment()}:${environment}`,
86
+ kind: immutable ? "immutable" : "default"
87
+ };
88
+ const keys = customization.include_claim_keys ?? [];
89
+ const unsupported = keys.filter((key) => !SUPPORTED_CLAIM_KEYS.includes(key));
90
+ if (keys.length === 0 || unsupported.length > 0) throw new OidcSubjectNotSupported(repo, keys, unsupported);
91
+ if (keys.some((key) => NEEDS_FACTS.has(key)) && !facts) throw new RepoFactsRequired(repo);
92
+ return {
93
+ subject: keys.map((key) => {
94
+ switch (key) {
95
+ case "repo": return repoSegment();
96
+ case "context":
97
+ case "environment": return environment;
98
+ case "repository": return `repository:${claim(repo)}`;
99
+ case "repository_owner": return `repository_owner:${claim(owner)}`;
100
+ case "repository_owner_id": return `repository_owner_id:${facts.ownerId}`;
101
+ case "repository_id": return `repository_id:${facts.repoId}`;
102
+ default: return `repository_visibility:${claim(facts.visibility)}`;
103
+ }
104
+ }).join(":"),
105
+ kind: "custom"
106
+ };
107
+ }
108
+ /** The endpoint a repository's subject format is read from. */
109
+ function customizationEndpoint(repo) {
110
+ return `repos/${repo}/actions/oidc/customization/sub`;
111
+ }
112
+ /**
113
+ * The `sub` GitHub will send for `repo`'s `stage` environment, read from the
114
+ * repository's OIDC settings through `gh`.
115
+ *
116
+ * A repository on a custom template that names no keys of its own uses its
117
+ * organisation's, read from `orgs/{owner}/actions/oidc/customization/sub`.
118
+ * When the settings cannot be read at all — no permission, or a GitHub
119
+ * Enterprise Server without the endpoint — the default format is assumed, with
120
+ * a warning saying where to check it.
121
+ */
122
+ function resolveOidcSubject(gh, repo, stage) {
123
+ const endpoint = customizationEndpoint(repo);
124
+ let customization;
125
+ try {
126
+ customization = JSON.parse(gh(["api", endpoint]));
127
+ } catch {
128
+ return {
129
+ subject: `repo:${repo}:environment:${claim(stage)}`,
130
+ kind: "assumed",
131
+ warning: `Could not read ${endpoint}, so the default subject format is assumed. Check it with: gh api ${endpoint} — a repository on the immutable subject or a custom template sends a different sub, and the role would not be assumable.`
132
+ };
133
+ }
134
+ if (!customization.use_default && (customization.include_claim_keys ?? []).length === 0) {
135
+ const [owner = ""] = repo.split("/");
136
+ const orgEndpoint = `orgs/${owner}/actions/oidc/customization/sub`;
137
+ let org;
138
+ try {
139
+ org = JSON.parse(gh(["api", orgEndpoint]));
140
+ } catch {
141
+ throw new OrgOidcTemplateUnreadable(repo, orgEndpoint);
142
+ }
143
+ customization = {
144
+ ...customization,
145
+ include_claim_keys: org.include_claim_keys ?? [],
146
+ use_immutable_subject: customization.use_immutable_subject ?? org.use_immutable_subject
147
+ };
148
+ }
149
+ const facts = needsRepoFacts(customization) ? readRepoFacts(gh, repo) : void 0;
150
+ return oidcSubject(repo, stage, customization, facts);
151
+ }
152
+ function readRepoFacts(gh, repo) {
153
+ const raw = JSON.parse(gh(["api", `repos/${repo}`]));
154
+ return {
155
+ ownerId: raw.owner.id,
156
+ repoId: raw.id,
157
+ visibility: raw.visibility
158
+ };
159
+ }
160
+ /**
161
+ * The repository's custom subject template includes a claim whose value
162
+ * depends on the run — or names none — so no one subject can be trusted.
163
+ */
164
+ var OidcSubjectNotSupported = class extends require_errors.GkmError {
165
+ repo;
166
+ includeClaimKeys;
167
+ unsupportedKeys;
168
+ constructor(repo, includeClaimKeys, unsupportedKeys) {
169
+ super(`${repo} builds its OIDC subject from a custom template, ${JSON.stringify(includeClaimKeys)}, and ${unsupportedKeys.length > 0 ? `${unsupportedKeys.join(", ")} depend${unsupportedKeys.length === 1 ? "s" : ""} on the run` : "it names no claims"}, so the deploy role cannot trust one exact subject. Set the repository back to the default subject — gh api --method PUT ${customizationEndpoint(repo)} -F use_default=true — (or keep the immutable one by also passing -F use_immutable_subject=true), or use a template built only from ${SUPPORTED_CLAIM_KEYS.join(", ")}; then run this again.`);
170
+ this.repo = repo;
171
+ this.includeClaimKeys = includeClaimKeys;
172
+ this.unsupportedKeys = unsupportedKeys;
173
+ this.name = "OidcSubjectNotSupported";
174
+ }
175
+ };
176
+ /** The subject needs the repository's ids, and none were read. */
177
+ var RepoFactsRequired = class extends require_errors.GkmError {
178
+ repo;
179
+ constructor(repo) {
180
+ super(`The OIDC subject of ${repo} includes its owner and repository ids; read them with gh api repos/${repo} and pass them in.`);
181
+ this.repo = repo;
182
+ this.name = "RepoFactsRequired";
183
+ }
184
+ };
185
+ /**
186
+ * The repository uses its organisation's subject template, and that template
187
+ * could not be read — so what GitHub sends is unknown, and is not guessed.
188
+ */
189
+ var OrgOidcTemplateUnreadable = class extends require_errors.GkmError {
190
+ repo;
191
+ endpoint;
192
+ constructor(repo, endpoint) {
193
+ super(`${repo} uses its organisation's OIDC subject template, and ${endpoint} could not be read. Run this as an organisation owner (gh auth refresh -s admin:org), or set the repository back to the default subject with gh api --method PUT ${customizationEndpoint(repo)} -F use_default=true; then run this again.`);
194
+ this.repo = repo;
195
+ this.endpoint = endpoint;
196
+ this.name = "OrgOidcTemplateUnreadable";
197
+ }
198
+ };
199
+ //#endregion
200
+ //#region src/deploy/githubPolicy.ts
201
+ /**
202
+ * What SST needs to create a stack is most of AWS, so this is the default
203
+ * outside compose — said out loud in the output, and replaceable with
204
+ * `--policy-arn`.
205
+ */
206
+ const DEFAULT_POLICY_ARN = "arn:aws:iam::aws:policy/AdministratorAccess";
207
+ /** The name of the inline policy a compose stage's role is given. */
208
+ const SCOPED_POLICY_NAME = "gkm-deploy";
209
+ /** Every target the stage's apps deploy through. */
210
+ function deployTargets(workspace) {
211
+ const targets = /* @__PURE__ */ new Set([workspace.deploy?.default ?? "dokploy"]);
212
+ for (const app of Object.values(workspace.apps)) targets.add(app.resolvedDeployTarget);
213
+ return [...targets].sort();
214
+ }
215
+ /**
216
+ * The access the stage's deploy role is given: `--policy-arn` when passed,
217
+ * the scoped policy for a stage only the compose target deploys, and
218
+ * `AdministratorAccess` otherwise.
219
+ */
220
+ function deployAccess(workspace, stage, policyArn, manifest = {}) {
221
+ const buckets = Object.entries(manifest).filter(([, d]) => d.kind === "objects").map(([id]) => id);
222
+ if (policyArn) return {
223
+ kind: "managed",
224
+ policyArn,
225
+ reason: "--policy-arn"
226
+ };
227
+ const targets = deployTargets(workspace);
228
+ if (targets.length !== 1 || targets[0] !== "compose") return {
229
+ kind: "managed",
230
+ policyArn: DEFAULT_POLICY_ARN,
231
+ reason: `the ${targets.join(", ")} target${targets.length === 1 ? "" : "s"} deploy${targets.length === 1 ? "s" : ""} infrastructure; --policy-arn to narrow`
232
+ };
233
+ const project = workspace.name;
234
+ const store = workspace.secrets.store ?? "file";
235
+ const state = workspace.state;
236
+ if (typeof store === "object" && typeof store.provider === "object" || state !== void 0 && typeof state.provider === "object") return {
237
+ kind: "managed",
238
+ policyArn: DEFAULT_POLICY_ARN,
239
+ reason: `a custom ${typeof store === "object" && typeof store.provider === "object" ? "secrets store" : "state provider"} cannot be scoped; --policy-arn to narrow`
240
+ };
241
+ const describe = [];
242
+ const build = [];
243
+ const projectBucketIn = (account) => require_projectBucket.projectBucketName(require_identity.deployIdentity(workspace, stage).scope, account);
244
+ const projectBucketStatement = (account) => ({
245
+ Sid: "ProjectBucket",
246
+ Effect: "Allow",
247
+ Action: [...require_projectBucket.PROJECT_BUCKET_CREATE_ACTIONS],
248
+ Resource: `arn:aws:s3:::${projectBucketIn(account)}`
249
+ });
250
+ const stateInSecretsBucket = typeof store === "object" && store.provider === "s3" && state?.provider === "s3" && state.bucket === store.bucket;
251
+ if (typeof store === "object" && store.provider === "s3") {
252
+ const location = require_workspace.s3SecretsLocation(store, state);
253
+ const key = require_workspace.s3SecretsKey(location.prefix, project, stage);
254
+ const named = location.bucket;
255
+ const bucketIn = (account) => named ?? projectBucketIn(account);
256
+ describe.push(named ? `read and update s3://${named}/${key}` : `read and update ${key} in the project bucket ${projectBucketIn("<account>")}${stateInSecretsBucket ? "" : ", creating it"}`);
257
+ build.push((account) => [{
258
+ Sid: "StageSecrets",
259
+ Effect: "Allow",
260
+ Action: ["s3:GetObject", "s3:PutObject"],
261
+ Resource: `arn:aws:s3:::${bucketIn(account)}/${key}`
262
+ }, ...stateInSecretsBucket ? [] : [{
263
+ Sid: "StageSecretsBucket",
264
+ Effect: "Allow",
265
+ Action: ["s3:ListBucket"],
266
+ Resource: `arn:aws:s3:::${bucketIn(account)}`
267
+ }, ...named ? [] : [projectBucketStatement(account)]]]);
268
+ } else if (typeof store === "object" && store.provider === "ssm") {
269
+ const { region } = store;
270
+ const name = require_aws.secretsParameterName(project, stage);
271
+ describe.push(`read and update ${name} (SSM, ${region})`);
272
+ build.push((account) => [{
273
+ Sid: "StageSecrets",
274
+ Effect: "Allow",
275
+ Action: ["ssm:GetParameter", "ssm:PutParameter"],
276
+ Resource: `arn:aws:ssm:${region}:${account}:parameter${name}`
277
+ }]);
278
+ } else if (typeof store === "object" && store.provider === "secrets-manager") {
279
+ const { region, kmsKeyId } = store;
280
+ const name = require_secretsManager.secretsManagerSecretName(project, stage);
281
+ describe.push(`read and update ${name} (Secrets Manager, ${region})`);
282
+ build.push((account) => {
283
+ const statements = [{
284
+ Sid: "StageSecrets",
285
+ Effect: "Allow",
286
+ Action: [
287
+ "secretsmanager:GetSecretValue",
288
+ "secretsmanager:PutSecretValue",
289
+ "secretsmanager:CreateSecret"
290
+ ],
291
+ Resource: `arn:aws:secretsmanager:${region}:${account}:secret:${name}-??????`
292
+ }];
293
+ if (kmsKeyId) statements.push({
294
+ Sid: "StageSecretsKey",
295
+ Effect: "Allow",
296
+ Action: ["kms:Decrypt", "kms:GenerateDataKey"],
297
+ Resource: kmsKeyId.startsWith("arn:") ? kmsKeyId : "*",
298
+ Condition: { StringEquals: { "kms:ViaService": `secretsmanager.${region}.amazonaws.com` } }
299
+ });
300
+ return statements;
301
+ });
302
+ }
303
+ if (state?.provider === "ssm") {
304
+ const { region } = state;
305
+ const path = `/gkm/${project}/${stage}/`;
306
+ describe.push(`read and write the deploy state under ${path} (SSM, ${region})`);
307
+ build.push((account) => [{
308
+ Sid: "StageState",
309
+ Effect: "Allow",
310
+ Action: [
311
+ "ssm:GetParameter",
312
+ "ssm:PutParameter",
313
+ "ssm:DeleteParameter"
314
+ ],
315
+ Resource: `arn:aws:ssm:${region}:${account}:parameter${path}*`
316
+ }]);
317
+ } else if (state?.provider === "s3") {
318
+ const prefix = (state.prefix ?? "gkm").replace(/\/+$/, "");
319
+ const path = `${prefix ? `${prefix}/` : ""}${project}/${stage}/`;
320
+ const named = state.bucket;
321
+ const bucketIn = (account) => named ?? projectBucketIn(account);
322
+ describe.push(named ? `read and write the deploy state under s3://${named}/${path}` : `create the project bucket ${projectBucketIn("<account>")}, and read and write the deploy state under ${path} in it`);
323
+ build.push((account) => [...stateBucketStatements(bucketIn(account), path), ...named ? [] : [projectBucketStatement(account)]]);
324
+ }
325
+ const objects = require_workspace.stageProvider(workspace, "objects", stage);
326
+ if (objects.mode === "provider" && objects.name === "s3" && buckets.length) {
327
+ const { scope } = require_identity.deployIdentity(workspace, stage);
328
+ const names = [...buckets].sort().map((id) => ({
329
+ bucket: require_deploy.bucketName({
330
+ scope,
331
+ stage,
332
+ id
333
+ }),
334
+ user: require_deploy.iamUserName({
335
+ scope,
336
+ stage,
337
+ id
338
+ })
339
+ }));
340
+ const suffix = "?".repeat(6);
341
+ describe.push(`create and configure the buckets ${names.map((n) => n.bucket).join(", ")} and their IAM users (S3, IAM)`);
342
+ build.push((account) => [{
343
+ Sid: "StageBuckets",
344
+ Effect: "Allow",
345
+ Action: [
346
+ "s3:CreateBucket",
347
+ "s3:ListBucket",
348
+ "s3:GetBucketTagging",
349
+ "s3:PutBucketTagging",
350
+ "s3:GetBucketPublicAccessBlock",
351
+ "s3:PutBucketPublicAccessBlock",
352
+ "s3:GetBucketPolicy",
353
+ "s3:PutBucketPolicy",
354
+ "s3:GetEncryptionConfiguration",
355
+ "s3:PutEncryptionConfiguration",
356
+ "s3:GetBucketVersioning",
357
+ "s3:PutBucketVersioning",
358
+ "s3:GetBucketCORS",
359
+ "s3:PutBucketCORS",
360
+ "s3:GetLifecycleConfiguration",
361
+ "s3:PutLifecycleConfiguration"
362
+ ],
363
+ Resource: names.flatMap((n) => [`arn:aws:s3:::${n.bucket}`, `arn:aws:s3:::${n.bucket}-${suffix}`])
364
+ }, {
365
+ Sid: "StageBucketUsers",
366
+ Effect: "Allow",
367
+ Action: [
368
+ "iam:GetUser",
369
+ "iam:CreateUser",
370
+ "iam:TagUser",
371
+ "iam:ListUserTags",
372
+ "iam:GetUserPolicy",
373
+ "iam:PutUserPolicy",
374
+ "iam:ListAccessKeys",
375
+ "iam:CreateAccessKey",
376
+ "iam:DeleteAccessKey"
377
+ ],
378
+ Resource: names.map((n) => `arn:aws:iam::${account}:user${require_deploy.IAM_USER_PATH}${n.user}`)
379
+ }]);
380
+ }
381
+ if (require_dns.stageBackups(workspace, manifest, stage).mode === "on") {
382
+ const { scope } = require_identity.deployIdentity(workspace, stage);
383
+ const user = require_deploy.backupsUserName(scope, stage);
384
+ const bucketIn = (account) => require_projectBucket.projectBucketName(scope, account);
385
+ describe.push(`create the project bucket ${bucketIn("<account>")} and keep its lifecycle, and create the backups user ${user} and its key (S3, IAM)`);
386
+ build.push((account) => [{
387
+ Sid: "StageBackupsBucket",
388
+ Effect: "Allow",
389
+ Action: ["s3:ListBucket", .../* @__PURE__ */ new Set([...require_projectBucket.PROJECT_BUCKET_CREATE_ACTIONS, ...require_projectBucket.PROJECT_BUCKET_LIFECYCLE_ACTIONS])],
390
+ Resource: `arn:aws:s3:::${bucketIn(account)}`
391
+ }, {
392
+ Sid: "StageBackupsUser",
393
+ Effect: "Allow",
394
+ Action: [
395
+ "iam:GetUser",
396
+ "iam:CreateUser",
397
+ "iam:TagUser",
398
+ "iam:ListUserTags",
399
+ "iam:GetUserPolicy",
400
+ "iam:PutUserPolicy",
401
+ "iam:ListAccessKeys",
402
+ "iam:CreateAccessKey",
403
+ "iam:DeleteAccessKey"
404
+ ],
405
+ Resource: `arn:aws:iam::${account}:user${require_deploy.IAM_USER_PATH}${user}`
406
+ }]);
407
+ }
408
+ for (const { domain, config } of require_dns.stageDnsDomains(stage, workspace.domains, workspace.dns)) {
409
+ if (config.provider !== "route53") continue;
410
+ const zoneId = config.hostedZoneId?.replace(/^\/?hostedzone\//, "");
411
+ describe.push(`write the A, AAAA and CNAME records of ${domain} (Route53${zoneId ? `, ${zoneId}` : ""})`);
412
+ build.push(() => [
413
+ {
414
+ Sid: "StageDnsRecords",
415
+ Effect: "Allow",
416
+ Action: ["route53:ChangeResourceRecordSets", "route53:ListResourceRecordSets"],
417
+ Resource: `arn:aws:route53:::hostedzone/${zoneId ?? "*"}`
418
+ },
419
+ {
420
+ Sid: "StageDnsChanges",
421
+ Effect: "Allow",
422
+ Action: ["route53:GetChange"],
423
+ Resource: "arn:aws:route53:::change/*"
424
+ },
425
+ ...zoneId ? [] : [{
426
+ Sid: "StageDnsZones",
427
+ Effect: "Allow",
428
+ Action: ["route53:ListHostedZonesByName"],
429
+ Resource: "*"
430
+ }]
431
+ ]);
432
+ }
433
+ return {
434
+ kind: "scoped",
435
+ statements: (account) => build.flatMap((statements) => statements(account)),
436
+ describe
437
+ };
438
+ }
439
+ /**
440
+ * Reading and writing one stage's deploy state in `bucket`, as the deploy
441
+ * role is given it.
442
+ */
443
+ function stateBucketStatements(bucket, path) {
444
+ return [{
445
+ Sid: "StageState",
446
+ Effect: "Allow",
447
+ Action: [
448
+ "s3:GetObject",
449
+ "s3:PutObject",
450
+ "s3:DeleteObject"
451
+ ],
452
+ Resource: `arn:aws:s3:::${bucket}/${path}*`
453
+ }, {
454
+ Sid: "StageStateBucket",
455
+ Effect: "Allow",
456
+ Action: ["s3:ListBucket"],
457
+ Resource: `arn:aws:s3:::${bucket}`
458
+ }];
459
+ }
460
+ /** The scoped access as a policy document, or null when it allows nothing. */
461
+ function scopedPolicyDocument(statements) {
462
+ if (statements.length === 0) return null;
463
+ return JSON.stringify({
464
+ Version: "2012-10-17",
465
+ Statement: statements
466
+ });
467
+ }
468
+ /** The account an IAM ARN is in: `arn:aws:iam::<account>:…`. */
469
+ function accountOf(arn) {
470
+ return arn.split(":")[4] ?? "";
471
+ }
472
+ //#endregion
473
+ //#region src/deploy/github.ts
474
+ /**
475
+ * `gkm deploy:github` — let GitHub Actions deploy one stage, with no keys.
476
+ *
477
+ * A stage usually lives in its own AWS account — staging in one, production in
478
+ * another — so this runs once per stage, with that account's profile:
479
+ *
480
+ * gkm deploy:github --stage staging --profile acme-dev
481
+ * gkm deploy:github --stage prod --profile acme-prod
482
+ *
483
+ * In the stage's account it makes sure GitHub's OIDC provider exists, and a
484
+ * role that only this repository's `<stage>` environment can assume. On
485
+ * GitHub it creates that environment and gives it what the generated deploy
486
+ * workflow reads: `AWS_ROLE_ARN`, and — when the stage's secrets are kept in
487
+ * the local file — its key as `GKM_SECRETS_KEY`. With `secrets.store` set to
488
+ * S3, SSM or Secrets Manager the deploy job reads them with the role instead, so
489
+ * no key is handed to GitHub, and this checks the stage's store in the same
490
+ * account, with the same profile. Re-running it converges rather than duplicating.
491
+ *
492
+ * The role trusts the exact `sub` GitHub sends for the environment, read from
493
+ * the repository's OIDC subject settings (`githubOidc.ts`) — the default, the
494
+ * immutable subject with the owner's and repository's ids, or a custom
495
+ * template. A re-run rewrites an existing role's trust to it, so running this
496
+ * again repairs a role that trusted the wrong format. What the role may do is
497
+ * `githubPolicy.ts`: `AdministratorAccess` for SST, and for a compose stage
498
+ * only its own secrets (and deploy state, when that is in AWS).
499
+ */
500
+ const logger = console;
501
+ const GITHUB_OIDC_HOST = "token.actions.githubusercontent.com";
502
+ const AUDIENCE = "sts.amazonaws.com";
503
+ /**
504
+ * The tag recording which managed policy gkm attached to the role — so a
505
+ * re-run detaches only what gkm put there, never a policy someone else did.
506
+ */
507
+ const POLICY_TAG = "gkm:policy-arn";
508
+ /** The system's `gh`. */
509
+ const ghCli = (args, input) => (0, node_child_process.execFileSync)("gh", args, {
510
+ encoding: "utf-8",
511
+ stdio: [
512
+ "pipe",
513
+ "pipe",
514
+ "pipe"
515
+ ],
516
+ ...input === void 0 ? {} : { input }
517
+ }).trim();
518
+ /** The role a stage deploys as: `<project>-github-<stage>`, within IAM's 64. */
519
+ function roleName(project, stage) {
520
+ return `${project}-github-${stage}`.toLowerCase().replace(/[^a-z0-9+=,.@_-]/g, "-").slice(0, 64);
521
+ }
522
+ /**
523
+ * Who may assume the role: a workflow job whose OIDC token carries exactly
524
+ * `subject` — the repository's `<stage>` environment, in the format the
525
+ * repository sends (see `githubOidc.ts`), and nothing else. Not another
526
+ * branch's job, not another environment's: that is what keeps a staging
527
+ * deploy from using the production role.
528
+ */
529
+ function trustPolicy(providerArn, subject) {
530
+ return JSON.stringify({
531
+ Version: "2012-10-17",
532
+ Statement: [{
533
+ Effect: "Allow",
534
+ Principal: { Federated: providerArn },
535
+ Action: "sts:AssumeRoleWithWebIdentity",
536
+ Condition: { StringEquals: {
537
+ [`${GITHUB_OIDC_HOST}:aud`]: AUDIENCE,
538
+ [`${GITHUB_OIDC_HOST}:sub`]: subject
539
+ } }
540
+ }]
541
+ });
542
+ }
543
+ /**
544
+ * The subject a trust policy trusts, or undefined when it names none. IAM
545
+ * hands documents back URL-encoded.
546
+ */
547
+ function trustedSubject(document) {
548
+ if (!document) return void 0;
549
+ let parsed;
550
+ try {
551
+ parsed = JSON.parse(safeDecode(document));
552
+ } catch {
553
+ return;
554
+ }
555
+ for (const statement of parsed.Statement ?? []) for (const operator of Object.values(statement.Condition ?? {})) {
556
+ const value = operator[`${GITHUB_OIDC_HOST}:sub`];
557
+ if (typeof value === "string") return value;
558
+ if (Array.isArray(value)) return value.join(", ");
559
+ }
560
+ }
561
+ function safeDecode(value) {
562
+ try {
563
+ return decodeURIComponent(value);
564
+ } catch {
565
+ return value;
566
+ }
567
+ }
568
+ /** GitHub's OIDC provider in this account, created if it is not there. */
569
+ async function ensureOidcProvider(iam) {
570
+ const { OpenIDConnectProviderList = [] } = await iam.send(new _aws_sdk_client_iam.ListOpenIDConnectProvidersCommand({}));
571
+ const existing = OpenIDConnectProviderList.find((p) => p.Arn?.endsWith(`oidc-provider/${GITHUB_OIDC_HOST}`))?.Arn;
572
+ if (existing) return existing;
573
+ return (await iam.send(new _aws_sdk_client_iam.CreateOpenIDConnectProviderCommand({
574
+ Url: `https://${GITHUB_OIDC_HOST}`,
575
+ ClientIDList: [AUDIENCE]
576
+ }))).OpenIDConnectProviderArn;
577
+ }
578
+ function isNoSuchEntity(error) {
579
+ return error.name === "NoSuchEntityException";
580
+ }
581
+ /**
582
+ * The deploy role, created or brought back to this trust and access.
583
+ *
584
+ * Converges: re-running rewrites the trust, and moves the role from one access
585
+ * to another — detaching a managed policy only when the role's
586
+ * {@link POLICY_TAG} says gkm attached it.
587
+ */
588
+ async function ensureRole(iam, name, trust, access) {
589
+ let arn;
590
+ let created = false;
591
+ let previousSubject;
592
+ let recorded;
593
+ try {
594
+ const { Role } = await iam.send(new _aws_sdk_client_iam.GetRoleCommand({ RoleName: name }));
595
+ previousSubject = trustedSubject(Role.AssumeRolePolicyDocument);
596
+ await iam.send(new _aws_sdk_client_iam.UpdateAssumeRolePolicyCommand({
597
+ RoleName: name,
598
+ PolicyDocument: trust
599
+ }));
600
+ arn = Role.Arn;
601
+ const { Tags = [] } = await iam.send(new _aws_sdk_client_iam.ListRoleTagsCommand({ RoleName: name }));
602
+ recorded = Tags.find((tag) => tag.Key === POLICY_TAG)?.Value;
603
+ } catch (error) {
604
+ if (!isNoSuchEntity(error)) throw error;
605
+ const { Role } = await iam.send(new _aws_sdk_client_iam.CreateRoleCommand({
606
+ RoleName: name,
607
+ AssumeRolePolicyDocument: trust,
608
+ Description: "Deploys from GitHub Actions (gkm deploy:github)",
609
+ MaxSessionDuration: 7200
610
+ }));
611
+ arn = Role.Arn;
612
+ created = true;
613
+ }
614
+ const detached = [];
615
+ const leftAttached = [];
616
+ const detach = async (policyArn) => {
617
+ try {
618
+ await iam.send(new _aws_sdk_client_iam.DetachRolePolicyCommand({
619
+ RoleName: name,
620
+ PolicyArn: policyArn
621
+ }));
622
+ detached.push(policyArn);
623
+ } catch (error) {
624
+ if (!isNoSuchEntity(error)) throw error;
625
+ }
626
+ };
627
+ const deleteInline = async () => {
628
+ try {
629
+ await iam.send(new _aws_sdk_client_iam.DeleteRolePolicyCommand({
630
+ RoleName: name,
631
+ PolicyName: SCOPED_POLICY_NAME
632
+ }));
633
+ } catch (error) {
634
+ if (!isNoSuchEntity(error)) throw error;
635
+ }
636
+ };
637
+ if ("managed" in access) {
638
+ await iam.send(new _aws_sdk_client_iam.AttachRolePolicyCommand({
639
+ RoleName: name,
640
+ PolicyArn: access.managed
641
+ }));
642
+ if (recorded && recorded !== access.managed) await detach(recorded);
643
+ if (recorded !== access.managed) await iam.send(new _aws_sdk_client_iam.TagRoleCommand({
644
+ RoleName: name,
645
+ Tags: [{
646
+ Key: POLICY_TAG,
647
+ Value: access.managed
648
+ }]
649
+ }));
650
+ if (!created) await deleteInline();
651
+ return {
652
+ arn,
653
+ created,
654
+ previousSubject,
655
+ detached,
656
+ leftAttached
657
+ };
658
+ }
659
+ if (access.inline) await iam.send(new _aws_sdk_client_iam.PutRolePolicyCommand({
660
+ RoleName: name,
661
+ PolicyName: SCOPED_POLICY_NAME,
662
+ PolicyDocument: access.inline
663
+ }));
664
+ else if (!created) await deleteInline();
665
+ if (created) return {
666
+ arn,
667
+ created,
668
+ previousSubject,
669
+ detached,
670
+ leftAttached
671
+ };
672
+ if (recorded) {
673
+ await detach(recorded);
674
+ await iam.send(new _aws_sdk_client_iam.UntagRoleCommand({
675
+ RoleName: name,
676
+ TagKeys: [POLICY_TAG]
677
+ }));
678
+ }
679
+ const { AttachedPolicies = [] } = await iam.send(new _aws_sdk_client_iam.ListAttachedRolePoliciesCommand({ RoleName: name }));
680
+ for (const policy of AttachedPolicies) if (policy.PolicyArn && !detached.includes(policy.PolicyArn)) leftAttached.push(policy.PolicyArn);
681
+ return {
682
+ arn,
683
+ created,
684
+ previousSubject,
685
+ detached,
686
+ leftAttached
687
+ };
688
+ }
689
+ /**
690
+ * An IAM client for the stage's account.
691
+ *
692
+ * `fromIni` for a named profile, deliberately: it resolves exactly that
693
+ * profile — keys, assume-role, `credential_process` or SSO, whichever
694
+ * ~/.aws/config says — and never falls back to AWS_* in the environment. The
695
+ * provider chain checks the environment first, so exported staging keys would
696
+ * quietly win over `--profile prod` and the production role would land in the
697
+ * staging account.
698
+ */
699
+ async function iamFor(profile, endpoint) {
700
+ const config = { region: "us-east-1" };
701
+ if (profile) {
702
+ const { fromIni } = await import("@aws-sdk/credential-providers");
703
+ config.credentials = fromIni({ profile });
704
+ }
705
+ if (endpoint) {
706
+ config.endpoint = endpoint;
707
+ config.credentials = {
708
+ accessKeyId: "test",
709
+ secretAccessKey: "test"
710
+ };
711
+ }
712
+ return new _aws_sdk_client_iam.IAMClient(config);
713
+ }
714
+ async function deployGithubCommand(options, deps = {}) {
715
+ const gh = deps.gh ?? ghCli;
716
+ const { workspace } = await require_config.loadWorkspaceConfig(deps.cwd);
717
+ require_workspace.assertDeployedStage(workspace.stages, options.stage);
718
+ const repo = options.repo ?? gh([
719
+ "repo",
720
+ "view",
721
+ "--json",
722
+ "nameWithOwner",
723
+ "-q",
724
+ ".nameWithOwner"
725
+ ]);
726
+ const role = roleName(workspace.name, options.stage);
727
+ const oidc = resolveOidcSubject(gh, repo, options.stage);
728
+ const manifest = await require_discover.discover({
729
+ patterns: require_seeds.constructGlobs(workspace),
730
+ cwd: workspace.root
731
+ });
732
+ const access = deployAccess(workspace, options.stage, options.policyArn, manifest);
733
+ const key = await require_seeds.readKey(options.stage, require_seeds.keystoreProject(workspace));
734
+ const keyPath = require_seeds.getKeyPath(options.stage, require_seeds.keystoreProject(workspace));
735
+ const hasKey = key !== null;
736
+ const remote = require_seeds.isRemoteStore(workspace, options.stage);
737
+ const store = await require_seeds.secretsStoreFor(workspace, options.stage, { ...options.profile ? { profile: options.profile } : {} });
738
+ const hasSecrets = remote && await store.read(options.stage) !== null;
739
+ const via = options.profile ? `profile "${options.profile}"` : "the default credentials";
740
+ logger.log(`\n🔐 GitHub → AWS for stage "${options.stage}"\n`);
741
+ logger.log(` Repository: ${repo}`);
742
+ logger.log(` AWS profile: ${options.profile ?? "(default credentials)"}`);
743
+ logger.log(` Role: ${role}`);
744
+ if (access.kind === "managed") logger.log(` Policy: ${access.policyArn} (${access.reason})`);
745
+ else if (access.describe.length > 0) {
746
+ logger.log(` Policy: inline "${SCOPED_POLICY_NAME}", scoped to the compose deploy — only:`);
747
+ for (const line of access.describe) logger.log(` ${line}`);
748
+ } else logger.log(" Policy: none — a compose deploy with file secrets and local state reads nothing from AWS");
749
+ logger.log(` Trusted by: ${oidc.subject} only (${SUBJECT_KINDS[oidc.kind]})`);
750
+ if (oidc.warning) logger.log(` ⚠ ${oidc.warning}`);
751
+ if (remote) logger.log(` Secrets: ${hasSecrets ? `in the store (${store.name}), read with ${via}` : `none in the store yet — gkm secrets:set <KEY> '…' --stage ${options.stage}`}`);
752
+ else logger.log(` Secrets key: ${hasKey ? keyPath : `none at ${keyPath} — run gkm secrets:init --stage ${options.stage} first`}`);
753
+ if (options.dryRun) {
754
+ if (access.kind === "scoped") {
755
+ const document = scopedPolicyDocument(access.statements("<account>"));
756
+ if (document) logger.log(`\n Inline policy:\n${JSON.stringify(JSON.parse(document), null, 2).replace(/^/gm, " ")}`);
757
+ }
758
+ logger.log("\n --dry-run: nothing changed.\n");
759
+ return {
760
+ repo,
761
+ subject: oidc.subject
762
+ };
763
+ }
764
+ const iam = deps.iam ?? await iamFor(options.profile);
765
+ const providerArn = await ensureOidcProvider(iam).catch((error) => {
766
+ if (/SSO session/i.test(String(error?.message)) && options.profile) throw new SsoSessionExpired(options.profile);
767
+ throw error;
768
+ });
769
+ const outcome = await ensureRole(iam, role, trustPolicy(providerArn, oidc.subject), access.kind === "managed" ? { managed: access.policyArn } : { inline: scopedPolicyDocument(access.statements(accountOf(providerArn))) });
770
+ const roleArn = outcome.arn;
771
+ logger.log(`\n ✓ AWS: ${roleArn}${outcome.created ? " (created)" : ""}`);
772
+ if (!outcome.created) logger.log(outcome.previousSubject === oidc.subject ? ` ✓ Trust: unchanged, ${oidc.subject}` : ` ✓ Trust: ${outcome.previousSubject ?? "(no subject)"} → ${oidc.subject}`);
773
+ for (const detached of outcome.detached) logger.log(` ✓ Detached ${detached} (attached by gkm, no longer needed)`);
774
+ if (access.kind === "scoped") for (const attached of outcome.leftAttached) logger.log(` ⚠ ${attached} is still attached to ${role}. gkm has no record of attaching it, so it is left; the compose deploy does not need it. Detach it with: aws iam detach-role-policy --role-name ${role} --policy-arn ${attached}${options.profile ? ` --profile ${options.profile}` : ""}`);
775
+ gh([
776
+ "api",
777
+ "--method",
778
+ "PUT",
779
+ `repos/${repo}/environments/${options.stage}`
780
+ ]);
781
+ gh([
782
+ "variable",
783
+ "set",
784
+ "AWS_ROLE_ARN",
785
+ "--env",
786
+ options.stage,
787
+ "--repo",
788
+ repo,
789
+ "--body",
790
+ roleArn
791
+ ]);
792
+ logger.log(` ✓ GitHub: environment "${options.stage}", AWS_ROLE_ARN`);
793
+ if (remote) {
794
+ if (!hasSecrets) logger.log(` ⚠ The "${options.stage}" store holds no secrets yet; set them with gkm secrets:set <KEY> '…' --stage ${options.stage}${options.profile ? ` (AWS_PROFILE=${options.profile})` : ""}.`);
795
+ } else if (hasKey) {
796
+ gh([
797
+ "secret",
798
+ "set",
799
+ "GKM_SECRETS_KEY",
800
+ "--env",
801
+ options.stage,
802
+ "--repo",
803
+ repo
804
+ ], key);
805
+ logger.log(" ✓ GitHub: GKM_SECRETS_KEY");
806
+ } else logger.log(` ⚠ No secrets key for "${options.stage}"; run gkm secrets:init --stage ${options.stage}, then this again.`);
807
+ logger.log(`\n Protect it: add required reviewers to the "${options.stage}" environment in the repository settings.\n`);
808
+ return {
809
+ roleArn,
810
+ repo,
811
+ subject: oidc.subject
812
+ };
813
+ }
814
+ const SUBJECT_KINDS = {
815
+ default: "the repository's default subject",
816
+ immutable: "the repository's immutable subject",
817
+ custom: "the repository's custom subject template",
818
+ assumed: "assumed: the default format"
819
+ };
820
+ /** The profile's SSO login has lapsed; the fix is one command away. */
821
+ var SsoSessionExpired = class extends require_errors.GkmError {
822
+ profile;
823
+ constructor(profile) {
824
+ super(`The SSO session for profile "${profile}" has expired or is invalid. Run: aws sso login --profile ${profile}`);
825
+ this.profile = profile;
826
+ this.name = "SsoSessionExpired";
827
+ }
828
+ };
829
+ //#endregion
830
+ exports.deployGithubCommand = deployGithubCommand;
831
+ exports.ghCli = ghCli;
832
+
833
+ //# sourceMappingURL=github-BAeaC1Pl.cjs.map