@geekmidas/cli 10.0.0-alpha.11 → 10.0.0-alpha.110

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 (501) hide show
  1. package/README.md +315 -414
  2. package/bin/adjacent-tsconfig.mjs +46 -8
  3. package/bin/gkm.mjs +11 -3
  4. package/bin/owning-tsconfig-jsx-register.mjs +18 -0
  5. package/bin/owning-tsconfig-jsx.mjs +108 -0
  6. package/dist/EndpointGenerator-BwbYTMtB.cjs +1090 -0
  7. package/dist/EndpointGenerator-BwbYTMtB.cjs.map +1 -0
  8. package/dist/EndpointGenerator-CvLX8bpx.mjs +1031 -0
  9. package/dist/EndpointGenerator-CvLX8bpx.mjs.map +1 -0
  10. package/dist/GoDaddyProvider-CjeOduia.mjs +388 -0
  11. package/dist/GoDaddyProvider-CjeOduia.mjs.map +1 -0
  12. package/dist/GoDaddyProvider-qNUzTXI7.cjs +388 -0
  13. package/dist/GoDaddyProvider-qNUzTXI7.cjs.map +1 -0
  14. package/dist/{HostingerProvider-BcyFRbqV.mjs → HostingerProvider-BNpS9aRJ.mjs} +29 -25
  15. package/dist/HostingerProvider-BNpS9aRJ.mjs.map +1 -0
  16. package/dist/{HostingerProvider-BOvsgATO.cjs → HostingerProvider-DR1iws1P.cjs} +29 -25
  17. package/dist/HostingerProvider-DR1iws1P.cjs.map +1 -0
  18. package/dist/LegacyStateStore-MxiSu7KJ.cjs +124 -0
  19. package/dist/LegacyStateStore-MxiSu7KJ.cjs.map +1 -0
  20. package/dist/LegacyStateStore-pgscYsiG.mjs +124 -0
  21. package/dist/LegacyStateStore-pgscYsiG.mjs.map +1 -0
  22. package/dist/LocalStateStore-BcvyKbAw.mjs +167 -0
  23. package/dist/LocalStateStore-BcvyKbAw.mjs.map +1 -0
  24. package/dist/LocalStateStore-Bm8Vmwjb.cjs +178 -0
  25. package/dist/LocalStateStore-Bm8Vmwjb.cjs.map +1 -0
  26. package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs +541 -0
  27. package/dist/OpenApiTsGenerator-BD6ZOQ51.cjs.map +1 -0
  28. package/dist/OpenApiTsGenerator-DXXFXSbO.mjs +536 -0
  29. package/dist/OpenApiTsGenerator-DXXFXSbO.mjs.map +1 -0
  30. package/dist/{Route53Provider-CH9XH7bz.cjs → Route53Provider-Bllus2NR.cjs} +21 -22
  31. package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
  32. package/dist/{Route53Provider-C0xmer8U.mjs → Route53Provider-QXxjkZO1.mjs} +13 -13
  33. package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
  34. package/dist/S3StateStore-DXHSBVsV.cjs +222 -0
  35. package/dist/S3StateStore-DXHSBVsV.cjs.map +1 -0
  36. package/dist/S3StateStore-H2XsAzpJ.mjs +223 -0
  37. package/dist/S3StateStore-H2XsAzpJ.mjs.map +1 -0
  38. package/dist/SSMStateStore-BLPSNl-U.cjs +204 -0
  39. package/dist/SSMStateStore-BLPSNl-U.cjs.map +1 -0
  40. package/dist/SSMStateStore-CENciQEM.mjs +205 -0
  41. package/dist/SSMStateStore-CENciQEM.mjs.map +1 -0
  42. package/dist/SubscriberGenerator-CeH7wbYt.cjs +571 -0
  43. package/dist/SubscriberGenerator-CeH7wbYt.cjs.map +1 -0
  44. package/dist/SubscriberGenerator-DHnIYwUU.mjs +518 -0
  45. package/dist/SubscriberGenerator-DHnIYwUU.mjs.map +1 -0
  46. package/dist/add-Cdg1kEqN.cjs +719 -0
  47. package/dist/add-Cdg1kEqN.cjs.map +1 -0
  48. package/dist/add-snhdVmR-.mjs +717 -0
  49. package/dist/add-snhdVmR-.mjs.map +1 -0
  50. package/dist/appPorts-BoXMwolc.mjs +249 -0
  51. package/dist/appPorts-BoXMwolc.mjs.map +1 -0
  52. package/dist/appPorts-IW-OZmRi.cjs +296 -0
  53. package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
  54. package/dist/aws-8QQ8n-t6.mjs +89 -0
  55. package/dist/aws-8QQ8n-t6.mjs.map +1 -0
  56. package/dist/aws-DY9NqQIT.cjs +100 -0
  57. package/dist/aws-DY9NqQIT.cjs.map +1 -0
  58. package/dist/awsStore-Bx5nCFnS.mjs +121 -0
  59. package/dist/awsStore-Bx5nCFnS.mjs.map +1 -0
  60. package/dist/awsStore-u3ehhMoY.cjs +138 -0
  61. package/dist/awsStore-u3ehhMoY.cjs.map +1 -0
  62. package/dist/{backup-provisioner-DXXg6FIL.mjs → backup-provisioner-C8DnCmxK.mjs} +11 -8
  63. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  64. package/dist/{backup-provisioner-cE2PuCTb.cjs → backup-provisioner-oDEsPj02.cjs} +22 -20
  65. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  66. package/dist/backups/runner.cjs +519 -0
  67. package/dist/backups/runner.cjs.map +1 -0
  68. package/dist/backups/runner.d.cts +102 -0
  69. package/dist/backups/runner.d.cts.map +1 -0
  70. package/dist/backups/runner.d.mts +102 -0
  71. package/dist/backups/runner.d.mts.map +1 -0
  72. package/dist/backups/runner.mjs +506 -0
  73. package/dist/backups/runner.mjs.map +1 -0
  74. package/dist/{bundler-CaTGtiaO.cjs → bundler-B4GDxImV.cjs} +38 -35
  75. package/dist/bundler-B4GDxImV.cjs.map +1 -0
  76. package/dist/{bundler-S3ek7ea-.mjs → bundler-Wd9H4QLJ.mjs} +36 -32
  77. package/dist/bundler-Wd9H4QLJ.mjs.map +1 -0
  78. package/dist/cli-BZYz55tO.cjs +71 -0
  79. package/dist/cli-BZYz55tO.cjs.map +1 -0
  80. package/dist/cli-BzrDSNSg.mjs +71 -0
  81. package/dist/cli-BzrDSNSg.mjs.map +1 -0
  82. package/dist/compose-DN9zySvQ.cjs +3330 -0
  83. package/dist/compose-DN9zySvQ.cjs.map +1 -0
  84. package/dist/compose-Gsd1Nq7R.mjs +3187 -0
  85. package/dist/compose-Gsd1Nq7R.mjs.map +1 -0
  86. package/dist/config-D48erO2j.d.mts +269 -0
  87. package/dist/config-D48erO2j.d.mts.map +1 -0
  88. package/dist/config-DHDtsQrB.d.cts +269 -0
  89. package/dist/config-DHDtsQrB.d.cts.map +1 -0
  90. package/dist/config.cjs +421 -11
  91. package/dist/config.cjs.map +1 -0
  92. package/dist/config.d.cts +4 -120
  93. package/dist/config.d.mts +4 -120
  94. package/dist/config.mjs +405 -4
  95. package/dist/config.mjs.map +1 -0
  96. package/dist/credentialSchemas-Cf5Pf8VE.mjs +237 -0
  97. package/dist/credentialSchemas-Cf5Pf8VE.mjs.map +1 -0
  98. package/dist/credentialSchemas-D_VUCDUh.cjs +272 -0
  99. package/dist/credentialSchemas-D_VUCDUh.cjs.map +1 -0
  100. package/dist/credentials-B5N5yKk6.mjs +267 -0
  101. package/dist/credentials-B5N5yKk6.mjs.map +1 -0
  102. package/dist/credentials-Zqr3QQYB.cjs +350 -0
  103. package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
  104. package/dist/databases-BeGP5eDh.mjs +495 -0
  105. package/dist/databases-BeGP5eDh.mjs.map +1 -0
  106. package/dist/databases-DGALFDG3.cjs +598 -0
  107. package/dist/databases-DGALFDG3.cjs.map +1 -0
  108. package/dist/define-6poNqm5O.mjs +106 -0
  109. package/dist/define-6poNqm5O.mjs.map +1 -0
  110. package/dist/define-crmMcXFS.cjs +153 -0
  111. package/dist/define-crmMcXFS.cjs.map +1 -0
  112. package/dist/deploy/public.cjs +212 -0
  113. package/dist/deploy/public.cjs.map +1 -0
  114. package/dist/deploy/public.d.cts +653 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +653 -0
  117. package/dist/deploy/public.d.mts.map +1 -0
  118. package/dist/deploy/public.mjs +145 -0
  119. package/dist/deploy/public.mjs.map +1 -0
  120. package/dist/deploy/sniffer-envkit-patch.cjs +18 -10
  121. package/dist/deploy/sniffer-envkit-patch.cjs.map +1 -1
  122. package/dist/deploy/sniffer-envkit-patch.d.cts +0 -2
  123. package/dist/deploy/sniffer-envkit-patch.d.cts.map +1 -1
  124. package/dist/deploy/sniffer-envkit-patch.d.mts +0 -2
  125. package/dist/deploy/sniffer-envkit-patch.d.mts.map +1 -1
  126. package/dist/deploy/sniffer-envkit-patch.mjs +10 -2
  127. package/dist/deploy/sniffer-envkit-patch.mjs.map +1 -1
  128. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  129. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  130. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  131. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  132. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  133. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  134. package/dist/deploy/sniffer-hooks.cjs +13 -7
  135. package/dist/deploy/sniffer-hooks.cjs.map +1 -1
  136. package/dist/deploy/sniffer-hooks.d.cts +1 -2
  137. package/dist/deploy/sniffer-hooks.d.cts.map +1 -1
  138. package/dist/deploy/sniffer-hooks.d.mts +1 -2
  139. package/dist/deploy/sniffer-hooks.d.mts.map +1 -1
  140. package/dist/deploy/sniffer-hooks.mjs +10 -3
  141. package/dist/deploy/sniffer-hooks.mjs.map +1 -1
  142. package/dist/deploy/sniffer-loader.cjs +16 -7
  143. package/dist/deploy/sniffer-loader.cjs.map +1 -1
  144. package/dist/deploy/sniffer-loader.d.cts +1 -1
  145. package/dist/deploy/sniffer-loader.d.mts +1 -1
  146. package/dist/deploy/sniffer-loader.mjs +14 -3
  147. package/dist/deploy/sniffer-loader.mjs.map +1 -1
  148. package/dist/deploy/sniffer-routes-worker.cjs +11 -11
  149. package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
  150. package/dist/deploy/sniffer-routes-worker.d.cts +1 -1
  151. package/dist/deploy/sniffer-routes-worker.d.mts +1 -1
  152. package/dist/deploy/sniffer-routes-worker.mjs +4 -4
  153. package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
  154. package/dist/deploy/sniffer-worker.cjs +15 -6
  155. package/dist/deploy/sniffer-worker.cjs.map +1 -1
  156. package/dist/deploy/sniffer-worker.d.cts +1 -3
  157. package/dist/deploy/sniffer-worker.d.cts.map +1 -1
  158. package/dist/deploy/sniffer-worker.d.mts +1 -3
  159. package/dist/deploy/sniffer-worker.d.mts.map +1 -1
  160. package/dist/deploy/sniffer-worker.mjs +15 -4
  161. package/dist/deploy/sniffer-worker.mjs.map +1 -1
  162. package/dist/deploy-CFvq8daZ.cjs +2390 -0
  163. package/dist/deploy-CFvq8daZ.cjs.map +1 -0
  164. package/dist/deploy-H2S8_mTx.mjs +2317 -0
  165. package/dist/deploy-H2S8_mTx.mjs.map +1 -0
  166. package/dist/derive-B4vDpzgP.mjs +150 -0
  167. package/dist/derive-B4vDpzgP.mjs.map +1 -0
  168. package/dist/derive-DAbo49sm.cjs +161 -0
  169. package/dist/derive-DAbo49sm.cjs.map +1 -0
  170. package/dist/discover-Bsr7HjqJ.cjs +616 -0
  171. package/dist/discover-Bsr7HjqJ.cjs.map +1 -0
  172. package/dist/discover-Ca8U75dl.mjs +537 -0
  173. package/dist/discover-Ca8U75dl.mjs.map +1 -0
  174. package/dist/discover-CvTtV5ZD.d.cts +108 -0
  175. package/dist/discover-CvTtV5ZD.d.cts.map +1 -0
  176. package/dist/discover-W2kab9Lc.d.mts +108 -0
  177. package/dist/discover-W2kab9Lc.d.mts.map +1 -0
  178. package/dist/dns-BdETzP10.cjs +1057 -0
  179. package/dist/dns-BdETzP10.cjs.map +1 -0
  180. package/dist/dns-pFMShDqW.mjs +926 -0
  181. package/dist/dns-pFMShDqW.mjs.map +1 -0
  182. package/dist/dokploy-HioAjP7K.cjs +38 -0
  183. package/dist/dokploy-HioAjP7K.cjs.map +1 -0
  184. package/dist/dokploy-oDJbnvCb.mjs +38 -0
  185. package/dist/dokploy-oDJbnvCb.mjs.map +1 -0
  186. package/dist/drivers-D11JHxrD.mjs +177 -0
  187. package/dist/drivers-D11JHxrD.mjs.map +1 -0
  188. package/dist/drivers-GKaA6ITM.cjs +200 -0
  189. package/dist/drivers-GKaA6ITM.cjs.map +1 -0
  190. package/dist/{emit-CIlvnDvV.mjs → emit-C1e8qD08.mjs} +13 -26
  191. package/dist/emit-C1e8qD08.mjs.map +1 -0
  192. package/dist/{emit-CUD1BWls.cjs → emit-Dmc1nvdS.cjs} +31 -57
  193. package/dist/emit-Dmc1nvdS.cjs.map +1 -0
  194. package/dist/encryption-D5pDJyp2.mjs +89 -0
  195. package/dist/encryption-D5pDJyp2.mjs.map +1 -0
  196. package/dist/encryption-DVCxD-gV.cjs +90 -0
  197. package/dist/encryption-DVCxD-gV.cjs.map +1 -0
  198. package/dist/engine-BaJGPzte.cjs +3196 -0
  199. package/dist/engine-BaJGPzte.cjs.map +1 -0
  200. package/dist/engine-CfAKgr2_.mjs +3083 -0
  201. package/dist/engine-CfAKgr2_.mjs.map +1 -0
  202. package/dist/errors-D8Gwp5kU.mjs +23 -0
  203. package/dist/errors-D8Gwp5kU.mjs.map +1 -0
  204. package/dist/errors-DMC4Umsb.cjs +34 -0
  205. package/dist/errors-DMC4Umsb.cjs.map +1 -0
  206. package/dist/github-D902Vwr9.cjs +829 -0
  207. package/dist/github-D902Vwr9.cjs.map +1 -0
  208. package/dist/github-E-ZxqFPq.mjs +829 -0
  209. package/dist/github-E-ZxqFPq.mjs.map +1 -0
  210. package/dist/identity-CBXr4wNi.mjs +129 -0
  211. package/dist/identity-CBXr4wNi.mjs.map +1 -0
  212. package/dist/identity-CbLfgQNT.cjs +182 -0
  213. package/dist/identity-CbLfgQNT.cjs.map +1 -0
  214. package/dist/{index-Ayxg_DQY.d.mts → index-8OfpOtSI.d.cts} +39 -24
  215. package/dist/index-8OfpOtSI.d.cts.map +1 -0
  216. package/dist/{index-CR5urhWX.d.cts → index-Dpji6Bxq.d.mts} +39 -24
  217. package/dist/index-Dpji6Bxq.d.mts.map +1 -0
  218. package/dist/index.cjs +13764 -12651
  219. package/dist/index.cjs.map +1 -1
  220. package/dist/index.d.cts +1 -1
  221. package/dist/index.d.mts +1 -1
  222. package/dist/index.mjs +13654 -12553
  223. package/dist/index.mjs.map +1 -1
  224. package/dist/local-BwC2v2Y8.mjs +224 -0
  225. package/dist/local-BwC2v2Y8.mjs.map +1 -0
  226. package/dist/local-DNhnkugT.cjs +241 -0
  227. package/dist/local-DNhnkugT.cjs.map +1 -0
  228. package/dist/migrate-BZ0GnSZQ.mjs +181 -0
  229. package/dist/migrate-BZ0GnSZQ.mjs.map +1 -0
  230. package/dist/migrate-CTqhWtev.cjs +271 -0
  231. package/dist/migrate-CTqhWtev.cjs.map +1 -0
  232. package/dist/migrate-DCXwHcWX.mjs +266 -0
  233. package/dist/migrate-DCXwHcWX.mjs.map +1 -0
  234. package/dist/migrate-Df81ew0k.cjs +181 -0
  235. package/dist/migrate-Df81ew0k.cjs.map +1 -0
  236. package/dist/openapi.cjs +214 -10
  237. package/dist/openapi.cjs.map +1 -0
  238. package/dist/openapi.d.cts +38 -17
  239. package/dist/openapi.d.cts.map +1 -1
  240. package/dist/openapi.d.mts +38 -17
  241. package/dist/openapi.d.mts.map +1 -1
  242. package/dist/openapi.mjs +208 -5
  243. package/dist/openapi.mjs.map +1 -0
  244. package/dist/projectBucket-BBbQ1lHF.cjs +263 -0
  245. package/dist/projectBucket-BBbQ1lHF.cjs.map +1 -0
  246. package/dist/projectBucket-C_DN4WzF.mjs +222 -0
  247. package/dist/projectBucket-C_DN4WzF.mjs.map +1 -0
  248. package/dist/provider-BqpjG9QM.cjs +57 -0
  249. package/dist/provider-BqpjG9QM.cjs.map +1 -0
  250. package/dist/provider-CEOKk8NS.mjs +46 -0
  251. package/dist/provider-CEOKk8NS.mjs.map +1 -0
  252. package/dist/ready-BMFjxBYA.cjs +404 -0
  253. package/dist/ready-BMFjxBYA.cjs.map +1 -0
  254. package/dist/ready-CIt5SOtg.mjs +375 -0
  255. package/dist/ready-CIt5SOtg.mjs.map +1 -0
  256. package/dist/reconcile/public.cjs +3 -5
  257. package/dist/reconcile/public.d.cts +11 -87
  258. package/dist/reconcile/public.d.cts.map +1 -1
  259. package/dist/reconcile/public.d.mts +11 -87
  260. package/dist/reconcile/public.d.mts.map +1 -1
  261. package/dist/reconcile/public.mjs +3 -4
  262. package/dist/{reconcile-C13ERt1U.mjs → reconcile--I7V4Klj.mjs} +4 -7
  263. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  264. package/dist/{reconcile-CYMhFSYy.cjs → reconcile-CuCQBa5-.cjs} +5 -8
  265. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  266. package/dist/resolve-BMpPd8x3.mjs +263 -0
  267. package/dist/resolve-BMpPd8x3.mjs.map +1 -0
  268. package/dist/resolve-D043YmW9.cjs +316 -0
  269. package/dist/resolve-D043YmW9.cjs.map +1 -0
  270. package/dist/rollback-CBiYsQ3T.cjs +165 -0
  271. package/dist/rollback-CBiYsQ3T.cjs.map +1 -0
  272. package/dist/rollback-CDs_XNb0.mjs +136 -0
  273. package/dist/rollback-CDs_XNb0.mjs.map +1 -0
  274. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  275. package/dist/{chunk-CUT6urMc.cjs → rolldown-runtime-C0BPl7ul.cjs} +23 -10
  276. package/dist/run-BJLIerMM.mjs +133 -0
  277. package/dist/run-BJLIerMM.mjs.map +1 -0
  278. package/dist/run-fVZ-rLnc.cjs +174 -0
  279. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  280. package/dist/runtime-ACdfK59n.d.cts +82 -0
  281. package/dist/runtime-ACdfK59n.d.cts.map +1 -0
  282. package/dist/runtime-YyQuekxi.d.mts +82 -0
  283. package/dist/runtime-YyQuekxi.d.mts.map +1 -0
  284. package/dist/s3-CrPoA89T.cjs +215 -0
  285. package/dist/s3-CrPoA89T.cjs.map +1 -0
  286. package/dist/s3-DQXZdmCM.mjs +215 -0
  287. package/dist/s3-DQXZdmCM.mjs.map +1 -0
  288. package/dist/sandbox/config-worker.cjs +43 -0
  289. package/dist/sandbox/config-worker.cjs.map +1 -0
  290. package/dist/sandbox/config-worker.d.cts +1 -0
  291. package/dist/sandbox/config-worker.d.mts +1 -0
  292. package/dist/sandbox/config-worker.mjs +44 -0
  293. package/dist/sandbox/config-worker.mjs.map +1 -0
  294. package/dist/sandbox/credentials-worker.cjs +54 -0
  295. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  296. package/dist/sandbox/credentials-worker.d.cts +1 -0
  297. package/dist/sandbox/credentials-worker.d.mts +1 -0
  298. package/dist/sandbox/credentials-worker.mjs +55 -0
  299. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  300. package/dist/sandbox/discover-worker.cjs +47 -0
  301. package/dist/sandbox/discover-worker.cjs.map +1 -0
  302. package/dist/sandbox/discover-worker.d.cts +1 -0
  303. package/dist/sandbox/discover-worker.d.mts +1 -0
  304. package/dist/sandbox/discover-worker.mjs +48 -0
  305. package/dist/sandbox/discover-worker.mjs.map +1 -0
  306. package/dist/sandbox/migrate-worker.cjs +75 -0
  307. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  308. package/dist/sandbox/migrate-worker.d.cts +1 -0
  309. package/dist/sandbox/migrate-worker.d.mts +1 -0
  310. package/dist/sandbox/migrate-worker.mjs +76 -0
  311. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  312. package/dist/sandbox-C4g1eG31.d.mts +104 -0
  313. package/dist/sandbox-C4g1eG31.d.mts.map +1 -0
  314. package/dist/sandbox-CHv3OYXg.cjs +165 -0
  315. package/dist/sandbox-CHv3OYXg.cjs.map +1 -0
  316. package/dist/sandbox-CbVB7uOD.mjs +118 -0
  317. package/dist/sandbox-CbVB7uOD.mjs.map +1 -0
  318. package/dist/sandbox-CdKgQ3XU.d.cts +104 -0
  319. package/dist/sandbox-CdKgQ3XU.d.cts.map +1 -0
  320. package/dist/{workspace-C-a3G_U0.cjs → schemas-BCwKKA42.mjs} +958 -1868
  321. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  322. package/dist/{workspace-DaEX7FEg.mjs → schemas-BQ_v0lEX.cjs} +1048 -1678
  323. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  324. package/dist/secretsManager-CQORubp9.mjs +97 -0
  325. package/dist/secretsManager-CQORubp9.mjs.map +1 -0
  326. package/dist/secretsManager-RAGcEDX1.cjs +108 -0
  327. package/dist/secretsManager-RAGcEDX1.cjs.map +1 -0
  328. package/dist/seeds-BjcO4DDa.mjs +8194 -0
  329. package/dist/seeds-BjcO4DDa.mjs.map +1 -0
  330. package/dist/seeds-DNqRA1aQ.cjs +9173 -0
  331. package/dist/seeds-DNqRA1aQ.cjs.map +1 -0
  332. package/dist/sniffer-DipSS8r8.cjs +1998 -0
  333. package/dist/sniffer-DipSS8r8.cjs.map +1 -0
  334. package/dist/sniffer-b0XPmSyT.mjs +1825 -0
  335. package/dist/sniffer-b0XPmSyT.mjs.map +1 -0
  336. package/dist/sst-B-Uz4cvm.cjs +464 -0
  337. package/dist/sst-B-Uz4cvm.cjs.map +1 -0
  338. package/dist/sst-C1pxbFEd.mjs +441 -0
  339. package/dist/sst-C1pxbFEd.mjs.map +1 -0
  340. package/dist/stage-C_y2UovO.cjs +266 -0
  341. package/dist/stage-C_y2UovO.cjs.map +1 -0
  342. package/dist/stage-DrDmZusd.mjs +266 -0
  343. package/dist/stage-DrDmZusd.mjs.map +1 -0
  344. package/dist/stages-DJrOYLZ-.mjs +176 -0
  345. package/dist/stages-DJrOYLZ-.mjs.map +1 -0
  346. package/dist/stages-_3RVNG83.cjs +176 -0
  347. package/dist/stages-_3RVNG83.cjs.map +1 -0
  348. package/dist/target/public.cjs +15 -0
  349. package/dist/target/public.d.cts +28 -0
  350. package/dist/target/public.d.cts.map +1 -0
  351. package/dist/target/public.d.mts +28 -0
  352. package/dist/target/public.d.mts.map +1 -0
  353. package/dist/target/public.mjs +4 -0
  354. package/dist/terminal-CvRLxz6g.mjs +85 -0
  355. package/dist/terminal-CvRLxz6g.mjs.map +1 -0
  356. package/dist/terminal-D_NRPW4W.cjs +85 -0
  357. package/dist/terminal-D_NRPW4W.cjs.map +1 -0
  358. package/dist/types-B6UXlEkf.d.cts +7650 -0
  359. package/dist/types-B6UXlEkf.d.cts.map +1 -0
  360. package/dist/types-HqVPddRK.d.mts +7649 -0
  361. package/dist/types-HqVPddRK.d.mts.map +1 -0
  362. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  363. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  364. package/dist/utils-D_fxUqvU.mjs +156 -0
  365. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  366. package/dist/vitest.cjs +65 -0
  367. package/dist/vitest.cjs.map +1 -0
  368. package/dist/vitest.d.cts +29 -0
  369. package/dist/vitest.d.cts.map +1 -0
  370. package/dist/vitest.d.mts +29 -0
  371. package/dist/vitest.d.mts.map +1 -0
  372. package/dist/vitest.mjs +65 -0
  373. package/dist/vitest.mjs.map +1 -0
  374. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  375. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  376. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  377. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  378. package/dist/workspace/index.cjs +8 -4
  379. package/dist/workspace/index.d.cts +3 -3
  380. package/dist/workspace/index.d.mts +3 -3
  381. package/dist/workspace/index.mjs +2 -3
  382. package/dist/workspace-BwqQnool.cjs +2806 -0
  383. package/dist/workspace-BwqQnool.cjs.map +1 -0
  384. package/dist/workspace-D1QbNd55.mjs +2394 -0
  385. package/dist/workspace-D1QbNd55.mjs.map +1 -0
  386. package/package.json +54 -22
  387. package/dist/CachedStateProvider-BEBl2wQT.cjs +0 -60
  388. package/dist/CachedStateProvider-BEBl2wQT.cjs.map +0 -1
  389. package/dist/CachedStateProvider-C-8wtlto.mjs +0 -3
  390. package/dist/CachedStateProvider-Co4n5Wvs.mjs +0 -54
  391. package/dist/CachedStateProvider-Co4n5Wvs.mjs.map +0 -1
  392. package/dist/CachedStateProvider-DqhGpzsm.cjs +0 -3
  393. package/dist/HostingerProvider-BOvsgATO.cjs.map +0 -1
  394. package/dist/HostingerProvider-BcyFRbqV.mjs.map +0 -1
  395. package/dist/LocalStateProvider-Bq-0C0sg.mjs +0 -42
  396. package/dist/LocalStateProvider-Bq-0C0sg.mjs.map +0 -1
  397. package/dist/LocalStateProvider-yjXZXZDM.cjs +0 -43
  398. package/dist/LocalStateProvider-yjXZXZDM.cjs.map +0 -1
  399. package/dist/Route53Provider-C0xmer8U.mjs.map +0 -1
  400. package/dist/Route53Provider-CH9XH7bz.cjs.map +0 -1
  401. package/dist/SSMStateProvider-CXtNgPfy.cjs +0 -66
  402. package/dist/SSMStateProvider-CXtNgPfy.cjs.map +0 -1
  403. package/dist/SSMStateProvider-DOZifZfE.mjs +0 -66
  404. package/dist/SSMStateProvider-DOZifZfE.mjs.map +0 -1
  405. package/dist/backup-provisioner-DXXg6FIL.mjs.map +0 -1
  406. package/dist/backup-provisioner-cE2PuCTb.cjs.map +0 -1
  407. package/dist/bundler-CaTGtiaO.cjs.map +0 -1
  408. package/dist/bundler-S3ek7ea-.mjs.map +0 -1
  409. package/dist/chunk-Duj1WY3L.mjs +0 -7
  410. package/dist/config-B0L2tvvC.mjs +0 -402
  411. package/dist/config-B0L2tvvC.mjs.map +0 -1
  412. package/dist/config-HhDpJmLO.cjs +0 -462
  413. package/dist/config-HhDpJmLO.cjs.map +0 -1
  414. package/dist/config.d.cts.map +0 -1
  415. package/dist/config.d.mts.map +0 -1
  416. package/dist/credentials-B2Pyh3bJ.cjs +0 -2681
  417. package/dist/credentials-B2Pyh3bJ.cjs.map +0 -1
  418. package/dist/credentials-B5zRHdAl.mjs +0 -141
  419. package/dist/credentials-B5zRHdAl.mjs.map +0 -1
  420. package/dist/credentials-BapzjyV5.cjs +0 -195
  421. package/dist/credentials-BapzjyV5.cjs.map +0 -1
  422. package/dist/credentials-CZrys9C5.mjs +0 -2549
  423. package/dist/credentials-CZrys9C5.mjs.map +0 -1
  424. package/dist/discover-CAlFgYec.mjs +0 -229
  425. package/dist/discover-CAlFgYec.mjs.map +0 -1
  426. package/dist/discover-DTmFeloL.cjs +0 -271
  427. package/dist/discover-DTmFeloL.cjs.map +0 -1
  428. package/dist/dokploy-api-5cK2InBm.cjs +0 -3
  429. package/dist/dokploy-api-D2Ny4Jrc.mjs +0 -3
  430. package/dist/dokploy-api-pdaBryoY.mjs +0 -706
  431. package/dist/dokploy-api-pdaBryoY.mjs.map +0 -1
  432. package/dist/dokploy-api-zqKe9lHH.cjs +0 -718
  433. package/dist/dokploy-api-zqKe9lHH.cjs.map +0 -1
  434. package/dist/emit-CIlvnDvV.mjs.map +0 -1
  435. package/dist/emit-CUD1BWls.cjs.map +0 -1
  436. package/dist/encryption-D2pL3tHH.cjs +0 -54
  437. package/dist/encryption-D2pL3tHH.cjs.map +0 -1
  438. package/dist/encryption-YDsXXi6w.mjs +0 -3
  439. package/dist/encryption-_4zwjOAR.mjs +0 -42
  440. package/dist/encryption-_4zwjOAR.mjs.map +0 -1
  441. package/dist/encryption-sQ2Oxx0d.cjs +0 -4
  442. package/dist/fullstack-secrets-D6MyHhQP.cjs +0 -111
  443. package/dist/fullstack-secrets-D6MyHhQP.cjs.map +0 -1
  444. package/dist/fullstack-secrets-METaRLS1.mjs +0 -87
  445. package/dist/fullstack-secrets-METaRLS1.mjs.map +0 -1
  446. package/dist/generator-CNzBw7g5.cjs +0 -289
  447. package/dist/generator-CNzBw7g5.cjs.map +0 -1
  448. package/dist/generator-VE2JrFlY.mjs +0 -253
  449. package/dist/generator-VE2JrFlY.mjs.map +0 -1
  450. package/dist/github-BrvaPkFf.cjs +0 -197
  451. package/dist/github-BrvaPkFf.cjs.map +0 -1
  452. package/dist/github-CrpsXSfV.mjs +0 -196
  453. package/dist/github-CrpsXSfV.mjs.map +0 -1
  454. package/dist/index-Ayxg_DQY.d.mts.map +0 -1
  455. package/dist/index-CR5urhWX.d.cts.map +0 -1
  456. package/dist/keystore-C9rint2E.cjs +0 -101
  457. package/dist/keystore-C9rint2E.cjs.map +0 -1
  458. package/dist/keystore-TxeYM7an.mjs +0 -83
  459. package/dist/keystore-TxeYM7an.mjs.map +0 -1
  460. package/dist/openapi-DaKlTKxz.cjs +0 -2075
  461. package/dist/openapi-DaKlTKxz.cjs.map +0 -1
  462. package/dist/openapi-react-query-BKH334Ug.cjs +0 -173
  463. package/dist/openapi-react-query-BKH334Ug.cjs.map +0 -1
  464. package/dist/openapi-react-query-DoR5CmzQ.mjs +0 -167
  465. package/dist/openapi-react-query-DoR5CmzQ.mjs.map +0 -1
  466. package/dist/openapi-react-query.cjs +0 -4
  467. package/dist/openapi-react-query.d.cts +0 -11
  468. package/dist/openapi-react-query.d.cts.map +0 -1
  469. package/dist/openapi-react-query.d.mts +0 -11
  470. package/dist/openapi-react-query.d.mts.map +0 -1
  471. package/dist/openapi-react-query.mjs +0 -4
  472. package/dist/openapi-y1d7Kalt.mjs +0 -2021
  473. package/dist/openapi-y1d7Kalt.mjs.map +0 -1
  474. package/dist/reconcile-C13ERt1U.mjs.map +0 -1
  475. package/dist/reconcile-CYMhFSYy.cjs.map +0 -1
  476. package/dist/setup-BWgMs4gg.mjs +0 -12
  477. package/dist/setup-DOv92pIu.cjs +0 -473
  478. package/dist/setup-DOv92pIu.cjs.map +0 -1
  479. package/dist/setup-DQo_h_yK.mjs +0 -443
  480. package/dist/setup-DQo_h_yK.mjs.map +0 -1
  481. package/dist/setup-lCx_DcUo.cjs +0 -12
  482. package/dist/storage-B020InPW.mjs +0 -222
  483. package/dist/storage-B020InPW.mjs.map +0 -1
  484. package/dist/storage-CSNplaJn.cjs +0 -282
  485. package/dist/storage-CSNplaJn.cjs.map +0 -1
  486. package/dist/storage-DGBzMLZa.mjs +0 -4
  487. package/dist/storage-DlVol_oj.cjs +0 -8
  488. package/dist/sync-0ILCb-1S.cjs +0 -93
  489. package/dist/sync-0ILCb-1S.cjs.map +0 -1
  490. package/dist/sync-CzHXiR9c.mjs +0 -76
  491. package/dist/sync-CzHXiR9c.mjs.map +0 -1
  492. package/dist/sync-DYENfOt4.cjs +0 -4
  493. package/dist/sync-HAau6h_R.mjs +0 -3
  494. package/dist/types-CL7jPFM2.d.mts +0 -2220
  495. package/dist/types-CL7jPFM2.d.mts.map +0 -1
  496. package/dist/types-Y3fKQSAK.d.cts +0 -2220
  497. package/dist/types-Y3fKQSAK.d.cts.map +0 -1
  498. package/dist/workspace-C-a3G_U0.cjs.map +0 -1
  499. package/dist/workspace-DQxxs7Jk.cjs +0 -10
  500. package/dist/workspace-DaEX7FEg.mjs.map +0 -1
  501. package/dist/workspace-DbI580qS.mjs +0 -9
@@ -1,9 +1,8 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const node_path = require_chunk.__toESM(require("node:path"));
3
- const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
4
- const node_child_process = require_chunk.__toESM(require("node:child_process"));
5
- const node_module = require_chunk.__toESM(require("node:module"));
6
-
1
+ let node_path = require("node:path");
2
+ let node_fs = require("node:fs");
3
+ let node_fs_promises = require("node:fs/promises");
4
+ let node_child_process = require("node:child_process");
5
+ let node_module = require("node:module");
7
6
  //#region src/build/bundler.ts
8
7
  /**
9
8
  * Banner to inject into ESM bundle for CJS compatibility.
@@ -63,16 +62,10 @@ async function collectRequiredEnvVars(constructs) {
63
62
  * @param options - Bundle configuration options
64
63
  * @returns Bundle result with output path and optional master key
65
64
  */
66
- /** Default env var values for docker compose services */
67
- const DOCKER_SERVICE_ENV_VARS = {
68
- postgres: { DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/app" },
69
- redis: { REDIS_URL: "redis://redis:6379" },
70
- rabbitmq: { RABBITMQ_URL: "amqp://rabbitmq:5672" }
71
- };
72
65
  async function bundleServer(options) {
73
- const { entryPoint, outputDir, minify, sourcemap, external, stage, constructs, dockerServices } = options;
66
+ const { entryPoint, outputDir, minify, sourcemap, external, stage, constructs } = options;
74
67
  await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
75
- const mjsOutput = (0, node_path.join)(outputDir, "server.mjs");
68
+ const mjsOutput = (0, node_path.join)(outputDir, options.outfile ?? "server.mjs");
76
69
  const args = [
77
70
  esbuildBinary(),
78
71
  entryPoint,
@@ -84,28 +77,25 @@ async function bundleServer(options) {
84
77
  "--packages=bundle",
85
78
  `--banner:js=${ESM_CJS_COMPAT_BANNER}`
86
79
  ];
87
- if (minify) args.push("--minify");
80
+ if (minify) args.push("--minify", "--keep-names");
88
81
  if (sourcemap) args.push("--sourcemap");
89
82
  for (const ext of external) args.push(`--external:${ext}`);
90
83
  let masterKey;
91
84
  if (stage) {
92
- const { readStageSecrets, toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets, writeStageSecrets } = await Promise.resolve().then(() => require("./storage-DlVol_oj.cjs"));
93
- const { encryptSecrets, generateDefineOptions } = await Promise.resolve().then(() => require("./encryption-sQ2Oxx0d.cjs"));
94
- let secrets = await readStageSecrets(stage);
85
+ const { toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets } = await Promise.resolve().then(() => require("./seeds-DNqRA1aQ.cjs")).then((n) => n.storage_exports);
86
+ const { FileSecretsStore, secretsStoreFor } = await Promise.resolve().then(() => require("./seeds-DNqRA1aQ.cjs")).then((n) => n.store_exports);
87
+ const { ConfigNotFound, loadWorkspaceSettings } = await Promise.resolve().then(() => require("./config.cjs"));
88
+ const { encryptSecrets, generateDefineOptions } = await Promise.resolve().then(() => require("./sniffer-DipSS8r8.cjs")).then((n) => n.encryption_exports);
89
+ const store = await loadWorkspaceSettings().then((workspace) => secretsStoreFor(workspace, stage), (error) => {
90
+ if (error instanceof ConfigNotFound) return new FileSecretsStore(process.cwd());
91
+ throw error;
92
+ });
93
+ let secrets = await store.read(stage);
95
94
  if (!secrets) {
96
95
  console.log(` Initializing secrets for stage "${stage}"...`);
97
96
  secrets = initStageSecrets(stage);
98
- await writeStageSecrets(secrets);
99
- console.log(` ✓ Created .gkm/secrets/${stage}.json`);
100
- }
101
- if (dockerServices) {
102
- for (const [service, enabled] of Object.entries(dockerServices)) if (enabled && DOCKER_SERVICE_ENV_VARS[service]) for (const [envVar, defaultValue] of Object.entries(DOCKER_SERVICE_ENV_VARS[service])) {
103
- const urlKey = envVar;
104
- if (!secrets.urls[urlKey] && !secrets.custom[envVar]) {
105
- secrets.urls[urlKey] = defaultValue;
106
- console.log(` Auto-populated ${envVar} from docker compose`);
107
- }
108
- }
97
+ await store.write(stage, secrets);
98
+ console.log(` ✓ Created the "${stage}" secrets (${store.name})`);
109
99
  }
110
100
  if (constructs && constructs.length > 0) {
111
101
  console.log(" Analyzing environment variable requirements...");
@@ -119,7 +109,7 @@ async function bundleServer(options) {
119
109
  ...validation.missing.map((v) => ` ❌ ${v}`),
120
110
  "",
121
111
  "To fix this, either:",
122
- ` 1. Add the missing variables to .gkm/secrets/${stage}.json using:`,
112
+ ` 1. Add the missing variables to the "${stage}" secrets using:`,
123
113
  ` gkm secrets:set <KEY> <VALUE> --stage ${stage}`,
124
114
  "",
125
115
  ` 2. Or import from a JSON file:`,
@@ -133,12 +123,25 @@ async function bundleServer(options) {
133
123
  console.log(` ✓ All ${requiredVars.length} required environment variables found`);
134
124
  }
135
125
  }
136
- const embeddable = toEmbeddableSecrets(secrets);
137
- const encrypted = encryptSecrets(embeddable);
126
+ const encrypted = encryptSecrets(toEmbeddableSecrets(secrets));
138
127
  masterKey = encrypted.masterKey;
139
128
  const defines = generateDefineOptions(encrypted);
140
- for (const [key, value] of Object.entries(defines)) args.push(`--define:${key}=${JSON.stringify(value)}`);
129
+ for (const [key, value] of Object.entries(defines)) args.push(`--define:${key}=${value}`);
141
130
  console.log(` Secrets encrypted for stage "${stage}"`);
131
+ } else {
132
+ const gkmDir = (0, node_path.join)(outputDir, "..", "..");
133
+ const encryptedPath = (0, node_path.join)(gkmDir, "credentials.enc");
134
+ const ivPath = (0, node_path.join)(gkmDir, "credentials.iv");
135
+ if ((0, node_fs.existsSync)(encryptedPath) && (0, node_fs.existsSync)(ivPath)) {
136
+ const { generateDefineOptions } = await Promise.resolve().then(() => require("./sniffer-DipSS8r8.cjs")).then((n) => n.encryption_exports);
137
+ const defines = generateDefineOptions({
138
+ encrypted: (0, node_fs.readFileSync)(encryptedPath, "utf-8").trim(),
139
+ iv: (0, node_fs.readFileSync)(ivPath, "utf-8").trim(),
140
+ masterKey: ""
141
+ });
142
+ for (const [key, value] of Object.entries(defines)) args.push(`--define:${key}=${value}`);
143
+ console.log(" Embedded the encrypted credentials the build was given");
144
+ }
142
145
  }
143
146
  try {
144
147
  const [cmd, ...cmdArgs] = args;
@@ -160,7 +163,7 @@ async function bundleServer(options) {
160
163
  masterKey
161
164
  };
162
165
  }
163
-
164
166
  //#endregion
165
167
  exports.bundleServer = bundleServer;
166
- //# sourceMappingURL=bundler-CaTGtiaO.cjs.map
168
+
169
+ //# sourceMappingURL=bundler-B4GDxImV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler-B4GDxImV.cjs","names":["require","createRequire","join","dirname","mkdir","existsSync","readFileSync","spawnSync","writeFile"],"sources":["../src/build/bundler.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\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/** Packages to exclude from bundling */\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}\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 mjsOutput = join(outputDir, options.outfile ?? 'server.mjs');\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];\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\t// Add external packages (user-specified)\n\tfor (const ext of external) {\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\treturn {\n\t\toutputPath: mjsOutput,\n\t\tmasterKey,\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,wBACL;;;;;;;;;;;;;AAwCD,SAAS,gBAAwB;CAChC,MAAMA,aAAAA,GAAUC,YAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B;CAE7C,IAAI;EAGH,MAAM,MAAMD,UAAQ,QAAQ,sBAAsB;EAClD,QAAA,GAAOE,UAAAA,KAAAA,EAAAA,GAAKC,UAAAA,QAAAA,CAAQ,GAAG,GAAG,OAAO,SAAS;CAC3C,QAAQ;EAGP,OAAO;CACR;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,eAAe,uBACd,YACoB;CAIpB,MAAM,2BAAW,IAAI,IAAY;CAEjC,KAAK,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AAY;EACZ;CACD;AACD"}
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { dirname, join } from "node:path";
3
+ import { existsSync, readFileSync } from "node:fs";
3
4
  import { mkdir, writeFile } from "node:fs/promises";
4
5
  import { spawnSync } from "node:child_process";
5
-
6
6
  //#region src/build/bundler.ts
7
7
  /**
8
8
  * Banner to inject into ESM bundle for CJS compatibility.
@@ -62,16 +62,10 @@ async function collectRequiredEnvVars(constructs) {
62
62
  * @param options - Bundle configuration options
63
63
  * @returns Bundle result with output path and optional master key
64
64
  */
65
- /** Default env var values for docker compose services */
66
- const DOCKER_SERVICE_ENV_VARS = {
67
- postgres: { DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/app" },
68
- redis: { REDIS_URL: "redis://redis:6379" },
69
- rabbitmq: { RABBITMQ_URL: "amqp://rabbitmq:5672" }
70
- };
71
65
  async function bundleServer(options) {
72
- const { entryPoint, outputDir, minify, sourcemap, external, stage, constructs, dockerServices } = options;
66
+ const { entryPoint, outputDir, minify, sourcemap, external, stage, constructs } = options;
73
67
  await mkdir(outputDir, { recursive: true });
74
- const mjsOutput = join(outputDir, "server.mjs");
68
+ const mjsOutput = join(outputDir, options.outfile ?? "server.mjs");
75
69
  const args = [
76
70
  esbuildBinary(),
77
71
  entryPoint,
@@ -83,28 +77,25 @@ async function bundleServer(options) {
83
77
  "--packages=bundle",
84
78
  `--banner:js=${ESM_CJS_COMPAT_BANNER}`
85
79
  ];
86
- if (minify) args.push("--minify");
80
+ if (minify) args.push("--minify", "--keep-names");
87
81
  if (sourcemap) args.push("--sourcemap");
88
82
  for (const ext of external) args.push(`--external:${ext}`);
89
83
  let masterKey;
90
84
  if (stage) {
91
- const { readStageSecrets, toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets, writeStageSecrets } = await import("./storage-DGBzMLZa.mjs");
92
- const { encryptSecrets, generateDefineOptions } = await import("./encryption-YDsXXi6w.mjs");
93
- let secrets = await readStageSecrets(stage);
85
+ const { toEmbeddableSecrets, validateEnvironmentVariables, initStageSecrets } = await import("./seeds-BjcO4DDa.mjs").then((n) => n.Vt);
86
+ const { FileSecretsStore, secretsStoreFor } = await import("./seeds-BjcO4DDa.mjs").then((n) => n.Rt);
87
+ const { ConfigNotFound, loadWorkspaceSettings } = await import("./config.mjs");
88
+ const { encryptSecrets, generateDefineOptions } = await import("./sniffer-b0XPmSyT.mjs").then((n) => n.O);
89
+ const store = await loadWorkspaceSettings().then((workspace) => secretsStoreFor(workspace, stage), (error) => {
90
+ if (error instanceof ConfigNotFound) return new FileSecretsStore(process.cwd());
91
+ throw error;
92
+ });
93
+ let secrets = await store.read(stage);
94
94
  if (!secrets) {
95
95
  console.log(` Initializing secrets for stage "${stage}"...`);
96
96
  secrets = initStageSecrets(stage);
97
- await writeStageSecrets(secrets);
98
- console.log(` ✓ Created .gkm/secrets/${stage}.json`);
99
- }
100
- if (dockerServices) {
101
- for (const [service, enabled] of Object.entries(dockerServices)) if (enabled && DOCKER_SERVICE_ENV_VARS[service]) for (const [envVar, defaultValue] of Object.entries(DOCKER_SERVICE_ENV_VARS[service])) {
102
- const urlKey = envVar;
103
- if (!secrets.urls[urlKey] && !secrets.custom[envVar]) {
104
- secrets.urls[urlKey] = defaultValue;
105
- console.log(` Auto-populated ${envVar} from docker compose`);
106
- }
107
- }
97
+ await store.write(stage, secrets);
98
+ console.log(` ✓ Created the "${stage}" secrets (${store.name})`);
108
99
  }
109
100
  if (constructs && constructs.length > 0) {
110
101
  console.log(" Analyzing environment variable requirements...");
@@ -118,7 +109,7 @@ async function bundleServer(options) {
118
109
  ...validation.missing.map((v) => ` ❌ ${v}`),
119
110
  "",
120
111
  "To fix this, either:",
121
- ` 1. Add the missing variables to .gkm/secrets/${stage}.json using:`,
112
+ ` 1. Add the missing variables to the "${stage}" secrets using:`,
122
113
  ` gkm secrets:set <KEY> <VALUE> --stage ${stage}`,
123
114
  "",
124
115
  ` 2. Or import from a JSON file:`,
@@ -132,12 +123,25 @@ async function bundleServer(options) {
132
123
  console.log(` ✓ All ${requiredVars.length} required environment variables found`);
133
124
  }
134
125
  }
135
- const embeddable = toEmbeddableSecrets(secrets);
136
- const encrypted = encryptSecrets(embeddable);
126
+ const encrypted = encryptSecrets(toEmbeddableSecrets(secrets));
137
127
  masterKey = encrypted.masterKey;
138
128
  const defines = generateDefineOptions(encrypted);
139
- for (const [key, value] of Object.entries(defines)) args.push(`--define:${key}=${JSON.stringify(value)}`);
129
+ for (const [key, value] of Object.entries(defines)) args.push(`--define:${key}=${value}`);
140
130
  console.log(` Secrets encrypted for stage "${stage}"`);
131
+ } else {
132
+ const gkmDir = join(outputDir, "..", "..");
133
+ const encryptedPath = join(gkmDir, "credentials.enc");
134
+ const ivPath = join(gkmDir, "credentials.iv");
135
+ if (existsSync(encryptedPath) && existsSync(ivPath)) {
136
+ const { generateDefineOptions } = await import("./sniffer-b0XPmSyT.mjs").then((n) => n.O);
137
+ const defines = generateDefineOptions({
138
+ encrypted: readFileSync(encryptedPath, "utf-8").trim(),
139
+ iv: readFileSync(ivPath, "utf-8").trim(),
140
+ masterKey: ""
141
+ });
142
+ for (const [key, value] of Object.entries(defines)) args.push(`--define:${key}=${value}`);
143
+ console.log(" Embedded the encrypted credentials the build was given");
144
+ }
141
145
  }
142
146
  try {
143
147
  const [cmd, ...cmdArgs] = args;
@@ -148,8 +152,8 @@ async function bundleServer(options) {
148
152
  });
149
153
  if (result.error) throw result.error;
150
154
  if (result.status !== 0) throw new Error(`esbuild exited with code ${result.status}`);
151
- const { readFile: readFile$1 } = await import("node:fs/promises");
152
- const content = await readFile$1(mjsOutput, "utf-8");
155
+ const { readFile } = await import("node:fs/promises");
156
+ const content = await readFile(mjsOutput, "utf-8");
153
157
  if (!content.startsWith("#!")) await writeFile(mjsOutput, `#!/usr/bin/env node\n${content}`);
154
158
  } catch (error) {
155
159
  throw new Error(`Failed to bundle server: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -159,7 +163,7 @@ async function bundleServer(options) {
159
163
  masterKey
160
164
  };
161
165
  }
162
-
163
166
  //#endregion
164
167
  export { bundleServer };
165
- //# sourceMappingURL=bundler-S3ek7ea-.mjs.map
168
+
169
+ //# sourceMappingURL=bundler-Wd9H4QLJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler-Wd9H4QLJ.mjs","names":[],"sources":["../src/build/bundler.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport type { Construct } from '@geekmidas/constructs';\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/** Packages to exclude from bundling */\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}\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 mjsOutput = join(outputDir, options.outfile ?? 'server.mjs');\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];\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\t// Add external packages (user-specified)\n\tfor (const ext of external) {\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\treturn {\n\t\toutputPath: mjsOutput,\n\t\tmasterKey,\n\t};\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,wBACL;;;;;;;;;;;;;AAwCD,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;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,GAAG,GAAG,SAAS,IAAI,IAAI;CAI5C,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,KAAK;AAClC;;;;;;;;AAUA,eAAsB,aACrB,SACwB;CACxB,MAAM,EACL,YACA,WACA,QACA,WACA,UACA,OACA,eACG;CAGJ,MAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;CAE1C,MAAM,YAAY,KAAK,WAAW,QAAQ,WAAW,YAAY;CAGjE,MAAM,OAAO;EACZ,cAAc;EACd;EACA;EACA;EACA;EACA;EACA,aAAa;EACb;EACA,eAAe;CAChB;CAEA,IAAI,QAGH,KAAK,KAAK,YAAY,cAAc;CAGrC,IAAI,WACH,K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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;CAEA,OAAO;EACN,YAAY;EACZ;CACD;AACD"}
@@ -0,0 +1,71 @@
1
+ const require_credentials = require("./credentials-Zqr3QQYB.cjs");
2
+ const require_deploy = require("./deploy-CFvq8daZ.cjs");
3
+ const require_index = require("./index.cjs");
4
+ const require_provider = require("./provider-BqpjG9QM.cjs");
5
+ const require_terminal = require("./terminal-D_NRPW4W.cjs");
6
+ //#region src/deploy/cli.ts
7
+ /**
8
+ * `gkm deploy`: the terminal around `deploy()`. CLI layer only.
9
+ *
10
+ * Everything that belongs to a person at a terminal lives here and nowhere
11
+ * below it: prompting for a missing login (and storing it), printing progress,
12
+ * and turning the outcome into an exit code. The deploy itself is the same
13
+ * `deploy()` a host calls.
14
+ */
15
+ /**
16
+ * Run `gkm deploy` and resolve with its exit code: 0 when the run finished,
17
+ * 1 when anything stopped it.
18
+ */
19
+ async function deployCli(options, streams = { stdout: process.stdout }) {
20
+ let target = options.target;
21
+ if (options.provider !== void 0 && target === void 0) try {
22
+ target = require_provider.targetForProvider(options.provider, (message) => console.warn(message));
23
+ } catch (error) {
24
+ console.error(require_index.formatError(error));
25
+ return 1;
26
+ }
27
+ const input = {
28
+ cwd: options.cwd,
29
+ stage: options.stage,
30
+ ...target ? { target } : {},
31
+ ...options.tag ? { tag: options.tag } : {},
32
+ ...options.dryRun ? { dryRun: true } : {},
33
+ ...options.atomic ? { atomic: true } : {},
34
+ ...options.allowDevServices ? { allowDevServices: true } : {},
35
+ ...options.skipDns ? { skipDns: true } : {},
36
+ ...options.rotateKeys ? { rotateKeys: true } : {},
37
+ ...options.retireOldKeys ? { retireOldKeys: true } : {}
38
+ };
39
+ if (options.json) {
40
+ const run = require_deploy.deploy({
41
+ ...input,
42
+ credentials: require_credentials.storedCredentials(),
43
+ childOutput: "stderr"
44
+ });
45
+ for await (const event of run) streams.stdout.write(`${JSON.stringify(event)}\n`);
46
+ return run.result.then(() => 0, (error) => {
47
+ console.error(require_index.formatError(error));
48
+ return 1;
49
+ });
50
+ }
51
+ const run = require_deploy.deploy({
52
+ ...input,
53
+ credentials: require_terminal.terminalCredentials(require_credentials.storedCredentials()),
54
+ logger: {
55
+ info: (message) => console.log(message),
56
+ warn: (message) => console.warn(message),
57
+ error: (message) => console.error(message)
58
+ }
59
+ });
60
+ try {
61
+ await run.result;
62
+ return 0;
63
+ } catch (error) {
64
+ console.error(require_index.formatError(error));
65
+ return 1;
66
+ }
67
+ }
68
+ //#endregion
69
+ exports.deployCli = deployCli;
70
+
71
+ //# sourceMappingURL=cli-BZYz55tO.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-BZYz55tO.cjs","names":["targetForProvider","formatError","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 { 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\tconst input = {\n\t\tcwd: options.cwd,\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":";;;;;;;;;;;;;;;;;;AAoDA,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;CAGD,MAAM,QAAQ;EACb,KAAK,QAAQ;EACb,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,MAAMC,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,MAAMF,cAAAA,YAAY,KAAK,CAAC;GAChC,OAAO;EACR,CACD;CACD;CAIA,MAAM,MAAMC,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,MAAMF,cAAAA,YAAY,KAAK,CAAC;EAChC,OAAO;CACR;AACD"}
@@ -0,0 +1,71 @@
1
+ import { r as storedCredentials } from "./credentials-B5N5yKk6.mjs";
2
+ import { t as deploy } from "./deploy-H2S8_mTx.mjs";
3
+ import { i as formatError } from "./index.mjs";
4
+ import { n as targetForProvider } from "./provider-CEOKk8NS.mjs";
5
+ import { terminalCredentials } from "./terminal-CvRLxz6g.mjs";
6
+ //#region src/deploy/cli.ts
7
+ /**
8
+ * `gkm deploy`: the terminal around `deploy()`. CLI layer only.
9
+ *
10
+ * Everything that belongs to a person at a terminal lives here and nowhere
11
+ * below it: prompting for a missing login (and storing it), printing progress,
12
+ * and turning the outcome into an exit code. The deploy itself is the same
13
+ * `deploy()` a host calls.
14
+ */
15
+ /**
16
+ * Run `gkm deploy` and resolve with its exit code: 0 when the run finished,
17
+ * 1 when anything stopped it.
18
+ */
19
+ async function deployCli(options, streams = { stdout: process.stdout }) {
20
+ let target = options.target;
21
+ if (options.provider !== void 0 && target === void 0) try {
22
+ target = targetForProvider(options.provider, (message) => console.warn(message));
23
+ } catch (error) {
24
+ console.error(formatError(error));
25
+ return 1;
26
+ }
27
+ const input = {
28
+ cwd: options.cwd,
29
+ stage: options.stage,
30
+ ...target ? { target } : {},
31
+ ...options.tag ? { tag: options.tag } : {},
32
+ ...options.dryRun ? { dryRun: true } : {},
33
+ ...options.atomic ? { atomic: true } : {},
34
+ ...options.allowDevServices ? { allowDevServices: true } : {},
35
+ ...options.skipDns ? { skipDns: true } : {},
36
+ ...options.rotateKeys ? { rotateKeys: true } : {},
37
+ ...options.retireOldKeys ? { retireOldKeys: true } : {}
38
+ };
39
+ if (options.json) {
40
+ const run = deploy({
41
+ ...input,
42
+ credentials: storedCredentials(),
43
+ childOutput: "stderr"
44
+ });
45
+ for await (const event of run) streams.stdout.write(`${JSON.stringify(event)}\n`);
46
+ return run.result.then(() => 0, (error) => {
47
+ console.error(formatError(error));
48
+ return 1;
49
+ });
50
+ }
51
+ const run = deploy({
52
+ ...input,
53
+ credentials: terminalCredentials(storedCredentials()),
54
+ logger: {
55
+ info: (message) => console.log(message),
56
+ warn: (message) => console.warn(message),
57
+ error: (message) => console.error(message)
58
+ }
59
+ });
60
+ try {
61
+ await run.result;
62
+ return 0;
63
+ } catch (error) {
64
+ console.error(formatError(error));
65
+ return 1;
66
+ }
67
+ }
68
+ //#endregion
69
+ export { deployCli };
70
+
71
+ //# sourceMappingURL=cli-BzrDSNSg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-BzrDSNSg.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 { 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\tconst input = {\n\t\tcwd: options.cwd,\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":";;;;;;;;;;;;;;;;;;AAoDA,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,CACr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