@geekmidas/cli 10.0.0-alpha.14 → 10.0.0-alpha.141

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 (424) hide show
  1. package/README.md +313 -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-BMRL04ic.mjs +1037 -0
  7. package/dist/EndpointGenerator-BMRL04ic.mjs.map +1 -0
  8. package/dist/EndpointGenerator-ePscnbwB.cjs +1096 -0
  9. package/dist/EndpointGenerator-ePscnbwB.cjs.map +1 -0
  10. package/dist/GoDaddyProvider-DxFAueU4.mjs +413 -0
  11. package/dist/GoDaddyProvider-DxFAueU4.mjs.map +1 -0
  12. package/dist/GoDaddyProvider-hAc0q5s-.cjs +413 -0
  13. package/dist/GoDaddyProvider-hAc0q5s-.cjs.map +1 -0
  14. package/dist/{HostingerProvider-BY26bWwB.mjs → HostingerProvider-CgMuKgO_.mjs} +23 -9
  15. package/dist/HostingerProvider-CgMuKgO_.mjs.map +1 -0
  16. package/dist/{HostingerProvider-BZFGYYVA.cjs → HostingerProvider-DEqpvoiD.cjs} +23 -9
  17. package/dist/HostingerProvider-DEqpvoiD.cjs.map +1 -0
  18. package/dist/LegacyStateStore-BPY8Acgs.mjs +124 -0
  19. package/dist/LegacyStateStore-BPY8Acgs.mjs.map +1 -0
  20. package/dist/LegacyStateStore-BqSVgWi1.cjs +124 -0
  21. package/dist/LegacyStateStore-BqSVgWi1.cjs.map +1 -0
  22. package/dist/LocalStateStore-5pVR26KA.mjs +167 -0
  23. package/dist/LocalStateStore-5pVR26KA.mjs.map +1 -0
  24. package/dist/LocalStateStore-Df4RyGi2.cjs +178 -0
  25. package/dist/LocalStateStore-Df4RyGi2.cjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-B-PQLx8X.mjs +534 -0
  27. package/dist/OpenApiTsGenerator-B-PQLx8X.mjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-BvacdbiG.cjs +539 -0
  29. package/dist/OpenApiTsGenerator-BvacdbiG.cjs.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-Do1DwEMX.mjs +223 -0
  35. package/dist/S3StateStore-Do1DwEMX.mjs.map +1 -0
  36. package/dist/S3StateStore-uykstvZI.cjs +222 -0
  37. package/dist/S3StateStore-uykstvZI.cjs.map +1 -0
  38. package/dist/SSMStateStore-DQXFWqkE.cjs +204 -0
  39. package/dist/SSMStateStore-DQXFWqkE.cjs.map +1 -0
  40. package/dist/SSMStateStore-xQ-Ce91W.mjs +205 -0
  41. package/dist/SSMStateStore-xQ-Ce91W.mjs.map +1 -0
  42. package/dist/SubscriberGenerator-DLPH-ynS.mjs +783 -0
  43. package/dist/SubscriberGenerator-DLPH-ynS.mjs.map +1 -0
  44. package/dist/SubscriberGenerator-DR4Y7ihK.cjs +848 -0
  45. package/dist/SubscriberGenerator-DR4Y7ihK.cjs.map +1 -0
  46. package/dist/add-DLkN488n.mjs +711 -0
  47. package/dist/add-DLkN488n.mjs.map +1 -0
  48. package/dist/add-Y_nPkjIf.cjs +713 -0
  49. package/dist/add-Y_nPkjIf.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-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
  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-BeNDZdHQ.cjs → bundler-COOvv27I.cjs} +59 -14
  75. package/dist/bundler-COOvv27I.cjs.map +1 -0
  76. package/dist/{bundler-BodTL4kf.mjs → bundler-DFyrGST-.mjs} +59 -14
  77. package/dist/bundler-DFyrGST-.mjs.map +1 -0
  78. package/dist/cli-DKsV-Myw.cjs +71 -0
  79. package/dist/cli-DKsV-Myw.cjs.map +1 -0
  80. package/dist/cli-iAX4BQ3t.mjs +71 -0
  81. package/dist/cli-iAX4BQ3t.mjs.map +1 -0
  82. package/dist/compose-CGXx22Wy.cjs +4416 -0
  83. package/dist/compose-CGXx22Wy.cjs.map +1 -0
  84. package/dist/compose-ofZIpp2q.mjs +4273 -0
  85. package/dist/compose-ofZIpp2q.mjs.map +1 -0
  86. package/dist/config-BbivVpq0.d.mts +268 -0
  87. package/dist/config-BbivVpq0.d.mts.map +1 -0
  88. package/dist/config-BcL1Fojs.d.cts +268 -0
  89. package/dist/config-BcL1Fojs.d.cts.map +1 -0
  90. package/dist/config.cjs +420 -9
  91. package/dist/config.cjs.map +1 -0
  92. package/dist/config.d.cts +4 -117
  93. package/dist/config.d.mts +4 -117
  94. package/dist/config.mjs +406 -3
  95. package/dist/config.mjs.map +1 -0
  96. package/dist/credentialSchemas-DUCSYl9a.mjs +237 -0
  97. package/dist/credentialSchemas-DUCSYl9a.mjs.map +1 -0
  98. package/dist/credentialSchemas-DZ2Nh5li.cjs +272 -0
  99. package/dist/credentialSchemas-DZ2Nh5li.cjs.map +1 -0
  100. package/dist/credentials-D7XJypNd.cjs +520 -0
  101. package/dist/credentials-D7XJypNd.cjs.map +1 -0
  102. package/dist/credentials-DpfnUvIR.mjs +395 -0
  103. package/dist/credentials-DpfnUvIR.mjs.map +1 -0
  104. package/dist/databases-Db48ZIXL.mjs +588 -0
  105. package/dist/databases-Db48ZIXL.mjs.map +1 -0
  106. package/dist/databases-P824RTnx.cjs +703 -0
  107. package/dist/databases-P824RTnx.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 +211 -0
  113. package/dist/deploy/public.cjs.map +1 -0
  114. package/dist/deploy/public.d.cts +647 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +647 -0
  117. package/dist/deploy/public.d.mts.map +1 -0
  118. package/dist/deploy/public.mjs +144 -0
  119. package/dist/deploy/public.mjs.map +1 -0
  120. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  121. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  122. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  123. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  124. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  125. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  126. package/dist/deploy/sniffer-hooks.cjs +1 -1
  127. package/dist/deploy/sniffer-hooks.mjs +1 -1
  128. package/dist/deploy/sniffer-loader.cjs +2 -2
  129. package/dist/deploy/sniffer-loader.mjs +1 -1
  130. package/dist/deploy/sniffer-routes-worker.cjs +2 -2
  131. package/dist/deploy/sniffer-routes-worker.mjs +1 -1
  132. package/dist/deploy-BibGpDAz.cjs +3891 -0
  133. package/dist/deploy-BibGpDAz.cjs.map +1 -0
  134. package/dist/deploy-C4QQkHK7.mjs +3835 -0
  135. package/dist/deploy-C4QQkHK7.mjs.map +1 -0
  136. package/dist/derive-Cd7Hl3r2.mjs +259 -0
  137. package/dist/derive-Cd7Hl3r2.mjs.map +1 -0
  138. package/dist/derive-CgZfoBU2.cjs +282 -0
  139. package/dist/derive-CgZfoBU2.cjs.map +1 -0
  140. package/dist/discover-B2m8ytyq.mjs +831 -0
  141. package/dist/discover-B2m8ytyq.mjs.map +1 -0
  142. package/dist/discover-yqeJ2Bx7.cjs +934 -0
  143. package/dist/discover-yqeJ2Bx7.cjs.map +1 -0
  144. package/dist/dokploy-B_VX3nLM.cjs +38 -0
  145. package/dist/dokploy-B_VX3nLM.cjs.map +1 -0
  146. package/dist/dokploy-pSrsileA.mjs +38 -0
  147. package/dist/dokploy-pSrsileA.mjs.map +1 -0
  148. package/dist/drivers-C47nm-wB.cjs +311 -0
  149. package/dist/drivers-C47nm-wB.cjs.map +1 -0
  150. package/dist/drivers-CDjpjakg.mjs +252 -0
  151. package/dist/drivers-CDjpjakg.mjs.map +1 -0
  152. package/dist/eas-Bou-_M76.mjs +334 -0
  153. package/dist/eas-Bou-_M76.mjs.map +1 -0
  154. package/dist/eas-cSSc8Lex.cjs +337 -0
  155. package/dist/eas-cSSc8Lex.cjs.map +1 -0
  156. package/dist/emit-Bj6XSivk.mjs +136 -0
  157. package/dist/emit-Bj6XSivk.mjs.map +1 -0
  158. package/dist/emit-CDC__ubE.cjs +147 -0
  159. package/dist/emit-CDC__ubE.cjs.map +1 -0
  160. package/dist/encryption-Bps9As2D.mjs +89 -0
  161. package/dist/encryption-Bps9As2D.mjs.map +1 -0
  162. package/dist/encryption-CElaAwJs.cjs +90 -0
  163. package/dist/encryption-CElaAwJs.cjs.map +1 -0
  164. package/dist/engine-CXE4UOHj.mjs +3210 -0
  165. package/dist/engine-CXE4UOHj.mjs.map +1 -0
  166. package/dist/engine-CiG7Wfyc.cjs +3323 -0
  167. package/dist/engine-CiG7Wfyc.cjs.map +1 -0
  168. package/dist/errors-D8Gwp5kU.mjs +23 -0
  169. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  170. package/dist/errors-DMC4Umsb.cjs +34 -0
  171. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  172. package/dist/github-BzppIvpw.cjs +901 -0
  173. package/dist/github-BzppIvpw.cjs.map +1 -0
  174. package/dist/github-CvFJlFWA.mjs +900 -0
  175. package/dist/github-CvFJlFWA.mjs.map +1 -0
  176. package/dist/googlePlay-BJnMCWoa.cjs +931 -0
  177. package/dist/googlePlay-BJnMCWoa.cjs.map +1 -0
  178. package/dist/googlePlay-RSe9wOfZ.mjs +931 -0
  179. package/dist/googlePlay-RSe9wOfZ.mjs.map +1 -0
  180. package/dist/identity-CBXr4wNi.mjs +129 -0
  181. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  182. package/dist/identity-CbLfgQNT.cjs +182 -0
  183. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  184. package/dist/{index-D-iAVHx-.d.cts → index-BZZeEWug.d.mts} +39 -15
  185. package/dist/index-BZZeEWug.d.mts.map +1 -0
  186. package/dist/{index-Cd-qeOam.d.mts → index-C1jffZ5_.d.cts} +39 -15
  187. package/dist/index-C1jffZ5_.d.cts.map +1 -0
  188. package/dist/index.cjs +13502 -12269
  189. package/dist/index.cjs.map +1 -1
  190. package/dist/index.mjs +13522 -12287
  191. package/dist/index.mjs.map +1 -1
  192. package/dist/local-B7Zv1NoA.mjs +224 -0
  193. package/dist/local-B7Zv1NoA.mjs.map +1 -0
  194. package/dist/local-OPC9BCZt.cjs +241 -0
  195. package/dist/local-OPC9BCZt.cjs.map +1 -0
  196. package/dist/migrate-B0nQra2W.mjs +181 -0
  197. package/dist/migrate-B0nQra2W.mjs.map +1 -0
  198. package/dist/migrate-BCBs0BMn.cjs +181 -0
  199. package/dist/migrate-BCBs0BMn.cjs.map +1 -0
  200. package/dist/migrate-BPCJBL7_.mjs +265 -0
  201. package/dist/migrate-BPCJBL7_.mjs.map +1 -0
  202. package/dist/migrate-Dmh5Dbcr.cjs +270 -0
  203. package/dist/migrate-Dmh5Dbcr.cjs.map +1 -0
  204. package/dist/openapi.cjs +214 -7
  205. package/dist/openapi.cjs.map +1 -0
  206. package/dist/openapi.d.cts +32 -8
  207. package/dist/openapi.d.cts.map +1 -1
  208. package/dist/openapi.d.mts +32 -8
  209. package/dist/openapi.d.mts.map +1 -1
  210. package/dist/openapi.mjs +209 -2
  211. package/dist/openapi.mjs.map +1 -0
  212. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  213. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  214. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  215. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  216. package/dist/provider-BqpjG9QM.cjs +57 -0
  217. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  218. package/dist/provider-CEOKk8NS.mjs +46 -0
  219. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  220. package/dist/publish-DKy3hn8a.cjs +124 -0
  221. package/dist/publish-DKy3hn8a.cjs.map +1 -0
  222. package/dist/publish-cthyGGQt.mjs +123 -0
  223. package/dist/publish-cthyGGQt.mjs.map +1 -0
  224. package/dist/ready-CGqJ74Kt.mjs +375 -0
  225. package/dist/ready-CGqJ74Kt.mjs.map +1 -0
  226. package/dist/ready-DuU0FXSj.cjs +404 -0
  227. package/dist/ready-DuU0FXSj.cjs.map +1 -0
  228. package/dist/reconcile/public.cjs +3 -5
  229. package/dist/reconcile/public.d.cts +31 -89
  230. package/dist/reconcile/public.d.cts.map +1 -1
  231. package/dist/reconcile/public.d.mts +31 -89
  232. package/dist/reconcile/public.d.mts.map +1 -1
  233. package/dist/reconcile/public.mjs +3 -3
  234. package/dist/{reconcile-DhQ00DpU.mjs → reconcile--I7V4Klj.mjs} +2 -2
  235. package/dist/{reconcile-DhQ00DpU.mjs.map → reconcile--I7V4Klj.mjs.map} +1 -1
  236. package/dist/{reconcile-Dd2iyILf.cjs → reconcile-CuCQBa5-.cjs} +3 -3
  237. package/dist/{reconcile-Dd2iyILf.cjs.map → reconcile-CuCQBa5-.cjs.map} +1 -1
  238. package/dist/resolve-AYtMIgoq.cjs +316 -0
  239. package/dist/resolve-AYtMIgoq.cjs.map +1 -0
  240. package/dist/resolve-BaRqJlqV.mjs +263 -0
  241. package/dist/resolve-BaRqJlqV.mjs.map +1 -0
  242. package/dist/rollback-CQ184yFu.cjs +165 -0
  243. package/dist/rollback-CQ184yFu.cjs.map +1 -0
  244. package/dist/rollback-DqV6t9oo.mjs +136 -0
  245. package/dist/rollback-DqV6t9oo.mjs.map +1 -0
  246. package/dist/runtime-Bvgyxm88.d.cts +82 -0
  247. package/dist/runtime-Bvgyxm88.d.cts.map +1 -0
  248. package/dist/runtime-CeAt1IJd.d.mts +82 -0
  249. package/dist/runtime-CeAt1IJd.d.mts.map +1 -0
  250. package/dist/s3-BKnL6YGQ.cjs +215 -0
  251. package/dist/s3-BKnL6YGQ.cjs.map +1 -0
  252. package/dist/s3-DW7SLsb8.mjs +215 -0
  253. package/dist/s3-DW7SLsb8.mjs.map +1 -0
  254. package/dist/sandbox/config-worker.cjs +43 -0
  255. package/dist/sandbox/config-worker.cjs.map +1 -0
  256. package/dist/sandbox/config-worker.d.cts +1 -0
  257. package/dist/sandbox/config-worker.d.mts +1 -0
  258. package/dist/sandbox/config-worker.mjs +44 -0
  259. package/dist/sandbox/config-worker.mjs.map +1 -0
  260. package/dist/sandbox/credentials-worker.cjs +54 -0
  261. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  262. package/dist/sandbox/credentials-worker.d.cts +1 -0
  263. package/dist/sandbox/credentials-worker.d.mts +1 -0
  264. package/dist/sandbox/credentials-worker.mjs +55 -0
  265. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  266. package/dist/sandbox/discover-worker.cjs +47 -0
  267. package/dist/sandbox/discover-worker.cjs.map +1 -0
  268. package/dist/sandbox/discover-worker.d.cts +1 -0
  269. package/dist/sandbox/discover-worker.d.mts +1 -0
  270. package/dist/sandbox/discover-worker.mjs +48 -0
  271. package/dist/sandbox/discover-worker.mjs.map +1 -0
  272. package/dist/sandbox/migrate-worker.cjs +76 -0
  273. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  274. package/dist/sandbox/migrate-worker.d.cts +1 -0
  275. package/dist/sandbox/migrate-worker.d.mts +1 -0
  276. package/dist/sandbox/migrate-worker.mjs +77 -0
  277. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  278. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  279. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  280. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  281. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  282. package/dist/{workspace-mFpI_ky_.cjs → schemas-BCwKKA42.mjs} +399 -1162
  283. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  284. package/dist/{workspace-CgwmXEtc.mjs → schemas-BQ_v0lEX.cjs} +487 -971
  285. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  286. package/dist/secretsManager-CQORubp9.mjs +97 -0
  287. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  288. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  289. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  290. package/dist/seeds-DndMeyzm.cjs +10669 -0
  291. package/dist/seeds-DndMeyzm.cjs.map +1 -0
  292. package/dist/seeds-o6x6BTRo.mjs +9534 -0
  293. package/dist/seeds-o6x6BTRo.mjs.map +1 -0
  294. package/dist/serverSetup-AfG0-at8.mjs +651 -0
  295. package/dist/serverSetup-AfG0-at8.mjs.map +1 -0
  296. package/dist/serverSetup-Dnw9Kdel.cjs +651 -0
  297. package/dist/serverSetup-Dnw9Kdel.cjs.map +1 -0
  298. package/dist/sniffer-BHhJ8DiC.mjs +1825 -0
  299. package/dist/sniffer-BHhJ8DiC.mjs.map +1 -0
  300. package/dist/sniffer-taO-AXSk.cjs +1998 -0
  301. package/dist/sniffer-taO-AXSk.cjs.map +1 -0
  302. package/dist/snsSubscriptions-CC-WM1zC.cjs +1720 -0
  303. package/dist/snsSubscriptions-CC-WM1zC.cjs.map +1 -0
  304. package/dist/snsSubscriptions-D_IBKhni.mjs +1497 -0
  305. package/dist/snsSubscriptions-D_IBKhni.mjs.map +1 -0
  306. package/dist/sst-Bz2HJlqc.mjs +440 -0
  307. package/dist/sst-Bz2HJlqc.mjs.map +1 -0
  308. package/dist/sst-lvCHdYsY.cjs +463 -0
  309. package/dist/sst-lvCHdYsY.cjs.map +1 -0
  310. package/dist/stage-CTibxcpA.cjs +310 -0
  311. package/dist/stage-CTibxcpA.cjs.map +1 -0
  312. package/dist/stage-dd9dtLfh.mjs +299 -0
  313. package/dist/stage-dd9dtLfh.mjs.map +1 -0
  314. package/dist/stages--icWbhPy.cjs +190 -0
  315. package/dist/stages--icWbhPy.cjs.map +1 -0
  316. package/dist/stages-CUwSy39f.mjs +190 -0
  317. package/dist/stages-CUwSy39f.mjs.map +1 -0
  318. package/dist/target/public.cjs +15 -0
  319. package/dist/target/public.d.cts +28 -0
  320. package/dist/target/public.d.cts.map +1 -0
  321. package/dist/target/public.d.mts +28 -0
  322. package/dist/target/public.d.mts.map +1 -0
  323. package/dist/target/public.mjs +4 -0
  324. package/dist/terminal-DURcYlVX.cjs +85 -0
  325. package/dist/terminal-DURcYlVX.cjs.map +1 -0
  326. package/dist/terminal-yOZ7kKF9.mjs +85 -0
  327. package/dist/terminal-yOZ7kKF9.mjs.map +1 -0
  328. package/dist/{types-C5ZNpUad.d.cts → types-C6hDCkV2.d.mts} +2229 -456
  329. package/dist/types-C6hDCkV2.d.mts.map +1 -0
  330. package/dist/{types-BGo5TaNE.d.mts → types-Dy1eV7yc.d.cts} +2231 -456
  331. package/dist/types-Dy1eV7yc.d.cts.map +1 -0
  332. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  333. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  334. package/dist/utils-D_fxUqvU.mjs +156 -0
  335. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  336. package/dist/vitest.cjs +65 -0
  337. package/dist/vitest.cjs.map +1 -0
  338. package/dist/vitest.d.cts +29 -0
  339. package/dist/vitest.d.cts.map +1 -0
  340. package/dist/vitest.d.mts +29 -0
  341. package/dist/vitest.d.mts.map +1 -0
  342. package/dist/vitest.mjs +65 -0
  343. package/dist/vitest.mjs.map +1 -0
  344. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  345. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  346. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  347. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  348. package/dist/workspace/index.cjs +6 -2
  349. package/dist/workspace/index.d.cts +3 -3
  350. package/dist/workspace/index.d.mts +3 -3
  351. package/dist/workspace/index.mjs +2 -2
  352. package/dist/workspace-BbfBFtjn.mjs +2488 -0
  353. package/dist/workspace-BbfBFtjn.mjs.map +1 -0
  354. package/dist/workspace-Dkm3HL9e.cjs +2924 -0
  355. package/dist/workspace-Dkm3HL9e.cjs.map +1 -0
  356. package/package.json +61 -14
  357. package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
  358. package/dist/HostingerProvider-BZFGYYVA.cjs.map +0 -1
  359. package/dist/LocalStateProvider-7HR6SS2t.cjs +0 -48
  360. package/dist/LocalStateProvider-7HR6SS2t.cjs.map +0 -1
  361. package/dist/LocalStateProvider-D7QyJoLM.mjs +0 -48
  362. package/dist/LocalStateProvider-D7QyJoLM.mjs.map +0 -1
  363. package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
  364. package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
  365. package/dist/SSMStateProvider-B0Hu1MKZ.mjs +0 -75
  366. package/dist/SSMStateProvider-B0Hu1MKZ.mjs.map +0 -1
  367. package/dist/SSMStateProvider-VrQ-yeqd.cjs +0 -74
  368. package/dist/SSMStateProvider-VrQ-yeqd.cjs.map +0 -1
  369. package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
  370. package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
  371. package/dist/bundler-BeNDZdHQ.cjs.map +0 -1
  372. package/dist/bundler-BodTL4kf.mjs.map +0 -1
  373. package/dist/config-Q1rvKHvw.cjs +0 -467
  374. package/dist/config-Q1rvKHvw.cjs.map +0 -1
  375. package/dist/config-pqGD3hF9.mjs +0 -414
  376. package/dist/config-pqGD3hF9.mjs.map +0 -1
  377. package/dist/config.d.cts.map +0 -1
  378. package/dist/config.d.mts.map +0 -1
  379. package/dist/credentials-BekkKtY_.mjs +0 -2780
  380. package/dist/credentials-BekkKtY_.mjs.map +0 -1
  381. package/dist/credentials-Q6F0uqJq.cjs +0 -2917
  382. package/dist/credentials-Q6F0uqJq.cjs.map +0 -1
  383. package/dist/discover-BERGFg8v.cjs +0 -288
  384. package/dist/discover-BERGFg8v.cjs.map +0 -1
  385. package/dist/discover-CK-n3w6b.mjs +0 -244
  386. package/dist/discover-CK-n3w6b.mjs.map +0 -1
  387. package/dist/emit-BdoPFjZf.cjs +0 -253
  388. package/dist/emit-BdoPFjZf.cjs.map +0 -1
  389. package/dist/emit-Bzq7JsMP.mjs +0 -224
  390. package/dist/emit-Bzq7JsMP.mjs.map +0 -1
  391. package/dist/fullstack-secrets-BET8gqwK.mjs +0 -81
  392. package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
  393. package/dist/fullstack-secrets-DXsWO-5m.cjs +0 -92
  394. package/dist/fullstack-secrets-DXsWO-5m.cjs.map +0 -1
  395. package/dist/generator-LfZU7NlU.mjs +0 -247
  396. package/dist/generator-LfZU7NlU.mjs.map +0 -1
  397. package/dist/generator-Wdfp0jCS.cjs +0 -282
  398. package/dist/generator-Wdfp0jCS.cjs.map +0 -1
  399. package/dist/github-BfflNPVe.cjs +0 -203
  400. package/dist/github-BfflNPVe.cjs.map +0 -1
  401. package/dist/github-CRwnxKmD.mjs +0 -203
  402. package/dist/github-CRwnxKmD.mjs.map +0 -1
  403. package/dist/index-Cd-qeOam.d.mts.map +0 -1
  404. package/dist/index-D-iAVHx-.d.cts.map +0 -1
  405. package/dist/keystore-B4PRlbgE.mjs +0 -81
  406. package/dist/keystore-B4PRlbgE.mjs.map +0 -1
  407. package/dist/keystore-DgGRj2Yy.cjs +0 -98
  408. package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
  409. package/dist/openapi-Dcbme-Us.cjs +0 -2038
  410. package/dist/openapi-Dcbme-Us.cjs.map +0 -1
  411. package/dist/openapi-vy4JzhUv.mjs +0 -1991
  412. package/dist/openapi-vy4JzhUv.mjs.map +0 -1
  413. package/dist/storage-C-30BD1e.cjs +0 -272
  414. package/dist/storage-C-30BD1e.cjs.map +0 -1
  415. package/dist/storage-P_b3w7uj.mjs +0 -231
  416. package/dist/storage-P_b3w7uj.mjs.map +0 -1
  417. package/dist/sync-B3xxXtJT.mjs +0 -88
  418. package/dist/sync-B3xxXtJT.mjs.map +0 -1
  419. package/dist/sync-D7uTIIEi.cjs +0 -111
  420. package/dist/sync-D7uTIIEi.cjs.map +0 -1
  421. package/dist/types-BGo5TaNE.d.mts.map +0 -1
  422. package/dist/types-C5ZNpUad.d.cts.map +0 -1
  423. package/dist/workspace-CgwmXEtc.mjs.map +0 -1
  424. package/dist/workspace-mFpI_ky_.cjs.map +0 -1
@@ -1,203 +0,0 @@
1
- import { o as loadWorkspaceConfig } from "./config-pqGD3hF9.mjs";
2
- import { w as assertDeployedStage } from "./workspace-CgwmXEtc.mjs";
3
- import { t as getKeyPath } from "./keystore-B4PRlbgE.mjs";
4
- import { existsSync, readFileSync } from "node:fs";
5
- import { execFileSync } from "node:child_process";
6
- import { AttachRolePolicyCommand, CreateOpenIDConnectProviderCommand, CreateRoleCommand, GetRoleCommand, IAMClient, ListOpenIDConnectProvidersCommand, UpdateAssumeRolePolicyCommand } from "@aws-sdk/client-iam";
7
- //#region src/deploy/github.ts
8
- /**
9
- * `gkm deploy:github` — let GitHub Actions deploy one stage, with no keys.
10
- *
11
- * A stage usually lives in its own AWS account — staging in one, production in
12
- * another — so this runs once per stage, with that account's profile:
13
- *
14
- * gkm deploy:github --stage staging --profile acme-dev
15
- * gkm deploy:github --stage prod --profile acme-prod
16
- *
17
- * In the stage's account it makes sure GitHub's OIDC provider exists, and a
18
- * role that only this repository's `<stage>` environment can assume. On
19
- * GitHub it creates that environment and gives it what the generated deploy
20
- * workflow reads: `AWS_ROLE_ARN`, and the stage's secrets key as
21
- * `GKM_SECRETS_KEY`. Re-running it converges rather than duplicating.
22
- */
23
- const logger = console;
24
- const GITHUB_OIDC_HOST = "token.actions.githubusercontent.com";
25
- const AUDIENCE = "sts.amazonaws.com";
26
- const defaultGh = (args, input) => execFileSync("gh", args, {
27
- encoding: "utf-8",
28
- ...input === void 0 ? {} : {
29
- input,
30
- stdio: [
31
- "pipe",
32
- "pipe",
33
- "pipe"
34
- ]
35
- }
36
- }).trim();
37
- /** The role a stage deploys as: `<project>-github-<stage>`, within IAM's 64. */
38
- function roleName(project, stage) {
39
- return `${project}-github-${stage}`.toLowerCase().replace(/[^a-z0-9+=,.@_-]/g, "-").slice(0, 64);
40
- }
41
- /**
42
- * Who may assume the role: a workflow job running in this repository's
43
- * `<stage>` environment, and nothing else — not another branch's job, not
44
- * another environment's. That is what keeps a staging deploy from using the
45
- * production role.
46
- */
47
- function trustPolicy(providerArn, repo, stage) {
48
- return JSON.stringify({
49
- Version: "2012-10-17",
50
- Statement: [{
51
- Effect: "Allow",
52
- Principal: { Federated: providerArn },
53
- Action: "sts:AssumeRoleWithWebIdentity",
54
- Condition: { StringEquals: {
55
- [`${GITHUB_OIDC_HOST}:aud`]: AUDIENCE,
56
- [`${GITHUB_OIDC_HOST}:sub`]: `repo:${repo}:environment:${stage}`
57
- } }
58
- }]
59
- });
60
- }
61
- /** GitHub's OIDC provider in this account, created if it is not there. */
62
- async function ensureOidcProvider(iam) {
63
- const { OpenIDConnectProviderList = [] } = await iam.send(new ListOpenIDConnectProvidersCommand({}));
64
- const existing = OpenIDConnectProviderList.find((p) => p.Arn?.endsWith(`oidc-provider/${GITHUB_OIDC_HOST}`))?.Arn;
65
- if (existing) return existing;
66
- return (await iam.send(new CreateOpenIDConnectProviderCommand({
67
- Url: `https://${GITHUB_OIDC_HOST}`,
68
- ClientIDList: [AUDIENCE]
69
- }))).OpenIDConnectProviderArn;
70
- }
71
- /** The deploy role, created or brought back to this trust and policy. */
72
- async function ensureRole(iam, name, trust, policyArn) {
73
- let arn;
74
- try {
75
- const { Role } = await iam.send(new GetRoleCommand({ RoleName: name }));
76
- await iam.send(new UpdateAssumeRolePolicyCommand({
77
- RoleName: name,
78
- PolicyDocument: trust
79
- }));
80
- arn = Role.Arn;
81
- } catch (error) {
82
- if (error.name !== "NoSuchEntityException") throw error;
83
- const { Role } = await iam.send(new CreateRoleCommand({
84
- RoleName: name,
85
- AssumeRolePolicyDocument: trust,
86
- Description: "Deploys from GitHub Actions (gkm deploy:github)",
87
- MaxSessionDuration: 7200
88
- }));
89
- arn = Role.Arn;
90
- }
91
- await iam.send(new AttachRolePolicyCommand({
92
- RoleName: name,
93
- PolicyArn: policyArn
94
- }));
95
- return arn;
96
- }
97
- /**
98
- * An IAM client for the stage's account.
99
- *
100
- * `fromIni` for a named profile, deliberately: it resolves exactly that
101
- * profile — keys, assume-role, `credential_process` or SSO, whichever
102
- * ~/.aws/config says — and never falls back to AWS_* in the environment. The
103
- * provider chain checks the environment first, so exported staging keys would
104
- * quietly win over `--profile prod` and the production role would land in the
105
- * staging account.
106
- */
107
- async function iamFor(profile, endpoint) {
108
- const config = { region: "us-east-1" };
109
- if (profile) {
110
- const { fromIni } = await import("@aws-sdk/credential-providers");
111
- config.credentials = fromIni({ profile });
112
- }
113
- if (endpoint) {
114
- config.endpoint = endpoint;
115
- config.credentials = {
116
- accessKeyId: "test",
117
- secretAccessKey: "test"
118
- };
119
- }
120
- return new IAMClient(config);
121
- }
122
- async function deployGithubCommand(options, deps = {}) {
123
- const gh = deps.gh ?? defaultGh;
124
- const { workspace } = await loadWorkspaceConfig(deps.cwd);
125
- assertDeployedStage(workspace.stages, options.stage);
126
- const repo = options.repo ?? gh([
127
- "repo",
128
- "view",
129
- "--json",
130
- "nameWithOwner",
131
- "-q",
132
- ".nameWithOwner"
133
- ]);
134
- const role = roleName(workspace.name, options.stage);
135
- const policyArn = options.policyArn ?? "arn:aws:iam::aws:policy/AdministratorAccess";
136
- const keyPath = getKeyPath(options.stage, workspace.name);
137
- const hasKey = existsSync(keyPath);
138
- logger.log(`\n🔐 GitHub → AWS for stage "${options.stage}"\n`);
139
- logger.log(` Repository: ${repo}`);
140
- logger.log(` AWS profile: ${options.profile ?? "(default credentials)"}`);
141
- logger.log(` Role: ${role}`);
142
- logger.log(` Policy: ${policyArn}${options.policyArn ? "" : " (default; --policy-arn to narrow)"}`);
143
- logger.log(` Trusted by: repo:${repo}:environment:${options.stage} only`);
144
- logger.log(` Secrets key: ${hasKey ? keyPath : `none at ${keyPath} — run gkm secrets:init --stage ${options.stage} first`}`);
145
- if (options.dryRun) {
146
- logger.log("\n --dry-run: nothing changed.\n");
147
- return { repo };
148
- }
149
- const iam = deps.iam ?? await iamFor(options.profile);
150
- const roleArn = await ensureRole(iam, role, trustPolicy(await ensureOidcProvider(iam).catch((error) => {
151
- if (/SSO session/i.test(String(error?.message)) && options.profile) throw new SsoSessionExpired(options.profile);
152
- throw error;
153
- }), repo, options.stage), policyArn);
154
- logger.log(`\n ✓ AWS: ${roleArn}`);
155
- gh([
156
- "api",
157
- "--method",
158
- "PUT",
159
- `repos/${repo}/environments/${options.stage}`
160
- ]);
161
- gh([
162
- "variable",
163
- "set",
164
- "AWS_ROLE_ARN",
165
- "--env",
166
- options.stage,
167
- "--repo",
168
- repo,
169
- "--body",
170
- roleArn
171
- ]);
172
- logger.log(` ✓ GitHub: environment "${options.stage}", AWS_ROLE_ARN`);
173
- if (hasKey) {
174
- gh([
175
- "secret",
176
- "set",
177
- "GKM_SECRETS_KEY",
178
- "--env",
179
- options.stage,
180
- "--repo",
181
- repo
182
- ], readFileSync(keyPath, "utf-8").trim());
183
- logger.log(" ✓ GitHub: GKM_SECRETS_KEY");
184
- } else logger.log(` ⚠ No secrets key for "${options.stage}"; run gkm secrets:init --stage ${options.stage}, then this again.`);
185
- logger.log(`\n Protect it: add required reviewers to the "${options.stage}" environment in the repository settings.\n`);
186
- return {
187
- roleArn,
188
- repo
189
- };
190
- }
191
- /** The profile's SSO login has lapsed; the fix is one command away. */
192
- var SsoSessionExpired = class extends Error {
193
- profile;
194
- constructor(profile) {
195
- super(`The SSO session for profile "${profile}" has expired or is invalid. Run: aws sso login --profile ${profile}`);
196
- this.profile = profile;
197
- this.name = "SsoSessionExpired";
198
- }
199
- };
200
- //#endregion
201
- export { deployGithubCommand };
202
-
203
- //# sourceMappingURL=github-CRwnxKmD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github-CRwnxKmD.mjs","names":[],"sources":["../src/deploy/github.ts"],"sourcesContent":["/**\n * `gkm deploy:github` — let GitHub Actions deploy one stage, with no keys.\n *\n * A stage usually lives in its own AWS account — staging in one, production in\n * another — so this runs once per stage, with that account's profile:\n *\n * gkm deploy:github --stage staging --profile acme-dev\n * gkm deploy:github --stage prod --profile acme-prod\n *\n * In the stage's account it makes sure GitHub's OIDC provider exists, and a\n * role that only this repository's `<stage>` environment can assume. On\n * GitHub it creates that environment and gives it what the generated deploy\n * workflow reads: `AWS_ROLE_ARN`, and the stage's secrets key as\n * `GKM_SECRETS_KEY`. Re-running it converges rather than duplicating.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport {\n\tAttachRolePolicyCommand,\n\tCreateOpenIDConnectProviderCommand,\n\tCreateRoleCommand,\n\tGetRoleCommand,\n\tIAMClient,\n\ttype IAMClientConfig,\n\tListOpenIDConnectProvidersCommand,\n\tUpdateAssumeRolePolicyCommand,\n} from '@aws-sdk/client-iam';\nimport { loadWorkspaceConfig } from '../config.js';\nimport { getKeyPath } from '../secrets/keystore.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\n\nconst logger = console;\n\nconst GITHUB_OIDC_HOST = 'token.actions.githubusercontent.com';\nconst AUDIENCE = 'sts.amazonaws.com';\n\n/**\n * What SST needs to create a stack is most of AWS, so this is the default —\n * said out loud in the output, and replaceable with `--policy-arn`.\n */\nexport const DEFAULT_POLICY_ARN = 'arn:aws:iam::aws:policy/AdministratorAccess';\n\nexport interface DeployGithubOptions {\n\tstage: string;\n\t/** The AWS profile for the stage's account. */\n\tprofile?: string;\n\t/** `owner/name`; defaults to the repository `gh` sees here. */\n\trepo?: string;\n\t/** The policy the deploy role gets. */\n\tpolicyArn?: string;\n\tdryRun?: boolean;\n}\n\n/** Runs `gh` with the given arguments and optional stdin, returning stdout. */\nexport type Gh = (args: string[], input?: string) => string;\n\nconst defaultGh: Gh = (args, input) =>\n\texecFileSync('gh', args, {\n\t\tencoding: 'utf-8',\n\t\t...(input === undefined\n\t\t\t? {}\n\t\t\t: { input, stdio: ['pipe', 'pipe', 'pipe'] as const }),\n\t}).trim();\n\n/** The role a stage deploys as: `<project>-github-<stage>`, within IAM's 64. */\nexport function roleName(project: string, stage: string): string {\n\treturn `${project}-github-${stage}`\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9+=,.@_-]/g, '-')\n\t\t.slice(0, 64);\n}\n\n/**\n * Who may assume the role: a workflow job running in this repository's\n * `<stage>` environment, and nothing else — not another branch's job, not\n * another environment's. That is what keeps a staging deploy from using the\n * production role.\n */\nexport function trustPolicy(\n\tproviderArn: string,\n\trepo: string,\n\tstage: string,\n): string {\n\treturn JSON.stringify({\n\t\tVersion: '2012-10-17',\n\t\tStatement: [\n\t\t\t{\n\t\t\t\tEffect: 'Allow',\n\t\t\t\tPrincipal: { Federated: providerArn },\n\t\t\t\tAction: 'sts:AssumeRoleWithWebIdentity',\n\t\t\t\tCondition: {\n\t\t\t\t\tStringEquals: {\n\t\t\t\t\t\t[`${GITHUB_OIDC_HOST}:aud`]: AUDIENCE,\n\t\t\t\t\t\t[`${GITHUB_OIDC_HOST}:sub`]: `repo:${repo}:environment:${stage}`,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n}\n\n/** GitHub's OIDC provider in this account, created if it is not there. */\nexport async function ensureOidcProvider(iam: IAMClient): Promise<string> {\n\tconst { OpenIDConnectProviderList = [] } = await iam.send(\n\t\tnew ListOpenIDConnectProvidersCommand({}),\n\t);\n\tconst existing = OpenIDConnectProviderList.find((p) =>\n\t\tp.Arn?.endsWith(`oidc-provider/${GITHUB_OIDC_HOST}`),\n\t)?.Arn;\n\tif (existing) return existing;\n\n\tconst created = await iam.send(\n\t\tnew CreateOpenIDConnectProviderCommand({\n\t\t\tUrl: `https://${GITHUB_OIDC_HOST}`,\n\t\t\tClientIDList: [AUDIENCE],\n\t\t}),\n\t);\n\treturn created.OpenIDConnectProviderArn!;\n}\n\n/** The deploy role, created or brought back to this trust and policy. */\nexport async function ensureRole(\n\tiam: IAMClient,\n\tname: string,\n\ttrust: string,\n\tpolicyArn: string,\n): Promise<string> {\n\tlet arn: string;\n\ttry {\n\t\tconst { Role } = await iam.send(new GetRoleCommand({ RoleName: name }));\n\t\tawait iam.send(\n\t\t\tnew UpdateAssumeRolePolicyCommand({\n\t\t\t\tRoleName: name,\n\t\t\t\tPolicyDocument: trust,\n\t\t\t}),\n\t\t);\n\t\tarn = Role!.Arn!;\n\t} catch (error) {\n\t\tif ((error as { name?: string }).name !== 'NoSuchEntityException') {\n\t\t\tthrow error;\n\t\t}\n\t\tconst { Role } = await iam.send(\n\t\t\tnew CreateRoleCommand({\n\t\t\t\tRoleName: name,\n\t\t\t\tAssumeRolePolicyDocument: trust,\n\t\t\t\tDescription: 'Deploys from GitHub Actions (gkm deploy:github)',\n\t\t\t\t// SST deploys can run long; the default hour is tight.\n\t\t\t\tMaxSessionDuration: 3600 * 2,\n\t\t\t}),\n\t\t);\n\t\tarn = Role!.Arn!;\n\t}\n\n\t// Attaching an attached policy is a no-op, so this converges too.\n\tawait iam.send(\n\t\tnew AttachRolePolicyCommand({ RoleName: name, PolicyArn: policyArn }),\n\t);\n\treturn arn;\n}\n\n/**\n * An IAM client for the stage's account.\n *\n * `fromIni` for a named profile, deliberately: it resolves exactly that\n * profile — keys, assume-role, `credential_process` or SSO, whichever\n * ~/.aws/config says — and never falls back to AWS_* in the environment. The\n * provider chain checks the environment first, so exported staging keys would\n * quietly win over `--profile prod` and the production role would land in the\n * staging account.\n */\nexport async function iamFor(\n\tprofile?: string,\n\tendpoint?: string,\n): Promise<IAMClient> {\n\tconst config: IAMClientConfig = { region: 'us-east-1' };\n\tif (profile) {\n\t\tconst { fromIni } = await import('@aws-sdk/credential-providers');\n\t\tconfig.credentials = fromIni({ profile });\n\t}\n\tif (endpoint) {\n\t\tconfig.endpoint = endpoint;\n\t\tconfig.credentials = { accessKeyId: 'test', secretAccessKey: 'test' };\n\t}\n\treturn new IAMClient(config);\n}\n\nexport async function deployGithubCommand(\n\toptions: DeployGithubOptions,\n\tdeps: { iam?: IAMClient; gh?: Gh; cwd?: string } = {},\n): Promise<{ roleArn?: string; repo: string }> {\n\tconst gh = deps.gh ?? defaultGh;\n\tconst { workspace } = await loadWorkspaceConfig(deps.cwd);\n\tassertDeployedStage(workspace.stages, options.stage);\n\n\tconst repo =\n\t\toptions.repo ??\n\t\tgh(['repo', 'view', '--json', 'nameWithOwner', '-q', '.nameWithOwner']);\n\tconst role = roleName(workspace.name, options.stage);\n\tconst policyArn = options.policyArn ?? DEFAULT_POLICY_ARN;\n\tconst keyPath = getKeyPath(options.stage, workspace.name);\n\tconst hasKey = existsSync(keyPath);\n\n\tlogger.log(`\\n🔐 GitHub → AWS for stage \"${options.stage}\"\\n`);\n\tlogger.log(` Repository: ${repo}`);\n\tlogger.log(` AWS profile: ${options.profile ?? '(default credentials)'}`);\n\tlogger.log(` Role: ${role}`);\n\tlogger.log(\n\t\t` Policy: ${policyArn}${options.policyArn ? '' : ' (default; --policy-arn to narrow)'}`,\n\t);\n\tlogger.log(` Trusted by: repo:${repo}:environment:${options.stage} only`);\n\tlogger.log(\n\t\t` Secrets key: ${hasKey ? keyPath : `none at ${keyPath} — run gkm secrets:init --stage ${options.stage} first`}`,\n\t);\n\n\tif (options.dryRun) {\n\t\tlogger.log('\\n --dry-run: nothing changed.\\n');\n\t\treturn { repo };\n\t}\n\n\tconst iam = deps.iam ?? (await iamFor(options.profile));\n\tconst providerArn = await ensureOidcProvider(iam).catch((error) => {\n\t\t// The first AWS call is where an expired SSO login surfaces; the SDK's\n\t\t// message does not say which profile, and this command knows.\n\t\tif (/SSO session/i.test(String(error?.message)) && options.profile) {\n\t\t\tthrow new SsoSessionExpired(options.profile);\n\t\t}\n\t\tthrow error;\n\t});\n\tconst roleArn = await ensureRole(\n\t\tiam,\n\t\trole,\n\t\ttrustPolicy(providerArn, repo, options.stage),\n\t\tpolicyArn,\n\t);\n\tlogger.log(`\\n ✓ AWS: ${roleArn}`);\n\n\t// The environment the generated deploy workflow runs the stage in.\n\tgh(['api', '--method', 'PUT', `repos/${repo}/environments/${options.stage}`]);\n\tgh([\n\t\t'variable',\n\t\t'set',\n\t\t'AWS_ROLE_ARN',\n\t\t'--env',\n\t\toptions.stage,\n\t\t'--repo',\n\t\trepo,\n\t\t'--body',\n\t\troleArn,\n\t]);\n\tlogger.log(` ✓ GitHub: environment \"${options.stage}\", AWS_ROLE_ARN`);\n\n\tif (hasKey) {\n\t\t// Through stdin, so the key is never an argument a process list shows.\n\t\tgh(\n\t\t\t[\n\t\t\t\t'secret',\n\t\t\t\t'set',\n\t\t\t\t'GKM_SECRETS_KEY',\n\t\t\t\t'--env',\n\t\t\t\toptions.stage,\n\t\t\t\t'--repo',\n\t\t\t\trepo,\n\t\t\t],\n\t\t\treadFileSync(keyPath, 'utf-8').trim(),\n\t\t);\n\t\tlogger.log(' ✓ GitHub: GKM_SECRETS_KEY');\n\t} else {\n\t\tlogger.log(\n\t\t\t` ⚠ No secrets key for \"${options.stage}\"; run gkm secrets:init --stage ${options.stage}, then this again.`,\n\t\t);\n\t}\n\n\tlogger.log(\n\t\t`\\n Protect it: add required reviewers to the \"${options.stage}\" environment in the repository settings.\\n`,\n\t);\n\treturn { roleArn, repo };\n}\n\n/** The profile's SSO login has lapsed; the fix is one command away. */\nexport class SsoSessionExpired extends Error {\n\tconstructor(readonly profile: string) {\n\t\tsuper(\n\t\t\t`The SSO session for profile \"${profile}\" has expired or is invalid. Run: aws sso login --profile ${profile}`,\n\t\t);\n\t\tthis.name = 'SsoSessionExpired';\n\t}\n}\n"],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-Cd-qeOam.d.mts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"mappings":";;;;;;;;;cASa;;;;;;;;;;;;;;;iBAoBG,mBAAmB,YAAY;;;;;iBAoB/B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC4ElB,sBAAsB,cAAc,YACnD,QAAQ,eAAe,SACrB,wBAAwB;;;;iBA8BX,mBACf,QAAQ,iBACR,cACE;;;;;iBA8Ca,yBACf,QAAQ,WACR,cACE;;;;;iBA0Da,cACf,QAAQ,YAAY,iBACpB,cACE;;;;;;;iBA6Ba,wBACf,WAAW;;;;;;;;;;;;iBAkBI,kBACf,WAAW,qBACX;;;;;;;iBAsBe,kBAAkB,WAAW;;iBAa7B,kBAAkB,QAAQ;;;;;iBAiB1B,gBACf,WAAW,qBACX,kBACE;;;;;iBAkCa,iBAAiB,WAAW;;;;;;;;;;iBAmC5B,qBACf,WAAW,qBACX,iBACA,qBACE;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgDa,oBACf;EACK;EAAmB,YAAY;eAEpC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-D-iAVHx-.d.cts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"mappings":";;;;;;;;;cASa;;;;;;;;;;;;;;;iBAoBG,mBAAmB,YAAY;;;;;iBAoB/B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC4ElB,sBAAsB,cAAc,YACnD,QAAQ,eAAe,SACrB,wBAAwB;;;;iBA8BX,mBACf,QAAQ,iBACR,cACE;;;;;iBA8Ca,yBACf,QAAQ,WACR,cACE;;;;;iBA0Da,cACf,QAAQ,YAAY,iBACpB,cACE;;;;;;;iBA6Ba,wBACf,WAAW;;;;;;;;;;;;iBAkBI,kBACf,WAAW,qBACX;;;;;;;iBAsBe,kBAAkB,WAAW;;iBAa7B,kBAAkB,QAAQ;;;;;iBAiB1B,gBACf,WAAW,qBACX,kBACE;;;;;iBAkCa,iBAAiB,WAAW;;;;;;;;;;iBAmC5B,qBACf,WAAW,qBACX,iBACA,qBACE;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgDa,oBACf;EACK;EAAmB,YAAY;eAEpC"}
@@ -1,81 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
3
- import { homedir } from "node:os";
4
- import { basename, join } from "node:path";
5
- import { randomBytes } from "node:crypto";
6
- //#region src/secrets/keystore.ts
7
- /** Key length for AES-256 encryption */
8
- const KEY_LENGTH = 32;
9
- /**
10
- * Get the keystore directory for a project.
11
- * Keys are stored at ~/.gkm/{project-name}/
12
- *
13
- * @param projectName - Name of the project (defaults to current directory name)
14
- * @returns Path to the keystore directory
15
- */
16
- function getKeystoreDir(projectName) {
17
- const name = projectName ?? basename(process.cwd());
18
- return join(homedir(), ".gkm", name);
19
- }
20
- /**
21
- * Get the path to a stage's encryption key.
22
- *
23
- * @param stage - Stage name (e.g., 'development', 'production')
24
- * @param projectName - Name of the project (defaults to current directory name)
25
- * @returns Path to the key file
26
- */
27
- function getKeyPath(stage, projectName) {
28
- return join(getKeystoreDir(projectName), `${stage}.key`);
29
- }
30
- /**
31
- * Generate a new encryption key for a stage.
32
- * The key is stored at ~/.gkm/{project-name}/{stage}.key with restricted permissions.
33
- *
34
- * @param stage - Stage name
35
- * @param projectName - Project name (defaults to current directory name)
36
- * @returns The generated key as a hex string
37
- */
38
- async function generateKey(stage, projectName) {
39
- const keyDir = getKeystoreDir(projectName);
40
- const keyPath = getKeyPath(stage, projectName);
41
- await mkdir(keyDir, {
42
- recursive: true,
43
- mode: 448
44
- });
45
- const key = randomBytes(KEY_LENGTH).toString("hex");
46
- await writeFile(keyPath, key, {
47
- mode: 384,
48
- encoding: "utf-8"
49
- });
50
- await chmod(keyPath, 384);
51
- return key;
52
- }
53
- /**
54
- * Read an encryption key for a stage.
55
- *
56
- * @param stage - Stage name
57
- * @param projectName - Project name (defaults to current directory name)
58
- * @returns The key as a hex string, or null if not found
59
- */
60
- async function readKey(stage, projectName) {
61
- const keyPath = getKeyPath(stage, projectName);
62
- if (!existsSync(keyPath)) return null;
63
- return (await readFile(keyPath, "utf-8")).trim();
64
- }
65
- /**
66
- * Get or create a key for a stage.
67
- * If the key already exists, it is returned. Otherwise, a new key is generated.
68
- *
69
- * @param stage - Stage name
70
- * @param projectName - Project name (defaults to current directory name)
71
- * @returns The key as a hex string
72
- */
73
- async function getOrCreateKey(stage, projectName) {
74
- const existingKey = await readKey(stage, projectName);
75
- if (existingKey) return existingKey;
76
- return generateKey(stage, projectName);
77
- }
78
- //#endregion
79
- export { getOrCreateKey as n, readKey as r, getKeyPath as t };
80
-
81
- //# sourceMappingURL=keystore-B4PRlbgE.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keystore-B4PRlbgE.mjs","names":[],"sources":["../src/secrets/keystore.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\nimport { existsSync } from 'node:fs';\nimport { chmod, mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { basename, join } from 'node:path';\n\n/** Key length for AES-256 encryption */\nconst KEY_LENGTH = 32; // 256 bits\n\n/**\n * Get the keystore directory for a project.\n * Keys are stored at ~/.gkm/{project-name}/\n *\n * @param projectName - Name of the project (defaults to current directory name)\n * @returns Path to the keystore directory\n */\nexport function getKeystoreDir(projectName?: string): string {\n\tconst name = projectName ?? basename(process.cwd());\n\treturn join(homedir(), '.gkm', name);\n}\n\n/**\n * Get the path to a stage's encryption key.\n *\n * @param stage - Stage name (e.g., 'development', 'production')\n * @param projectName - Name of the project (defaults to current directory name)\n * @returns Path to the key file\n */\nexport function getKeyPath(stage: string, projectName?: string): string {\n\treturn join(getKeystoreDir(projectName), `${stage}.key`);\n}\n\n/**\n * Check if a key exists for a stage.\n */\nexport function keyExists(stage: string, projectName?: string): boolean {\n\treturn existsSync(getKeyPath(stage, projectName));\n}\n\n/**\n * Generate a new encryption key for a stage.\n * The key is stored at ~/.gkm/{project-name}/{stage}.key with restricted permissions.\n *\n * @param stage - Stage name\n * @param projectName - Project name (defaults to current directory name)\n * @returns The generated key as a hex string\n */\nexport async function generateKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string> {\n\tconst keyDir = getKeystoreDir(projectName);\n\tconst keyPath = getKeyPath(stage, projectName);\n\n\t// Ensure keystore directory exists with restricted permissions\n\tawait mkdir(keyDir, { recursive: true, mode: 0o700 });\n\n\t// Generate random key\n\tconst key = randomBytes(KEY_LENGTH).toString('hex');\n\n\t// Write key with restricted permissions (owner read/write only)\n\tawait writeFile(keyPath, key, { mode: 0o600, encoding: 'utf-8' });\n\n\t// Ensure permissions are set correctly (in case file existed)\n\tawait chmod(keyPath, 0o600);\n\n\treturn key;\n}\n\n/**\n * Read an encryption key for a stage.\n *\n * @param stage - Stage name\n * @param projectName - Project name (defaults to current directory name)\n * @returns The key as a hex string, or null if not found\n */\nexport async function readKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string | null> {\n\tconst keyPath = getKeyPath(stage, projectName);\n\n\tif (!existsSync(keyPath)) {\n\t\treturn null;\n\t}\n\n\tconst key = await readFile(keyPath, 'utf-8');\n\treturn key.trim();\n}\n\n/**\n * Read an encryption key for a stage, throwing if not found.\n */\nexport async function requireKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string> {\n\tconst key = await readKey(stage, projectName);\n\n\tif (!key) {\n\t\tconst name = projectName ?? basename(process.cwd());\n\t\tthrow new Error(\n\t\t\t`Encryption key not found for stage \"${stage}\" in project \"${name}\". ` +\n\t\t\t\t`Expected key at: ${getKeyPath(stage, projectName)}`,\n\t\t);\n\t}\n\n\treturn key;\n}\n\n/**\n * Delete a key for a stage.\n */\nexport async function deleteKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<void> {\n\tconst keyPath = getKeyPath(stage, projectName);\n\n\tif (existsSync(keyPath)) {\n\t\tawait rm(keyPath);\n\t}\n}\n\n/**\n * Get or create a key for a stage.\n * If the key already exists, it is returned. Otherwise, a new key is generated.\n *\n * @param stage - Stage name\n * @param projectName - Project name (defaults to current directory name)\n * @returns The key as a hex string\n */\nexport async function getOrCreateKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string> {\n\tconst existingKey = await readKey(stage, projectName);\n\n\tif (existingKey) {\n\t\treturn existingKey;\n\t}\n\n\treturn generateKey(stage, projectName);\n}\n"],"mappings":";;;;;;;AAOA,MAAM,aAAa;;;;;;;;AASnB,SAAgB,eAAe,aAA8B;CAC5D,MAAM,OAAO,eAAe,SAAS,QAAQ,IAAI,CAAC;CAClD,OAAO,KAAK,QAAQ,GAAG,QAAQ,IAAI;AACpC;;;;;;;;AASA,SAAgB,WAAW,OAAe,aAA8B;CACvE,OAAO,KAAK,eAAe,WAAW,GAAG,GAAG,MAAM,KAAK;AACxD;;;;;;;;;AAiBA,eAAsB,YACrB,OACA,aACkB;CAClB,MAAM,SAAS,eAAe,WAAW;CACzC,MAAM,UAAU,WAAW,OAAO,WAAW;CAG7C,MAAM,MAAM,QAAQ;EAAE,WAAW;EAAM,MAAM;CAAM,CAAC;CAGpD,MAAM,MAAM,YAAY,UAAU,CAAC,CAAC,SAAS,KAAK;CAGlD,MAAM,UAAU,SAAS,KAAK;EAAE,MAAM;EAAO,UAAU;CAAQ,CAAC;CAGhE,MAAM,MAAM,SAAS,GAAK;CAE1B,OAAO;AACR;;;;;;;;AASA,eAAsB,QACrB,OACA,aACyB;CACzB,MAAM,UAAU,WAAW,OAAO,WAAW;CAE7C,IAAI,CAAC,WAAW,OAAO,GACtB,OAAO;CAIR,QAAO,MADW,SAAS,SAAS,OAAO,EAAA,CAChC,KAAK;AACjB;;;;;;;;;AA4CA,eAAsB,eACrB,OACA,aACkB;CAClB,MAAM,cAAc,MAAM,QAAQ,OAAO,WAAW;CAEpD,IAAI,aACH,OAAO;CAGR,OAAO,YAAY,OAAO,WAAW;AACtC"}
@@ -1,98 +0,0 @@
1
- let node_fs = require("node:fs");
2
- let node_fs_promises = require("node:fs/promises");
3
- let node_os = require("node:os");
4
- let node_path = require("node:path");
5
- let node_crypto = require("node:crypto");
6
- //#region src/secrets/keystore.ts
7
- /** Key length for AES-256 encryption */
8
- const KEY_LENGTH = 32;
9
- /**
10
- * Get the keystore directory for a project.
11
- * Keys are stored at ~/.gkm/{project-name}/
12
- *
13
- * @param projectName - Name of the project (defaults to current directory name)
14
- * @returns Path to the keystore directory
15
- */
16
- function getKeystoreDir(projectName) {
17
- const name = projectName ?? (0, node_path.basename)(process.cwd());
18
- return (0, node_path.join)((0, node_os.homedir)(), ".gkm", name);
19
- }
20
- /**
21
- * Get the path to a stage's encryption key.
22
- *
23
- * @param stage - Stage name (e.g., 'development', 'production')
24
- * @param projectName - Name of the project (defaults to current directory name)
25
- * @returns Path to the key file
26
- */
27
- function getKeyPath(stage, projectName) {
28
- return (0, node_path.join)(getKeystoreDir(projectName), `${stage}.key`);
29
- }
30
- /**
31
- * Generate a new encryption key for a stage.
32
- * The key is stored at ~/.gkm/{project-name}/{stage}.key with restricted permissions.
33
- *
34
- * @param stage - Stage name
35
- * @param projectName - Project name (defaults to current directory name)
36
- * @returns The generated key as a hex string
37
- */
38
- async function generateKey(stage, projectName) {
39
- const keyDir = getKeystoreDir(projectName);
40
- const keyPath = getKeyPath(stage, projectName);
41
- await (0, node_fs_promises.mkdir)(keyDir, {
42
- recursive: true,
43
- mode: 448
44
- });
45
- const key = (0, node_crypto.randomBytes)(KEY_LENGTH).toString("hex");
46
- await (0, node_fs_promises.writeFile)(keyPath, key, {
47
- mode: 384,
48
- encoding: "utf-8"
49
- });
50
- await (0, node_fs_promises.chmod)(keyPath, 384);
51
- return key;
52
- }
53
- /**
54
- * Read an encryption key for a stage.
55
- *
56
- * @param stage - Stage name
57
- * @param projectName - Project name (defaults to current directory name)
58
- * @returns The key as a hex string, or null if not found
59
- */
60
- async function readKey(stage, projectName) {
61
- const keyPath = getKeyPath(stage, projectName);
62
- if (!(0, node_fs.existsSync)(keyPath)) return null;
63
- return (await (0, node_fs_promises.readFile)(keyPath, "utf-8")).trim();
64
- }
65
- /**
66
- * Get or create a key for a stage.
67
- * If the key already exists, it is returned. Otherwise, a new key is generated.
68
- *
69
- * @param stage - Stage name
70
- * @param projectName - Project name (defaults to current directory name)
71
- * @returns The key as a hex string
72
- */
73
- async function getOrCreateKey(stage, projectName) {
74
- const existingKey = await readKey(stage, projectName);
75
- if (existingKey) return existingKey;
76
- return generateKey(stage, projectName);
77
- }
78
- //#endregion
79
- Object.defineProperty(exports, "getKeyPath", {
80
- enumerable: true,
81
- get: function() {
82
- return getKeyPath;
83
- }
84
- });
85
- Object.defineProperty(exports, "getOrCreateKey", {
86
- enumerable: true,
87
- get: function() {
88
- return getOrCreateKey;
89
- }
90
- });
91
- Object.defineProperty(exports, "readKey", {
92
- enumerable: true,
93
- get: function() {
94
- return readKey;
95
- }
96
- });
97
-
98
- //# sourceMappingURL=keystore-DgGRj2Yy.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keystore-DgGRj2Yy.cjs","names":["basename","join","homedir","mkdir","randomBytes","writeFile","chmod","existsSync","readFile"],"sources":["../src/secrets/keystore.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\nimport { existsSync } from 'node:fs';\nimport { chmod, mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { homedir } from 'node:os';\nimport { basename, join } from 'node:path';\n\n/** Key length for AES-256 encryption */\nconst KEY_LENGTH = 32; // 256 bits\n\n/**\n * Get the keystore directory for a project.\n * Keys are stored at ~/.gkm/{project-name}/\n *\n * @param projectName - Name of the project (defaults to current directory name)\n * @returns Path to the keystore directory\n */\nexport function getKeystoreDir(projectName?: string): string {\n\tconst name = projectName ?? basename(process.cwd());\n\treturn join(homedir(), '.gkm', name);\n}\n\n/**\n * Get the path to a stage's encryption key.\n *\n * @param stage - Stage name (e.g., 'development', 'production')\n * @param projectName - Name of the project (defaults to current directory name)\n * @returns Path to the key file\n */\nexport function getKeyPath(stage: string, projectName?: string): string {\n\treturn join(getKeystoreDir(projectName), `${stage}.key`);\n}\n\n/**\n * Check if a key exists for a stage.\n */\nexport function keyExists(stage: string, projectName?: string): boolean {\n\treturn existsSync(getKeyPath(stage, projectName));\n}\n\n/**\n * Generate a new encryption key for a stage.\n * The key is stored at ~/.gkm/{project-name}/{stage}.key with restricted permissions.\n *\n * @param stage - Stage name\n * @param projectName - Project name (defaults to current directory name)\n * @returns The generated key as a hex string\n */\nexport async function generateKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string> {\n\tconst keyDir = getKeystoreDir(projectName);\n\tconst keyPath = getKeyPath(stage, projectName);\n\n\t// Ensure keystore directory exists with restricted permissions\n\tawait mkdir(keyDir, { recursive: true, mode: 0o700 });\n\n\t// Generate random key\n\tconst key = randomBytes(KEY_LENGTH).toString('hex');\n\n\t// Write key with restricted permissions (owner read/write only)\n\tawait writeFile(keyPath, key, { mode: 0o600, encoding: 'utf-8' });\n\n\t// Ensure permissions are set correctly (in case file existed)\n\tawait chmod(keyPath, 0o600);\n\n\treturn key;\n}\n\n/**\n * Read an encryption key for a stage.\n *\n * @param stage - Stage name\n * @param projectName - Project name (defaults to current directory name)\n * @returns The key as a hex string, or null if not found\n */\nexport async function readKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string | null> {\n\tconst keyPath = getKeyPath(stage, projectName);\n\n\tif (!existsSync(keyPath)) {\n\t\treturn null;\n\t}\n\n\tconst key = await readFile(keyPath, 'utf-8');\n\treturn key.trim();\n}\n\n/**\n * Read an encryption key for a stage, throwing if not found.\n */\nexport async function requireKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string> {\n\tconst key = await readKey(stage, projectName);\n\n\tif (!key) {\n\t\tconst name = projectName ?? basename(process.cwd());\n\t\tthrow new Error(\n\t\t\t`Encryption key not found for stage \"${stage}\" in project \"${name}\". ` +\n\t\t\t\t`Expected key at: ${getKeyPath(stage, projectName)}`,\n\t\t);\n\t}\n\n\treturn key;\n}\n\n/**\n * Delete a key for a stage.\n */\nexport async function deleteKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<void> {\n\tconst keyPath = getKeyPath(stage, projectName);\n\n\tif (existsSync(keyPath)) {\n\t\tawait rm(keyPath);\n\t}\n}\n\n/**\n * Get or create a key for a stage.\n * If the key already exists, it is returned. Otherwise, a new key is generated.\n *\n * @param stage - Stage name\n * @param projectName - Project name (defaults to current directory name)\n * @returns The key as a hex string\n */\nexport async function getOrCreateKey(\n\tstage: string,\n\tprojectName?: string,\n): Promise<string> {\n\tconst existingKey = await readKey(stage, projectName);\n\n\tif (existingKey) {\n\t\treturn existingKey;\n\t}\n\n\treturn generateKey(stage, projectName);\n}\n"],"mappings":";;;;;;;AAOA,MAAM,aAAa;;;;;;;;AASnB,SAAgB,eAAe,aAA8B;CAC5D,MAAM,OAAO,gBAAA,GAAeA,UAAAA,SAAAA,CAAS,QAAQ,IAAI,CAAC;CAClD,QAAA,GAAOC,UAAAA,KAAAA,EAAAA,GAAKC,QAAAA,QAAAA,CAAQ,GAAG,QAAQ,IAAI;AACpC;;;;;;;;AASA,SAAgB,WAAW,OAAe,aAA8B;CACvE,QAAA,GAAOD,UAAAA,KAAAA,CAAK,eAAe,WAAW,GAAG,GAAG,MAAM,KAAK;AACxD;;;;;;;;;AAiBA,eAAsB,YACrB,OACA,aACkB;CAClB,MAAM,SAAS,eAAe,WAAW;CACzC,MAAM,UAAU,WAAW,OAAO,WAAW;CAG7C,OAAA,GAAME,iBAAAA,MAAAA,CAAM,QAAQ;EAAE,WAAW;EAAM,MAAM;CAAM,CAAC;CAGpD,MAAM,OAAA,GAAMC,YAAAA,YAAAA,CAAY,UAAU,CAAC,CAAC,SAAS,KAAK;CAGlD,OAAA,GAAMC,iBAAAA,UAAAA,CAAU,SAAS,KAAK;EAAE,MAAM;EAAO,UAAU;CAAQ,CAAC;CAGhE,OAAA,GAAMC,iBAAAA,MAAAA,CAAM,SAAS,GAAK;CAE1B,OAAO;AACR;;;;;;;;AASA,eAAsB,QACrB,OACA,aACyB;CACzB,MAAM,UAAU,WAAW,OAAO,WAAW;CAE7C,IAAI,EAAA,GAACC,QAAAA,WAAAA,CAAW,OAAO,GACtB,OAAO;CAIR,QAAO,OAAA,GADWC,iBAAAA,SAAAA,CAAS,SAAS,OAAO,EAAA,CAChC,KAAK;AACjB;;;;;;;;;AA4CA,eAAsB,eACrB,OACA,aACkB;CAClB,MAAM,cAAc,MAAM,QAAQ,OAAO,WAAW;CAEpD,IAAI,aACH,OAAO;CAGR,OAAO,YAAY,OAAO,WAAW;AACtC"}