@geekmidas/cli 10.0.0-alpha.170 → 10.0.0-alpha.172

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 (220) hide show
  1. package/dist/{GoDaddyProvider-DK9_Jw9d.cjs → GoDaddyProvider-BLCCgWNA.cjs} +2 -2
  2. package/dist/{GoDaddyProvider-DK9_Jw9d.cjs.map → GoDaddyProvider-BLCCgWNA.cjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-Cf4MIuaD.mjs → GoDaddyProvider-CIhg_ymt.mjs} +2 -2
  4. package/dist/{GoDaddyProvider-Cf4MIuaD.mjs.map → GoDaddyProvider-CIhg_ymt.mjs.map} +1 -1
  5. package/dist/{HostingerProvider-CQebZrz3.mjs → HostingerProvider-BOFzH5JM.mjs} +2 -2
  6. package/dist/{HostingerProvider-CQebZrz3.mjs.map → HostingerProvider-BOFzH5JM.mjs.map} +1 -1
  7. package/dist/{HostingerProvider-qQzo4MYp.cjs → HostingerProvider-BUBeLZFT.cjs} +2 -2
  8. package/dist/{HostingerProvider-qQzo4MYp.cjs.map → HostingerProvider-BUBeLZFT.cjs.map} +1 -1
  9. package/dist/{LegacyStateStore-BeMRGXRi.cjs → LegacyStateStore-CLuyua0d.cjs} +2 -2
  10. package/dist/{LegacyStateStore-BeMRGXRi.cjs.map → LegacyStateStore-CLuyua0d.cjs.map} +1 -1
  11. package/dist/{LegacyStateStore-DXPHKdMk.mjs → LegacyStateStore-CrkjCaSU.mjs} +2 -2
  12. package/dist/{LegacyStateStore-DXPHKdMk.mjs.map → LegacyStateStore-CrkjCaSU.mjs.map} +1 -1
  13. package/dist/{LocalStateStore-E_sa5GR2.cjs → LocalStateStore-Bu1mGMUv.cjs} +2 -2
  14. package/dist/{LocalStateStore-E_sa5GR2.cjs.map → LocalStateStore-Bu1mGMUv.cjs.map} +1 -1
  15. package/dist/{LocalStateStore-BYQ9lPje.mjs → LocalStateStore-DV4jBo8p.mjs} +2 -2
  16. package/dist/{LocalStateStore-BYQ9lPje.mjs.map → LocalStateStore-DV4jBo8p.mjs.map} +1 -1
  17. package/dist/{S3StateStore-BQaGVNRf.mjs → S3StateStore-B4FDrGY1.mjs} +4 -4
  18. package/dist/{S3StateStore-BQaGVNRf.mjs.map → S3StateStore-B4FDrGY1.mjs.map} +1 -1
  19. package/dist/{S3StateStore-Cjr4Rtsf.cjs → S3StateStore-kbkBod12.cjs} +4 -4
  20. package/dist/{S3StateStore-Cjr4Rtsf.cjs.map → S3StateStore-kbkBod12.cjs.map} +1 -1
  21. package/dist/{SSMStateStore-Bq_S7x5_.mjs → SSMStateStore-5MSu94ua.mjs} +2 -2
  22. package/dist/{SSMStateStore-Bq_S7x5_.mjs.map → SSMStateStore-5MSu94ua.mjs.map} +1 -1
  23. package/dist/{SSMStateStore-Cnfwdlme.cjs → SSMStateStore-DbsAcN97.cjs} +2 -2
  24. package/dist/{SSMStateStore-Cnfwdlme.cjs.map → SSMStateStore-DbsAcN97.cjs.map} +1 -1
  25. package/dist/{add-3_IHpF5F.cjs → add-CB1o52l-.cjs} +5 -5
  26. package/dist/{add-3_IHpF5F.cjs.map → add-CB1o52l-.cjs.map} +1 -1
  27. package/dist/{add-CNQFnG0C.mjs → add-CLEIQtcF.mjs} +5 -5
  28. package/dist/{add-CNQFnG0C.mjs.map → add-CLEIQtcF.mjs.map} +1 -1
  29. package/dist/{apps-DGod3aS9.mjs → apps-B4qOLFEC.mjs} +16 -795
  30. package/dist/apps-B4qOLFEC.mjs.map +1 -0
  31. package/dist/{apps-BGu47YRF.cjs → apps-CTyacCpW.cjs} +28 -897
  32. package/dist/apps-CTyacCpW.cjs.map +1 -0
  33. package/dist/{bundler-DWGxNGSB.cjs → bundler-Bma2_DTI.cjs} +6 -6
  34. package/dist/{bundler-DWGxNGSB.cjs.map → bundler-Bma2_DTI.cjs.map} +1 -1
  35. package/dist/{bundler-Dm0mB7EK.mjs → bundler-CSSYSsl8.mjs} +6 -6
  36. package/dist/{bundler-Dm0mB7EK.mjs.map → bundler-CSSYSsl8.mjs.map} +1 -1
  37. package/dist/{cli-Qm-8tG46.mjs → cli-BFEuBKiU.mjs} +4 -4
  38. package/dist/{cli-Qm-8tG46.mjs.map → cli-BFEuBKiU.mjs.map} +1 -1
  39. package/dist/{cli-CYeZF85I.cjs → cli-DXGl3fsc.cjs} +4 -4
  40. package/dist/{cli-CYeZF85I.cjs.map → cli-DXGl3fsc.cjs.map} +1 -1
  41. package/dist/{compose-IsvqY6iX.cjs → compose-BNWFrHHE.cjs} +64 -11
  42. package/dist/compose-BNWFrHHE.cjs.map +1 -0
  43. package/dist/{compose-CXgwCuqv.mjs → compose-CANkT9bL.mjs} +923 -25
  44. package/dist/compose-CANkT9bL.mjs.map +1 -0
  45. package/dist/{compose-CshnO-Th.cjs → compose-DpDrZwZS.cjs} +1063 -27
  46. package/dist/compose-DpDrZwZS.cjs.map +1 -0
  47. package/dist/{compose-BVeevJO_.mjs → compose-SSYHdZMN.mjs} +63 -10
  48. package/dist/compose-SSYHdZMN.mjs.map +1 -0
  49. package/dist/{config-u5XdE1Cq.d.cts → config-CsCYzlVO.d.mts} +3 -3
  50. package/dist/{config-B8gSu59v.d.mts.map → config-CsCYzlVO.d.mts.map} +1 -1
  51. package/dist/{config-B8gSu59v.d.mts → config-D-gHQXhi.d.cts} +3 -3
  52. package/dist/{config-u5XdE1Cq.d.cts.map → config-D-gHQXhi.d.cts.map} +1 -1
  53. package/dist/config.cjs +1 -1
  54. package/dist/config.d.cts +3 -3
  55. package/dist/config.d.mts +3 -3
  56. package/dist/config.mjs +1 -1
  57. package/dist/{credentials-DzR2j8h1.cjs → credentials-BAeWfaj3.cjs} +6 -6
  58. package/dist/{credentials-DzR2j8h1.cjs.map → credentials-BAeWfaj3.cjs.map} +1 -1
  59. package/dist/{credentials-CKIeLL7T.mjs → credentials-DmNpxlFO.mjs} +6 -6
  60. package/dist/{credentials-CKIeLL7T.mjs.map → credentials-DmNpxlFO.mjs.map} +1 -1
  61. package/dist/deploy/public.cjs +11 -11
  62. package/dist/deploy/public.d.cts +4 -4
  63. package/dist/deploy/public.d.mts +4 -4
  64. package/dist/deploy/public.mjs +11 -11
  65. package/dist/{deploy-DQjEjUfB.cjs → deploy-DHrbzHxT.cjs} +25 -27
  66. package/dist/deploy-DHrbzHxT.cjs.map +1 -0
  67. package/dist/{deploy-CjubyZlP.mjs → deploy-Qa7wXYS4.mjs} +24 -26
  68. package/dist/deploy-Qa7wXYS4.mjs.map +1 -0
  69. package/dist/{destroy-D1375m8C.cjs → destroy-CJ6wwQRQ.cjs} +9 -9
  70. package/dist/{destroy-D1375m8C.cjs.map → destroy-CJ6wwQRQ.cjs.map} +1 -1
  71. package/dist/{destroy-D4m5aO9k.mjs → destroy-CKuYg9JQ.mjs} +9 -9
  72. package/dist/{destroy-D4m5aO9k.mjs.map → destroy-CKuYg9JQ.mjs.map} +1 -1
  73. package/dist/{docker-CSEAKwFr.cjs → docker-C9ObsT80.cjs} +9 -9
  74. package/dist/{docker-CSEAKwFr.cjs.map → docker-C9ObsT80.cjs.map} +1 -1
  75. package/dist/{docker-C27YUUMQ.mjs → docker-CrNWM0jN.mjs} +5 -5
  76. package/dist/{docker-C27YUUMQ.mjs.map → docker-CrNWM0jN.mjs.map} +1 -1
  77. package/dist/{dokploy-DJDdiFz6.cjs → dokploy-C6KfcyOG.cjs} +2 -2
  78. package/dist/{dokploy-DJDdiFz6.cjs.map → dokploy-C6KfcyOG.cjs.map} +1 -1
  79. package/dist/{dokploy-CSqDsvY-.mjs → dokploy-DITW2LHL.mjs} +2 -2
  80. package/dist/{dokploy-CSqDsvY-.mjs.map → dokploy-DITW2LHL.mjs.map} +1 -1
  81. package/dist/{eas-DryGYjFk.cjs → eas-BBwlSGd8.cjs} +3 -3
  82. package/dist/{eas-DryGYjFk.cjs.map → eas-BBwlSGd8.cjs.map} +1 -1
  83. package/dist/{eas-DC3F8cy0.mjs → eas-BE7tu9eH.mjs} +3 -3
  84. package/dist/{eas-DC3F8cy0.mjs.map → eas-BE7tu9eH.mjs.map} +1 -1
  85. package/dist/{encryption-C8Y8Ly6n.mjs → encryption-Bn_pIrIe.mjs} +3 -3
  86. package/dist/{encryption-C8Y8Ly6n.mjs.map → encryption-Bn_pIrIe.mjs.map} +1 -1
  87. package/dist/{encryption-8qZGm15p.cjs → encryption-D0jmwRdU.cjs} +3 -3
  88. package/dist/{encryption-8qZGm15p.cjs.map → encryption-D0jmwRdU.cjs.map} +1 -1
  89. package/dist/{engine-DI7JAyiD.cjs → engine-BDqBychY.cjs} +19 -19
  90. package/dist/{engine-DI7JAyiD.cjs.map → engine-BDqBychY.cjs.map} +1 -1
  91. package/dist/{engine-C9E0MeLm.mjs → engine-Dv4SfML2.mjs} +9 -9
  92. package/dist/{engine-C9E0MeLm.mjs.map → engine-Dv4SfML2.mjs.map} +1 -1
  93. package/dist/{github-DdaV-Gll.mjs → github-7vONG88-.mjs} +7 -7
  94. package/dist/{github-DdaV-Gll.mjs.map → github-7vONG88-.mjs.map} +1 -1
  95. package/dist/{github-g3nRZlli.cjs → github-orgDU5Ta.cjs} +7 -7
  96. package/dist/{github-g3nRZlli.cjs.map → github-orgDU5Ta.cjs.map} +1 -1
  97. package/dist/{googlePlay-BmeR1kY4.mjs → googlePlay-DOPEv_Uu.mjs} +4 -4
  98. package/dist/{googlePlay-BmeR1kY4.mjs.map → googlePlay-DOPEv_Uu.mjs.map} +1 -1
  99. package/dist/{googlePlay-BHJ_iThq.cjs → googlePlay-DWiYD2Up.cjs} +4 -4
  100. package/dist/{googlePlay-BHJ_iThq.cjs.map → googlePlay-DWiYD2Up.cjs.map} +1 -1
  101. package/dist/{iam-ra1_Y405.mjs → iam-BE0qX5Lb.mjs} +2 -2
  102. package/dist/{iam-ra1_Y405.mjs.map → iam-BE0qX5Lb.mjs.map} +1 -1
  103. package/dist/{iam-BoYPPNdM.cjs → iam-FA95ku7l.cjs} +2 -2
  104. package/dist/{iam-BoYPPNdM.cjs.map → iam-FA95ku7l.cjs.map} +1 -1
  105. package/dist/{index-DFZ0SMwN.d.mts → index-QxGYzGEN.d.mts} +2 -2
  106. package/dist/{index-1H93w_H6.d.cts.map → index-QxGYzGEN.d.mts.map} +1 -1
  107. package/dist/{index-1H93w_H6.d.cts → index-tFzoro1V.d.cts} +2 -2
  108. package/dist/{index-DFZ0SMwN.d.mts.map → index-tFzoro1V.d.cts.map} +1 -1
  109. package/dist/index.cjs +72 -72
  110. package/dist/index.cjs.map +1 -1
  111. package/dist/index.mjs +63 -63
  112. package/dist/index.mjs.map +1 -1
  113. package/dist/{local-DTidpa-a.cjs → local-Dx_1DLrj.cjs} +2 -2
  114. package/dist/{local-DTidpa-a.cjs.map → local-Dx_1DLrj.cjs.map} +1 -1
  115. package/dist/{local-Bkv-e8uM.mjs → local-s-ReaV9D.mjs} +2 -2
  116. package/dist/{local-Bkv-e8uM.mjs.map → local-s-ReaV9D.mjs.map} +1 -1
  117. package/dist/{migrate-BZRsJwni.mjs → migrate-83OqvIDr.mjs} +3 -3
  118. package/dist/{migrate-BZRsJwni.mjs.map → migrate-83OqvIDr.mjs.map} +1 -1
  119. package/dist/{migrate-CXLhrHwu.cjs → migrate-BCnC1nUd.cjs} +5 -5
  120. package/dist/{migrate-CXLhrHwu.cjs.map → migrate-BCnC1nUd.cjs.map} +1 -1
  121. package/dist/{migrate-DU4MtKxz.cjs → migrate-BwKps39u.cjs} +3 -3
  122. package/dist/{migrate-DU4MtKxz.cjs.map → migrate-BwKps39u.cjs.map} +1 -1
  123. package/dist/{migrate-DNOI23QA.mjs → migrate-rZPQE2lm.mjs} +5 -5
  124. package/dist/{migrate-DNOI23QA.mjs.map → migrate-rZPQE2lm.mjs.map} +1 -1
  125. package/dist/{notes-1TM_Vzi7.mjs → notes-BvER-Te2.mjs} +4 -3
  126. package/dist/notes-BvER-Te2.mjs.map +1 -0
  127. package/dist/{notes-BpaXOAkA.cjs → notes-Chp3yhjU.cjs} +4 -3
  128. package/dist/{notes-1TM_Vzi7.mjs.map → notes-Chp3yhjU.cjs.map} +1 -1
  129. package/dist/openapi.cjs +1 -1
  130. package/dist/openapi.d.cts +1 -1
  131. package/dist/openapi.d.mts +1 -1
  132. package/dist/openapi.mjs +1 -1
  133. package/dist/{projectBucket-DbEWuLGX.cjs → projectBucket-BcbirdBj.cjs} +2 -2
  134. package/dist/{projectBucket-DbEWuLGX.cjs.map → projectBucket-BcbirdBj.cjs.map} +1 -1
  135. package/dist/{projectBucket-BRgsSv2P.mjs → projectBucket-BfE46Zj9.mjs} +2 -2
  136. package/dist/{projectBucket-BRgsSv2P.mjs.map → projectBucket-BfE46Zj9.mjs.map} +1 -1
  137. package/dist/{publish-DjFgxu2v.mjs → publish-Cm7fGhl3.mjs} +2 -2
  138. package/dist/{publish-DjFgxu2v.mjs.map → publish-Cm7fGhl3.mjs.map} +1 -1
  139. package/dist/{publish-BN1l3tPF.cjs → publish-N7RjKFiU.cjs} +2 -2
  140. package/dist/{publish-BN1l3tPF.cjs.map → publish-N7RjKFiU.cjs.map} +1 -1
  141. package/dist/reconcile/public.d.cts +1 -1
  142. package/dist/reconcile/public.d.mts +1 -1
  143. package/dist/{resolve-NEKsqNAw.mjs → resolve-BP-wvD7F.mjs} +4 -4
  144. package/dist/{resolve-NEKsqNAw.mjs.map → resolve-BP-wvD7F.mjs.map} +1 -1
  145. package/dist/{resolve-BHVyg4Hg.cjs → resolve-Bjz8vr36.cjs} +4 -4
  146. package/dist/{resolve-BHVyg4Hg.cjs.map → resolve-Bjz8vr36.cjs.map} +1 -1
  147. package/dist/{rollback-CUjvOIDE.cjs → rollback-C0QxGS7N.cjs} +6 -6
  148. package/dist/{rollback-CUjvOIDE.cjs.map → rollback-C0QxGS7N.cjs.map} +1 -1
  149. package/dist/{rollback-BVgyLE7B.mjs → rollback-OWocmLZ3.mjs} +6 -6
  150. package/dist/{rollback-BVgyLE7B.mjs.map → rollback-OWocmLZ3.mjs.map} +1 -1
  151. package/dist/{runtime-CKOkIrw0.d.cts → runtime-BpGIXfYr.d.mts} +2 -2
  152. package/dist/{runtime-CKOkIrw0.d.cts.map → runtime-BpGIXfYr.d.mts.map} +1 -1
  153. package/dist/{runtime-Cdvv8SfU.d.mts → runtime-DLV0CNZ4.d.cts} +2 -2
  154. package/dist/{runtime-Cdvv8SfU.d.mts.map → runtime-DLV0CNZ4.d.cts.map} +1 -1
  155. package/dist/{s3-BO4yr61G.mjs → s3-BrXDNOOi.mjs} +3 -3
  156. package/dist/{s3-BO4yr61G.mjs.map → s3-BrXDNOOi.mjs.map} +1 -1
  157. package/dist/{s3-DnPbDfQN.cjs → s3-CQHYU8Iy.cjs} +3 -3
  158. package/dist/{s3-DnPbDfQN.cjs.map → s3-CQHYU8Iy.cjs.map} +1 -1
  159. package/dist/{serverSetup-BxnCM11A.mjs → serverSetup-DAXGkiFf.mjs} +6 -6
  160. package/dist/{serverSetup-BxnCM11A.mjs.map → serverSetup-DAXGkiFf.mjs.map} +1 -1
  161. package/dist/{serverSetup-DScJ7tQs.cjs → serverSetup-DcyafYuO.cjs} +6 -6
  162. package/dist/{serverSetup-DScJ7tQs.cjs.map → serverSetup-DcyafYuO.cjs.map} +1 -1
  163. package/dist/{sniffer-9smKtb86.mjs → sniffer-D6dwbd7L.mjs} +7 -7
  164. package/dist/{sniffer-9smKtb86.mjs.map → sniffer-D6dwbd7L.mjs.map} +1 -1
  165. package/dist/{sniffer-DHcxlSJF.cjs → sniffer-DpiPHtcR.cjs} +7 -7
  166. package/dist/{sniffer-DHcxlSJF.cjs.map → sniffer-DpiPHtcR.cjs.map} +1 -1
  167. package/dist/{snsSubscriptions-CygsiXhb.mjs → snsSubscriptions-BVaZU0qQ.mjs} +4 -4
  168. package/dist/{snsSubscriptions-CygsiXhb.mjs.map → snsSubscriptions-BVaZU0qQ.mjs.map} +1 -1
  169. package/dist/{snsSubscriptions-B8TYeAM-.cjs → snsSubscriptions-CXpZqb-Y.cjs} +4 -4
  170. package/dist/{snsSubscriptions-B8TYeAM-.cjs.map → snsSubscriptions-CXpZqb-Y.cjs.map} +1 -1
  171. package/dist/{sst-DiHVSku5.cjs → sst-C0VMb3o0.cjs} +5 -5
  172. package/dist/{sst-DiHVSku5.cjs.map → sst-C0VMb3o0.cjs.map} +1 -1
  173. package/dist/{sst-Bgb3WWEl.mjs → sst-CglMlWMQ.mjs} +5 -5
  174. package/dist/{sst-Bgb3WWEl.mjs.map → sst-CglMlWMQ.mjs.map} +1 -1
  175. package/dist/{stack-A3evQgbk.cjs → stack-DKloCsy6.cjs} +80 -24
  176. package/dist/stack-DKloCsy6.cjs.map +1 -0
  177. package/dist/{stack-Cy2FwO3Z.mjs → stack-DXHdVCsD.mjs} +62 -12
  178. package/dist/stack-DXHdVCsD.mjs.map +1 -0
  179. package/dist/{stage-Dgy08WVL.mjs → stage-BOOoPl_k.mjs} +6 -6
  180. package/dist/{stage-Dgy08WVL.mjs.map → stage-BOOoPl_k.mjs.map} +1 -1
  181. package/dist/{stage-Bm1x9Anp.cjs → stage-CcsCwU8-.cjs} +6 -6
  182. package/dist/{stage-Bm1x9Anp.cjs.map → stage-CcsCwU8-.cjs.map} +1 -1
  183. package/dist/{stages-COiipV8N.mjs → stages-CCAAe1tP.mjs} +2 -2
  184. package/dist/{stages-COiipV8N.mjs.map → stages-CCAAe1tP.mjs.map} +1 -1
  185. package/dist/{stages-BWg3NU3J.cjs → stages-D49CUpBY.cjs} +2 -2
  186. package/dist/{stages-BWg3NU3J.cjs.map → stages-D49CUpBY.cjs.map} +1 -1
  187. package/dist/target/public.cjs +1 -1
  188. package/dist/target/public.d.cts +2 -2
  189. package/dist/target/public.d.mts +2 -2
  190. package/dist/target/public.mjs +1 -1
  191. package/dist/{terminal-BDRxzEZD.cjs → terminal-Bc0XhkqW.cjs} +2 -2
  192. package/dist/{terminal-BDRxzEZD.cjs.map → terminal-Bc0XhkqW.cjs.map} +1 -1
  193. package/dist/{terminal-BRAIvH83.mjs → terminal-D92VjzyD.mjs} +2 -2
  194. package/dist/{terminal-BRAIvH83.mjs.map → terminal-D92VjzyD.mjs.map} +1 -1
  195. package/dist/{types-DEmuMHsS.d.cts → types-Bj1A1wkS.d.mts} +3 -3
  196. package/dist/{types-g_S0_RAi.d.mts.map → types-Bj1A1wkS.d.mts.map} +1 -1
  197. package/dist/{types-g_S0_RAi.d.mts → types-CV4AzwC_.d.cts} +4 -2
  198. package/dist/{types-DEmuMHsS.d.cts.map → types-CV4AzwC_.d.cts.map} +1 -1
  199. package/dist/workspace/index.cjs +1 -1
  200. package/dist/workspace/index.d.cts +2 -2
  201. package/dist/workspace/index.d.mts +2 -2
  202. package/dist/workspace/index.mjs +1 -1
  203. package/dist/{workspace-_aoe8v6u.mjs → workspace-B0PI9k9p.mjs} +28 -5
  204. package/dist/workspace-B0PI9k9p.mjs.map +1 -0
  205. package/dist/{workspace-CEpojAus.cjs → workspace-LR9DFjU8.cjs} +39 -4
  206. package/dist/workspace-LR9DFjU8.cjs.map +1 -0
  207. package/package.json +15 -15
  208. package/dist/apps-BGu47YRF.cjs.map +0 -1
  209. package/dist/apps-DGod3aS9.mjs.map +0 -1
  210. package/dist/compose-BVeevJO_.mjs.map +0 -1
  211. package/dist/compose-CXgwCuqv.mjs.map +0 -1
  212. package/dist/compose-CshnO-Th.cjs.map +0 -1
  213. package/dist/compose-IsvqY6iX.cjs.map +0 -1
  214. package/dist/deploy-CjubyZlP.mjs.map +0 -1
  215. package/dist/deploy-DQjEjUfB.cjs.map +0 -1
  216. package/dist/notes-BpaXOAkA.cjs.map +0 -1
  217. package/dist/stack-A3evQgbk.cjs.map +0 -1
  218. package/dist/stack-Cy2FwO3Z.mjs.map +0 -1
  219. package/dist/workspace-CEpojAus.cjs.map +0 -1
  220. package/dist/workspace-_aoe8v6u.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_credentials = require("./credentials-DzR2j8h1.cjs");
1
+ const require_credentials = require("./credentials-BAeWfaj3.cjs");
2
2
  let node_path = require("node:path");
3
3
  let node_fs = require("node:fs");
4
4
  let node_fs_promises = require("node:fs/promises");
@@ -97,10 +97,10 @@ async function bundleServer(options) {
97
97
  for (const ext of Object.keys(candidates)) args.push(`--external:${ext}`);
98
98
  let masterKey;
99
99
  if (stage) {
100
- const { toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets } = await Promise.resolve().then(() => require("./credentials-DzR2j8h1.cjs")).then((n) => n.storage_exports);
101
- const { FileSecretsStore, secretsStoreFor } = await Promise.resolve().then(() => require("./credentials-DzR2j8h1.cjs")).then((n) => n.store_exports);
100
+ const { toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets } = await Promise.resolve().then(() => require("./credentials-BAeWfaj3.cjs")).then((n) => n.storage_exports);
101
+ const { FileSecretsStore, secretsStoreFor } = await Promise.resolve().then(() => require("./credentials-BAeWfaj3.cjs")).then((n) => n.store_exports);
102
102
  const { ConfigNotFound, loadWorkspaceSettings } = await Promise.resolve().then(() => require("./config.cjs"));
103
- const { encryptSecrets, generateDefineOptions } = await Promise.resolve().then(() => require("./sniffer-DHcxlSJF.cjs")).then((n) => n.encryption_exports);
103
+ const { encryptSecrets, generateDefineOptions } = await Promise.resolve().then(() => require("./sniffer-DpiPHtcR.cjs")).then((n) => n.encryption_exports);
104
104
  const store = await loadWorkspaceSettings().then((workspace) => secretsStoreFor(workspace, stage), (error) => {
105
105
  if (error instanceof ConfigNotFound) return new FileSecretsStore(process.cwd());
106
106
  throw error;
@@ -148,7 +148,7 @@ async function bundleServer(options) {
148
148
  const encryptedPath = (0, node_path.join)(gkmDir, "credentials.enc");
149
149
  const ivPath = (0, node_path.join)(gkmDir, "credentials.iv");
150
150
  if ((0, node_fs.existsSync)(encryptedPath) && (0, node_fs.existsSync)(ivPath)) {
151
- const { generateDefineOptions } = await Promise.resolve().then(() => require("./sniffer-DHcxlSJF.cjs")).then((n) => n.encryption_exports);
151
+ const { generateDefineOptions } = await Promise.resolve().then(() => require("./sniffer-DpiPHtcR.cjs")).then((n) => n.encryption_exports);
152
152
  const defines = generateDefineOptions({
153
153
  encrypted: (0, node_fs.readFileSync)(encryptedPath, "utf-8").trim(),
154
154
  iv: (0, node_fs.readFileSync)(ivPath, "utf-8").trim(),
@@ -190,4 +190,4 @@ async function bundleServer(options) {
190
190
  //#endregion
191
191
  exports.bundleServer = bundleServer;
192
192
 
193
- //# sourceMappingURL=bundler-DWGxNGSB.cjs.map
193
+ //# sourceMappingURL=bundler-Bma2_DTI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundler-DWGxNGSB.cjs","names":["dirname","existsSync","join","require","createRequire","mkdir","bundleExternals","readFileSync","spawnSync","writeFile","importedPackages","rm","externalsManifestName"],"sources":["../src/build/bundler.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\nimport {\n\tbundleExternals,\n\texternalsManifestName,\n\timportedPackages,\n} from './native';\n\n/**\n * Banner to inject into ESM bundle for CJS compatibility.\n * Creates a `require` function using Node's createRequire for packages\n * that internally use CommonJS require() for Node builtins.\n */\nconst ESM_CJS_COMPAT_BANNER =\n\t'import { createRequire } from \"module\"; const require = createRequire(import.meta.url);';\n\nexport interface BundleOptions {\n\t/** Entry point file (e.g., .gkm/server/server.ts) */\n\tentryPoint: string;\n\t/** Output directory for bundled files */\n\toutputDir: string;\n\t/** The bundle's file name in `outputDir`. Defaults to `server.mjs`. */\n\toutfile?: string;\n\t/** Minify the output (default: true) */\n\tminify: boolean;\n\t/** Generate sourcemaps (default: false) */\n\tsourcemap: boolean;\n\t/**\n\t * Packages to leave out of the bundle besides its native ones, which are\n\t * always left out and recorded beside it — see `externalsManifestName`.\n\t */\n\texternal: string[];\n\t/** Stage for secrets injection (optional) */\n\tstage?: string;\n\t/** Constructs to validate environment variables for */\n\tconstructs?: Construct[];\n}\n\nexport interface BundleResult {\n\t/** Path to the bundled output */\n\toutputPath: string;\n\t/** Ephemeral master key for deployment (only if stage was provided) */\n\tmasterKey?: string;\n\t/** What the bundle left out, at the version to install beside it. */\n\texternals: Record<string, string>;\n}\n\n/** The app a bundle is built for: the nearest `package.json` above its entry. */\nfunction appRootOf(entryPoint: string): string {\n\tlet dir = dirname(entryPoint);\n\twhile (!existsSync(join(dir, 'package.json'))) {\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) return dirname(entryPoint);\n\t\tdir = parent;\n\t}\n\treturn dir;\n}\n\n/**\n * The esbuild binary, resolved from this package rather than from PATH.\n *\n * It used to be `npx esbuild`, which is two assumptions: that esbuild is\n * installed somewhere npx can find, and that the *app's* directory is where to\n * look. Neither holds — the CLI did not depend on esbuild at all, so a deploy\n * run from an app that had not installed it failed at the bundle step with\n * `sh: esbuild: command not found`, after provisioning had already happened.\n *\n * The same fix `bin/gkm.mjs` makes for tsx: resolve from this package's own\n * `node_modules`, so the tool the CLI shells out to is the one it depends on.\n */\nfunction esbuildBinary(): string {\n\tconst require = createRequire(import.meta.url);\n\n\ttry {\n\t\t// The package root, then its bin — `require.resolve('esbuild')` gives the\n\t\t// JS entry point, which is a library rather than the CLI.\n\t\tconst pkg = require.resolve('esbuild/package.json');\n\t\treturn join(dirname(pkg), 'bin', 'esbuild');\n\t} catch {\n\t\t// Better a PATH lookup than a hard failure: a project that installed\n\t\t// esbuild itself still works.\n\t\treturn 'esbuild';\n\t}\n}\n\n/**\n * Collect the environment variables a build cannot proceed without.\n *\n * Uses the SnifferEnvironmentParser to detect which env vars each service\n * reads, and keeps only the ones it cannot do without. `markOptional` is what\n * separates them: the sniffer already knows which reads went through\n * `.optional()` or `.default()`, and asking for that distinction is the\n * difference between a build that stops and one that proceeds correctly.\n *\n * Without it, a key that is *absent by design* failed the build. A surface\n * publishes `AUTH_COOKIE_DOMAIN` only when there is a domain to widen a cookie\n * to — one host has nothing to share it with, so the derivation correctly\n * yields nothing, and Better Auth reads it as optional for exactly that\n * reason. Treating every sniffed read as required made the honest answer\n * indistinguishable from a missing secret.\n *\n * @param constructs - Array of constructs to analyze\n * @returns Deduplicated, sorted names of the required variables\n */\nasync function collectRequiredEnvVars(\n\tconstructs: Construct[],\n): Promise<string[]> {\n\t// A key read optionally by one construct and required by another stays\n\t// required: the strictest read is the one that fails at runtime, and taking\n\t// the union of the required reads is what says so.\n\tconst required = new Set<string>();\n\n\tfor (const construct of constructs) {\n\t\tfor (const name of await construct.getEnvironment({ markOptional: true })) {\n\t\t\tif (!name.endsWith('?')) required.add(name);\n\t\t}\n\t}\n\n\treturn Array.from(required).sort();\n}\n\n/**\n * Bundle the server application using esbuild.\n * Creates a fully standalone bundle with all dependencies included.\n *\n * @param options - Bundle configuration options\n * @returns Bundle result with output path and optional master key\n */\n\nexport async function bundleServer(\n\toptions: BundleOptions,\n): Promise<BundleResult> {\n\tconst {\n\t\tentryPoint,\n\t\toutputDir,\n\t\tminify,\n\t\tsourcemap,\n\t\texternal,\n\t\tstage,\n\t\tconstructs,\n\t} = options;\n\n\t// Ensure output directory exists\n\tawait mkdir(outputDir, { recursive: true });\n\n\tconst outfile = options.outfile ?? 'server.mjs';\n\tconst mjsOutput = join(outputDir, outfile);\n\n\t// A package with native code loads a binary from beside its own source,\n\t// built for the platform it was installed on: inlined, it finds neither.\n\t// Every one the app could reach stays out of the bundle, and the ones the\n\t// bundle imports are installed for the image's platform at this version.\n\tconst candidates = bundleExternals(appRootOf(entryPoint), external);\n\tconst metafile = join(outputDir, `.${outfile}.meta.json`);\n\n\t// Build command-line arguments for esbuild\n\tconst args = [\n\t\tesbuildBinary(),\n\t\tentryPoint,\n\t\t'--bundle',\n\t\t'--platform=node',\n\t\t'--target=node22',\n\t\t'--format=esm',\n\t\t`--outfile=${mjsOutput}`,\n\t\t'--packages=bundle', // Bundle all dependencies for standalone output\n\t\t`--banner:js=${ESM_CJS_COMPAT_BANNER}`, // CJS compatibility for packages like pino\n\t\t`--metafile=${metafile}`,\n\t];\n\n\tif (minify) {\n\t\t// Names kept: an error's class name is what a log line's `err.type` and\n\t\t// a response's `name` say, and minified they read `_6`.\n\t\targs.push('--minify', '--keep-names');\n\t}\n\n\tif (sourcemap) {\n\t\targs.push('--sourcemap');\n\t}\n\n\tfor (const ext of Object.keys(candidates)) {\n\t\targs.push(`--external:${ext}`);\n\t}\n\n\t// Handle secrets injection if stage is provided\n\tlet masterKey: string | undefined;\n\n\tif (stage) {\n\t\tconst {\n\t\t\ttoEmbeddableSecrets,\n\t\t\tvalidateEnvironmentVariables,\n\t\t\tinitStageSecrets,\n\t\t} = await import('../secrets/storage');\n\t\tconst { FileSecretsStore, secretsStoreFor } = await import(\n\t\t\t'../secrets/store'\n\t\t);\n\t\tconst { ConfigNotFound, loadWorkspaceSettings } = await import('../config');\n\t\tconst { encryptSecrets, generateDefineOptions } = await import(\n\t\t\t'../secrets/encryption'\n\t\t);\n\n\t\t// The stage's own store — SSM or Secrets Manager for a deployed stage\n\t\t// kept there. Outside\n\t\t// any workspace nothing names one, so it is the file.\n\t\tconst store = await loadWorkspaceSettings().then(\n\t\t\t(workspace) => secretsStoreFor(workspace, stage),\n\t\t\t(error) => {\n\t\t\t\tif (error instanceof ConfigNotFound) {\n\t\t\t\t\treturn new FileSecretsStore(process.cwd());\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tlet secrets = await store.read(stage);\n\n\t\tif (!secrets) {\n\t\t\t// Auto-initialize secrets for the stage\n\t\t\tconsole.log(` Initializing secrets for stage \"${stage}\"...`);\n\t\t\tsecrets = initStageSecrets(stage);\n\t\t\tawait store.write(stage, secrets);\n\t\t\tconsole.log(` ✓ Created the \"${stage}\" secrets (${store.name})`);\n\t\t}\n\n\t\t// Validate environment variables if constructs are provided\n\t\tif (constructs && constructs.length > 0) {\n\t\t\tconsole.log(' Analyzing environment variable requirements...');\n\t\t\tconst requiredVars = await collectRequiredEnvVars(constructs);\n\n\t\t\tif (requiredVars.length > 0) {\n\t\t\t\tconst validation = validateEnvironmentVariables(requiredVars, secrets);\n\n\t\t\t\tif (!validation.valid) {\n\t\t\t\t\tconst errorMessage = [\n\t\t\t\t\t\t`Missing environment variables for stage \"${stage}\":`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t...validation.missing.map((v) => ` ❌ ${v}`),\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'To fix this, either:',\n\t\t\t\t\t\t` 1. Add the missing variables to the \"${stage}\" secrets using:`,\n\t\t\t\t\t\t` gkm secrets:set <KEY> <VALUE> --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t` 2. Or import from a JSON file:`,\n\t\t\t\t\t\t` gkm secrets:import secrets.json --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'Required variables:',\n\t\t\t\t\t\t...validation.required.map((v) =>\n\t\t\t\t\t\t\tvalidation.missing.includes(v) ? ` ❌ ${v}` : ` ✓ ${v}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t].join('\\n');\n\n\t\t\t\t\tthrow new Error(errorMessage);\n\t\t\t\t}\n\n\t\t\t\tconsole.log(\n\t\t\t\t\t` ✓ All ${requiredVars.length} required environment variables found`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Convert to embeddable format and encrypt\n\t\tconst embeddable = toEmbeddableSecrets(secrets);\n\t\tconst encrypted = encryptSecrets(embeddable);\n\t\tmasterKey = encrypted.masterKey;\n\n\t\t// Add define options for build-time injection using esbuild's --define:KEY=VALUE format\n\t\tconst defines = generateDefineOptions(encrypted);\n\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t// `value` is already a JS string literal; quoting it again would\n\t\t\t// embed the quotes, and the IV would not parse as hex.\n\t\t\targs.push(`--define:${key}=${value}`);\n\t\t}\n\n\t\tconsole.log(` Secrets encrypted for stage \"${stage}\"`);\n\t} else {\n\t\t// Credentials encrypted elsewhere — an image build hands them in as a\n\t\t// BuildKit secret and writes them beside the app's `.gkm/server` — are\n\t\t// embedded as they are; whoever encrypted them holds the key.\n\t\tconst gkmDir = join(outputDir, '..', '..');\n\t\tconst encryptedPath = join(gkmDir, 'credentials.enc');\n\t\tconst ivPath = join(gkmDir, 'credentials.iv');\n\t\tif (existsSync(encryptedPath) && existsSync(ivPath)) {\n\t\t\tconst { generateDefineOptions } = await import('../secrets/encryption');\n\t\t\tconst defines = generateDefineOptions({\n\t\t\t\tencrypted: readFileSync(encryptedPath, 'utf-8').trim(),\n\t\t\t\tiv: readFileSync(ivPath, 'utf-8').trim(),\n\t\t\t\tmasterKey: '',\n\t\t\t});\n\t\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t\targs.push(`--define:${key}=${value}`);\n\t\t\t}\n\t\t\tconsole.log(' Embedded the encrypted credentials the build was given');\n\t\t}\n\t}\n\n\ttry {\n\t\t// Run esbuild with command-line arguments\n\t\tconst [cmd, ...cmdArgs] = args as [string, ...string[]];\n\t\tconst result = spawnSync(cmd, cmdArgs, {\n\t\t\tcwd: process.cwd(),\n\t\t\tstdio: 'inherit',\n\t\t\tshell: process.platform === 'win32', // Only use shell on Windows for npx resolution\n\t\t});\n\n\t\tif (result.error) {\n\t\t\tthrow result.error;\n\t\t}\n\t\tif (result.status !== 0) {\n\t\t\tthrow new Error(`esbuild exited with code ${result.status}`);\n\t\t}\n\n\t\t// Add shebang to the bundled file\n\t\tconst { readFile } = await import('node:fs/promises');\n\t\tconst content = await readFile(mjsOutput, 'utf-8');\n\t\tif (!content.startsWith('#!')) {\n\t\t\tawait writeFile(mjsOutput, `#!/usr/bin/env node\\n${content}`);\n\t\t}\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to bundle server: ${error instanceof Error ? error.message : 'Unknown error'}`,\n\t\t);\n\t}\n\n\t// Declared ones always; a native package only where the bundle imports it\n\t// — an app that depends on `@geekmidas/cli` reaches esbuild, and never\n\t// runs it.\n\tconst imported = importedPackages(metafile);\n\tawait rm(metafile, { force: true });\n\tconst externals = Object.fromEntries(\n\t\tObject.entries(candidates).filter(\n\t\t\t([name]) => external.includes(name) || imported.has(name),\n\t\t),\n\t);\n\tawait writeFile(\n\t\tjoin(outputDir, externalsManifestName(outfile)),\n\t\t`${JSON.stringify({ private: true, dependencies: externals }, null, 2)}\\n`,\n\t);\n\tif (Object.keys(externals).length > 0) {\n\t\tconsole.log(\n\t\t\t` Left out of the bundle, installed beside it: ${Object.keys(externals).join(', ')}`,\n\t\t);\n\t}\n\n\treturn {\n\t\toutputPath: mjsOutput,\n\t\tmasterKey,\n\t\texternals,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,wBACL;;AAkCD,SAAS,UAAU,YAA4B;CAC9C,IAAI,OAAA,GAAMA,UAAAA,QAAAA,CAAQ,UAAU;CAC5B,OAAO,EAAA,GAACC,QAAAA,WAAAA,EAAAA,GAAWC,UAAAA,KAAAA,CAAK,KAAK,cAAc,CAAC,GAAG;EAC9C,MAAM,UAAA,GAASF,UAAAA,QAAAA,CAAQ,GAAG;EAC1B,IAAI,WAAW,KAAK,QAAA,GAAOA,UAAAA,QAAAA,CAAQ,UAAU;EAC7C,MAAM;CACP;CACA,OAAO;AACR;;;;;;;;;;;;;AAcA,SAAS,gBAAwB;CAChC,MAAMG,aAAAA,GAAUC,YAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B;CAE7C,IAAI;EAGH,MAAM,MAAMD,UAAQ,QAAQ,sBAAsB;EAClD,QAAA,GAAOD,UAAAA,KAAAA,EAAAA,GAAKF,UAAAA,QAAAA,CAAQ,GAAG,GAAG,OAAO,SAAS;CAC3C,QAAQ;EAGP,OAAO;CACR;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,eAAe,uBACd,YACoB;CAIpB,MAAM,2BAAW,IAAI,IAAY;CAEjC,KAAK,MAAM,aAAa,YACvB,KAAK,MAAM,QAAQ,MAAM,UAAU,eAAe,EAAE,cAAc,KAAK,CAAC,GACvE,IAAI,CAAC,KAAK,SAAS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MACT,4BAA4B,iBAAiB,QAAQ,MAAM,UAAU,iBACtE;CACD;CAKA,MAAM,WAAWC,oBAAAA,iBAAiB,QAAQ;CAC1C,OAAA,GAAMC,iBAAAA,GAAAA,CAAG,UAAU,EAAE,OAAO,KAAK,CAAC;CAClC,MAAM,YAAY,OAAO,YACxB,OAAO,QAAQ,UAAU,CAAC,CAAC,QACzB,CAAC,UAAU,SAAS,SAAS,IAAI,KAAK,SAAS,IAAI,IAAI,CACzD,CACD;CACA,OAAA,GAAMF,iBAAAA,UAAAA,EAAAA,GACLP,UAAAA,KAAAA,CAAK,WAAWU,oBAAAA,sBAAsB,OAAO,CAAC,GAC9C,GAAG,KAAK,UAAU;EAAE,SAAS;EAAM,cAAc;CAAU,GAAG,MAAM,CAAC,EAAE,GACxE;CACA,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,SAAS,GACnC,QAAQ,IACP,kDAAkD,OAAO,KAAK,SAAS,CAAC,CAAC,KAAK,IAAI,GACnF;CAGD,OAAO;EACN,YAAY;EACZ;EACA;CACD;AACD"}
1
+ {"version":3,"file":"bundler-Bma2_DTI.cjs","names":["dirname","existsSync","join","require","createRequire","mkdir","bundleExternals","readFileSync","spawnSync","writeFile","importedPackages","rm","externalsManifestName"],"sources":["../src/build/bundler.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\nimport {\n\tbundleExternals,\n\texternalsManifestName,\n\timportedPackages,\n} from './native';\n\n/**\n * Banner to inject into ESM bundle for CJS compatibility.\n * Creates a `require` function using Node's createRequire for packages\n * that internally use CommonJS require() for Node builtins.\n */\nconst ESM_CJS_COMPAT_BANNER =\n\t'import { createRequire } from \"module\"; const require = createRequire(import.meta.url);';\n\nexport interface BundleOptions {\n\t/** Entry point file (e.g., .gkm/server/server.ts) */\n\tentryPoint: string;\n\t/** Output directory for bundled files */\n\toutputDir: string;\n\t/** The bundle's file name in `outputDir`. Defaults to `server.mjs`. */\n\toutfile?: string;\n\t/** Minify the output (default: true) */\n\tminify: boolean;\n\t/** Generate sourcemaps (default: false) */\n\tsourcemap: boolean;\n\t/**\n\t * Packages to leave out of the bundle besides its native ones, which are\n\t * always left out and recorded beside it — see `externalsManifestName`.\n\t */\n\texternal: string[];\n\t/** Stage for secrets injection (optional) */\n\tstage?: string;\n\t/** Constructs to validate environment variables for */\n\tconstructs?: Construct[];\n}\n\nexport interface BundleResult {\n\t/** Path to the bundled output */\n\toutputPath: string;\n\t/** Ephemeral master key for deployment (only if stage was provided) */\n\tmasterKey?: string;\n\t/** What the bundle left out, at the version to install beside it. */\n\texternals: Record<string, string>;\n}\n\n/** The app a bundle is built for: the nearest `package.json` above its entry. */\nfunction appRootOf(entryPoint: string): string {\n\tlet dir = dirname(entryPoint);\n\twhile (!existsSync(join(dir, 'package.json'))) {\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) return dirname(entryPoint);\n\t\tdir = parent;\n\t}\n\treturn dir;\n}\n\n/**\n * The esbuild binary, resolved from this package rather than from PATH.\n *\n * It used to be `npx esbuild`, which is two assumptions: that esbuild is\n * installed somewhere npx can find, and that the *app's* directory is where to\n * look. Neither holds — the CLI did not depend on esbuild at all, so a deploy\n * run from an app that had not installed it failed at the bundle step with\n * `sh: esbuild: command not found`, after provisioning had already happened.\n *\n * The same fix `bin/gkm.mjs` makes for tsx: resolve from this package's own\n * `node_modules`, so the tool the CLI shells out to is the one it depends on.\n */\nfunction esbuildBinary(): string {\n\tconst require = createRequire(import.meta.url);\n\n\ttry {\n\t\t// The package root, then its bin — `require.resolve('esbuild')` gives the\n\t\t// JS entry point, which is a library rather than the CLI.\n\t\tconst pkg = require.resolve('esbuild/package.json');\n\t\treturn join(dirname(pkg), 'bin', 'esbuild');\n\t} catch {\n\t\t// Better a PATH lookup than a hard failure: a project that installed\n\t\t// esbuild itself still works.\n\t\treturn 'esbuild';\n\t}\n}\n\n/**\n * Collect the environment variables a build cannot proceed without.\n *\n * Uses the SnifferEnvironmentParser to detect which env vars each service\n * reads, and keeps only the ones it cannot do without. `markOptional` is what\n * separates them: the sniffer already knows which reads went through\n * `.optional()` or `.default()`, and asking for that distinction is the\n * difference between a build that stops and one that proceeds correctly.\n *\n * Without it, a key that is *absent by design* failed the build. A surface\n * publishes `AUTH_COOKIE_DOMAIN` only when there is a domain to widen a cookie\n * to — one host has nothing to share it with, so the derivation correctly\n * yields nothing, and Better Auth reads it as optional for exactly that\n * reason. Treating every sniffed read as required made the honest answer\n * indistinguishable from a missing secret.\n *\n * @param constructs - Array of constructs to analyze\n * @returns Deduplicated, sorted names of the required variables\n */\nasync function collectRequiredEnvVars(\n\tconstructs: Construct[],\n): Promise<string[]> {\n\t// A key read optionally by one construct and required by another stays\n\t// required: the strictest read is the one that fails at runtime, and taking\n\t// the union of the required reads is what says so.\n\tconst required = new Set<string>();\n\n\tfor (const construct of constructs) {\n\t\tfor (const name of await construct.getEnvironment({ markOptional: true })) {\n\t\t\tif (!name.endsWith('?')) required.add(name);\n\t\t}\n\t}\n\n\treturn Array.from(required).sort();\n}\n\n/**\n * Bundle the server application using esbuild.\n * Creates a fully standalone bundle with all dependencies included.\n *\n * @param options - Bundle configuration options\n * @returns Bundle result with output path and optional master key\n */\n\nexport async function bundleServer(\n\toptions: BundleOptions,\n): Promise<BundleResult> {\n\tconst {\n\t\tentryPoint,\n\t\toutputDir,\n\t\tminify,\n\t\tsourcemap,\n\t\texternal,\n\t\tstage,\n\t\tconstructs,\n\t} = options;\n\n\t// Ensure output directory exists\n\tawait mkdir(outputDir, { recursive: true });\n\n\tconst outfile = options.outfile ?? 'server.mjs';\n\tconst mjsOutput = join(outputDir, outfile);\n\n\t// A package with native code loads a binary from beside its own source,\n\t// built for the platform it was installed on: inlined, it finds neither.\n\t// Every one the app could reach stays out of the bundle, and the ones the\n\t// bundle imports are installed for the image's platform at this version.\n\tconst candidates = bundleExternals(appRootOf(entryPoint), external);\n\tconst metafile = join(outputDir, `.${outfile}.meta.json`);\n\n\t// Build command-line arguments for esbuild\n\tconst args = [\n\t\tesbuildBinary(),\n\t\tentryPoint,\n\t\t'--bundle',\n\t\t'--platform=node',\n\t\t'--target=node22',\n\t\t'--format=esm',\n\t\t`--outfile=${mjsOutput}`,\n\t\t'--packages=bundle', // Bundle all dependencies for standalone output\n\t\t`--banner:js=${ESM_CJS_COMPAT_BANNER}`, // CJS compatibility for packages like pino\n\t\t`--metafile=${metafile}`,\n\t];\n\n\tif (minify) {\n\t\t// Names kept: an error's class name is what a log line's `err.type` and\n\t\t// a response's `name` say, and minified they read `_6`.\n\t\targs.push('--minify', '--keep-names');\n\t}\n\n\tif (sourcemap) {\n\t\targs.push('--sourcemap');\n\t}\n\n\tfor (const ext of Object.keys(candidates)) {\n\t\targs.push(`--external:${ext}`);\n\t}\n\n\t// Handle secrets injection if stage is provided\n\tlet masterKey: string | undefined;\n\n\tif (stage) {\n\t\tconst {\n\t\t\ttoEmbeddableSecrets,\n\t\t\tvalidateEnvironmentVariables,\n\t\t\tinitStageSecrets,\n\t\t} = await import('../secrets/storage');\n\t\tconst { FileSecretsStore, secretsStoreFor } = await import(\n\t\t\t'../secrets/store'\n\t\t);\n\t\tconst { ConfigNotFound, loadWorkspaceSettings } = await import('../config');\n\t\tconst { encryptSecrets, generateDefineOptions } = await import(\n\t\t\t'../secrets/encryption'\n\t\t);\n\n\t\t// The stage's own store — SSM or Secrets Manager for a deployed stage\n\t\t// kept there. Outside\n\t\t// any workspace nothing names one, so it is the file.\n\t\tconst store = await loadWorkspaceSettings().then(\n\t\t\t(workspace) => secretsStoreFor(workspace, stage),\n\t\t\t(error) => {\n\t\t\t\tif (error instanceof ConfigNotFound) {\n\t\t\t\t\treturn new FileSecretsStore(process.cwd());\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tlet secrets = await store.read(stage);\n\n\t\tif (!secrets) {\n\t\t\t// Auto-initialize secrets for the stage\n\t\t\tconsole.log(` Initializing secrets for stage \"${stage}\"...`);\n\t\t\tsecrets = initStageSecrets(stage);\n\t\t\tawait store.write(stage, secrets);\n\t\t\tconsole.log(` ✓ Created the \"${stage}\" secrets (${store.name})`);\n\t\t}\n\n\t\t// Validate environment variables if constructs are provided\n\t\tif (constructs && constructs.length > 0) {\n\t\t\tconsole.log(' Analyzing environment variable requirements...');\n\t\t\tconst requiredVars = await collectRequiredEnvVars(constructs);\n\n\t\t\tif (requiredVars.length > 0) {\n\t\t\t\tconst validation = validateEnvironmentVariables(requiredVars, secrets);\n\n\t\t\t\tif (!validation.valid) {\n\t\t\t\t\tconst errorMessage = [\n\t\t\t\t\t\t`Missing environment variables for stage \"${stage}\":`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t...validation.missing.map((v) => ` ❌ ${v}`),\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'To fix this, either:',\n\t\t\t\t\t\t` 1. Add the missing variables to the \"${stage}\" secrets using:`,\n\t\t\t\t\t\t` gkm secrets:set <KEY> <VALUE> --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t` 2. Or import from a JSON file:`,\n\t\t\t\t\t\t` gkm secrets:import secrets.json --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'Required variables:',\n\t\t\t\t\t\t...validation.required.map((v) =>\n\t\t\t\t\t\t\tvalidation.missing.includes(v) ? ` ❌ ${v}` : ` ✓ ${v}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t].join('\\n');\n\n\t\t\t\t\tthrow new Error(errorMessage);\n\t\t\t\t}\n\n\t\t\t\tconsole.log(\n\t\t\t\t\t` ✓ All ${requiredVars.length} required environment variables found`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Convert to embeddable format and encrypt\n\t\tconst embeddable = toEmbeddableSecrets(secrets);\n\t\tconst encrypted = encryptSecrets(embeddable);\n\t\tmasterKey = encrypted.masterKey;\n\n\t\t// Add define options for build-time injection using esbuild's --define:KEY=VALUE format\n\t\tconst defines = generateDefineOptions(encrypted);\n\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t// `value` is already a JS string literal; quoting it again would\n\t\t\t// embed the quotes, and the IV would not parse as hex.\n\t\t\targs.push(`--define:${key}=${value}`);\n\t\t}\n\n\t\tconsole.log(` Secrets encrypted for stage \"${stage}\"`);\n\t} else {\n\t\t// Credentials encrypted elsewhere — an image build hands them in as a\n\t\t// BuildKit secret and writes them beside the app's `.gkm/server` — are\n\t\t// embedded as they are; whoever encrypted them holds the key.\n\t\tconst gkmDir = join(outputDir, '..', '..');\n\t\tconst encryptedPath = join(gkmDir, 'credentials.enc');\n\t\tconst ivPath = join(gkmDir, 'credentials.iv');\n\t\tif (existsSync(encryptedPath) && existsSync(ivPath)) {\n\t\t\tconst { generateDefineOptions } = await import('../secrets/encryption');\n\t\t\tconst defines = generateDefineOptions({\n\t\t\t\tencrypted: readFileSync(encryptedPath, 'utf-8').trim(),\n\t\t\t\tiv: readFileSync(ivPath, 'utf-8').trim(),\n\t\t\t\tmasterKey: '',\n\t\t\t});\n\t\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t\targs.push(`--define:${key}=${value}`);\n\t\t\t}\n\t\t\tconsole.log(' Embedded the encrypted credentials the build was given');\n\t\t}\n\t}\n\n\ttry {\n\t\t// Run esbuild with command-line arguments\n\t\tconst [cmd, ...cmdArgs] = args as [string, ...string[]];\n\t\tconst result = spawnSync(cmd, cmdArgs, {\n\t\t\tcwd: process.cwd(),\n\t\t\tstdio: 'inherit',\n\t\t\tshell: process.platform === 'win32', // Only use shell on Windows for npx resolution\n\t\t});\n\n\t\tif (result.error) {\n\t\t\tthrow result.error;\n\t\t}\n\t\tif (result.status !== 0) {\n\t\t\tthrow new Error(`esbuild exited with code ${result.status}`);\n\t\t}\n\n\t\t// Add shebang to the bundled file\n\t\tconst { readFile } = await import('node:fs/promises');\n\t\tconst content = await readFile(mjsOutput, 'utf-8');\n\t\tif (!content.startsWith('#!')) {\n\t\t\tawait writeFile(mjsOutput, `#!/usr/bin/env node\\n${content}`);\n\t\t}\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to bundle server: ${error instanceof Error ? error.message : 'Unknown error'}`,\n\t\t);\n\t}\n\n\t// Declared ones always; a native package only where the bundle imports it\n\t// — an app that depends on `@geekmidas/cli` reaches esbuild, and never\n\t// runs it.\n\tconst imported = importedPackages(metafile);\n\tawait rm(metafile, { force: true });\n\tconst externals = Object.fromEntries(\n\t\tObject.entries(candidates).filter(\n\t\t\t([name]) => external.includes(name) || imported.has(name),\n\t\t),\n\t);\n\tawait writeFile(\n\t\tjoin(outputDir, externalsManifestName(outfile)),\n\t\t`${JSON.stringify({ private: true, dependencies: externals }, null, 2)}\\n`,\n\t);\n\tif (Object.keys(externals).length > 0) {\n\t\tconsole.log(\n\t\t\t` Left out of the bundle, installed beside it: ${Object.keys(externals).join(', ')}`,\n\t\t);\n\t}\n\n\treturn {\n\t\toutputPath: mjsOutput,\n\t\tmasterKey,\n\t\texternals,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,wBACL;;AAkCD,SAAS,UAAU,YAA4B;CAC9C,IAAI,OAAA,GAAMA,UAAAA,QAAAA,CAAQ,UAAU;CAC5B,OAAO,EAAA,GAACC,QAAAA,WAAAA,EAAAA,GAAWC,UAAAA,KAAAA,CAAK,KAAK,cAAc,CAAC,GAAG;EAC9C,MAAM,UAAA,GAASF,UAAAA,QAAAA,CAAQ,GAAG;EAC1B,IAAI,WAAW,KAAK,QAAA,GAAOA,UAAAA,QAAAA,CAAQ,UAAU;EAC7C,MAAM;CACP;CACA,OAAO;AACR;;;;;;;;;;;;;AAcA,SAAS,gBAAwB;CAChC,MAAMG,aAAAA,GAAUC,YAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA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S;GACtC,KAAK,QAAQ,IAAI;GACjB,OAAO;GACP,OAAO,QAAQ,aAAa;EAC7B,CAAC;EAED,IAAI,OAAO,OACV,MAAM,OAAO;EAEd,IAAI,OAAO,WAAW,GACrB,MAAM,IAAI,MAAM,4BAA4B,OAAO,QAAQ;EAI5D,MAAM,EAAE,aAAa,MAAM,OAAO;EAClC,MAAM,UAAU,MAAM,SAAS,WAAW,OAAO;EACjD,IAAI,CAAC,QAAQ,WAAW,IAAI,GAC3B,OAAA,GAAMC,iBAAAA,UAAAA,CAAU,WAAW,wBAAwB,SAAS;CAE9D,SAAS,OAAO;EACf,MAAM,IAAI,MACT,4BAA4B,iBAAiB,QAAQ,MAAM,UAAU,iBACtE;CACD;CAKA,MAAM,WAAWC,oBAAAA,iBAAiB,QAAQ;CAC1C,OAAA,GAAMC,iBAAAA,GAAAA,CAAG,UAAU,EAAE,OAAO,KAAK,CAAC;CAClC,MAAM,YAAY,OAAO,YACxB,OAAO,QAAQ,UAAU,CAAC,CAAC,QACzB,CAAC,UAAU,SAAS,SAAS,IAAI,KAAK,SAAS,IAAI,IAAI,CACzD,CACD;CACA,OAAA,GAAMF,iBAAAA,UAAAA,EAAAA,GACLP,UAAAA,KAAAA,CAAK,WAAWU,oBAAAA,sBAAsB,OAAO,CAAC,GAC9C,GAAG,KAAK,UAAU;EAAE,SAAS;EAAM,cAAc;CAAU,GAAG,MAAM,CAAC,EAAE,GACxE;CACA,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,SAAS,GACnC,QAAQ,IACP,kDAAkD,OAAO,KAAK,SAAS,CAAC,CAAC,KAAK,IAAI,GACnF;CAGD,OAAO;EACN,YAAY;EACZ;EACA;CACD;AACD"}
@@ -1,4 +1,4 @@
1
- import { L as bundleExternals, R as externalsManifestName, z as importedPackages } from "./credentials-CKIeLL7T.mjs";
1
+ import { L as bundleExternals, R as externalsManifestName, z as importedPackages } from "./credentials-DmNpxlFO.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { dirname, join } from "node:path";
4
4
  import { existsSync, readFileSync } from "node:fs";
@@ -97,10 +97,10 @@ async function bundleServer(options) {
97
97
  for (const ext of Object.keys(candidates)) args.push(`--external:${ext}`);
98
98
  let masterKey;
99
99
  if (stage) {
100
- const { toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets } = await import("./credentials-CKIeLL7T.mjs").then((n) => n.P);
101
- const { FileSecretsStore, secretsStoreFor } = await import("./credentials-CKIeLL7T.mjs").then((n) => n.j);
100
+ const { toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets } = await import("./credentials-DmNpxlFO.mjs").then((n) => n.P);
101
+ const { FileSecretsStore, secretsStoreFor } = await import("./credentials-DmNpxlFO.mjs").then((n) => n.j);
102
102
  const { ConfigNotFound, loadWorkspaceSettings } = await import("./config.mjs");
103
- const { encryptSecrets, generateDefineOptions } = await import("./sniffer-9smKtb86.mjs").then((n) => n.O);
103
+ const { encryptSecrets, generateDefineOptions } = await import("./sniffer-D6dwbd7L.mjs").then((n) => n.O);
104
104
  const store = await loadWorkspaceSettings().then((workspace) => secretsStoreFor(workspace, stage), (error) => {
105
105
  if (error instanceof ConfigNotFound) return new FileSecretsStore(process.cwd());
106
106
  throw error;
@@ -148,7 +148,7 @@ async function bundleServer(options) {
148
148
  const encryptedPath = join(gkmDir, "credentials.enc");
149
149
  const ivPath = join(gkmDir, "credentials.iv");
150
150
  if (existsSync(encryptedPath) && existsSync(ivPath)) {
151
- const { generateDefineOptions } = await import("./sniffer-9smKtb86.mjs").then((n) => n.O);
151
+ const { generateDefineOptions } = await import("./sniffer-D6dwbd7L.mjs").then((n) => n.O);
152
152
  const defines = generateDefineOptions({
153
153
  encrypted: readFileSync(encryptedPath, "utf-8").trim(),
154
154
  iv: readFileSync(ivPath, "utf-8").trim(),
@@ -190,4 +190,4 @@ async function bundleServer(options) {
190
190
  //#endregion
191
191
  export { bundleServer };
192
192
 
193
- //# sourceMappingURL=bundler-Dm0mB7EK.mjs.map
193
+ //# sourceMappingURL=bundler-CSSYSsl8.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundler-Dm0mB7EK.mjs","names":[],"sources":["../src/build/bundler.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\nimport {\n\tbundleExternals,\n\texternalsManifestName,\n\timportedPackages,\n} from './native';\n\n/**\n * Banner to inject into ESM bundle for CJS compatibility.\n * Creates a `require` function using Node's createRequire for packages\n * that internally use CommonJS require() for Node builtins.\n */\nconst ESM_CJS_COMPAT_BANNER =\n\t'import { createRequire } from \"module\"; const require = createRequire(import.meta.url);';\n\nexport interface BundleOptions {\n\t/** Entry point file (e.g., .gkm/server/server.ts) */\n\tentryPoint: string;\n\t/** Output directory for bundled files */\n\toutputDir: string;\n\t/** The bundle's file name in `outputDir`. Defaults to `server.mjs`. */\n\toutfile?: string;\n\t/** Minify the output (default: true) */\n\tminify: boolean;\n\t/** Generate sourcemaps (default: false) */\n\tsourcemap: boolean;\n\t/**\n\t * Packages to leave out of the bundle besides its native ones, which are\n\t * always left out and recorded beside it — see `externalsManifestName`.\n\t */\n\texternal: string[];\n\t/** Stage for secrets injection (optional) */\n\tstage?: string;\n\t/** Constructs to validate environment variables for */\n\tconstructs?: Construct[];\n}\n\nexport interface BundleResult {\n\t/** Path to the bundled output */\n\toutputPath: string;\n\t/** Ephemeral master key for deployment (only if stage was provided) */\n\tmasterKey?: string;\n\t/** What the bundle left out, at the version to install beside it. */\n\texternals: Record<string, string>;\n}\n\n/** The app a bundle is built for: the nearest `package.json` above its entry. */\nfunction appRootOf(entryPoint: string): string {\n\tlet dir = dirname(entryPoint);\n\twhile (!existsSync(join(dir, 'package.json'))) {\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) return dirname(entryPoint);\n\t\tdir = parent;\n\t}\n\treturn dir;\n}\n\n/**\n * The esbuild binary, resolved from this package rather than from PATH.\n *\n * It used to be `npx esbuild`, which is two assumptions: that esbuild is\n * installed somewhere npx can find, and that the *app's* directory is where to\n * look. Neither holds — the CLI did not depend on esbuild at all, so a deploy\n * run from an app that had not installed it failed at the bundle step with\n * `sh: esbuild: command not found`, after provisioning had already happened.\n *\n * The same fix `bin/gkm.mjs` makes for tsx: resolve from this package's own\n * `node_modules`, so the tool the CLI shells out to is the one it depends on.\n */\nfunction esbuildBinary(): string {\n\tconst require = createRequire(import.meta.url);\n\n\ttry {\n\t\t// The package root, then its bin — `require.resolve('esbuild')` gives the\n\t\t// JS entry point, which is a library rather than the CLI.\n\t\tconst pkg = require.resolve('esbuild/package.json');\n\t\treturn join(dirname(pkg), 'bin', 'esbuild');\n\t} catch {\n\t\t// Better a PATH lookup than a hard failure: a project that installed\n\t\t// esbuild itself still works.\n\t\treturn 'esbuild';\n\t}\n}\n\n/**\n * Collect the environment variables a build cannot proceed without.\n *\n * Uses the SnifferEnvironmentParser to detect which env vars each service\n * reads, and keeps only the ones it cannot do without. `markOptional` is what\n * separates them: the sniffer already knows which reads went through\n * `.optional()` or `.default()`, and asking for that distinction is the\n * difference between a build that stops and one that proceeds correctly.\n *\n * Without it, a key that is *absent by design* failed the build. A surface\n * publishes `AUTH_COOKIE_DOMAIN` only when there is a domain to widen a cookie\n * to — one host has nothing to share it with, so the derivation correctly\n * yields nothing, and Better Auth reads it as optional for exactly that\n * reason. Treating every sniffed read as required made the honest answer\n * indistinguishable from a missing secret.\n *\n * @param constructs - Array of constructs to analyze\n * @returns Deduplicated, sorted names of the required variables\n */\nasync function collectRequiredEnvVars(\n\tconstructs: Construct[],\n): Promise<string[]> {\n\t// A key read optionally by one construct and required by another stays\n\t// required: the strictest read is the one that fails at runtime, and taking\n\t// the union of the required reads is what says so.\n\tconst required = new Set<string>();\n\n\tfor (const construct of constructs) {\n\t\tfor (const name of await construct.getEnvironment({ markOptional: true })) {\n\t\t\tif (!name.endsWith('?')) required.add(name);\n\t\t}\n\t}\n\n\treturn Array.from(required).sort();\n}\n\n/**\n * Bundle the server application using esbuild.\n * Creates a fully standalone bundle with all dependencies included.\n *\n * @param options - Bundle configuration options\n * @returns Bundle result with output path and optional master key\n */\n\nexport async function bundleServer(\n\toptions: BundleOptions,\n): Promise<BundleResult> {\n\tconst {\n\t\tentryPoint,\n\t\toutputDir,\n\t\tminify,\n\t\tsourcemap,\n\t\texternal,\n\t\tstage,\n\t\tconstructs,\n\t} = options;\n\n\t// Ensure output directory exists\n\tawait mkdir(outputDir, { recursive: true });\n\n\tconst outfile = options.outfile ?? 'server.mjs';\n\tconst mjsOutput = join(outputDir, outfile);\n\n\t// A package with native code loads a binary from beside its own source,\n\t// built for the platform it was installed on: inlined, it finds neither.\n\t// Every one the app could reach stays out of the bundle, and the ones the\n\t// bundle imports are installed for the image's platform at this version.\n\tconst candidates = bundleExternals(appRootOf(entryPoint), external);\n\tconst metafile = join(outputDir, `.${outfile}.meta.json`);\n\n\t// Build command-line arguments for esbuild\n\tconst args = [\n\t\tesbuildBinary(),\n\t\tentryPoint,\n\t\t'--bundle',\n\t\t'--platform=node',\n\t\t'--target=node22',\n\t\t'--format=esm',\n\t\t`--outfile=${mjsOutput}`,\n\t\t'--packages=bundle', // Bundle all dependencies for standalone output\n\t\t`--banner:js=${ESM_CJS_COMPAT_BANNER}`, // CJS compatibility for packages like pino\n\t\t`--metafile=${metafile}`,\n\t];\n\n\tif (minify) {\n\t\t// Names kept: an error's class name is what a log line's `err.type` and\n\t\t// a response's `name` say, and minified they read `_6`.\n\t\targs.push('--minify', '--keep-names');\n\t}\n\n\tif (sourcemap) {\n\t\targs.push('--sourcemap');\n\t}\n\n\tfor (const ext of Object.keys(candidates)) {\n\t\targs.push(`--external:${ext}`);\n\t}\n\n\t// Handle secrets injection if stage is provided\n\tlet masterKey: string | undefined;\n\n\tif (stage) {\n\t\tconst {\n\t\t\ttoEmbeddableSecrets,\n\t\t\tvalidateEnvironmentVariables,\n\t\t\tinitStageSecrets,\n\t\t} = await import('../secrets/storage');\n\t\tconst { FileSecretsStore, secretsStoreFor } = await import(\n\t\t\t'../secrets/store'\n\t\t);\n\t\tconst { ConfigNotFound, loadWorkspaceSettings } = await import('../config');\n\t\tconst { encryptSecrets, generateDefineOptions } = await import(\n\t\t\t'../secrets/encryption'\n\t\t);\n\n\t\t// The stage's own store — SSM or Secrets Manager for a deployed stage\n\t\t// kept there. Outside\n\t\t// any workspace nothing names one, so it is the file.\n\t\tconst store = await loadWorkspaceSettings().then(\n\t\t\t(workspace) => secretsStoreFor(workspace, stage),\n\t\t\t(error) => {\n\t\t\t\tif (error instanceof ConfigNotFound) {\n\t\t\t\t\treturn new FileSecretsStore(process.cwd());\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tlet secrets = await store.read(stage);\n\n\t\tif (!secrets) {\n\t\t\t// Auto-initialize secrets for the stage\n\t\t\tconsole.log(` Initializing secrets for stage \"${stage}\"...`);\n\t\t\tsecrets = initStageSecrets(stage);\n\t\t\tawait store.write(stage, secrets);\n\t\t\tconsole.log(` ✓ Created the \"${stage}\" secrets (${store.name})`);\n\t\t}\n\n\t\t// Validate environment variables if constructs are provided\n\t\tif (constructs && constructs.length > 0) {\n\t\t\tconsole.log(' Analyzing environment variable requirements...');\n\t\t\tconst requiredVars = await collectRequiredEnvVars(constructs);\n\n\t\t\tif (requiredVars.length > 0) {\n\t\t\t\tconst validation = validateEnvironmentVariables(requiredVars, secrets);\n\n\t\t\t\tif (!validation.valid) {\n\t\t\t\t\tconst errorMessage = [\n\t\t\t\t\t\t`Missing environment variables for stage \"${stage}\":`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t...validation.missing.map((v) => ` ❌ ${v}`),\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'To fix this, either:',\n\t\t\t\t\t\t` 1. Add the missing variables to the \"${stage}\" secrets using:`,\n\t\t\t\t\t\t` gkm secrets:set <KEY> <VALUE> --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t` 2. Or import from a JSON file:`,\n\t\t\t\t\t\t` gkm secrets:import secrets.json --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'Required variables:',\n\t\t\t\t\t\t...validation.required.map((v) =>\n\t\t\t\t\t\t\tvalidation.missing.includes(v) ? ` ❌ ${v}` : ` ✓ ${v}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t].join('\\n');\n\n\t\t\t\t\tthrow new Error(errorMessage);\n\t\t\t\t}\n\n\t\t\t\tconsole.log(\n\t\t\t\t\t` ✓ All ${requiredVars.length} required environment variables found`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Convert to embeddable format and encrypt\n\t\tconst embeddable = toEmbeddableSecrets(secrets);\n\t\tconst encrypted = encryptSecrets(embeddable);\n\t\tmasterKey = encrypted.masterKey;\n\n\t\t// Add define options for build-time injection using esbuild's --define:KEY=VALUE format\n\t\tconst defines = generateDefineOptions(encrypted);\n\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t// `value` is already a JS string literal; quoting it again would\n\t\t\t// embed the quotes, and the IV would not parse as hex.\n\t\t\targs.push(`--define:${key}=${value}`);\n\t\t}\n\n\t\tconsole.log(` Secrets encrypted for stage \"${stage}\"`);\n\t} else {\n\t\t// Credentials encrypted elsewhere — an image build hands them in as a\n\t\t// BuildKit secret and writes them beside the app's `.gkm/server` — are\n\t\t// embedded as they are; whoever encrypted them holds the key.\n\t\tconst gkmDir = join(outputDir, '..', '..');\n\t\tconst encryptedPath = join(gkmDir, 'credentials.enc');\n\t\tconst ivPath = join(gkmDir, 'credentials.iv');\n\t\tif (existsSync(encryptedPath) && existsSync(ivPath)) {\n\t\t\tconst { generateDefineOptions } = await import('../secrets/encryption');\n\t\t\tconst defines = generateDefineOptions({\n\t\t\t\tencrypted: readFileSync(encryptedPath, 'utf-8').trim(),\n\t\t\t\tiv: readFileSync(ivPath, 'utf-8').trim(),\n\t\t\t\tmasterKey: '',\n\t\t\t});\n\t\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t\targs.push(`--define:${key}=${value}`);\n\t\t\t}\n\t\t\tconsole.log(' Embedded the encrypted credentials the build was given');\n\t\t}\n\t}\n\n\ttry {\n\t\t// Run esbuild with command-line arguments\n\t\tconst [cmd, ...cmdArgs] = args as [string, ...string[]];\n\t\tconst result = spawnSync(cmd, cmdArgs, {\n\t\t\tcwd: process.cwd(),\n\t\t\tstdio: 'inherit',\n\t\t\tshell: process.platform === 'win32', // Only use shell on Windows for npx resolution\n\t\t});\n\n\t\tif (result.error) {\n\t\t\tthrow result.error;\n\t\t}\n\t\tif (result.status !== 0) {\n\t\t\tthrow new Error(`esbuild exited with code ${result.status}`);\n\t\t}\n\n\t\t// Add shebang to the bundled file\n\t\tconst { readFile } = await import('node:fs/promises');\n\t\tconst content = await readFile(mjsOutput, 'utf-8');\n\t\tif (!content.startsWith('#!')) {\n\t\t\tawait writeFile(mjsOutput, `#!/usr/bin/env node\\n${content}`);\n\t\t}\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to bundle server: ${error instanceof Error ? error.message : 'Unknown error'}`,\n\t\t);\n\t}\n\n\t// Declared ones always; a native package only where the bundle imports it\n\t// — an app that depends on `@geekmidas/cli` reaches esbuild, and never\n\t// runs it.\n\tconst imported = importedPackages(metafile);\n\tawait rm(metafile, { force: true });\n\tconst externals = Object.fromEntries(\n\t\tObject.entries(candidates).filter(\n\t\t\t([name]) => external.includes(name) || imported.has(name),\n\t\t),\n\t);\n\tawait writeFile(\n\t\tjoin(outputDir, externalsManifestName(outfile)),\n\t\t`${JSON.stringify({ private: true, dependencies: externals }, null, 2)}\\n`,\n\t);\n\tif (Object.keys(externals).length > 0) {\n\t\tconsole.log(\n\t\t\t` Left out of the bundle, installed beside it: ${Object.keys(externals).join(', ')}`,\n\t\t);\n\t}\n\n\treturn {\n\t\toutputPath: mjsOutput,\n\t\tmasterK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I,MAAM,4BAA4B,OAAO,QAAQ;EAI5D,MAAM,EAAE,aAAa,MAAM,OAAO;EAClC,MAAM,UAAU,MAAM,SAAS,WAAW,OAAO;EACjD,IAAI,CAAC,QAAQ,WAAW,IAAI,GAC3B,MAAM,UAAU,WAAW,wBAAwB,SAAS;CAE9D,SAAS,OAAO;EACf,MAAM,IAAI,MACT,4BAA4B,iBAAiB,QAAQ,MAAM,UAAU,iBACtE;CACD;CAKA,MAAM,WAAW,iBAAiB,QAAQ;CAC1C,MAAM,GAAG,UAAU,EAAE,OAAO,KAAK,CAAC;CAClC,MAAM,YAAY,OAAO,YACxB,OAAO,QAAQ,UAAU,CAAC,CAAC,QACzB,CAAC,UAAU,SAAS,SAAS,IAAI,KAAK,SAAS,IAAI,IAAI,CACzD,CACD;CACA,MAAM,UACL,KAAK,WAAW,sBAAsB,OAAO,CAAC,GAC9C,GAAG,KAAK,UAAU;EAAE,SAAS;EAAM,cAAc;CAAU,GAAG,MAAM,CAAC,EAAE,GACxE;CACA,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,SAAS,GACnC,QAAQ,IACP,kDAAkD,OAAO,KAAK,SAAS,CAAC,CAAC,KAAK,IAAI,GACnF;CAGD,OAAO;EACN,YAAY;EACZ;EACA;CACD;AACD"}
1
+ {"version":3,"file":"bundler-CSSYSsl8.mjs","names":[],"sources":["../src/build/bundler.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\nimport {\n\tbundleExternals,\n\texternalsManifestName,\n\timportedPackages,\n} from './native';\n\n/**\n * Banner to inject into ESM bundle for CJS compatibility.\n * Creates a `require` function using Node's createRequire for packages\n * that internally use CommonJS require() for Node builtins.\n */\nconst ESM_CJS_COMPAT_BANNER =\n\t'import { createRequire } from \"module\"; const require = createRequire(import.meta.url);';\n\nexport interface BundleOptions {\n\t/** Entry point file (e.g., .gkm/server/server.ts) */\n\tentryPoint: string;\n\t/** Output directory for bundled files */\n\toutputDir: string;\n\t/** The bundle's file name in `outputDir`. Defaults to `server.mjs`. */\n\toutfile?: string;\n\t/** Minify the output (default: true) */\n\tminify: boolean;\n\t/** Generate sourcemaps (default: false) */\n\tsourcemap: boolean;\n\t/**\n\t * Packages to leave out of the bundle besides its native ones, which are\n\t * always left out and recorded beside it — see `externalsManifestName`.\n\t */\n\texternal: string[];\n\t/** Stage for secrets injection (optional) */\n\tstage?: string;\n\t/** Constructs to validate environment variables for */\n\tconstructs?: Construct[];\n}\n\nexport interface BundleResult {\n\t/** Path to the bundled output */\n\toutputPath: string;\n\t/** Ephemeral master key for deployment (only if stage was provided) */\n\tmasterKey?: string;\n\t/** What the bundle left out, at the version to install beside it. */\n\texternals: Record<string, string>;\n}\n\n/** The app a bundle is built for: the nearest `package.json` above its entry. */\nfunction appRootOf(entryPoint: string): string {\n\tlet dir = dirname(entryPoint);\n\twhile (!existsSync(join(dir, 'package.json'))) {\n\t\tconst parent = dirname(dir);\n\t\tif (parent === dir) return dirname(entryPoint);\n\t\tdir = parent;\n\t}\n\treturn dir;\n}\n\n/**\n * The esbuild binary, resolved from this package rather than from PATH.\n *\n * It used to be `npx esbuild`, which is two assumptions: that esbuild is\n * installed somewhere npx can find, and that the *app's* directory is where to\n * look. Neither holds — the CLI did not depend on esbuild at all, so a deploy\n * run from an app that had not installed it failed at the bundle step with\n * `sh: esbuild: command not found`, after provisioning had already happened.\n *\n * The same fix `bin/gkm.mjs` makes for tsx: resolve from this package's own\n * `node_modules`, so the tool the CLI shells out to is the one it depends on.\n */\nfunction esbuildBinary(): string {\n\tconst require = createRequire(import.meta.url);\n\n\ttry {\n\t\t// The package root, then its bin — `require.resolve('esbuild')` gives the\n\t\t// JS entry point, which is a library rather than the CLI.\n\t\tconst pkg = require.resolve('esbuild/package.json');\n\t\treturn join(dirname(pkg), 'bin', 'esbuild');\n\t} catch {\n\t\t// Better a PATH lookup than a hard failure: a project that installed\n\t\t// esbuild itself still works.\n\t\treturn 'esbuild';\n\t}\n}\n\n/**\n * Collect the environment variables a build cannot proceed without.\n *\n * Uses the SnifferEnvironmentParser to detect which env vars each service\n * reads, and keeps only the ones it cannot do without. `markOptional` is what\n * separates them: the sniffer already knows which reads went through\n * `.optional()` or `.default()`, and asking for that distinction is the\n * difference between a build that stops and one that proceeds correctly.\n *\n * Without it, a key that is *absent by design* failed the build. A surface\n * publishes `AUTH_COOKIE_DOMAIN` only when there is a domain to widen a cookie\n * to — one host has nothing to share it with, so the derivation correctly\n * yields nothing, and Better Auth reads it as optional for exactly that\n * reason. Treating every sniffed read as required made the honest answer\n * indistinguishable from a missing secret.\n *\n * @param constructs - Array of constructs to analyze\n * @returns Deduplicated, sorted names of the required variables\n */\nasync function collectRequiredEnvVars(\n\tconstructs: Construct[],\n): Promise<string[]> {\n\t// A key read optionally by one construct and required by another stays\n\t// required: the strictest read is the one that fails at runtime, and taking\n\t// the union of the required reads is what says so.\n\tconst required = new Set<string>();\n\n\tfor (const construct of constructs) {\n\t\tfor (const name of await construct.getEnvironment({ markOptional: true })) {\n\t\t\tif (!name.endsWith('?')) required.add(name);\n\t\t}\n\t}\n\n\treturn Array.from(required).sort();\n}\n\n/**\n * Bundle the server application using esbuild.\n * Creates a fully standalone bundle with all dependencies included.\n *\n * @param options - Bundle configuration options\n * @returns Bundle result with output path and optional master key\n */\n\nexport async function bundleServer(\n\toptions: BundleOptions,\n): Promise<BundleResult> {\n\tconst {\n\t\tentryPoint,\n\t\toutputDir,\n\t\tminify,\n\t\tsourcemap,\n\t\texternal,\n\t\tstage,\n\t\tconstructs,\n\t} = options;\n\n\t// Ensure output directory exists\n\tawait mkdir(outputDir, { recursive: true });\n\n\tconst outfile = options.outfile ?? 'server.mjs';\n\tconst mjsOutput = join(outputDir, outfile);\n\n\t// A package with native code loads a binary from beside its own source,\n\t// built for the platform it was installed on: inlined, it finds neither.\n\t// Every one the app could reach stays out of the bundle, and the ones the\n\t// bundle imports are installed for the image's platform at this version.\n\tconst candidates = bundleExternals(appRootOf(entryPoint), external);\n\tconst metafile = join(outputDir, `.${outfile}.meta.json`);\n\n\t// Build command-line arguments for esbuild\n\tconst args = [\n\t\tesbuildBinary(),\n\t\tentryPoint,\n\t\t'--bundle',\n\t\t'--platform=node',\n\t\t'--target=node22',\n\t\t'--format=esm',\n\t\t`--outfile=${mjsOutput}`,\n\t\t'--packages=bundle', // Bundle all dependencies for standalone output\n\t\t`--banner:js=${ESM_CJS_COMPAT_BANNER}`, // CJS compatibility for packages like pino\n\t\t`--metafile=${metafile}`,\n\t];\n\n\tif (minify) {\n\t\t// Names kept: an error's class name is what a log line's `err.type` and\n\t\t// a response's `name` say, and minified they read `_6`.\n\t\targs.push('--minify', '--keep-names');\n\t}\n\n\tif (sourcemap) {\n\t\targs.push('--sourcemap');\n\t}\n\n\tfor (const ext of Object.keys(candidates)) {\n\t\targs.push(`--external:${ext}`);\n\t}\n\n\t// Handle secrets injection if stage is provided\n\tlet masterKey: string | undefined;\n\n\tif (stage) {\n\t\tconst {\n\t\t\ttoEmbeddableSecrets,\n\t\t\tvalidateEnvironmentVariables,\n\t\t\tinitStageSecrets,\n\t\t} = await import('../secrets/storage');\n\t\tconst { FileSecretsStore, secretsStoreFor } = await import(\n\t\t\t'../secrets/store'\n\t\t);\n\t\tconst { ConfigNotFound, loadWorkspaceSettings } = await import('../config');\n\t\tconst { encryptSecrets, generateDefineOptions } = await import(\n\t\t\t'../secrets/encryption'\n\t\t);\n\n\t\t// The stage's own store — SSM or Secrets Manager for a deployed stage\n\t\t// kept there. Outside\n\t\t// any workspace nothing names one, so it is the file.\n\t\tconst store = await loadWorkspaceSettings().then(\n\t\t\t(workspace) => secretsStoreFor(workspace, stage),\n\t\t\t(error) => {\n\t\t\t\tif (error instanceof ConfigNotFound) {\n\t\t\t\t\treturn new FileSecretsStore(process.cwd());\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t);\n\t\tlet secrets = await store.read(stage);\n\n\t\tif (!secrets) {\n\t\t\t// Auto-initialize secrets for the stage\n\t\t\tconsole.log(` Initializing secrets for stage \"${stage}\"...`);\n\t\t\tsecrets = initStageSecrets(stage);\n\t\t\tawait store.write(stage, secrets);\n\t\t\tconsole.log(` ✓ Created the \"${stage}\" secrets (${store.name})`);\n\t\t}\n\n\t\t// Validate environment variables if constructs are provided\n\t\tif (constructs && constructs.length > 0) {\n\t\t\tconsole.log(' Analyzing environment variable requirements...');\n\t\t\tconst requiredVars = await collectRequiredEnvVars(constructs);\n\n\t\t\tif (requiredVars.length > 0) {\n\t\t\t\tconst validation = validateEnvironmentVariables(requiredVars, secrets);\n\n\t\t\t\tif (!validation.valid) {\n\t\t\t\t\tconst errorMessage = [\n\t\t\t\t\t\t`Missing environment variables for stage \"${stage}\":`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t...validation.missing.map((v) => ` ❌ ${v}`),\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'To fix this, either:',\n\t\t\t\t\t\t` 1. Add the missing variables to the \"${stage}\" secrets using:`,\n\t\t\t\t\t\t` gkm secrets:set <KEY> <VALUE> --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t` 2. Or import from a JSON file:`,\n\t\t\t\t\t\t` gkm secrets:import secrets.json --stage ${stage}`,\n\t\t\t\t\t\t'',\n\t\t\t\t\t\t'Required variables:',\n\t\t\t\t\t\t...validation.required.map((v) =>\n\t\t\t\t\t\t\tvalidation.missing.includes(v) ? ` ❌ ${v}` : ` ✓ ${v}`,\n\t\t\t\t\t\t),\n\t\t\t\t\t].join('\\n');\n\n\t\t\t\t\tthrow new Error(errorMessage);\n\t\t\t\t}\n\n\t\t\t\tconsole.log(\n\t\t\t\t\t` ✓ All ${requiredVars.length} required environment variables found`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Convert to embeddable format and encrypt\n\t\tconst embeddable = toEmbeddableSecrets(secrets);\n\t\tconst encrypted = encryptSecrets(embeddable);\n\t\tmasterKey = encrypted.masterKey;\n\n\t\t// Add define options for build-time injection using esbuild's --define:KEY=VALUE format\n\t\tconst defines = generateDefineOptions(encrypted);\n\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t// `value` is already a JS string literal; quoting it again would\n\t\t\t// embed the quotes, and the IV would not parse as hex.\n\t\t\targs.push(`--define:${key}=${value}`);\n\t\t}\n\n\t\tconsole.log(` Secrets encrypted for stage \"${stage}\"`);\n\t} else {\n\t\t// Credentials encrypted elsewhere — an image build hands them in as a\n\t\t// BuildKit secret and writes them beside the app's `.gkm/server` — are\n\t\t// embedded as they are; whoever encrypted them holds the key.\n\t\tconst gkmDir = join(outputDir, '..', '..');\n\t\tconst encryptedPath = join(gkmDir, 'credentials.enc');\n\t\tconst ivPath = join(gkmDir, 'credentials.iv');\n\t\tif (existsSync(encryptedPath) && existsSync(ivPath)) {\n\t\t\tconst { generateDefineOptions } = await import('../secrets/encryption');\n\t\t\tconst defines = generateDefineOptions({\n\t\t\t\tencrypted: readFileSync(encryptedPath, 'utf-8').trim(),\n\t\t\t\tiv: readFileSync(ivPath, 'utf-8').trim(),\n\t\t\t\tmasterKey: '',\n\t\t\t});\n\t\t\tfor (const [key, value] of Object.entries(defines)) {\n\t\t\t\targs.push(`--define:${key}=${value}`);\n\t\t\t}\n\t\t\tconsole.log(' Embedded the encrypted credentials the build was given');\n\t\t}\n\t}\n\n\ttry {\n\t\t// Run esbuild with command-line arguments\n\t\tconst [cmd, ...cmdArgs] = args as [string, ...string[]];\n\t\tconst result = spawnSync(cmd, cmdArgs, {\n\t\t\tcwd: process.cwd(),\n\t\t\tstdio: 'inherit',\n\t\t\tshell: process.platform === 'win32', // Only use shell on Windows for npx resolution\n\t\t});\n\n\t\tif (result.error) {\n\t\t\tthrow result.error;\n\t\t}\n\t\tif (result.status !== 0) {\n\t\t\tthrow new Error(`esbuild exited with code ${result.status}`);\n\t\t}\n\n\t\t// Add shebang to the bundled file\n\t\tconst { readFile } = await import('node:fs/promises');\n\t\tconst content = await readFile(mjsOutput, 'utf-8');\n\t\tif (!content.startsWith('#!')) {\n\t\t\tawait writeFile(mjsOutput, `#!/usr/bin/env node\\n${content}`);\n\t\t}\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to bundle server: ${error instanceof Error ? error.message : 'Unknown error'}`,\n\t\t);\n\t}\n\n\t// Declared ones always; a native package only where the bundle imports it\n\t// — an app that depends on `@geekmidas/cli` reaches esbuild, and never\n\t// runs it.\n\tconst imported = importedPackages(metafile);\n\tawait rm(metafile, { force: true });\n\tconst externals = Object.fromEntries(\n\t\tObject.entries(candidates).filter(\n\t\t\t([name]) => external.includes(name) || imported.has(name),\n\t\t),\n\t);\n\tawait writeFile(\n\t\tjoin(outputDir, externalsManifestName(outfile)),\n\t\t`${JSON.stringify({ private: true, dependencies: externals }, null, 2)}\\n`,\n\t);\n\tif (Object.keys(externals).length > 0) {\n\t\tconsole.log(\n\t\t\t` Left out of the bundle, installed beside it: ${Object.keys(externals).join(', ')}`,\n\t\t);\n\t}\n\n\treturn {\n\t\toutputPath: mjsOutput,\n\t\tmasterKey,\n\t\texternals,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,wBACL;;AAkCD,SAAS,UAAU,YAA4B;CAC9C,IAAI,MAAM,QAAQ,UAAU;CAC5B,OAAO,CAAC,WAAW,KAAK,KAAK,cAAc,CAAC,GAAG;EAC9C,MAAM,SAAS,QAAQ,GAAG;EAC1B,IAAI,WAAW,KAAK,OAAO,QAAQ,UAAU;EAC7C,MAAM;CACP;CACA,OAAO;AACR;;;;;;;;;;;;;AAcA,SAAS,gBAAwB;CAChC,MAAM,UAAU,cAAc,YAAY,GAAG;CAE7C,IAAI;EAGH,MAAM,MAAM,QAAQ,QAAQ,sBAAsB;EAClD,OAAO,KAAK,QAAQ,GAAG,GAAG,OAAO,SAAS;CAC3C,QAAQ;E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D,CACD;CACA,MAAM,UACL,KAAK,WAAW,sBAAsB,OAAO,CAAC,GAC9C,GAAG,KAAK,UAAU;EAAE,SAAS;EAAM,cAAc;CAAU,GAAG,MAAM,CAAC,EAAE,GACxE;CACA,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,SAAS,GACnC,QAAQ,IACP,kDAAkD,OAAO,KAAK,SAAS,CAAC,CAAC,KAAK,IAAI,GACnF;CAGD,OAAO;EACN,YAAY;EACZ;EACA;CACD;AACD"}
@@ -1,9 +1,9 @@
1
- import { r as storedCredentials } from "./credentials-CKIeLL7T.mjs";
1
+ import { r as storedCredentials } from "./credentials-DmNpxlFO.mjs";
2
2
  import { loadRawWorkspaceConfig } from "./config.mjs";
3
- import { t as deploy } from "./deploy-CjubyZlP.mjs";
3
+ import { t as deploy } from "./deploy-Qa7wXYS4.mjs";
4
4
  import { s as formatError } from "./index.mjs";
5
5
  import { n as targetForProvider } from "./provider-CEOKk8NS.mjs";
6
- import { terminalCredentials } from "./terminal-BRAIvH83.mjs";
6
+ import { terminalCredentials } from "./terminal-D92VjzyD.mjs";
7
7
  //#region src/deploy/cli.ts
8
8
  /**
9
9
  * `gkm deploy`: the terminal around `deploy()`. CLI layer only.
@@ -77,4 +77,4 @@ async function deployCli(options, streams = { stdout: process.stdout }) {
77
77
  //#endregion
78
78
  export { deployCli };
79
79
 
80
- //# sourceMappingURL=cli-Qm-8tG46.mjs.map
80
+ //# sourceMappingURL=cli-BFEuBKiU.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-Qm-8tG46.mjs","names":[],"sources":["../src/deploy/cli.ts"],"sourcesContent":["/**\n * `gkm deploy`: the terminal around `deploy()`. CLI layer only.\n *\n * Everything that belongs to a person at a terminal lives here and nowhere\n * below it: prompting for a missing login (and storing it), printing progress,\n * and turning the outcome into an exit code. The deploy itself is the same\n * `deploy()` a host calls.\n */\n\nimport { loadRawWorkspaceConfig } from '../config';\nimport { formatError } from '../debug';\nimport { targetForProvider } from '../target/provider';\nimport { storedCredentials } from './credentials';\nimport { deploy } from './deploy';\nimport { terminalCredentials } from './terminal';\n\nexport interface DeployCliOptions {\n\t/** The project directory: `--cwd`, else where the command was run. */\n\tcwd: string;\n\t/** `--target`: where to deploy. Defaults to `deploy.default`. */\n\ttarget?: string;\n\t/** `--provider`, deprecated: `dokploy` means `--target dokploy`. */\n\tprovider?: string;\n\tstage: string;\n\ttag?: string;\n\t/**\n\t * Print each event as one JSON object per line on stdout, instead of the\n\t * progress lines. Nothing prompts: a missing credential fails the run.\n\t */\n\tjson?: boolean;\n\t/** Plan only: create, change, build and push nothing. */\n\tdryRun?: boolean;\n\t/** On a failed release, roll back every app, not only the failed ones. */\n\tatomic?: boolean;\n\t/** `--allow-dev-services`. */\n\tallowDevServices?: boolean;\n\t/** `--skip-dns`. */\n\tskipDns?: boolean;\n\t/** `--rotate-keys`. */\n\trotateKeys?: boolean;\n\t/** `--retire-old-keys`. */\n\tretireOldKeys?: boolean;\n}\n\n/** Where the command writes. The process's own streams, outside tests. */\nexport interface DeployCliStreams {\n\tstdout: Pick<NodeJS.WriteStream, 'write'>;\n}\n\n/**\n * Run `gkm deploy` and resolve with its exit code: 0 when the run finished,\n * 1 when anything stopped it.\n */\nexport async function deployCli(\n\toptions: DeployCliOptions,\n\tstreams: DeployCliStreams = { stdout: process.stdout },\n): Promise<number> {\n\tlet target = options.target;\n\tif (options.provider !== undefined && target === undefined) {\n\t\ttry {\n\t\t\t// On stderr, so a `--json` run's stdout still carries only events.\n\t\t\ttarget = targetForProvider(options.provider, (message) =>\n\t\t\t\tconsole.warn(message),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.error(formatError(error));\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t// Loaded here, with the environment `gkm deploy` was run in, and handed\n\t// to the run: a reload in its sandbox sees only an allowlist of it, so a\n\t// setting the config reads from the environment would differ by step.\n\tlet config: Awaited<ReturnType<typeof loadRawWorkspaceConfig>>['config'];\n\ttry {\n\t\t({ config } = await loadRawWorkspaceConfig(options.cwd));\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n\n\tconst input = {\n\t\tcwd: options.cwd,\n\t\tconfig,\n\t\tstage: options.stage,\n\t\t...(target ? { target } : {}),\n\t\t...(options.tag ? { tag: options.tag } : {}),\n\t\t...(options.dryRun ? { dryRun: true } : {}),\n\t\t...(options.atomic ? { atomic: true } : {}),\n\t\t...(options.allowDevServices ? { allowDevServices: true } : {}),\n\t\t...(options.skipDns ? { skipDns: true } : {}),\n\t\t...(options.rotateKeys ? { rotateKeys: true } : {}),\n\t\t...(options.retireOldKeys ? { retireOldKeys: true } : {}),\n\t};\n\n\tif (options.json) {\n\t\t// stdout carries the events and nothing else: docker's own output goes\n\t\t// to stderr, and nobody is asked anything — a prompt would be written\n\t\t// into the stream a program is parsing.\n\t\tconst run = deploy({\n\t\t\t...input,\n\t\t\tcredentials: storedCredentials(),\n\t\t\tchildOutput: 'stderr',\n\t\t});\n\t\tfor await (const event of run) {\n\t\t\tstreams.stdout.write(`${JSON.stringify(event)}\\n`);\n\t\t}\n\t\treturn run.result.then(\n\t\t\t() => 0,\n\t\t\t(error) => {\n\t\t\t\tconsole.error(formatError(error));\n\t\t\t\treturn 1;\n\t\t\t},\n\t\t);\n\t}\n\n\t// The lines arrive as they are written, rather than as events read back a\n\t// tick later, so they interleave with a prompt exactly as they always did.\n\tconst run = deploy({\n\t\t...input,\n\t\tcredentials: terminalCredentials(storedCredentials()),\n\t\tlogger: {\n\t\t\tinfo: (message) => console.log(message),\n\t\t\twarn: (message) => console.warn(message),\n\t\t\terror: (message) => console.error(message),\n\t\t},\n\t});\n\n\ttry {\n\t\tawait run.result;\n\t\treturn 0;\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,UACrB,SACA,UAA4B,EAAE,QAAQ,QAAQ,OAAO,GACnC;CAClB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kB,CAAC;EACpD,QAAQ;GACP,OAAO,YAAY,QAAQ,IAAI,OAAO;GACtC,OAAO,YAAY,QAAQ,KAAK,OAAO;GACvC,QAAQ,YAAY,QAAQ,MAAM,OAAO;EAC1C;CACD,CAAC;CAED,IAAI;EACH,MAAM,IAAI;EACV,OAAO;CACR,SAAS,OAAO;EACf,QAAQ,MAAM,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;AACD"}
1
+ {"version":3,"file":"cli-BFEuBKiU.mjs","names":[],"sources":["../src/deploy/cli.ts"],"sourcesContent":["/**\n * `gkm deploy`: the terminal around `deploy()`. CLI layer only.\n *\n * Everything that belongs to a person at a terminal lives here and nowhere\n * below it: prompting for a missing login (and storing it), printing progress,\n * and turning the outcome into an exit code. The deploy itself is the same\n * `deploy()` a host calls.\n */\n\nimport { loadRawWorkspaceConfig } from '../config';\nimport { formatError } from '../debug';\nimport { targetForProvider } from '../target/provider';\nimport { storedCredentials } from './credentials';\nimport { deploy } from './deploy';\nimport { terminalCredentials } from './terminal';\n\nexport interface DeployCliOptions {\n\t/** The project directory: `--cwd`, else where the command was run. */\n\tcwd: string;\n\t/** `--target`: where to deploy. Defaults to `deploy.default`. */\n\ttarget?: string;\n\t/** `--provider`, deprecated: `dokploy` means `--target dokploy`. */\n\tprovider?: string;\n\tstage: string;\n\ttag?: string;\n\t/**\n\t * Print each event as one JSON object per line on stdout, instead of the\n\t * progress lines. Nothing prompts: a missing credential fails the run.\n\t */\n\tjson?: boolean;\n\t/** Plan only: create, change, build and push nothing. */\n\tdryRun?: boolean;\n\t/** On a failed release, roll back every app, not only the failed ones. */\n\tatomic?: boolean;\n\t/** `--allow-dev-services`. */\n\tallowDevServices?: boolean;\n\t/** `--skip-dns`. */\n\tskipDns?: boolean;\n\t/** `--rotate-keys`. */\n\trotateKeys?: boolean;\n\t/** `--retire-old-keys`. */\n\tretireOldKeys?: boolean;\n}\n\n/** Where the command writes. The process's own streams, outside tests. */\nexport interface DeployCliStreams {\n\tstdout: Pick<NodeJS.WriteStream, 'write'>;\n}\n\n/**\n * Run `gkm deploy` and resolve with its exit code: 0 when the run finished,\n * 1 when anything stopped it.\n */\nexport async function deployCli(\n\toptions: DeployCliOptions,\n\tstreams: DeployCliStreams = { stdout: process.stdout },\n): Promise<number> {\n\tlet target = options.target;\n\tif (options.provider !== undefined && target === undefined) {\n\t\ttry {\n\t\t\t// On stderr, so a `--json` run's stdout still carries only events.\n\t\t\ttarget = targetForProvider(options.provider, (message) =>\n\t\t\t\tconsole.warn(message),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.error(formatError(error));\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t// Loaded here, with the environment `gkm deploy` was run in, and handed\n\t// to the run: a reload in its sandbox sees only an allowlist of it, so a\n\t// setting the config reads from the environment would differ by step.\n\tlet config: Awaited<ReturnType<typeof loadRawWorkspaceConfig>>['config'];\n\ttry {\n\t\t({ config } = await loadRawWorkspaceConfig(options.cwd));\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n\n\tconst input = {\n\t\tcwd: options.cwd,\n\t\tconfig,\n\t\tstage: options.stage,\n\t\t...(target ? { target } : {}),\n\t\t...(options.tag ? { tag: options.tag } : {}),\n\t\t...(options.dryRun ? { dryRun: true } : {}),\n\t\t...(options.atomic ? { atomic: true } : {}),\n\t\t...(options.allowDevServices ? { allowDevServices: true } : {}),\n\t\t...(options.skipDns ? { skipDns: true } : {}),\n\t\t...(options.rotateKeys ? { rotateKeys: true } : {}),\n\t\t...(options.retireOldKeys ? { retireOldKeys: true } : {}),\n\t};\n\n\tif (options.json) {\n\t\t// stdout carries the events and nothing else: docker's own output goes\n\t\t// to stderr, and nobody is asked anything — a prompt would be written\n\t\t// into the stream a program is parsing.\n\t\tconst run = deploy({\n\t\t\t...input,\n\t\t\tcredentials: storedCredentials(),\n\t\t\tchildOutput: 'stderr',\n\t\t});\n\t\tfor await (const event of run) {\n\t\t\tstreams.stdout.write(`${JSON.stringify(event)}\\n`);\n\t\t}\n\t\treturn run.result.then(\n\t\t\t() => 0,\n\t\t\t(error) => {\n\t\t\t\tconsole.error(formatError(error));\n\t\t\t\treturn 1;\n\t\t\t},\n\t\t);\n\t}\n\n\t// The lines arrive as they are written, rather than as events read back a\n\t// tick later, so they interleave with a prompt exactly as they always did.\n\tconst run = deploy({\n\t\t...input,\n\t\tcredentials: terminalCredentials(storedCredentials()),\n\t\tlogger: {\n\t\t\tinfo: (message) => console.log(message),\n\t\t\twarn: (message) => console.warn(message),\n\t\t\terror: (message) => console.error(message),\n\t\t},\n\t});\n\n\ttry {\n\t\tawait run.result;\n\t\treturn 0;\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,UACrB,SACA,UAA4B,EAAE,QAAQ,QAAQ,OAAO,GACnC;CAClB,IAAI,SAAS,QAAQ;CACrB,IAAI,QAAQ,aAAa,KAAA,KAAa,WAAW,KAAA,GAChD,IAAI;EAEH,SAAS,kBAAkB,QAAQ,WAAW,YAC7C,QAAQ,KAAK,OAAO,CACrB;CACD,SAAS,OAAO;EACf,QAAQ,MAAM,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;CAMD,IAAI;CACJ,IAAI;EACH,CAAC,CAAE,UAAW,MAAM,uBAAuB,QAAQ,GAAG;CACvD,SAAS,OAAO;EACf,QAAQ,MAAM,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;CAEA,MAAM,QAAQ;EACb,KAAK,QAAQ;EACb;EACA,OAAO,QAAQ;EACf,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC3B,GAAI,QAAQ,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;EAC1C,GAAI,QAAQ,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;EACzC,GAAI,QAAQ,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;EACzC,GAAI,QAAQ,mBAAmB,EAAE,kBAAkB,KAAK,IAAI,CAAC;EAC7D,GAAI,QAAQ,UAAU,EAAE,SAAS,KAAK,IAAI,CAAC;EAC3C,GAAI,QAAQ,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC;EACjD,GAAI,QAAQ,gBAAgB,EAAE,eAAe,KAAK,IAAI,CAAC;CACxD;CAEA,IAAI,QAAQ,MAAM;EAIjB,MAAM,MAAM,OAAO;GAClB,GAAG;GACH,aAAa,kBAAkB;GAC/B,aAAa;EACd,CAAC;EACD,WAAW,MAAM,SAAS,KACzB,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;EAElD,OAAO,IAAI,OAAO,WACX,IACL,UAAU;GACV,QAAQ,MAAM,YAAY,KAAK,CAAC;GAChC,OAAO;EACR,CACD;CACD;CAIA,MAAM,MAAM,OAAO;EAClB,GAAG;EACH,aAAa,oBAAoB,kBAAkB,CAAC;EACpD,QAAQ;GACP,OAAO,YAAY,QAAQ,IAAI,OAAO;GACtC,OAAO,YAAY,QAAQ,KAAK,OAAO;GACvC,QAAQ,YAAY,QAAQ,MAAM,OAAO;EAC1C;CACD,CAAC;CAED,IAAI;EACH,MAAM,IAAI;EACV,OAAO;CACR,SAAS,OAAO;EACf,QAAQ,MAAM,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;AACD"}
@@ -1,9 +1,9 @@
1
- const require_credentials = require("./credentials-DzR2j8h1.cjs");
1
+ const require_credentials = require("./credentials-BAeWfaj3.cjs");
2
2
  const require_config = require("./config.cjs");
3
- const require_deploy = require("./deploy-DQjEjUfB.cjs");
3
+ const require_deploy = require("./deploy-DHrbzHxT.cjs");
4
4
  const require_index = require("./index.cjs");
5
5
  const require_provider = require("./provider-BqpjG9QM.cjs");
6
- const require_terminal = require("./terminal-BDRxzEZD.cjs");
6
+ const require_terminal = require("./terminal-Bc0XhkqW.cjs");
7
7
  //#region src/deploy/cli.ts
8
8
  /**
9
9
  * `gkm deploy`: the terminal around `deploy()`. CLI layer only.
@@ -77,4 +77,4 @@ async function deployCli(options, streams = { stdout: process.stdout }) {
77
77
  //#endregion
78
78
  exports.deployCli = deployCli;
79
79
 
80
- //# sourceMappingURL=cli-CYeZF85I.cjs.map
80
+ //# sourceMappingURL=cli-DXGl3fsc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-CYeZF85I.cjs","names":["targetForProvider","formatError","loadRawWorkspaceConfig","deploy","storedCredentials","terminalCredentials"],"sources":["../src/deploy/cli.ts"],"sourcesContent":["/**\n * `gkm deploy`: the terminal around `deploy()`. CLI layer only.\n *\n * Everything that belongs to a person at a terminal lives here and nowhere\n * below it: prompting for a missing login (and storing it), printing progress,\n * and turning the outcome into an exit code. The deploy itself is the same\n * `deploy()` a host calls.\n */\n\nimport { loadRawWorkspaceConfig } from '../config';\nimport { formatError } from '../debug';\nimport { targetForProvider } from '../target/provider';\nimport { storedCredentials } from './credentials';\nimport { deploy } from './deploy';\nimport { terminalCredentials } from './terminal';\n\nexport interface DeployCliOptions {\n\t/** The project directory: `--cwd`, else where the command was run. */\n\tcwd: string;\n\t/** `--target`: where to deploy. Defaults to `deploy.default`. */\n\ttarget?: string;\n\t/** `--provider`, deprecated: `dokploy` means `--target dokploy`. */\n\tprovider?: string;\n\tstage: string;\n\ttag?: string;\n\t/**\n\t * Print each event as one JSON object per line on stdout, instead of the\n\t * progress lines. Nothing prompts: a missing credential fails the run.\n\t */\n\tjson?: boolean;\n\t/** Plan only: create, change, build and push nothing. */\n\tdryRun?: boolean;\n\t/** On a failed release, roll back every app, not only the failed ones. */\n\tatomic?: boolean;\n\t/** `--allow-dev-services`. */\n\tallowDevServices?: boolean;\n\t/** `--skip-dns`. */\n\tskipDns?: boolean;\n\t/** `--rotate-keys`. */\n\trotateKeys?: boolean;\n\t/** `--retire-old-keys`. */\n\tretireOldKeys?: boolean;\n}\n\n/** Where the command writes. The process's own streams, outside tests. */\nexport interface DeployCliStreams {\n\tstdout: Pick<NodeJS.WriteStream, 'write'>;\n}\n\n/**\n * Run `gkm deploy` and resolve with its exit code: 0 when the run finished,\n * 1 when anything stopped it.\n */\nexport async function deployCli(\n\toptions: DeployCliOptions,\n\tstreams: DeployCliStreams = { stdout: process.stdout },\n): Promise<number> {\n\tlet target = options.target;\n\tif (options.provider !== undefined && target === undefined) {\n\t\ttry {\n\t\t\t// On stderr, so a `--json` run's stdout still carries only events.\n\t\t\ttarget = targetForProvider(options.provider, (message) =>\n\t\t\t\tconsole.warn(message),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.error(formatError(error));\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t// Loaded here, with the environment `gkm deploy` was run in, and handed\n\t// to the run: a reload in its sandbox sees only an allowlist of it, so a\n\t// setting the config reads from the environment would differ by step.\n\tlet config: Awaited<ReturnType<typeof loadRawWorkspaceConfig>>['config'];\n\ttry {\n\t\t({ config } = await loadRawWorkspaceConfig(options.cwd));\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n\n\tconst input = {\n\t\tcwd: options.cwd,\n\t\tconfig,\n\t\tstage: options.stage,\n\t\t...(target ? { target } : {}),\n\t\t...(options.tag ? { tag: options.tag } : {}),\n\t\t...(options.dryRun ? { dryRun: true } : {}),\n\t\t...(options.atomic ? { atomic: true } : {}),\n\t\t...(options.allowDevServices ? { allowDevServices: true } : {}),\n\t\t...(options.skipDns ? { skipDns: true } : {}),\n\t\t...(options.rotateKeys ? { rotateKeys: true } : {}),\n\t\t...(options.retireOldKeys ? { retireOldKeys: true } : {}),\n\t};\n\n\tif (options.json) {\n\t\t// stdout carries the events and nothing else: docker's own output goes\n\t\t// to stderr, and nobody is asked anything — a prompt would be written\n\t\t// into the stream a program is parsing.\n\t\tconst run = deploy({\n\t\t\t...input,\n\t\t\tcredentials: storedCredentials(),\n\t\t\tchildOutput: 'stderr',\n\t\t});\n\t\tfor await (const event of run) {\n\t\t\tstreams.stdout.write(`${JSON.stringify(event)}\\n`);\n\t\t}\n\t\treturn run.result.then(\n\t\t\t() => 0,\n\t\t\t(error) => {\n\t\t\t\tconsole.error(formatError(error));\n\t\t\t\treturn 1;\n\t\t\t},\n\t\t);\n\t}\n\n\t// The lines arrive as they are written, rather than as events read back a\n\t// tick later, so they interleave with a prompt exactly as they always did.\n\tconst run = deploy({\n\t\t...input,\n\t\tcredentials: terminalCredentials(storedCredentials()),\n\t\tlogger: {\n\t\t\tinfo: (message) => console.log(message),\n\t\t\twarn: (message) => console.warn(message),\n\t\t\terror: (message) => console.error(message),\n\t\t},\n\t});\n\n\ttry {\n\t\tawait run.result;\n\t\treturn 0;\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,UACrB,SACA,UAA4B,EAAE,QAAQ,QAAQ,OAAO,GACnC;CAClB,IAAI,SAAS,QAAQ;CACrB,IAAI,QAAQ,aAAa,KAAA,KAAa,WAAW,KAAA,GAChD,IAAI;EAEH,SAASA,iBAAAA,kBAAkB,QAAQ,WAAW,YAC7C,QAAQ,KAAK,OAAO,CACrB;CACD,SAAS,OAAO;EACf,QAAQ,MAAMC,cAAAA,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;CAMD,IAAI;CACJ,IAAI;EACH,CAAC,CAAE,UAAW,MAAMC,eAAAA,uBAAuB,QAAQ,GAAG;CACvD,SAAS,OAAO;EACf,QAAQ,MAAMD,cAAAA,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;CAEA,MAAM,QAAQ;EACb,KAAK,QAAQ;EACb;EACA,OAAO,QAAQ;EACf,GAAI,SAAS,EAAE,OAAO,IAAI,CAAC;EAC3B,GAAI,QAAQ,MAAM,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC;EAC1C,GAAI,QAAQ,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;EACzC,GAAI,QAAQ,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;EACzC,GAAI,QAAQ,mBAAmB,EAAE,kBAAkB,KAAK,IAAI,CAAC;EAC7D,GAAI,QAAQ,UAAU,EAAE,SAAS,KAAK,IAAI,CAAC;EAC3C,GAAI,QAAQ,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC;EACjD,GAAI,QAAQ,gBAAgB,EAAE,eAAe,KAAK,IAAI,CAAC;CACxD;CAEA,IAAI,QAAQ,MAAM;EAIjB,MAAM,MAAME,eAAAA,OAAO;GAClB,GAAG;GACH,aAAaC,oBAAAA,kBAAkB;GAC/B,aAAa;EACd,CAAC;EACD,WAAW,MAAM,SAAS,KACzB,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,KAAK,EAAE,GAAG;EAElD,OAAO,IAAI,OAAO,WACX,IACL,UAAU;GACV,QAAQ,MAAMH,cAAAA,YAAY,KAAK,CAAC;GAChC,OAAO;EACR,CACD;CACD;CAIA,MAAM,MAAME,eAAAA,OAAO;EAClB,GAAG;EACH,aAAaE,iBAAAA,oBAAoBD,oBAAAA,kBAAkB,CAAC;EACpD,QAAQ;GACP,OAAO,YAAY,QAAQ,IAAI,OAAO;GACtC,OAAO,YAAY,QAAQ,KAAK,OAAO;GACvC,QAAQ,YAAY,QAAQ,MAAM,OAAO;EAC1C;CACD,CAAC;CAED,IAAI;EACH,MAAM,IAAI;EACV,OAAO;CACR,SAAS,OAAO;EACf,QAAQ,MAAMH,cAAAA,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;AACD"}
1
+ {"version":3,"file":"cli-DXGl3fsc.cjs","names":["targetForProvider","formatError","loadRawWorkspaceConfig","deploy","storedCredentials","terminalCredentials"],"sources":["../src/deploy/cli.ts"],"sourcesContent":["/**\n * `gkm deploy`: the terminal around `deploy()`. CLI layer only.\n *\n * Everything that belongs to a person at a terminal lives here and nowhere\n * below it: prompting for a missing login (and storing it), printing progress,\n * and turning the outcome into an exit code. The deploy itself is the same\n * `deploy()` a host calls.\n */\n\nimport { loadRawWorkspaceConfig } from '../config';\nimport { formatError } from '../debug';\nimport { targetForProvider } from '../target/provider';\nimport { storedCredentials } from './credentials';\nimport { deploy } from './deploy';\nimport { terminalCredentials } from './terminal';\n\nexport interface DeployCliOptions {\n\t/** The project directory: `--cwd`, else where the command was run. */\n\tcwd: string;\n\t/** `--target`: where to deploy. Defaults to `deploy.default`. */\n\ttarget?: string;\n\t/** `--provider`, deprecated: `dokploy` means `--target dokploy`. */\n\tprovider?: string;\n\tstage: string;\n\ttag?: string;\n\t/**\n\t * Print each event as one JSON object per line on stdout, instead of the\n\t * progress lines. Nothing prompts: a missing credential fails the run.\n\t */\n\tjson?: boolean;\n\t/** Plan only: create, change, build and push nothing. */\n\tdryRun?: boolean;\n\t/** On a failed release, roll back every app, not only the failed ones. */\n\tatomic?: boolean;\n\t/** `--allow-dev-services`. */\n\tallowDevServices?: boolean;\n\t/** `--skip-dns`. */\n\tskipDns?: boolean;\n\t/** `--rotate-keys`. */\n\trotateKeys?: boolean;\n\t/** `--retire-old-keys`. */\n\tretireOldKeys?: boolean;\n}\n\n/** Where the command writes. The process's own streams, outside tests. */\nexport interface DeployCliStreams {\n\tstdout: Pick<NodeJS.WriteStream, 'write'>;\n}\n\n/**\n * Run `gkm deploy` and resolve with its exit code: 0 when the run finished,\n * 1 when anything stopped it.\n */\nexport async function deployCli(\n\toptions: DeployCliOptions,\n\tstreams: DeployCliStreams = { stdout: process.stdout },\n): Promise<number> {\n\tlet target = options.target;\n\tif (options.provider !== undefined && target === undefined) {\n\t\ttry {\n\t\t\t// On stderr, so a `--json` run's stdout still carries only events.\n\t\t\ttarget = targetForProvider(options.provider, (message) =>\n\t\t\t\tconsole.warn(message),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.error(formatError(error));\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t// Loaded here, with the environment `gkm deploy` was run in, and handed\n\t// to the run: a reload in its sandbox sees only an allowlist of it, so a\n\t// setting the config reads from the environment would differ by step.\n\tlet config: Awaited<ReturnType<typeof loadRawWorkspaceConfig>>['config'];\n\ttry {\n\t\t({ config } = await loadRawWorkspaceConfig(options.cwd));\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n\n\tconst input = {\n\t\tcwd: options.cwd,\n\t\tconfig,\n\t\tstage: options.stage,\n\t\t...(target ? { target } : {}),\n\t\t...(options.tag ? { tag: options.tag } : {}),\n\t\t...(options.dryRun ? { dryRun: true } : {}),\n\t\t...(options.atomic ? { atomic: true } : {}),\n\t\t...(options.allowDevServices ? { allowDevServices: true } : {}),\n\t\t...(options.skipDns ? { skipDns: true } : {}),\n\t\t...(options.rotateKeys ? { rotateKeys: true } : {}),\n\t\t...(options.retireOldKeys ? { retireOldKeys: true } : {}),\n\t};\n\n\tif (options.json) {\n\t\t// stdout carries the events and nothing else: docker's own output goes\n\t\t// to stderr, and nobody is asked anything — a prompt would be written\n\t\t// into the stream a program is parsing.\n\t\tconst run = deploy({\n\t\t\t...input,\n\t\t\tcredentials: storedCredentials(),\n\t\t\tchildOutput: 'stderr',\n\t\t});\n\t\tfor await (const event of run) {\n\t\t\tstreams.stdout.write(`${JSON.stringify(event)}\\n`);\n\t\t}\n\t\treturn run.result.then(\n\t\t\t() => 0,\n\t\t\t(error) => {\n\t\t\t\tconsole.error(formatError(error));\n\t\t\t\treturn 1;\n\t\t\t},\n\t\t);\n\t}\n\n\t// The lines arrive as they are written, rather than as events read back a\n\t// tick later, so they interleave with a prompt exactly as they always did.\n\tconst run = deploy({\n\t\t...input,\n\t\tcredentials: terminalCredentials(storedCredentials()),\n\t\tlogger: {\n\t\t\tinfo: (message) => console.log(message),\n\t\t\twarn: (message) => console.warn(message),\n\t\t\terror: (message) => console.error(message),\n\t\t},\n\t});\n\n\ttry {\n\t\tawait run.result;\n\t\treturn 0;\n\t} catch (error) {\n\t\tconsole.error(formatError(error));\n\t\treturn 1;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,UACrB,SACA,UAA4B,EAAE,QAA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GAChC,OAAO;EACR,CACD;CACD;CAIA,MAAM,MAAME,eAAAA,OAAO;EAClB,GAAG;EACH,aAAaE,iBAAAA,oBAAoBD,oBAAAA,kBAAkB,CAAC;EACpD,QAAQ;GACP,OAAO,YAAY,QAAQ,IAAI,OAAO;GACtC,OAAO,YAAY,QAAQ,KAAK,OAAO;GACvC,QAAQ,YAAY,QAAQ,MAAM,OAAO;EAC1C;CACD,CAAC;CAED,IAAI;EACH,MAAM,IAAI;EACV,OAAO;CACR,SAAS,OAAO;EACf,QAAQ,MAAMH,cAAAA,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;AACD"}
@@ -1,14 +1,14 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
2
  const require_errors = require("./errors-DMC4Umsb.cjs");
3
- const require_credentials = require("./credentials-DzR2j8h1.cjs");
4
- const require_workspace = require("./workspace-CEpojAus.cjs");
5
- const require_apps = require("./apps-BGu47YRF.cjs");
3
+ const require_credentials = require("./credentials-BAeWfaj3.cjs");
4
+ const require_workspace = require("./workspace-LR9DFjU8.cjs");
5
+ const require_apps = require("./apps-CTyacCpW.cjs");
6
6
  const require_define = require("./define-crmMcXFS.cjs");
7
- const require_compose = require("./compose-CshnO-Th.cjs");
7
+ const require_compose = require("./compose-DpDrZwZS.cjs");
8
8
  const require_discover = require("./discover-39VKSE2i.cjs");
9
- const require_stack = require("./stack-A3evQgbk.cjs");
10
- const require_docker = require("./docker-CSEAKwFr.cjs");
11
- const require_snsSubscriptions = require("./snsSubscriptions-B8TYeAM-.cjs");
9
+ const require_stack = require("./stack-DKloCsy6.cjs");
10
+ const require_docker = require("./docker-C9ObsT80.cjs");
11
+ const require_snsSubscriptions = require("./snsSubscriptions-CXpZqb-Y.cjs");
12
12
  const require_drivers = require("./drivers-BhdC9Efj.cjs");
13
13
  const require_seeds = require("./seeds-Bc3niNVb.cjs");
14
14
  const require_databases = require("./databases-CuTL1e7s.cjs");
@@ -1124,8 +1124,8 @@ function deployedStackSecrets(workspace, stage, stored, manifest) {
1124
1124
  target: "compose",
1125
1125
  runtime: "server",
1126
1126
  selfHosted: true,
1127
- used: require_apps.usesTelemetry(manifest)
1128
- })?.provider === "self-hosted" ? require_compose.withLogsPassword(withSeed.secrets) : {
1127
+ used: require_compose.usesTelemetry(manifest)
1128
+ })?.provider === "self-hosted" ? require_compose.withLogsLogin(withSeed.secrets, workspace.domains?.[stage]) : {
1129
1129
  secrets: withSeed.secrets,
1130
1130
  generated: []
1131
1131
  };
@@ -1774,6 +1774,7 @@ async function validateCompose(ctx, deps, options = {}) {
1774
1774
  if (mode === "build") assertRedisClient(workspace, composed, manifest);
1775
1775
  const pinned = (unpinned) => options.pin ? withPinnedImages(unpinned, options.pin.file, options.pin.digests) : unpinned;
1776
1776
  const stack = pinned(composed);
1777
+ for (const warning of stack.warnings) ctx.logger.warn(`⚠ ${warning}`);
1777
1778
  if (mode === "pull" && !ctx.dryRun) await require_stack.assertImagesExist(deps.docker, tag, [
1778
1779
  ...stack.apps,
1779
1780
  ...stack.workers,
@@ -1863,6 +1864,7 @@ async function readyCompose(ctx, run, deps) {
1863
1864
  }
1864
1865
  if (run.server && !ctx.dryRun && !run.push) await deps.server.check(run.server);
1865
1866
  await edgeHostsFree(ctx, run, deps);
1867
+ await logsPortOnServer(ctx, run, deps);
1866
1868
  const prune = await stageHostsDns(ctx, deps, require_snsSubscriptions.stackHosts(stack).filter((host) => !require_snsSubscriptions.isLocalHost(host)), run.secrets?.custom, stack.wildcard?.host);
1867
1869
  if (prune) run.pruneDns = prune;
1868
1870
  }
@@ -1882,6 +1884,57 @@ async function edgeHostsFree(ctx, run, deps) {
1882
1884
  ...ref.output ? { output: ref.output } : {}
1883
1885
  }), stack.project, stack.traefik);
1884
1886
  }
1887
+ /** How many ports past the first a stage's OpenObserve is tried on. */
1888
+ const LOGS_PORT_TRIES = 100;
1889
+ /**
1890
+ * The loopback port the stack's OpenObserve is published on, settled against
1891
+ * what every other stack on the server publishes — before anything is
1892
+ * written, so two stages on one machine cannot both take `5080` and fail at
1893
+ * `up`.
1894
+ *
1895
+ * - A port the stage named is refused when another project holds it.
1896
+ * - Otherwise the stack keeps the port it already publishes, or takes the
1897
+ * first from the default up that no other project holds — and the stack,
1898
+ * its tunnel line included, is moved onto it.
1899
+ *
1900
+ * Asked of the server's engine, so not on a dry run, a push, or the local
1901
+ * stage; nor for a log UI served through the edge, which publishes nothing.
1902
+ *
1903
+ * @throws {LogsPortTaken}
1904
+ */
1905
+ async function logsPortOnServer(ctx, run, deps) {
1906
+ const logs = run.stack.logs;
1907
+ if (!logs || logs.public || run.stack.local) return;
1908
+ if (ctx.dryRun || run.push || !run.server) return;
1909
+ const engine = run.ref.host ? { host: run.ref.host } : {};
1910
+ const project = run.ref.project;
1911
+ const holder = async (port) => {
1912
+ const others = (await deps.docker.publishers(engine, port)).filter((held) => held.project !== project);
1913
+ return others[0] && (others[0].project ?? others[0].container);
1914
+ };
1915
+ if (logs.portSet) {
1916
+ const taken = await holder(logs.port);
1917
+ if (taken) throw new require_compose.LogsPortTaken(ctx.stage, logs.port, taken, true);
1918
+ return;
1919
+ }
1920
+ const kept = await deps.docker.published(engine, project, require_compose.LOGS_SERVICE, require_workspace.LOGS_PORT);
1921
+ let port = kept;
1922
+ if (port === void 0) {
1923
+ let taken;
1924
+ for (let next = logs.port; next < logs.port + LOGS_PORT_TRIES; next++) {
1925
+ taken = await holder(next);
1926
+ if (!taken) {
1927
+ port = next;
1928
+ break;
1929
+ }
1930
+ }
1931
+ if (port === void 0) throw new require_compose.LogsPortTaken(ctx.stage, logs.port, taken ?? "", false);
1932
+ }
1933
+ if (port !== logs.port) {
1934
+ ctx.logger.info(kept === void 0 ? `📜 OpenObserve: ${logs.port} is another stack's on this server, so "${ctx.stage}" publishes ${port}` : `📜 OpenObserve: "${ctx.stage}" keeps ${port}, the port it already publishes`);
1935
+ run.stack = require_stack.withLogsPort(run.stack, port);
1936
+ }
1937
+ }
1885
1938
  /** A stack whose caches are in Redis, built for an app that has no client. */
1886
1939
  var RedisClientMissing = class extends require_errors.GkmError {
1887
1940
  apps;
@@ -2008,7 +2061,7 @@ async function stageSecrets(ctx, manifest) {
2008
2061
  };
2009
2062
  const { secrets, generated } = deployedStackSecrets(ctx.workspace, ctx.stage, stored, manifest);
2010
2063
  if (secrets.seed) ctx.secrets.mask(secrets.seed);
2011
- for (const [key, value] of Object.entries(secrets.custom ?? {})) if (!require_workspace.isReservedStageKey(key)) ctx.secrets.mask(value);
2064
+ for (const [key, value] of Object.entries(secrets.custom ?? {})) if (!require_workspace.isReservedStageKey(key) && key !== "ZO_ROOT_USER_EMAIL") ctx.secrets.mask(value);
2012
2065
  return {
2013
2066
  secrets,
2014
2067
  generated
@@ -3237,4 +3290,4 @@ Object.defineProperty(exports, "stackOverrideFile", {
3237
3290
  }
3238
3291
  });
3239
3292
 
3240
- //# sourceMappingURL=compose-IsvqY6iX.cjs.map
3293
+ //# sourceMappingURL=compose-BNWFrHHE.cjs.map