@geekmidas/cli 10.0.0-alpha.16 → 10.0.0-alpha.161

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 (446) hide show
  1. package/README.md +323 -380
  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-B5BKAoLz.mjs +1039 -0
  7. package/dist/EndpointGenerator-B5BKAoLz.mjs.map +1 -0
  8. package/dist/EndpointGenerator-DxrRqfJ3.cjs +1098 -0
  9. package/dist/EndpointGenerator-DxrRqfJ3.cjs.map +1 -0
  10. package/dist/GoDaddyProvider-CBqsvbER.cjs +412 -0
  11. package/dist/GoDaddyProvider-CBqsvbER.cjs.map +1 -0
  12. package/dist/GoDaddyProvider-CwqdLM1E.mjs +412 -0
  13. package/dist/GoDaddyProvider-CwqdLM1E.mjs.map +1 -0
  14. package/dist/{HostingerProvider-BZFGYYVA.cjs → HostingerProvider-DtOtsFkM.cjs} +23 -9
  15. package/dist/HostingerProvider-DtOtsFkM.cjs.map +1 -0
  16. package/dist/{HostingerProvider-BY26bWwB.mjs → HostingerProvider-gD4uqzMN.mjs} +23 -9
  17. package/dist/HostingerProvider-gD4uqzMN.mjs.map +1 -0
  18. package/dist/LegacyStateStore-6xsGADme.mjs +124 -0
  19. package/dist/LegacyStateStore-6xsGADme.mjs.map +1 -0
  20. package/dist/LegacyStateStore-C0rm5slD.cjs +124 -0
  21. package/dist/LegacyStateStore-C0rm5slD.cjs.map +1 -0
  22. package/dist/LocalStateStore-G0JHXOVW.mjs +167 -0
  23. package/dist/LocalStateStore-G0JHXOVW.mjs.map +1 -0
  24. package/dist/LocalStateStore-NBMF3zCb.cjs +178 -0
  25. package/dist/LocalStateStore-NBMF3zCb.cjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-DOTLKBFf.cjs +539 -0
  27. package/dist/OpenApiTsGenerator-DOTLKBFf.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-Vaf0pI8u.mjs +534 -0
  29. package/dist/OpenApiTsGenerator-Vaf0pI8u.mjs.map +1 -0
  30. package/dist/{Route53Provider-Cvj40A8I.mjs → Route53Provider-Di_SD9CF.mjs} +3 -3
  31. package/dist/Route53Provider-Di_SD9CF.mjs.map +1 -0
  32. package/dist/{Route53Provider-DVILBsvV.cjs → Route53Provider-emLuQHVw.cjs} +3 -3
  33. package/dist/Route53Provider-emLuQHVw.cjs.map +1 -0
  34. package/dist/S3StateStore-7n6gIYEJ.cjs +222 -0
  35. package/dist/S3StateStore-7n6gIYEJ.cjs.map +1 -0
  36. package/dist/S3StateStore-B7IPTvu0.mjs +223 -0
  37. package/dist/S3StateStore-B7IPTvu0.mjs.map +1 -0
  38. package/dist/SSMStateStore-CWEShHLS.mjs +205 -0
  39. package/dist/SSMStateStore-CWEShHLS.mjs.map +1 -0
  40. package/dist/SSMStateStore-O12NeGEg.cjs +204 -0
  41. package/dist/SSMStateStore-O12NeGEg.cjs.map +1 -0
  42. package/dist/SubscriberGenerator-BybB6uez.mjs +783 -0
  43. package/dist/SubscriberGenerator-BybB6uez.mjs.map +1 -0
  44. package/dist/SubscriberGenerator-mZpSuSU7.cjs +848 -0
  45. package/dist/SubscriberGenerator-mZpSuSU7.cjs.map +1 -0
  46. package/dist/add-C-nlqQgN.mjs +711 -0
  47. package/dist/add-C-nlqQgN.mjs.map +1 -0
  48. package/dist/add-ktNZmJb-.cjs +713 -0
  49. package/dist/add-ktNZmJb-.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/apps-C7SujLV-.mjs +5621 -0
  55. package/dist/apps-C7SujLV-.mjs.map +1 -0
  56. package/dist/apps-CtjYJS9e.cjs +6247 -0
  57. package/dist/apps-CtjYJS9e.cjs.map +1 -0
  58. package/dist/aws-C5LAU_Ii.mjs +97 -0
  59. package/dist/aws-C5LAU_Ii.mjs.map +1 -0
  60. package/dist/aws-DKC2m3sT.cjs +108 -0
  61. package/dist/aws-DKC2m3sT.cjs.map +1 -0
  62. package/dist/awsStore-Bx5nCFnS.mjs +121 -0
  63. package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
  64. package/dist/awsStore-u3ehhMoY.cjs +138 -0
  65. package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
  66. package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
  67. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  68. package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
  69. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  70. package/dist/backups/runner.cjs +519 -0
  71. package/dist/backups/runner.cjs.map +1 -0
  72. package/dist/backups/runner.d.cts +102 -0
  73. package/dist/backups/runner.d.cts.map +1 -0
  74. package/dist/backups/runner.d.mts +102 -0
  75. package/dist/backups/runner.d.mts.map +1 -0
  76. package/dist/backups/runner.mjs +506 -0
  77. package/dist/backups/runner.mjs.map +1 -0
  78. package/dist/{bundler-BeNDZdHQ.cjs → bundler-DGwgZmim.cjs} +59 -14
  79. package/dist/bundler-DGwgZmim.cjs.map +1 -0
  80. package/dist/{bundler-BodTL4kf.mjs → bundler-DnHKVaZz.mjs} +59 -14
  81. package/dist/bundler-DnHKVaZz.mjs.map +1 -0
  82. package/dist/cli-CI9v138l.mjs +80 -0
  83. package/dist/cli-CI9v138l.mjs.map +1 -0
  84. package/dist/cli-k2G7rG15.cjs +80 -0
  85. package/dist/cli-k2G7rG15.cjs.map +1 -0
  86. package/dist/compose-BD2rwRfn.cjs +1919 -0
  87. package/dist/compose-BD2rwRfn.cjs.map +1 -0
  88. package/dist/compose-Co-Dt-a4.mjs +1560 -0
  89. package/dist/compose-Co-Dt-a4.mjs.map +1 -0
  90. package/dist/compose-nGgRylPu.cjs +3163 -0
  91. package/dist/compose-nGgRylPu.cjs.map +1 -0
  92. package/dist/compose-reJW9x-G.mjs +3074 -0
  93. package/dist/compose-reJW9x-G.mjs.map +1 -0
  94. package/dist/config-B5Hi3mLK.cjs +821 -0
  95. package/dist/config-B5Hi3mLK.cjs.map +1 -0
  96. package/dist/config-C60T2h98.d.cts +291 -0
  97. package/dist/config-C60T2h98.d.cts.map +1 -0
  98. package/dist/config-CfI2g_Ho.d.mts +291 -0
  99. package/dist/config-CfI2g_Ho.d.mts.map +1 -0
  100. package/dist/config-DWTUVGRE.mjs +696 -0
  101. package/dist/config-DWTUVGRE.mjs.map +1 -0
  102. package/dist/config.cjs +13 -3
  103. package/dist/config.d.cts +4 -117
  104. package/dist/config.d.mts +4 -117
  105. package/dist/config.mjs +3 -3
  106. package/dist/credentialSchemas-BAklWDna.cjs +271 -0
  107. package/dist/credentialSchemas-BAklWDna.cjs.map +1 -0
  108. package/dist/credentialSchemas-mz9QZTYh.mjs +236 -0
  109. package/dist/credentialSchemas-mz9QZTYh.mjs.map +1 -0
  110. package/dist/credentials-BG1KOq9I.mjs +1838 -0
  111. package/dist/credentials-BG1KOq9I.mjs.map +1 -0
  112. package/dist/credentials-UlL1n_Rd.cjs +2293 -0
  113. package/dist/credentials-UlL1n_Rd.cjs.map +1 -0
  114. package/dist/databases-C1qqNxTu.mjs +588 -0
  115. package/dist/databases-C1qqNxTu.mjs.map +1 -0
  116. package/dist/databases-CrKh5jw6.cjs +703 -0
  117. package/dist/databases-CrKh5jw6.cjs.map +1 -0
  118. package/dist/define-6poNqm5O.mjs +106 -0
  119. package/dist/define-6poNqm5O.mjs.map +1 -0
  120. package/dist/define-crmMcXFS.cjs +153 -0
  121. package/dist/define-crmMcXFS.cjs.map +1 -0
  122. package/dist/deploy/public.cjs +211 -0
  123. package/dist/deploy/public.cjs.map +1 -0
  124. package/dist/deploy/public.d.cts +658 -0
  125. package/dist/deploy/public.d.cts.map +1 -0
  126. package/dist/deploy/public.d.mts +658 -0
  127. package/dist/deploy/public.d.mts.map +1 -0
  128. package/dist/deploy/public.mjs +144 -0
  129. package/dist/deploy/public.mjs.map +1 -0
  130. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  131. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  132. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  133. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  134. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  135. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  136. package/dist/deploy/sniffer-hooks.cjs +1 -1
  137. package/dist/deploy/sniffer-hooks.mjs +1 -1
  138. package/dist/deploy/sniffer-loader.cjs +2 -2
  139. package/dist/deploy/sniffer-loader.mjs +1 -1
  140. package/dist/deploy/sniffer-routes-worker.cjs +2 -2
  141. package/dist/deploy/sniffer-routes-worker.mjs +1 -1
  142. package/dist/deploy-CqIULk0k.cjs +3425 -0
  143. package/dist/deploy-CqIULk0k.cjs.map +1 -0
  144. package/dist/deploy-DRkCNV7f.mjs +3369 -0
  145. package/dist/deploy-DRkCNV7f.mjs.map +1 -0
  146. package/dist/destroy-CMldkiX-.cjs +789 -0
  147. package/dist/destroy-CMldkiX-.cjs.map +1 -0
  148. package/dist/destroy-DXIAL8nF.mjs +788 -0
  149. package/dist/destroy-DXIAL8nF.mjs.map +1 -0
  150. package/dist/discover-CRywE7yc.cjs +1085 -0
  151. package/dist/discover-CRywE7yc.cjs.map +1 -0
  152. package/dist/discover-DbDrCQ8h.mjs +940 -0
  153. package/dist/discover-DbDrCQ8h.mjs.map +1 -0
  154. package/dist/docker-DFFzQe2f.mjs +1408 -0
  155. package/dist/docker-DFFzQe2f.mjs.map +1 -0
  156. package/dist/docker-LwJW3dx_.cjs +1515 -0
  157. package/dist/docker-LwJW3dx_.cjs.map +1 -0
  158. package/dist/dokploy-DYm0D6Tp.mjs +38 -0
  159. package/dist/dokploy-DYm0D6Tp.mjs.map +1 -0
  160. package/dist/dokploy-wTsJqG-N.cjs +38 -0
  161. package/dist/dokploy-wTsJqG-N.cjs.map +1 -0
  162. package/dist/drivers-BhdC9Efj.cjs +248 -0
  163. package/dist/drivers-BhdC9Efj.cjs.map +1 -0
  164. package/dist/drivers-wcDnzf7l.mjs +213 -0
  165. package/dist/drivers-wcDnzf7l.mjs.map +1 -0
  166. package/dist/eas-BJ_Zlvm8.mjs +334 -0
  167. package/dist/eas-BJ_Zlvm8.mjs.map +1 -0
  168. package/dist/eas-C4EkjTGJ.cjs +337 -0
  169. package/dist/eas-C4EkjTGJ.cjs.map +1 -0
  170. package/dist/emit-C4KSXOeS.mjs +153 -0
  171. package/dist/emit-C4KSXOeS.mjs.map +1 -0
  172. package/dist/emit-DiW0kbue.cjs +164 -0
  173. package/dist/emit-DiW0kbue.cjs.map +1 -0
  174. package/dist/encryption-BQEqqrGq.cjs +90 -0
  175. package/dist/encryption-BQEqqrGq.cjs.map +1 -0
  176. package/dist/encryption-Cu5YTs9V.mjs +89 -0
  177. package/dist/encryption-Cu5YTs9V.mjs.map +1 -0
  178. package/dist/engine-DdRauUQC.cjs +3330 -0
  179. package/dist/engine-DdRauUQC.cjs.map +1 -0
  180. package/dist/engine-q8aCVbLH.mjs +3217 -0
  181. package/dist/engine-q8aCVbLH.mjs.map +1 -0
  182. package/dist/errors-D8Gwp5kU.mjs +23 -0
  183. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  184. package/dist/errors-DMC4Umsb.cjs +34 -0
  185. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  186. package/dist/github-CoXirRes.mjs +901 -0
  187. package/dist/github-CoXirRes.mjs.map +1 -0
  188. package/dist/github-OVZF2k0L.cjs +902 -0
  189. package/dist/github-OVZF2k0L.cjs.map +1 -0
  190. package/dist/googlePlay-CUeTUT7s.cjs +931 -0
  191. package/dist/googlePlay-CUeTUT7s.cjs.map +1 -0
  192. package/dist/googlePlay-HXRRVq0l.mjs +931 -0
  193. package/dist/googlePlay-HXRRVq0l.mjs.map +1 -0
  194. package/dist/iam-6LH6wptf.cjs +618 -0
  195. package/dist/iam-6LH6wptf.cjs.map +1 -0
  196. package/dist/iam-c0e8m04X.mjs +509 -0
  197. package/dist/iam-c0e8m04X.mjs.map +1 -0
  198. package/dist/{index-C-VLwB_Y.d.mts → index-DDY0cZCo.d.cts} +38 -14
  199. package/dist/index-DDY0cZCo.d.cts.map +1 -0
  200. package/dist/{index-C-HkOEBt.d.cts → index-DWNwkcy7.d.mts} +38 -14
  201. package/dist/index-DWNwkcy7.d.mts.map +1 -0
  202. package/dist/index.cjs +13752 -12326
  203. package/dist/index.cjs.map +1 -1
  204. package/dist/index.mjs +13791 -12363
  205. package/dist/index.mjs.map +1 -1
  206. package/dist/local-CCJ-T37d.mjs +224 -0
  207. package/dist/local-CCJ-T37d.mjs.map +1 -0
  208. package/dist/local-Dx0o6vfp.cjs +241 -0
  209. package/dist/local-Dx0o6vfp.cjs.map +1 -0
  210. package/dist/migrate-BkwSXhxv.mjs +181 -0
  211. package/dist/migrate-BkwSXhxv.mjs.map +1 -0
  212. package/dist/migrate-CJoKOCGY.cjs +181 -0
  213. package/dist/migrate-CJoKOCGY.cjs.map +1 -0
  214. package/dist/migrate-DEsYfgzn.cjs +272 -0
  215. package/dist/migrate-DEsYfgzn.cjs.map +1 -0
  216. package/dist/migrate-Dr0BeWsY.mjs +267 -0
  217. package/dist/migrate-Dr0BeWsY.mjs.map +1 -0
  218. package/dist/notes-BOyzuPqr.mjs +399 -0
  219. package/dist/notes-BOyzuPqr.mjs.map +1 -0
  220. package/dist/notes-VFPa51Pd.cjs +500 -0
  221. package/dist/notes-VFPa51Pd.cjs.map +1 -0
  222. package/dist/openapi.cjs +213 -7
  223. package/dist/openapi.cjs.map +1 -0
  224. package/dist/openapi.d.cts +32 -8
  225. package/dist/openapi.d.cts.map +1 -1
  226. package/dist/openapi.d.mts +32 -8
  227. package/dist/openapi.d.mts.map +1 -1
  228. package/dist/openapi.mjs +208 -2
  229. package/dist/openapi.mjs.map +1 -0
  230. package/dist/projectBucket-B26ucBRI.mjs +222 -0
  231. package/dist/projectBucket-B26ucBRI.mjs.map +1 -0
  232. package/dist/projectBucket-CWpY3Vxv.cjs +263 -0
  233. package/dist/projectBucket-CWpY3Vxv.cjs.map +1 -0
  234. package/dist/provider-BqpjG9QM.cjs +57 -0
  235. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  236. package/dist/provider-CEOKk8NS.mjs +46 -0
  237. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  238. package/dist/publish-Bg4iffje.mjs +123 -0
  239. package/dist/publish-Bg4iffje.mjs.map +1 -0
  240. package/dist/publish-IjcRoorJ.cjs +124 -0
  241. package/dist/publish-IjcRoorJ.cjs.map +1 -0
  242. package/dist/ready-BjFMu_1J.mjs +375 -0
  243. package/dist/ready-BjFMu_1J.mjs.map +1 -0
  244. package/dist/ready-eVMJIcWn.cjs +404 -0
  245. package/dist/ready-eVMJIcWn.cjs.map +1 -0
  246. package/dist/reconcile/public.cjs +3 -5
  247. package/dist/reconcile/public.d.cts +33 -89
  248. package/dist/reconcile/public.d.cts.map +1 -1
  249. package/dist/reconcile/public.d.mts +33 -89
  250. package/dist/reconcile/public.d.mts.map +1 -1
  251. package/dist/reconcile/public.mjs +3 -3
  252. package/dist/{reconcile-DhQ00DpU.mjs → reconcile--I7V4Klj.mjs} +2 -2
  253. package/dist/{reconcile-DhQ00DpU.mjs.map → reconcile--I7V4Klj.mjs.map} +1 -1
  254. package/dist/{reconcile-Dd2iyILf.cjs → reconcile-CuCQBa5-.cjs} +3 -3
  255. package/dist/{reconcile-Dd2iyILf.cjs.map → reconcile-CuCQBa5-.cjs.map} +1 -1
  256. package/dist/resolve-CgVDhWW8.cjs +316 -0
  257. package/dist/resolve-CgVDhWW8.cjs.map +1 -0
  258. package/dist/resolve-rw7mLp5E.mjs +263 -0
  259. package/dist/resolve-rw7mLp5E.mjs.map +1 -0
  260. package/dist/rollback-Cv02Cnky.mjs +136 -0
  261. package/dist/rollback-Cv02Cnky.mjs.map +1 -0
  262. package/dist/rollback-vdkPi_Rm.cjs +165 -0
  263. package/dist/rollback-vdkPi_Rm.cjs.map +1 -0
  264. package/dist/runtime-D-rOcRoq.d.cts +82 -0
  265. package/dist/runtime-D-rOcRoq.d.cts.map +1 -0
  266. package/dist/runtime-DG1mNh_5.d.mts +82 -0
  267. package/dist/runtime-DG1mNh_5.d.mts.map +1 -0
  268. package/dist/s3-DIvAtJwk.cjs +240 -0
  269. package/dist/s3-DIvAtJwk.cjs.map +1 -0
  270. package/dist/s3-DmsM_V2R.mjs +240 -0
  271. package/dist/s3-DmsM_V2R.mjs.map +1 -0
  272. package/dist/sandbox/config-worker.cjs +43 -0
  273. package/dist/sandbox/config-worker.cjs.map +1 -0
  274. package/dist/sandbox/config-worker.d.cts +1 -0
  275. package/dist/sandbox/config-worker.d.mts +1 -0
  276. package/dist/sandbox/config-worker.mjs +44 -0
  277. package/dist/sandbox/config-worker.mjs.map +1 -0
  278. package/dist/sandbox/credentials-worker.cjs +53 -0
  279. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  280. package/dist/sandbox/credentials-worker.d.cts +1 -0
  281. package/dist/sandbox/credentials-worker.d.mts +1 -0
  282. package/dist/sandbox/credentials-worker.mjs +54 -0
  283. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  284. package/dist/sandbox/discover-worker.cjs +47 -0
  285. package/dist/sandbox/discover-worker.cjs.map +1 -0
  286. package/dist/sandbox/discover-worker.d.cts +1 -0
  287. package/dist/sandbox/discover-worker.d.mts +1 -0
  288. package/dist/sandbox/discover-worker.mjs +48 -0
  289. package/dist/sandbox/discover-worker.mjs.map +1 -0
  290. package/dist/sandbox/migrate-worker.cjs +75 -0
  291. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  292. package/dist/sandbox/migrate-worker.d.cts +1 -0
  293. package/dist/sandbox/migrate-worker.d.mts +1 -0
  294. package/dist/sandbox/migrate-worker.mjs +76 -0
  295. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  296. package/dist/{workspace-mFpI_ky_.cjs → schemas-BCwKKA42.mjs} +399 -1162
  297. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  298. package/dist/{workspace-CgwmXEtc.mjs → schemas-BQ_v0lEX.cjs} +487 -971
  299. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  300. package/dist/secretsManager-CJyxFcBH.mjs +113 -0
  301. package/dist/secretsManager-CJyxFcBH.mjs.map +1 -0
  302. package/dist/secretsManager-D8on44WI.cjs +124 -0
  303. package/dist/secretsManager-D8on44WI.cjs.map +1 -0
  304. package/dist/seeds-D7q1zKCJ.cjs +369 -0
  305. package/dist/seeds-D7q1zKCJ.cjs.map +1 -0
  306. package/dist/seeds-y1rzXlAc.mjs +298 -0
  307. package/dist/seeds-y1rzXlAc.mjs.map +1 -0
  308. package/dist/serverSetup-CvcN4zJQ.mjs +685 -0
  309. package/dist/serverSetup-CvcN4zJQ.mjs.map +1 -0
  310. package/dist/serverSetup-qXIRRhgw.cjs +685 -0
  311. package/dist/serverSetup-qXIRRhgw.cjs.map +1 -0
  312. package/dist/sniffer-CGfL25Bc.cjs +1997 -0
  313. package/dist/sniffer-CGfL25Bc.cjs.map +1 -0
  314. package/dist/sniffer-DuKVVAs_.mjs +1824 -0
  315. package/dist/sniffer-DuKVVAs_.mjs.map +1 -0
  316. package/dist/snsSubscriptions-DPfGjpuB.cjs +1179 -0
  317. package/dist/snsSubscriptions-DPfGjpuB.cjs.map +1 -0
  318. package/dist/snsSubscriptions-nnSUW2Eh.mjs +1048 -0
  319. package/dist/snsSubscriptions-nnSUW2Eh.mjs.map +1 -0
  320. package/dist/sst-Bw7686br.mjs +478 -0
  321. package/dist/sst-Bw7686br.mjs.map +1 -0
  322. package/dist/sst-Md7c1UC_.cjs +501 -0
  323. package/dist/sst-Md7c1UC_.cjs.map +1 -0
  324. package/dist/stack-D2cLLaO-.mjs +2256 -0
  325. package/dist/stack-D2cLLaO-.mjs.map +1 -0
  326. package/dist/stack-DTcnynGb.cjs +2431 -0
  327. package/dist/stack-DTcnynGb.cjs.map +1 -0
  328. package/dist/stage-Bw3bJ7Au.mjs +302 -0
  329. package/dist/stage-Bw3bJ7Au.mjs.map +1 -0
  330. package/dist/stage-RLOenlHV.cjs +313 -0
  331. package/dist/stage-RLOenlHV.cjs.map +1 -0
  332. package/dist/stages-B0yOikgt.cjs +190 -0
  333. package/dist/stages-B0yOikgt.cjs.map +1 -0
  334. package/dist/stages-yA9bhStl.mjs +190 -0
  335. package/dist/stages-yA9bhStl.mjs.map +1 -0
  336. package/dist/target/public.cjs +15 -0
  337. package/dist/target/public.d.cts +28 -0
  338. package/dist/target/public.d.cts.map +1 -0
  339. package/dist/target/public.d.mts +28 -0
  340. package/dist/target/public.d.mts.map +1 -0
  341. package/dist/target/public.mjs +4 -0
  342. package/dist/terminal-C-_cMKTY.cjs +85 -0
  343. package/dist/terminal-C-_cMKTY.cjs.map +1 -0
  344. package/dist/terminal-Dq29bK3u.mjs +85 -0
  345. package/dist/terminal-Dq29bK3u.mjs.map +1 -0
  346. package/dist/types-Bl_CwZC9.cjs +90 -0
  347. package/dist/types-Bl_CwZC9.cjs.map +1 -0
  348. package/dist/{types-RhXmHR-e.d.cts → types-CvucX3yD.d.mts} +2163 -364
  349. package/dist/types-CvucX3yD.d.mts.map +1 -0
  350. package/dist/{types-kvBQjpPo.d.mts → types-D1C8pUyh.d.cts} +2165 -364
  351. package/dist/types-D1C8pUyh.d.cts.map +1 -0
  352. package/dist/types-Y1NfWlyG.mjs +61 -0
  353. package/dist/types-Y1NfWlyG.mjs.map +1 -0
  354. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  355. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  356. package/dist/utils-D_fxUqvU.mjs +156 -0
  357. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  358. package/dist/vitest.cjs +65 -0
  359. package/dist/vitest.cjs.map +1 -0
  360. package/dist/vitest.d.cts +29 -0
  361. package/dist/vitest.d.cts.map +1 -0
  362. package/dist/vitest.d.mts +29 -0
  363. package/dist/vitest.d.mts.map +1 -0
  364. package/dist/vitest.mjs +65 -0
  365. package/dist/vitest.mjs.map +1 -0
  366. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  367. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  368. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  369. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  370. package/dist/workspace/index.cjs +6 -2
  371. package/dist/workspace/index.d.cts +3 -3
  372. package/dist/workspace/index.d.mts +3 -3
  373. package/dist/workspace/index.mjs +2 -2
  374. package/dist/workspace-1szcahj9.cjs +2916 -0
  375. package/dist/workspace-1szcahj9.cjs.map +1 -0
  376. package/dist/workspace-DFGsrjGD.mjs +2480 -0
  377. package/dist/workspace-DFGsrjGD.mjs.map +1 -0
  378. package/package.json +65 -13
  379. package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
  380. package/dist/HostingerProvider-BZFGYYVA.cjs.map +0 -1
  381. package/dist/LocalStateProvider-7HR6SS2t.cjs +0 -48
  382. package/dist/LocalStateProvider-7HR6SS2t.cjs.map +0 -1
  383. package/dist/LocalStateProvider-D7QyJoLM.mjs +0 -48
  384. package/dist/LocalStateProvider-D7QyJoLM.mjs.map +0 -1
  385. package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
  386. package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
  387. package/dist/SSMStateProvider-B0Hu1MKZ.mjs +0 -75
  388. package/dist/SSMStateProvider-B0Hu1MKZ.mjs.map +0 -1
  389. package/dist/SSMStateProvider-VrQ-yeqd.cjs +0 -74
  390. package/dist/SSMStateProvider-VrQ-yeqd.cjs.map +0 -1
  391. package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
  392. package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
  393. package/dist/bundler-BeNDZdHQ.cjs.map +0 -1
  394. package/dist/bundler-BodTL4kf.mjs.map +0 -1
  395. package/dist/config-Q1rvKHvw.cjs +0 -467
  396. package/dist/config-Q1rvKHvw.cjs.map +0 -1
  397. package/dist/config-pqGD3hF9.mjs +0 -414
  398. package/dist/config-pqGD3hF9.mjs.map +0 -1
  399. package/dist/config.d.cts.map +0 -1
  400. package/dist/config.d.mts.map +0 -1
  401. package/dist/credentials-BekkKtY_.mjs +0 -2780
  402. package/dist/credentials-BekkKtY_.mjs.map +0 -1
  403. package/dist/credentials-Q6F0uqJq.cjs +0 -2917
  404. package/dist/credentials-Q6F0uqJq.cjs.map +0 -1
  405. package/dist/discover-BERGFg8v.cjs +0 -288
  406. package/dist/discover-BERGFg8v.cjs.map +0 -1
  407. package/dist/discover-CK-n3w6b.mjs +0 -244
  408. package/dist/discover-CK-n3w6b.mjs.map +0 -1
  409. package/dist/emit-BdoPFjZf.cjs +0 -253
  410. package/dist/emit-BdoPFjZf.cjs.map +0 -1
  411. package/dist/emit-Bzq7JsMP.mjs +0 -224
  412. package/dist/emit-Bzq7JsMP.mjs.map +0 -1
  413. package/dist/fullstack-secrets-BET8gqwK.mjs +0 -81
  414. package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
  415. package/dist/fullstack-secrets-DXsWO-5m.cjs +0 -92
  416. package/dist/fullstack-secrets-DXsWO-5m.cjs.map +0 -1
  417. package/dist/generator-LfZU7NlU.mjs +0 -247
  418. package/dist/generator-LfZU7NlU.mjs.map +0 -1
  419. package/dist/generator-Wdfp0jCS.cjs +0 -282
  420. package/dist/generator-Wdfp0jCS.cjs.map +0 -1
  421. package/dist/github-BfflNPVe.cjs +0 -203
  422. package/dist/github-BfflNPVe.cjs.map +0 -1
  423. package/dist/github-CRwnxKmD.mjs +0 -203
  424. package/dist/github-CRwnxKmD.mjs.map +0 -1
  425. package/dist/index-C-HkOEBt.d.cts.map +0 -1
  426. package/dist/index-C-VLwB_Y.d.mts.map +0 -1
  427. package/dist/keystore-B4PRlbgE.mjs +0 -81
  428. package/dist/keystore-B4PRlbgE.mjs.map +0 -1
  429. package/dist/keystore-DgGRj2Yy.cjs +0 -98
  430. package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
  431. package/dist/openapi-Dcbme-Us.cjs +0 -2038
  432. package/dist/openapi-Dcbme-Us.cjs.map +0 -1
  433. package/dist/openapi-vy4JzhUv.mjs +0 -1991
  434. package/dist/openapi-vy4JzhUv.mjs.map +0 -1
  435. package/dist/storage-C-30BD1e.cjs +0 -272
  436. package/dist/storage-C-30BD1e.cjs.map +0 -1
  437. package/dist/storage-P_b3w7uj.mjs +0 -231
  438. package/dist/storage-P_b3w7uj.mjs.map +0 -1
  439. package/dist/sync-B3xxXtJT.mjs +0 -88
  440. package/dist/sync-B3xxXtJT.mjs.map +0 -1
  441. package/dist/sync-D7uTIIEi.cjs +0 -111
  442. package/dist/sync-D7uTIIEi.cjs.map +0 -1
  443. package/dist/types-RhXmHR-e.d.cts.map +0 -1
  444. package/dist/types-kvBQjpPo.d.mts.map +0 -1
  445. package/dist/workspace-CgwmXEtc.mjs.map +0 -1
  446. package/dist/workspace-mFpI_ky_.cjs.map +0 -1
@@ -0,0 +1,902 @@
1
+ const require_errors = require("./errors-DMC4Umsb.cjs");
2
+ const require_credentials = require("./credentials-UlL1n_Rd.cjs");
3
+ const require_workspace = require("./workspace-1szcahj9.cjs");
4
+ const require_apps = require("./apps-CtjYJS9e.cjs");
5
+ const require_config = require("./config-B5Hi3mLK.cjs");
6
+ const require_discover = require("./discover-CRywE7yc.cjs");
7
+ const require_snsSubscriptions = require("./snsSubscriptions-DPfGjpuB.cjs");
8
+ const require_deploy = require("./deploy-CqIULk0k.cjs");
9
+ const require_iam = require("./iam-6LH6wptf.cjs");
10
+ const require_projectBucket = require("./projectBucket-CWpY3Vxv.cjs");
11
+ const require_aws = require("./aws-DKC2m3sT.cjs");
12
+ const require_secretsManager = require("./secretsManager-D8on44WI.cjs");
13
+ let node_child_process = require("node:child_process");
14
+ let _aws_sdk_client_iam = require("@aws-sdk/client-iam");
15
+ //#region src/deploy/githubOidc.ts
16
+ /**
17
+ * The `sub` GitHub puts in a deploy job's OIDC token — what the deploy role's
18
+ * trust policy has to match exactly.
19
+ *
20
+ * It is not always `repo:<owner>/<name>:environment:<stage>`. A repository
21
+ * (or its organisation) decides the format, and says which through
22
+ * `GET /repos/{owner}/{repo}/actions/oidc/customization/sub`:
23
+ *
24
+ * - the default: `repo:<owner>/<name>:environment:<stage>`;
25
+ * - the immutable subject — the default for repositories created after
26
+ * 15 July 2026, opt-in before — puts the owner's and the repository's ids in
27
+ * the `repo` segment: `repo:<owner>@<ownerId>/<name>@<repoId>:environment:<stage>`.
28
+ * The API hands that segment back as `sub_claim_prefix`;
29
+ * - a custom template (`use_default: false`) builds the `sub` from
30
+ * `include_claim_keys`, in order, each as `<key>:<value>` joined by `:`,
31
+ * where `context` is `environment:<stage>` in an environment job.
32
+ *
33
+ * A `:` inside a value is sent as `%3A`.
34
+ *
35
+ * See https://docs.github.com/en/actions/reference/security/oidc.
36
+ */
37
+ /**
38
+ * Template keys whose values are known for a repository's environment job
39
+ * before the job runs. Anything else — `job_workflow_ref`, `ref`, `sha`,
40
+ * `run_id`, `workflow`, `actor`, a custom property — depends on the run.
41
+ */
42
+ const SUPPORTED_CLAIM_KEYS = [
43
+ "repo",
44
+ "context",
45
+ "environment",
46
+ "repository",
47
+ "repository_owner",
48
+ "repository_owner_id",
49
+ "repository_id",
50
+ "repository_visibility"
51
+ ];
52
+ const NEEDS_FACTS = /* @__PURE__ */ new Set([
53
+ "repository_owner_id",
54
+ "repository_id",
55
+ "repository_visibility"
56
+ ]);
57
+ /** A `:` inside a claim value is sent as `%3A`. */
58
+ function claim(value) {
59
+ return value.replaceAll(":", "%3A");
60
+ }
61
+ /** Whether {@link oidcSubject} needs the repository's ids or visibility. */
62
+ function needsRepoFacts(customization) {
63
+ const immutableWithoutPrefix = customization.use_immutable_subject === true && !customization.sub_claim_prefix;
64
+ if (customization.use_default) return immutableWithoutPrefix;
65
+ return (customization.include_claim_keys ?? []).some((key) => NEEDS_FACTS.has(key) || key === "repo" && immutableWithoutPrefix);
66
+ }
67
+ /**
68
+ * The exact `sub` of a job in `repo`'s `stage` environment.
69
+ *
70
+ * @throws OidcSubjectNotSupported when a custom template includes a claim
71
+ * whose value depends on the run, so no one subject can be trusted.
72
+ */
73
+ function oidcSubject(repo, stage, customization, facts) {
74
+ const [owner = "", name = ""] = repo.split("/");
75
+ const environment = `environment:${claim(stage)}`;
76
+ const repoSegment = () => {
77
+ if (customization.sub_claim_prefix) return customization.sub_claim_prefix;
78
+ if (customization.use_immutable_subject) {
79
+ if (!facts) throw new RepoFactsRequired(repo);
80
+ return `repo:${owner}@${facts.ownerId}/${name}@${facts.repoId}`;
81
+ }
82
+ return `repo:${repo}`;
83
+ };
84
+ const immutable = customization.use_immutable_subject === true || customization.sub_claim_prefix !== void 0;
85
+ if (customization.use_default) return {
86
+ subject: `${repoSegment()}:${environment}`,
87
+ kind: immutable ? "immutable" : "default"
88
+ };
89
+ const keys = customization.include_claim_keys ?? [];
90
+ const unsupported = keys.filter((key) => !SUPPORTED_CLAIM_KEYS.includes(key));
91
+ if (keys.length === 0 || unsupported.length > 0) throw new OidcSubjectNotSupported(repo, keys, unsupported);
92
+ if (keys.some((key) => NEEDS_FACTS.has(key)) && !facts) throw new RepoFactsRequired(repo);
93
+ return {
94
+ subject: keys.map((key) => {
95
+ switch (key) {
96
+ case "repo": return repoSegment();
97
+ case "context":
98
+ case "environment": return environment;
99
+ case "repository": return `repository:${claim(repo)}`;
100
+ case "repository_owner": return `repository_owner:${claim(owner)}`;
101
+ case "repository_owner_id": return `repository_owner_id:${facts.ownerId}`;
102
+ case "repository_id": return `repository_id:${facts.repoId}`;
103
+ default: return `repository_visibility:${claim(facts.visibility)}`;
104
+ }
105
+ }).join(":"),
106
+ kind: "custom"
107
+ };
108
+ }
109
+ /** The endpoint a repository's subject format is read from. */
110
+ function customizationEndpoint(repo) {
111
+ return `repos/${repo}/actions/oidc/customization/sub`;
112
+ }
113
+ /**
114
+ * The `sub` GitHub will send for `repo`'s `stage` environment, read from the
115
+ * repository's OIDC settings through `gh`.
116
+ *
117
+ * A repository on a custom template that names no keys of its own uses its
118
+ * organisation's, read from `orgs/{owner}/actions/oidc/customization/sub`.
119
+ * When the settings cannot be read at all — no permission, or a GitHub
120
+ * Enterprise Server without the endpoint — the default format is assumed, with
121
+ * a warning saying where to check it.
122
+ */
123
+ function resolveOidcSubject(gh, repo, stage) {
124
+ const endpoint = customizationEndpoint(repo);
125
+ let customization;
126
+ try {
127
+ customization = JSON.parse(gh(["api", endpoint]));
128
+ } catch {
129
+ return {
130
+ subject: `repo:${repo}:environment:${claim(stage)}`,
131
+ kind: "assumed",
132
+ 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.`
133
+ };
134
+ }
135
+ if (!customization.use_default && (customization.include_claim_keys ?? []).length === 0) {
136
+ const [owner = ""] = repo.split("/");
137
+ const orgEndpoint = `orgs/${owner}/actions/oidc/customization/sub`;
138
+ let org;
139
+ try {
140
+ org = JSON.parse(gh(["api", orgEndpoint]));
141
+ } catch {
142
+ throw new OrgOidcTemplateUnreadable(repo, orgEndpoint);
143
+ }
144
+ customization = {
145
+ ...customization,
146
+ include_claim_keys: org.include_claim_keys ?? [],
147
+ use_immutable_subject: customization.use_immutable_subject ?? org.use_immutable_subject
148
+ };
149
+ }
150
+ const facts = needsRepoFacts(customization) ? readRepoFacts(gh, repo) : void 0;
151
+ return oidcSubject(repo, stage, customization, facts);
152
+ }
153
+ function readRepoFacts(gh, repo) {
154
+ const raw = JSON.parse(gh(["api", `repos/${repo}`]));
155
+ return {
156
+ ownerId: raw.owner.id,
157
+ repoId: raw.id,
158
+ visibility: raw.visibility
159
+ };
160
+ }
161
+ /**
162
+ * The repository's custom subject template includes a claim whose value
163
+ * depends on the run — or names none — so no one subject can be trusted.
164
+ */
165
+ var OidcSubjectNotSupported = class extends require_errors.GkmError {
166
+ repo;
167
+ includeClaimKeys;
168
+ unsupportedKeys;
169
+ constructor(repo, includeClaimKeys, unsupportedKeys) {
170
+ 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.`);
171
+ this.repo = repo;
172
+ this.includeClaimKeys = includeClaimKeys;
173
+ this.unsupportedKeys = unsupportedKeys;
174
+ this.name = "OidcSubjectNotSupported";
175
+ }
176
+ };
177
+ /** The subject needs the repository's ids, and none were read. */
178
+ var RepoFactsRequired = class extends require_errors.GkmError {
179
+ repo;
180
+ constructor(repo) {
181
+ super(`The OIDC subject of ${repo} includes its owner and repository ids; read them with gh api repos/${repo} and pass them in.`);
182
+ this.repo = repo;
183
+ this.name = "RepoFactsRequired";
184
+ }
185
+ };
186
+ /**
187
+ * The repository uses its organisation's subject template, and that template
188
+ * could not be read — so what GitHub sends is unknown, and is not guessed.
189
+ */
190
+ var OrgOidcTemplateUnreadable = class extends require_errors.GkmError {
191
+ repo;
192
+ endpoint;
193
+ constructor(repo, endpoint) {
194
+ 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.`);
195
+ this.repo = repo;
196
+ this.endpoint = endpoint;
197
+ this.name = "OrgOidcTemplateUnreadable";
198
+ }
199
+ };
200
+ //#endregion
201
+ //#region src/deploy/githubPolicy.ts
202
+ /**
203
+ * What SST needs to create a stack is most of AWS, so this is the default
204
+ * outside compose — said out loud in the output, and replaceable with
205
+ * `--policy-arn`.
206
+ */
207
+ const DEFAULT_POLICY_ARN = "arn:aws:iam::aws:policy/AdministratorAccess";
208
+ /** The name of the inline policy a compose stage's role is given. */
209
+ const SCOPED_POLICY_NAME = "gkm-deploy";
210
+ /** Every target the stage's apps deploy through. */
211
+ function deployTargets(workspace) {
212
+ const targets = /* @__PURE__ */ new Set([workspace.deploy?.default ?? "dokploy"]);
213
+ for (const app of Object.values(workspace.apps)) targets.add(app.resolvedDeployTarget);
214
+ return [...targets].sort();
215
+ }
216
+ /**
217
+ * The access the stage's deploy role is given: `--policy-arn` when passed,
218
+ * the scoped policy for a stage only the compose target deploys, and
219
+ * `AdministratorAccess` otherwise.
220
+ */
221
+ function deployAccess(workspace, stage, policyArn, manifest = {}) {
222
+ const buckets = Object.entries(manifest).filter(([, d]) => d.kind === "objects").map(([id]) => id);
223
+ if (policyArn) return {
224
+ kind: "managed",
225
+ policyArn,
226
+ reason: "--policy-arn"
227
+ };
228
+ const targets = deployTargets(workspace);
229
+ if (targets.length !== 1 || targets[0] !== "compose") return {
230
+ kind: "managed",
231
+ policyArn: DEFAULT_POLICY_ARN,
232
+ reason: `the ${targets.join(", ")} target${targets.length === 1 ? "" : "s"} deploy${targets.length === 1 ? "s" : ""} infrastructure; --policy-arn to narrow`
233
+ };
234
+ const project = workspace.name;
235
+ const store = workspace.secrets.store ?? "file";
236
+ const state = workspace.state;
237
+ if (typeof store === "object" && typeof store.provider === "object" || state !== void 0 && typeof state.provider === "object") return {
238
+ kind: "managed",
239
+ policyArn: DEFAULT_POLICY_ARN,
240
+ reason: `a custom ${typeof store === "object" && typeof store.provider === "object" ? "secrets store" : "state provider"} cannot be scoped; --policy-arn to narrow`
241
+ };
242
+ const describe = [];
243
+ const build = [];
244
+ const projectBucketIn = (account) => require_projectBucket.projectBucketName(require_credentials.deployIdentity(workspace, stage).scope, account);
245
+ const projectBucketStatement = (account) => ({
246
+ Sid: "ProjectBucket",
247
+ Effect: "Allow",
248
+ Action: [...require_projectBucket.PROJECT_BUCKET_CREATE_ACTIONS],
249
+ Resource: `arn:aws:s3:::${projectBucketIn(account)}`
250
+ });
251
+ const stateInSecretsBucket = typeof store === "object" && store.provider === "s3" && state?.provider === "s3" && state.bucket === store.bucket;
252
+ if (typeof store === "object" && store.provider === "s3") {
253
+ const location = require_workspace.s3SecretsLocation(store, state);
254
+ const key = require_workspace.s3SecretsKey(location.prefix, project, stage);
255
+ const named = location.bucket;
256
+ const bucketIn = (account) => named ?? projectBucketIn(account);
257
+ describe.push(named ? `read and update s3://${named}/${key}` : `read and update ${key} in the project bucket ${projectBucketIn("<account>")}${stateInSecretsBucket ? "" : ", creating it"}`);
258
+ build.push((account) => [{
259
+ Sid: "StageSecrets",
260
+ Effect: "Allow",
261
+ Action: ["s3:GetObject", "s3:PutObject"],
262
+ Resource: `arn:aws:s3:::${bucketIn(account)}/${key}`
263
+ }, ...stateInSecretsBucket ? [] : [{
264
+ Sid: "StageSecretsBucket",
265
+ Effect: "Allow",
266
+ Action: ["s3:ListBucket"],
267
+ Resource: `arn:aws:s3:::${bucketIn(account)}`
268
+ }, ...named ? [] : [projectBucketStatement(account)]]]);
269
+ } else if (typeof store === "object" && store.provider === "ssm") {
270
+ const { region } = store;
271
+ const name = require_aws.secretsParameterName(project, stage);
272
+ describe.push(`read and update ${name} (SSM, ${region})`);
273
+ build.push((account) => [{
274
+ Sid: "StageSecrets",
275
+ Effect: "Allow",
276
+ Action: ["ssm:GetParameter", "ssm:PutParameter"],
277
+ Resource: `arn:aws:ssm:${region}:${account}:parameter${name}`
278
+ }]);
279
+ } else if (typeof store === "object" && store.provider === "secrets-manager") {
280
+ const { region, kmsKeyId } = store;
281
+ const name = require_secretsManager.secretsManagerSecretName(project, stage);
282
+ describe.push(`read and update ${name} (Secrets Manager, ${region})`);
283
+ build.push((account) => {
284
+ const statements = [{
285
+ Sid: "StageSecrets",
286
+ Effect: "Allow",
287
+ Action: [
288
+ "secretsmanager:GetSecretValue",
289
+ "secretsmanager:PutSecretValue",
290
+ "secretsmanager:CreateSecret"
291
+ ],
292
+ Resource: `arn:aws:secretsmanager:${region}:${account}:secret:${name}-??????`
293
+ }];
294
+ if (kmsKeyId) statements.push({
295
+ Sid: "StageSecretsKey",
296
+ Effect: "Allow",
297
+ Action: ["kms:Decrypt", "kms:GenerateDataKey"],
298
+ Resource: kmsKeyId.startsWith("arn:") ? kmsKeyId : "*",
299
+ Condition: { StringEquals: { "kms:ViaService": `secretsmanager.${region}.amazonaws.com` } }
300
+ });
301
+ return statements;
302
+ });
303
+ }
304
+ if (state?.provider === "ssm") {
305
+ const { region } = state;
306
+ const path = `/gkm/${project}/${stage}/`;
307
+ describe.push(`read and write the deploy state under ${path} (SSM, ${region})`);
308
+ build.push((account) => [{
309
+ Sid: "StageState",
310
+ Effect: "Allow",
311
+ Action: [
312
+ "ssm:GetParameter",
313
+ "ssm:PutParameter",
314
+ "ssm:DeleteParameter"
315
+ ],
316
+ Resource: `arn:aws:ssm:${region}:${account}:parameter${path}*`
317
+ }]);
318
+ } else if (state?.provider === "s3") {
319
+ const prefix = (state.prefix ?? "gkm").replace(/\/+$/, "");
320
+ const path = `${prefix ? `${prefix}/` : ""}${project}/${stage}/`;
321
+ const named = state.bucket;
322
+ const bucketIn = (account) => named ?? projectBucketIn(account);
323
+ 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`);
324
+ build.push((account) => [...stateBucketStatements(bucketIn(account), path), ...named ? [] : [projectBucketStatement(account)]]);
325
+ }
326
+ const objects = require_workspace.stageProvider(workspace, "objects", stage);
327
+ if (objects.mode === "provider" && objects.name === "s3" && buckets.length) {
328
+ const { scope } = require_credentials.deployIdentity(workspace, stage);
329
+ const names = [...buckets].sort().map((id) => ({
330
+ bucket: require_iam.bucketName({
331
+ scope,
332
+ stage,
333
+ id
334
+ }),
335
+ user: require_iam.iamUserName({
336
+ scope,
337
+ stage,
338
+ id
339
+ })
340
+ }));
341
+ const suffix = "?".repeat(6);
342
+ describe.push(`create and configure the buckets ${names.map((n) => n.bucket).join(", ")}, their IAM users, and — for a bucket a subscriber watches — its events topic, dead-letter queue and subscriptions (S3, IAM, SNS, SQS)`);
343
+ build.push((account) => [
344
+ {
345
+ Sid: "StageBuckets",
346
+ Effect: "Allow",
347
+ Action: [
348
+ "s3:CreateBucket",
349
+ "s3:ListBucket",
350
+ "s3:GetBucketTagging",
351
+ "s3:PutBucketTagging",
352
+ "s3:GetBucketPublicAccessBlock",
353
+ "s3:PutBucketPublicAccessBlock",
354
+ "s3:GetBucketPolicy",
355
+ "s3:PutBucketPolicy",
356
+ "s3:GetEncryptionConfiguration",
357
+ "s3:PutEncryptionConfiguration",
358
+ "s3:GetBucketVersioning",
359
+ "s3:PutBucketVersioning",
360
+ "s3:GetBucketCORS",
361
+ "s3:PutBucketCORS",
362
+ "s3:GetBucketNotification",
363
+ "s3:PutBucketNotification",
364
+ "s3:GetLifecycleConfiguration",
365
+ "s3:PutLifecycleConfiguration"
366
+ ],
367
+ Resource: names.flatMap((n) => [`arn:aws:s3:::${n.bucket}`, `arn:aws:s3:::${n.bucket}-${suffix}`])
368
+ },
369
+ {
370
+ Sid: "StageBucketTopics",
371
+ Effect: "Allow",
372
+ Action: [
373
+ "sns:CreateTopic",
374
+ "sns:TagResource",
375
+ "sns:GetTopicAttributes",
376
+ "sns:SetTopicAttributes",
377
+ "sns:Subscribe",
378
+ "sns:Unsubscribe",
379
+ "sns:ListSubscriptionsByTopic",
380
+ "sns:GetSubscriptionAttributes",
381
+ "sns:SetSubscriptionAttributes"
382
+ ],
383
+ Resource: names.flatMap((n) => [`${n.bucket}-events`, `${n.bucket}-${suffix}-events`].flatMap((topic) => [`arn:aws:sns:*:${account}:${topic}`, `arn:aws:sns:*:${account}:${topic}:*`]))
384
+ },
385
+ {
386
+ Sid: "StageBucketDeadLetters",
387
+ Effect: "Allow",
388
+ Action: [
389
+ "sqs:CreateQueue",
390
+ "sqs:TagQueue",
391
+ "sqs:GetQueueUrl",
392
+ "sqs:GetQueueAttributes",
393
+ "sqs:SetQueueAttributes"
394
+ ],
395
+ Resource: names.flatMap((n) => [`arn:aws:sqs:*:${account}:${n.bucket}-events-dlq`, `arn:aws:sqs:*:${account}:${n.bucket}-${suffix}-events-dlq`])
396
+ },
397
+ {
398
+ Sid: "StageBucketUsers",
399
+ Effect: "Allow",
400
+ Action: [
401
+ "iam:GetUser",
402
+ "iam:CreateUser",
403
+ "iam:TagUser",
404
+ "iam:ListUserTags",
405
+ "iam:GetUserPolicy",
406
+ "iam:PutUserPolicy",
407
+ "iam:ListAccessKeys",
408
+ "iam:CreateAccessKey",
409
+ "iam:DeleteAccessKey"
410
+ ],
411
+ Resource: names.map((n) => `arn:aws:iam::${account}:user${require_iam.IAM_USER_PATH}${n.user}`)
412
+ }
413
+ ]);
414
+ if (Object.values(manifest).some((d) => d.kind === "file-server") && objects.config.cdn !== false) {
415
+ describe.push("create the file servers’ certificates and CloudFront distributions (ACM, CloudFront)");
416
+ build.push(() => [{
417
+ Sid: "StageFileServerCertificates",
418
+ Effect: "Allow",
419
+ Action: [
420
+ "acm:RequestCertificate",
421
+ "acm:DescribeCertificate",
422
+ "acm:ListCertificates",
423
+ "acm:AddTagsToCertificate"
424
+ ],
425
+ Resource: "*"
426
+ }, {
427
+ Sid: "StageFileServerCdn",
428
+ Effect: "Allow",
429
+ Action: [
430
+ "cloudfront:CreateDistribution",
431
+ "cloudfront:CreateDistributionWithTags",
432
+ "cloudfront:GetDistribution",
433
+ "cloudfront:GetDistributionConfig",
434
+ "cloudfront:UpdateDistribution",
435
+ "cloudfront:ListDistributions",
436
+ "cloudfront:TagResource",
437
+ "cloudfront:CreateOriginAccessControl",
438
+ "cloudfront:GetOriginAccessControl",
439
+ "cloudfront:ListOriginAccessControls",
440
+ "cloudfront:CreateResponseHeadersPolicy",
441
+ "cloudfront:GetResponseHeadersPolicy",
442
+ "cloudfront:GetResponseHeadersPolicyConfig",
443
+ "cloudfront:UpdateResponseHeadersPolicy",
444
+ "cloudfront:ListResponseHeadersPolicies"
445
+ ],
446
+ Resource: "*"
447
+ }]);
448
+ }
449
+ }
450
+ if (require_apps.stageBackups(workspace, manifest, stage).mode === "on") {
451
+ const { scope } = require_credentials.deployIdentity(workspace, stage);
452
+ const user = require_deploy.backupsUserName(scope, stage);
453
+ const bucketIn = (account) => require_projectBucket.projectBucketName(scope, account);
454
+ describe.push(`create the project bucket ${bucketIn("<account>")} and keep its lifecycle, and create the backups user ${user} and its key (S3, IAM)`);
455
+ build.push((account) => [{
456
+ Sid: "StageBackupsBucket",
457
+ Effect: "Allow",
458
+ Action: ["s3:ListBucket", .../* @__PURE__ */ new Set([...require_projectBucket.PROJECT_BUCKET_CREATE_ACTIONS, ...require_projectBucket.PROJECT_BUCKET_LIFECYCLE_ACTIONS])],
459
+ Resource: `arn:aws:s3:::${bucketIn(account)}`
460
+ }, {
461
+ Sid: "StageBackupsUser",
462
+ Effect: "Allow",
463
+ Action: [
464
+ "iam:GetUser",
465
+ "iam:CreateUser",
466
+ "iam:TagUser",
467
+ "iam:ListUserTags",
468
+ "iam:GetUserPolicy",
469
+ "iam:PutUserPolicy",
470
+ "iam:ListAccessKeys",
471
+ "iam:CreateAccessKey",
472
+ "iam:DeleteAccessKey"
473
+ ],
474
+ Resource: `arn:aws:iam::${account}:user${require_iam.IAM_USER_PATH}${user}`
475
+ }]);
476
+ }
477
+ for (const { domain, config } of require_snsSubscriptions.stageDnsDomains(stage, workspace.domains, workspace.dns)) {
478
+ if (config.provider !== "route53") continue;
479
+ const zoneId = config.hostedZoneId?.replace(/^\/?hostedzone\//, "");
480
+ describe.push(`write the A, AAAA and CNAME records of ${domain} (Route53${zoneId ? `, ${zoneId}` : ""})`);
481
+ build.push(() => [
482
+ {
483
+ Sid: "StageDnsRecords",
484
+ Effect: "Allow",
485
+ Action: ["route53:ChangeResourceRecordSets", "route53:ListResourceRecordSets"],
486
+ Resource: `arn:aws:route53:::hostedzone/${zoneId ?? "*"}`
487
+ },
488
+ {
489
+ Sid: "StageDnsChanges",
490
+ Effect: "Allow",
491
+ Action: ["route53:GetChange"],
492
+ Resource: "arn:aws:route53:::change/*"
493
+ },
494
+ ...zoneId ? [] : [{
495
+ Sid: "StageDnsZones",
496
+ Effect: "Allow",
497
+ Action: ["route53:ListHostedZonesByName"],
498
+ Resource: "*"
499
+ }]
500
+ ]);
501
+ }
502
+ return {
503
+ kind: "scoped",
504
+ statements: (account) => build.flatMap((statements) => statements(account)),
505
+ describe
506
+ };
507
+ }
508
+ /**
509
+ * Reading and writing one stage's deploy state in `bucket`, as the deploy
510
+ * role is given it.
511
+ */
512
+ function stateBucketStatements(bucket, path) {
513
+ return [{
514
+ Sid: "StageState",
515
+ Effect: "Allow",
516
+ Action: [
517
+ "s3:GetObject",
518
+ "s3:PutObject",
519
+ "s3:DeleteObject"
520
+ ],
521
+ Resource: `arn:aws:s3:::${bucket}/${path}*`
522
+ }, {
523
+ Sid: "StageStateBucket",
524
+ Effect: "Allow",
525
+ Action: ["s3:ListBucket"],
526
+ Resource: `arn:aws:s3:::${bucket}`
527
+ }];
528
+ }
529
+ /** The scoped access as a policy document, or null when it allows nothing. */
530
+ function scopedPolicyDocument(statements) {
531
+ if (statements.length === 0) return null;
532
+ return JSON.stringify({
533
+ Version: "2012-10-17",
534
+ Statement: statements
535
+ });
536
+ }
537
+ /** The account an IAM ARN is in: `arn:aws:iam::<account>:…`. */
538
+ function accountOf(arn) {
539
+ return arn.split(":")[4] ?? "";
540
+ }
541
+ //#endregion
542
+ //#region src/deploy/github.ts
543
+ /**
544
+ * `gkm deploy:github` — let GitHub Actions deploy one stage, with no keys.
545
+ *
546
+ * A stage usually lives in its own AWS account — staging in one, production in
547
+ * another — so this runs once per stage, with that account's profile:
548
+ *
549
+ * gkm deploy:github --stage staging --profile acme-dev
550
+ * gkm deploy:github --stage prod --profile acme-prod
551
+ *
552
+ * In the stage's account it makes sure GitHub's OIDC provider exists, and a
553
+ * role that only this repository's `<stage>` environment can assume. On
554
+ * GitHub it creates that environment and gives it what the generated deploy
555
+ * workflow reads: `AWS_ROLE_ARN`, and — when the stage's secrets are kept in
556
+ * the local file — its key as `GKM_SECRETS_KEY`. With `secrets.store` set to
557
+ * S3, SSM or Secrets Manager the deploy job reads them with the role instead, so
558
+ * no key is handed to GitHub, and this checks the stage's store in the same
559
+ * account, with the same profile. Re-running it converges rather than duplicating.
560
+ *
561
+ * The role trusts the exact `sub` GitHub sends for the environment, read from
562
+ * the repository's OIDC subject settings (`githubOidc.ts`) — the default, the
563
+ * immutable subject with the owner's and repository's ids, or a custom
564
+ * template. A re-run rewrites an existing role's trust to it, so running this
565
+ * again repairs a role that trusted the wrong format. What the role may do is
566
+ * `githubPolicy.ts`: `AdministratorAccess` for SST, and for a compose stage
567
+ * only its own secrets (and deploy state, when that is in AWS).
568
+ */
569
+ const logger = console;
570
+ const GITHUB_OIDC_HOST = "token.actions.githubusercontent.com";
571
+ const AUDIENCE = "sts.amazonaws.com";
572
+ /**
573
+ * The tag recording which managed policy gkm attached to the role — so a
574
+ * re-run detaches only what gkm put there, never a policy someone else did.
575
+ */
576
+ const POLICY_TAG = "gkm:policy-arn";
577
+ /** The system's `gh`. */
578
+ const ghCli = (args, input) => (0, node_child_process.execFileSync)("gh", args, {
579
+ encoding: "utf-8",
580
+ stdio: [
581
+ "pipe",
582
+ "pipe",
583
+ "pipe"
584
+ ],
585
+ ...input === void 0 ? {} : { input }
586
+ }).trim();
587
+ /** The role a stage deploys as: `<project>-github-<stage>`, within IAM's 64. */
588
+ function roleName(project, stage) {
589
+ return `${project}-github-${stage}`.toLowerCase().replace(/[^a-z0-9+=,.@_-]/g, "-").slice(0, 64);
590
+ }
591
+ /**
592
+ * Who may assume the role: a workflow job whose OIDC token carries exactly
593
+ * `subject` — the repository's `<stage>` environment, in the format the
594
+ * repository sends (see `githubOidc.ts`), and nothing else. Not another
595
+ * branch's job, not another environment's: that is what keeps a staging
596
+ * deploy from using the production role.
597
+ */
598
+ function trustPolicy(providerArn, subject) {
599
+ return JSON.stringify({
600
+ Version: "2012-10-17",
601
+ Statement: [{
602
+ Effect: "Allow",
603
+ Principal: { Federated: providerArn },
604
+ Action: "sts:AssumeRoleWithWebIdentity",
605
+ Condition: { StringEquals: {
606
+ [`${GITHUB_OIDC_HOST}:aud`]: AUDIENCE,
607
+ [`${GITHUB_OIDC_HOST}:sub`]: subject
608
+ } }
609
+ }]
610
+ });
611
+ }
612
+ /**
613
+ * The subject a trust policy trusts, or undefined when it names none. IAM
614
+ * hands documents back URL-encoded.
615
+ */
616
+ function trustedSubject(document) {
617
+ if (!document) return void 0;
618
+ let parsed;
619
+ try {
620
+ parsed = JSON.parse(safeDecode(document));
621
+ } catch {
622
+ return;
623
+ }
624
+ for (const statement of parsed.Statement ?? []) for (const operator of Object.values(statement.Condition ?? {})) {
625
+ const value = operator[`${GITHUB_OIDC_HOST}:sub`];
626
+ if (typeof value === "string") return value;
627
+ if (Array.isArray(value)) return value.join(", ");
628
+ }
629
+ }
630
+ function safeDecode(value) {
631
+ try {
632
+ return decodeURIComponent(value);
633
+ } catch {
634
+ return value;
635
+ }
636
+ }
637
+ /** GitHub's OIDC provider in this account, created if it is not there. */
638
+ async function ensureOidcProvider(iam) {
639
+ const { OpenIDConnectProviderList = [] } = await iam.send(new _aws_sdk_client_iam.ListOpenIDConnectProvidersCommand({}));
640
+ const existing = OpenIDConnectProviderList.find((p) => p.Arn?.endsWith(`oidc-provider/${GITHUB_OIDC_HOST}`))?.Arn;
641
+ if (existing) return existing;
642
+ return (await iam.send(new _aws_sdk_client_iam.CreateOpenIDConnectProviderCommand({
643
+ Url: `https://${GITHUB_OIDC_HOST}`,
644
+ ClientIDList: [AUDIENCE]
645
+ }))).OpenIDConnectProviderArn;
646
+ }
647
+ function isNoSuchEntity(error) {
648
+ return error.name === "NoSuchEntityException";
649
+ }
650
+ /**
651
+ * The deploy role, created or brought back to this trust and access.
652
+ *
653
+ * Converges: re-running rewrites the trust, and moves the role from one access
654
+ * to another — detaching a managed policy only when the role's
655
+ * {@link POLICY_TAG} says gkm attached it.
656
+ */
657
+ async function ensureRole(iam, name, trust, access) {
658
+ let arn;
659
+ let created = false;
660
+ let previousSubject;
661
+ let recorded;
662
+ try {
663
+ const { Role } = await iam.send(new _aws_sdk_client_iam.GetRoleCommand({ RoleName: name }));
664
+ previousSubject = trustedSubject(Role.AssumeRolePolicyDocument);
665
+ await iam.send(new _aws_sdk_client_iam.UpdateAssumeRolePolicyCommand({
666
+ RoleName: name,
667
+ PolicyDocument: trust
668
+ }));
669
+ arn = Role.Arn;
670
+ const { Tags = [] } = await iam.send(new _aws_sdk_client_iam.ListRoleTagsCommand({ RoleName: name }));
671
+ recorded = Tags.find((tag) => tag.Key === POLICY_TAG)?.Value;
672
+ } catch (error) {
673
+ if (!isNoSuchEntity(error)) throw error;
674
+ const { Role } = await iam.send(new _aws_sdk_client_iam.CreateRoleCommand({
675
+ RoleName: name,
676
+ AssumeRolePolicyDocument: trust,
677
+ Description: "Deploys from GitHub Actions (gkm deploy:github)",
678
+ MaxSessionDuration: 7200
679
+ }));
680
+ arn = Role.Arn;
681
+ created = true;
682
+ }
683
+ const detached = [];
684
+ const leftAttached = [];
685
+ const detach = async (policyArn) => {
686
+ try {
687
+ await iam.send(new _aws_sdk_client_iam.DetachRolePolicyCommand({
688
+ RoleName: name,
689
+ PolicyArn: policyArn
690
+ }));
691
+ detached.push(policyArn);
692
+ } catch (error) {
693
+ if (!isNoSuchEntity(error)) throw error;
694
+ }
695
+ };
696
+ const deleteInline = async () => {
697
+ try {
698
+ await iam.send(new _aws_sdk_client_iam.DeleteRolePolicyCommand({
699
+ RoleName: name,
700
+ PolicyName: SCOPED_POLICY_NAME
701
+ }));
702
+ } catch (error) {
703
+ if (!isNoSuchEntity(error)) throw error;
704
+ }
705
+ };
706
+ if ("managed" in access) {
707
+ await iam.send(new _aws_sdk_client_iam.AttachRolePolicyCommand({
708
+ RoleName: name,
709
+ PolicyArn: access.managed
710
+ }));
711
+ if (recorded && recorded !== access.managed) await detach(recorded);
712
+ if (recorded !== access.managed) await iam.send(new _aws_sdk_client_iam.TagRoleCommand({
713
+ RoleName: name,
714
+ Tags: [{
715
+ Key: POLICY_TAG,
716
+ Value: access.managed
717
+ }]
718
+ }));
719
+ if (!created) await deleteInline();
720
+ return {
721
+ arn,
722
+ created,
723
+ previousSubject,
724
+ detached,
725
+ leftAttached
726
+ };
727
+ }
728
+ if (access.inline) await iam.send(new _aws_sdk_client_iam.PutRolePolicyCommand({
729
+ RoleName: name,
730
+ PolicyName: SCOPED_POLICY_NAME,
731
+ PolicyDocument: access.inline
732
+ }));
733
+ else if (!created) await deleteInline();
734
+ if (created) return {
735
+ arn,
736
+ created,
737
+ previousSubject,
738
+ detached,
739
+ leftAttached
740
+ };
741
+ if (recorded) {
742
+ await detach(recorded);
743
+ await iam.send(new _aws_sdk_client_iam.UntagRoleCommand({
744
+ RoleName: name,
745
+ TagKeys: [POLICY_TAG]
746
+ }));
747
+ }
748
+ const { AttachedPolicies = [] } = await iam.send(new _aws_sdk_client_iam.ListAttachedRolePoliciesCommand({ RoleName: name }));
749
+ for (const policy of AttachedPolicies) if (policy.PolicyArn && !detached.includes(policy.PolicyArn)) leftAttached.push(policy.PolicyArn);
750
+ return {
751
+ arn,
752
+ created,
753
+ previousSubject,
754
+ detached,
755
+ leftAttached
756
+ };
757
+ }
758
+ /**
759
+ * An IAM client for the stage's account.
760
+ *
761
+ * `fromIni` for a named profile, deliberately: it resolves exactly that
762
+ * profile — keys, assume-role, `credential_process` or SSO, whichever
763
+ * ~/.aws/config says — and never falls back to AWS_* in the environment. The
764
+ * provider chain checks the environment first, so exported staging keys would
765
+ * quietly win over `--profile prod` and the production role would land in the
766
+ * staging account.
767
+ */
768
+ async function iamFor(profile, endpoint) {
769
+ const config = { region: "us-east-1" };
770
+ if (profile) {
771
+ const { fromIni } = await import("@aws-sdk/credential-providers");
772
+ config.credentials = fromIni({ profile });
773
+ }
774
+ if (endpoint) {
775
+ config.endpoint = endpoint;
776
+ config.credentials = {
777
+ accessKeyId: "test",
778
+ secretAccessKey: "test"
779
+ };
780
+ }
781
+ return new _aws_sdk_client_iam.IAMClient(config);
782
+ }
783
+ async function deployGithubCommand(options, deps = {}) {
784
+ const gh = deps.gh ?? ghCli;
785
+ const { workspace } = await require_config.loadWorkspaceConfig(deps.cwd);
786
+ require_workspace.assertDeployedStage(workspace.stages, options.stage);
787
+ const repo = options.repo ?? gh([
788
+ "repo",
789
+ "view",
790
+ "--json",
791
+ "nameWithOwner",
792
+ "-q",
793
+ ".nameWithOwner"
794
+ ]);
795
+ const role = roleName(workspace.name, options.stage);
796
+ const oidc = resolveOidcSubject(gh, repo, options.stage);
797
+ const manifest = await require_discover.discover({
798
+ patterns: require_apps.constructGlobs(workspace),
799
+ cwd: workspace.root
800
+ });
801
+ const access = deployAccess(workspace, options.stage, options.policyArn, manifest);
802
+ const key = await require_credentials.readKey(options.stage, require_credentials.keystoreProject(workspace));
803
+ const keyPath = require_credentials.getKeyPath(options.stage, require_credentials.keystoreProject(workspace));
804
+ const hasKey = key !== null;
805
+ const remote = require_credentials.isRemoteStore(workspace, options.stage);
806
+ const store = await require_credentials.secretsStoreFor(workspace, options.stage, { ...options.profile ? { profile: options.profile } : {} });
807
+ const hasSecrets = remote && await store.read(options.stage) !== null;
808
+ const via = options.profile ? `profile "${options.profile}"` : "the default credentials";
809
+ logger.log(`\n🔐 GitHub → AWS for stage "${options.stage}"\n`);
810
+ logger.log(` Repository: ${repo}`);
811
+ logger.log(` AWS profile: ${options.profile ?? "(default credentials)"}`);
812
+ logger.log(` Role: ${role}`);
813
+ if (access.kind === "managed") logger.log(` Policy: ${access.policyArn} (${access.reason})`);
814
+ else if (access.describe.length > 0) {
815
+ logger.log(` Policy: inline "${SCOPED_POLICY_NAME}", scoped to the compose deploy — only:`);
816
+ for (const line of access.describe) logger.log(` ${line}`);
817
+ } else logger.log(" Policy: none — a compose deploy with file secrets and local state reads nothing from AWS");
818
+ logger.log(` Trusted by: ${oidc.subject} only (${SUBJECT_KINDS[oidc.kind]})`);
819
+ if (oidc.warning) logger.log(` ⚠ ${oidc.warning}`);
820
+ 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}`}`);
821
+ else logger.log(` Secrets key: ${hasKey ? keyPath : `none at ${keyPath} — run gkm secrets:init --stage ${options.stage} first`}`);
822
+ if (options.dryRun) {
823
+ if (access.kind === "scoped") {
824
+ const document = scopedPolicyDocument(access.statements("<account>"));
825
+ if (document) logger.log(`\n Inline policy:\n${JSON.stringify(JSON.parse(document), null, 2).replace(/^/gm, " ")}`);
826
+ }
827
+ logger.log("\n --dry-run: nothing changed.\n");
828
+ return {
829
+ repo,
830
+ subject: oidc.subject
831
+ };
832
+ }
833
+ const iam = deps.iam ?? await iamFor(options.profile);
834
+ const providerArn = await ensureOidcProvider(iam).catch((error) => {
835
+ if (/SSO session/i.test(String(error?.message)) && options.profile) throw new SsoSessionExpired(options.profile);
836
+ throw error;
837
+ });
838
+ const outcome = await ensureRole(iam, role, trustPolicy(providerArn, oidc.subject), access.kind === "managed" ? { managed: access.policyArn } : { inline: scopedPolicyDocument(access.statements(accountOf(providerArn))) });
839
+ const roleArn = outcome.arn;
840
+ logger.log(`\n ✓ AWS: ${roleArn}${outcome.created ? " (created)" : ""}`);
841
+ if (!outcome.created) logger.log(outcome.previousSubject === oidc.subject ? ` ✓ Trust: unchanged, ${oidc.subject}` : ` ✓ Trust: ${outcome.previousSubject ?? "(no subject)"} → ${oidc.subject}`);
842
+ for (const detached of outcome.detached) logger.log(` ✓ Detached ${detached} (attached by gkm, no longer needed)`);
843
+ 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}` : ""}`);
844
+ gh([
845
+ "api",
846
+ "--method",
847
+ "PUT",
848
+ `repos/${repo}/environments/${options.stage}`
849
+ ]);
850
+ gh([
851
+ "variable",
852
+ "set",
853
+ "AWS_ROLE_ARN",
854
+ "--env",
855
+ options.stage,
856
+ "--repo",
857
+ repo,
858
+ "--body",
859
+ roleArn
860
+ ]);
861
+ logger.log(` ✓ GitHub: environment "${options.stage}", AWS_ROLE_ARN`);
862
+ if (remote) {
863
+ 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})` : ""}.`);
864
+ } else if (hasKey) {
865
+ gh([
866
+ "secret",
867
+ "set",
868
+ "GKM_SECRETS_KEY",
869
+ "--env",
870
+ options.stage,
871
+ "--repo",
872
+ repo
873
+ ], key);
874
+ logger.log(" ✓ GitHub: GKM_SECRETS_KEY");
875
+ } else logger.log(` ⚠ No secrets key for "${options.stage}"; run gkm secrets:init --stage ${options.stage}, then this again.`);
876
+ logger.log(`\n Protect it: add required reviewers to the "${options.stage}" environment in the repository settings.\n`);
877
+ return {
878
+ roleArn,
879
+ repo,
880
+ subject: oidc.subject
881
+ };
882
+ }
883
+ const SUBJECT_KINDS = {
884
+ default: "the repository's default subject",
885
+ immutable: "the repository's immutable subject",
886
+ custom: "the repository's custom subject template",
887
+ assumed: "assumed: the default format"
888
+ };
889
+ /** The profile's SSO login has lapsed; the fix is one command away. */
890
+ var SsoSessionExpired = class extends require_errors.GkmError {
891
+ profile;
892
+ constructor(profile) {
893
+ super(`The SSO session for profile "${profile}" has expired or is invalid. Run: aws sso login --profile ${profile}`);
894
+ this.profile = profile;
895
+ this.name = "SsoSessionExpired";
896
+ }
897
+ };
898
+ //#endregion
899
+ exports.deployGithubCommand = deployGithubCommand;
900
+ exports.ghCli = ghCli;
901
+
902
+ //# sourceMappingURL=github-OVZF2k0L.cjs.map