@geekmidas/cli 10.0.0-alpha.62 → 10.0.0-alpha.64

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 (234) hide show
  1. package/README.md +2 -0
  2. package/dist/{HostingerProvider-DyD1Hin8.cjs → HostingerProvider-Bx2lHHvu.cjs} +3 -3
  3. package/dist/{HostingerProvider-DyD1Hin8.cjs.map → HostingerProvider-Bx2lHHvu.cjs.map} +1 -1
  4. package/dist/{HostingerProvider-B92qH4dC.mjs → HostingerProvider-Cd4aS5Kj.mjs} +2 -2
  5. package/dist/{HostingerProvider-B92qH4dC.mjs.map → HostingerProvider-Cd4aS5Kj.mjs.map} +1 -1
  6. package/dist/{LegacyStateStore-UHJEBLdn.cjs → LegacyStateStore-C2abV49N.cjs} +2 -2
  7. package/dist/{LegacyStateStore-UHJEBLdn.cjs.map → LegacyStateStore-C2abV49N.cjs.map} +1 -1
  8. package/dist/{LegacyStateStore-A8d2GdT7.mjs → LegacyStateStore-DIgkGaUP.mjs} +2 -2
  9. package/dist/{LegacyStateStore-A8d2GdT7.mjs.map → LegacyStateStore-DIgkGaUP.mjs.map} +1 -1
  10. package/dist/{LocalStateStore-B51rnfgn.mjs → LocalStateStore-Cy1ZBW7U.mjs} +2 -2
  11. package/dist/{LocalStateStore-B51rnfgn.mjs.map → LocalStateStore-Cy1ZBW7U.mjs.map} +1 -1
  12. package/dist/{LocalStateStore-COW3Ldwa.cjs → LocalStateStore-DiJqKyPy.cjs} +2 -2
  13. package/dist/{LocalStateStore-COW3Ldwa.cjs.map → LocalStateStore-DiJqKyPy.cjs.map} +1 -1
  14. package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs → OpenApiTsGenerator-BWuDRHe9.cjs} +2 -2
  15. package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs.map → OpenApiTsGenerator-BWuDRHe9.cjs.map} +1 -1
  16. package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs → OpenApiTsGenerator-C6v-IeHt.mjs} +2 -2
  17. package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs.map → OpenApiTsGenerator-C6v-IeHt.mjs.map} +1 -1
  18. package/dist/{S3StateStore-CJewPhgz.mjs → S3StateStore-D3x6ivBL.mjs} +2 -2
  19. package/dist/{S3StateStore-CJewPhgz.mjs.map → S3StateStore-D3x6ivBL.mjs.map} +1 -1
  20. package/dist/{S3StateStore-WUJGdRNL.cjs → S3StateStore-Ds0V1Lgm.cjs} +2 -2
  21. package/dist/{S3StateStore-WUJGdRNL.cjs.map → S3StateStore-Ds0V1Lgm.cjs.map} +1 -1
  22. package/dist/{SSMStateStore-Zejt42V8.cjs → SSMStateStore-CLipvx47.cjs} +2 -2
  23. package/dist/{SSMStateStore-Zejt42V8.cjs.map → SSMStateStore-CLipvx47.cjs.map} +1 -1
  24. package/dist/{SSMStateStore-iK5UKp9d.mjs → SSMStateStore-DfF174xQ.mjs} +2 -2
  25. package/dist/{SSMStateStore-iK5UKp9d.mjs.map → SSMStateStore-DfF174xQ.mjs.map} +1 -1
  26. package/dist/{bundler-CfH9frOS.cjs → bundler-C8uJf324.cjs} +4 -4
  27. package/dist/{bundler-CfH9frOS.cjs.map → bundler-C8uJf324.cjs.map} +1 -1
  28. package/dist/{bundler-DN5r4x5b.mjs → bundler-DYgm9xsd.mjs} +3 -3
  29. package/dist/{bundler-DN5r4x5b.mjs.map → bundler-DYgm9xsd.mjs.map} +1 -1
  30. package/dist/{cli-DYwxmfsW.mjs → cli-Bogz-zEj.mjs} +5 -4
  31. package/dist/{cli-DYwxmfsW.mjs.map → cli-Bogz-zEj.mjs.map} +1 -1
  32. package/dist/{cli-DOAUp80L.cjs → cli-D3jofJ6j.cjs} +7 -6
  33. package/dist/{cli-DOAUp80L.cjs.map → cli-D3jofJ6j.cjs.map} +1 -1
  34. package/dist/config-Be-4_I6H.d.cts +256 -0
  35. package/dist/config-Be-4_I6H.d.cts.map +1 -0
  36. package/dist/config-DqNRiQOp.d.mts +256 -0
  37. package/dist/config-DqNRiQOp.d.mts.map +1 -0
  38. package/dist/config.cjs +416 -13
  39. package/dist/config.cjs.map +1 -0
  40. package/dist/config.d.cts +4 -211
  41. package/dist/config.d.mts +4 -211
  42. package/dist/config.mjs +402 -3
  43. package/dist/config.mjs.map +1 -0
  44. package/dist/credentials-B70vmLcm.cjs +125 -0
  45. package/dist/credentials-B70vmLcm.cjs.map +1 -0
  46. package/dist/credentials-s0wMeZBU.mjs +108 -0
  47. package/dist/credentials-s0wMeZBU.mjs.map +1 -0
  48. package/dist/{define-CHBIEc5j.mjs → define-CYs0PEfZ.mjs} +2 -3
  49. package/dist/define-CYs0PEfZ.mjs.map +1 -0
  50. package/dist/{define-Cv_QvDrg.cjs → define-zUsP72ym.cjs} +2 -3
  51. package/dist/define-zUsP72ym.cjs.map +1 -0
  52. package/dist/deploy/public.cjs +166 -14
  53. package/dist/deploy/public.cjs.map +1 -0
  54. package/dist/deploy/public.d.cts +224 -3
  55. package/dist/deploy/public.d.cts.map +1 -1
  56. package/dist/deploy/public.d.mts +224 -3
  57. package/dist/deploy/public.d.mts.map +1 -1
  58. package/dist/deploy/public.mjs +141 -10
  59. package/dist/deploy/public.mjs.map +1 -0
  60. package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
  61. package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
  62. package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
  63. package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
  64. package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
  65. package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
  66. package/dist/{deploy-DSaCYvcO.cjs → deploy-55rJkdKz.cjs} +17 -14
  67. package/dist/{deploy-DSaCYvcO.cjs.map → deploy-55rJkdKz.cjs.map} +1 -1
  68. package/dist/{deploy-Cg9fae7a.mjs → deploy-Dc2LBJaK.mjs} +13 -10
  69. package/dist/deploy-Dc2LBJaK.mjs.map +1 -0
  70. package/dist/{deploy-B7jvUORo.mjs → deploy-ZRXIPp1c.mjs} +11 -8
  71. package/dist/{deploy-B7jvUORo.mjs.map → deploy-ZRXIPp1c.mjs.map} +1 -1
  72. package/dist/{deploy-D8Qr-Xto.cjs → deploy-yUcR2OlW.cjs} +15 -12
  73. package/dist/deploy-yUcR2OlW.cjs.map +1 -0
  74. package/dist/derive-B4vDpzgP.mjs +150 -0
  75. package/dist/derive-B4vDpzgP.mjs.map +1 -0
  76. package/dist/derive-DAbo49sm.cjs +161 -0
  77. package/dist/derive-DAbo49sm.cjs.map +1 -0
  78. package/dist/discover-B6yPpvRV.d.mts +99 -0
  79. package/dist/discover-B6yPpvRV.d.mts.map +1 -0
  80. package/dist/discover-B_IkPukx.d.cts +99 -0
  81. package/dist/discover-B_IkPukx.d.cts.map +1 -0
  82. package/dist/{discover-Bc-4eA_p.cjs → discover-DHdECueV.cjs} +280 -1
  83. package/dist/discover-DHdECueV.cjs.map +1 -0
  84. package/dist/{discover-FrYvzkeC.mjs → discover-LMrqsWSU.mjs} +246 -3
  85. package/dist/discover-LMrqsWSU.mjs.map +1 -0
  86. package/dist/{dokploy-CD9PY-3D.mjs → dokploy-CepdXuMl.mjs} +3 -3
  87. package/dist/{dokploy-CD9PY-3D.mjs.map → dokploy-CepdXuMl.mjs.map} +1 -1
  88. package/dist/{dokploy-Ey2foJLv.cjs → dokploy-D1d37rvM.cjs} +3 -3
  89. package/dist/{dokploy-Ey2foJLv.cjs.map → dokploy-D1d37rvM.cjs.map} +1 -1
  90. package/dist/{encryption-ChBk3hTj.cjs → encryption-C9X98u2F.cjs} +5 -5
  91. package/dist/{encryption-ChBk3hTj.cjs.map → encryption-C9X98u2F.cjs.map} +1 -1
  92. package/dist/{encryption-CVwvGbsL.mjs → encryption-CKHjMpCr.mjs} +5 -5
  93. package/dist/{encryption-CVwvGbsL.mjs.map → encryption-CKHjMpCr.mjs.map} +1 -1
  94. package/dist/fakes-C9RiT6XG.mjs.map +1 -1
  95. package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
  96. package/dist/{github-BCB3_LBX.mjs → github-D-byNI7T.mjs} +4 -4
  97. package/dist/{github-BCB3_LBX.mjs.map → github-D-byNI7T.mjs.map} +1 -1
  98. package/dist/{github-OUgPDlqg.cjs → github-Dd3tMa1u.cjs} +4 -4
  99. package/dist/{github-OUgPDlqg.cjs.map → github-Dd3tMa1u.cjs.map} +1 -1
  100. package/dist/{index-BtXDZQuF.d.cts → index-CJ2qsSpp.d.mts} +2 -2
  101. package/dist/{index-BtXDZQuF.d.cts.map → index-CJ2qsSpp.d.mts.map} +1 -1
  102. package/dist/{index-DrKzpHl-.d.mts → index-CfE9Y885.d.cts} +2 -2
  103. package/dist/{index-DrKzpHl-.d.mts.map → index-CfE9Y885.d.cts.map} +1 -1
  104. package/dist/index.cjs +111 -239
  105. package/dist/index.cjs.map +1 -1
  106. package/dist/index.mjs +82 -210
  107. package/dist/index.mjs.map +1 -1
  108. package/dist/local-C7wnrcYK.cjs +586 -0
  109. package/dist/local-C7wnrcYK.cjs.map +1 -0
  110. package/dist/local-Cd8ZYQG3.mjs +473 -0
  111. package/dist/local-Cd8ZYQG3.mjs.map +1 -0
  112. package/dist/{migrate-BoHMqdCu.mjs → migrate-B4gngTLe.mjs} +6 -6
  113. package/dist/{migrate-BoHMqdCu.mjs.map → migrate-B4gngTLe.mjs.map} +1 -1
  114. package/dist/{migrate-dnaFMvOm.cjs → migrate-tx9-P9uz.cjs} +6 -6
  115. package/dist/{migrate-dnaFMvOm.cjs.map → migrate-tx9-P9uz.cjs.map} +1 -1
  116. package/dist/openapi.cjs +3 -3
  117. package/dist/openapi.d.cts +1 -1
  118. package/dist/openapi.d.mts +1 -1
  119. package/dist/openapi.mjs +3 -3
  120. package/dist/{ready-DQIy21W5.mjs → ready-bQfu9GES.mjs} +3 -3
  121. package/dist/{ready-DQIy21W5.mjs.map → ready-bQfu9GES.mjs.map} +1 -1
  122. package/dist/{ready-XlNx-Gbo.cjs → ready-brEhh68f.cjs} +3 -3
  123. package/dist/{ready-XlNx-Gbo.cjs.map → ready-brEhh68f.cjs.map} +1 -1
  124. package/dist/reconcile/public.cjs +1 -1
  125. package/dist/reconcile/public.d.cts +4 -77
  126. package/dist/reconcile/public.d.cts.map +1 -1
  127. package/dist/reconcile/public.d.mts +4 -77
  128. package/dist/reconcile/public.d.mts.map +1 -1
  129. package/dist/reconcile/public.mjs +1 -1
  130. package/dist/{resolve-wbv66HjD.cjs → resolve-BXsNQjMR.cjs} +9 -6
  131. package/dist/resolve-BXsNQjMR.cjs.map +1 -0
  132. package/dist/{resolve-CFCIkm7m.mjs → resolve-DZ2IJ0qY.mjs} +9 -6
  133. package/dist/resolve-DZ2IJ0qY.mjs.map +1 -0
  134. package/dist/{runtime-CMwtq0AL.cjs → runtime-BGNDrHzh.cjs} +2 -2
  135. package/dist/{runtime-CMwtq0AL.cjs.map → runtime-BGNDrHzh.cjs.map} +1 -1
  136. package/dist/{runtime-Dn_n-29S.d.cts → runtime-CJEYK4Gz.d.mts} +2 -2
  137. package/dist/{runtime-CXPlkZzs.d.mts.map → runtime-CJEYK4Gz.d.mts.map} +1 -1
  138. package/dist/{runtime-CXPlkZzs.d.mts → runtime-Cjq1jlVX.d.cts} +2 -2
  139. package/dist/{runtime-Dn_n-29S.d.cts.map → runtime-Cjq1jlVX.d.cts.map} +1 -1
  140. package/dist/{runtime-DbakJS8u.mjs → runtime-Cmn-FeYO.mjs} +2 -2
  141. package/dist/{runtime-DbakJS8u.mjs.map → runtime-Cmn-FeYO.mjs.map} +1 -1
  142. package/dist/sandbox/config-worker.cjs +43 -0
  143. package/dist/sandbox/config-worker.cjs.map +1 -0
  144. package/dist/sandbox/config-worker.d.cts +1 -0
  145. package/dist/sandbox/config-worker.d.mts +1 -0
  146. package/dist/sandbox/config-worker.mjs +44 -0
  147. package/dist/sandbox/config-worker.mjs.map +1 -0
  148. package/dist/sandbox/discover-worker.cjs +44 -0
  149. package/dist/sandbox/discover-worker.cjs.map +1 -0
  150. package/dist/sandbox/discover-worker.d.cts +1 -0
  151. package/dist/sandbox/discover-worker.d.mts +1 -0
  152. package/dist/sandbox/discover-worker.mjs +45 -0
  153. package/dist/sandbox/discover-worker.mjs.map +1 -0
  154. package/dist/sandbox-CL--ZDui.cjs +164 -0
  155. package/dist/sandbox-CL--ZDui.cjs.map +1 -0
  156. package/dist/sandbox-Dm247NGx.mjs +117 -0
  157. package/dist/sandbox-Dm247NGx.mjs.map +1 -0
  158. package/dist/sandbox-M8UnLhXE.d.cts +126 -0
  159. package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
  160. package/dist/sandbox-M8UnLhXE.d.mts +126 -0
  161. package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
  162. package/dist/{workspace-BFe57es7.mjs → schemas-Ckm_aBnF.cjs} +71 -982
  163. package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
  164. package/dist/{workspace-B6zQO6RY.cjs → schemas-D2LCF689.mjs} +2 -1168
  165. package/dist/schemas-D2LCF689.mjs.map +1 -0
  166. package/dist/{sniffer-DHE2Nafd.mjs → sniffer-49KPbDgq.mjs} +131 -444
  167. package/dist/sniffer-49KPbDgq.mjs.map +1 -0
  168. package/dist/{sniffer-BsfPa-GA.cjs → sniffer-ByhbEW5A.cjs} +145 -512
  169. package/dist/sniffer-ByhbEW5A.cjs.map +1 -0
  170. package/dist/sst-BdALKEas.cjs +453 -0
  171. package/dist/sst-BdALKEas.cjs.map +1 -0
  172. package/dist/sst-Cper040I.mjs +430 -0
  173. package/dist/sst-Cper040I.mjs.map +1 -0
  174. package/dist/{store-BS8A7NcA.mjs → store-BaaonhkJ.mjs} +2 -2
  175. package/dist/{store-BS8A7NcA.mjs.map → store-BaaonhkJ.mjs.map} +1 -1
  176. package/dist/{store-KvNQwYaB.cjs → store-D_2ByRtW.cjs} +4 -4
  177. package/dist/{store-KvNQwYaB.cjs.map → store-D_2ByRtW.cjs.map} +1 -1
  178. package/dist/target/public.cjs +3 -3
  179. package/dist/target/public.d.cts +3 -3
  180. package/dist/target/public.d.mts +3 -3
  181. package/dist/target/public.mjs +3 -3
  182. package/dist/{terminal-6oL0vANs.cjs → terminal-Bdv--jhY.cjs} +16 -111
  183. package/dist/terminal-Bdv--jhY.cjs.map +1 -0
  184. package/dist/{terminal-ByZNjuig.mjs → terminal-D7Ntz6WE.mjs} +13 -90
  185. package/dist/terminal-D7Ntz6WE.mjs.map +1 -0
  186. package/dist/{types-DIA7Li-J.d.cts → types-B_bEQvb9.d.mts} +42 -7
  187. package/dist/types-B_bEQvb9.d.mts.map +1 -0
  188. package/dist/{types-CfLKGfC_.d.mts → types-DkrDOMxw.d.cts} +43 -6
  189. package/dist/types-DkrDOMxw.d.cts.map +1 -0
  190. package/dist/utils-D2Nk1Nv2.cjs +205 -0
  191. package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
  192. package/dist/utils-D_fxUqvU.mjs +156 -0
  193. package/dist/utils-D_fxUqvU.mjs.map +1 -0
  194. package/dist/vitest.cjs +2 -2
  195. package/dist/vitest.mjs +2 -2
  196. package/dist/workerRuntime-BXfhbe13.cjs +108 -0
  197. package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
  198. package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
  199. package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
  200. package/dist/workspace/index.cjs +1 -1
  201. package/dist/workspace/index.d.cts +2 -2
  202. package/dist/workspace/index.d.mts +2 -2
  203. package/dist/workspace/index.mjs +1 -1
  204. package/dist/workspace-BwgWJK7h.cjs +1196 -0
  205. package/dist/workspace-BwgWJK7h.cjs.map +1 -0
  206. package/dist/workspace-Bwit4q9O.mjs +1024 -0
  207. package/dist/workspace-Bwit4q9O.mjs.map +1 -0
  208. package/package.json +13 -13
  209. package/dist/config-BYh9S0cZ.cjs +0 -534
  210. package/dist/config-BYh9S0cZ.cjs.map +0 -1
  211. package/dist/config-Bf4-bROQ.mjs +0 -457
  212. package/dist/config-Bf4-bROQ.mjs.map +0 -1
  213. package/dist/config.d.cts.map +0 -1
  214. package/dist/config.d.mts.map +0 -1
  215. package/dist/define-CHBIEc5j.mjs.map +0 -1
  216. package/dist/define-Cv_QvDrg.cjs.map +0 -1
  217. package/dist/deploy-Cg9fae7a.mjs.map +0 -1
  218. package/dist/deploy-D8Qr-Xto.cjs.map +0 -1
  219. package/dist/discover-Bc-4eA_p.cjs.map +0 -1
  220. package/dist/discover-FrYvzkeC.mjs.map +0 -1
  221. package/dist/home-DOzBaWaL.cjs +0 -33
  222. package/dist/home-DOzBaWaL.cjs.map +0 -1
  223. package/dist/home-GI7pJl1M.mjs +0 -22
  224. package/dist/home-GI7pJl1M.mjs.map +0 -1
  225. package/dist/resolve-CFCIkm7m.mjs.map +0 -1
  226. package/dist/resolve-wbv66HjD.cjs.map +0 -1
  227. package/dist/sniffer-BsfPa-GA.cjs.map +0 -1
  228. package/dist/sniffer-DHE2Nafd.mjs.map +0 -1
  229. package/dist/terminal-6oL0vANs.cjs.map +0 -1
  230. package/dist/terminal-ByZNjuig.mjs.map +0 -1
  231. package/dist/types-CfLKGfC_.d.mts.map +0 -1
  232. package/dist/types-DIA7Li-J.d.cts.map +0 -1
  233. package/dist/workspace-B6zQO6RY.cjs.map +0 -1
  234. package/dist/workspace-BFe57es7.mjs.map +0 -1
@@ -1,11 +1,13 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
- const require_home = require("./home-DOzBaWaL.cjs");
3
- const require_discover = require("./discover-Bc-4eA_p.cjs");
4
- const require_config = require("./config-BYh9S0cZ.cjs");
5
- const require_workspace = require("./workspace-B6zQO6RY.cjs");
2
+ const require_local = require("./local-C7wnrcYK.cjs");
3
+ const require_discover = require("./discover-DHdECueV.cjs");
4
+ const require_sandbox = require("./sandbox-CL--ZDui.cjs");
5
+ const require_derive = require("./derive-DAbo49sm.cjs");
6
+ const require_workspace = require("./workspace-BwgWJK7h.cjs");
7
+ const require_config = require("./config.cjs");
6
8
  const require_storage = require("./storage-CSGoC3bK.cjs");
7
- const require_store = require("./store-KvNQwYaB.cjs");
8
- const require_runtime = require("./runtime-CMwtq0AL.cjs");
9
+ const require_store = require("./store-D_2ByRtW.cjs");
10
+ const require_runtime = require("./runtime-BGNDrHzh.cjs");
9
11
  const require_fakes = require("./fakes-zW-jNAbQ.cjs");
10
12
  let node_path = require("node:path");
11
13
  let node_process = require("node:process");
@@ -16,12 +18,11 @@ let node_fs_promises = require("node:fs/promises");
16
18
  let node_os = require("node:os");
17
19
  let node_util = require("node:util");
18
20
  let _geekmidas_manifest = require("@geekmidas/manifest");
21
+ let node_url = require("node:url");
19
22
  let node_child_process = require("node:child_process");
20
- let node_module = require("node:module");
21
23
  let node_net = require("node:net");
22
24
  let dotenv = require("dotenv");
23
25
  let node_crypto = require("node:crypto");
24
- let node_url = require("node:url");
25
26
  let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
26
27
  let _geekmidas_db_pg_roles = require("@geekmidas/db/pg/roles");
27
28
  let _geekmidas_events_sns_url = require("@geekmidas/events/sns/url");
@@ -109,128 +110,6 @@ async function prompt(message, options) {
109
110
  }
110
111
  }
111
112
  //#endregion
112
- //#region src/auth/credentials.ts
113
- /**
114
- * Get the path to the credentials directory
115
- */
116
- function getCredentialsDir(options) {
117
- if (options?.home) return options.home;
118
- return options?.root ? (0, node_path.join)(options.root, ".gkm") : require_home.gkmHome();
119
- }
120
- /**
121
- * Get the path to the credentials file
122
- */
123
- function getCredentialsPath(options) {
124
- return (0, node_path.join)(getCredentialsDir(options), "credentials.json");
125
- }
126
- /**
127
- * Ensure the credentials directory exists
128
- */
129
- function ensureCredentialsDir(options) {
130
- const dir = getCredentialsDir(options);
131
- if (!(0, node_fs.existsSync)(dir)) (0, node_fs.mkdirSync)(dir, {
132
- recursive: true,
133
- mode: 448
134
- });
135
- }
136
- /**
137
- * Read stored credentials from disk
138
- */
139
- async function readCredentials(options) {
140
- const path = getCredentialsPath(options);
141
- if (!(0, node_fs.existsSync)(path)) return {};
142
- try {
143
- const content = await (0, node_fs_promises.readFile)(path, "utf-8");
144
- return JSON.parse(content);
145
- } catch {
146
- return {};
147
- }
148
- }
149
- /**
150
- * Write credentials to disk
151
- */
152
- async function writeCredentials(credentials, options) {
153
- ensureCredentialsDir(options);
154
- const path = getCredentialsPath(options);
155
- await (0, node_fs_promises.writeFile)(path, JSON.stringify(credentials, null, 2), { mode: 384 });
156
- }
157
- /**
158
- * Store Dokploy credentials
159
- */
160
- async function storeDokployCredentials(token, endpoint, options) {
161
- const credentials = await readCredentials(options);
162
- credentials.dokploy = {
163
- token,
164
- endpoint,
165
- storedAt: (/* @__PURE__ */ new Date()).toISOString()
166
- };
167
- await writeCredentials(credentials, options);
168
- }
169
- /**
170
- * Get stored Dokploy credentials
171
- */
172
- async function getDokployCredentials(options) {
173
- const credentials = await readCredentials(options);
174
- const token = process.env.DOKPLOY_API_TOKEN ?? credentials.dokploy?.token;
175
- const endpoint = process.env.DOKPLOY_ENDPOINT ?? credentials.dokploy?.endpoint;
176
- if (!token || !endpoint) return null;
177
- return {
178
- token,
179
- endpoint: endpoint.replace(/\/$/, ""),
180
- ...credentials.dokploy?.registryId ? { registryId: credentials.dokploy.registryId } : {}
181
- };
182
- }
183
- /**
184
- * Remove Dokploy credentials
185
- */
186
- async function removeDokployCredentials(options) {
187
- const credentials = await readCredentials(options);
188
- if (!credentials.dokploy) return false;
189
- delete credentials.dokploy;
190
- await writeCredentials(credentials, options);
191
- return true;
192
- }
193
- /**
194
- * Get Dokploy API token, checking stored credentials first, then environment
195
- */
196
- async function getDokployToken(options) {
197
- const envToken = process.env.DOKPLOY_API_TOKEN;
198
- if (envToken) return envToken;
199
- const stored = await getDokployCredentials(options);
200
- if (stored) return stored.token;
201
- return null;
202
- }
203
- /**
204
- * Get Dokploy registry ID from stored credentials
205
- */
206
- async function getDokployRegistryId(options) {
207
- return (await getDokployCredentials(options))?.registryId ?? void 0;
208
- }
209
- /**
210
- * Store Hostinger API token
211
- *
212
- * @param token - API token from hpanel.hostinger.com/profile/api
213
- */
214
- async function storeHostingerToken(token, options) {
215
- const credentials = await readCredentials(options);
216
- credentials.hostinger = {
217
- token,
218
- storedAt: (/* @__PURE__ */ new Date()).toISOString()
219
- };
220
- await writeCredentials(credentials, options);
221
- }
222
- /**
223
- * Get stored Hostinger API token
224
- *
225
- * Checks environment variable first (HOSTINGER_API_TOKEN),
226
- * then falls back to stored credentials.
227
- */
228
- async function getHostingerToken(options) {
229
- const envToken = process.env.HOSTINGER_API_TOKEN;
230
- if (envToken) return envToken;
231
- return (await readCredentials(options)).hostinger?.token ?? null;
232
- }
233
- //#endregion
234
113
  //#region src/auth/index.ts
235
114
  const logger$2 = console;
236
115
  /**
@@ -278,10 +157,10 @@ async function loginCommand(options) {
278
157
  logger$2.error("\n✗ Invalid credentials. Please check your token and try again.");
279
158
  process.exit(1);
280
159
  }
281
- await storeDokployCredentials(token, endpoint);
160
+ await require_local.storeDokployCredentials(token, endpoint);
282
161
  logger$2.log("\n✓ Successfully logged in to Dokploy!");
283
162
  logger$2.log(` Endpoint: ${endpoint}`);
284
- logger$2.log(` Credentials stored in: ${getCredentialsPath()}`);
163
+ logger$2.log(` Credentials stored in: ${require_local.getCredentialsPath()}`);
285
164
  logger$2.log("\nYou can now use deploy commands without setting DOKPLOY_API_TOKEN.");
286
165
  }
287
166
  if (provider === "hostinger") {
@@ -298,9 +177,9 @@ async function loginCommand(options) {
298
177
  logger$2.error("Token is required");
299
178
  process.exit(1);
300
179
  }
301
- await storeHostingerToken(token);
180
+ await require_local.storeHostingerToken(token);
302
181
  logger$2.log("\n✓ Hostinger token stored.");
303
- logger$2.log(` Credentials stored in: ${getCredentialsPath()}`);
182
+ logger$2.log(` Credentials stored in: ${require_local.getCredentialsPath()}`);
304
183
  logger$2.log(" Not validated here: every DNS endpoint is scoped to a domain, so the\n first deploy that touches DNS is where a bad token reports itself.");
305
184
  logger$2.log("\nYou can now use it as a DNS provider without setting HOSTINGER_API_TOKEN.");
306
185
  }
@@ -311,12 +190,12 @@ async function loginCommand(options) {
311
190
  async function logoutCommand(options) {
312
191
  const { provider = "dokploy" } = options;
313
192
  if (provider === "all") {
314
- if (await removeDokployCredentials()) logger$2.log("\n✓ Logged out from all services");
193
+ if (await require_local.removeDokployCredentials()) logger$2.log("\n✓ Logged out from all services");
315
194
  else logger$2.log("\nNo stored credentials found");
316
195
  return;
317
196
  }
318
197
  if (provider === "dokploy") {
319
- if (await removeDokployCredentials()) logger$2.log("\n✓ Logged out from Dokploy");
198
+ if (await require_local.removeDokployCredentials()) logger$2.log("\n✓ Logged out from Dokploy");
320
199
  else logger$2.log("\nNo Dokploy credentials found");
321
200
  }
322
201
  }
@@ -325,13 +204,13 @@ async function logoutCommand(options) {
325
204
  */
326
205
  async function whoamiCommand() {
327
206
  logger$2.log("\n📋 Current credentials:\n");
328
- const dokploy = await getDokployCredentials();
207
+ const dokploy = await require_local.getDokployCredentials();
329
208
  if (dokploy) {
330
209
  logger$2.log(" Dokploy:");
331
210
  logger$2.log(` Endpoint: ${dokploy.endpoint}`);
332
211
  logger$2.log(` Token: ${maskToken(dokploy.token)}`);
333
212
  } else logger$2.log(" Dokploy: Not logged in");
334
- logger$2.log(`\n Credentials file: ${getCredentialsPath()}`);
213
+ logger$2.log(`\n Credentials file: ${require_local.getCredentialsPath()}`);
335
214
  }
336
215
  /**
337
216
  * Mask a token for display
@@ -588,45 +467,6 @@ function normalizeRoutes(routes) {
588
467
  return Array.isArray(routes) ? routes : [routes];
589
468
  }
590
469
  //#endregion
591
- //#region src/owningTsconfigJsx.ts
592
- const REGISTER = "owning-tsconfig-jsx-register.mjs";
593
- /** The CLI's `bin/` was not found above the module looking for it. */
594
- var OwningTsconfigJsxHookMissing = class extends Error {
595
- from;
596
- constructor(from) {
597
- super(`Could not find bin/${REGISTER} in any directory above '${from}'. It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the package if it is missing.`);
598
- this.from = from;
599
- this.name = "OwningTsconfigJsxHookMissing";
600
- }
601
- };
602
- /**
603
- * The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
604
- * upward because this module runs from `src/` in the repo and from a chunk in
605
- * `dist/` once built, and `bin/` sits beside both.
606
- */
607
- function registerUrl() {
608
- const from = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
609
- for (let dir = from;; dir = (0, node_path.dirname)(dir)) {
610
- const candidate = (0, node_path.join)(dir, "bin", REGISTER);
611
- if ((0, node_fs.existsSync)(candidate)) return (0, node_url.pathToFileURL)(candidate).href;
612
- if ((0, node_path.dirname)(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
613
- }
614
- }
615
- /**
616
- * `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
617
- * that compiles each `.tsx` with its own tsconfig's JSX settings (see
618
- * `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
619
- * is registered before tsx and reads the source on tsx's behalf.
620
- *
621
- * `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
622
- * this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
623
- * started with tsx already imported.
624
- */
625
- function withOwningTsconfigJsx(nodeOptions = "") {
626
- if (nodeOptions.includes(REGISTER)) return nodeOptions;
627
- return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
628
- }
629
- //#endregion
630
470
  //#region src/reconcile/containers.ts
631
471
  /**
632
472
  * What gkm knows about each container it can derive.
@@ -1348,11 +1188,11 @@ function planFor(manifest, stage, order, options = {}) {
1348
1188
  const root = rootSite(sites.map((r) => {
1349
1189
  const declared = manifest[r.id];
1350
1190
  return {
1351
- name: require_config.appKey(r.id),
1191
+ name: require_derive.appKey(r.id),
1352
1192
  ...declared?.kind === "site" && declared.root ? { root: true } : {}
1353
1193
  };
1354
1194
  }));
1355
- for (const site of sites) if (require_config.appKey(site.id) === root) site.root = true;
1195
+ for (const site of sites) if (require_derive.appKey(site.id) === root) site.root = true;
1356
1196
  const workerBroker = events === "pgboss" && Object.values(manifest).some((d) => d?.kind === "worker") && resources.some((r) => r.kind === "database");
1357
1197
  return {
1358
1198
  stage,
@@ -1906,7 +1746,7 @@ function localPlan(workspace, manifest, fakes = {}) {
1906
1746
  * host's port for each app, never a name on the compose network.
1907
1747
  */
1908
1748
  function sitePublicArgs(manifest, appName, env) {
1909
- const declaration = Object.entries(manifest).find(([id, d]) => d.kind === "site" && require_config.appKey(id) === appName)?.[1];
1749
+ const declaration = Object.entries(manifest).find(([id, d]) => d.kind === "site" && require_derive.appKey(id) === appName)?.[1];
1910
1750
  if (declaration?.kind !== "site") return {};
1911
1751
  const args = {};
1912
1752
  for (const key of Object.keys((0, _geekmidas_manifest.publicEnvFor)(declaration, manifest))) {
@@ -1962,7 +1802,7 @@ function networkEnv(plan, options) {
1962
1802
  * port.
1963
1803
  */
1964
1804
  function appEnvKeys(manifest, appName, runnables = {}) {
1965
- const entry = Object.entries(manifest).find(([id, d]) => (d.kind === "rest-api" || d.kind === "site" || d.kind === "mobile-app") && require_config.appKey(id) === appName);
1805
+ const entry = Object.entries(manifest).find(([id, d]) => (d.kind === "rest-api" || d.kind === "site" || d.kind === "mobile-app") && require_derive.appKey(id) === appName);
1966
1806
  if (!entry) return void 0;
1967
1807
  const [id, declaration] = entry;
1968
1808
  const keys = /* @__PURE__ */ new Set([
@@ -2011,7 +1851,7 @@ function appServices(workspace, manifest, containers, runnables = {}, fakes = {}
2011
1851
  const services = {};
2012
1852
  for (const [name, app] of Object.entries(workspace.apps)) {
2013
1853
  if (app.type === "mobile" || !app.port) continue;
2014
- const key = require_config.appKey(name);
1854
+ const key = require_derive.appKey(name);
2015
1855
  const health = app.type === "web" ? "/" : "/health";
2016
1856
  const dockerfile = dockerfileOf(name, app.path);
2017
1857
  const ports = [`${app.port}:${app.port}`];
@@ -2473,7 +2313,7 @@ var UnassignedPort = class extends Error {
2473
2313
  * Every call is scoped to the generated compose file. Nothing here can touch a
2474
2314
  * container this project did not generate.
2475
2315
  */
2476
- const run$1 = (0, node_util.promisify)(node_child_process.execFile);
2316
+ const run = (0, node_util.promisify)(node_child_process.execFile);
2477
2317
  /**
2478
2318
  * The generated file, then the project's own if it has one.
2479
2319
  *
@@ -2516,7 +2356,7 @@ function shown(args, services) {
2516
2356
  const dockerCli = {
2517
2357
  async publishedPort(composePath, service, inside) {
2518
2358
  try {
2519
- const { stdout } = await run$1("docker", [
2359
+ const { stdout } = await run("docker", [
2520
2360
  "compose",
2521
2361
  ...composeFiles(composePath),
2522
2362
  "port",
@@ -2541,11 +2381,11 @@ const dockerCli = {
2541
2381
  ...services
2542
2382
  ];
2543
2383
  if (options.show) return shown(args, services);
2544
- await run$1("docker", args);
2384
+ await run("docker", args);
2545
2385
  },
2546
2386
  async copyOut(composePath, service, from, to) {
2547
2387
  await (0, node_fs_promises.mkdir)((0, node_path.dirname)(to), { recursive: true });
2548
- await run$1("docker", [
2388
+ await run("docker", [
2549
2389
  "compose",
2550
2390
  ...composeFiles(composePath),
2551
2391
  "cp",
@@ -2554,7 +2394,7 @@ const dockerCli = {
2554
2394
  ]);
2555
2395
  },
2556
2396
  async reload(composePath, service) {
2557
- await run$1("docker", [
2397
+ await run("docker", [
2558
2398
  "compose",
2559
2399
  ...composeFiles(composePath),
2560
2400
  "exec",
@@ -2569,7 +2409,7 @@ const dockerCli = {
2569
2409
  async healthy(composePath, services) {
2570
2410
  if (services.length === 0) return true;
2571
2411
  try {
2572
- const { stdout } = await run$1("docker", [
2412
+ const { stdout } = await run("docker", [
2573
2413
  "compose",
2574
2414
  ...composeFiles(composePath),
2575
2415
  "ps",
@@ -3485,7 +3325,7 @@ function metroPorts(workspace, manifest) {
3485
3325
  const ports = {};
3486
3326
  for (const [id, declaration] of Object.entries(manifest)) {
3487
3327
  if (declaration.kind !== "mobile-app") continue;
3488
- const port = workspace.apps[require_config.appKey(id)]?.port;
3328
+ const port = workspace.apps[require_derive.appKey(id)]?.port;
3489
3329
  if (port) ports[id] = port;
3490
3330
  }
3491
3331
  return ports;
@@ -3510,7 +3350,7 @@ function surfaceAddresses(workspace, manifest, at = (_app, port) => localAddress
3510
3350
  const addresses = {};
3511
3351
  for (const [id, declaration] of Object.entries(manifest)) {
3512
3352
  if (declaration.kind !== "rest-api" && declaration.kind !== "site") continue;
3513
- const host = require_config.appKey(id);
3353
+ const host = require_derive.appKey(id);
3514
3354
  const port = workspace.apps[host]?.port;
3515
3355
  if (port) addresses[id] = at(host, port);
3516
3356
  }
@@ -3521,116 +3361,6 @@ function localAddress(port) {
3521
3361
  return `http://localhost:${port}`;
3522
3362
  }
3523
3363
  //#endregion
3524
- //#region src/run.ts
3525
- /**
3526
- * Start a program with an argument array, never a shell string.
3527
- *
3528
- * `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the
3529
- * workspace — image refs, tags, build args, package names — to `docker` and
3530
- * `turbo`. Joined into a string and handed to a shell, a package named
3531
- * `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which
3532
- * matters most where the CLI builds a repository it didn't write: a CI job for a
3533
- * fork, a shared build runner. Here every value reaches the program as one
3534
- * `argv` element, whatever it contains.
3535
- */
3536
- /** Long enough for a cold image build; short enough that a hung one ends. */
3537
- const DEFAULT_TIMEOUT_MS = 18e5;
3538
- /** How long a timed-out child has to exit on SIGTERM before it is killed. */
3539
- const KILL_GRACE_MS = 5e3;
3540
- /** The command line as a person would read it — for messages, never to run. */
3541
- function display(command, args) {
3542
- return [command, ...args].join(" ");
3543
- }
3544
- /** The program ran and exited unsuccessfully; its own output said why. */
3545
- var CommandFailed = class extends Error {
3546
- command;
3547
- args;
3548
- exitCode;
3549
- signal;
3550
- constructor(command, args, exitCode, signal) {
3551
- super(`\`${display(command, args)}\` ${exitCode === null ? `was stopped by ${signal ?? "a signal"}` : `exited with code ${exitCode}`}. Its output above says why; run it by hand to see it again.`);
3552
- this.command = command;
3553
- this.args = args;
3554
- this.exitCode = exitCode;
3555
- this.signal = signal;
3556
- this.name = "CommandFailed";
3557
- }
3558
- };
3559
- /** The program ran past its timeout and was killed. */
3560
- var CommandTimedOut = class extends Error {
3561
- command;
3562
- args;
3563
- timeoutMs;
3564
- constructor(command, args, timeoutMs) {
3565
- super(`\`${display(command, args)}\` was still running after ${Math.round(timeoutMs / 1e3)}s and was stopped. Check what it was waiting on — a registry, the Docker daemon, a prompt — and run it again.`);
3566
- this.command = command;
3567
- this.args = args;
3568
- this.timeoutMs = timeoutMs;
3569
- this.name = "CommandTimedOut";
3570
- }
3571
- };
3572
- /**
3573
- * Run `command` with `args`, resolving when it exits 0.
3574
- *
3575
- * Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}
3576
- * once `timeoutMs` passes (after the child is gone), and with the spawn error
3577
- * itself when the program cannot be started at all — `ENOENT` already names it.
3578
- */
3579
- async function run(command, args, options = {}) {
3580
- await spawnChild(command, args, options, false);
3581
- }
3582
- /**
3583
- * {@link run}, resolving with what the program wrote to stdout — for a value
3584
- * the CLI reads back, such as the digest `docker inspect` reports. stderr still
3585
- * reaches the terminal, so a failure explains itself the same way.
3586
- */
3587
- function runOutput(command, args, options = {}) {
3588
- return spawnChild(command, args, options, true);
3589
- }
3590
- function spawnChild(command, args, options, capture) {
3591
- const { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;
3592
- return new Promise((resolve, reject) => {
3593
- const child = (0, node_child_process.spawn)(command, [...args], {
3594
- stdio: "inherit",
3595
- ...spawnOptions,
3596
- ...capture ? { stdio: [
3597
- "ignore",
3598
- "pipe",
3599
- "inherit"
3600
- ] } : {},
3601
- shell: false
3602
- });
3603
- let stdout = "";
3604
- child.stdout?.on("data", (chunk) => {
3605
- stdout += chunk.toString();
3606
- });
3607
- let timedOut = false;
3608
- let killer;
3609
- const timer = setTimeout(() => {
3610
- timedOut = true;
3611
- child.kill("SIGTERM");
3612
- killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
3613
- killer.unref?.();
3614
- }, timeoutMs);
3615
- timer.unref?.();
3616
- const settle = () => {
3617
- clearTimeout(timer);
3618
- if (killer) clearTimeout(killer);
3619
- };
3620
- child.on("error", (error) => {
3621
- settle();
3622
- reject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);
3623
- });
3624
- child.on("close", (code, signal) => {
3625
- settle();
3626
- if (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);
3627
- else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
3628
- else if (code === 0) resolve(stdout);
3629
- else reject(new CommandFailed(command, args, code, signal));
3630
- });
3631
- });
3632
- }
3633
- //#endregion
3634
3364
  //#region src/secrets/encryption.ts
3635
3365
  var encryption_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
3636
3366
  encryptSecrets: () => encryptSecrets,
@@ -4055,17 +3785,17 @@ function isStateStore(value) {
4055
3785
  async function createStateStore(options) {
4056
3786
  const { config, workspaceRoot, workspaceName } = options;
4057
3787
  if (!config || config.provider === "local") {
4058
- const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-COW3Ldwa.cjs")).then((n) => n.LocalStateStore_exports);
3788
+ const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-DiJqKyPy.cjs")).then((n) => n.LocalStateStore_exports);
4059
3789
  return new LocalStateStore(workspaceRoot);
4060
3790
  }
4061
3791
  if (isStateStore(config.provider)) return config.provider;
4062
3792
  if (isStateProvider(config.provider)) {
4063
- const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-UHJEBLdn.cjs"));
3793
+ const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-C2abV49N.cjs"));
4064
3794
  return new LegacyStateStore(config.provider, { warn: options.warn });
4065
3795
  }
4066
3796
  if (config.provider === "ssm") {
4067
3797
  if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
4068
- const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-Zejt42V8.cjs"));
3798
+ const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-CLipvx47.cjs"));
4069
3799
  const ssm = config;
4070
3800
  return SSMStateStore.create({
4071
3801
  workspaceName,
@@ -4075,7 +3805,7 @@ async function createStateStore(options) {
4075
3805
  }
4076
3806
  if (config.provider === "s3") {
4077
3807
  if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
4078
- const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-WUJGdRNL.cjs"));
3808
+ const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-Ds0V1Lgm.cjs"));
4079
3809
  const s3 = config;
4080
3810
  return S3StateStore.create({
4081
3811
  workspaceName,
@@ -5259,7 +4989,7 @@ async function buildDockerImage(imageName, options, cwd) {
5259
4989
  logger.log(`\n🐳 Building Docker image: ${fullImageName}`);
5260
4990
  const cleanup = ensureLockfile(cwd);
5261
4991
  try {
5262
- await run("docker", [
4992
+ await require_local.run("docker", [
5263
4993
  "build",
5264
4994
  "--file=.gkm/docker/Dockerfile",
5265
4995
  `--tag=${fullImageName}`,
@@ -5288,7 +5018,7 @@ async function pushDockerImage(imageName, options, cwd) {
5288
5018
  const fullImageName = validateImageRef(`${registry}/${imageName}:${tag}`);
5289
5019
  logger.log(`\n🚀 Pushing Docker image: ${fullImageName}`);
5290
5020
  try {
5291
- await run("docker", ["push", fullImageName], { cwd });
5021
+ await require_local.run("docker", ["push", fullImageName], { cwd });
5292
5022
  logger.log(`✅ Docker image pushed: ${fullImageName}`);
5293
5023
  } catch (error) {
5294
5024
  throw new DockerPushFailed(fullImageName, error);
@@ -5391,7 +5121,7 @@ async function workspaceDockerCommand(workspace, manifest) {
5391
5121
  * leaving the bundle with an empty URL.
5392
5122
  */
5393
5123
  function siteDockerfile(appName, app, options) {
5394
- const declared = options.manifest ? Object.entries(options.manifest).find(([id, d]) => d.kind === "site" && require_config.appKey(id) === appName)?.[1] : void 0;
5124
+ const declared = options.manifest ? Object.entries(options.manifest).find(([id, d]) => d.kind === "site" && require_derive.appKey(id) === appName)?.[1] : void 0;
5395
5125
  const publicUrlArgs = declared?.kind === "site" && options.manifest ? Object.keys((0, _geekmidas_manifest.publicEnvFor)(declared, options.manifest)) : getPublicUrlArgNames(app);
5396
5126
  const webOpts = {
5397
5127
  imageName: appName,
@@ -6230,13 +5960,6 @@ var DokployApi = class {
6230
5960
  const __filename$1 = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
6231
5961
  const __dirname$1 = (0, node_path.dirname)(__filename$1);
6232
5962
  /**
6233
- * Resolve the tsx package path from the CLI package's dependencies.
6234
- * This ensures tsx is available regardless of whether the target project has it installed.
6235
- */
6236
- function resolveTsxPath() {
6237
- return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve("tsx");
6238
- }
6239
- /**
6240
5963
  * Resolve the path to a sniffer helper file.
6241
5964
  * Handles both dev (.ts with tsx) and production (.mjs from dist).
6242
5965
  *
@@ -6255,6 +5978,39 @@ function resolveSnifferFile(baseName) {
6255
5978
  return tsPath;
6256
5979
  }
6257
5980
  /**
5981
+ * Run a sniffer worker in the sandbox, with the sandbox's environment and
5982
+ * nothing of the deploy's: the deploy's Dokploy token, registry login and AWS
5983
+ * keys stay where they are. A worker that outlives the timeout is killed, and
5984
+ * comes back as the error the caller reports.
5985
+ */
5986
+ async function runSniffer(run, workspacePath, cwd, nodeArgs) {
5987
+ const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new require_local.LocalSandbox({ root: (0, node_path.resolve)(workspacePath) });
5988
+ try {
5989
+ const result = await sandbox.exec("node", nodeArgs, {
5990
+ cwd,
5991
+ env: { ...sandbox.env },
5992
+ timeoutMs: run.timeoutMs ?? 3e4,
5993
+ output: "capture"
5994
+ });
5995
+ return {
5996
+ stdout: result.stdout,
5997
+ stderr: result.stderr,
5998
+ code: result.exitCode
5999
+ };
6000
+ } catch (error) {
6001
+ return { error: error instanceof Error ? error : new Error(String(error)) };
6002
+ }
6003
+ }
6004
+ /** The worker's JSON answer: the last object on stdout naming `envVars`. */
6005
+ function snifferAnswer(stdout) {
6006
+ try {
6007
+ const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
6008
+ return jsonMatch ? JSON.parse(jsonMatch[0]) : void 0;
6009
+ } catch {
6010
+ return;
6011
+ }
6012
+ }
6013
+ /**
6258
6014
  * Get required environment variables for an app.
6259
6015
  *
6260
6016
  * Detection strategy (in order):
@@ -6276,6 +6032,10 @@ function resolveSnifferFile(baseName) {
6276
6032
  */
6277
6033
  async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
6278
6034
  const { logWarnings = true, markOptional = false } = options;
6035
+ const run = {
6036
+ ...options.sandbox ? { sandbox: options.sandbox } : {},
6037
+ ...options.timeoutMs ? { timeoutMs: options.timeoutMs } : {}
6038
+ };
6279
6039
  if (app.type === "web" || app.type === "mobile") {
6280
6040
  const publicPrefix = require_workspace.getPublicEnvPrefix(app.framework);
6281
6041
  const depVars = publicPrefix ? (app.dependencies ?? []).map((dep) => `${publicPrefix}${dep.toUpperCase()}_URL`) : [];
@@ -6286,7 +6046,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
6286
6046
  if (app.config.client) configPaths.push(app.config.client);
6287
6047
  if (app.config.server) configPaths.push(app.config.server);
6288
6048
  for (const configPath of configPaths) {
6289
- const result = await sniffEntryFile(configPath, app.path, workspacePath);
6049
+ const result = await sniffEntryFile(configPath, app.path, workspacePath, run);
6290
6050
  if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Config file "${configPath}" threw error during sniffing (env vars still captured): ${result.error.message}`);
6291
6051
  sniffedVars.push(...result.envVars);
6292
6052
  sniffedOptional.push(...result.optionalEnvVars);
@@ -6305,7 +6065,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
6305
6065
  };
6306
6066
  }
6307
6067
  if (app.entry) {
6308
- const result = await sniffEntryFile(app.entry, app.path, workspacePath);
6068
+ const result = await sniffEntryFile(app.entry, app.path, workspacePath, run);
6309
6069
  if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Entry file threw error during sniffing (env vars still captured): ${result.error.message}`);
6310
6070
  return {
6311
6071
  appName,
@@ -6314,7 +6074,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
6314
6074
  };
6315
6075
  }
6316
6076
  if (app.routes) {
6317
- const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath);
6077
+ const result = await sniffRouteFiles(normalizeRoutes(app.routes), app.path, workspacePath, run);
6318
6078
  if (logWarnings && result.error) require_discover.output.warn(`[sniffer] ${appName}: Route sniffing threw error (env vars still captured): ${result.error.message}`);
6319
6079
  return {
6320
6080
  appName,
@@ -6323,7 +6083,7 @@ async function sniffAppEnvironment(app, appName, workspacePath, options = {}) {
6323
6083
  };
6324
6084
  }
6325
6085
  if (app.envParser) {
6326
- const result = await sniffEnvParser(app.envParser, app.path, workspacePath);
6086
+ const result = await sniffEnvParser(app.envParser, app.path, workspacePath, run);
6327
6087
  if (logWarnings) {
6328
6088
  if (result.error) require_discover.output.warn(`[sniffer] ${appName}: envParser threw error during sniffing (env vars still captured): ${result.error.message}`);
6329
6089
  if (result.unhandledRejections.length > 0) require_discover.output.warn(`[sniffer] ${appName}: Fire-and-forget rejections during sniffing (suppressed): ${result.unhandledRejections.map((e) => e.message).join(", ")}`);
@@ -6368,63 +6128,27 @@ function applyMarkOptional(envVars, optionalEnvVars, markOptional) {
6368
6128
  * @param workspacePath - Absolute path to workspace root
6369
6129
  * @returns EntrySniffResult with env vars and optional error
6370
6130
  */
6371
- async function sniffEntryFile(entryPath, appPath, workspacePath) {
6131
+ async function sniffEntryFile(entryPath, appPath, workspacePath, run = {}) {
6372
6132
  const fullEntryPath = (0, node_path.resolve)(workspacePath, appPath, entryPath);
6373
6133
  const loaderPath = resolveSnifferFile("sniffer-loader");
6374
6134
  const workerPath = resolveSnifferFile("sniffer-worker");
6375
- return new Promise((resolvePromise) => {
6376
- const child = (0, node_child_process.spawn)("node", [
6377
- "--import",
6378
- loaderPath,
6379
- workerPath,
6380
- fullEntryPath
6381
- ], {
6382
- cwd: (0, node_path.resolve)(workspacePath, appPath),
6383
- stdio: [
6384
- "ignore",
6385
- "pipe",
6386
- "pipe"
6387
- ],
6388
- env: {
6389
- ...process.env,
6390
- NODE_OPTIONS: withOwningTsconfigJsx("--import=tsx")
6391
- }
6392
- });
6393
- let stdout = "";
6394
- let stderr = "";
6395
- child.stdout.on("data", (data) => {
6396
- stdout += data.toString();
6397
- });
6398
- child.stderr.on("data", (data) => {
6399
- stderr += data.toString();
6400
- });
6401
- child.on("close", (code) => {
6402
- try {
6403
- const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
6404
- if (jsonMatch) {
6405
- const result = JSON.parse(jsonMatch[0]);
6406
- resolvePromise({
6407
- envVars: result.envVars || [],
6408
- optionalEnvVars: result.optionalEnvVars || [],
6409
- error: result.error ? new Error(result.error) : void 0
6410
- });
6411
- return;
6412
- }
6413
- } catch {}
6414
- resolvePromise({
6415
- envVars: [],
6416
- optionalEnvVars: [],
6417
- error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${code}): ${stderr || stdout || "No output"}`)
6418
- });
6419
- });
6420
- child.on("error", (err) => {
6421
- resolvePromise({
6422
- envVars: [],
6423
- optionalEnvVars: [],
6424
- error: err
6425
- });
6426
- });
6427
- });
6135
+ const ran = await runSniffer(run, workspacePath, (0, node_path.resolve)(workspacePath, appPath), require_discover.nodeWithTsx(workerPath, [fullEntryPath], [loaderPath]));
6136
+ if ("error" in ran) return {
6137
+ envVars: [],
6138
+ optionalEnvVars: [],
6139
+ error: ran.error
6140
+ };
6141
+ const answer = snifferAnswer(ran.stdout);
6142
+ if (answer) return {
6143
+ envVars: answer.envVars || [],
6144
+ optionalEnvVars: answer.optionalEnvVars || [],
6145
+ error: answer.error ? new Error(answer.error) : void 0
6146
+ };
6147
+ return {
6148
+ envVars: [],
6149
+ optionalEnvVars: [],
6150
+ error: /* @__PURE__ */ new Error(`Failed to sniff entry file (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
6151
+ };
6428
6152
  }
6429
6153
  /**
6430
6154
  * Sniff route files by loading constructs and calling getEnvironment().
@@ -6440,116 +6164,79 @@ async function sniffEntryFile(entryPath, appPath, workspacePath) {
6440
6164
  * @param workspacePath - Absolute path to workspace root
6441
6165
  * @returns EntrySniffResult with env vars and optional error
6442
6166
  */
6443
- async function sniffRouteFiles(routes, appPath, workspacePath) {
6167
+ async function sniffRouteFiles(routes, appPath, workspacePath, run = {}) {
6444
6168
  const fullAppPath = (0, node_path.resolve)(workspacePath, appPath);
6445
6169
  const workerPath = resolveSnifferFile("sniffer-routes-worker");
6446
- const tsxPath = resolveTsxPath();
6447
6170
  const pattern = (Array.isArray(routes) ? routes : [routes])[0];
6448
6171
  if (!pattern) return {
6449
6172
  envVars: [],
6450
6173
  optionalEnvVars: [],
6451
6174
  error: /* @__PURE__ */ new Error("No route patterns provided")
6452
6175
  };
6453
- return new Promise((resolvePromise) => {
6454
- const child = (0, node_child_process.spawn)("node", [
6455
- "--import",
6456
- tsxPath,
6457
- workerPath,
6458
- fullAppPath,
6459
- pattern
6460
- ], {
6461
- cwd: fullAppPath,
6462
- stdio: [
6463
- "ignore",
6464
- "pipe",
6465
- "pipe"
6466
- ],
6467
- env: { ...process.env }
6468
- });
6469
- let stdout = "";
6470
- let stderr = "";
6471
- child.stdout.on("data", (data) => {
6472
- stdout += data.toString();
6473
- });
6474
- child.stderr.on("data", (data) => {
6475
- stderr += data.toString();
6476
- });
6477
- child.on("close", (code) => {
6478
- if (stderr) stderr.split("\n").filter((line) => line.trim()).forEach((line) => require_discover.output.warn(line));
6479
- try {
6480
- const jsonMatch = stdout.match(/\{[^{}]*"envVars"[^{}]*\}[^{]*$/);
6481
- if (jsonMatch) {
6482
- const result = JSON.parse(jsonMatch[0]);
6483
- resolvePromise({
6484
- envVars: result.envVars || [],
6485
- optionalEnvVars: result.optionalEnvVars || [],
6486
- error: result.error ? new Error(result.error) : void 0
6487
- });
6488
- return;
6489
- }
6490
- } catch {}
6491
- resolvePromise({
6492
- envVars: [],
6493
- optionalEnvVars: [],
6494
- error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${code}): ${stderr || stdout || "No output"}`)
6495
- });
6496
- });
6497
- child.on("error", (err) => {
6498
- resolvePromise({
6499
- envVars: [],
6500
- optionalEnvVars: [],
6501
- error: err
6502
- });
6503
- });
6504
- });
6176
+ const ran = await runSniffer(run, workspacePath, fullAppPath, require_discover.nodeWithTsx(workerPath, [fullAppPath, pattern]));
6177
+ if ("error" in ran) return {
6178
+ envVars: [],
6179
+ optionalEnvVars: [],
6180
+ error: ran.error
6181
+ };
6182
+ if (ran.stderr) ran.stderr.split("\n").filter((line) => line.trim()).forEach((line) => require_discover.output.warn(line));
6183
+ const answer = snifferAnswer(ran.stdout);
6184
+ if (answer) return {
6185
+ envVars: answer.envVars || [],
6186
+ optionalEnvVars: answer.optionalEnvVars || [],
6187
+ error: answer.error ? new Error(answer.error) : void 0
6188
+ };
6189
+ return {
6190
+ envVars: [],
6191
+ optionalEnvVars: [],
6192
+ error: /* @__PURE__ */ new Error(`Failed to sniff route files (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
6193
+ };
6505
6194
  }
6506
6195
  /**
6507
6196
  * Run the SnifferEnvironmentParser on an envParser module to detect
6508
6197
  * which environment variables it accesses.
6509
6198
  *
6510
- * This function handles "fire and forget" async operations by using
6511
- * the shared sniffWithFireAndForget utility from @geekmidas/envkit.
6199
+ * In a subprocess, like the entry and route sniffers: the module is the
6200
+ * project's code, and it was imported into the deploy itself before — with
6201
+ * every credential the deploy held in reach. Fire-and-forget rejections are
6202
+ * collected there with the shared `sniffWithFireAndForget`.
6512
6203
  *
6513
6204
  * @param envParserPath - The envParser config (e.g., './src/config/env#envParser')
6514
6205
  * @param appPath - The app's path relative to workspace
6515
6206
  * @param workspacePath - Absolute path to workspace root
6516
6207
  * @returns SniffResult with env vars and any errors encountered
6517
6208
  */
6518
- async function sniffEnvParser(envParserPath, appPath, workspacePath) {
6209
+ async function sniffEnvParser(envParserPath, appPath, workspacePath, run = {}) {
6519
6210
  const [modulePath, exportName = "default"] = envParserPath.split("#");
6520
6211
  if (!modulePath) return {
6521
6212
  envVars: [],
6522
6213
  optionalEnvVars: [],
6523
6214
  unhandledRejections: []
6524
6215
  };
6525
- const fullPath = (0, node_path.resolve)(workspacePath, appPath, modulePath);
6526
- let SnifferEnvironmentParser;
6527
- let sniffWithFireAndForget;
6528
- try {
6529
- const envkitModule = await import("@geekmidas/envkit/sniffer");
6530
- SnifferEnvironmentParser = envkitModule.SnifferEnvironmentParser;
6531
- sniffWithFireAndForget = envkitModule.sniffWithFireAndForget;
6532
- } catch (error) {
6533
- const message = error instanceof Error ? error.message : String(error);
6534
- require_discover.output.warn(`[sniffer] Failed to import SnifferEnvironmentParser: ${message}`);
6535
- return {
6536
- envVars: [],
6537
- optionalEnvVars: [],
6538
- unhandledRejections: []
6539
- };
6540
- }
6541
- const sniffer = new SnifferEnvironmentParser();
6542
- return sniffWithFireAndForget(sniffer, async () => {
6543
- const envParser = (await import((0, node_url.pathToFileURL)(fullPath).href))[exportName];
6544
- if (typeof envParser !== "function") {
6545
- require_discover.output.warn(`[sniffer] Export "${exportName}" from "${modulePath}" is not a function`);
6546
- return;
6547
- }
6548
- const result = envParser(sniffer);
6549
- if (result && typeof result.parse === "function") try {
6550
- result.parse();
6551
- } catch {}
6552
- });
6216
+ const appRoot = (0, node_path.resolve)(workspacePath, appPath);
6217
+ const fullPath = (0, node_path.resolve)(appRoot, modulePath);
6218
+ const workerPath = resolveSnifferFile("sniffer-envparser-worker");
6219
+ const ran = await runSniffer(run, workspacePath, appRoot, require_discover.nodeWithTsx(workerPath, [fullPath, exportName]));
6220
+ if ("error" in ran) return {
6221
+ envVars: [],
6222
+ optionalEnvVars: [],
6223
+ unhandledRejections: [],
6224
+ error: ran.error
6225
+ };
6226
+ const answer = snifferAnswer(ran.stdout);
6227
+ if (!answer) return {
6228
+ envVars: [],
6229
+ optionalEnvVars: [],
6230
+ unhandledRejections: [],
6231
+ error: /* @__PURE__ */ new Error(`Failed to sniff envParser (exit code ${ran.code}): ${ran.stderr || ran.stdout || "No output"}`)
6232
+ };
6233
+ for (const warning of answer.warnings ?? []) require_discover.output.warn(warning);
6234
+ return {
6235
+ envVars: answer.envVars ?? [],
6236
+ optionalEnvVars: answer.optionalEnvVars ?? [],
6237
+ unhandledRejections: (answer.unhandledRejections ?? []).map((message) => new Error(message)),
6238
+ ...answer.error ? { error: new Error(answer.error) } : {}
6239
+ };
6553
6240
  }
6554
6241
  /**
6555
6242
  * Sniff environment requirements for multiple apps.
@@ -6808,36 +6495,12 @@ Object.defineProperty(exports, "getBackupState", {
6808
6495
  return getBackupState;
6809
6496
  }
6810
6497
  });
6811
- Object.defineProperty(exports, "getDokployCredentials", {
6812
- enumerable: true,
6813
- get: function() {
6814
- return getDokployCredentials;
6815
- }
6816
- });
6817
- Object.defineProperty(exports, "getDokployRegistryId", {
6818
- enumerable: true,
6819
- get: function() {
6820
- return getDokployRegistryId;
6821
- }
6822
- });
6823
- Object.defineProperty(exports, "getDokployToken", {
6824
- enumerable: true,
6825
- get: function() {
6826
- return getDokployToken;
6827
- }
6828
- });
6829
6498
  Object.defineProperty(exports, "getGeneratedSecret", {
6830
6499
  enumerable: true,
6831
6500
  get: function() {
6832
6501
  return getGeneratedSecret;
6833
6502
  }
6834
6503
  });
6835
- Object.defineProperty(exports, "getHostingerToken", {
6836
- enumerable: true,
6837
- get: function() {
6838
- return getHostingerToken;
6839
- }
6840
- });
6841
6504
  Object.defineProperty(exports, "hostFor", {
6842
6505
  enumerable: true,
6843
6506
  get: function() {
@@ -6970,12 +6633,6 @@ Object.defineProperty(exports, "quoteIdentifier", {
6970
6633
  return quoteIdentifier;
6971
6634
  }
6972
6635
  });
6973
- Object.defineProperty(exports, "readCredentials", {
6974
- enumerable: true,
6975
- get: function() {
6976
- return readCredentials;
6977
- }
6978
- });
6979
6636
  Object.defineProperty(exports, "reconcileWorkspace", {
6980
6637
  enumerable: true,
6981
6638
  get: function() {
@@ -6994,18 +6651,6 @@ Object.defineProperty(exports, "resourceName", {
6994
6651
  return resourceName;
6995
6652
  }
6996
6653
  });
6997
- Object.defineProperty(exports, "run", {
6998
- enumerable: true,
6999
- get: function() {
7000
- return run;
7001
- }
7002
- });
7003
- Object.defineProperty(exports, "runOutput", {
7004
- enumerable: true,
7005
- get: function() {
7006
- return runOutput;
7007
- }
7008
- });
7009
6654
  Object.defineProperty(exports, "setApplicationId", {
7010
6655
  enumerable: true,
7011
6656
  get: function() {
@@ -7072,12 +6717,6 @@ Object.defineProperty(exports, "storageBackendFor", {
7072
6717
  return storageBackendFor;
7073
6718
  }
7074
6719
  });
7075
- Object.defineProperty(exports, "storeDokployCredentials", {
7076
- enumerable: true,
7077
- get: function() {
7078
- return storeDokployCredentials;
7079
- }
7080
- });
7081
6720
  Object.defineProperty(exports, "validateDokployToken", {
7082
6721
  enumerable: true,
7083
6722
  get: function() {
@@ -7102,12 +6741,6 @@ Object.defineProperty(exports, "withGeneratedSecrets", {
7102
6741
  return withGeneratedSecrets;
7103
6742
  }
7104
6743
  });
7105
- Object.defineProperty(exports, "withOwningTsconfigJsx", {
7106
- enumerable: true,
7107
- get: function() {
7108
- return withOwningTsconfigJsx;
7109
- }
7110
- });
7111
6744
  Object.defineProperty(exports, "workspace_exports", {
7112
6745
  enumerable: true,
7113
6746
  get: function() {
@@ -7115,4 +6748,4 @@ Object.defineProperty(exports, "workspace_exports", {
7115
6748
  }
7116
6749
  });
7117
6750
 
7118
- //# sourceMappingURL=sniffer-BsfPa-GA.cjs.map
6751
+ //# sourceMappingURL=sniffer-ByhbEW5A.cjs.map