@geekmidas/cli 10.0.0-alpha.19 → 10.0.0-alpha.190

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 (436) hide show
  1. package/README.md +323 -380
  2. package/bin/adjacent-tsconfig.mjs +46 -8
  3. package/bin/gkm.mjs +11 -3
  4. package/bin/owning-tsconfig-jsx-register.mjs +18 -0
  5. package/bin/owning-tsconfig-jsx.mjs +108 -0
  6. package/dist/EndpointGenerator-CBKH87_b.mjs +1043 -0
  7. package/dist/EndpointGenerator-CBKH87_b.mjs.map +1 -0
  8. package/dist/EndpointGenerator-iyA3HkOH.cjs +1102 -0
  9. package/dist/EndpointGenerator-iyA3HkOH.cjs.map +1 -0
  10. package/dist/LegacyStateStore-CWiswz6T.mjs +124 -0
  11. package/dist/LegacyStateStore-CWiswz6T.mjs.map +1 -0
  12. package/dist/LegacyStateStore-CuSe37fl.cjs +124 -0
  13. package/dist/LegacyStateStore-CuSe37fl.cjs.map +1 -0
  14. package/dist/LocalStateStore-BciJ_DF0.cjs +178 -0
  15. package/dist/LocalStateStore-BciJ_DF0.cjs.map +1 -0
  16. package/dist/LocalStateStore-CLHasLJI.mjs +167 -0
  17. package/dist/LocalStateStore-CLHasLJI.mjs.map +1 -0
  18. package/dist/OpenApiTsGenerator-CoVA3Ykv.mjs +534 -0
  19. package/dist/OpenApiTsGenerator-CoVA3Ykv.mjs.map +1 -0
  20. package/dist/OpenApiTsGenerator-vy-fOJgs.cjs +539 -0
  21. package/dist/OpenApiTsGenerator-vy-fOJgs.cjs.map +1 -0
  22. package/dist/S3StateStore-BHLRjoj3.cjs +222 -0
  23. package/dist/S3StateStore-BHLRjoj3.cjs.map +1 -0
  24. package/dist/S3StateStore-CTiv2_ON.mjs +223 -0
  25. package/dist/S3StateStore-CTiv2_ON.mjs.map +1 -0
  26. package/dist/SSMStateStore-BqT3MXXb.cjs +204 -0
  27. package/dist/SSMStateStore-BqT3MXXb.cjs.map +1 -0
  28. package/dist/SSMStateStore-D6qqaem2.mjs +205 -0
  29. package/dist/SSMStateStore-D6qqaem2.mjs.map +1 -0
  30. package/dist/SubscriberGenerator-Cfoz8uTY.mjs +787 -0
  31. package/dist/SubscriberGenerator-Cfoz8uTY.mjs.map +1 -0
  32. package/dist/SubscriberGenerator-CxzECrfj.cjs +852 -0
  33. package/dist/SubscriberGenerator-CxzECrfj.cjs.map +1 -0
  34. package/dist/add-B2OmIQzs.cjs +712 -0
  35. package/dist/add-B2OmIQzs.cjs.map +1 -0
  36. package/dist/add-CXwL549o.mjs +710 -0
  37. package/dist/add-CXwL549o.mjs.map +1 -0
  38. package/dist/appPorts-BoXMwolc.mjs +249 -0
  39. package/dist/appPorts-BoXMwolc.mjs.map +1 -0
  40. package/dist/appPorts-IW-OZmRi.cjs +296 -0
  41. package/dist/appPorts-IW-OZmRi.cjs.map +1 -0
  42. package/dist/aws-BXfiWNbi.cjs +108 -0
  43. package/dist/aws-BXfiWNbi.cjs.map +1 -0
  44. package/dist/aws-BjvSTTcE.mjs +97 -0
  45. package/dist/aws-BjvSTTcE.mjs.map +1 -0
  46. package/dist/awsStore-BYYCmXiq.mjs +121 -0
  47. package/dist/awsStore-BYYCmXiq.mjs.map +1 -0
  48. package/dist/awsStore-DKQUElJL.cjs +138 -0
  49. package/dist/awsStore-DKQUElJL.cjs.map +1 -0
  50. package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
  51. package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
  52. package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
  53. package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
  54. package/dist/backups/runner.cjs +1007 -0
  55. package/dist/backups/runner.cjs.map +1 -0
  56. package/dist/backups/runner.d.cts +187 -0
  57. package/dist/backups/runner.d.cts.map +1 -0
  58. package/dist/backups/runner.d.mts +187 -0
  59. package/dist/backups/runner.d.mts.map +1 -0
  60. package/dist/backups/runner.mjs +984 -0
  61. package/dist/backups/runner.mjs.map +1 -0
  62. package/dist/{bundler-mwH7WOb1.mjs → bundler-CHXyJFsS.mjs} +68 -15
  63. package/dist/bundler-CHXyJFsS.mjs.map +1 -0
  64. package/dist/{bundler-mjqGAvu1.cjs → bundler-CLoVtcBi.cjs} +67 -14
  65. package/dist/bundler-CLoVtcBi.cjs.map +1 -0
  66. package/dist/cli-Bjua3PaZ.mjs +80 -0
  67. package/dist/cli-Bjua3PaZ.mjs.map +1 -0
  68. package/dist/cli-DiuUr1Am.cjs +80 -0
  69. package/dist/cli-DiuUr1Am.cjs.map +1 -0
  70. package/dist/clientTelemetry-DXuYNH-J.d.cts +10 -0
  71. package/dist/clientTelemetry-DXuYNH-J.d.cts.map +1 -0
  72. package/dist/clientTelemetry-eC8VQ6nB.d.mts +10 -0
  73. package/dist/clientTelemetry-eC8VQ6nB.d.mts.map +1 -0
  74. package/dist/compose-DUOETDhc.mjs +2855 -0
  75. package/dist/compose-DUOETDhc.mjs.map +1 -0
  76. package/dist/compose-gnNrY3NQ.cjs +2939 -0
  77. package/dist/compose-gnNrY3NQ.cjs.map +1 -0
  78. package/dist/config-1zirYXeO.d.mts +300 -0
  79. package/dist/config-1zirYXeO.d.mts.map +1 -0
  80. package/dist/config-rSlB-bXj.d.cts +300 -0
  81. package/dist/config-rSlB-bXj.d.cts.map +1 -0
  82. package/dist/config.cjs +462 -9
  83. package/dist/config.cjs.map +1 -0
  84. package/dist/config.d.cts +4 -117
  85. package/dist/config.d.mts +4 -117
  86. package/dist/config.mjs +446 -3
  87. package/dist/config.mjs.map +1 -0
  88. package/dist/credentialSchemas-D_85KW2k.mjs +236 -0
  89. package/dist/credentialSchemas-D_85KW2k.mjs.map +1 -0
  90. package/dist/credentialSchemas-DjK6xKMk.cjs +271 -0
  91. package/dist/credentialSchemas-DjK6xKMk.cjs.map +1 -0
  92. package/dist/credentials-BI52H1ad.cjs +2911 -0
  93. package/dist/credentials-BI52H1ad.cjs.map +1 -0
  94. package/dist/credentials-Cp09PIsc.cjs +1451 -0
  95. package/dist/credentials-Cp09PIsc.cjs.map +1 -0
  96. package/dist/credentials-DbjLhvix.mjs +1140 -0
  97. package/dist/credentials-DbjLhvix.mjs.map +1 -0
  98. package/dist/credentials-VLP_959f.mjs +2390 -0
  99. package/dist/credentials-VLP_959f.mjs.map +1 -0
  100. package/dist/databases-CV22HzrI.mjs +588 -0
  101. package/dist/databases-CV22HzrI.mjs.map +1 -0
  102. package/dist/databases-DwYYH2mX.cjs +703 -0
  103. package/dist/databases-DwYYH2mX.cjs.map +1 -0
  104. package/dist/dbTunnel-CLsqWr7o.mjs +153 -0
  105. package/dist/dbTunnel-CLsqWr7o.mjs.map +1 -0
  106. package/dist/dbTunnel-DQcdaaLi.cjs +153 -0
  107. package/dist/dbTunnel-DQcdaaLi.cjs.map +1 -0
  108. package/dist/define-BfrNaY82.mjs +106 -0
  109. package/dist/define-BfrNaY82.mjs.map +1 -0
  110. package/dist/define-zKgLY65H.cjs +153 -0
  111. package/dist/define-zKgLY65H.cjs.map +1 -0
  112. package/dist/deploy/public.cjs +210 -0
  113. package/dist/deploy/public.cjs.map +1 -0
  114. package/dist/deploy/public.d.cts +659 -0
  115. package/dist/deploy/public.d.cts.map +1 -0
  116. package/dist/deploy/public.d.mts +659 -0
  117. package/dist/deploy/public.d.mts.map +1 -0
  118. package/dist/deploy/public.mjs +143 -0
  119. package/dist/deploy/public.mjs.map +1 -0
  120. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  121. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  122. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  123. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  124. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  125. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  126. package/dist/deploy/sniffer-hooks.cjs +1 -1
  127. package/dist/deploy/sniffer-hooks.mjs +1 -1
  128. package/dist/deploy/sniffer-loader.cjs +2 -2
  129. package/dist/deploy/sniffer-loader.mjs +1 -1
  130. package/dist/deploy/sniffer-routes-worker.cjs +2 -2
  131. package/dist/deploy/sniffer-routes-worker.mjs +1 -1
  132. package/dist/deploy-DhIy2Ftj.mjs +3854 -0
  133. package/dist/deploy-DhIy2Ftj.mjs.map +1 -0
  134. package/dist/deploy-DpQ_4Pu1.cjs +3910 -0
  135. package/dist/deploy-DpQ_4Pu1.cjs.map +1 -0
  136. package/dist/destroy-DmTDT6V7.cjs +791 -0
  137. package/dist/destroy-DmTDT6V7.cjs.map +1 -0
  138. package/dist/destroy-wV9yNLQV.mjs +790 -0
  139. package/dist/destroy-wV9yNLQV.mjs.map +1 -0
  140. package/dist/discover-Dfmn6HQ7.mjs +940 -0
  141. package/dist/discover-Dfmn6HQ7.mjs.map +1 -0
  142. package/dist/discover-OXczlq08.cjs +1085 -0
  143. package/dist/discover-OXczlq08.cjs.map +1 -0
  144. package/dist/dokploy-B61ww4Yb.cjs +38 -0
  145. package/dist/dokploy-B61ww4Yb.cjs.map +1 -0
  146. package/dist/dokploy-Jhl3sPd4.mjs +38 -0
  147. package/dist/dokploy-Jhl3sPd4.mjs.map +1 -0
  148. package/dist/drivers-BQRb3KsL.mjs +294 -0
  149. package/dist/drivers-BQRb3KsL.mjs.map +1 -0
  150. package/dist/drivers-DP7__dJX.cjs +377 -0
  151. package/dist/drivers-DP7__dJX.cjs.map +1 -0
  152. package/dist/eas-BmvO40xS.mjs +334 -0
  153. package/dist/eas-BmvO40xS.mjs.map +1 -0
  154. package/dist/eas-X09Gz8_E.cjs +337 -0
  155. package/dist/eas-X09Gz8_E.cjs.map +1 -0
  156. package/dist/emit-C4KSXOeS.mjs +153 -0
  157. package/dist/emit-C4KSXOeS.mjs.map +1 -0
  158. package/dist/emit-DiW0kbue.cjs +164 -0
  159. package/dist/emit-DiW0kbue.cjs.map +1 -0
  160. package/dist/encryption-BBIUewnL.cjs +90 -0
  161. package/dist/encryption-BBIUewnL.cjs.map +1 -0
  162. package/dist/encryption-BOmswIgE.mjs +89 -0
  163. package/dist/encryption-BOmswIgE.mjs.map +1 -0
  164. package/dist/engine-BhjhShKf.cjs +3333 -0
  165. package/dist/engine-BhjhShKf.cjs.map +1 -0
  166. package/dist/engine-DW2H3KNa.mjs +3220 -0
  167. package/dist/engine-DW2H3KNa.mjs.map +1 -0
  168. package/dist/errors-C9uIyIDt.mjs +27 -0
  169. package/dist/errors-C9uIyIDt.mjs.map +1 -0
  170. package/dist/errors-D1x8duqI.cjs +38 -0
  171. package/dist/errors-D1x8duqI.cjs.map +1 -0
  172. package/dist/github-Ptbigbrq.mjs +986 -0
  173. package/dist/github-Ptbigbrq.mjs.map +1 -0
  174. package/dist/github-xUtu4Ur7.cjs +987 -0
  175. package/dist/github-xUtu4Ur7.cjs.map +1 -0
  176. package/dist/googlePlay-B4xhz5xT.cjs +931 -0
  177. package/dist/googlePlay-B4xhz5xT.cjs.map +1 -0
  178. package/dist/googlePlay-C9rrwN5b.mjs +931 -0
  179. package/dist/googlePlay-C9rrwN5b.mjs.map +1 -0
  180. package/dist/iam-D7mXd6by.cjs +521 -0
  181. package/dist/iam-D7mXd6by.cjs.map +1 -0
  182. package/dist/iam-DNlbVN_l.mjs +442 -0
  183. package/dist/iam-DNlbVN_l.mjs.map +1 -0
  184. package/dist/{index-RCUizGxL.d.cts → index-B1gfXH5K.d.mts} +38 -14
  185. package/dist/index-B1gfXH5K.d.mts.map +1 -0
  186. package/dist/{index-B4H4XF7A.d.mts → index-CunkOPOu.d.cts} +38 -14
  187. package/dist/index-CunkOPOu.d.cts.map +1 -0
  188. package/dist/index.cjs +15566 -13457
  189. package/dist/index.cjs.map +1 -1
  190. package/dist/index.mjs +15249 -13138
  191. package/dist/index.mjs.map +1 -1
  192. package/dist/local-CvC-z86k.mjs +224 -0
  193. package/dist/local-CvC-z86k.mjs.map +1 -0
  194. package/dist/local-DAJrhvSC.cjs +241 -0
  195. package/dist/local-DAJrhvSC.cjs.map +1 -0
  196. package/dist/migrate-0-A4BOcd.cjs +272 -0
  197. package/dist/migrate-0-A4BOcd.cjs.map +1 -0
  198. package/dist/migrate-C_36JSwV.mjs +181 -0
  199. package/dist/migrate-C_36JSwV.mjs.map +1 -0
  200. package/dist/migrate-DHbXzZIJ.mjs +267 -0
  201. package/dist/migrate-DHbXzZIJ.mjs.map +1 -0
  202. package/dist/migrate-fGWfv2DV.cjs +181 -0
  203. package/dist/migrate-fGWfv2DV.cjs.map +1 -0
  204. package/dist/next.cjs +59 -0
  205. package/dist/next.cjs.map +1 -0
  206. package/dist/next.d.cts +44 -0
  207. package/dist/next.d.cts.map +1 -0
  208. package/dist/next.d.mts +44 -0
  209. package/dist/next.d.mts.map +1 -0
  210. package/dist/next.mjs +58 -0
  211. package/dist/next.mjs.map +1 -0
  212. package/dist/openapi.cjs +213 -7
  213. package/dist/openapi.cjs.map +1 -0
  214. package/dist/openapi.d.cts +27 -8
  215. package/dist/openapi.d.cts.map +1 -1
  216. package/dist/openapi.d.mts +27 -8
  217. package/dist/openapi.d.mts.map +1 -1
  218. package/dist/openapi.mjs +208 -2
  219. package/dist/openapi.mjs.map +1 -0
  220. package/dist/projectBucket-BAoFOQtA.cjs +263 -0
  221. package/dist/projectBucket-BAoFOQtA.cjs.map +1 -0
  222. package/dist/projectBucket-Dxub09V1.mjs +222 -0
  223. package/dist/projectBucket-Dxub09V1.mjs.map +1 -0
  224. package/dist/provider-BvjDbsTR.mjs +46 -0
  225. package/dist/provider-BvjDbsTR.mjs.map +1 -0
  226. package/dist/provider-DLhgo-mB.cjs +57 -0
  227. package/dist/provider-DLhgo-mB.cjs.map +1 -0
  228. package/dist/publish-BX8_zXaf.cjs +124 -0
  229. package/dist/publish-BX8_zXaf.cjs.map +1 -0
  230. package/dist/publish-DE_yBzlz.mjs +123 -0
  231. package/dist/publish-DE_yBzlz.mjs.map +1 -0
  232. package/dist/ready-DCvnFZnJ.cjs +404 -0
  233. package/dist/ready-DCvnFZnJ.cjs.map +1 -0
  234. package/dist/ready-sSPuiZ7N.mjs +375 -0
  235. package/dist/ready-sSPuiZ7N.mjs.map +1 -0
  236. package/dist/reconcile/public.cjs +3 -5
  237. package/dist/reconcile/public.d.cts +33 -89
  238. package/dist/reconcile/public.d.cts.map +1 -1
  239. package/dist/reconcile/public.d.mts +33 -89
  240. package/dist/reconcile/public.d.mts.map +1 -1
  241. package/dist/reconcile/public.mjs +3 -3
  242. package/dist/reconcile--I7V4Klj.mjs +34 -0
  243. package/dist/reconcile--I7V4Klj.mjs.map +1 -0
  244. package/dist/reconcile-CuCQBa5-.cjs +34 -0
  245. package/dist/reconcile-CuCQBa5-.cjs.map +1 -0
  246. package/dist/resolve-CPB2jkB4.cjs +316 -0
  247. package/dist/resolve-CPB2jkB4.cjs.map +1 -0
  248. package/dist/resolve-DCPtP7-X.mjs +263 -0
  249. package/dist/resolve-DCPtP7-X.mjs.map +1 -0
  250. package/dist/rollback-sefKrjlE.mjs +137 -0
  251. package/dist/rollback-sefKrjlE.mjs.map +1 -0
  252. package/dist/rollback-ygh2qRWo.cjs +166 -0
  253. package/dist/rollback-ygh2qRWo.cjs.map +1 -0
  254. package/dist/runtime-BwiWhqkI.d.cts +82 -0
  255. package/dist/runtime-BwiWhqkI.d.cts.map +1 -0
  256. package/dist/runtime-Dx5F8-IL.d.mts +82 -0
  257. package/dist/runtime-Dx5F8-IL.d.mts.map +1 -0
  258. package/dist/s3-Bcvbg8io.cjs +240 -0
  259. package/dist/s3-Bcvbg8io.cjs.map +1 -0
  260. package/dist/s3-DK1ofU4f.mjs +240 -0
  261. package/dist/s3-DK1ofU4f.mjs.map +1 -0
  262. package/dist/sandbox/config-worker.cjs +43 -0
  263. package/dist/sandbox/config-worker.cjs.map +1 -0
  264. package/dist/sandbox/config-worker.d.cts +1 -0
  265. package/dist/sandbox/config-worker.d.mts +1 -0
  266. package/dist/sandbox/config-worker.mjs +44 -0
  267. package/dist/sandbox/config-worker.mjs.map +1 -0
  268. package/dist/sandbox/credentials-worker.cjs +53 -0
  269. package/dist/sandbox/credentials-worker.cjs.map +1 -0
  270. package/dist/sandbox/credentials-worker.d.cts +1 -0
  271. package/dist/sandbox/credentials-worker.d.mts +1 -0
  272. package/dist/sandbox/credentials-worker.mjs +54 -0
  273. package/dist/sandbox/credentials-worker.mjs.map +1 -0
  274. package/dist/sandbox/discover-worker.cjs +47 -0
  275. package/dist/sandbox/discover-worker.cjs.map +1 -0
  276. package/dist/sandbox/discover-worker.d.cts +1 -0
  277. package/dist/sandbox/discover-worker.d.mts +1 -0
  278. package/dist/sandbox/discover-worker.mjs +48 -0
  279. package/dist/sandbox/discover-worker.mjs.map +1 -0
  280. package/dist/sandbox/migrate-worker.cjs +75 -0
  281. package/dist/sandbox/migrate-worker.cjs.map +1 -0
  282. package/dist/sandbox/migrate-worker.d.cts +1 -0
  283. package/dist/sandbox/migrate-worker.d.mts +1 -0
  284. package/dist/sandbox/migrate-worker.mjs +76 -0
  285. package/dist/sandbox/migrate-worker.mjs.map +1 -0
  286. package/dist/{workspace-CRD9YinV.cjs → schemas-BCwKKA42.mjs} +399 -1179
  287. package/dist/schemas-BCwKKA42.mjs.map +1 -0
  288. package/dist/{workspace-Bu3xNCej.mjs → schemas-BQ_v0lEX.cjs} +487 -982
  289. package/dist/schemas-BQ_v0lEX.cjs.map +1 -0
  290. package/dist/secretsManager-CjTo6CRq.mjs +113 -0
  291. package/dist/secretsManager-CjTo6CRq.mjs.map +1 -0
  292. package/dist/secretsManager-CvmBGjdM.cjs +124 -0
  293. package/dist/secretsManager-CvmBGjdM.cjs.map +1 -0
  294. package/dist/seeds-Bc3niNVb.cjs +382 -0
  295. package/dist/seeds-Bc3niNVb.cjs.map +1 -0
  296. package/dist/seeds-Ccn0Ru2T.mjs +299 -0
  297. package/dist/seeds-Ccn0Ru2T.mjs.map +1 -0
  298. package/dist/serverSetup-ClU2iSeU.cjs +686 -0
  299. package/dist/serverSetup-ClU2iSeU.cjs.map +1 -0
  300. package/dist/serverSetup-D68Otrp0.mjs +686 -0
  301. package/dist/serverSetup-D68Otrp0.mjs.map +1 -0
  302. package/dist/sniffer-CFOmQQit.cjs +1997 -0
  303. package/dist/sniffer-CFOmQQit.cjs.map +1 -0
  304. package/dist/sniffer-CRF3eD_B.mjs +1824 -0
  305. package/dist/sniffer-CRF3eD_B.mjs.map +1 -0
  306. package/dist/snsSubscriptions-CwA6Ceg2.mjs +1024 -0
  307. package/dist/snsSubscriptions-CwA6Ceg2.mjs.map +1 -0
  308. package/dist/snsSubscriptions-S_CMCXqI.cjs +1149 -0
  309. package/dist/snsSubscriptions-S_CMCXqI.cjs.map +1 -0
  310. package/dist/sst-BgG7dJJu.cjs +514 -0
  311. package/dist/sst-BgG7dJJu.cjs.map +1 -0
  312. package/dist/sst-CDnHFO3U.mjs +491 -0
  313. package/dist/sst-CDnHFO3U.mjs.map +1 -0
  314. package/dist/stack-BXmLQf3K.mjs +10920 -0
  315. package/dist/stack-BXmLQf3K.mjs.map +1 -0
  316. package/dist/stack-BtnflNSa.cjs +11901 -0
  317. package/dist/stack-BtnflNSa.cjs.map +1 -0
  318. package/dist/stage-BbQidxxa.mjs +302 -0
  319. package/dist/stage-BbQidxxa.mjs.map +1 -0
  320. package/dist/stage-ssuPXLhP.cjs +331 -0
  321. package/dist/stage-ssuPXLhP.cjs.map +1 -0
  322. package/dist/stages-CQwD2QxS.cjs +190 -0
  323. package/dist/stages-CQwD2QxS.cjs.map +1 -0
  324. package/dist/stages-MA2sXnX4.mjs +190 -0
  325. package/dist/stages-MA2sXnX4.mjs.map +1 -0
  326. package/dist/target/public.cjs +15 -0
  327. package/dist/target/public.d.cts +28 -0
  328. package/dist/target/public.d.cts.map +1 -0
  329. package/dist/target/public.d.mts +28 -0
  330. package/dist/target/public.d.mts.map +1 -0
  331. package/dist/target/public.mjs +4 -0
  332. package/dist/terminal-BEGE1AEV.mjs +85 -0
  333. package/dist/terminal-BEGE1AEV.mjs.map +1 -0
  334. package/dist/terminal-BecJpgA3.cjs +85 -0
  335. package/dist/terminal-BecJpgA3.cjs.map +1 -0
  336. package/dist/{types-7R81hu0i.d.mts → types-BvokH0ya.d.cts} +2235 -459
  337. package/dist/types-BvokH0ya.d.cts.map +1 -0
  338. package/dist/{types-N7c2O2m7.d.cts → types-DmLnGeii.d.mts} +2233 -459
  339. package/dist/types-DmLnGeii.d.mts.map +1 -0
  340. package/dist/utils-CdKxD8Lt.mjs +156 -0
  341. package/dist/utils-CdKxD8Lt.mjs.map +1 -0
  342. package/dist/utils-DBqXbB8P.cjs +205 -0
  343. package/dist/utils-DBqXbB8P.cjs.map +1 -0
  344. package/dist/vitest.cjs +65 -0
  345. package/dist/vitest.cjs.map +1 -0
  346. package/dist/vitest.d.cts +29 -0
  347. package/dist/vitest.d.cts.map +1 -0
  348. package/dist/vitest.d.mts +29 -0
  349. package/dist/vitest.d.mts.map +1 -0
  350. package/dist/vitest.mjs +65 -0
  351. package/dist/vitest.mjs.map +1 -0
  352. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  353. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  354. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  355. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  356. package/dist/workspace/index.cjs +6 -2
  357. package/dist/workspace/index.d.cts +3 -3
  358. package/dist/workspace/index.d.mts +3 -3
  359. package/dist/workspace/index.mjs +2 -2
  360. package/dist/workspace-DEmfa9RO.cjs +3689 -0
  361. package/dist/workspace-DEmfa9RO.cjs.map +1 -0
  362. package/dist/workspace-RgU7TBgg.mjs +3133 -0
  363. package/dist/workspace-RgU7TBgg.mjs.map +1 -0
  364. package/package.json +76 -13
  365. package/dist/HostingerProvider-BY26bWwB.mjs +0 -243
  366. package/dist/HostingerProvider-BY26bWwB.mjs.map +0 -1
  367. package/dist/HostingerProvider-BZFGYYVA.cjs +0 -243
  368. package/dist/HostingerProvider-BZFGYYVA.cjs.map +0 -1
  369. package/dist/LocalStateProvider-7HR6SS2t.cjs +0 -48
  370. package/dist/LocalStateProvider-7HR6SS2t.cjs.map +0 -1
  371. package/dist/LocalStateProvider-D7QyJoLM.mjs +0 -48
  372. package/dist/LocalStateProvider-D7QyJoLM.mjs.map +0 -1
  373. package/dist/Route53Provider-Cvj40A8I.mjs +0 -209
  374. package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
  375. package/dist/Route53Provider-DVILBsvV.cjs +0 -209
  376. package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
  377. package/dist/SSMStateProvider-B0Hu1MKZ.mjs +0 -75
  378. package/dist/SSMStateProvider-B0Hu1MKZ.mjs.map +0 -1
  379. package/dist/SSMStateProvider-VrQ-yeqd.cjs +0 -74
  380. package/dist/SSMStateProvider-VrQ-yeqd.cjs.map +0 -1
  381. package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
  382. package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
  383. package/dist/bundler-mjqGAvu1.cjs.map +0 -1
  384. package/dist/bundler-mwH7WOb1.mjs.map +0 -1
  385. package/dist/config-DSXI480r.cjs +0 -467
  386. package/dist/config-DSXI480r.cjs.map +0 -1
  387. package/dist/config-DdKkoUE1.mjs +0 -414
  388. package/dist/config-DdKkoUE1.mjs.map +0 -1
  389. package/dist/config.d.cts.map +0 -1
  390. package/dist/config.d.mts.map +0 -1
  391. package/dist/credentials-C6Pfn6GY.cjs +0 -2939
  392. package/dist/credentials-C6Pfn6GY.cjs.map +0 -1
  393. package/dist/credentials-lbv-j0Be.mjs +0 -2802
  394. package/dist/credentials-lbv-j0Be.mjs.map +0 -1
  395. package/dist/discover-BERGFg8v.cjs +0 -288
  396. package/dist/discover-BERGFg8v.cjs.map +0 -1
  397. package/dist/discover-CK-n3w6b.mjs +0 -244
  398. package/dist/discover-CK-n3w6b.mjs.map +0 -1
  399. package/dist/emit-BdoPFjZf.cjs +0 -253
  400. package/dist/emit-BdoPFjZf.cjs.map +0 -1
  401. package/dist/emit-Bzq7JsMP.mjs +0 -224
  402. package/dist/emit-Bzq7JsMP.mjs.map +0 -1
  403. package/dist/generator-LfZU7NlU.mjs +0 -247
  404. package/dist/generator-LfZU7NlU.mjs.map +0 -1
  405. package/dist/generator-Wdfp0jCS.cjs +0 -282
  406. package/dist/generator-Wdfp0jCS.cjs.map +0 -1
  407. package/dist/github-BvfpvBcW.cjs +0 -216
  408. package/dist/github-BvfpvBcW.cjs.map +0 -1
  409. package/dist/github-DW3CP-4D.mjs +0 -216
  410. package/dist/github-DW3CP-4D.mjs.map +0 -1
  411. package/dist/index-B4H4XF7A.d.mts.map +0 -1
  412. package/dist/index-RCUizGxL.d.cts.map +0 -1
  413. package/dist/openapi-B8bu_OXN.cjs +0 -2038
  414. package/dist/openapi-B8bu_OXN.cjs.map +0 -1
  415. package/dist/openapi-DfjbhrsM.mjs +0 -1991
  416. package/dist/openapi-DfjbhrsM.mjs.map +0 -1
  417. package/dist/reconcile-gb1lz1Dk.mjs +0 -113
  418. package/dist/reconcile-gb1lz1Dk.mjs.map +0 -1
  419. package/dist/reconcile-hx_vBvux.cjs +0 -136
  420. package/dist/reconcile-hx_vBvux.cjs.map +0 -1
  421. package/dist/ssm-BKN1Cg4z.mjs +0 -60
  422. package/dist/ssm-BKN1Cg4z.mjs.map +0 -1
  423. package/dist/ssm-FxeSAt35.cjs +0 -60
  424. package/dist/ssm-FxeSAt35.cjs.map +0 -1
  425. package/dist/storage-DgypfSD6.cjs +0 -351
  426. package/dist/storage-DgypfSD6.cjs.map +0 -1
  427. package/dist/storage-TP0x118M.mjs +0 -304
  428. package/dist/storage-TP0x118M.mjs.map +0 -1
  429. package/dist/transfer-DjFZRgub.mjs +0 -122
  430. package/dist/transfer-DjFZRgub.mjs.map +0 -1
  431. package/dist/transfer-SeiSeKEF.cjs +0 -151
  432. package/dist/transfer-SeiSeKEF.cjs.map +0 -1
  433. package/dist/types-7R81hu0i.d.mts.map +0 -1
  434. package/dist/types-N7c2O2m7.d.cts.map +0 -1
  435. package/dist/workspace-Bu3xNCej.mjs.map +0 -1
  436. package/dist/workspace-CRD9YinV.cjs.map +0 -1
@@ -1,4 +1,147 @@
1
- import { ConstructManifest } from "@geekmidas/manifest";
1
+ import "@geekmidas/edge";
2
+ import { ComposeProxy } from "@geekmidas/edge/routes";
3
+ import { ConstructManifest, Declaration } from "@geekmidas/manifest";
4
+ //#region src/errors.d.ts
5
+ declare class GkmError extends Error {}
6
+ //#endregion
7
+ //#region src/sandbox/sandbox.d.ts
8
+ /** Where a command's output goes. */
9
+ type SandboxOutput = 'capture' | 'inherit' | 'stderr' | 'ignore';
10
+ interface SandboxExecOptions {
11
+ /**
12
+ * Where the command runs: the project root or a directory below it, as an
13
+ * absolute path or relative to the root. Anywhere else is refused with
14
+ * {@link SandboxCwdEscape}.
15
+ */
16
+ cwd: string;
17
+ /**
18
+ * The command's whole environment. Nothing of the host's is added to it:
19
+ * start from {@link Sandbox.env} and add what the step needs.
20
+ */
21
+ env: Readonly<Record<string, string>>;
22
+ /**
23
+ * How long the command may run before it is killed. Required: a step that
24
+ * waits forever — a sniffed entry that opens a server, a build stuck on a
25
+ * prompt — would otherwise hold the deploy, and its lock, forever.
26
+ */
27
+ timeoutMs: number;
28
+ /**
29
+ * Files the command can read, by name. Mounted in a directory of their own
30
+ * — named by `GKM_SECRETS_DIR` in the command's environment — and removed
31
+ * when it exits. Never set as variables, which every child inherits, a
32
+ * crash report prints and `/proc/<pid>/environ` shows.
33
+ */
34
+ secrets?: Readonly<Record<string, string>>;
35
+ /**
36
+ * `capture` (the default) returns stdout and stderr in the result;
37
+ * `inherit` gives the command the host's terminal; `stderr` sends both
38
+ * streams to the host's stderr; `ignore` discards them.
39
+ */
40
+ output?: SandboxOutput;
41
+ /** Kills the command when aborted; `exec` rejects with the signal's reason. */
42
+ signal?: AbortSignal;
43
+ }
44
+ /** How a command ended. A non-zero exit is a result, not an error. */
45
+ interface SandboxResult {
46
+ exitCode: number | null;
47
+ signal: string | null;
48
+ /** What it wrote to stdout, when its output was captured. */
49
+ stdout: string;
50
+ /** What it wrote to stderr, when its output was captured. */
51
+ stderr: string;
52
+ }
53
+ /**
54
+ * Runs a command against the project, and nothing else of the host's.
55
+ *
56
+ * `exec` resolves with the result however the command exited. It rejects
57
+ * with {@link CommandTimedOut} once the timeout passes — after the command is
58
+ * gone — with {@link SandboxCwdEscape} for a directory outside the project,
59
+ * with the signal's reason when aborted, and with the spawn error when the
60
+ * program cannot be started.
61
+ */
62
+ interface Sandbox {
63
+ /** The project: the directory every command runs at or below. */
64
+ readonly root: string;
65
+ /**
66
+ * Whether the code it runs is kept from the host: its files, its
67
+ * processes, its memory.
68
+ *
69
+ * An isolating sandbox shares nothing but what crosses `exec`, so a config
70
+ * reaches the deploy as data — a live object in it (a custom state store,
71
+ * an inline target) cannot cross, and is refused with
72
+ * `ConfigObjectNotSerializable`. A non-isolating one, like
73
+ * {@link LocalSandbox}, runs on the host as the host's user; a project
74
+ * whose config holds live objects is then loaded in-process as before,
75
+ * because a project trusted to run there is trusted to do that.
76
+ */
77
+ readonly isolating: boolean;
78
+ /**
79
+ * The environment a command starts from: what any program needs to run
80
+ * here — `PATH`, `HOME`, the locale — and no credential.
81
+ */
82
+ readonly env: Readonly<Record<string, string>>;
83
+ exec(command: string, args: readonly string[], options: SandboxExecOptions): Promise<SandboxResult>;
84
+ }
85
+ /** The variable naming the directory a command's secrets are mounted in. */
86
+ declare const SECRETS_DIR_ENV = "GKM_SECRETS_DIR";
87
+ /** A command was asked to run outside the project. */
88
+ declare class SandboxCwdEscape extends GkmError {
89
+ readonly cwd: string;
90
+ readonly root: string;
91
+ constructor(cwd: string, root: string);
92
+ }
93
+ /**
94
+ * `cwd` as an absolute directory inside `root`, or {@link SandboxCwdEscape}.
95
+ *
96
+ * Symlinks are resolved on both sides first, so a link inside the project
97
+ * that points out of it is an escape, and a project reached through a link
98
+ * (`/tmp` on macOS) is still itself. For a sandbox of a host's own to call
99
+ * before it runs anything.
100
+ */
101
+ declare function confineCwd(root: string, cwd: string): string;
102
+ /** A secret's file name: one path segment, so it cannot be written elsewhere. */
103
+ declare class SecretNameInvalid extends GkmError {
104
+ readonly secretName: string;
105
+ constructor(secretName: string);
106
+ }
107
+ //#endregion
108
+ //#region src/deploy/identity.d.ts
109
+ interface DeployIdentity {
110
+ /**
111
+ * Whose deploy this is — an organisation, a team, a repository. Two
112
+ * workspaces with the same name are told apart by it. Defaults to the
113
+ * kebab-cased workspace name; set `deploy.namespace` to choose one.
114
+ */
115
+ readonly namespace: string;
116
+ /** The workspace name as the target spells it: lowercase, `[a-z0-9-]`. */
117
+ readonly project: string;
118
+ readonly stage: string;
119
+ /**
120
+ * `<namespace>/<project>`: what a Dokploy project is claimed by.
121
+ *
122
+ * The stage is not part of it because one Dokploy project holds every stage
123
+ * of a workspace, each as an environment — the key has to be the same from
124
+ * every stage that deploys into it.
125
+ */
126
+ readonly key: string;
127
+ /**
128
+ * The prefix every name on the target carries: the project alone in the
129
+ * default namespace, `<namespace>-<project>` in any other.
130
+ *
131
+ * The default adds nothing so that a workspace that never set a namespace
132
+ * keeps the names it was already deployed under — a Postgres is found by
133
+ * its name, and a new name would be a new, empty database.
134
+ */
135
+ readonly scope: string;
136
+ }
137
+ /** What an identity is derived from: a workspace's name and namespace. */
138
+ interface IdentitySource {
139
+ name: string;
140
+ deploy?: {
141
+ namespace?: string;
142
+ };
143
+ }
144
+ declare function deployIdentity(workspace: IdentitySource, stage: string): DeployIdentity;
2
145
  //#endregion
3
146
  //#region src/secrets/types.d.ts
4
147
  /** Credentials for a specific service */
@@ -9,8 +152,6 @@ interface ServiceCredentials {
9
152
  password: string;
10
153
  /** Database name (for postgres) */
11
154
  database?: string;
12
- /** Virtual host (for rabbitmq) */
13
- vhost?: string;
14
155
  /** Bucket name (for minio) */
15
156
  bucket?: string;
16
157
  /** Access key ID (for localstack) */
@@ -26,45 +167,91 @@ interface StageSecrets {
26
167
  createdAt: string;
27
168
  /** ISO timestamp when secrets were last updated */
28
169
  updatedAt: string;
29
- /** Event backend type (if events are enabled) */
30
- eventsBackend?: EventsBackend;
31
170
  /** Service-specific credentials */
32
171
  services: {
33
172
  postgres?: ServiceCredentials;
34
173
  redis?: ServiceCredentials;
35
- rabbitmq?: ServiceCredentials;
36
174
  minio?: ServiceCredentials;
37
175
  mailpit?: ServiceCredentials;
38
176
  localstack?: ServiceCredentials;
39
- pgboss?: ServiceCredentials;
40
177
  };
41
178
  /** Generated connection URLs */
42
179
  urls: {
43
180
  DATABASE_URL?: string;
44
181
  REDIS_URL?: string;
45
- RABBITMQ_URL?: string;
46
182
  STORAGE_ENDPOINT?: string;
47
183
  SMTP_HOST?: string;
48
184
  SMTP_PORT?: string;
49
- EVENT_PUBLISHER_CONNECTION_STRING?: string;
50
- EVENT_SUBSCRIBER_CONNECTION_STRING?: string;
51
185
  };
52
- /** Custom user-defined secrets */
186
+ /**
187
+ * Values injected by key: those set with `gkm secrets:set` — a third
188
+ * party's credentials — and those generated once for the stage, such as an
189
+ * auth server's signing secret.
190
+ */
53
191
  custom: Record<string, string>;
192
+ /**
193
+ * Random, generated once per stage: what every password a deploy derives
194
+ * is salted with. Without it a derived password is a function of the
195
+ * project and stage names, which anyone reading the repo has.
196
+ */
197
+ seed?: string;
54
198
  }
55
199
  //#endregion
56
200
  //#region src/secrets/store.d.ts
57
201
  interface SecretsStore {
58
- /** The stage's secrets, or null if the store holds none for it. */
59
- pull(stage: string): Promise<StageSecrets | null>;
60
- /** Replace the stage's secrets in the store. */
61
- push(stage: string, secrets: StageSecrets): Promise<void>;
202
+ /**
203
+ * Which kind of store this is — `'file'`, `'s3'`, `'ssm'`,
204
+ * `'secrets-manager'`, or a custom one's.
205
+ */
206
+ readonly name: string;
207
+ /** The stage's secrets, or null when it has none here. */
208
+ read(stage: string): Promise<StageSecrets | null>;
209
+ /** Replace the stage's secrets. */
210
+ write(stage: string, secrets: StageSecrets): Promise<void>;
211
+ /**
212
+ * Delete the stage's secrets, every kept version of them included — what
213
+ * `gkm compose --destroy --secrets` does. Optional for a custom store; one
214
+ * without it cannot have its stage's secrets destroyed by gkm.
215
+ */
216
+ delete?(stage: string): Promise<void>;
62
217
  }
63
218
  /** Secrets in SSM Parameter Store, in the account of the active credentials. */
64
219
  interface SsmSecretsStoreConfig {
65
220
  provider: 'ssm';
66
221
  region: string;
67
222
  }
223
+ /**
224
+ * Secrets in AWS Secrets Manager, in the account of the active credentials:
225
+ * one secret per stage, `gkm/<project>/<stage>/secrets`. Up to 64 KB where
226
+ * SSM holds 8 KB, at a monthly price per secret.
227
+ */
228
+ interface SecretsManagerSecretsStoreConfig {
229
+ provider: 'secrets-manager';
230
+ region: string;
231
+ /**
232
+ * The KMS key (id, ARN or alias) a stage's secret is created with. Unset,
233
+ * it is the account's AWS-managed `aws/secretsmanager` key.
234
+ */
235
+ kmsKeyId?: string;
236
+ }
237
+ /**
238
+ * Secrets in S3, one object per stage —
239
+ * `<prefix>/<project>/<stage>/secrets.json` — in the project bucket beside the
240
+ * deploy state and backups, or in a bucket that exists. Encrypted with SSE-S3,
241
+ * every past document kept by the bucket's versioning, and no size limit.
242
+ */
243
+ interface S3SecretsStoreConfig {
244
+ provider: 's3';
245
+ /**
246
+ * A bucket that already exists. Omitted, the project bucket —
247
+ * `gkm-<project>-<account id>`, created by the first write.
248
+ */
249
+ bucket?: string;
250
+ /** The bucket's region. Omitted, the deploy state's, when it is in S3. */
251
+ region?: string;
252
+ /** Key prefix inside the bucket. Omitted, the S3 state's, else `gkm`. */
253
+ prefix?: string;
254
+ }
68
255
  /** Any other backend: an object implementing {@link SecretsStore}. */
69
256
  interface CustomSecretsStoreConfig {
70
257
  provider: SecretsStore;
@@ -73,18 +260,64 @@ interface CustomSecretsStoreConfig {
73
260
  * `secrets.store` in gkm.config.ts.
74
261
  *
75
262
  * `'file'` — the default — keeps each stage's secrets in the encrypted
76
- * `.gkm/secrets/<stage>.json` beside its key in `~/.gkm/`. It cannot serve a
77
- * deploy from CI while `.gkm/` is gitignored; `ssm` or a custom store can.
263
+ * `.gkm/secrets/<stage>.json`, its key in the CLI's home (`GKM_HOME`, else
264
+ * `~/.gkm`). It cannot serve a
265
+ * deploy from CI while `.gkm/` is gitignored; `s3`, `ssm`, `secrets-manager`
266
+ * or a custom store can.
78
267
  */
79
- type SecretsStoreConfig = 'file' | SsmSecretsStoreConfig | CustomSecretsStoreConfig;
268
+ type SecretsStoreConfig = 'file' | S3SecretsStoreConfig | SsmSecretsStoreConfig | SecretsManagerSecretsStoreConfig | CustomSecretsStoreConfig;
80
269
  //#endregion
81
- //#region src/deploy/state.d.ts
270
+ //#region src/compose/cdnConfig.d.ts
271
+ /** The CDNs `deploy.cdn` can name. */
272
+ declare const CDN_PROVIDERS: readonly ['cloudflare'];
273
+ type CdnProvider = (typeof CDN_PROVIDERS)[number];
82
274
  /**
83
- * Deploy state management for Dokploy deployments
275
+ * Where the server's certificate for the hosts the CDN answers comes from —
276
+ * what the CDN checks when it connects to the server:
84
277
  *
85
- * Stores resource IDs (applications, services) per stage to avoid
86
- * re-creating resources on subsequent deploys.
278
+ * - `'origin'` (the default): one the CDN issues for its origin — Cloudflare's
279
+ * Origin CA, through the deploy's token — valid 15 years and trusted by
280
+ * the CDN alone. Kept in the stage's secrets; the server holds no token.
281
+ * - `'dns'`: Let's Encrypt, over the DNS challenge, which the shared Traefik
282
+ * edge answers through the CDN's DNS with `CF_DNS_API_TOKEN`.
87
283
  */
284
+ declare const CDN_CERTIFICATES: readonly ['origin', 'dns'];
285
+ type CdnCertificate = (typeof CDN_CERTIFICATES)[number];
286
+ /**
287
+ * One deployed stage's CDN — `deploy.cdn.<stage>`. `false`, or a stage the
288
+ * map leaves out, serves every host straight from the server.
289
+ */
290
+ type StageCdnConfig = {
291
+ provider: CdnProvider;
292
+ certificate?: CdnCertificate;
293
+ } | false;
294
+ //#endregion
295
+ //#region src/deploy/actor.d.ts
296
+ /**
297
+ * Who wrote a stage's deploy state: a GitHub Actions run, or a person at a
298
+ * machine. Recorded on every state write (`updatedBy`), on every resource
299
+ * record and on every release (`releasedBy`), so "who put this here" has an
300
+ * answer that does not depend on anyone's memory.
301
+ */
302
+ /** A GitHub Actions run: the account that triggered it and the run's page. */
303
+ interface GithubActor {
304
+ kind: 'github';
305
+ /** `GITHUB_ACTOR` — the account that triggered the run. */
306
+ actor: string;
307
+ /** `<server>/<repository>/actions/runs/<run id>` */
308
+ run: string;
309
+ /** `GITHUB_WORKFLOW` — the workflow's name. */
310
+ workflow?: string;
311
+ }
312
+ /** A person at a machine. */
313
+ interface LocalActor {
314
+ kind: 'local';
315
+ user: string;
316
+ host: string;
317
+ }
318
+ type Actor = GithubActor | LocalActor;
319
+ //#endregion
320
+ //#region src/deploy/state.d.ts
88
321
  /**
89
322
  * Per-app database credentials
90
323
  */
@@ -139,12 +372,30 @@ interface BackupState {
139
372
  /** Timestamp when backup was configured */
140
373
  createdAt: string;
141
374
  }
375
+ /** What every target's state for a stage holds. */
376
+ interface StageStateCore {
377
+ stage: string;
378
+ lastDeployedAt: string;
379
+ /**
380
+ * The deploy identity's key (`<namespace>/<project>`) that last deployed
381
+ * this stage — what the project's ownership marker says.
382
+ */
383
+ identity?: string;
384
+ /**
385
+ * Each app's releases, keyed by app name: what runs now, what ran before
386
+ * it — which `gkm deploy:rollback` restores — and the history behind both.
387
+ */
388
+ releases?: Record<string, AppReleases>;
389
+ }
390
+ /** A compose stage's state: the core, and nothing Dokploy-specific. */
391
+ interface ComposeStageState extends StageStateCore {
392
+ provider: 'compose';
393
+ }
142
394
  /**
143
395
  * State for a single stage deployment
144
396
  */
145
- interface DokployStageState {
397
+ interface DokployStageState extends StageStateCore {
146
398
  provider: 'dokploy';
147
- stage: string;
148
399
  /** Dokploy project ID - created on first deploy */
149
400
  projectId: string;
150
401
  environmentId: string;
@@ -163,64 +414,1150 @@ interface DokployStageState {
163
414
  dnsRecords?: Record<string, CreatedDnsRecord>;
164
415
  /** Backup destination state */
165
416
  backups?: BackupState;
166
- lastDeployedAt: string;
417
+ /**
418
+ * The Dokploy registry the stage's images are pulled through. Kept per
419
+ * stage rather than once per machine, so a stage keeps the registry it was
420
+ * deployed with whoever deploys it next.
421
+ */
422
+ registryId?: string;
423
+ }
424
+ /** A stage's state, whichever target wrote it. */
425
+ type StageState = DokployStageState | ComposeStageState;
426
+ /** An image a stage runs: the ref it was pushed as, and what it resolved to. */
427
+ interface DeployedImage {
428
+ ref: string;
429
+ /**
430
+ * The tag it was released under — a site's carries its stage
431
+ * (`v1.4.0-production`). Recorded by targets that pull a release by tag.
432
+ */
433
+ tag?: string;
434
+ /** The registry's digest, `sha256:…` — absent if it could not be read. */
435
+ digest?: string;
436
+ }
437
+ /** An image that went live, and when. */
438
+ interface ReleasedImage extends DeployedImage {
439
+ /** The image tag the deploy released under. */
440
+ tag?: string;
441
+ releasedAt: string;
442
+ /** Who released it — absent on a release recorded before it was kept. */
443
+ releasedBy?: Actor;
444
+ /** Set when a rollback replaced it: it is never rolled back *to*. */
445
+ rolledBack?: true;
446
+ }
447
+ /** An app's releases: what runs, what ran before it, and what ran before that. */
448
+ interface AppReleases {
449
+ current: ReleasedImage;
450
+ /** What a rollback restores; absent until a second release. */
451
+ previous?: ReleasedImage;
452
+ /** Every release, newest first, at most {@link RELEASE_HISTORY} of them. */
453
+ history: ReleasedImage[];
454
+ }
455
+ //#endregion
456
+ //#region src/deploy/StateStore.d.ts
457
+ /** Opaque: a file hash, an SSM parameter version or an S3 ETag. */
458
+ type StateVersion = string;
459
+ /**
460
+ * `pending` is written before the call that creates the resource, `ready`
461
+ * once the target has returned its id. A run that finds a `pending` record
462
+ * knows a previous run may have created the resource and should look for it
463
+ * before creating another.
464
+ */
465
+ type ResourceStatus = 'pending' | 'ready';
466
+ interface ResourceRecord {
467
+ /** Unique within the stage, `<type>:<name>` — e.g. `application:api`. */
468
+ key: string;
469
+ /** What kind of resource it is — e.g. `application`, `postgres`. */
470
+ type: string;
471
+ /** The id the target gave it. Absent while `pending`. */
472
+ id?: string;
473
+ status: ResourceStatus;
474
+ /** Whatever the target needs to adopt the resource on a later run. */
475
+ data?: Record<string, unknown>;
476
+ updatedAt: string;
477
+ /** Who wrote the record — absent on one written before it was kept. */
478
+ updatedBy?: Actor;
479
+ }
480
+ /** A resource as a caller hands it to `putResource`; the store stamps it. */
481
+ type ResourceInput = Omit<ResourceRecord, 'updatedAt' | 'updatedBy'>;
482
+ /** One write of a stage's state: which, when, by whom, doing what. */
483
+ interface HistoryEntry {
484
+ serial: number;
485
+ at: string;
486
+ by: Actor;
487
+ /** The lock's operation — `deploy`, `rollback`, `setup`, `state:push` … */
488
+ operation: string;
489
+ }
490
+ interface StoredStageState {
491
+ state: StageState;
492
+ resources: Record<string, ResourceRecord>;
493
+ /** The latest writes, newest first. */
494
+ history: HistoryEntry[];
495
+ /** Pass back as `expectedVersion` to write on top of exactly this read. */
496
+ version: StateVersion;
497
+ }
498
+ interface WriteOptions {
499
+ /**
500
+ * The version this write is based on — `null` to create state that must
501
+ * not exist yet.
502
+ */
503
+ expectedVersion: StateVersion | null;
504
+ }
505
+ interface ResourceWriteOptions {
506
+ /**
507
+ * Omitted, the record is applied on top of whatever is stored now (still
508
+ * conditionally, so a concurrent write raises rather than being lost).
509
+ */
510
+ expectedVersion?: StateVersion;
511
+ }
512
+ interface LockHolder {
513
+ /** Unique per acquisition, so a release never removes someone else's lock. */
514
+ id: string;
515
+ owner: string;
516
+ host: string;
517
+ pid: number;
518
+ acquiredAt: string;
519
+ /** What the holder is doing, e.g. `deploy`. */
520
+ operation?: string;
521
+ }
522
+ interface LockOptions {
523
+ operation?: string;
524
+ }
525
+ interface StateLock {
526
+ readonly stage: string;
527
+ readonly holder: LockHolder;
528
+ /** Removes the lock if it is still this one; safe to call twice. */
529
+ release(): Promise<void>;
530
+ }
531
+ interface StateStore {
532
+ /** Takes the stage's lock, or raises `StateLocked` naming its holder. */
533
+ lock(stage: string, options?: LockOptions): Promise<StateLock>;
534
+ /**
535
+ * Removes the stage's lock whoever holds it, for a run that crashed with
536
+ * it held. Returns the holder it removed, or `null` if there was none.
537
+ */
538
+ forceUnlock(stage: string): Promise<LockHolder | null>;
539
+ read(stage: string): Promise<StoredStageState | null>;
540
+ /** Replaces the stage's state, keeping its resource records. */
541
+ write(stage: string, state: StageState, options: WriteOptions): Promise<StateVersion>;
542
+ putResource(stage: string, record: ResourceInput, options?: ResourceWriteOptions): Promise<StateVersion>;
543
+ deleteResource(stage: string, key: string, options?: ResourceWriteOptions): Promise<StateVersion>;
544
+ /**
545
+ * How big the stage's document is as this store would write it, against
546
+ * the most it can hold — for a store with a limit (SSM). `null` when the
547
+ * stage has no state yet.
548
+ */
549
+ capacity?(stage: string): Promise<StateCapacity | null>;
550
+ }
551
+ /** A stored document's size against the store's limit, in bytes. */
552
+ interface StateCapacity {
553
+ bytes: number;
554
+ limit: number;
555
+ location: string;
556
+ /** The store's AWS region, for the message that suggests S3. */
557
+ region?: string;
558
+ }
559
+ declare class StateLocked extends GkmError {
560
+ readonly stage: string;
561
+ readonly holder: LockHolder | null;
562
+ readonly location: string;
563
+ constructor(stage: string, holder: LockHolder | null, location: string);
564
+ }
565
+ declare class StateVersionConflict extends GkmError {
566
+ readonly stage: string;
567
+ readonly expectedVersion: StateVersion | null;
568
+ readonly actualVersion: StateVersion | null;
569
+ constructor(stage: string, expectedVersion: StateVersion | null, actualVersion: StateVersion | null);
570
+ }
571
+ /**
572
+ * A deploy, setup or rollback of a stage in CI, with the stage's state kept on
573
+ * the runner — which is discarded when the job ends.
574
+ */
575
+ declare class LocalStateInCi extends GkmError {
576
+ readonly stage: string;
577
+ readonly operation: string;
578
+ readonly region: string;
579
+ constructor(stage: string, operation: string, region: string);
580
+ }
581
+ //#endregion
582
+ //#region src/deploy/StateProvider.d.ts
583
+ /**
584
+ * Interface for deployment state storage providers.
585
+ *
586
+ * Implementations must handle:
587
+ * - Reading state for a stage (returns null if not found)
588
+ * - Writing state for a stage (creates or updates)
589
+ */
590
+ interface StateProvider {
591
+ /**
592
+ * Read deployment state for a stage.
593
+ *
594
+ * @param stage - The deployment stage (e.g., 'development', 'production')
595
+ * @returns The state object or null if not found
596
+ */
597
+ read(stage: string): Promise<StageState | null>;
598
+ /**
599
+ * Write deployment state for a stage.
600
+ *
601
+ * @param stage - The deployment stage
602
+ * @param state - The state object to persist
603
+ */
604
+ write(stage: string, state: StageState): Promise<void>;
605
+ }
606
+ /**
607
+ * Valid AWS regions.
608
+ */
609
+ type AwsRegion = 'us-east-1' | 'us-east-2' | 'us-west-1' | 'us-west-2' | 'af-south-1' | 'ap-east-1' | 'ap-south-1' | 'ap-south-2' | 'ap-southeast-1' | 'ap-southeast-2' | 'ap-southeast-3' | 'ap-southeast-4' | 'ap-northeast-1' | 'ap-northeast-2' | 'ap-northeast-3' | 'ca-central-1' | 'eu-central-1' | 'eu-central-2' | 'eu-west-1' | 'eu-west-2' | 'eu-west-3' | 'eu-south-1' | 'eu-south-2' | 'eu-north-1' | 'me-south-1' | 'me-central-1' | 'sa-east-1';
610
+ /**
611
+ * Local state provider config.
612
+ */
613
+ interface LocalStateConfig {
614
+ provider: 'local';
615
+ }
616
+ /**
617
+ * SSM state provider config (requires region).
618
+ */
619
+ interface SSMStateConfig {
620
+ provider: 'ssm';
621
+ /** AWS region (required for SSM provider) */
622
+ region: AwsRegion;
623
+ /** AWS profile name (optional - uses default credential chain if not provided) */
624
+ profile?: string;
167
625
  }
626
+ /**
627
+ * S3 state config: one object per stage, written with conditional puts
628
+ * (`If-Match` / `If-None-Match`), and a lock object beside it.
629
+ *
630
+ * Keys: `<prefix>/<workspace name>/<stage>/state.json` and `lock.json`.
631
+ */
632
+ interface S3StateConfig {
633
+ provider: 's3';
634
+ /**
635
+ * Bucket the state lives in; it must already exist. Omitted, the project
636
+ * bucket — `gkm-<project>-<account id>`, created by the first deploy.
637
+ */
638
+ bucket?: string;
639
+ /** AWS region of the bucket */
640
+ region: AwsRegion;
641
+ /** Key prefix inside the bucket (default: `gkm`) */
642
+ prefix?: string;
643
+ /** AWS profile name (optional - uses default credential chain if not provided) */
644
+ profile?: string;
645
+ }
646
+ /**
647
+ * Custom state provider config.
648
+ */
649
+ interface CustomStateConfig {
650
+ /**
651
+ * Custom implementation. A `StateStore` is used as is; a `StateProvider`
652
+ * still works, but cannot lock — deploy warns `StateStoreWithoutLocking`.
653
+ */
654
+ provider: StateProvider | StateStore;
655
+ }
656
+ /**
657
+ * State configuration types.
658
+ */
659
+ type StateConfig = LocalStateConfig | SSMStateConfig | S3StateConfig | CustomStateConfig;
660
+ //#endregion
661
+ //#region src/reconcile/discover.d.ts
662
+ /** The construct face discovery needs: an id, and the ability to declare. */
663
+ interface Declarable {
664
+ id: string;
665
+ declare(): Declaration[];
666
+ }
667
+ /**
668
+ * Whether a module export is a construct.
669
+ *
670
+ * Deliberately loose about what else it carries — a construct that also has a
671
+ * `service` is still a construct, and requiring one would exclude the kinds that
672
+ * own no address.
673
+ */
674
+ declare function isDeclarable(value: unknown): value is Declarable;
675
+ interface DiscoverOptions {
676
+ /** The glob(s) to search. One pattern, not one per kind. */
677
+ patterns: string | readonly string[];
678
+ cwd?: string;
679
+ /**
680
+ * Re-import changed modules, for the dev watcher.
681
+ *
682
+ * A single glob makes discovery more central, not less: a new construct file
683
+ * has to be picked up on `add`, not only on `change`.
684
+ */
685
+ bustCache?: boolean;
686
+ /**
687
+ * Filled in with where each construct was found, when provided.
688
+ *
689
+ * Discovery is the only thing that knows: it globbed the files and imported
690
+ * them. Everything downstream that needs to *write* an import — the build,
691
+ * generating a server entry that reads a surface's logger — would otherwise
692
+ * have to be told the path in config, which is the string this removes.
693
+ *
694
+ * An out-parameter rather than a second return value so that every existing
695
+ * caller, which wants the manifest and nothing else, is unchanged.
696
+ */
697
+ sources?: Record<string, ConstructSource>;
698
+ /**
699
+ * Filled in, when provided, with the files each worker's background work is
700
+ * declared in — its crons, queue consumers and topic subscribers — keyed by
701
+ * the worker.
702
+ *
703
+ * What says which app's build carries a worker's entry: the one whose
704
+ * directory holds its work. A worker declares no path of its own.
705
+ */
706
+ background?: Record<string, string[]>;
707
+ /**
708
+ * Filled in, when provided, with the files that export something built
709
+ * from each surface — an endpoint, a WebSocket route — keyed by the
710
+ * surface. What a surface that serves itself imports its routes from.
711
+ */
712
+ served?: Record<string, string[]>;
713
+ /**
714
+ * Filled in, when provided, with each worker's subscribers — by the export
715
+ * a push route is named after, and the key its deliveries come from: its
716
+ * topic's, or its bucket's events — keyed by the worker.
717
+ *
718
+ * What says which worker SNS pushes to, and on which paths: a build bound
719
+ * for a server records no subscriber in the manifest, because none has a
720
+ * handler of its own there.
721
+ */
722
+ subscribers?: Record<string, BoundSubscriber[]>;
723
+ /**
724
+ * Import the construct modules in this sandbox rather than in this
725
+ * process. Defaults to the run's own (`withSandbox`), so a deploy's every
726
+ * discovery — the engine's included — happens there; with neither, they
727
+ * are imported here, as before.
728
+ */
729
+ sandbox?: Sandbox;
730
+ }
731
+ /** A worker's subscriber — to a topic or to a bucket — as discovery found it. */
732
+ interface BoundSubscriber {
733
+ /** Its export — what its push route is named after. */
734
+ name: string;
735
+ /**
736
+ * The env key its deliveries come from: its topic's publisher connection
737
+ * string, or its bucket's events connection string. An `sns://` value is
738
+ * what makes SNS push to it.
739
+ */
740
+ connectionKey: string;
741
+ /**
742
+ * The event types a topic subscriber names — its SNS subscription's filter
743
+ * on the `type` attribute the topic's publisher sets. Absent for a
744
+ * bucket's subscriber: S3 sets no such attribute, and the subscriber's own
745
+ * filter decides.
746
+ */
747
+ events?: readonly string[];
748
+ }
749
+ /** Importing a construct module, or declaring one, threw in the sandbox. */
750
+ declare class ConstructDiscoveryFailed extends Error {
751
+ readonly errorName: string;
752
+ readonly detail: string;
753
+ constructor(errorName: string, detail: string);
754
+ }
755
+ /**
756
+ * The constructs' declarations hold something that is not data, and the
757
+ * sandbox they were discovered in hands the deploy nothing but data.
758
+ */
759
+ declare class ConstructsNotSerializable extends Error {
760
+ readonly paths: readonly string[];
761
+ constructor(paths: readonly string[]);
762
+ }
763
+ /** Where a construct was declared, and under what name. */
764
+ interface ConstructSource {
765
+ /** Absolute path to the module that exported it. */
766
+ file: string;
767
+ /** The name it was exported as — what an import statement has to say. */
768
+ exportName: string;
769
+ /**
770
+ * The exported construct itself.
771
+ *
772
+ * What a declaration cannot say — whether it serves itself — the object can
773
+ * be asked, and discovery already imported it.
774
+ */
775
+ construct: unknown;
776
+ }
777
+ /**
778
+ * Build the construct manifest for a project.
779
+ *
780
+ * Runs the manifest's own validation before returning, so an app is wrong here
781
+ * — where the error names a file — rather than at deploy.
782
+ *
783
+ * @throws {DuplicateConstruct} when two exports claim one id.
784
+ */
785
+ declare function discover(options: DiscoverOptions): Promise<ConstructManifest>;
786
+ //#endregion
787
+ //#region src/providers/types.d.ts
788
+ /** The manifest kinds a stage can name a provider for. */
789
+ declare const PROVIDER_KINDS: readonly ['objects', 'inbox', 'email'];
790
+ type ProviderKind = (typeof PROVIDER_KINDS)[number];
791
+ //#endregion
792
+ //#region src/providers/ses/config.d.ts
793
+ /** `inbox: { provider: 'ses' }` — each inbox received by SES in the stage's account. */
794
+ interface SesInboxConfig {
795
+ provider: 'ses';
796
+ /**
797
+ * Where mail is received, and the inbox's bucket and topic live. Defaults
798
+ * to the secrets store's region, then `AWS_REGION` — and must be one SES
799
+ * receives mail in.
800
+ */
801
+ region?: string;
802
+ }
803
+ /**
804
+ * `email: { provider: 'ses' }` — each mail construct sends through SES's SMTP
805
+ * interface in the stage's account.
806
+ */
807
+ interface SesEmailConfig {
808
+ provider: 'ses';
809
+ /**
810
+ * Where mail is sent from: the identity, and the SMTP endpoint the URL
811
+ * names. Defaults to the secrets store's region, then `AWS_REGION`.
812
+ */
813
+ region?: string;
814
+ /**
815
+ * The address mail is sent from — what `<ID>_FROM` holds. Its domain is
816
+ * the SES identity the deploy verifies. Defaults to `noreply@` the
817
+ * stage's domain.
818
+ */
819
+ from?: string;
820
+ }
821
+ //#endregion
822
+ //#region src/deploy/credentials.d.ts
823
+ /**
824
+ * What each kind of credential is asked for with, and what it is.
825
+ *
826
+ * A target that needs a kind the CLI does not know declares it by augmenting
827
+ * this interface, and lists it in its `credentials`:
828
+ *
829
+ * ```ts
830
+ * declare module '@geekmidas/cli/target' {
831
+ * interface CredentialKinds {
832
+ * fly: { request: { org: string }; value: { token: string } };
833
+ * }
834
+ * }
835
+ * ```
836
+ */
837
+ interface CredentialKinds {
838
+ /** The Dokploy API a stage deploys through. */
839
+ dokploy: {
840
+ /** `deploy.dokploy.endpoint`, when the config names one. */
841
+ request: {
842
+ endpoint?: string;
843
+ };
844
+ value: {
845
+ endpoint: string;
846
+ token: string;
847
+ };
848
+ };
849
+ /**
850
+ * A container registry login, for Dokploy to pull with. Asked for only when
851
+ * Dokploy has no registry for `deploy.registry` and one has to be
852
+ * created.
853
+ */
854
+ registry: {
855
+ /** `deploy.registry`. */
856
+ request: {
857
+ url: string;
858
+ };
859
+ value: {
860
+ username: string;
861
+ password: string;
862
+ };
863
+ };
864
+ /**
865
+ * The AWS account a stage deploys to, for the SST target's `sst deploy`.
866
+ * Handed to that one command's environment and to nothing else.
867
+ */
868
+ aws: {
869
+ /** The stage, for a provider that keeps one account per stage. */
870
+ request: {
871
+ stage: string;
872
+ };
873
+ value: AwsCredential;
874
+ };
875
+ /**
876
+ * A GoDaddy Personal Access Token, for a `dns` domain whose provider is
877
+ * `godaddy`. Read on the machine that writes the records — never the
878
+ * server's.
879
+ */
880
+ godaddy: {
881
+ request: Record<never, never>;
882
+ value: GoDaddyCredential;
883
+ };
884
+ /**
885
+ * A Hostinger API token, for a `dns` domain whose provider is
886
+ * `hostinger`. Like GoDaddy's, read where the records are written.
887
+ */
888
+ hostinger: {
889
+ request: Record<never, never>;
890
+ value: HostingerCredential;
891
+ };
892
+ /**
893
+ * A Cloudflare API token, for a `dns` domain whose provider is
894
+ * `cloudflare`. Read where the records are written.
895
+ */
896
+ cloudflare: {
897
+ request: Record<never, never>;
898
+ value: CloudflareCredential;
899
+ };
900
+ }
901
+ /** A Cloudflare API token with Zone:Read and DNS:Edit on the zone. */
902
+ interface CloudflareCredential {
903
+ token: string;
904
+ }
905
+ /** A Hostinger API token, from hpanel.hostinger.com/profile/api. */
906
+ interface HostingerCredential {
907
+ token: string;
908
+ }
909
+ /** A GoDaddy Personal Access Token, sent as `Authorization: Bearer <token>`. */
910
+ interface GoDaddyCredential {
911
+ token: string;
912
+ }
913
+ /**
914
+ * Who to act as on AWS: a named profile, or keys.
915
+ *
916
+ * Never both. Given both, every AWS SDK takes the keys and ignores the
917
+ * profile, so `--profile prod` with staging's keys still exported would deploy
918
+ * production's stack into staging's account — the reason `secretsStoreFor`
919
+ * resolves a named profile on its own, and why this cannot express the mix.
920
+ */
921
+ type AwsCredential = {
922
+ /** A profile in `~/.aws/config` — keys, SSO, an assumed role. */
923
+ profile: string;
924
+ region?: string;
925
+ } | {
926
+ accessKeyId: string;
927
+ secretAccessKey: string;
928
+ /** Present for temporary keys: an assumed role, GitHub's OIDC. */
929
+ sessionToken?: string;
930
+ region?: string;
931
+ };
932
+ type CredentialKind = keyof CredentialKinds;
933
+ /** What a deploy asks a provider for. */
934
+ type CredentialRequest<K extends CredentialKind = CredentialKind> = { [P in K]: {
935
+ kind: P;
936
+ } & CredentialKinds[P]['request']; }[K];
937
+ /** What a provider answers with. */
938
+ type Credential<K extends CredentialKind> = CredentialKinds[K]['value'];
939
+ interface CredentialProvider {
940
+ /**
941
+ * The credential `request` asks for, or `undefined` when this provider has
942
+ * none — the deploy then raises {@link MissingCredential}.
943
+ */
944
+ get<K extends CredentialKind>(request: CredentialRequest<K>, options?: {
945
+ signal?: AbortSignal;
946
+ }): Promise<Credential<K> | undefined>;
947
+ }
948
+ /** A deploy needed a credential, and its provider had none. */
949
+ declare class MissingCredential extends GkmError {
950
+ readonly kind: CredentialKind;
951
+ /** What it was for: the Dokploy endpoint or the registry URL. */
952
+ readonly target: string | undefined;
953
+ /** How to supply it. */
954
+ readonly howToProvide: string;
955
+ constructor(kind: CredentialKind,
956
+ /** What it was for: the Dokploy endpoint or the registry URL. */
957
+ target: string | undefined,
958
+ /** How to supply it. */
959
+ howToProvide?: string);
960
+ }
961
+ /** Whatever was asked for, from the first provider that has it. */
962
+ declare function chainCredentials(...providers: CredentialProvider[]): CredentialProvider;
963
+ interface StoredCredentialsOptions {
964
+ /** Where to read the variables from. Defaults to `process.env`. */
965
+ env?: NodeJS.ProcessEnv;
966
+ /**
967
+ * The CLI's home, whose `credentials.json` holds stored logins. Defaults
968
+ * to `GKM_HOME`, else `~/.gkm`.
969
+ */
970
+ home?: string;
971
+ }
972
+ /**
973
+ * Credentials from the environment, then from what `gkm login` stored. What
974
+ * `deploy()` uses when it is handed no provider.
975
+ *
976
+ * - Dokploy: `DOKPLOY_API_TOKEN` / `DOKPLOY_ENDPOINT`, each falling back to
977
+ * the stored login, and the endpoint finally to `deploy.dokploy.endpoint`.
978
+ * Each half is read on its own: a token is a secret and belongs in the
979
+ * environment, an endpoint is configuration and belongs in the config.
980
+ * - Registry: `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`.
981
+ * - AWS: `AWS_PROFILE` when it is set, and then nothing else; otherwise
982
+ * `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`. The
983
+ * profile winning is `secretsStoreFor`'s rule: a profile is a choice of
984
+ * account someone made, exported keys may be left over from another.
985
+ * Read here, by name, and handed only to the command that deploys — the
986
+ * sandbox every other step runs in passes no `AWS_*` on.
987
+ */
988
+ declare function storedCredentials(options?: StoredCredentialsOptions): CredentialProvider;
989
+ //#endregion
990
+ //#region src/deploy/types.d.ts
991
+ /** Result for a single app deployment in workspace mode */
992
+ interface AppDeployResult {
993
+ /** App name */
994
+ appName: string;
995
+ /** App type */
996
+ type: 'backend' | 'web' | 'mobile';
997
+ /** Whether deployment succeeded */
998
+ success: boolean;
999
+ /** Dokploy application ID */
1000
+ applicationId?: string;
1001
+ /** Docker image reference */
1002
+ imageRef?: string;
1003
+ /** The registry's digest for the image, `sha256:…`, once pushed */
1004
+ digest?: string;
1005
+ /** Deployment URL */
1006
+ url?: string;
1007
+ /** Error message if failed */
1008
+ error?: string;
1009
+ }
1010
+ /** Result from workspace deployment */
1011
+ interface WorkspaceDeployResult {
1012
+ /** Results for each app */
1013
+ apps: AppDeployResult[];
1014
+ /** Dokploy project ID */
1015
+ projectId: string;
1016
+ /** Total number of successful deployments */
1017
+ successCount: number;
1018
+ /** Total number of failed deployments */
1019
+ failedCount: number;
1020
+ }
1021
+ /**
1022
+ * What a deploy did — or, for a dry run, would do. Plain JSON, so it can be
1023
+ * written out as is (`gkm deploy --json` ends with it).
1024
+ */
1025
+ interface DeployResult extends WorkspaceDeployResult {
1026
+ stage: string;
1027
+ /** `<namespace>/<project>`. */
1028
+ identity: string;
1029
+ /** The image tag every app was built with. */
1030
+ tag: string;
1031
+ /** Whether this was a dry run: nothing was created, built or pushed. */
1032
+ dryRun: boolean;
1033
+ /** Dokploy's environment for the stage; empty when a dry run would create it. */
1034
+ environmentId: string;
1035
+ /** Apps left out, and why — a mobile app, another deploy target. */
1036
+ skipped: {
1037
+ app: string;
1038
+ reason: string;
1039
+ }[];
1040
+ /** Each deployed app's public URL. */
1041
+ urls: Record<string, string>;
1042
+ /**
1043
+ * Every resource the run touched, in order: what it applied, or for a dry
1044
+ * run, what it would.
1045
+ */
1046
+ changes: ResourceChange[];
1047
+ }
1048
+ //#endregion
1049
+ //#region src/deploy/events.d.ts
1050
+ /**
1051
+ * The stretch of a deploy an event belongs to.
1052
+ *
1053
+ * - `validate`: the config, the target, the stage, the apps, the lock, the
1054
+ * stage's secrets and what each app reads from its environment
1055
+ * - `plan`: a dry run's lookups — what would be created and what reused
1056
+ * - `provision`: what the apps run on — for Dokploy the project, environment
1057
+ * and registry — and the declared constructs
1058
+ * - `build`: each app's artifact, built without changing anything live
1059
+ * - `release`: the artifacts put live. Dokploy applies the stage's
1060
+ * migrations and runs its seeds, then builds and pushes each image here, beside its
1061
+ * application, because a site's build args are resolved per app — and
1062
+ * checks each backend before any site is released
1063
+ * - `verify`: what was released answers — for Dokploy, each site's DNS
1064
+ * records and health
1065
+ * - `rollback`: the previous release restored, after `release` or `verify`
1066
+ * failed, on a target that can
1067
+ */
1068
+ type DeployPhase = 'validate' | 'plan' | 'provision' | 'build' | 'release' | 'verify' | 'rollback';
1069
+ /** An error, as an event carries it. */
1070
+ interface DeployEventError {
1071
+ /** The error's class name — `MissingCredential`, `StateLocked`. */
1072
+ name: string;
1073
+ message: string;
1074
+ }
1075
+ /**
1076
+ * How a resource came to be used:
1077
+ * - `recorded`: the id the stage's state holds still resolves
1078
+ * - `resumed`: a run that died after creating it is picked up
1079
+ * - `found`: it existed and was looked up
1080
+ * - `created`: this run created it
1081
+ */
1082
+ type ResourceVia = 'recorded' | 'resumed' | 'found' | 'created';
1083
+ /** One resource a deploy touches, planned or applied. */
1084
+ interface ResourceChange {
1085
+ /** `<type>:<name>`, unique within the stage — `application:api`. */
1086
+ key: string;
1087
+ /** `project`, `environment`, `registry`, `application`, `domain`, `image`, or a construct's kind. */
1088
+ resourceType: string;
1089
+ /**
1090
+ * For a plan: whether the run would create it, reuse what exists, or
1091
+ * ensure it (look it up, and create it if missing). For an applied change:
1092
+ * what was done.
1093
+ */
1094
+ action: 'create' | 'reuse' | 'ensure' | 'build';
1095
+ /** The target's id, once there is one. */
1096
+ id?: string;
1097
+ }
1098
+ type DeployEvent = {
1099
+ type: 'deploy.started';
1100
+ stage: string;
1101
+ /** The target the run deploys through, by the name it was given. */
1102
+ target: string;
1103
+ /** `<namespace>/<project>`. */
1104
+ identity: string;
1105
+ tag: string;
1106
+ /** The apps this run deploys, in order. */
1107
+ apps: string[];
1108
+ dryRun: boolean;
1109
+ } | {
1110
+ type: 'phase.started';
1111
+ phase: DeployPhase;
1112
+ } | {
1113
+ type: 'phase.finished';
1114
+ phase: DeployPhase;
1115
+ } |
1116
+ /** A phase threw; `deploy.failed` follows (after a rollback, if any). */
1117
+ {
1118
+ type: 'phase.failed';
1119
+ phase: DeployPhase;
1120
+ error: DeployEventError;
1121
+ } |
1122
+ /**
1123
+ * A progress line, exactly as `gkm deploy` prints it — leading newline and
1124
+ * indentation included, so a terminal renderer prints `message` as is.
1125
+ */
1126
+ {
1127
+ type: 'log';
1128
+ level: 'info' | 'warn' | 'error';
1129
+ message: string;
1130
+ } | {
1131
+ type: 'app.skipped';
1132
+ app: string;
1133
+ reason: string;
1134
+ } | ({
1135
+ type: 'resource.planned';
1136
+ } & ResourceChange) | ({
1137
+ type: 'resource.applied';
1138
+ via: ResourceVia;
1139
+ } & ResourceChange & {
1140
+ id: string;
1141
+ }) | {
1142
+ type: 'artifact.built';
1143
+ app: string;
1144
+ imageRef: string;
1145
+ /** The registry's digest, `sha256:…`, once pushed. */
1146
+ digest?: string;
1147
+ } | {
1148
+ type: 'app.deployed';
1149
+ app: string;
1150
+ applicationId: string;
1151
+ imageRef: string;
1152
+ url: string;
1153
+ } | {
1154
+ type: 'app.failed';
1155
+ app: string;
1156
+ error: DeployEventError;
1157
+ } |
1158
+ /** One check of whether a released app answers. */
1159
+ {
1160
+ type: 'health.checked';
1161
+ app: string;
1162
+ /** What was asked: a URL, or the target's own status check. */
1163
+ url: string;
1164
+ healthy: boolean;
1165
+ /** The HTTP status, when the check was a request. */
1166
+ status?: number;
1167
+ /** 1 for the first check of the app in this run. */
1168
+ attempt: number;
1169
+ } |
1170
+ /**
1171
+ * A deployed stage runs a dev service — `--allow-dev-services` — in place
1172
+ * of real mail or object storage: Mailpit delivers no mail, MinIO keeps
1173
+ * every object on one container's disk. A warning, every run.
1174
+ */
1175
+ {
1176
+ type: 'dev-service.used';
1177
+ service: 'minio' | 'mailpit';
1178
+ stage: string;
1179
+ /** The constructs it stands in for. */
1180
+ constructs: string[];
1181
+ } |
1182
+ /**
1183
+ * The stack's log UI (`deploy.compose.logs`) is up and answering: where
1184
+ * it is and how it is reached — through an SSH tunnel to a loopback
1185
+ * port, or publicly on a host that allows only some addresses.
1186
+ */
1187
+ {
1188
+ type: 'logs.ready';
1189
+ service: 'openobserve';
1190
+ access: 'tunnel' | 'public';
1191
+ /** Where a browser opens it: the tunnel's end, or its public host. */
1192
+ url: string;
1193
+ /** The loopback port it is published on, for a tunnel. */
1194
+ port?: number;
1195
+ /** The addresses a public host answers. */
1196
+ allow?: string[];
1197
+ email: string;
1198
+ } |
1199
+ /**
1200
+ * One construct's migrations applied by the deploy, before any app
1201
+ * started. Only for a construct that had one to apply.
1202
+ */
1203
+ {
1204
+ type: 'migration.applied';
1205
+ /** The construct, by id: `Database`. */
1206
+ construct: string;
1207
+ /** Its folder: `db/database/migrations`. */
1208
+ folder: string;
1209
+ /** The migrations applied, in order. */
1210
+ applied: string[];
1211
+ } |
1212
+ /**
1213
+ * One construct's seeds run by the deploy — after its migrations, before
1214
+ * any app started, every one of them on every deploy. Only for a
1215
+ * construct that has seeds.
1216
+ */
1217
+ {
1218
+ type: 'seed.ran';
1219
+ /** The construct, by id: `Database`. */
1220
+ construct: string;
1221
+ /** Its folder: `db/database/seeds`. */
1222
+ folder: string;
1223
+ /** The seeds run, in order. */
1224
+ seeded: string[];
1225
+ } | {
1226
+ type: 'deploy.finished';
1227
+ result: DeployResult;
1228
+ } | {
1229
+ type: 'deploy.failed';
1230
+ error: DeployEventError;
1231
+ };
1232
+ /** Every `type` a deploy event can have. */
1233
+ type DeployEventType = DeployEvent['type'];
168
1234
  //#endregion
169
- //#region src/deploy/StateProvider.d.ts
1235
+ //#region src/target/types.d.ts
170
1236
  /**
171
- * Interface for deployment state storage providers.
1237
+ * Which family of defaults a target's deploys belong to.
172
1238
  *
173
- * Implementations must handle:
174
- * - Reading state for a stage (returns null if not found)
175
- * - Writing state for a stage (creates or updates)
1239
+ * - `server`: the target runs containers the project controls, so a cache can
1240
+ * live in the database and events go through pg-boss.
1241
+ * - `aws`: the target runs on managed AWS services, so the defaults are
1242
+ * Upstash, S3 and SNS/SQS.
1243
+ *
1244
+ * `gkm dev` and `gkm build` choose backends by it, which is why a target from
1245
+ * a package declares it in its `package.json` too: they read it without
1246
+ * importing the target.
176
1247
  */
177
- interface StateProvider {
1248
+ type DeployRuntime = 'server' | 'aws';
1249
+ /** What a target can do, beyond the phases every target has. */
1250
+ interface DeployTargetCapabilities {
178
1251
  /**
179
- * Read deployment state for a stage.
180
- *
181
- * @param stage - The deployment stage (e.g., 'development', 'production')
182
- * @returns The state object or null if not found
1252
+ * Whether `rollback` restores the previous release. When it does, a failed
1253
+ * `release` or `verify` is rolled back before the deploy reports failure.
183
1254
  */
184
- read(stage: string): Promise<DokployStageState | null>;
1255
+ rollback: boolean;
185
1256
  /**
186
- * Write deployment state for a stage.
187
- *
188
- * @param stage - The deployment stage
189
- * @param state - The state object to persist
1257
+ * Who applies database migrations: the target, as part of `release`, or
1258
+ * the app itself when it starts.
1259
+ */
1260
+ migrations: 'target' | 'app';
1261
+ /**
1262
+ * Whether the target builds container images — and so needs Docker where
1263
+ * the deploy runs, and a registry to push to.
1264
+ */
1265
+ images: boolean;
1266
+ /**
1267
+ * Whether it can also run the project's local stage — `gkm deploy --stage
1268
+ * <local>`. Only a target that runs on this machine can: a stack started
1269
+ * here is the local stage's, while one on a server is shared, and the local
1270
+ * stage's secrets are a developer's. Absent, a deploy refuses the local
1271
+ * stage with `UndeclaredStage`.
1272
+ */
1273
+ localStage?: boolean;
1274
+ /**
1275
+ * Whether it runs telemetry's self-hosted provider — OpenObserve beside
1276
+ * the apps — for a stage whose `deploy.telemetry` asks for it, or names
1277
+ * nothing. Absent, a stage that uses a `Telemetry` construct names a
1278
+ * provider of its own (`otlp`) or opts out with `false`.
190
1279
  */
191
- write(stage: string, state: DokployStageState): Promise<void>;
1280
+ selfHostedTelemetry?: boolean;
1281
+ }
1282
+ /** A failed validation of a target's options, issue by issue. */
1283
+ interface TargetOptionsIssue {
1284
+ readonly message: string;
1285
+ readonly path?: ReadonlyArray<PropertyKey | {
1286
+ readonly key: PropertyKey;
1287
+ }>;
192
1288
  }
1289
+ type TargetOptionsResult<Output> = {
1290
+ readonly value: Output;
1291
+ readonly issues?: undefined;
1292
+ } | {
1293
+ readonly issues: ReadonlyArray<TargetOptionsIssue>;
1294
+ };
193
1295
  /**
194
- * Valid AWS regions.
1296
+ * The schema a target's options are validated with: any Standard Schema —
1297
+ * a Zod, Valibot or ArkType schema is one.
1298
+ *
1299
+ * The interface is the Standard Schema spec's own, copied as the spec asks,
1300
+ * so a target's types do not depend on a package the CLI does not ship.
195
1301
  */
196
- type AwsRegion = 'us-east-1' | 'us-east-2' | 'us-west-1' | 'us-west-2' | 'af-south-1' | 'ap-east-1' | 'ap-south-1' | 'ap-south-2' | 'ap-southeast-1' | 'ap-southeast-2' | 'ap-southeast-3' | 'ap-southeast-4' | 'ap-northeast-1' | 'ap-northeast-2' | 'ap-northeast-3' | 'ca-central-1' | 'eu-central-1' | 'eu-central-2' | 'eu-west-1' | 'eu-west-2' | 'eu-west-3' | 'eu-south-1' | 'eu-south-2' | 'eu-north-1' | 'me-south-1' | 'me-central-1' | 'sa-east-1';
1302
+ interface TargetOptionsSchema<Output = unknown> {
1303
+ readonly '~standard': {
1304
+ readonly version: 1;
1305
+ readonly vendor: string;
1306
+ readonly validate: (value: unknown) => TargetOptionsResult<Output> | Promise<TargetOptionsResult<Output>>;
1307
+ readonly types?: {
1308
+ readonly input: unknown;
1309
+ readonly output: Output;
1310
+ } | undefined;
1311
+ };
1312
+ }
197
1313
  /**
198
- * Local state provider config.
1314
+ * The stage's secrets, as a target reads and writes them.
1315
+ *
1316
+ * Every secret value read through here is masked: a progress line that
1317
+ * would print one prints `***` instead, in the terminal and in the events.
199
1318
  */
200
- interface LocalStateConfig {
201
- provider: 'local';
1319
+ interface DeploySecrets {
1320
+ /** Which kind of store holds them — `'file'`, `'s3'`, `'ssm'`, `'secrets-manager'`, or
1321
+ * a custom one's. */
1322
+ readonly store: string;
1323
+ /** The stage's secrets, or null when it has none yet. */
1324
+ read(): Promise<StageSecrets | null>;
1325
+ /** Replace the stage's secrets. */
1326
+ write(secrets: StageSecrets): Promise<void>;
1327
+ /** Mask `value` in everything this run prints or emits from now on. */
1328
+ mask(value: string): void;
1329
+ }
1330
+ /** Where a target's progress lines go: `log` events of the run. */
1331
+ interface DeployTargetLogger {
1332
+ info(message: string): void;
1333
+ warn(message: string): void;
1334
+ error(message: string): void;
202
1335
  }
203
1336
  /**
204
- * SSM state provider config (requires region).
1337
+ * The events a target reports. The run's own — `deploy.*` and `phase.*` —
1338
+ * are the CLI's, which emits them around each phase it calls.
205
1339
  */
206
- interface SSMStateConfig {
207
- provider: 'ssm';
208
- /** AWS region (required for SSM provider) */
209
- region: AwsRegion;
210
- /** AWS profile name (optional - uses default credential chain if not provided) */
211
- profile?: string;
1340
+ type TargetEvent = Exclude<DeployEvent, {
1341
+ type: 'deploy.started' | 'deploy.finished' | 'deploy.failed' | 'phase.started' | 'phase.finished' | 'phase.failed';
1342
+ }>;
1343
+ /** Everything a phase is handed. The same object for every phase of a run. */
1344
+ interface DeployPhaseContext<Options = undefined> {
1345
+ /** The name the target was resolved by — `deploy.default`, `--target`. */
1346
+ readonly target: string;
1347
+ /**
1348
+ * The workspace root. Never `process.cwd()`: a host deploys projects
1349
+ * that are not where it runs.
1350
+ */
1351
+ readonly cwd: string;
1352
+ readonly stage: string;
1353
+ /** The image tag, or whatever version label the target releases under. */
1354
+ readonly tag: string;
1355
+ /**
1356
+ * Whether `tag` was asked for (`--tag`) rather than made up for this run
1357
+ * — by the target's own `tag()`, else `<stage>-<timestamp>`. A target that
1358
+ * releases what CI already pushed when given one tells the two apart here.
1359
+ */
1360
+ readonly tagGiven: boolean;
1361
+ /**
1362
+ * The apps this target deploys, in dependency order: those asked for that
1363
+ * deploy here. Apps that deploy elsewhere are already in `skipped`.
1364
+ */
1365
+ readonly apps: readonly string[];
1366
+ /** The apps the run leaves out, and why. */
1367
+ readonly skipped: readonly {
1368
+ app: string;
1369
+ reason: string;
1370
+ }[];
1371
+ /** Who the deploy is, for naming and claiming what it creates. */
1372
+ readonly identity: DeployIdentity;
1373
+ /** The workspace, with its apps derived from the manifest. */
1374
+ readonly workspace: NormalizedWorkspace;
1375
+ /** What the workspace declares. */
1376
+ readonly manifest: ConstructManifest;
1377
+ /**
1378
+ * Where each Worker's crons, queues and subscribers are declared, from the
1379
+ * same discovery: which workers have work to run, and which app each is
1380
+ * built from (`workerUnits`).
1381
+ */
1382
+ readonly background?: Readonly<Record<string, readonly string[]>>;
1383
+ /**
1384
+ * Each Worker's subscribers, from the same discovery — by export, and the
1385
+ * key its deliveries come from: which of them SNS pushes to.
1386
+ */
1387
+ readonly subscribers?: Readonly<Record<string, readonly BoundSubscriber[]>>;
1388
+ /**
1389
+ * The DNS records the stage's providers asked for on this run, as
1390
+ * `dns-record` keys — set once they have run. A record a provider asked
1391
+ * for on an earlier deploy and not on this one is stale, and pruned with
1392
+ * the stack's. Unset when the providers did not run: then none of theirs
1393
+ * is pruned.
1394
+ */
1395
+ providerDns?: readonly string[];
1396
+ /** The target's options, as its `options` schema parsed them. */
1397
+ readonly options: Options;
1398
+ /**
1399
+ * Look everything up and report what would happen — as `resource.planned`
1400
+ * events — without changing anything. Only `validate` and `plan` run.
1401
+ */
1402
+ readonly dryRun: boolean;
1403
+ /**
1404
+ * When `release` or `verify` fails, roll back every app the run released
1405
+ * rather than only those that failed — for apps that must move together,
1406
+ * an API and the site built against it. Only a target that can roll back
1407
+ * reads it.
1408
+ */
1409
+ readonly atomic: boolean;
1410
+ /**
1411
+ * `--allow-dev-services`: a deployed stage runs the dev service for every
1412
+ * bucket and mail it does not account for — no key in its secrets, no
1413
+ * provider backing the kind. Off by default: a deployed stage's mail and
1414
+ * buckets come from its secrets or its providers, and a server target
1415
+ * refuses one that lacks them. The local stage ignores it — it always
1416
+ * runs both.
1417
+ */
1418
+ readonly allowDevServices: boolean;
1419
+ /**
1420
+ * `--skip-dns`: a server target neither writes its public hosts' DNS
1421
+ * records nor checks that they point at the stage's server — for a CDN or
1422
+ * proxy in front of it, or records written by another step.
1423
+ */
1424
+ readonly skipDns?: boolean;
1425
+ /** Where every credential comes from. Nothing prompts. */
1426
+ readonly credentials: CredentialProvider;
1427
+ /**
1428
+ * The stage's deploy state. A real run holds the stage's lock for every
1429
+ * phase; a dry run holds none and must write nothing.
1430
+ */
1431
+ readonly state: StateStore;
1432
+ readonly secrets: DeploySecrets;
1433
+ readonly logger: DeployTargetLogger;
1434
+ /** Fires when the run is stopped; every phase stops what it is doing. */
1435
+ readonly signal: AbortSignal;
1436
+ /**
1437
+ * Where the output of what a phase spawns goes: the host's terminal, its
1438
+ * stderr (so stdout carries only events), or nowhere.
1439
+ */
1440
+ readonly childOutput: 'inherit' | 'stderr' | 'ignore';
1441
+ /** Report progress. */
1442
+ emit(event: TargetEvent): void;
1443
+ /** Leave an app out of this run, with the reason a person will read. */
1444
+ skip(app: string, reason: string): void;
1445
+ /**
1446
+ * What a resource is called on the target: scoped by the stage and the
1447
+ * identity exactly as the constructs are — `name('api')` is
1448
+ * `production-shop-api`. Two workspaces, or two stages, never share one.
1449
+ */
1450
+ name(resource: string): string;
1451
+ }
1452
+ /** Why `rollback` was called: the phase that failed, and its error. */
1453
+ interface DeployFailure {
1454
+ readonly phase: 'release' | 'verify';
1455
+ readonly error: unknown;
212
1456
  }
213
1457
  /**
214
- * Custom state provider config.
1458
+ * A deploy target.
1459
+ *
1460
+ * The CLI calls the phases in order — `validate`, then `plan` for a dry run,
1461
+ * or `provision → build → release → verify` for a real one — emitting
1462
+ * `phase.started`/`phase.finished` around each. Every phase must be safe to
1463
+ * run again: a deploy stopped part way is finished by deploying again, so a
1464
+ * phase finds what an earlier run made (through `state`) before making it.
1465
+ *
1466
+ * `Run` is whatever the target carries from one phase to the next within a
1467
+ * run — `validate` makes it, every later phase is handed it.
1468
+ *
1469
+ * ```ts
1470
+ * import { defineTarget } from '@geekmidas/cli/target';
1471
+ * import { z } from 'zod';
1472
+ *
1473
+ * export default defineTarget({
1474
+ * name: 'fly',
1475
+ * runtime: 'server',
1476
+ * capabilities: { rollback: true, migrations: 'target', images: true },
1477
+ * options: z.object({ org: z.string(), region: z.string().default('ams') }),
1478
+ * async validate(ctx) {
1479
+ * return { org: ctx.options.org, region: ctx.options.region };
1480
+ * },
1481
+ * async plan(ctx, run) { … },
1482
+ * async release(ctx, run) { … },
1483
+ * async rollback(ctx, run, failure) { … },
1484
+ * result(ctx, run) { … },
1485
+ * });
1486
+ * ```
215
1487
  */
216
- interface CustomStateConfig {
217
- /** Custom StateProvider implementation */
218
- provider: StateProvider;
1488
+ interface DeployTarget<Options = undefined, Run = unknown> {
1489
+ /** The target's own name, for messages. Config refers to it by its key. */
1490
+ readonly name: string;
1491
+ readonly runtime: DeployRuntime;
1492
+ readonly capabilities: DeployTargetCapabilities;
1493
+ /**
1494
+ * What `deploy.targets` may pass it — `[package, options]` — validated
1495
+ * before any phase runs. Without one, the target takes no options.
1496
+ */
1497
+ readonly options?: TargetOptionsSchema<Options>;
1498
+ /**
1499
+ * The kinds of credential it asks the run's `CredentialProvider` for, so a
1500
+ * host or `gkm login` can collect them up front.
1501
+ */
1502
+ readonly credentials?: readonly CredentialKind[];
1503
+ /**
1504
+ * The tag a run releases under when none is asked for. Without one it is
1505
+ * `<stage>-<timestamp>`; a target that builds from the checkout can name
1506
+ * its images after the commit instead.
1507
+ */
1508
+ tag?(where: {
1509
+ readonly cwd: string;
1510
+ readonly stage: string;
1511
+ }): Promise<string>;
1512
+ /**
1513
+ * What the run is — the apps, the images, what each runs with — checked
1514
+ * before anything changes. A build-only run calls it too, so it checks
1515
+ * what building needs; what only a deploy needs is `ready`'s.
1516
+ */
1517
+ validate(ctx: DeployPhaseContext<Options>): Promise<Run>;
1518
+ /**
1519
+ * What only this target checks before a deploy changes anything — compose's
1520
+ * server address and its hosts' DNS. Run after `validate` and the stage's
1521
+ * own readiness check (every key it needs, after its providers wrote
1522
+ * theirs), on a deploy and its dry run. A build-only run never calls it:
1523
+ * an image needs none of it.
1524
+ */
1525
+ ready?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
1526
+ /** A dry run: emit `resource.planned` for what a real run would do. */
1527
+ plan(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
1528
+ /** Create or find what the apps run on, and what they declare. */
1529
+ provision?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
1530
+ /** Build each app's artifact (`artifact.built`), changing nothing live. */
1531
+ build?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
1532
+ /** Put the built artifacts live (`app.deployed`). */
1533
+ release(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
1534
+ /** Check what was released answers (`health.checked`). */
1535
+ verify?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
1536
+ /**
1537
+ * Restore the previous release, after `release` or `verify` failed. Called
1538
+ * only when `capabilities.rollback` is true.
1539
+ */
1540
+ rollback?(ctx: DeployPhaseContext<Options>, run: Run, failure: DeployFailure): Promise<void>;
1541
+ /** What the run did, once its last phase has finished. */
1542
+ result(ctx: DeployPhaseContext<Options>, run: Run): DeployResult | Promise<DeployResult>;
219
1543
  }
220
1544
  /**
221
- * State configuration types.
1545
+ * A target of any options and run state — what the CLI holds once a target
1546
+ * is resolved, its types left behind in the config that named it. The phases
1547
+ * are methods, so their parameters are compared bivariantly and every
1548
+ * `DeployTarget<O, R>` is one.
1549
+ */
1550
+ type AnyDeployTarget = DeployTarget<unknown, unknown>;
1551
+ /** A target's options type, from the target. */
1552
+ type TargetOptions<T> = T extends DeployTarget<infer O, infer _Run> ? O : never;
1553
+ /**
1554
+ * One `deploy.targets` entry:
1555
+ *
1556
+ * - `'@acme/gkm-target'` — a package, its default export the target
1557
+ * - a target object, from `defineTarget` or a package's factory
1558
+ * - `['@acme/gkm-target', { region: 'ams' }]` — either, with options
222
1559
  */
223
- type StateConfig = LocalStateConfig | SSMStateConfig | CustomStateConfig;
1560
+ type DeployTargetEntry = string | AnyDeployTarget | readonly [string | AnyDeployTarget, unknown];
224
1561
  declare namespace json_schema_d_exports {
225
1562
  export { ArraySchema, BaseSchema, BooleanSchema, IntegerSchema, JSONSchema, NullSchema, NumberSchema, ObjectSchema, Schema$1 as Schema, SchemaType, StringSchema, _JSONSchema };
226
1563
  }
@@ -4612,17 +5949,18 @@ declare const FrameworkSchema: ZodUnion<readonly [ZodEnum<{
4612
5949
  */
4613
5950
  type Framework = output$1<typeof FrameworkSchema>;
4614
5951
  /**
4615
- * Supported deploy targets (Phase 1).
4616
- */
4617
- declare const SUPPORTED_DEPLOY_TARGETS: readonly ['dokploy'];
4618
- /**
4619
- * Phase 2 deploy targets (not yet implemented).
5952
+ * The built-in targets a config may name, both deployed by `gkm deploy`:
5953
+ * `dokploy`, and `sst`, which runs `sst deploy` on the manifest `gkm build`
5954
+ * writes.
4620
5955
  */
4621
- declare const PHASE_2_DEPLOY_TARGETS: readonly ['vercel', 'cloudflare'];
5956
+ declare const SUPPORTED_DEPLOY_TARGETS: string[];
5957
+ /** Built-in names reserved for targets that do not exist yet. */
5958
+ declare const PHASE_2_DEPLOY_TARGETS: string[];
4622
5959
  /**
4623
- * Check if a deploy target is supported.
5960
+ * Whether a config may name `target`: a usable built-in, or one of its own
5961
+ * `deploy.targets`.
4624
5962
  */
4625
- declare function isDeployTargetSupported(target: string): boolean;
5963
+ declare function isDeployTargetSupported(target: string, targets?: Record<string, unknown>): boolean;
4626
5964
  /**
4627
5965
  * Check if a deploy target is planned for Phase 2.
4628
5966
  */
@@ -4632,13 +5970,21 @@ declare function isPhase2DeployTarget(target: string): boolean;
4632
5970
  */
4633
5971
  declare function getDeployTargetError(target: string, appName?: string): string;
4634
5972
  /**
4635
- * Combined DNS config that supports both new multi-domain and legacy single-domain formats.
5973
+ * Single DNS provider config (for one domain).
4636
5974
  */
4637
- declare const DnsConfigWithLegacySchema: ZodUnion<readonly [ZodRecord<ZodString, ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{
5975
+ declare const DnsProviderSchema: ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{
4638
5976
  provider: ZodLiteral<"hostinger">;
5977
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
5978
+ mode: ZodLiteral<"cname">;
5979
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
5980
+ }, $strict>]>>;
4639
5981
  ttl: ZodOptional<ZodNumber>;
4640
5982
  }, $strip>, ZodObject<{
4641
5983
  provider: ZodLiteral<"route53">;
5984
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
5985
+ mode: ZodLiteral<"cname">;
5986
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
5987
+ }, $strict>]>>;
4642
5988
  region: ZodOptional<ZodEnum<{
4643
5989
  "af-south-1": "af-south-1";
4644
5990
  "ap-east-1": "ap-east-1";
@@ -4672,67 +6018,25 @@ declare const DnsConfigWithLegacySchema: ZodUnion<readonly [ZodRecord<ZodString,
4672
6018
  hostedZoneId: ZodOptional<ZodString>;
4673
6019
  ttl: ZodOptional<ZodNumber>;
4674
6020
  }, $strip>, ZodObject<{
4675
- provider: ZodLiteral<"cloudflare">;
4676
- ttl: ZodOptional<ZodNumber>;
4677
- }, $strip>, ZodObject<{
4678
- provider: ZodLiteral<"manual">;
4679
- }, $strip>], "provider">, ZodObject<{
4680
- provider: ZodCustom<{
4681
- name: string;
4682
- getRecords: Function;
4683
- upsertRecords: Function;
4684
- }, {
4685
- name: string;
4686
- getRecords: Function;
4687
- upsertRecords: Function;
4688
- }>;
4689
- ttl: ZodOptional<ZodNumber>;
4690
- }, $strip>]>>, ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{
4691
- provider: ZodLiteral<"hostinger">;
4692
- ttl: ZodOptional<ZodNumber>;
4693
- domain: ZodString;
4694
- }, $strip>, ZodObject<{
4695
- provider: ZodLiteral<"route53">;
4696
- region: ZodOptional<ZodEnum<{
4697
- "af-south-1": "af-south-1";
4698
- "ap-east-1": "ap-east-1";
4699
- "ap-northeast-1": "ap-northeast-1";
4700
- "ap-northeast-2": "ap-northeast-2";
4701
- "ap-northeast-3": "ap-northeast-3";
4702
- "ap-south-1": "ap-south-1";
4703
- "ap-south-2": "ap-south-2";
4704
- "ap-southeast-1": "ap-southeast-1";
4705
- "ap-southeast-2": "ap-southeast-2";
4706
- "ap-southeast-3": "ap-southeast-3";
4707
- "ap-southeast-4": "ap-southeast-4";
4708
- "ca-central-1": "ca-central-1";
4709
- "eu-central-1": "eu-central-1";
4710
- "eu-central-2": "eu-central-2";
4711
- "eu-north-1": "eu-north-1";
4712
- "eu-south-1": "eu-south-1";
4713
- "eu-south-2": "eu-south-2";
4714
- "eu-west-1": "eu-west-1";
4715
- "eu-west-2": "eu-west-2";
4716
- "eu-west-3": "eu-west-3";
4717
- "me-central-1": "me-central-1";
4718
- "me-south-1": "me-south-1";
4719
- "sa-east-1": "sa-east-1";
4720
- "us-east-1": "us-east-1";
4721
- "us-east-2": "us-east-2";
4722
- "us-west-1": "us-west-1";
4723
- "us-west-2": "us-west-2";
4724
- }>>;
4725
- profile: ZodOptional<ZodString>;
4726
- hostedZoneId: ZodOptional<ZodString>;
6021
+ provider: ZodLiteral<"godaddy">;
6022
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6023
+ mode: ZodLiteral<"cname">;
6024
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6025
+ }, $strict>]>>;
4727
6026
  ttl: ZodOptional<ZodNumber>;
4728
- domain: ZodString;
4729
6027
  }, $strip>, ZodObject<{
4730
6028
  provider: ZodLiteral<"cloudflare">;
6029
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6030
+ mode: ZodLiteral<"cname">;
6031
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6032
+ }, $strict>]>>;
4731
6033
  ttl: ZodOptional<ZodNumber>;
4732
- domain: ZodString;
4733
6034
  }, $strip>, ZodObject<{
4734
6035
  provider: ZodLiteral<"manual">;
4735
- domain: ZodString;
6036
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6037
+ mode: ZodLiteral<"cname">;
6038
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6039
+ }, $strict>]>>;
4736
6040
  }, $strip>], "provider">, ZodObject<{
4737
6041
  provider: ZodCustom<{
4738
6042
  name: string;
@@ -4743,17 +6047,20 @@ declare const DnsConfigWithLegacySchema: ZodUnion<readonly [ZodRecord<ZodString,
4743
6047
  getRecords: Function;
4744
6048
  upsertRecords: Function;
4745
6049
  }>;
6050
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6051
+ mode: ZodLiteral<"cname">;
6052
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6053
+ }, $strict>]>>;
4746
6054
  ttl: ZodOptional<ZodNumber>;
4747
- domain: ZodString;
4748
- }, $strip>]>]>;
4749
- type DnsConfig = output$1<typeof DnsConfigWithLegacySchema>;
6055
+ }, $strip>]>;
6056
+ type DnsProvider = output$1<typeof DnsProviderSchema>;
4750
6057
  /**
4751
6058
  * Backups configuration schema.
4752
6059
  *
4753
6060
  * Configures automatic backup destinations for database services.
4754
6061
  * On first deploy, creates S3 bucket with unique name and IAM credentials.
4755
6062
  */
4756
- declare const BackupsConfigSchema: ZodObject<{
6063
+ declare const DokployBackupsConfigSchema: ZodObject<{
4757
6064
  type: ZodLiteral<"s3">;
4758
6065
  profile: ZodOptional<ZodString>;
4759
6066
  region: ZodEnum<{
@@ -4788,16 +6095,13 @@ declare const BackupsConfigSchema: ZodObject<{
4788
6095
  schedule: ZodOptional<ZodString>;
4789
6096
  retention: ZodOptional<ZodNumber>;
4790
6097
  }, $strip>;
4791
- type BackupsConfig = output$1<typeof BackupsConfigSchema>;
6098
+ type DokployBackupsConfig = output$1<typeof DokployBackupsConfigSchema>;
4792
6099
  /**
4793
6100
  * Workspace configuration schema.
4794
6101
  */
4795
6102
  declare const WorkspaceConfigSchema: ZodObject<{
4796
6103
  name: ZodOptional<ZodString>;
4797
- constructs: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4798
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4799
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4800
- }, $strip>]>>;
6104
+ constructs: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
4801
6105
  apps: ZodOptional<ZodRecord<ZodString, ZodObject<{
4802
6106
  type: ZodDefault<ZodOptional<ZodEnum<{
4803
6107
  backend: "backend";
@@ -4807,39 +6111,14 @@ declare const WorkspaceConfigSchema: ZodObject<{
4807
6111
  path: ZodString;
4808
6112
  port: ZodNumber;
4809
6113
  dependencies: ZodOptional<ZodArray<ZodString>>;
4810
- deploy: ZodOptional<ZodEnum<{
4811
- cloudflare: "cloudflare";
4812
- dokploy: "dokploy";
4813
- vercel: "vercel";
4814
- }>>;
4815
- constructs: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4816
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4817
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4818
- }, $strip>]>>;
4819
- routes: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4820
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4821
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4822
- }, $strip>]>>;
4823
- functions: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4824
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4825
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4826
- }, $strip>]>>;
4827
- crons: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4828
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4829
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4830
- }, $strip>]>>;
4831
- queues: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4832
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4833
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4834
- }, $strip>]>>;
4835
- topics: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4836
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4837
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4838
- }, $strip>]>>;
4839
- subscribers: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>, ZodObject<{
4840
- paths: ZodUnion<readonly [ZodString, ZodArray<ZodString>]>;
4841
- partition: ZodCustom<(filepath: string) => string, (filepath: string) => string>;
4842
- }, $strip>]>>;
6114
+ deploy: ZodOptional<ZodString>;
6115
+ constructs: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
6116
+ routes: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
6117
+ functions: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
6118
+ crons: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
6119
+ queues: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
6120
+ topics: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
6121
+ subscribers: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
4843
6122
  envParser: ZodOptional<ZodString>;
4844
6123
  logger: ZodOptional<ZodString>;
4845
6124
  hooks: ZodOptional<ZodObject<{
@@ -4854,11 +6133,6 @@ declare const WorkspaceConfigSchema: ZodObject<{
4854
6133
  maxEntries: ZodOptional<ZodNumber>;
4855
6134
  websocket: ZodOptional<ZodBoolean>;
4856
6135
  }, $strip>]>>;
4857
- studio: ZodOptional<ZodUnion<readonly [ZodString, ZodBoolean, ZodObject<{
4858
- enabled: ZodOptional<ZodBoolean>;
4859
- path: ZodOptional<ZodString>;
4860
- schema: ZodOptional<ZodString>;
4861
- }, $strip>]>>;
4862
6136
  openapi: ZodOptional<ZodUnion<readonly [ZodBoolean, ZodObject<{
4863
6137
  enabled: ZodOptional<ZodBoolean>;
4864
6138
  title: ZodOptional<ZodString>;
@@ -4898,78 +6172,190 @@ declare const WorkspaceConfigSchema: ZodObject<{
4898
6172
  }>>;
4899
6173
  }, $strip>>;
4900
6174
  }, $strip>>;
4901
- deploy: ZodOptional<ZodObject<{
4902
- default: ZodOptional<ZodEnum<{
4903
- cloudflare: "cloudflare";
4904
- dokploy: "dokploy";
4905
- vercel: "vercel";
6175
+ domains: ZodOptional<ZodRecord<ZodString, ZodString>>;
6176
+ protectedSubdomains: ZodOptional<ZodArray<ZodString>>;
6177
+ dns: ZodOptional<ZodRecord<ZodString, ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{
6178
+ provider: ZodLiteral<"hostinger">;
6179
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6180
+ mode: ZodLiteral<"cname">;
6181
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6182
+ }, $strict>]>>;
6183
+ ttl: ZodOptional<ZodNumber>;
6184
+ }, $strip>, ZodObject<{
6185
+ provider: ZodLiteral<"route53">;
6186
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6187
+ mode: ZodLiteral<"cname">;
6188
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6189
+ }, $strict>]>>;
6190
+ region: ZodOptional<ZodEnum<{
6191
+ "af-south-1": "af-south-1";
6192
+ "ap-east-1": "ap-east-1";
6193
+ "ap-northeast-1": "ap-northeast-1";
6194
+ "ap-northeast-2": "ap-northeast-2";
6195
+ "ap-northeast-3": "ap-northeast-3";
6196
+ "ap-south-1": "ap-south-1";
6197
+ "ap-south-2": "ap-south-2";
6198
+ "ap-southeast-1": "ap-southeast-1";
6199
+ "ap-southeast-2": "ap-southeast-2";
6200
+ "ap-southeast-3": "ap-southeast-3";
6201
+ "ap-southeast-4": "ap-southeast-4";
6202
+ "ca-central-1": "ca-central-1";
6203
+ "eu-central-1": "eu-central-1";
6204
+ "eu-central-2": "eu-central-2";
6205
+ "eu-north-1": "eu-north-1";
6206
+ "eu-south-1": "eu-south-1";
6207
+ "eu-south-2": "eu-south-2";
6208
+ "eu-west-1": "eu-west-1";
6209
+ "eu-west-2": "eu-west-2";
6210
+ "eu-west-3": "eu-west-3";
6211
+ "me-central-1": "me-central-1";
6212
+ "me-south-1": "me-south-1";
6213
+ "sa-east-1": "sa-east-1";
6214
+ "us-east-1": "us-east-1";
6215
+ "us-east-2": "us-east-2";
6216
+ "us-west-1": "us-west-1";
6217
+ "us-west-2": "us-west-2";
4906
6218
  }>>;
6219
+ profile: ZodOptional<ZodString>;
6220
+ hostedZoneId: ZodOptional<ZodString>;
6221
+ ttl: ZodOptional<ZodNumber>;
6222
+ }, $strip>, ZodObject<{
6223
+ provider: ZodLiteral<"godaddy">;
6224
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6225
+ mode: ZodLiteral<"cname">;
6226
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6227
+ }, $strict>]>>;
6228
+ ttl: ZodOptional<ZodNumber>;
6229
+ }, $strip>, ZodObject<{
6230
+ provider: ZodLiteral<"cloudflare">;
6231
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6232
+ mode: ZodLiteral<"cname">;
6233
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6234
+ }, $strict>]>>;
6235
+ ttl: ZodOptional<ZodNumber>;
6236
+ }, $strip>, ZodObject<{
6237
+ provider: ZodLiteral<"manual">;
6238
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6239
+ mode: ZodLiteral<"cname">;
6240
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6241
+ }, $strict>]>>;
6242
+ }, $strip>], "provider">, ZodObject<{
6243
+ provider: ZodCustom<{
6244
+ name: string;
6245
+ getRecords: Function;
6246
+ upsertRecords: Function;
6247
+ }, {
6248
+ name: string;
6249
+ getRecords: Function;
6250
+ upsertRecords: Function;
6251
+ }>;
6252
+ records: ZodOptional<ZodUnion<readonly [ZodLiteral<"a">, ZodObject<{
6253
+ mode: ZodLiteral<"cname">;
6254
+ target: ZodUnion<readonly [ZodString, ZodRecord<ZodString, ZodString>]>;
6255
+ }, $strict>]>>;
6256
+ ttl: ZodOptional<ZodNumber>;
6257
+ }, $strip>]>>>;
6258
+ deploy: ZodOptional<ZodObject<{
6259
+ default: ZodOptional<ZodString>;
6260
+ targets: ZodOptional<ZodRecord<ZodString, ZodUnion<readonly [ZodString, ZodCustom<unknown, unknown>, ZodTuple<[ZodUnion<readonly [ZodString, ZodCustom<unknown, unknown>]>, ZodUnknown], null>]>>>;
6261
+ namespace: ZodOptional<ZodString>;
6262
+ registry: ZodOptional<ZodString>;
4907
6263
  dokploy: ZodOptional<ZodObject<{
4908
6264
  endpoint: ZodOptional<ZodURL>;
4909
6265
  endpoints: ZodOptional<ZodRecord<ZodString, ZodURL>>;
4910
- registry: ZodOptional<ZodString>;
4911
6266
  registryId: ZodOptional<ZodString>;
4912
- domains: ZodOptional<ZodRecord<ZodString, ZodString>>;
6267
+ backups: ZodOptional<ZodLazy<ZodObject<{
6268
+ type: ZodLiteral<"s3">;
6269
+ profile: ZodOptional<ZodString>;
6270
+ region: ZodEnum<{
6271
+ "af-south-1": "af-south-1";
6272
+ "ap-east-1": "ap-east-1";
6273
+ "ap-northeast-1": "ap-northeast-1";
6274
+ "ap-northeast-2": "ap-northeast-2";
6275
+ "ap-northeast-3": "ap-northeast-3";
6276
+ "ap-south-1": "ap-south-1";
6277
+ "ap-south-2": "ap-south-2";
6278
+ "ap-southeast-1": "ap-southeast-1";
6279
+ "ap-southeast-2": "ap-southeast-2";
6280
+ "ap-southeast-3": "ap-southeast-3";
6281
+ "ap-southeast-4": "ap-southeast-4";
6282
+ "ca-central-1": "ca-central-1";
6283
+ "eu-central-1": "eu-central-1";
6284
+ "eu-central-2": "eu-central-2";
6285
+ "eu-north-1": "eu-north-1";
6286
+ "eu-south-1": "eu-south-1";
6287
+ "eu-south-2": "eu-south-2";
6288
+ "eu-west-1": "eu-west-1";
6289
+ "eu-west-2": "eu-west-2";
6290
+ "eu-west-3": "eu-west-3";
6291
+ "me-central-1": "me-central-1";
6292
+ "me-south-1": "me-south-1";
6293
+ "sa-east-1": "sa-east-1";
6294
+ "us-east-1": "us-east-1";
6295
+ "us-east-2": "us-east-2";
6296
+ "us-west-1": "us-west-1";
6297
+ "us-west-2": "us-west-2";
6298
+ }>;
6299
+ schedule: ZodOptional<ZodString>;
6300
+ retention: ZodOptional<ZodNumber>;
6301
+ }, $strip>>>;
6302
+ verify: ZodOptional<ZodObject<{
6303
+ deploymentTimeoutMs: ZodOptional<ZodNumber>;
6304
+ healthCheckPath: ZodOptional<ZodString>;
6305
+ healthyAfter: ZodOptional<ZodNumber>;
6306
+ intervalMs: ZodOptional<ZodNumber>;
6307
+ healthTimeoutMs: ZodOptional<ZodNumber>;
6308
+ }, $strip>>;
4913
6309
  }, $strip>>;
4914
- dns: ZodOptional<ZodUnion<readonly [ZodRecord<ZodString, ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{
4915
- provider: ZodLiteral<"hostinger">;
4916
- ttl: ZodOptional<ZodNumber>;
4917
- }, $strip>, ZodObject<{
4918
- provider: ZodLiteral<"route53">;
4919
- region: ZodOptional<ZodEnum<{
4920
- "af-south-1": "af-south-1";
4921
- "ap-east-1": "ap-east-1";
4922
- "ap-northeast-1": "ap-northeast-1";
4923
- "ap-northeast-2": "ap-northeast-2";
4924
- "ap-northeast-3": "ap-northeast-3";
4925
- "ap-south-1": "ap-south-1";
4926
- "ap-south-2": "ap-south-2";
4927
- "ap-southeast-1": "ap-southeast-1";
4928
- "ap-southeast-2": "ap-southeast-2";
4929
- "ap-southeast-3": "ap-southeast-3";
4930
- "ap-southeast-4": "ap-southeast-4";
4931
- "ca-central-1": "ca-central-1";
4932
- "eu-central-1": "eu-central-1";
4933
- "eu-central-2": "eu-central-2";
4934
- "eu-north-1": "eu-north-1";
4935
- "eu-south-1": "eu-south-1";
4936
- "eu-south-2": "eu-south-2";
4937
- "eu-west-1": "eu-west-1";
4938
- "eu-west-2": "eu-west-2";
4939
- "eu-west-3": "eu-west-3";
4940
- "me-central-1": "me-central-1";
4941
- "me-south-1": "me-south-1";
4942
- "sa-east-1": "sa-east-1";
4943
- "us-east-1": "us-east-1";
4944
- "us-east-2": "us-east-2";
4945
- "us-west-1": "us-west-1";
4946
- "us-west-2": "us-west-2";
4947
- }>>;
4948
- profile: ZodOptional<ZodString>;
4949
- hostedZoneId: ZodOptional<ZodString>;
4950
- ttl: ZodOptional<ZodNumber>;
4951
- }, $strip>, ZodObject<{
4952
- provider: ZodLiteral<"cloudflare">;
4953
- ttl: ZodOptional<ZodNumber>;
4954
- }, $strip>, ZodObject<{
4955
- provider: ZodLiteral<"manual">;
4956
- }, $strip>], "provider">, ZodObject<{
4957
- provider: ZodCustom<{
4958
- name: string;
4959
- getRecords: Function;
4960
- upsertRecords: Function;
4961
- }, {
4962
- name: string;
4963
- getRecords: Function;
4964
- upsertRecords: Function;
4965
- }>;
4966
- ttl: ZodOptional<ZodNumber>;
4967
- }, $strip>]>>, ZodUnion<readonly [ZodDiscriminatedUnion<[ZodObject<{
4968
- provider: ZodLiteral<"hostinger">;
4969
- ttl: ZodOptional<ZodNumber>;
4970
- domain: ZodString;
4971
- }, $strip>, ZodObject<{
4972
- provider: ZodLiteral<"route53">;
6310
+ compose: ZodOptional<ZodObject<{
6311
+ proxy: ZodOptional<ZodUnion<readonly [ZodEnum<{
6312
+ caddy: "caddy";
6313
+ traefik: "traefik";
6314
+ }>, ZodRecord<ZodString, ZodEnum<{
6315
+ caddy: "caddy";
6316
+ traefik: "traefik";
6317
+ }>>]>>;
6318
+ tls: ZodOptional<ZodRecord<ZodString, ZodObject<{
6319
+ certFile: ZodString;
6320
+ keyFile: ZodString;
6321
+ caFile: ZodOptional<ZodString>;
6322
+ }, $strict>>>;
6323
+ server: ZodOptional<ZodRecord<ZodString, ZodObject<{
6324
+ user: ZodString;
6325
+ host: ZodOptional<ZodString>;
6326
+ port: ZodOptional<ZodNumber>;
6327
+ }, $strict>>>;
6328
+ }, $strict>>;
6329
+ telemetry: ZodOptional<ZodRecord<ZodString, ZodUnion<readonly [ZodLiteral<false>, ZodLiteral<"self-hosted">, ZodObject<{
6330
+ provider: ZodLiteral<"self-hosted">;
6331
+ port: ZodOptional<ZodNumber>;
6332
+ retentionDays: ZodOptional<ZodNumber>;
6333
+ public: ZodOptional<ZodObject<{
6334
+ allow: ZodArray<ZodString>;
6335
+ }, $strip>>;
6336
+ sampleRate: ZodOptional<ZodNumber>;
6337
+ }, $strict>, ZodObject<{
6338
+ provider: ZodLiteral<"otlp">;
6339
+ endpoint: ZodString;
6340
+ headers: ZodOptional<ZodRecord<ZodString, ZodString>>;
6341
+ sampleRate: ZodOptional<ZodNumber>;
6342
+ }, $strict>]>>>;
6343
+ objects: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
6344
+ inbox: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
6345
+ email: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
6346
+ backups: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
6347
+ cdn: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
6348
+ }, $strip>>;
6349
+ stages: ZodObject<{
6350
+ local: ZodString;
6351
+ deployed: ZodArray<ZodString>;
6352
+ protected: ZodOptional<ZodArray<ZodString>>;
6353
+ }, $strip>;
6354
+ secrets: ZodOptional<ZodObject<{
6355
+ enabled: ZodOptional<ZodBoolean>;
6356
+ store: ZodOptional<ZodUnion<readonly [ZodLiteral<"file">, ZodObject<{
6357
+ provider: ZodLiteral<"s3">;
6358
+ bucket: ZodOptional<ZodString>;
4973
6359
  region: ZodOptional<ZodEnum<{
4974
6360
  "af-south-1": "af-south-1";
4975
6361
  "ap-east-1": "ap-east-1";
@@ -4996,36 +6382,12 @@ declare const WorkspaceConfigSchema: ZodObject<{
4996
6382
  "sa-east-1": "sa-east-1";
4997
6383
  "us-east-1": "us-east-1";
4998
6384
  "us-east-2": "us-east-2";
4999
- "us-west-1": "us-west-1";
5000
- "us-west-2": "us-west-2";
5001
- }>>;
5002
- profile: ZodOptional<ZodString>;
5003
- hostedZoneId: ZodOptional<ZodString>;
5004
- ttl: ZodOptional<ZodNumber>;
5005
- domain: ZodString;
5006
- }, $strip>, ZodObject<{
5007
- provider: ZodLiteral<"cloudflare">;
5008
- ttl: ZodOptional<ZodNumber>;
5009
- domain: ZodString;
5010
- }, $strip>, ZodObject<{
5011
- provider: ZodLiteral<"manual">;
5012
- domain: ZodString;
5013
- }, $strip>], "provider">, ZodObject<{
5014
- provider: ZodCustom<{
5015
- name: string;
5016
- getRecords: Function;
5017
- upsertRecords: Function;
5018
- }, {
5019
- name: string;
5020
- getRecords: Function;
5021
- upsertRecords: Function;
5022
- }>;
5023
- ttl: ZodOptional<ZodNumber>;
5024
- domain: ZodString;
5025
- }, $strip>]>]>>;
5026
- backups: ZodOptional<ZodObject<{
5027
- type: ZodLiteral<"s3">;
5028
- profile: ZodOptional<ZodString>;
6385
+ "us-west-1": "us-west-1";
6386
+ "us-west-2": "us-west-2";
6387
+ }>>;
6388
+ prefix: ZodOptional<ZodString>;
6389
+ }, $strict>, ZodObject<{
6390
+ provider: ZodLiteral<"ssm">;
5029
6391
  region: ZodEnum<{
5030
6392
  "af-south-1": "af-south-1";
5031
6393
  "ap-east-1": "ap-east-1";
@@ -5055,19 +6417,8 @@ declare const WorkspaceConfigSchema: ZodObject<{
5055
6417
  "us-west-1": "us-west-1";
5056
6418
  "us-west-2": "us-west-2";
5057
6419
  }>;
5058
- schedule: ZodOptional<ZodString>;
5059
- retention: ZodOptional<ZodNumber>;
5060
- }, $strip>>;
5061
- }, $strip>>;
5062
- stages: ZodObject<{
5063
- local: ZodString;
5064
- deployed: ZodArray<ZodString>;
5065
- protected: ZodOptional<ZodArray<ZodString>>;
5066
- }, $strip>;
5067
- secrets: ZodOptional<ZodObject<{
5068
- enabled: ZodOptional<ZodBoolean>;
5069
- store: ZodOptional<ZodUnion<readonly [ZodLiteral<"file">, ZodObject<{
5070
- provider: ZodLiteral<"ssm">;
6420
+ }, $strict>, ZodObject<{
6421
+ provider: ZodLiteral<"secrets-manager">;
5071
6422
  region: ZodEnum<{
5072
6423
  "af-south-1": "af-south-1";
5073
6424
  "ap-east-1": "ap-east-1";
@@ -5097,13 +6448,16 @@ declare const WorkspaceConfigSchema: ZodObject<{
5097
6448
  "us-west-1": "us-west-1";
5098
6449
  "us-west-2": "us-west-2";
5099
6450
  }>;
6451
+ kmsKeyId: ZodOptional<ZodString>;
5100
6452
  }, $strict>, ZodObject<{
5101
6453
  provider: ZodCustom<{
5102
- pull: Function;
5103
- push: Function;
6454
+ name: string;
6455
+ read: Function;
6456
+ write: Function;
5104
6457
  }, {
5105
- pull: Function;
5106
- push: Function;
6458
+ name: string;
6459
+ read: Function;
6460
+ write: Function;
5107
6461
  }>;
5108
6462
  }, $strip>]>>;
5109
6463
  algorithm: ZodOptional<ZodString>;
@@ -5146,6 +6500,40 @@ declare const WorkspaceConfigSchema: ZodObject<{
5146
6500
  "us-west-2": "us-west-2";
5147
6501
  }>;
5148
6502
  profile: ZodOptional<ZodString>;
6503
+ }, $strip>, ZodObject<{
6504
+ provider: ZodLiteral<"s3">;
6505
+ bucket: ZodOptional<ZodString>;
6506
+ region: ZodEnum<{
6507
+ "af-south-1": "af-south-1";
6508
+ "ap-east-1": "ap-east-1";
6509
+ "ap-northeast-1": "ap-northeast-1";
6510
+ "ap-northeast-2": "ap-northeast-2";
6511
+ "ap-northeast-3": "ap-northeast-3";
6512
+ "ap-south-1": "ap-south-1";
6513
+ "ap-south-2": "ap-south-2";
6514
+ "ap-southeast-1": "ap-southeast-1";
6515
+ "ap-southeast-2": "ap-southeast-2";
6516
+ "ap-southeast-3": "ap-southeast-3";
6517
+ "ap-southeast-4": "ap-southeast-4";
6518
+ "ca-central-1": "ca-central-1";
6519
+ "eu-central-1": "eu-central-1";
6520
+ "eu-central-2": "eu-central-2";
6521
+ "eu-north-1": "eu-north-1";
6522
+ "eu-south-1": "eu-south-1";
6523
+ "eu-south-2": "eu-south-2";
6524
+ "eu-west-1": "eu-west-1";
6525
+ "eu-west-2": "eu-west-2";
6526
+ "eu-west-3": "eu-west-3";
6527
+ "me-central-1": "me-central-1";
6528
+ "me-south-1": "me-south-1";
6529
+ "sa-east-1": "sa-east-1";
6530
+ "us-east-1": "us-east-1";
6531
+ "us-east-2": "us-east-2";
6532
+ "us-west-1": "us-west-1";
6533
+ "us-west-2": "us-west-2";
6534
+ }>;
6535
+ prefix: ZodOptional<ZodString>;
6536
+ profile: ZodOptional<ZodString>;
5149
6537
  }, $strip>], "provider">, ZodObject<{
5150
6538
  provider: ZodCustom<{
5151
6539
  read: Function;
@@ -5155,6 +6543,13 @@ declare const WorkspaceConfigSchema: ZodObject<{
5155
6543
  write: Function;
5156
6544
  }>;
5157
6545
  }, $strip>]>>;
6546
+ test: ZodOptional<ZodObject<{
6547
+ factories: ZodOptional<ZodString>;
6548
+ }, $strict>>;
6549
+ dev: ZodOptional<ZodObject<{
6550
+ allowedOrigins: ZodOptional<ZodArray<ZodURL>>;
6551
+ discoveryPort: ZodOptional<ZodNumber>;
6552
+ }, $strict>>;
5158
6553
  }, $strict>;
5159
6554
  /**
5160
6555
  * Validate workspace configuration.
@@ -5176,42 +6571,59 @@ declare function formatValidationErrors(error: ZodError): string;
5176
6571
  //#endregion
5177
6572
  //#region src/workspace/types.d.ts
5178
6573
  /**
5179
- * Deploy target for an app.
5180
- *
5181
- * Specifies where the app will be deployed.
6574
+ * Where a stage — or one app — deploys, by target name: a built-in
6575
+ * (`dokploy`, `sst`) or a key of `deploy.targets`.
5182
6576
  *
5183
6577
  * @example
5184
6578
  * ```ts
5185
- * // Currently supported
5186
6579
  * deploy: 'dokploy'
5187
- *
5188
- * // Future support (not yet implemented)
5189
- * deploy: 'vercel'
5190
- * deploy: 'cloudflare'
6580
+ * deploy: 'acme' // deploy: { targets: { acme: '@acme/gkm-target' } }
5191
6581
  * ```
5192
6582
  */
5193
- type DeployTarget = 'dokploy' | 'vercel' | 'cloudflare';
6583
+ type DeployTargetName = 'dokploy' | 'compose' | 'sst' | (string & {});
6584
+ /**
6585
+ * A per-stage map, typed from the workspace's deployed stages: a key that is
6586
+ * not one is a type error. Untyped (`string`) stages accept any key, which the
6587
+ * schema then checks at load.
6588
+ */
6589
+ type StageMap<S extends string, V> = string extends S ? Record<string, V> : Partial<Record<S, V>>;
6590
+ /**
6591
+ * `domains: { <stage>: '<domain>' }` at the root of `defineWorkspace`, typed from
6592
+ * the deployed stages.
6593
+ */
6594
+ type DomainsInput<S extends string = string> = StageMap<S, string>;
6595
+ /** How one root domain's hosts point at a compose stage's server. */
6596
+ type DnsRecordsModeInput<S extends string = string> = 'a' | {
6597
+ mode: 'cname';
6598
+ target: string | StageMap<S, string>;
6599
+ };
6600
+ /** One root domain's DNS provider, its records mode typed from the stages. */
6601
+ type DnsDomainInput<S extends string = string> = DnsProvider extends (infer P) ? P extends unknown ? Omit<P, 'records'> & {
6602
+ records?: DnsRecordsModeInput<S>;
6603
+ } : never : never;
6604
+ /** `dns: { '<root domain>': { provider, … } }` at the root of `defineWorkspace`. */
6605
+ type DnsInput<S extends string = string> = Record<string, DnsDomainInput<S>>;
6606
+ /** Each root domain's DNS provider — `dns` at the root of the config. */
6607
+ type WorkspaceDnsConfig = Record<string, DnsProvider>;
5194
6608
  /**
5195
- * Stage-based domain configuration.
6609
+ * Each deployed stage's base domain — `domains` at the root of the config.
5196
6610
  *
5197
- * Maps deployment stages to base domains. The main frontend app
5198
- * gets the base domain, other apps get `{appName}.{baseDomain}`.
6611
+ * A fact about the deployment rather than the platform, so every target reads
6612
+ * it. The root site answers on the base domain; every other surface on
6613
+ * `{subdomain}.{domain}`, where the subdomain is the construct's own
6614
+ * `subdomain`, or its id kebab-cased.
5199
6615
  *
5200
6616
  * @example
5201
6617
  * ```ts
5202
- * domains: {
5203
- * development: 'dev.myapp.com',
5204
- * staging: 'staging.myapp.com',
5205
- * production: 'myapp.com',
5206
- * }
6618
+ * domains: { production: 'myapp.com', staging: 'staging.myapp.com' },
5207
6619
  *
5208
- * // Result for production stage:
5209
- * // - web (main frontend): myapp.com
5210
- * // - api: api.myapp.com
5211
- * // - auth: auth.myapp.com
6620
+ * // production:
6621
+ * // - new StaticSite('Web', { root: true }) → myapp.com
6622
+ * // - new RestApi('Api', { subdomain: 'api' }) → api.myapp.com
6623
+ * // - new RestApi('Webhooks', { … }) → webhooks.myapp.com
5212
6624
  * ```
5213
6625
  */
5214
- type DokployDomainsConfig = Record<string, string>;
6626
+ type DomainsConfig = Record<string, string>;
5215
6627
  /**
5216
6628
  * Per-app domain override configuration.
5217
6629
  *
@@ -5243,9 +6655,9 @@ type AppDomainConfig = string | Record<string, string>;
5243
6655
  * ```ts
5244
6656
  * deploy: {
5245
6657
  * default: 'dokploy',
6658
+ * registry: 'ghcr.io/myorg',
5246
6659
  * dokploy: {
5247
6660
  * endpoint: 'https://dokploy.myserver.com',
5248
- * registry: 'ghcr.io/myorg',
5249
6661
  * },
5250
6662
  * }
5251
6663
  * ```
@@ -5254,12 +6666,12 @@ type AppDomainConfig = string | Record<string, string>;
5254
6666
  * ```ts
5255
6667
  * deploy: {
5256
6668
  * default: 'dokploy',
6669
+ * registry: 'ghcr.io/myorg',
5257
6670
  * dokploy: {
5258
6671
  * endpoints: {
5259
6672
  * development: 'https://dev-dokploy.myserver.com',
5260
6673
  * production: 'https://dokploy.myserver.com',
5261
6674
  * },
5262
- * registry: 'ghcr.io/myorg',
5263
6675
  * },
5264
6676
  * }
5265
6677
  * ```
@@ -5269,16 +6681,305 @@ interface DokployWorkspaceConfig {
5269
6681
  endpoint?: string;
5270
6682
  /** Per-stage Dokploy API endpoints (overrides endpoint) */
5271
6683
  endpoints?: Record<string, string>;
5272
- /** Container registry for Docker images (e.g., 'ghcr.io/myorg') */
5273
- registry?: string;
5274
6684
  /** Registry ID in Dokploy (auto-configured) */
5275
6685
  registryId?: string;
6686
+ /** Dokploy's own backup schedule for the stage's Postgres, to an S3 destination. */
6687
+ backups?: DokployBackupsConfig;
6688
+ /** How a release is waited for and checked before it counts as live. */
6689
+ verify?: DokployVerifyConfig;
6690
+ }
6691
+ /**
6692
+ * How a Dokploy release is waited for and checked.
6693
+ *
6694
+ * A release counts once Dokploy's deployment has finished and the app has
6695
+ * answered its health route `healthyAfter` times in a row. One that does not
6696
+ * is rolled back.
6697
+ */
6698
+ interface DokployVerifyConfig {
6699
+ /** How long Dokploy may take to finish a deployment. Default 10 minutes. */
6700
+ deploymentTimeoutMs?: number;
6701
+ /**
6702
+ * The path each backend is checked on, under its domain. Default
6703
+ * `/health`, which every production server build serves. A site is
6704
+ * checked at `/`.
6705
+ */
6706
+ healthCheckPath?: string;
6707
+ /** Consecutive 2xx answers that make an app healthy. Default 3. */
6708
+ healthyAfter?: number;
6709
+ /** Between health checks, and the first wait between polls. Default 2s. */
6710
+ intervalMs?: number;
6711
+ /** How long an app may take to become healthy. Default 5 minutes. */
6712
+ healthTimeoutMs?: number;
6713
+ }
6714
+ /**
6715
+ * The `compose` target's own settings — `deploy.compose`. Read by `gkm
6716
+ * compose` and `gkm deploy --target compose` only; the Dokploy target never
6717
+ * consults it.
6718
+ *
6719
+ * @example
6720
+ * ```ts
6721
+ * deploy: { compose: { proxy: 'traefik' } }
6722
+ * ```
6723
+ */
6724
+ interface ComposeWorkspaceConfig<S extends string = string> {
6725
+ /**
6726
+ * What serves a stage's stack: `'caddy'` (the default) — the stack's own
6727
+ * Caddy on 80/443 — or `'traefik'`, the machine's shared Traefik edge,
6728
+ * which every stack registers its routes with.
6729
+ *
6730
+ * One value applies to every stage, the local one included: on
6731
+ * `'traefik'` the local stack runs behind a Traefik edge on this machine,
6732
+ * the path the deployed stages take on their servers. `gkm dev` and
6733
+ * `gkm test` follow the local stage's: behind Traefik they register their
6734
+ * routes with that same edge and run no Caddy. A map sets each stage it
6735
+ * names, and a stage it leaves out is on Caddy — the way to run one stage
6736
+ * on something else.
6737
+ *
6738
+ * ```ts
6739
+ * proxy: 'traefik' // every stage, the local one included
6740
+ * proxy: { development: 'caddy', staging: 'traefik', production: 'traefik' }
6741
+ * ```
6742
+ */
6743
+ proxy?: ComposeProxy | StageMap<S, ComposeProxy>;
6744
+ /**
6745
+ * A stage's own certificate, by stage: a PEM certificate (with its chain)
6746
+ * and its key, relative to the workspace root or absolute. Either proxy
6747
+ * serves it, on any stage. Without one, a deployed stage's comes from
6748
+ * Let's Encrypt and the local stage's from gkm's local CA (`gkm trust`).
6749
+ *
6750
+ * ```ts
6751
+ * tls: { production: { certFile: 'certs/origin.pem', keyFile: 'certs/origin.key' } }
6752
+ * tls: {
6753
+ * development: {
6754
+ * certFile: 'certs/dev.pem',
6755
+ * keyFile: 'certs/dev-key.pem',
6756
+ * caFile: 'certs/rootCA.pem',
6757
+ * },
6758
+ * }
6759
+ * ```
6760
+ */
6761
+ tls?: StageMap<S, ComposeTlsConfig>;
6762
+ /**
6763
+ * Each deployed stage's server: the SSH login gkm drives its Docker
6764
+ * engine with (`DOCKER_HOST=ssh://user@host`). gkm runs where the deploy
6765
+ * starts — a CI runner, a laptop — and never on the server, which holds
6766
+ * Docker and this login and no cloud credentials. The host defaults to
6767
+ * the stage's `GKM_SERVER_IPV4` secret. Every deployed stage needs one;
6768
+ * the local stage runs on this machine's Docker.
6769
+ *
6770
+ * ```ts
6771
+ * server: { production: { user: 'deploy' } }
6772
+ * server: { staging: { user: 'deploy', host: 'staging.example.com', port: 2222 } }
6773
+ * ```
6774
+ */
6775
+ server?: StageMap<S, ComposeServerConfig>;
6776
+ }
6777
+ /** A deployed stage's server — `deploy.compose.server.<stage>`. */
6778
+ interface ComposeServerConfig {
6779
+ /** The SSH user, in the server's `docker` group. */
6780
+ user: string;
6781
+ /** The host to SSH to. Default: the stage's `GKM_SERVER_IPV4` secret. */
6782
+ host?: string;
6783
+ /** The SSH port. Default 22. */
6784
+ port?: number;
6785
+ }
6786
+ /** A stage's own certificate — `deploy.compose.tls.<stage>`. */
6787
+ interface ComposeTlsConfig {
6788
+ certFile: string;
6789
+ keyFile: string;
6790
+ /**
6791
+ * The root the certificate chains to, PEM, when no public CA issued it —
6792
+ * an mkcert root, a company CA. gkm's check after a start trusts it; on
6793
+ * the local stage the stack's containers are handed it too
6794
+ * (`NODE_EXTRA_CA_CERTS`). Without it, the check trusts what Node does by
6795
+ * default: its bundled roots, and `NODE_EXTRA_CA_CERTS` where it is set.
6796
+ */
6797
+ caFile?: string;
6798
+ }
6799
+ /**
6800
+ * Where one stage's telemetry goes, and how much of it — `deploy.telemetry`,
6801
+ * by stage.
6802
+ *
6803
+ * What is emitted is the application's (the `Telemetry` construct); where it
6804
+ * goes is this. A server target runs the self-hosted provider when a stage
6805
+ * names nothing; AWS has none, so a deployed AWS stage that uses telemetry
6806
+ * names a provider. `false` sends nothing. The local stage ignores this: `gkm
6807
+ * dev` and `gkm compose` on it always run OpenObserve, at 100%.
6808
+ *
6809
+ * @example
6810
+ * ```ts
6811
+ * telemetry: {
6812
+ * staging: 'self-hosted',
6813
+ * production: { provider: 'self-hosted', retentionDays: 14, sampleRate: 0.1 },
6814
+ * preview: { provider: 'otlp', endpoint: 'https://otlp.example.com', sampleRate: 0.5 },
6815
+ * scratch: false,
6816
+ * }
6817
+ * ```
6818
+ */
6819
+ type StageTelemetryConfig = 'self-hosted' | SelfHostedTelemetryConfig | OtlpTelemetryConfig | false;
6820
+ /**
6821
+ * What backs one deployed stage's buckets — `deploy.objects`, by stage.
6822
+ *
6823
+ * - `'external'` (the default) — the stage's secrets hold each bucket's URL,
6824
+ * set by you: S3, R2, any S3-compatible store.
6825
+ * - `{ provider: 's3' }` — every deploy of the stage creates (or repairs)
6826
+ * each bucket, its IAM user and key in the stage's AWS account, and writes
6827
+ * the bucket's URL into the stage's secrets, before its checks.
6828
+ * - `false` — the stage has no object storage; a bucket on it is refused.
6829
+ *
6830
+ * The local stage ignores this: `gkm dev` runs MinIO for every bucket.
6831
+ *
6832
+ * @example
6833
+ * ```ts
6834
+ * objects: {
6835
+ * production: { provider: 's3', region: 'eu-west-1', versioning: true },
6836
+ * staging: 'external',
6837
+ * }
6838
+ * ```
6839
+ */
6840
+ type StageObjectsConfig = 'external' | S3ObjectsConfig | false;
6841
+ /**
6842
+ * What receives one deployed stage's inboxes — `deploy.inbox`, by stage:
6843
+ *
6844
+ * - `{ provider: 'ses' }` — the deploy creates each inbox in the stage's AWS
6845
+ * account: its own bucket and topic, the domain's SES identity and MX
6846
+ * records, and a receipt rule in the region's active rule set.
6847
+ * - `'external'` — the default: the stage's secrets hold each inbox's keys.
6848
+ * - `false` — the stage receives no mail; an inbox on it is refused.
6849
+ *
6850
+ * Every local stage receives through Mailpit, whatever this says.
6851
+ *
6852
+ * @example
6853
+ * ```ts
6854
+ * inbox: { production: { provider: 'ses', region: 'eu-west-1' } }
6855
+ * ```
6856
+ */
6857
+ type StageInboxConfig = 'external' | SesInboxConfig | false;
6858
+ /**
6859
+ * What sends one deployed stage's mail — `deploy.email`, by stage:
6860
+ *
6861
+ * - `{ provider: 'ses' }` — the deploy creates what each `Email` construct
6862
+ * sends with in the stage's AWS account: the sender's domain as an SES
6863
+ * identity (its DKIM records through `dns`), an IAM user allowed only to
6864
+ * send as it, and its key — written as `<ID>_URL`, an `smtp://` URL with
6865
+ * the SMTP password derived from the key — and `<ID>_FROM`. A `<ID>_URL`
6866
+ * the stage's secrets already hold wins, and nothing is created for it.
6867
+ * - `'external'` — the default: the stage's secrets hold each construct's
6868
+ * `<ID>_URL` and `<ID>_FROM`, set by you.
6869
+ * - `false` — the stage sends no mail; an `Email` on it is refused.
6870
+ *
6871
+ * Every local stage sends to Mailpit, whatever this says.
6872
+ *
6873
+ * @example
6874
+ * ```ts
6875
+ * email: {
6876
+ * production: { provider: 'ses', region: 'eu-west-1' },
6877
+ * staging: 'external',
6878
+ * }
6879
+ * ```
6880
+ */
6881
+ type StageEmailConfig = 'external' | SesEmailConfig | false;
6882
+ /**
6883
+ * One deployed compose stage's backups — `deploy.backups`, by stage.
6884
+ *
6885
+ * A stage that runs Postgres is backed up whether it names one or not: every
6886
+ * day at 02:00 UTC, each backup kept 30 days, in the project bucket. An
6887
+ * entry changes when (`every`, or a five-field UTC `cron`, at most hourly)
6888
+ * and for how long (`keep`); `false` takes none, and deletes nothing.
6889
+ *
6890
+ * @example
6891
+ * ```ts
6892
+ * backups: {
6893
+ * production: { every: '6h', keep: '30d' },
6894
+ * staging: { cron: '30 3 * * *', keep: '7d' },
6895
+ * preview: false,
6896
+ * }
6897
+ * ```
6898
+ */
6899
+ type StageBackupsConfig = false | {
6900
+ /** `'6h'`, `'1d'` — counted from 02:00 UTC. At least `'1h'`. */
6901
+ every?: string;
6902
+ /** Five fields, in UTC: `'0 *\/6 * * *'`. */
6903
+ cron?: string;
6904
+ /** How long a backup is kept: `'30d'`. */
6905
+ keep?: string;
6906
+ /**
6907
+ * Point-in-time recovery: the stack's Postgres ships its WAL
6908
+ * continuously and the backups service takes a base backup on
6909
+ * `base`'s schedule, so `gkm backup:restore --to <time>` brings the
6910
+ * whole cluster back to any second in the last `keep`. `true` is
6911
+ * `{ keep: '14d', base: '1d' }`. The dumps above keep their own
6912
+ * schedule beside it.
6913
+ */
6914
+ pitr?: true | StagePitrConfig;
6915
+ };
6916
+ /** `deploy.backups.<stage>.pitr` — see {@link StageBackupsConfig}. */
6917
+ interface StagePitrConfig {
6918
+ /** How far back a restore can reach: `'14d'`. */
6919
+ keep?: string;
6920
+ /** How often a base backup is taken, counted from 02:00 UTC: `'1d'`. At least `'1h'`. */
6921
+ base?: string;
6922
+ }
6923
+ /** `objects: { provider: 's3' }` — a bucket per construct in the stage's account. */
6924
+ interface S3ObjectsConfig {
6925
+ provider: 's3';
6926
+ /**
6927
+ * Where the buckets are created. Defaults to the secrets store's region,
6928
+ * then `AWS_REGION`.
6929
+ */
6930
+ region?: string;
6931
+ /** Keep previous versions of every object. Defaults to the construct's own `versioned`. */
6932
+ versioning?: boolean;
5276
6933
  /**
5277
- * Stage-based domain configuration.
5278
- * The main frontend app gets the base domain.
5279
- * Other apps get {appName}.{baseDomain} by default.
6934
+ * Serve each file server through a CDN on `<fileserver>.<domain>`: a
6935
+ * CloudFront distribution reading the bucket, its certificate and its DNS
6936
+ * records, all created by the deploy. On by default, which needs the
6937
+ * stage to have a domain; `false` serves from the bucket's own endpoint.
5280
6938
  */
5281
- domains?: DokployDomainsConfig;
6939
+ cdn?: boolean;
6940
+ }
6941
+ /** Shared by every provider. */
6942
+ interface TelemetryProviderConfig {
6943
+ /**
6944
+ * The fraction of traces kept, decided where a trace starts and followed
6945
+ * by every service it reaches (`parentbased_traceidratio`). Logs are not
6946
+ * sampled. 0 to 1; default 1.
6947
+ */
6948
+ sampleRate?: number;
6949
+ }
6950
+ /**
6951
+ * The target runs the collector and its UI: OpenObserve, in a compose stack,
6952
+ * reached through an SSH tunnel by default.
6953
+ */
6954
+ interface SelfHostedTelemetryConfig extends TelemetryProviderConfig {
6955
+ provider: 'self-hosted';
6956
+ /**
6957
+ * The port it is published on, on 127.0.0.1 only — reached from another
6958
+ * machine through an SSH tunnel. Default 5080.
6959
+ */
6960
+ port?: number;
6961
+ /**
6962
+ * How many days of data it keeps (OpenObserve's
6963
+ * `ZO_COMPACT_DATA_RETENTION_DAYS`). At least 3; default 30.
6964
+ */
6965
+ retentionDays?: number;
6966
+ /**
6967
+ * Serve it on the `Telemetry` construct's label under the stage's domain —
6968
+ * `telemetry.<stage domain>` by default — through the stack's proxy, to these
6969
+ * addresses only (IPs or CIDRs), instead of on a loopback port. Every
6970
+ * other address is answered 403.
6971
+ */
6972
+ public?: {
6973
+ allow: string[];
6974
+ };
6975
+ }
6976
+ /** Any OTLP/HTTP endpoint — a collector, a vendor's ingest. */
6977
+ interface OtlpTelemetryConfig extends TelemetryProviderConfig {
6978
+ provider: 'otlp';
6979
+ /** The OTLP/HTTP base URL; `/v1/traces` and `/v1/logs` are added to it. */
6980
+ endpoint: string;
6981
+ /** Headers sent with every export — `{ 'x-team': 'shop' }`. */
6982
+ headers?: Record<string, string>;
5282
6983
  }
5283
6984
  /**
5284
6985
  * Deployment configuration for the workspace.
@@ -5290,37 +6991,96 @@ interface DokployWorkspaceConfig {
5290
6991
  * default: 'dokploy',
5291
6992
  * }
5292
6993
  *
5293
- * // Full configuration with DNS and backups
6994
+ * // Full configuration with backups (domains and dns are at the root)
5294
6995
  * deploy: {
5295
6996
  * default: 'dokploy',
6997
+ * registry: 'ghcr.io/myorg',
5296
6998
  * dokploy: {
5297
6999
  * endpoint: 'https://dokploy.myserver.com',
5298
7000
  * projectId: 'proj_abc123',
5299
- * registry: 'ghcr.io/myorg',
5300
- * domains: {
5301
- * production: 'myapp.com',
5302
- * },
5303
- * },
5304
- * dns: {
5305
- * provider: 'hostinger',
5306
- * domain: 'myapp.com',
5307
- * },
5308
- * backups: {
5309
- * type: 's3',
5310
- * region: 'us-east-1',
7001
+ * backups: { type: 's3', region: 'us-east-1' },
5311
7002
  * },
5312
7003
  * }
5313
7004
  * ```
5314
7005
  */
5315
- interface DeployConfig {
7006
+ interface DeployConfig<S extends string = string> {
5316
7007
  /** Default deploy target for all apps (default: 'dokploy') */
5317
- default?: DeployTarget;
7008
+ default?: DeployTargetName;
7009
+ /**
7010
+ * Targets that do not ship with the CLI, by the name `default` (or an
7011
+ * app's `deploy`) uses: a package whose default export is the target, a
7012
+ * target object, or either with its options.
7013
+ *
7014
+ * ```ts
7015
+ * targets: {
7016
+ * acme: '@acme/gkm-target',
7017
+ * fly: ['@acme/gkm-fly', { org: 'acme' }],
7018
+ * local: defineTarget({ … }),
7019
+ * }
7020
+ * ```
7021
+ *
7022
+ * A package is never guessed from a name: it is installed and listed here.
7023
+ * A built-in's name cannot be taken.
7024
+ */
7025
+ targets?: Record<string, DeployTargetEntry>;
7026
+ /**
7027
+ * Whose deploy this is, on a target shared with other workspaces — an
7028
+ * organisation or a team, lowercase `[a-z0-9-]`. Two workspaces with the
7029
+ * same name deploying to one Dokploy are kept apart by it: it is in the
7030
+ * project's ownership marker, the image path
7031
+ * (`<registry>/<namespace>/<project>-<app>`) and every resource name.
7032
+ *
7033
+ * Defaults to the kebab-cased workspace name, which adds nothing to the
7034
+ * names a workspace was already deployed under.
7035
+ */
7036
+ namespace?: string;
7037
+ /**
7038
+ * The container registry the apps' images are pushed to and pulled from,
7039
+ * whatever the target — `ghcr.io/myorg`. An image is
7040
+ * `<registry>/<namespace>/<project>-<app>:<tag>`.
7041
+ */
7042
+ registry?: string;
5318
7043
  /** Dokploy-specific configuration */
5319
7044
  dokploy?: DokployWorkspaceConfig;
5320
- /** DNS configuration for automatic record creation */
5321
- dns?: DnsConfig;
5322
- /** Backup destination configuration for database services */
5323
- backups?: BackupsConfig;
7045
+ /** What the `compose` target runs beside the apps — see {@link ComposeWorkspaceConfig}. */
7046
+ compose?: ComposeWorkspaceConfig<S>;
7047
+ /**
7048
+ * Where each deployed stage's telemetry goes — see
7049
+ * {@link StageTelemetryConfig}.
7050
+ */
7051
+ telemetry?: StageMap<S, StageTelemetryConfig>;
7052
+ /**
7053
+ * What backs each deployed stage's buckets — the `objects` kind that
7054
+ * `ObjectStorage` and `FileServer` produce. See {@link StageObjectsConfig}.
7055
+ */
7056
+ objects?: StageMap<S, StageObjectsConfig>;
7057
+ /**
7058
+ * What receives each deployed stage's inboxes — the `inbox` kind `Inbox`
7059
+ * produces. See {@link StageInboxConfig}.
7060
+ */
7061
+ inbox?: StageMap<S, StageInboxConfig>;
7062
+ /**
7063
+ * What sends each deployed stage's mail — the `email` kind `Email`
7064
+ * produces. See {@link StageEmailConfig}.
7065
+ */
7066
+ email?: StageMap<S, StageEmailConfig>;
7067
+ /**
7068
+ * When each deployed compose stage's databases are backed up, and how
7069
+ * long a backup is kept — see {@link StageBackupsConfig}.
7070
+ */
7071
+ backups?: StageMap<S, StageBackupsConfig>;
7072
+ /**
7073
+ * A CDN in front of each deployed compose stage's sites, by stage:
7074
+ * `{ provider: 'cloudflare' }` proxies every host a site answers on
7075
+ * through Cloudflare, whose DNS the stage's domain must be on. Every
7076
+ * other host is served straight from the server, as is a stage the map
7077
+ * leaves out.
7078
+ *
7079
+ * ```ts
7080
+ * cdn: { prod: { provider: 'cloudflare' } }
7081
+ * ```
7082
+ */
7083
+ cdn?: StageMap<S, StageCdnConfig>;
5324
7084
  }
5325
7085
  /**
5326
7086
  * Models package configuration for shared schemas.
@@ -5406,7 +7166,7 @@ interface StagesConfig {
5406
7166
  *
5407
7167
  * Configures how secrets are encrypted for deployment.
5408
7168
  * Secrets are stored encrypted in `.gkm/secrets/{stage}.json`
5409
- * with keys stored separately in `~/.gkm/{project}/{stage}.key`.
7169
+ * with keys stored separately in `~/.gkm/keys/{namespace}/{project}/{stage}.key`.
5410
7170
  *
5411
7171
  * @example
5412
7172
  * ```ts
@@ -5423,8 +7183,13 @@ interface SecretsConfig {
5423
7183
  /**
5424
7184
  * Where deployed stages' secrets live, so a deploy can reach them from
5425
7185
  * anywhere: `'file'` (default — the encrypted `.gkm/secrets/<stage>.json`,
5426
- * which cannot serve CI while `.gkm/` is gitignored), `{ provider: 'ssm',
5427
- * region }` (each stage's secrets in its own AWS account), or any object
7186
+ * which cannot serve CI while `.gkm/` is gitignored), `{ provider: 's3',
7187
+ * region?, bucket?, prefix? }` (each stage's secrets in one object in the
7188
+ * project bucket beside the deploy state, SSE-S3 and versioned, no size
7189
+ * limit; region and prefix default to an S3 `state`'s), `{ provider: 'ssm',
7190
+ * region }` (each stage's secrets in an SSM parameter in its own AWS
7191
+ * account, up to 8 KB), `{ provider: 'secrets-manager', region, kmsKeyId? }`
7192
+ * (a Secrets Manager secret in its own account, up to 64 KB), or any object
5428
7193
  * implementing `SecretsStore`. The local stage always uses the file.
5429
7194
  */
5430
7195
  store?: SecretsStoreConfig;
@@ -5494,7 +7259,7 @@ interface AppConfigBase {
5494
7259
  * Overrides `deploy.default` for this specific app.
5495
7260
  * @example 'dokploy', 'vercel'
5496
7261
  */
5497
- deploy?: DeployTarget;
7262
+ deploy?: DeployTargetName;
5498
7263
  /**
5499
7264
  * Constructs glob pattern — one glob, every kind.
5500
7265
  *
@@ -5545,23 +7310,16 @@ interface AppConfigBase {
5545
7310
  * @example './src/config/logger'
5546
7311
  */
5547
7312
  logger?: string;
5548
- /** Provider configuration (AWS, Docker, etc.) */
5549
- providers?: ProvidersConfig;
5550
7313
  /**
5551
7314
  * Server lifecycle hooks.
5552
7315
  * @example { beforeSetup: './src/hooks/setup.ts' }
5553
7316
  */
5554
7317
  hooks?: HooksConfig;
5555
7318
  /**
5556
- * Telescope debugging dashboard configuration.
7319
+ * Telescope request recording configuration.
5557
7320
  * @example true, './src/config/telescope', { enabled: true, path: '/__telescope' }
5558
7321
  */
5559
7322
  telescope?: string | boolean | TelescopeConfig;
5560
- /**
5561
- * Studio admin panel configuration.
5562
- * @example true, './src/config/studio'
5563
- */
5564
- studio?: string | boolean | StudioConfig;
5565
7323
  /**
5566
7324
  * OpenAPI documentation configuration.
5567
7325
  * @example true, { output: './src/openapi.ts' }
@@ -5735,7 +7493,7 @@ type ConstrainedApps<TApps extends AppsRecord> = { [K in keyof TApps]: Omit<TApp
5735
7493
  * });
5736
7494
  * ```
5737
7495
  */
5738
- type WorkspaceInput<TApps extends AppsRecord> = {
7496
+ type WorkspaceInput<TApps extends AppsRecord, TDeployed extends string = string> = {
5739
7497
  /**
5740
7498
  * Where the workspace's own constructs live, relative to its root.
5741
7499
  *
@@ -5755,15 +7513,80 @@ type WorkspaceInput<TApps extends AppsRecord> = {
5755
7513
  apps?: ConstrainedApps<TApps>;
5756
7514
  /** Shared packages configuration */
5757
7515
  shared?: SharedConfig;
7516
+ /**
7517
+ * Each deployed stage's base domain — see {@link DomainsConfig}. A key that
7518
+ * is not a deployed stage is a type error.
7519
+ */
7520
+ domains?: DomainsInput<NoInfer<TDeployed>>;
7521
+ /**
7522
+ * Subdomains a wildcard site's tenants may never take, beyond every app's
7523
+ * own (which are derived from the constructs and never listed here): the
7524
+ * names no construct declares — `www`, `mail`, `status`, `docs`.
7525
+ *
7526
+ * Listing an app's own subdomain is refused at load: the construct
7527
+ * already protects it.
7528
+ */
7529
+ protectedSubdomains?: readonly string[];
7530
+ /**
7531
+ * Each root domain's DNS provider, and how its hosts are pointed at a
7532
+ * compose stage's server (`records`).
7533
+ */
7534
+ dns?: DnsInput<NoInfer<TDeployed>>;
5758
7535
  /** Deployment configuration */
5759
- deploy?: DeployConfig;
5760
- /** The project's stages: which one is local, which deploy */
5761
- stages: StagesConfig;
7536
+ deploy?: DeployConfig<NoInfer<TDeployed>>;
7537
+ /**
7538
+ * The project's stages: which one is local, which deploy. The deployed
7539
+ * stages type every per-stage map — `domains`, `deploy.objects`,
7540
+ * `deploy.telemetry`, `deploy.compose.proxy`/`tls`.
7541
+ */
7542
+ stages: StagesInput<TDeployed>;
5762
7543
  /** Encrypted secrets configuration */
5763
7544
  secrets?: SecretsConfig;
5764
7545
  /** State provider configuration (local filesystem by default, or SSM for team collaboration) */
5765
7546
  state?: StateConfig;
7547
+ /** How `gkm dev` is reached: the discovery endpoint's port and origins */
7548
+ dev?: DevConfig;
5766
7549
  };
7550
+ /** `stages`, as `defineWorkspace` infers it: each deployed stage literally. */
7551
+ interface StagesInput<TDeployed extends string = string> {
7552
+ local: string;
7553
+ deployed: readonly TDeployed[];
7554
+ protected?: readonly NoInfer<TDeployed>[];
7555
+ }
7556
+ /**
7557
+ * How `gkm dev` is reached from outside the apps it runs.
7558
+ */
7559
+ interface DevConfig {
7560
+ /**
7561
+ * Browser origins allowed to read the discovery endpoint — and this
7562
+ * workspace in it — e.g. `['https://console.example.com']`.
7563
+ *
7564
+ * Empty by default: any page the developer visits can send requests to a
7565
+ * loopback port, so none is answered unless it is listed here. A request
7566
+ * with no `Origin` (curl, a local process) still needs the session token.
7567
+ */
7568
+ allowedOrigins?: string[];
7569
+ /**
7570
+ * The loopback port the discovery endpoint listens on. Defaults to 4983;
7571
+ * `GKM_DISCOVERY_PORT` overrides it.
7572
+ */
7573
+ discoveryPort?: number;
7574
+ }
7575
+ /**
7576
+ * How `gkm test` builds what a feature test is handed.
7577
+ */
7578
+ interface TestConfig {
7579
+ /**
7580
+ * The folder of test factories, relative to the root.
7581
+ *
7582
+ * Defaults to `test/factories`. A factory belongs to a database, not to an
7583
+ * app, so each file is named after one — `database.ts` for `Database`,
7584
+ * `auth-database.ts` for `AuthDatabase` — and exports `createFactory(db)`.
7585
+ * Every app's harness builds them on each test's transactions, and a test is
7586
+ * handed them as `factories`, keyed by service name.
7587
+ */
7588
+ factories?: string;
7589
+ }
5767
7590
  /**
5768
7591
  * Extract app names from apps record.
5769
7592
  */
@@ -5784,10 +7607,15 @@ type InferredWorkspaceConfig<TApps extends AppsRecord> = {
5784
7607
  dependencies?: InferAppNames<TApps>[];
5785
7608
  }; };
5786
7609
  shared?: SharedConfig;
7610
+ domains?: DomainsConfig;
7611
+ protectedSubdomains?: readonly string[];
7612
+ dns?: WorkspaceDnsConfig;
5787
7613
  deploy?: DeployConfig;
5788
7614
  stages: StagesConfig;
5789
7615
  secrets?: SecretsConfig;
5790
7616
  state?: StateConfig;
7617
+ test?: TestConfig;
7618
+ dev?: DevConfig;
5791
7619
  };
5792
7620
  /**
5793
7621
  * Workspace configuration for multi-app monorepos.
@@ -5834,17 +7662,20 @@ type InferredWorkspaceConfig<TApps extends AppsRecord> = {
5834
7662
  * },
5835
7663
  * },
5836
7664
  *
7665
+ * // Each deployed stage's base domain, and who hosts its DNS
7666
+ * domains: {
7667
+ * production: 'myapp.com',
7668
+ * staging: 'staging.myapp.com',
7669
+ * },
7670
+ * dns: { 'myapp.com': { provider: 'godaddy' } },
7671
+ *
5837
7672
  * // Deployment configuration
5838
7673
  * deploy: {
5839
7674
  * default: 'dokploy',
7675
+ * registry: 'ghcr.io/myorg',
5840
7676
  * dokploy: {
5841
7677
  * endpoint: 'https://dokploy.myserver.com',
5842
7678
  * projectId: 'proj_abc123',
5843
- * registry: 'ghcr.io/myorg',
5844
- * domains: {
5845
- * production: 'myapp.com',
5846
- * staging: 'staging.myapp.com',
5847
- * },
5848
7679
  * },
5849
7680
  * },
5850
7681
  *
@@ -5872,6 +7703,12 @@ interface WorkspaceConfig {
5872
7703
  apps?: Record<string, AppConfig>;
5873
7704
  /** Shared packages configuration */
5874
7705
  shared?: SharedConfig;
7706
+ /** Each deployed stage's base domain — see {@link DomainsConfig}. */
7707
+ domains?: DomainsConfig;
7708
+ /** Subdomains no tenant may take — see `WorkspaceInput`. */
7709
+ protectedSubdomains?: readonly string[];
7710
+ /** Each root domain's DNS provider — see {@link WorkspaceDnsConfig}. */
7711
+ dns?: WorkspaceDnsConfig;
5875
7712
  /** Default deployment configuration */
5876
7713
  deploy?: DeployConfig;
5877
7714
  /** The project's stages: which one is local, which deploy */
@@ -5880,6 +7717,10 @@ interface WorkspaceConfig {
5880
7717
  secrets?: SecretsConfig;
5881
7718
  /** State provider configuration (local filesystem by default, or SSM for team collaboration) */
5882
7719
  state?: StateConfig;
7720
+ /** What `gkm test` hands a feature test: where the factories are. */
7721
+ test?: TestConfig;
7722
+ /** How `gkm dev` is reached: the discovery endpoint's port and origins. */
7723
+ dev?: DevConfig;
5883
7724
  }
5884
7725
  /**
5885
7726
  * Normalized app configuration with resolved defaults.
@@ -5896,6 +7737,11 @@ interface NormalizedAppConfig extends Omit<AppConfigBase, 'type'> {
5896
7737
  * and that is `domain`.
5897
7738
  */
5898
7739
  root?: boolean;
7740
+ /**
7741
+ * The label this app answers on under a stage's domain, carried from its
7742
+ * declaration — `api` for `api.myapp.com`. Absent, the app's own name.
7743
+ */
7744
+ subdomain?: string;
5899
7745
  /** App type (always defined after normalization) */
5900
7746
  type: 'backend' | 'web' | 'mobile';
5901
7747
  /** Path to the app */
@@ -5905,7 +7751,7 @@ interface NormalizedAppConfig extends Omit<AppConfigBase, 'type'> {
5905
7751
  /** Resolved dependencies array (empty array if none) */
5906
7752
  dependencies: string[];
5907
7753
  /** Resolved deploy target (app.deploy > deploy.default > 'dokploy') */
5908
- resolvedDeployTarget: DeployTarget;
7754
+ resolvedDeployTarget: DeployTargetName;
5909
7755
  /** Entry file path for non-gkm apps */
5910
7756
  entry?: string;
5911
7757
  /** Framework for the app */
@@ -5935,6 +7781,12 @@ interface NormalizedWorkspace {
5935
7781
  constructs?: Routes;
5936
7782
  /** Normalized app configurations */
5937
7783
  apps: Record<string, NormalizedAppConfig>;
7784
+ /** Each deployed stage's base domain */
7785
+ domains?: DomainsConfig;
7786
+ /** Subdomains no tenant may take, beyond every app's own */
7787
+ protectedSubdomains?: readonly string[];
7788
+ /** Each root domain's DNS provider */
7789
+ dns?: WorkspaceDnsConfig;
5938
7790
  /** Deploy configuration (empty object if not specified) */
5939
7791
  deploy: DeployConfig;
5940
7792
  /** Shared packages configuration (empty object if not specified) */
@@ -5945,6 +7797,10 @@ interface NormalizedWorkspace {
5945
7797
  secrets: SecretsConfig;
5946
7798
  /** State provider configuration (undefined = local filesystem) */
5947
7799
  state?: StateConfig;
7800
+ /** What `gkm test` hands a feature test (empty object if not specified) */
7801
+ test: TestConfig;
7802
+ /** How `gkm dev` is reached, when configured */
7803
+ dev?: DevConfig;
5948
7804
  }
5949
7805
  /**
5950
7806
  * Result of loading and processing a configuration.
@@ -5964,6 +7820,11 @@ interface LoadedConfig {
5964
7820
  * two chances to disagree. Absent when the workspace declares no constructs.
5965
7821
  */
5966
7822
  manifest?: ConstructManifest;
7823
+ /**
7824
+ * The files each Worker's crons, queues and subscribers are declared in,
7825
+ * read in the same discovery — what says which app a worker is built from.
7826
+ */
7827
+ background?: Record<string, string[]>;
5967
7828
  }
5968
7829
  /**
5969
7830
  * Type guard to check if a config is a WorkspaceConfig.
@@ -5980,53 +7841,7 @@ interface LoadedConfig {
5980
7841
  declare function isWorkspaceConfig(config: GkmConfig | WorkspaceConfig): config is WorkspaceConfig;
5981
7842
  //#endregion
5982
7843
  //#region src/types.d.ts
5983
- interface PartitionedRoutes {
5984
- paths: string | string[];
5985
- partition: (filepath: string) => string;
5986
- }
5987
- type Routes = string | string[] | PartitionedRoutes;
5988
- interface ProviderConfig {
5989
- enabled?: boolean;
5990
- outputDir?: string;
5991
- }
5992
- interface AWSApiGatewayConfig extends ProviderConfig {}
5993
- interface AWSLambdaConfig extends ProviderConfig {}
5994
- interface ProductionConfig {
5995
- /** Enable production mode (default: false) */
5996
- enabled?: boolean;
5997
- /** Bundle server into single file (default: true) */
5998
- bundle?: boolean;
5999
- /** Minify bundled output (default: true) */
6000
- minify?: boolean;
6001
- /** Health check endpoint path (default: '/health') */
6002
- healthCheck?: string;
6003
- /** Enable graceful shutdown handling (default: true) */
6004
- gracefulShutdown?: boolean;
6005
- /** Packages to exclude from bundling (default: []) */
6006
- external?: string[];
6007
- /** Include subscribers in production build (default: 'exclude' for serverless) */
6008
- subscribers?: 'include' | 'exclude';
6009
- /** Include OpenAPI spec in production (default: false) */
6010
- openapi?: boolean;
6011
- /**
6012
- * Enable build-time optimized handler generation (default: true)
6013
- * Generates specialized handlers based on endpoint tier:
6014
- * - minimal: Near-raw-Hono performance for simple endpoints
6015
- * - standard: Optimized handlers for auth/services
6016
- * - full: Uses HonoEndpoint.addRoutes for complex endpoints
6017
- */
6018
- optimizedHandlers?: boolean;
6019
- }
6020
- /**
6021
- * Supported event backend types.
6022
- *
6023
- * - `pgboss`: Reuses PostgreSQL with a dedicated user/schema. Auto-enables db service.
6024
- * - `sns`: Adds LocalStack container with SNS+SQS services.
6025
- * - `rabbitmq`: Adds RabbitMQ container.
6026
- *
6027
- * All backends generate EVENT_PUBLISHER_CONNECTION_STRING and EVENT_SUBSCRIBER_CONNECTION_STRING.
6028
- */
6029
- type EventsBackend = 'pgboss' | 'sns' | 'rabbitmq';
7844
+ type Routes = string | string[];
6030
7845
  /**
6031
7846
  * Where a declared cache actually lives.
6032
7847
  *
@@ -6043,8 +7858,12 @@ type EventsBackend = 'pgboss' | 'sns' | 'rabbitmq';
6043
7858
  * - `db` — a table in the database the app already declared. No infrastructure
6044
7859
  * at all, and the same relationship pg-boss has to Postgres: it creates its
6045
7860
  * own table on first use and needs a declared database to live in.
7861
+ * - `redis` — a Redis the stack runs beside the apps, on its network. It holds
7862
+ * *every* declared cache, one declared from a database included, so the
7863
+ * cache never competes with the database for its connections. Only the
7864
+ * compose target selects it today (`gkm compose`).
6046
7865
  */
6047
- type CacheBackend = 'upstash' | 'elasticache' | 'db';
7866
+ type CacheBackend = 'upstash' | 'elasticache' | 'db' | 'redis';
6048
7867
  /**
6049
7868
  * Who delivers a declared app's mail.
6050
7869
  *
@@ -6071,17 +7890,11 @@ interface DockerConfig {
6071
7890
  registry?: string;
6072
7891
  /** Docker image name (default: derived from package.json name) */
6073
7892
  imageName?: string;
6074
- /** Base Docker image (default: 'node:22-alpine') */
7893
+ /** Base Docker image (default: 'node:22.23.4-alpine', a Node security release) */
6075
7894
  baseImage?: string;
6076
7895
  /** Container port (default: 3000) */
6077
7896
  port?: number;
6078
7897
  }
6079
- interface ServerConfig extends ProviderConfig {
6080
- enableOpenApi?: boolean;
6081
- port?: number;
6082
- /** Production build configuration */
6083
- production?: ProductionConfig;
6084
- }
6085
7898
  type Runtime = 'node' | 'bun';
6086
7899
  interface TelescopeConfig {
6087
7900
  /** Enable/disable telescope (default: true in development) */
@@ -6099,14 +7912,6 @@ interface TelescopeConfig {
6099
7912
  /** Enable WebSocket for real-time updates (default: true, requires @hono/node-ws for Node.js) */
6100
7913
  websocket?: boolean;
6101
7914
  }
6102
- interface StudioConfig {
6103
- /** Enable/disable studio (default: true in development) */
6104
- enabled?: boolean;
6105
- /** Path prefix for studio UI (default: /__studio) */
6106
- path?: string;
6107
- /** Schema to introspect (default: 'public') */
6108
- schema?: string;
6109
- }
6110
7915
  interface OpenApiConfig {
6111
7916
  /** Enable OpenAPI generation (default: true) */
6112
7917
  enabled?: boolean;
@@ -6144,34 +7949,6 @@ interface HooksConfig {
6144
7949
  */
6145
7950
  server?: string;
6146
7951
  }
6147
- /** Dokploy deployment configuration */
6148
- interface DokployProviderConfig {
6149
- /** Dokploy API endpoint (e.g., 'https://dokploy.example.com') */
6150
- endpoint: string;
6151
- /** Project ID in Dokploy */
6152
- projectId: string;
6153
- /** Application ID in Dokploy */
6154
- applicationId: string;
6155
- /** Container registry (overrides docker.registry if set) */
6156
- registry?: string;
6157
- /** Registry ID in Dokploy (recommended for private registries) */
6158
- registryId?: string;
6159
- }
6160
- interface ProvidersConfig {
6161
- aws?: {
6162
- apiGateway?: {
6163
- v1?: boolean | AWSApiGatewayConfig;
6164
- v2?: boolean | AWSApiGatewayConfig;
6165
- };
6166
- lambda?: {
6167
- functions?: boolean | AWSLambdaConfig;
6168
- crons?: boolean | AWSLambdaConfig;
6169
- };
6170
- };
6171
- server?: boolean | ServerConfig;
6172
- /** Dokploy deployment configuration */
6173
- dokploy?: boolean | DokployProviderConfig;
6174
- }
6175
7952
  interface GkmConfig {
6176
7953
  /**
6177
7954
  * What this app is called, and therefore how everything it declares is named.
@@ -6195,6 +7972,10 @@ interface GkmConfig {
6195
7972
  stages: StagesConfig;
6196
7973
  /** Encrypted secrets, and where deployed stages' secrets are stored */
6197
7974
  secrets?: SecretsConfig;
7975
+ /** What `gkm test` hands a feature test: where the factories are. */
7976
+ test?: TestConfig;
7977
+ /** How `gkm dev` is reached: the discovery endpoint's port and origins. */
7978
+ dev?: DevConfig;
6198
7979
  /**
6199
7980
  * Constructs glob pattern — one glob, every kind.
6200
7981
  *
@@ -6206,7 +7987,6 @@ interface GkmConfig {
6206
7987
  * @example './src/**\/*.ts'
6207
7988
  */
6208
7989
  constructs: Routes;
6209
- providers?: ProvidersConfig;
6210
7990
  /**
6211
7991
  * Server lifecycle hooks for customizing the Hono app.
6212
7992
  * Allows adding custom routes, middleware, error handlers, etc.
@@ -6225,16 +8005,6 @@ interface GkmConfig {
6225
8005
  * - A TelescopeConfig object for inline configuration
6226
8006
  */
6227
8007
  telescope?: string | boolean | TelescopeConfig;
6228
- /**
6229
- * Studio configuration for database browsing.
6230
- * Can be:
6231
- * - A string path to a module that exports a Studio instance (recommended)
6232
- * - A boolean to enable/disable with defaults
6233
- * - A StudioConfig object for inline configuration
6234
- *
6235
- * Requires a database connection configured via services.
6236
- */
6237
- studio?: string | boolean | StudioConfig;
6238
8008
  /**
6239
8009
  * OpenAPI generation configuration.
6240
8010
  * Can be:
@@ -6297,7 +8067,11 @@ interface GkmConfig {
6297
8067
  * a rename rather than a rewrite.
6298
8068
  */
6299
8069
  deploy?: DeployConfig;
8070
+ /** Each deployed stage's base domain — the same field a workspace has. */
8071
+ domains?: DomainsConfig;
8072
+ /** Each root domain's DNS provider — the same field a workspace has. */
8073
+ dns?: WorkspaceDnsConfig;
6300
8074
  }
6301
8075
  //#endregion
6302
- export { SUPPORTED_DEPLOY_TARGETS as A, WorkspaceInput as C, FrontendFramework as D, Framework as E, isPhase2DeployTarget as F, safeValidateWorkspaceConfig as I, validateWorkspaceConfig as L, formatValidationErrors as M, getDeployTargetError as N, MobileFramework as O, isDeployTargetSupported as P, WorkspaceConfig as S, BackendFramework as T, ModelsConfig as _, Routes as a, SecretsConfig as b, AppInput as c, DeployConfig as d, DeployTarget as f, LoadedConfig as g, InferredWorkspaceConfig as h, OpenApiConfig as i, WorkspaceConfigSchema as j, PHASE_2_DEPLOY_TARGETS as k, AppsRecord as l, InferAppNames as m, EmailBackend as n, AppConfig as o, DokployWorkspaceConfig as p, GkmConfig as r, AppConfigInput as s, CacheBackend as t, ConstrainedApps as u, NormalizedAppConfig as v, isWorkspaceConfig as w, SharedConfig as x, NormalizedWorkspace as y };
6303
- //# sourceMappingURL=types-N7c2O2m7.d.cts.map
8076
+ export { TargetOptions as $, BackendFramework as A, ReleasedImage as At, isPhase2DeployTarget as B, SandboxExecOptions as Bt, SecretsConfig as C, DiscoverOptions as Ct, WorkspaceConfig as D, StateLocked as Dt, StageTelemetryConfig as E, LocalStateInCi as Et, SUPPORTED_DEPLOY_TARGETS as F, DeployIdentity as Ft, DeployPhaseContext as G, GkmError as Gt, validateWorkspaceConfig as H, SandboxResult as Ht, WorkspaceConfigSchema as I, deployIdentity as It, DeployTarget as J, DeployRuntime as K, formatValidationErrors as L, SECRETS_DIR_ENV as Lt, FrontendFramework as M, GithubActor as Mt, MobileFramework as N, LocalActor as Nt, WorkspaceInput as O, StateStore as Ot, PHASE_2_DEPLOY_TARGETS as P, StageSecrets as Pt, TargetEvent as Q, getDeployTargetError as R, Sandbox as Rt, OtlpTelemetryConfig as S, ConstructsNotSerializable as St, SharedConfig as T, isDeclarable as Tt, AnyDeployTarget as U, SecretNameInvalid as Ut, safeValidateWorkspaceConfig as V, SandboxOutput as Vt, DeployFailure as W, confineCwd as Wt, DeployTargetEntry as X, DeployTargetCapabilities as Y, DeployTargetLogger as Z, InferredWorkspaceConfig as _, StoredCredentialsOptions as _t, Routes as a, DeployPhase as at, NormalizedAppConfig as b, ProviderKind as bt, AppInput as c, AppDeployResult as ct, ConstrainedApps as d, Credential as dt, TargetOptionsIssue as et, DeployConfig as f, CredentialKind as ft, InferAppNames as g, MissingCredential as gt, DokployWorkspaceConfig as h, CredentialRequest as ht, OpenApiConfig as i, DeployEventType as it, Framework as j, Actor as jt, isWorkspaceConfig as k, StateVersionConflict as kt, AppsRecord as l, DeployResult as lt, DevConfig as m, CredentialProvider as mt, EmailBackend as n, DeployEvent as nt, AppConfig as o, ResourceChange as ot, DeployTargetName as p, CredentialKinds as pt, DeploySecrets as q, GkmConfig as r, DeployEventError as rt, AppConfigInput as s, ResourceVia as st, CacheBackend as t, TargetOptionsSchema as tt, ComposeWorkspaceConfig as u, AwsCredential as ut, LoadedConfig as v, chainCredentials as vt, SelfHostedTelemetryConfig as w, discover as wt, NormalizedWorkspace as x, ConstructDiscoveryFailed as xt, ModelsConfig as y, storedCredentials as yt, isDeployTargetSupported as z, SandboxCwdEscape as zt };
8077
+ //# sourceMappingURL=types-DmLnGeii.d.mts.map