@marinoscar/platform-cli 0.1.0-next.3 → 0.1.0-next.31

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 (943) hide show
  1. package/CHANGELOG.md +365 -0
  2. package/README.md +163 -31
  3. package/dist/android/build.d.ts +30 -0
  4. package/dist/android/build.d.ts.map +1 -0
  5. package/dist/android/build.js +126 -0
  6. package/dist/android/build.js.map +1 -0
  7. package/dist/android/command.d.ts +21 -0
  8. package/dist/android/command.d.ts.map +1 -0
  9. package/dist/android/command.js +355 -0
  10. package/dist/android/command.js.map +1 -0
  11. package/dist/android/deploy-step.d.ts +85 -0
  12. package/dist/android/deploy-step.d.ts.map +1 -0
  13. package/dist/android/deploy-step.js +268 -0
  14. package/dist/android/deploy-step.js.map +1 -0
  15. package/dist/android/doctor.d.ts +47 -0
  16. package/dist/android/doctor.d.ts.map +1 -0
  17. package/dist/android/doctor.js +219 -0
  18. package/dist/android/doctor.js.map +1 -0
  19. package/dist/android/exec.d.ts +42 -0
  20. package/dist/android/exec.d.ts.map +1 -0
  21. package/dist/android/exec.js +103 -0
  22. package/dist/android/exec.js.map +1 -0
  23. package/dist/android/fix-plan.d.ts +44 -0
  24. package/dist/android/fix-plan.d.ts.map +1 -0
  25. package/dist/android/fix-plan.js +86 -0
  26. package/dist/android/fix-plan.js.map +1 -0
  27. package/dist/android/git-freshness.d.ts +34 -0
  28. package/dist/android/git-freshness.d.ts.map +1 -0
  29. package/dist/android/git-freshness.js +120 -0
  30. package/dist/android/git-freshness.js.map +1 -0
  31. package/dist/android/gradle.d.ts +32 -0
  32. package/dist/android/gradle.d.ts.map +1 -0
  33. package/dist/android/gradle.js +55 -0
  34. package/dist/android/gradle.js.map +1 -0
  35. package/dist/android/identity.d.ts +27 -0
  36. package/dist/android/identity.d.ts.map +1 -0
  37. package/dist/android/identity.js +60 -0
  38. package/dist/android/identity.js.map +1 -0
  39. package/dist/android/index.d.ts +7 -0
  40. package/dist/android/index.d.ts.map +1 -0
  41. package/dist/android/index.js +8 -0
  42. package/dist/android/index.js.map +1 -0
  43. package/dist/android/installer.d.ts +28 -0
  44. package/dist/android/installer.d.ts.map +1 -0
  45. package/dist/android/installer.js +96 -0
  46. package/dist/android/installer.js.map +1 -0
  47. package/dist/android/java.d.ts +26 -0
  48. package/dist/android/java.d.ts.map +1 -0
  49. package/dist/android/java.js +65 -0
  50. package/dist/android/java.js.map +1 -0
  51. package/dist/android/keystore.d.ts +54 -0
  52. package/dist/android/keystore.d.ts.map +1 -0
  53. package/dist/android/keystore.js +159 -0
  54. package/dist/android/keystore.js.map +1 -0
  55. package/dist/android/metadata.d.ts +39 -0
  56. package/dist/android/metadata.d.ts.map +1 -0
  57. package/dist/android/metadata.js +61 -0
  58. package/dist/android/metadata.js.map +1 -0
  59. package/dist/android/operations.d.ts +42 -0
  60. package/dist/android/operations.d.ts.map +1 -0
  61. package/dist/android/operations.js +59 -0
  62. package/dist/android/operations.js.map +1 -0
  63. package/dist/android/paths.d.ts +29 -0
  64. package/dist/android/paths.d.ts.map +1 -0
  65. package/dist/android/paths.js +97 -0
  66. package/dist/android/paths.js.map +1 -0
  67. package/dist/android/publish.d.ts +37 -0
  68. package/dist/android/publish.d.ts.map +1 -0
  69. package/dist/android/publish.js +119 -0
  70. package/dist/android/publish.js.map +1 -0
  71. package/dist/android/registrations.d.ts +92 -0
  72. package/dist/android/registrations.d.ts.map +1 -0
  73. package/dist/android/registrations.js +112 -0
  74. package/dist/android/registrations.js.map +1 -0
  75. package/dist/android/release-status.d.ts +73 -0
  76. package/dist/android/release-status.d.ts.map +1 -0
  77. package/dist/android/release-status.js +161 -0
  78. package/dist/android/release-status.js.map +1 -0
  79. package/dist/android/release.d.ts +33 -0
  80. package/dist/android/release.d.ts.map +1 -0
  81. package/dist/android/release.js +59 -0
  82. package/dist/android/release.js.map +1 -0
  83. package/dist/android/screen-layout.d.ts +26 -0
  84. package/dist/android/screen-layout.d.ts.map +1 -0
  85. package/dist/android/screen-layout.js +24 -0
  86. package/dist/android/screen-layout.js.map +1 -0
  87. package/dist/android/screen-model.d.ts +56 -0
  88. package/dist/android/screen-model.d.ts.map +1 -0
  89. package/dist/android/screen-model.js +207 -0
  90. package/dist/android/screen-model.js.map +1 -0
  91. package/dist/android/screen.d.ts +8 -0
  92. package/dist/android/screen.d.ts.map +1 -0
  93. package/dist/android/screen.js +395 -0
  94. package/dist/android/screen.js.map +1 -0
  95. package/dist/android/sdk.d.ts +48 -0
  96. package/dist/android/sdk.d.ts.map +1 -0
  97. package/dist/android/sdk.js +82 -0
  98. package/dist/android/sdk.js.map +1 -0
  99. package/dist/android/server-url.d.ts +19 -0
  100. package/dist/android/server-url.d.ts.map +1 -0
  101. package/dist/android/server-url.js +36 -0
  102. package/dist/android/server-url.js.map +1 -0
  103. package/dist/android/upload-progress.d.ts +3 -0
  104. package/dist/android/upload-progress.d.ts.map +1 -0
  105. package/dist/android/upload-progress.js +47 -0
  106. package/dist/android/upload-progress.js.map +1 -0
  107. package/dist/android/version.d.ts +47 -0
  108. package/dist/android/version.d.ts.map +1 -0
  109. package/dist/android/version.js +136 -0
  110. package/dist/android/version.js.map +1 -0
  111. package/dist/api-client/index.d.ts +3 -0
  112. package/dist/api-client/index.d.ts.map +1 -0
  113. package/dist/api-client/index.js +5 -0
  114. package/dist/api-client/index.js.map +1 -0
  115. package/dist/commands/index.d.ts +52 -0
  116. package/dist/commands/index.d.ts.map +1 -0
  117. package/dist/commands/index.js +63 -0
  118. package/dist/commands/index.js.map +1 -0
  119. package/dist/core/cli-registry.d.ts +41 -0
  120. package/dist/core/cli-registry.d.ts.map +1 -0
  121. package/dist/core/cli-registry.js +49 -0
  122. package/dist/core/cli-registry.js.map +1 -0
  123. package/dist/core/command-registry.d.ts +10 -0
  124. package/dist/core/command-registry.d.ts.map +1 -1
  125. package/dist/core/command-registry.js +17 -0
  126. package/dist/core/command-registry.js.map +1 -1
  127. package/dist/core/env-annotation-registry.d.ts +58 -0
  128. package/dist/core/env-annotation-registry.d.ts.map +1 -0
  129. package/dist/core/env-annotation-registry.js +80 -0
  130. package/dist/core/env-annotation-registry.js.map +1 -0
  131. package/dist/core/env-generator-registry.d.ts +59 -0
  132. package/dist/core/env-generator-registry.d.ts.map +1 -0
  133. package/dist/core/env-generator-registry.js +102 -0
  134. package/dist/core/env-generator-registry.js.map +1 -0
  135. package/dist/core/env-group-registry.d.ts +65 -0
  136. package/dist/core/env-group-registry.d.ts.map +1 -0
  137. package/dist/core/env-group-registry.js +77 -0
  138. package/dist/core/env-group-registry.js.map +1 -0
  139. package/dist/core/env-spec-registry.d.ts +16 -2
  140. package/dist/core/env-spec-registry.d.ts.map +1 -1
  141. package/dist/core/env-spec-registry.js +15 -0
  142. package/dist/core/env-spec-registry.js.map +1 -1
  143. package/dist/core/env-values.d.ts +3 -2
  144. package/dist/core/env-values.d.ts.map +1 -1
  145. package/dist/core/env-values.js +5 -3
  146. package/dist/core/env-values.js.map +1 -1
  147. package/dist/core/index.d.ts +10 -2
  148. package/dist/core/index.d.ts.map +1 -1
  149. package/dist/core/index.js +6 -2
  150. package/dist/core/index.js.map +1 -1
  151. package/dist/deploy/index.d.ts +3 -0
  152. package/dist/deploy/index.d.ts.map +1 -0
  153. package/dist/deploy/index.js +5 -0
  154. package/dist/deploy/index.js.map +1 -0
  155. package/dist/engine/api-client.d.ts +211 -0
  156. package/dist/engine/api-client.d.ts.map +1 -0
  157. package/dist/engine/api-client.js +350 -0
  158. package/dist/engine/api-client.js.map +1 -0
  159. package/dist/engine/browser.d.ts +18 -0
  160. package/dist/engine/browser.d.ts.map +1 -0
  161. package/dist/engine/browser.js +115 -0
  162. package/dist/engine/browser.js.map +1 -0
  163. package/dist/engine/builtin-registrations.d.ts +20 -0
  164. package/dist/engine/builtin-registrations.d.ts.map +1 -0
  165. package/dist/engine/builtin-registrations.js +86 -0
  166. package/dist/engine/builtin-registrations.js.map +1 -0
  167. package/dist/engine/commands/api.d.ts +88 -0
  168. package/dist/engine/commands/api.d.ts.map +1 -0
  169. package/dist/engine/commands/api.js +398 -0
  170. package/dist/engine/commands/api.js.map +1 -0
  171. package/dist/engine/commands/config.d.ts +5 -0
  172. package/dist/engine/commands/config.d.ts.map +1 -0
  173. package/dist/engine/commands/config.js +83 -0
  174. package/dist/engine/commands/config.js.map +1 -0
  175. package/dist/engine/commands/deploy.d.ts +250 -0
  176. package/dist/engine/commands/deploy.d.ts.map +1 -0
  177. package/dist/engine/commands/deploy.js +1186 -0
  178. package/dist/engine/commands/deploy.js.map +1 -0
  179. package/dist/engine/commands/init.d.ts +18 -0
  180. package/dist/engine/commands/init.d.ts.map +1 -0
  181. package/dist/engine/commands/init.js +50 -0
  182. package/dist/engine/commands/init.js.map +1 -0
  183. package/dist/engine/commands/login.d.ts +4 -0
  184. package/dist/engine/commands/login.d.ts.map +1 -0
  185. package/dist/engine/commands/login.js +205 -0
  186. package/dist/engine/commands/login.js.map +1 -0
  187. package/dist/engine/commands/node.d.ts +21 -0
  188. package/dist/engine/commands/node.d.ts.map +1 -0
  189. package/dist/engine/commands/node.js +503 -0
  190. package/dist/engine/commands/node.js.map +1 -0
  191. package/dist/engine/config.d.ts +284 -0
  192. package/dist/engine/config.d.ts.map +1 -0
  193. package/dist/engine/config.js +469 -0
  194. package/dist/engine/config.js.map +1 -0
  195. package/dist/engine/conformance.d.ts +193 -0
  196. package/dist/engine/conformance.d.ts.map +1 -0
  197. package/dist/engine/conformance.js +243 -0
  198. package/dist/engine/conformance.js.map +1 -0
  199. package/dist/engine/create-cli.d.ts +181 -0
  200. package/dist/engine/create-cli.d.ts.map +1 -0
  201. package/dist/engine/create-cli.js +91 -0
  202. package/dist/engine/create-cli.js.map +1 -0
  203. package/dist/engine/deploy/about.d.ts +12 -0
  204. package/dist/engine/deploy/about.d.ts.map +1 -0
  205. package/dist/engine/deploy/about.js +110 -0
  206. package/dist/engine/deploy/about.js.map +1 -0
  207. package/dist/engine/deploy/adopt.d.ts +21 -0
  208. package/dist/engine/deploy/adopt.d.ts.map +1 -0
  209. package/dist/engine/deploy/adopt.js +78 -0
  210. package/dist/engine/deploy/adopt.js.map +1 -0
  211. package/dist/engine/deploy/answers-file.d.ts +7 -0
  212. package/dist/engine/deploy/answers-file.d.ts.map +1 -0
  213. package/dist/engine/deploy/answers-file.js +49 -0
  214. package/dist/engine/deploy/answers-file.js.map +1 -0
  215. package/dist/engine/deploy/app-role.d.ts +278 -0
  216. package/dist/engine/deploy/app-role.d.ts.map +1 -0
  217. package/dist/engine/deploy/app-role.js +826 -0
  218. package/dist/engine/deploy/app-role.js.map +1 -0
  219. package/dist/engine/deploy/app-version.d.ts +103 -0
  220. package/dist/engine/deploy/app-version.d.ts.map +1 -0
  221. package/dist/engine/deploy/app-version.js +344 -0
  222. package/dist/engine/deploy/app-version.js.map +1 -0
  223. package/dist/engine/deploy/checks/compose.d.ts +16 -0
  224. package/dist/engine/deploy/checks/compose.d.ts.map +1 -0
  225. package/dist/engine/deploy/checks/compose.js +149 -0
  226. package/dist/engine/deploy/checks/compose.js.map +1 -0
  227. package/dist/engine/deploy/checks/database.d.ts +83 -0
  228. package/dist/engine/deploy/checks/database.d.ts.map +1 -0
  229. package/dist/engine/deploy/checks/database.js +455 -0
  230. package/dist/engine/deploy/checks/database.js.map +1 -0
  231. package/dist/engine/deploy/checks/dns.d.ts +3 -0
  232. package/dist/engine/deploy/checks/dns.d.ts.map +1 -0
  233. package/dist/engine/deploy/checks/dns.js +85 -0
  234. package/dist/engine/deploy/checks/dns.js.map +1 -0
  235. package/dist/engine/deploy/checks/host.d.ts +19 -0
  236. package/dist/engine/deploy/checks/host.d.ts.map +1 -0
  237. package/dist/engine/deploy/checks/host.js +543 -0
  238. package/dist/engine/deploy/checks/host.js.map +1 -0
  239. package/dist/engine/deploy/checks/index.d.ts +35 -0
  240. package/dist/engine/deploy/checks/index.d.ts.map +1 -0
  241. package/dist/engine/deploy/checks/index.js +75 -0
  242. package/dist/engine/deploy/checks/index.js.map +1 -0
  243. package/dist/engine/deploy/checks/registry.d.ts +110 -0
  244. package/dist/engine/deploy/checks/registry.d.ts.map +1 -0
  245. package/dist/engine/deploy/checks/registry.js +104 -0
  246. package/dist/engine/deploy/checks/registry.js.map +1 -0
  247. package/dist/engine/deploy/checks/source.d.ts +45 -0
  248. package/dist/engine/deploy/checks/source.d.ts.map +1 -0
  249. package/dist/engine/deploy/checks/source.js +175 -0
  250. package/dist/engine/deploy/checks/source.js.map +1 -0
  251. package/dist/engine/deploy/checks/stack-ports.d.ts +4 -0
  252. package/dist/engine/deploy/checks/stack-ports.d.ts.map +1 -0
  253. package/dist/engine/deploy/checks/stack-ports.js +261 -0
  254. package/dist/engine/deploy/checks/stack-ports.js.map +1 -0
  255. package/dist/engine/deploy/checks/tls.d.ts +87 -0
  256. package/dist/engine/deploy/checks/tls.d.ts.map +1 -0
  257. package/dist/engine/deploy/checks/tls.js +552 -0
  258. package/dist/engine/deploy/checks/tls.js.map +1 -0
  259. package/dist/engine/deploy/checks/types.d.ts +202 -0
  260. package/dist/engine/deploy/checks/types.d.ts.map +1 -0
  261. package/dist/engine/deploy/checks/types.js +199 -0
  262. package/dist/engine/deploy/checks/types.js.map +1 -0
  263. package/dist/engine/deploy/compose-command.d.ts +16 -0
  264. package/dist/engine/deploy/compose-command.d.ts.map +1 -0
  265. package/dist/engine/deploy/compose-command.js +40 -0
  266. package/dist/engine/deploy/compose-command.js.map +1 -0
  267. package/dist/engine/deploy/compose-containers.d.ts +101 -0
  268. package/dist/engine/deploy/compose-containers.d.ts.map +1 -0
  269. package/dist/engine/deploy/compose-containers.js +191 -0
  270. package/dist/engine/deploy/compose-containers.js.map +1 -0
  271. package/dist/engine/deploy/compose-files.d.ts +29 -0
  272. package/dist/engine/deploy/compose-files.d.ts.map +1 -0
  273. package/dist/engine/deploy/compose-files.js +118 -0
  274. package/dist/engine/deploy/compose-files.js.map +1 -0
  275. package/dist/engine/deploy/compose-hints.d.ts +11 -0
  276. package/dist/engine/deploy/compose-hints.d.ts.map +1 -0
  277. package/dist/engine/deploy/compose-hints.js +70 -0
  278. package/dist/engine/deploy/compose-hints.js.map +1 -0
  279. package/dist/engine/deploy/compose-port-variables.d.ts +58 -0
  280. package/dist/engine/deploy/compose-port-variables.d.ts.map +1 -0
  281. package/dist/engine/deploy/compose-port-variables.js +184 -0
  282. package/dist/engine/deploy/compose-port-variables.js.map +1 -0
  283. package/dist/engine/deploy/compose-ports.d.ts +98 -0
  284. package/dist/engine/deploy/compose-ports.d.ts.map +1 -0
  285. package/dist/engine/deploy/compose-ports.js +204 -0
  286. package/dist/engine/deploy/compose-ports.js.map +1 -0
  287. package/dist/engine/deploy/compose-project.d.ts +113 -0
  288. package/dist/engine/deploy/compose-project.d.ts.map +1 -0
  289. package/dist/engine/deploy/compose-project.js +177 -0
  290. package/dist/engine/deploy/compose-project.js.map +1 -0
  291. package/dist/engine/deploy/consent.d.ts +29 -0
  292. package/dist/engine/deploy/consent.d.ts.map +1 -0
  293. package/dist/engine/deploy/consent.js +35 -0
  294. package/dist/engine/deploy/consent.js.map +1 -0
  295. package/dist/engine/deploy/database-drop.d.ts +22 -0
  296. package/dist/engine/deploy/database-drop.d.ts.map +1 -0
  297. package/dist/engine/deploy/database-drop.js +135 -0
  298. package/dist/engine/deploy/database-drop.js.map +1 -0
  299. package/dist/engine/deploy/database.d.ts +116 -0
  300. package/dist/engine/deploy/database.d.ts.map +1 -0
  301. package/dist/engine/deploy/database.js +252 -0
  302. package/dist/engine/deploy/database.js.map +1 -0
  303. package/dist/engine/deploy/deploy-info.d.ts +48 -0
  304. package/dist/engine/deploy/deploy-info.d.ts.map +1 -0
  305. package/dist/engine/deploy/deploy-info.js +163 -0
  306. package/dist/engine/deploy/deploy-info.js.map +1 -0
  307. package/dist/engine/deploy/deployment-evidence.d.ts +38 -0
  308. package/dist/engine/deploy/deployment-evidence.d.ts.map +1 -0
  309. package/dist/engine/deploy/deployment-evidence.js +92 -0
  310. package/dist/engine/deploy/deployment-evidence.js.map +1 -0
  311. package/dist/engine/deploy/edge-config.d.ts +103 -0
  312. package/dist/engine/deploy/edge-config.d.ts.map +1 -0
  313. package/dist/engine/deploy/edge-config.js +170 -0
  314. package/dist/engine/deploy/edge-config.js.map +1 -0
  315. package/dist/engine/deploy/env-absence.d.ts +61 -0
  316. package/dist/engine/deploy/env-absence.d.ts.map +1 -0
  317. package/dist/engine/deploy/env-absence.js +33 -0
  318. package/dist/engine/deploy/env-absence.js.map +1 -0
  319. package/dist/engine/deploy/env-file.d.ts +14 -0
  320. package/dist/engine/deploy/env-file.d.ts.map +1 -0
  321. package/dist/engine/deploy/env-file.js +58 -0
  322. package/dist/engine/deploy/env-file.js.map +1 -0
  323. package/dist/engine/deploy/env-fragments.d.ts +29 -0
  324. package/dist/engine/deploy/env-fragments.d.ts.map +1 -0
  325. package/dist/engine/deploy/env-fragments.js +73 -0
  326. package/dist/engine/deploy/env-fragments.js.map +1 -0
  327. package/dist/engine/deploy/env-metadata.d.ts +73 -0
  328. package/dist/engine/deploy/env-metadata.d.ts.map +1 -0
  329. package/dist/engine/deploy/env-metadata.js +227 -0
  330. package/dist/engine/deploy/env-metadata.js.map +1 -0
  331. package/dist/engine/deploy/env-spec.d.ts +75 -0
  332. package/dist/engine/deploy/env-spec.d.ts.map +1 -0
  333. package/dist/engine/deploy/env-spec.js +239 -0
  334. package/dist/engine/deploy/env-spec.js.map +1 -0
  335. package/dist/engine/deploy/env-wizard.d.ts +56 -0
  336. package/dist/engine/deploy/env-wizard.d.ts.map +1 -0
  337. package/dist/engine/deploy/env-wizard.js +235 -0
  338. package/dist/engine/deploy/env-wizard.js.map +1 -0
  339. package/dist/engine/deploy/executor.d.ts +81 -0
  340. package/dist/engine/deploy/executor.d.ts.map +1 -0
  341. package/dist/engine/deploy/executor.js +247 -0
  342. package/dist/engine/deploy/executor.js.map +1 -0
  343. package/dist/engine/deploy/free-ports.d.ts +145 -0
  344. package/dist/engine/deploy/free-ports.d.ts.map +1 -0
  345. package/dist/engine/deploy/free-ports.js +235 -0
  346. package/dist/engine/deploy/free-ports.js.map +1 -0
  347. package/dist/engine/deploy/health.d.ts +153 -0
  348. package/dist/engine/deploy/health.d.ts.map +1 -0
  349. package/dist/engine/deploy/health.js +335 -0
  350. package/dist/engine/deploy/health.js.map +1 -0
  351. package/dist/engine/deploy/hooks.d.ts +66 -0
  352. package/dist/engine/deploy/hooks.d.ts.map +1 -0
  353. package/dist/engine/deploy/hooks.js +19 -0
  354. package/dist/engine/deploy/hooks.js.map +1 -0
  355. package/dist/engine/deploy/host-facts.d.ts +23 -0
  356. package/dist/engine/deploy/host-facts.d.ts.map +1 -0
  357. package/dist/engine/deploy/host-facts.js +67 -0
  358. package/dist/engine/deploy/host-facts.js.map +1 -0
  359. package/dist/engine/deploy/install.d.ts +239 -0
  360. package/dist/engine/deploy/install.d.ts.map +1 -0
  361. package/dist/engine/deploy/install.js +1474 -0
  362. package/dist/engine/deploy/install.js.map +1 -0
  363. package/dist/engine/deploy/inventory.d.ts +30 -0
  364. package/dist/engine/deploy/inventory.d.ts.map +1 -0
  365. package/dist/engine/deploy/inventory.js +122 -0
  366. package/dist/engine/deploy/inventory.js.map +1 -0
  367. package/dist/engine/deploy/journal.d.ts +77 -0
  368. package/dist/engine/deploy/journal.d.ts.map +1 -0
  369. package/dist/engine/deploy/journal.js +221 -0
  370. package/dist/engine/deploy/journal.js.map +1 -0
  371. package/dist/engine/deploy/layout.d.ts +77 -0
  372. package/dist/engine/deploy/layout.d.ts.map +1 -0
  373. package/dist/engine/deploy/layout.js +191 -0
  374. package/dist/engine/deploy/layout.js.map +1 -0
  375. package/dist/engine/deploy/oauth-check.d.ts +58 -0
  376. package/dist/engine/deploy/oauth-check.d.ts.map +1 -0
  377. package/dist/engine/deploy/oauth-check.js +213 -0
  378. package/dist/engine/deploy/oauth-check.js.map +1 -0
  379. package/dist/engine/deploy/proxy-bootstrap.d.ts +149 -0
  380. package/dist/engine/deploy/proxy-bootstrap.d.ts.map +1 -0
  381. package/dist/engine/deploy/proxy-bootstrap.js +416 -0
  382. package/dist/engine/deploy/proxy-bootstrap.js.map +1 -0
  383. package/dist/engine/deploy/proxy-streams.d.ts +110 -0
  384. package/dist/engine/deploy/proxy-streams.d.ts.map +1 -0
  385. package/dist/engine/deploy/proxy-streams.js +208 -0
  386. package/dist/engine/deploy/proxy-streams.js.map +1 -0
  387. package/dist/engine/deploy/proxy.d.ts +375 -0
  388. package/dist/engine/deploy/proxy.d.ts.map +1 -0
  389. package/dist/engine/deploy/proxy.js +758 -0
  390. package/dist/engine/deploy/proxy.js.map +1 -0
  391. package/dist/engine/deploy/renewal.d.ts +54 -0
  392. package/dist/engine/deploy/renewal.d.ts.map +1 -0
  393. package/dist/engine/deploy/renewal.js +169 -0
  394. package/dist/engine/deploy/renewal.js.map +1 -0
  395. package/dist/engine/deploy/repo.d.ts +119 -0
  396. package/dist/engine/deploy/repo.d.ts.map +1 -0
  397. package/dist/engine/deploy/repo.js +282 -0
  398. package/dist/engine/deploy/repo.js.map +1 -0
  399. package/dist/engine/deploy/run-record.d.ts +28 -0
  400. package/dist/engine/deploy/run-record.d.ts.map +1 -0
  401. package/dist/engine/deploy/run-record.js +44 -0
  402. package/dist/engine/deploy/run-record.js.map +1 -0
  403. package/dist/engine/deploy/stack-ports-gate.d.ts +19 -0
  404. package/dist/engine/deploy/stack-ports-gate.d.ts.map +1 -0
  405. package/dist/engine/deploy/stack-ports-gate.js +54 -0
  406. package/dist/engine/deploy/stack-ports-gate.js.map +1 -0
  407. package/dist/engine/deploy/state.d.ts +289 -0
  408. package/dist/engine/deploy/state.d.ts.map +1 -0
  409. package/dist/engine/deploy/state.js +163 -0
  410. package/dist/engine/deploy/state.js.map +1 -0
  411. package/dist/engine/deploy/steps/app-step-context.d.ts +24 -0
  412. package/dist/engine/deploy/steps/app-step-context.d.ts.map +1 -0
  413. package/dist/engine/deploy/steps/app-step-context.js +45 -0
  414. package/dist/engine/deploy/steps/app-step-context.js.map +1 -0
  415. package/dist/engine/deploy/steps/pipeline.d.ts +46 -0
  416. package/dist/engine/deploy/steps/pipeline.d.ts.map +1 -0
  417. package/dist/engine/deploy/steps/pipeline.js +73 -0
  418. package/dist/engine/deploy/steps/pipeline.js.map +1 -0
  419. package/dist/engine/deploy/steps/plan.d.ts +28 -0
  420. package/dist/engine/deploy/steps/plan.d.ts.map +1 -0
  421. package/dist/engine/deploy/steps/plan.js +32 -0
  422. package/dist/engine/deploy/steps/plan.js.map +1 -0
  423. package/dist/engine/deploy/steps/registry.d.ts +182 -0
  424. package/dist/engine/deploy/steps/registry.d.ts.map +1 -0
  425. package/dist/engine/deploy/steps/registry.js +214 -0
  426. package/dist/engine/deploy/steps/registry.js.map +1 -0
  427. package/dist/engine/deploy/steps/step-values.d.ts +28 -0
  428. package/dist/engine/deploy/steps/step-values.d.ts.map +1 -0
  429. package/dist/engine/deploy/steps/step-values.js +33 -0
  430. package/dist/engine/deploy/steps/step-values.js.map +1 -0
  431. package/dist/engine/deploy/testing/fake-containers.d.ts +29 -0
  432. package/dist/engine/deploy/testing/fake-containers.d.ts.map +1 -0
  433. package/dist/engine/deploy/testing/fake-containers.js +32 -0
  434. package/dist/engine/deploy/testing/fake-containers.js.map +1 -0
  435. package/dist/engine/deploy/testing/fake-postgres.d.ts +88 -0
  436. package/dist/engine/deploy/testing/fake-postgres.d.ts.map +1 -0
  437. package/dist/engine/deploy/testing/fake-postgres.js +236 -0
  438. package/dist/engine/deploy/testing/fake-postgres.js.map +1 -0
  439. package/dist/engine/deploy/testing/fake-vps.d.ts +147 -0
  440. package/dist/engine/deploy/testing/fake-vps.d.ts.map +1 -0
  441. package/dist/engine/deploy/testing/fake-vps.js +371 -0
  442. package/dist/engine/deploy/testing/fake-vps.js.map +1 -0
  443. package/dist/engine/deploy/uninstall.d.ts +87 -0
  444. package/dist/engine/deploy/uninstall.d.ts.map +1 -0
  445. package/dist/engine/deploy/uninstall.js +321 -0
  446. package/dist/engine/deploy/uninstall.js.map +1 -0
  447. package/dist/engine/deploy/update.d.ts +114 -0
  448. package/dist/engine/deploy/update.d.ts.map +1 -0
  449. package/dist/engine/deploy/update.js +1385 -0
  450. package/dist/engine/deploy/update.js.map +1 -0
  451. package/dist/engine/deploy/version-step.d.ts +74 -0
  452. package/dist/engine/deploy/version-step.d.ts.map +1 -0
  453. package/dist/engine/deploy/version-step.js +177 -0
  454. package/dist/engine/deploy/version-step.js.map +1 -0
  455. package/dist/engine/device-auth.d.ts +240 -0
  456. package/dist/engine/device-auth.d.ts.map +1 -0
  457. package/dist/engine/device-auth.js +442 -0
  458. package/dist/engine/device-auth.js.map +1 -0
  459. package/dist/engine/device-login.d.ts +126 -0
  460. package/dist/engine/device-login.d.ts.map +1 -0
  461. package/dist/engine/device-login.js +164 -0
  462. package/dist/engine/device-login.js.map +1 -0
  463. package/dist/engine/errors.d.ts +314 -0
  464. package/dist/engine/errors.d.ts.map +1 -0
  465. package/dist/engine/errors.js +561 -0
  466. package/dist/engine/errors.js.map +1 -0
  467. package/dist/engine/github-raw-manifest.d.ts +59 -0
  468. package/dist/engine/github-raw-manifest.d.ts.map +1 -0
  469. package/dist/engine/github-raw-manifest.js +197 -0
  470. package/dist/engine/github-raw-manifest.js.map +1 -0
  471. package/dist/engine/identity.d.ts +169 -0
  472. package/dist/engine/identity.d.ts.map +1 -0
  473. package/dist/engine/identity.js +227 -0
  474. package/dist/engine/identity.js.map +1 -0
  475. package/dist/engine/index.d.ts +141 -0
  476. package/dist/engine/index.d.ts.map +1 -0
  477. package/dist/engine/index.js +147 -0
  478. package/dist/engine/index.js.map +1 -0
  479. package/dist/engine/init/local-profile.d.ts +93 -0
  480. package/dist/engine/init/local-profile.d.ts.map +1 -0
  481. package/dist/engine/init/local-profile.js +295 -0
  482. package/dist/engine/init/local-profile.js.map +1 -0
  483. package/dist/engine/init/run-init.d.ts +41 -0
  484. package/dist/engine/init/run-init.d.ts.map +1 -0
  485. package/dist/engine/init/run-init.js +297 -0
  486. package/dist/engine/init/run-init.js.map +1 -0
  487. package/dist/engine/node/capabilities.d.ts +433 -0
  488. package/dist/engine/node/capabilities.d.ts.map +1 -0
  489. package/dist/engine/node/capabilities.js +597 -0
  490. package/dist/engine/node/capabilities.js.map +1 -0
  491. package/dist/engine/node/daemon-channels.d.ts +66 -0
  492. package/dist/engine/node/daemon-channels.d.ts.map +1 -0
  493. package/dist/engine/node/daemon-channels.js +65 -0
  494. package/dist/engine/node/daemon-channels.js.map +1 -0
  495. package/dist/engine/node/daemon.d.ts +63 -0
  496. package/dist/engine/node/daemon.d.ts.map +1 -0
  497. package/dist/engine/node/daemon.js +279 -0
  498. package/dist/engine/node/daemon.js.map +1 -0
  499. package/dist/engine/node/doctor.d.ts +60 -0
  500. package/dist/engine/node/doctor.d.ts.map +1 -0
  501. package/dist/engine/node/doctor.js +447 -0
  502. package/dist/engine/node/doctor.js.map +1 -0
  503. package/dist/engine/node/enrollment.d.ts +98 -0
  504. package/dist/engine/node/enrollment.d.ts.map +1 -0
  505. package/dist/engine/node/enrollment.js +189 -0
  506. package/dist/engine/node/enrollment.js.map +1 -0
  507. package/dist/engine/node/env-flags.d.ts +5 -0
  508. package/dist/engine/node/env-flags.d.ts.map +1 -0
  509. package/dist/engine/node/env-flags.js +22 -0
  510. package/dist/engine/node/env-flags.js.map +1 -0
  511. package/dist/engine/node/executors/credential-hygiene.d.ts +63 -0
  512. package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -0
  513. package/dist/engine/node/executors/credential-hygiene.js +210 -0
  514. package/dist/engine/node/executors/credential-hygiene.js.map +1 -0
  515. package/dist/engine/node/executors/db-backup-run.d.ts +73 -0
  516. package/dist/engine/node/executors/db-backup-run.d.ts.map +1 -0
  517. package/dist/engine/node/executors/db-backup-run.js +362 -0
  518. package/dist/engine/node/executors/db-backup-run.js.map +1 -0
  519. package/dist/engine/node/executors/example-checksum.d.ts +30 -0
  520. package/dist/engine/node/executors/example-checksum.d.ts.map +1 -0
  521. package/dist/engine/node/executors/example-checksum.js +56 -0
  522. package/dist/engine/node/executors/example-checksum.js.map +1 -0
  523. package/dist/engine/node/executors/index.d.ts +213 -0
  524. package/dist/engine/node/executors/index.d.ts.map +1 -0
  525. package/dist/engine/node/executors/index.js +58 -0
  526. package/dist/engine/node/executors/index.js.map +1 -0
  527. package/dist/engine/node/executors/registry.d.ts +38 -0
  528. package/dist/engine/node/executors/registry.d.ts.map +1 -0
  529. package/dist/engine/node/executors/registry.js +103 -0
  530. package/dist/engine/node/executors/registry.js.map +1 -0
  531. package/dist/engine/node/heap-snapshot.d.ts +37 -0
  532. package/dist/engine/node/heap-snapshot.d.ts.map +1 -0
  533. package/dist/engine/node/heap-snapshot.js +160 -0
  534. package/dist/engine/node/heap-snapshot.js.map +1 -0
  535. package/dist/engine/node/host-telemetry.d.ts +38 -0
  536. package/dist/engine/node/host-telemetry.d.ts.map +1 -0
  537. package/dist/engine/node/host-telemetry.js +39 -0
  538. package/dist/engine/node/host-telemetry.js.map +1 -0
  539. package/dist/engine/node/host-vitals.d.ts +51 -0
  540. package/dist/engine/node/host-vitals.d.ts.map +1 -0
  541. package/dist/engine/node/host-vitals.js +117 -0
  542. package/dist/engine/node/host-vitals.js.map +1 -0
  543. package/dist/engine/node/install-deps.d.ts +231 -0
  544. package/dist/engine/node/install-deps.d.ts.map +1 -0
  545. package/dist/engine/node/install-deps.js +392 -0
  546. package/dist/engine/node/install-deps.js.map +1 -0
  547. package/dist/engine/node/ipc-protocol.d.ts +114 -0
  548. package/dist/engine/node/ipc-protocol.d.ts.map +1 -0
  549. package/dist/engine/node/ipc-protocol.js +122 -0
  550. package/dist/engine/node/ipc-protocol.js.map +1 -0
  551. package/dist/engine/node/lifecycle.d.ts +103 -0
  552. package/dist/engine/node/lifecycle.d.ts.map +1 -0
  553. package/dist/engine/node/lifecycle.js +260 -0
  554. package/dist/engine/node/lifecycle.js.map +1 -0
  555. package/dist/engine/node/logger.d.ts +95 -0
  556. package/dist/engine/node/logger.d.ts.map +1 -0
  557. package/dist/engine/node/logger.js +241 -0
  558. package/dist/engine/node/logger.js.map +1 -0
  559. package/dist/engine/node/memory-watchdog.d.ts +89 -0
  560. package/dist/engine/node/memory-watchdog.d.ts.map +1 -0
  561. package/dist/engine/node/memory-watchdog.js +248 -0
  562. package/dist/engine/node/memory-watchdog.js.map +1 -0
  563. package/dist/engine/node/models.d.ts +195 -0
  564. package/dist/engine/node/models.d.ts.map +1 -0
  565. package/dist/engine/node/models.js +379 -0
  566. package/dist/engine/node/models.js.map +1 -0
  567. package/dist/engine/node/node-api.d.ts +439 -0
  568. package/dist/engine/node/node-api.d.ts.map +1 -0
  569. package/dist/engine/node/node-api.js +125 -0
  570. package/dist/engine/node/node-api.js.map +1 -0
  571. package/dist/engine/node/node-config.d.ts +128 -0
  572. package/dist/engine/node/node-config.d.ts.map +1 -0
  573. package/dist/engine/node/node-config.js +237 -0
  574. package/dist/engine/node/node-config.js.map +1 -0
  575. package/dist/engine/node/node-dashboard-source.d.ts +83 -0
  576. package/dist/engine/node/node-dashboard-source.d.ts.map +1 -0
  577. package/dist/engine/node/node-dashboard-source.js +181 -0
  578. package/dist/engine/node/node-dashboard-source.js.map +1 -0
  579. package/dist/engine/node/node-engine.d.ts +282 -0
  580. package/dist/engine/node/node-engine.d.ts.map +1 -0
  581. package/dist/engine/node/node-engine.js +925 -0
  582. package/dist/engine/node/node-engine.js.map +1 -0
  583. package/dist/engine/node/node-errors.d.ts +54 -0
  584. package/dist/engine/node/node-errors.d.ts.map +1 -0
  585. package/dist/engine/node/node-errors.js +71 -0
  586. package/dist/engine/node/node-errors.js.map +1 -0
  587. package/dist/engine/node/node-events-queue.d.ts +27 -0
  588. package/dist/engine/node/node-events-queue.d.ts.map +1 -0
  589. package/dist/engine/node/node-events-queue.js +46 -0
  590. package/dist/engine/node/node-events-queue.js.map +1 -0
  591. package/dist/engine/node/node-events.d.ts +132 -0
  592. package/dist/engine/node/node-events.d.ts.map +1 -0
  593. package/dist/engine/node/node-events.js +2 -0
  594. package/dist/engine/node/node-events.js.map +1 -0
  595. package/dist/engine/node/node-vitals.d.ts +123 -0
  596. package/dist/engine/node/node-vitals.d.ts.map +1 -0
  597. package/dist/engine/node/node-vitals.js +266 -0
  598. package/dist/engine/node/node-vitals.js.map +1 -0
  599. package/dist/engine/node/paths.d.ts +39 -0
  600. package/dist/engine/node/paths.d.ts.map +1 -0
  601. package/dist/engine/node/paths.js +60 -0
  602. package/dist/engine/node/paths.js.map +1 -0
  603. package/dist/engine/node/pg-dump.d.ts +126 -0
  604. package/dist/engine/node/pg-dump.d.ts.map +1 -0
  605. package/dist/engine/node/pg-dump.js +223 -0
  606. package/dist/engine/node/pg-dump.js.map +1 -0
  607. package/dist/engine/node/pidfile.d.ts +38 -0
  608. package/dist/engine/node/pidfile.d.ts.map +1 -0
  609. package/dist/engine/node/pidfile.js +156 -0
  610. package/dist/engine/node/pidfile.js.map +1 -0
  611. package/dist/engine/node/power-probe.d.ts +59 -0
  612. package/dist/engine/node/power-probe.d.ts.map +1 -0
  613. package/dist/engine/node/power-probe.js +240 -0
  614. package/dist/engine/node/power-probe.js.map +1 -0
  615. package/dist/engine/node/power-watcher.d.ts +30 -0
  616. package/dist/engine/node/power-watcher.d.ts.map +1 -0
  617. package/dist/engine/node/power-watcher.js +116 -0
  618. package/dist/engine/node/power-watcher.js.map +1 -0
  619. package/dist/engine/node/runtime-state.d.ts +24 -0
  620. package/dist/engine/node/runtime-state.d.ts.map +1 -0
  621. package/dist/engine/node/runtime-state.js +19 -0
  622. package/dist/engine/node/runtime-state.js.map +1 -0
  623. package/dist/engine/node/runtime-tuning.d.ts +174 -0
  624. package/dist/engine/node/runtime-tuning.d.ts.map +1 -0
  625. package/dist/engine/node/runtime-tuning.js +327 -0
  626. package/dist/engine/node/runtime-tuning.js.map +1 -0
  627. package/dist/engine/node/service.d.ts +39 -0
  628. package/dist/engine/node/service.d.ts.map +1 -0
  629. package/dist/engine/node/service.js +215 -0
  630. package/dist/engine/node/service.js.map +1 -0
  631. package/dist/engine/node/start.d.ts +69 -0
  632. package/dist/engine/node/start.d.ts.map +1 -0
  633. package/dist/engine/node/start.js +325 -0
  634. package/dist/engine/node/start.js.map +1 -0
  635. package/dist/engine/node/worker-env-aliases.d.ts +39 -0
  636. package/dist/engine/node/worker-env-aliases.d.ts.map +1 -0
  637. package/dist/engine/node/worker-env-aliases.js +126 -0
  638. package/dist/engine/node/worker-env-aliases.js.map +1 -0
  639. package/dist/engine/node/worker-env-table.d.ts +15 -0
  640. package/dist/engine/node/worker-env-table.d.ts.map +1 -0
  641. package/dist/engine/node/worker-env-table.js +100 -0
  642. package/dist/engine/node/worker-env-table.js.map +1 -0
  643. package/dist/engine/node/worker-env.d.ts +67 -0
  644. package/dist/engine/node/worker-env.d.ts.map +1 -0
  645. package/dist/engine/node/worker-env.js +114 -0
  646. package/dist/engine/node/worker-env.js.map +1 -0
  647. package/dist/engine/output.d.ts +97 -0
  648. package/dist/engine/output.d.ts.map +1 -0
  649. package/dist/engine/output.js +274 -0
  650. package/dist/engine/output.js.map +1 -0
  651. package/dist/engine/package-info.d.ts +7 -0
  652. package/dist/engine/package-info.d.ts.map +1 -0
  653. package/dist/engine/package-info.js +38 -0
  654. package/dist/engine/package-info.js.map +1 -0
  655. package/dist/engine/program.d.ts +53 -0
  656. package/dist/engine/program.d.ts.map +1 -0
  657. package/dist/engine/program.js +213 -0
  658. package/dist/engine/program.js.map +1 -0
  659. package/dist/engine/prompt.d.ts +69 -0
  660. package/dist/engine/prompt.d.ts.map +1 -0
  661. package/dist/engine/prompt.js +205 -0
  662. package/dist/engine/prompt.js.map +1 -0
  663. package/dist/engine/registries.d.ts +5 -0
  664. package/dist/engine/registries.d.ts.map +1 -0
  665. package/dist/engine/registries.js +68 -0
  666. package/dist/engine/registries.js.map +1 -0
  667. package/dist/engine/request-body.d.ts +31 -0
  668. package/dist/engine/request-body.d.ts.map +1 -0
  669. package/dist/engine/request-body.js +156 -0
  670. package/dist/engine/request-body.js.map +1 -0
  671. package/dist/engine/semver.d.ts +31 -0
  672. package/dist/engine/semver.d.ts.map +1 -0
  673. package/dist/engine/semver.js +100 -0
  674. package/dist/engine/semver.js.map +1 -0
  675. package/dist/engine/test-support.d.ts +50 -0
  676. package/dist/engine/test-support.d.ts.map +1 -0
  677. package/dist/engine/test-support.js +86 -0
  678. package/dist/engine/test-support.js.map +1 -0
  679. package/dist/engine/tui/app-registry.d.ts +103 -0
  680. package/dist/engine/tui/app-registry.d.ts.map +1 -0
  681. package/dist/engine/tui/app-registry.js +103 -0
  682. package/dist/engine/tui/app-registry.js.map +1 -0
  683. package/dist/engine/tui/app.d.ts +11 -0
  684. package/dist/engine/tui/app.d.ts.map +1 -0
  685. package/dist/engine/tui/app.js +134 -0
  686. package/dist/engine/tui/app.js.map +1 -0
  687. package/dist/engine/tui/builtin-screens.d.ts +11 -0
  688. package/dist/engine/tui/builtin-screens.d.ts.map +1 -0
  689. package/dist/engine/tui/builtin-screens.js +69 -0
  690. package/dist/engine/tui/builtin-screens.js.map +1 -0
  691. package/dist/engine/tui/conformance.d.ts +149 -0
  692. package/dist/engine/tui/conformance.d.ts.map +1 -0
  693. package/dist/engine/tui/conformance.js +428 -0
  694. package/dist/engine/tui/conformance.js.map +1 -0
  695. package/dist/engine/tui/context.d.ts +220 -0
  696. package/dist/engine/tui/context.d.ts.map +1 -0
  697. package/dist/engine/tui/context.js +258 -0
  698. package/dist/engine/tui/context.js.map +1 -0
  699. package/dist/engine/tui/dashboard/index.d.ts +8 -0
  700. package/dist/engine/tui/dashboard/index.d.ts.map +1 -0
  701. package/dist/engine/tui/dashboard/index.js +5 -0
  702. package/dist/engine/tui/dashboard/index.js.map +1 -0
  703. package/dist/engine/tui/dashboard/jobs-insights.d.ts +145 -0
  704. package/dist/engine/tui/dashboard/jobs-insights.d.ts.map +1 -0
  705. package/dist/engine/tui/dashboard/jobs-insights.js +63 -0
  706. package/dist/engine/tui/dashboard/jobs-insights.js.map +1 -0
  707. package/dist/engine/tui/dashboard/node-embedded.d.ts +33 -0
  708. package/dist/engine/tui/dashboard/node-embedded.d.ts.map +1 -0
  709. package/dist/engine/tui/dashboard/node-embedded.js +81 -0
  710. package/dist/engine/tui/dashboard/node-embedded.js.map +1 -0
  711. package/dist/engine/tui/dashboard/source.d.ts +294 -0
  712. package/dist/engine/tui/dashboard/source.d.ts.map +1 -0
  713. package/dist/engine/tui/dashboard/source.js +397 -0
  714. package/dist/engine/tui/dashboard/source.js.map +1 -0
  715. package/dist/engine/tui/dashboard/use-dashboard.d.ts +23 -0
  716. package/dist/engine/tui/dashboard/use-dashboard.d.ts.map +1 -0
  717. package/dist/engine/tui/dashboard/use-dashboard.js +32 -0
  718. package/dist/engine/tui/dashboard/use-dashboard.js.map +1 -0
  719. package/dist/engine/tui/index.d.ts +25 -0
  720. package/dist/engine/tui/index.d.ts.map +1 -0
  721. package/dist/engine/tui/index.js +89 -0
  722. package/dist/engine/tui/index.js.map +1 -0
  723. package/dist/engine/tui/layout.d.ts +152 -0
  724. package/dist/engine/tui/layout.d.ts.map +1 -0
  725. package/dist/engine/tui/layout.js +214 -0
  726. package/dist/engine/tui/layout.js.map +1 -0
  727. package/dist/engine/tui/menu-registry.d.ts +201 -0
  728. package/dist/engine/tui/menu-registry.d.ts.map +1 -0
  729. package/dist/engine/tui/menu-registry.js +205 -0
  730. package/dist/engine/tui/menu-registry.js.map +1 -0
  731. package/dist/engine/tui/menu-tree.d.ts +198 -0
  732. package/dist/engine/tui/menu-tree.d.ts.map +1 -0
  733. package/dist/engine/tui/menu-tree.js +276 -0
  734. package/dist/engine/tui/menu-tree.js.map +1 -0
  735. package/dist/engine/tui/raw-mode.d.ts +54 -0
  736. package/dist/engine/tui/raw-mode.d.ts.map +1 -0
  737. package/dist/engine/tui/raw-mode.js +106 -0
  738. package/dist/engine/tui/raw-mode.js.map +1 -0
  739. package/dist/engine/tui/routes.d.ts +5 -0
  740. package/dist/engine/tui/routes.d.ts.map +1 -0
  741. package/dist/engine/tui/routes.js +16 -0
  742. package/dist/engine/tui/routes.js.map +1 -0
  743. package/dist/engine/tui/screen-registry.d.ts +170 -0
  744. package/dist/engine/tui/screen-registry.d.ts.map +1 -0
  745. package/dist/engine/tui/screen-registry.js +180 -0
  746. package/dist/engine/tui/screen-registry.js.map +1 -0
  747. package/dist/engine/tui/screen-sections.d.ts +9 -0
  748. package/dist/engine/tui/screen-sections.d.ts.map +1 -0
  749. package/dist/engine/tui/screen-sections.js +45 -0
  750. package/dist/engine/tui/screen-sections.js.map +1 -0
  751. package/dist/engine/tui/screens/deploy/advanced-model.d.ts +69 -0
  752. package/dist/engine/tui/screens/deploy/advanced-model.d.ts.map +1 -0
  753. package/dist/engine/tui/screens/deploy/advanced-model.js +228 -0
  754. package/dist/engine/tui/screens/deploy/advanced-model.js.map +1 -0
  755. package/dist/engine/tui/screens/deploy/doctor-model.d.ts +37 -0
  756. package/dist/engine/tui/screens/deploy/doctor-model.d.ts.map +1 -0
  757. package/dist/engine/tui/screens/deploy/doctor-model.js +89 -0
  758. package/dist/engine/tui/screens/deploy/doctor-model.js.map +1 -0
  759. package/dist/engine/tui/screens/deploy/doctor.d.ts +8 -0
  760. package/dist/engine/tui/screens/deploy/doctor.d.ts.map +1 -0
  761. package/dist/engine/tui/screens/deploy/doctor.js +163 -0
  762. package/dist/engine/tui/screens/deploy/doctor.js.map +1 -0
  763. package/dist/engine/tui/screens/deploy/fields.d.ts +123 -0
  764. package/dist/engine/tui/screens/deploy/fields.d.ts.map +1 -0
  765. package/dist/engine/tui/screens/deploy/fields.js +202 -0
  766. package/dist/engine/tui/screens/deploy/fields.js.map +1 -0
  767. package/dist/engine/tui/screens/deploy/flags-model.d.ts +67 -0
  768. package/dist/engine/tui/screens/deploy/flags-model.d.ts.map +1 -0
  769. package/dist/engine/tui/screens/deploy/flags-model.js +302 -0
  770. package/dist/engine/tui/screens/deploy/flags-model.js.map +1 -0
  771. package/dist/engine/tui/screens/deploy/index.d.ts +6 -0
  772. package/dist/engine/tui/screens/deploy/index.d.ts.map +1 -0
  773. package/dist/engine/tui/screens/deploy/index.js +83 -0
  774. package/dist/engine/tui/screens/deploy/index.js.map +1 -0
  775. package/dist/engine/tui/screens/deploy/install-model.d.ts +159 -0
  776. package/dist/engine/tui/screens/deploy/install-model.d.ts.map +1 -0
  777. package/dist/engine/tui/screens/deploy/install-model.js +319 -0
  778. package/dist/engine/tui/screens/deploy/install-model.js.map +1 -0
  779. package/dist/engine/tui/screens/deploy/install.d.ts +8 -0
  780. package/dist/engine/tui/screens/deploy/install.d.ts.map +1 -0
  781. package/dist/engine/tui/screens/deploy/install.js +365 -0
  782. package/dist/engine/tui/screens/deploy/install.js.map +1 -0
  783. package/dist/engine/tui/screens/deploy/model.d.ts +49 -0
  784. package/dist/engine/tui/screens/deploy/model.d.ts.map +1 -0
  785. package/dist/engine/tui/screens/deploy/model.js +59 -0
  786. package/dist/engine/tui/screens/deploy/model.js.map +1 -0
  787. package/dist/engine/tui/screens/deploy/run-model.d.ts +58 -0
  788. package/dist/engine/tui/screens/deploy/run-model.d.ts.map +1 -0
  789. package/dist/engine/tui/screens/deploy/run-model.js +117 -0
  790. package/dist/engine/tui/screens/deploy/run-model.js.map +1 -0
  791. package/dist/engine/tui/screens/deploy/run.d.ts +75 -0
  792. package/dist/engine/tui/screens/deploy/run.d.ts.map +1 -0
  793. package/dist/engine/tui/screens/deploy/run.js +201 -0
  794. package/dist/engine/tui/screens/deploy/run.js.map +1 -0
  795. package/dist/engine/tui/screens/deploy/status.d.ts +17 -0
  796. package/dist/engine/tui/screens/deploy/status.d.ts.map +1 -0
  797. package/dist/engine/tui/screens/deploy/status.js +107 -0
  798. package/dist/engine/tui/screens/deploy/status.js.map +1 -0
  799. package/dist/engine/tui/screens/deploy/update.d.ts +41 -0
  800. package/dist/engine/tui/screens/deploy/update.d.ts.map +1 -0
  801. package/dist/engine/tui/screens/deploy/update.js +175 -0
  802. package/dist/engine/tui/screens/deploy/update.js.map +1 -0
  803. package/dist/engine/tui/screens/deploy.d.ts +12 -0
  804. package/dist/engine/tui/screens/deploy.d.ts.map +1 -0
  805. package/dist/engine/tui/screens/deploy.js +23 -0
  806. package/dist/engine/tui/screens/deploy.js.map +1 -0
  807. package/dist/engine/tui/screens/invoke.d.ts +6 -0
  808. package/dist/engine/tui/screens/invoke.d.ts.map +1 -0
  809. package/dist/engine/tui/screens/invoke.js +196 -0
  810. package/dist/engine/tui/screens/invoke.js.map +1 -0
  811. package/dist/engine/tui/screens/jobs.d.ts +12 -0
  812. package/dist/engine/tui/screens/jobs.d.ts.map +1 -0
  813. package/dist/engine/tui/screens/jobs.js +72 -0
  814. package/dist/engine/tui/screens/jobs.js.map +1 -0
  815. package/dist/engine/tui/screens/login.d.ts +6 -0
  816. package/dist/engine/tui/screens/login.d.ts.map +1 -0
  817. package/dist/engine/tui/screens/login.js +263 -0
  818. package/dist/engine/tui/screens/login.js.map +1 -0
  819. package/dist/engine/tui/screens/logout.d.ts +6 -0
  820. package/dist/engine/tui/screens/logout.d.ts.map +1 -0
  821. package/dist/engine/tui/screens/logout.js +149 -0
  822. package/dist/engine/tui/screens/logout.js.map +1 -0
  823. package/dist/engine/tui/screens/menu.d.ts +25 -0
  824. package/dist/engine/tui/screens/menu.d.ts.map +1 -0
  825. package/dist/engine/tui/screens/menu.js +124 -0
  826. package/dist/engine/tui/screens/menu.js.map +1 -0
  827. package/dist/engine/tui/screens/node.d.ts +6 -0
  828. package/dist/engine/tui/screens/node.d.ts.map +1 -0
  829. package/dist/engine/tui/screens/node.js +277 -0
  830. package/dist/engine/tui/screens/node.js.map +1 -0
  831. package/dist/engine/tui/screens/not-logged-in.d.ts +12 -0
  832. package/dist/engine/tui/screens/not-logged-in.d.ts.map +1 -0
  833. package/dist/engine/tui/screens/not-logged-in.js +14 -0
  834. package/dist/engine/tui/screens/not-logged-in.js.map +1 -0
  835. package/dist/engine/tui/screens/status.d.ts +6 -0
  836. package/dist/engine/tui/screens/status.d.ts.map +1 -0
  837. package/dist/engine/tui/screens/status.js +138 -0
  838. package/dist/engine/tui/screens/status.js.map +1 -0
  839. package/dist/engine/tui/scroll-box.d.ts +42 -0
  840. package/dist/engine/tui/scroll-box.d.ts.map +1 -0
  841. package/dist/engine/tui/scroll-box.js +62 -0
  842. package/dist/engine/tui/scroll-box.js.map +1 -0
  843. package/dist/engine/tui/section-registry.d.ts +65 -0
  844. package/dist/engine/tui/section-registry.d.ts.map +1 -0
  845. package/dist/engine/tui/section-registry.js +90 -0
  846. package/dist/engine/tui/section-registry.js.map +1 -0
  847. package/dist/engine/tui/terminal.d.ts +31 -0
  848. package/dist/engine/tui/terminal.d.ts.map +1 -0
  849. package/dist/engine/tui/terminal.js +142 -0
  850. package/dist/engine/tui/terminal.js.map +1 -0
  851. package/dist/engine/tui/testing/feeds.d.ts +58 -0
  852. package/dist/engine/tui/testing/feeds.d.ts.map +1 -0
  853. package/dist/engine/tui/testing/feeds.js +67 -0
  854. package/dist/engine/tui/testing/feeds.js.map +1 -0
  855. package/dist/engine/tui/testing/harness.d.ts +243 -0
  856. package/dist/engine/tui/testing/harness.d.ts.map +1 -0
  857. package/dist/engine/tui/testing/harness.js +332 -0
  858. package/dist/engine/tui/testing/harness.js.map +1 -0
  859. package/dist/engine/tui/theme.d.ts +179 -0
  860. package/dist/engine/tui/theme.d.ts.map +1 -0
  861. package/dist/engine/tui/theme.js +111 -0
  862. package/dist/engine/tui/theme.js.map +1 -0
  863. package/dist/engine/tui/tty.d.ts +56 -0
  864. package/dist/engine/tui/tty.d.ts.map +1 -0
  865. package/dist/engine/tui/tty.js +146 -0
  866. package/dist/engine/tui/tty.js.map +1 -0
  867. package/dist/engine/tui/ui/active-items.d.ts +40 -0
  868. package/dist/engine/tui/ui/active-items.d.ts.map +1 -0
  869. package/dist/engine/tui/ui/active-items.js +38 -0
  870. package/dist/engine/tui/ui/active-items.js.map +1 -0
  871. package/dist/engine/tui/ui/event-log.d.ts +58 -0
  872. package/dist/engine/tui/ui/event-log.d.ts.map +1 -0
  873. package/dist/engine/tui/ui/event-log.js +32 -0
  874. package/dist/engine/tui/ui/event-log.js.map +1 -0
  875. package/dist/engine/tui/ui/index.d.ts +20 -0
  876. package/dist/engine/tui/ui/index.d.ts.map +1 -0
  877. package/dist/engine/tui/ui/index.js +14 -0
  878. package/dist/engine/tui/ui/index.js.map +1 -0
  879. package/dist/engine/tui/ui/meter-legend.d.ts +26 -0
  880. package/dist/engine/tui/ui/meter-legend.d.ts.map +1 -0
  881. package/dist/engine/tui/ui/meter-legend.js +25 -0
  882. package/dist/engine/tui/ui/meter-legend.js.map +1 -0
  883. package/dist/engine/tui/ui/run-summary.d.ts +58 -0
  884. package/dist/engine/tui/ui/run-summary.d.ts.map +1 -0
  885. package/dist/engine/tui/ui/run-summary.js +29 -0
  886. package/dist/engine/tui/ui/run-summary.js.map +1 -0
  887. package/dist/engine/tui/ui/segment-meter.d.ts +72 -0
  888. package/dist/engine/tui/ui/segment-meter.d.ts.map +1 -0
  889. package/dist/engine/tui/ui/segment-meter.js +128 -0
  890. package/dist/engine/tui/ui/segment-meter.js.map +1 -0
  891. package/dist/engine/tui/ui/status-line.d.ts +42 -0
  892. package/dist/engine/tui/ui/status-line.d.ts.map +1 -0
  893. package/dist/engine/tui/ui/status-line.js +35 -0
  894. package/dist/engine/tui/ui/status-line.js.map +1 -0
  895. package/dist/engine/tui/ui/tone.d.ts +46 -0
  896. package/dist/engine/tui/ui/tone.d.ts.map +1 -0
  897. package/dist/engine/tui/ui/tone.js +48 -0
  898. package/dist/engine/tui/ui/tone.js.map +1 -0
  899. package/dist/engine/update-notice-options.d.ts +70 -0
  900. package/dist/engine/update-notice-options.d.ts.map +1 -0
  901. package/dist/engine/update-notice-options.js +79 -0
  902. package/dist/engine/update-notice-options.js.map +1 -0
  903. package/dist/engine/update-notice.d.ts +69 -0
  904. package/dist/engine/update-notice.d.ts.map +1 -0
  905. package/dist/engine/update-notice.js +204 -0
  906. package/dist/engine/update-notice.js.map +1 -0
  907. package/dist/index.d.ts +4 -5
  908. package/dist/index.d.ts.map +1 -1
  909. package/dist/index.js +5 -5
  910. package/dist/index.js.map +1 -1
  911. package/dist/node/index.d.ts +3 -0
  912. package/dist/node/index.d.ts.map +1 -0
  913. package/dist/node/index.js +5 -0
  914. package/dist/node/index.js.map +1 -0
  915. package/dist/telemetry/index.d.ts +2 -1
  916. package/dist/telemetry/index.d.ts.map +1 -1
  917. package/dist/telemetry/index.js +1 -0
  918. package/dist/telemetry/index.js.map +1 -1
  919. package/dist/telemetry/node-span-relay.d.ts +1 -1
  920. package/dist/telemetry/node-span-relay.d.ts.map +1 -1
  921. package/dist/telemetry/node-span-relay.js +39 -6
  922. package/dist/telemetry/node-span-relay.js.map +1 -1
  923. package/dist/telemetry/node-span.d.ts +39 -7
  924. package/dist/telemetry/node-span.d.ts.map +1 -1
  925. package/dist/telemetry/node-span.js +19 -1
  926. package/dist/telemetry/node-span.js.map +1 -1
  927. package/dist/testing/index.d.ts +3 -0
  928. package/dist/testing/index.d.ts.map +1 -0
  929. package/dist/testing/index.js +4 -0
  930. package/dist/testing/index.js.map +1 -0
  931. package/dist/tui/index.d.ts +3 -0
  932. package/dist/tui/index.d.ts.map +1 -0
  933. package/dist/tui/index.js +7 -0
  934. package/dist/tui/index.js.map +1 -0
  935. package/dist/tui/testing/index.d.ts +5 -0
  936. package/dist/tui/testing/index.d.ts.map +1 -0
  937. package/dist/tui/testing/index.js +12 -0
  938. package/dist/tui/testing/index.js.map +1 -0
  939. package/dist/tui/ui/index.d.ts +2 -0
  940. package/dist/tui/ui/index.d.ts.map +1 -0
  941. package/dist/tui/ui/index.js +10 -0
  942. package/dist/tui/ui/index.js.map +1 -0
  943. package/package.json +56 -5
@@ -0,0 +1,1385 @@
1
+ import { existsSync, mkdirSync, readFileSync } from 'node:fs';
2
+ import { basename, join } from 'node:path';
3
+ import { cliName, cliVersion } from '../identity.js';
4
+ import { PreconditionError, UsageError } from '../errors.js';
5
+ import { allChecks, listRegisteredDeployChecks, SOURCE_CHECK_IDS, checksPassed, databaseSettings, gitCredentialStateFor, readRoleAttributes, runChecks, runPsql, severityOf, } from './checks/index.js';
6
+ import { diffEnv, parseEnvExample, parseEnvFile } from './env-spec.js';
7
+ import { genuinelyNewKeys } from './env-absence.js';
8
+ import { effectiveGroups } from './compose-files.js';
9
+ import { adoptDeployment } from './adopt.js';
10
+ import { describeEvidence } from './deployment-evidence.js';
11
+ import { readEnvFile, writeEnvContents, writeEnvFile } from './env-file.js';
12
+ import { generateValue, metadataFor, needsAutoGenerate, } from './env-metadata.js';
13
+ import { runEnvWizard } from './env-wizard.js';
14
+ import { runCommand as defaultRunCommand } from './executor.js';
15
+ import { reconcileEdgeConfig, parseSha256sum, edgeConfigFiles } from './edge-config.js';
16
+ import { ensureApplicationRole, resolveAdminLogin, roleOptionsFrom, superuserAllowedFor, superuserConsequence, superuserRecord, } from './app-role.js';
17
+ import { ensureDatabase } from './database.js';
18
+ import { collectHealth, isHealthy, waitForHealthy } from './health.js';
19
+ import { openJournal } from './journal.js';
20
+ import { certificateStatus, describeProxyRuntime, installVhost, issueCertificate, resolveRecordedProxyRuntime, } from './proxy.js';
21
+ import { checkoutHead, ensureCheckout, isAlreadyDeployed, normaliseRepoUrl, resolveRepoTarget, } from './repo.js';
22
+ import { explainComposeFailure } from './compose-hints.js';
23
+ import { reconcileComposeProject } from './compose-project.js';
24
+ import { listComposeContainers } from './compose-containers.js';
25
+ import { foreignContainers, planPortValues, readComposeFileTexts } from './free-ports.js';
26
+ import { NotInstalledError, appendHistory, readState, writeState, } from './state.js';
27
+ import { assertStackPortsFree, STACK_PORTS_STEP_ID } from './stack-ports-gate.js';
28
+ import { runPipeline } from './steps/pipeline.js';
29
+ import { appStepContext } from './steps/app-step-context.js';
30
+ import { withRegisteredSteps } from './steps/registry.js';
31
+ import { checkoutPathFor, publishVersion, runVersionStep, stampAppVersion, } from './version-step.js';
32
+ import { writeDeployInfo } from './deploy-info.js';
33
+ import { collectHostFacts } from './host-facts.js';
34
+ import { observeProxy, proxyInfoOf } from './run-record.js';
35
+ import { composeArgv, composeCwd, composeProjectFor, consentOptions, ensureStackNetworks, oauthSmokeTarget, reportOAuthSmoke, scheduleRenewal, secretsFrom, } from './install.js';
36
+ /**
37
+ * The groups this run acts under: the flag, else what install recorded --
38
+ * NEVER read from the `.env`, for the reason `state.groups` gives -- plus the
39
+ * always-on ones (`effectiveGroups`, #567). They decide both which new keys
40
+ * count as drift and which compose files make up the stack (compose-files.ts).
41
+ *
42
+ * The always-on union is what upgrades a deployment recorded without
43
+ * `observability`: its GREPTIME_* / OTEL_* keys become drift and its compose
44
+ * file list gains the telemetry files, on this update.
45
+ */
46
+ function groupsOf(context) {
47
+ return effectiveGroups(context.options.groups ?? context.state.groups);
48
+ }
49
+ /** Collected ONCE per run and reused; see install.ts's `hostFactsOf`. */
50
+ async function hostFactsOf(context) {
51
+ context.hostFacts ??= await collectHostFacts({ runCommand: context.runCommand });
52
+ return context.hostFacts;
53
+ }
54
+ /** The proxy mode/container this run knows: resolved now, else as recorded. */
55
+ function currentRuntime(context) {
56
+ return context.proxyRuntime === undefined
57
+ ? { mode: context.state.proxyMode, container: context.state.proxyContainer }
58
+ : { mode: context.proxyRuntime.mode, container: context.proxyRuntime.container };
59
+ }
60
+ /**
61
+ * The info.json input for this run, as known at `at`. One builder for the
62
+ * health-gate write and the end-of-run rewrite; see install.ts's
63
+ * `installDeployInfo` for why.
64
+ */
65
+ function updateDeployInfo(context, at) {
66
+ const state = context.state;
67
+ const ref = context.target?.ref ?? state.ref;
68
+ const runtime = currentRuntime(context);
69
+ return {
70
+ name: basename(context.options.deployRoot),
71
+ ...(context.version?.version === undefined ? {} : { version: context.version.version }),
72
+ ...(context.commitSha === undefined ? {} : { commitSha: context.commitSha }),
73
+ ...(ref === undefined ? {} : { ref }),
74
+ installedAt: state.installedAt,
75
+ updatedAt: at,
76
+ cliVersion: cliVersion(),
77
+ ...(state.domain === undefined ? {} : { domain: state.domain }),
78
+ // What THIS run has finished so far -- not the resume set, which is what
79
+ // a PREVIOUS run finished.
80
+ completed: [...(context.progress ?? [])],
81
+ lastCommand: 'update',
82
+ bindPort: state.bindPort,
83
+ proxy: proxyInfoOf(state.domain === undefined
84
+ ? undefined
85
+ : {
86
+ domain: state.domain,
87
+ bindPort: state.bindPort,
88
+ mode: runtime.mode ?? null,
89
+ container: runtime.container ?? null,
90
+ // Until the end-of-run rewrite, what the last successful run read.
91
+ certificateExpiresAt: state.proxy?.domain === state.domain ? state.proxy.certificateExpiresAt : null,
92
+ }),
93
+ ...(context.hostFacts === undefined ? {} : { host: context.hostFacts }),
94
+ // Success-only: THIS run is not in it until it has succeeded.
95
+ history: state.history ?? [],
96
+ };
97
+ }
98
+ /** Certificates are renewed within this window, not on every deploy. */
99
+ function envFilePath(deployRoot) {
100
+ return join(composeCwd(deployRoot), '.env');
101
+ }
102
+ /** The environment this update acts on: the drift step's, else the file on disk (a resumed run). */
103
+ function environmentOfUpdate(context) {
104
+ if (context.env !== undefined)
105
+ return context.env;
106
+ const path = envFilePath(context.options.deployRoot);
107
+ return existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
108
+ }
109
+ /**
110
+ * Free host ports for the published-port keys an update is ADDING to `.env`
111
+ * (#1027), as a map of key to value; empty when none applies.
112
+ *
113
+ * Only `added` keys are candidates, so a value already in the file is never
114
+ * moved, and an `--answers` value counts as one. Docker is asked only when a
115
+ * candidate exists; when it cannot be asked the search is probe-only.
116
+ */
117
+ async function freePortsForNewKeys(context, specs, added, current) {
118
+ const picked = new Map();
119
+ if (added.length === 0)
120
+ return picked;
121
+ const files = readComposeFileTexts(context.options.deployRoot, groupsOf(context));
122
+ const decisions = await planPortValues({
123
+ files,
124
+ eligible: new Set(added.map((spec) => spec.key)),
125
+ given: new Map([...current, ...(context.options.answers ?? [])]),
126
+ defaults: new Map(specs.map((spec) => [spec.key, spec.defaultValue])),
127
+ taken: [context.state.bindPort],
128
+ containers: foreignContainers(await listComposeContainers(context.runCommand), composeProjectFor(context.state)),
129
+ probe: context.options.portFree,
130
+ });
131
+ for (const decision of decisions) {
132
+ picked.set(decision.variable, String(decision.port));
133
+ if (decision.message !== undefined) {
134
+ context.journal.line(`Picked a free host port: ${decision.message}`);
135
+ context.hooks?.onProgress?.(`Picked a free host port: ${decision.message}`);
136
+ }
137
+ }
138
+ return picked;
139
+ }
140
+ async function compose(context, extra, options) {
141
+ // See `ensureBindSources` in install.ts: Docker creates a missing bind
142
+ // source as root:root the moment it instantiates the service, and `compose
143
+ // run` does that as thoroughly as `up`.
144
+ mkdirSync(join(context.options.deployRoot, 'deploy-info'), { recursive: true });
145
+ // A network deleted since install (a `docker network prune`) fails `up`
146
+ // with a message about compose, not about the network. See install.ts.
147
+ await ensureStackNetworks(context, extra, groupsOf(context));
148
+ const argv = composeArgv(extra, composeProjectFor(context.state), groupsOf(context), composeCwd(context.options.deployRoot));
149
+ let result;
150
+ try {
151
+ result = await context.runCommand(argv, {
152
+ cwd: composeCwd(context.options.deployRoot),
153
+ timeoutMs: options?.timeoutMs ?? 30 * 60_000,
154
+ ...(options?.allowExitCodes === undefined ? {} : { allowExitCodes: options.allowExitCodes }),
155
+ redact: context.journal.redact,
156
+ ...(context.hooks?.onLog === undefined
157
+ ? {}
158
+ : { onLine: (line) => context.hooks?.onLog?.(line) }),
159
+ });
160
+ }
161
+ catch (error) {
162
+ // A compose "required variable ... is missing a value" says nothing about
163
+ // WHY; see compose-hints.ts. The compose output is kept above the hint.
164
+ throw explainComposeFailure(error, envFilePath(context.options.deployRoot));
165
+ }
166
+ context.journal.command(result);
167
+ return result;
168
+ }
169
+ /**
170
+ * Recreates the app's nginx, and only it.
171
+ *
172
+ * `--force-recreate` because nothing in the compose MODEL changes when a
173
+ * bind-mounted file's content does, so a plain `up -d` leaves the container
174
+ * alone; `--no-deps` so api and web are not recreated along with it.
175
+ */
176
+ const RECREATE_NGINX = ['up', '-d', '--no-deps', '--force-recreate', 'nginx'];
177
+ /**
178
+ * Recreates the api container, and only it: `--no-deps` so nginx/web are not
179
+ * recreated along with it, and `--force-recreate` because nothing in the
180
+ * compose MODEL changes when `.env`'s content does, so a plain `up -d` would
181
+ * leave the container alone. Used to force a maintenance-mode toggle into
182
+ * effect immediately -- see `enableMaintenanceMode`/`disableMaintenanceMode`
183
+ * below (#648).
184
+ */
185
+ const RECREATE_API = ['up', '-d', '--no-deps', '--force-recreate', 'api'];
186
+ /**
187
+ * Forces `MAINTENANCE_MODE=true` into the deployment's `.env` and recreates
188
+ * `api` so it takes effect immediately -- `MAINTENANCE_MODE` is read from
189
+ * `process.env`, which an already-running container does not re-read
190
+ * (`docs/specs/maintenance-mode.md` §2.3). The environment layer is the only
191
+ * one the CLI can use at all: it holds no admin session to call
192
+ * `PUT /api/admin/maintenance` with, and the doc names this layer exactly
193
+ * this kind of break-glass.
194
+ *
195
+ * ⚠ CALLED BEFORE `build`, NOT BEFORE `migrate`'s OWN `stop api`. Setting it
196
+ * any later would leave the live, pre-update api answering real traffic for
197
+ * the whole build -- several minutes a real user could hit mid-migration-prep
198
+ * for nothing this step could have prevented.
199
+ *
200
+ * Never fails the update: a protective measure that could not be applied is
201
+ * a loud warning, not a reason to abandon an otherwise-working release. See
202
+ * `scheduleRenewal`'s identical stance.
203
+ */
204
+ async function enableMaintenanceMode(context) {
205
+ const envPath = envFilePath(context.options.deployRoot);
206
+ const templatePath = join(composeCwd(context.options.deployRoot), '.env.example');
207
+ if (!existsSync(envPath) || !existsSync(templatePath)) {
208
+ context.journal.line('No environment file yet; maintenance mode was not set.');
209
+ return;
210
+ }
211
+ const specs = parseEnvExample(readFileSync(templatePath, 'utf8'));
212
+ const values = readEnvFile(envPath);
213
+ values.set('MAINTENANCE_MODE', 'true');
214
+ writeEnvFile(envPath, values, specs);
215
+ try {
216
+ await compose(context, [...RECREATE_API], { timeoutMs: 5 * 60_000 });
217
+ context.journal.line('Maintenance mode is on: real traffic sees a 503 until it is turned off.');
218
+ }
219
+ catch (error) {
220
+ const message = error instanceof Error ? error.message : String(error);
221
+ context.journal.line(`warning: could not restart api into maintenance mode: ${message}`);
222
+ context.hooks?.onProgress?.(`warning: maintenance mode may not be in effect (${message})`);
223
+ }
224
+ }
225
+ /**
226
+ * Clears the environment override this run set, and recreates `api` so real
227
+ * requests reach it again.
228
+ *
229
+ * ⚠ DELETES THE KEY. NEVER WRITES `false`. The environment layer resolves
230
+ * ahead of the persisted one (§2.1 of the maintenance-mode spec): writing
231
+ * `false` here would silently force shut a window an admin opened through
232
+ * `/admin/settings/maintenance` for reasons of their own, the moment this
233
+ * update happened to run concurrently with it. Deleting the key returns
234
+ * resolution to whatever that other layer already says, which is correct
235
+ * whether or not it was ever touched.
236
+ *
237
+ * ⚠ RUNS BEFORE `health`/`verify`, NOT AFTER. Those read `/api/health/ready`,
238
+ * which a maintenance window deliberately drains to `503` (§2.6/§2.7) --
239
+ * running them first would make every maintenance update time out waiting
240
+ * for a readiness that is never coming while the window stays open.
241
+ *
242
+ * Unlike `enableMaintenanceMode`, this is allowed to throw: if the recreate
243
+ * does not actually take, the very next step (`health`) would time out
244
+ * waiting on a still-drained `/ready` anyway, for the real reason, not an
245
+ * invented one -- so there is nothing this needs to swallow.
246
+ */
247
+ async function disableMaintenanceMode(context) {
248
+ const envPath = envFilePath(context.options.deployRoot);
249
+ const templatePath = join(composeCwd(context.options.deployRoot), '.env.example');
250
+ if (!existsSync(envPath) || !existsSync(templatePath))
251
+ return;
252
+ const specs = parseEnvExample(readFileSync(templatePath, 'utf8'));
253
+ const values = readEnvFile(envPath);
254
+ if (!values.has('MAINTENANCE_MODE'))
255
+ return;
256
+ values.delete('MAINTENANCE_MODE');
257
+ writeEnvFile(envPath, values, specs);
258
+ await compose(context, [...RECREATE_API], { timeoutMs: 5 * 60_000 });
259
+ context.journal.line('Maintenance mode is off.');
260
+ }
261
+ /** What the container reads; see edge-config.ts. */
262
+ async function readRunningEdgeConfig(context) {
263
+ try {
264
+ // Exit 1 is sha256sum's "some file could not be read" -- the hashes it
265
+ // DID print are still worth having, and a missing one counts as drift.
266
+ const result = await compose(context, ['exec', '-T', 'nginx', 'sha256sum', ...edgeConfigFiles().map((file) => file.container)], { timeoutMs: 60_000, allowExitCodes: [1] });
267
+ return {
268
+ hashes: parseSha256sum(result.stdout),
269
+ ...(result.exitCode === 0
270
+ ? {}
271
+ : { error: `exit ${result.exitCode}: ${result.stderr.trim() || 'no output'}` }),
272
+ };
273
+ }
274
+ catch (error) {
275
+ // nginx not running at all, or docker refusing the exec: nothing to
276
+ // compare, which `reconcileEdgeConfig` treats as drift.
277
+ return {
278
+ hashes: new Map(),
279
+ error: error instanceof Error ? error.message.split('\n')[0] : String(error),
280
+ };
281
+ }
282
+ }
283
+ /**
284
+ * Records, or clears, `--allow-superuser` in the state (#980): `kept` is the
285
+ * privileged login kept in this run, if any; otherwise a previous record
286
+ * survives only while `.env` still holds that login.
287
+ */
288
+ function recordSuperuser(context, kept, currentUser) {
289
+ const record = superuserRecord(kept, context.state, currentUser);
290
+ if (record.allowSuperuser === context.state.allowSuperuser &&
291
+ record.allowSuperuserLogin === context.state.allowSuperuserLogin) {
292
+ return;
293
+ }
294
+ context.state = { ...context.state, ...record };
295
+ writeState(context.state);
296
+ }
297
+ /** Whether the flags ask for database-role work even when the revision has not moved. */
298
+ function wantsRoleWork(options) {
299
+ return (options.provisionAppRole === true ||
300
+ options.rotateAppPassword === true ||
301
+ options.allowSuperuser === true ||
302
+ options.adminUser !== undefined ||
303
+ options.appDbUser !== undefined);
304
+ }
305
+ /** Every step after `fetch` stands down when the remote has not moved. */
306
+ /**
307
+ * Where this deployment's vhost lives.
308
+ *
309
+ * Prefers the recorded value. The fallback reproduces the old derivation only
310
+ * for records written before the field existed -- it is a compatibility path,
311
+ * not the answer.
312
+ */
313
+ function proxyRootFor(context) {
314
+ return (context.state.proxyRoot ?? join(context.options.deployRoot, '..', '..', 'proxy'));
315
+ }
316
+ /**
317
+ * The proxy runtime this update acts under, resolved once and reused.
318
+ *
319
+ * Flags, then the record install left, then detection -- never a fresh guess
320
+ * that could disagree with how install published this deployment.
321
+ */
322
+ async function proxyRuntimeOf(context) {
323
+ if (context.proxyRuntime !== undefined)
324
+ return context.proxyRuntime;
325
+ const runtime = await resolveRecordedProxyRuntime({
326
+ proxyRoot: proxyRootFor(context),
327
+ flags: { mode: context.options.proxyMode, container: context.options.proxyContainer },
328
+ recorded: context.state,
329
+ runCommand: context.runCommand,
330
+ });
331
+ context.proxyRuntime = runtime;
332
+ context.journal.line(describeProxyRuntime(runtime));
333
+ return runtime;
334
+ }
335
+ function skipWhenUnchanged(context) {
336
+ return context.unchanged === true ? 'already up to date' : undefined;
337
+ }
338
+ export function buildUpdateSteps() {
339
+ return [
340
+ {
341
+ id: 'preflight',
342
+ title: 'Check the essentials',
343
+ async run(context) {
344
+ // A LIGHT preflight, not the full doctor. DNS and certificate checks
345
+ // are install-time concerns; a site that is already serving does not
346
+ // need them re-litigated on every update.
347
+ const appCheckIds = new Set(listRegisteredDeployChecks().map((check) => check.id));
348
+ const wanted = new Set([
349
+ 'docker-installed',
350
+ 'docker-daemon',
351
+ 'docker-compose-v2',
352
+ 'git-installed',
353
+ 'disk-space',
354
+ // The run's compose project must be the one whose containers hold
355
+ // the bind port; otherwise `up -d` starts a second stack (#1020).
356
+ 'bind-port-owner',
357
+ // Every OTHER host port the stack publishes (greptimedb's 14003, #1024).
358
+ 'stack-ports-free',
359
+ ]);
360
+ // `fetch` talks to the recorded repository, so whether git can still
361
+ // read it is an essential too -- but only as the REQUIRED subset of
362
+ // the source checks: gh is advice everywhere except an HTTPS GitHub
363
+ // URL git cannot read (#390).
364
+ const repoUrl = normaliseRepoUrl(context.state.repoUrl);
365
+ const gitCredentialed = await gitCredentialStateFor(repoUrl, context.runCommand);
366
+ const checkContext = {
367
+ runCommand: context.runCommand,
368
+ deployRoot: context.options.deployRoot,
369
+ bindPort: context.state.bindPort,
370
+ composeProject: composeProjectFor(context.state),
371
+ // The files `up -d` will use, which `stack-ports-free` renders.
372
+ groups: groupsOf(context),
373
+ // `fetch` and `environment-drift` still change the files and the `.env`
374
+ // (the drift step generates a key a new revision requires, which a
375
+ // checkout moved by a failed run would otherwise fail to render
376
+ // without): a stack that cannot be rendered YET is judged by the
377
+ // `stack-ports` step, with the final ones, before anything is touched.
378
+ environmentPending: true,
379
+ // From the record, not reconstructed. Deriving it as
380
+ // `<deployRoot>/../../proxy` silently ignored a non-default
381
+ // --proxy-root given at install time, and wrote the vhost somewhere
382
+ // the proxy does not read.
383
+ proxyRoot: proxyRootFor(context),
384
+ // Resolved here only when this update may touch the proxy; the
385
+ // checks above do not read it today, but a check promoted by the
386
+ // runtime must see the same one `publish` will use.
387
+ ...(context.options.skipProxy === true || context.state.domain === undefined
388
+ ? {}
389
+ : { proxyRuntime: await proxyRuntimeOf(context) }),
390
+ repoUrl,
391
+ ...(gitCredentialed === undefined ? {} : { gitCredentialed }),
392
+ ...(context.options.skipProxy === true ? { skipProxy: true } : {}),
393
+ };
394
+ const results = await runChecks(allChecks().filter((check) => wanted.has(check.id) ||
395
+ (SOURCE_CHECK_IDS.has(check.id) && severityOf(check, checkContext) === 'required') ||
396
+ // An app check (registerDeployCheck) that is required blocks an update too.
397
+ (appCheckIds.has(check.id) && severityOf(check, checkContext) === 'required')), checkContext);
398
+ for (const result of results) {
399
+ context.journal.line(`${result.status} ${result.id}: ${result.detail}`);
400
+ // A warning does not stop the run, so say it where the operator is
401
+ // looking (`bind-port-owner`: a stopped leftover beside the live stack).
402
+ if (result.status === 'warn') {
403
+ context.hooks?.onProgress?.(`warning: ${result.id}: ${result.detail}${result.remedy === undefined ? '' : ` (${result.remedy})`}`);
404
+ }
405
+ }
406
+ if (!checksPassed(results)) {
407
+ throw new PreconditionError(results
408
+ .filter((result) => result.status === 'fail')
409
+ // The remedy rides along, as install's preflight does: a failure
410
+ // whose fix is in a place the operator cannot see is no help
411
+ // (`bind-port-owner` names the state file and the command).
412
+ .map((result) => `${result.id}: ${result.detail}${result.remedy === undefined ? '' : `\n ${result.remedy}`}`)
413
+ .join('\n'));
414
+ }
415
+ },
416
+ },
417
+ {
418
+ id: 'fetch',
419
+ title: 'Look for a new revision',
420
+ async run(context) {
421
+ const target = await resolveRepoTarget({
422
+ cwd: context.options.cwd ?? process.cwd(),
423
+ runCommand: context.runCommand,
424
+ state: context.state,
425
+ ...(context.options.ref === undefined ? {} : { refFlag: context.options.ref }),
426
+ });
427
+ const checkout = await ensureCheckout(target, {
428
+ deployRoot: context.options.deployRoot,
429
+ runCommand: context.runCommand,
430
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
431
+ ...(context.options.force === undefined ? {} : { force: context.options.force }),
432
+ });
433
+ context.target = target;
434
+ context.commitSha = checkout.sha;
435
+ // ⚠ "UNCHANGED" IS NOT "THE CHECKOUT DID NOT MOVE". This step moves the
436
+ // checkout BEFORE build, migrate and restart, while the recorded state
437
+ // only advances when the whole run succeeds. After a failed run the
438
+ // checkout therefore already sits on the new revision, and the next
439
+ // plain `update` used to find "nothing to do" -- skipping the drift
440
+ // heal, the build, the migration and the maintenance-off -- and exit 0.
441
+ // The deployment is up to date only when the checkout is ALSO still at
442
+ // the last revision that deployed successfully (`deployedHead`).
443
+ const deployedHead = context.state.deployedHead;
444
+ const moved = checkout.changed;
445
+ const rebuildAnyway = context.options.force === true || context.options.noCache === true;
446
+ // What this run replaces: the last GOOD revision. For a state file from
447
+ // before the marker, the checkout's previous HEAD is the best evidence
448
+ // there is -- and is recorded below as the marker, so that a failure of
449
+ // THIS run no longer poisons the next one.
450
+ const lastGood = deployedHead !== undefined && deployedHead !== ''
451
+ ? deployedHead
452
+ : checkout.previousSha;
453
+ context.previousSha = lastGood;
454
+ if (!rebuildAnyway && isAlreadyDeployed(checkout, deployedHead)) {
455
+ // Several minutes of build and a restart for a no-op is exactly the
456
+ // friction that stops people updating often.
457
+ context.unchanged = true;
458
+ context.journal.line(`Already at ${checkout.sha}; nothing to do.`);
459
+ return;
460
+ }
461
+ if (!moved && !rebuildAnyway) {
462
+ context.journal.line(`The checkout is at ${checkout.sha}, but the last successful deploy was ${deployedHead ?? 'unknown'}: ` +
463
+ `an earlier update did not finish. Running the full update.`);
464
+ }
465
+ context.journal.line(`${lastGood ?? 'unknown'} -> ${checkout.sha} (${target.ref})`);
466
+ // Recorded BEFORE anything is mutated, so a failed update still leaves
467
+ // behind what it was replacing.
468
+ writeState({
469
+ ...context.state,
470
+ previousSha: lastGood,
471
+ // Seeds the marker for a state file that predates it, but only when
472
+ // the checkout genuinely moved: with no move there is no evidence the
473
+ // old HEAD ever deployed, and an invented marker would make a failed
474
+ // forced rebuild look finished.
475
+ ...(deployedHead === undefined && lastGood !== undefined && lastGood !== checkout.sha
476
+ ? { deployedHead: lastGood }
477
+ : {}),
478
+ lastDeployedAt: new Date().toISOString(),
479
+ });
480
+ },
481
+ },
482
+ {
483
+ id: 'environment-drift',
484
+ title: 'Check for new environment variables',
485
+ skip: skipWhenUnchanged,
486
+ async run(context) {
487
+ const templatePath = join(composeCwd(context.options.deployRoot), '.env.example');
488
+ const path = envFilePath(context.options.deployRoot);
489
+ if (!existsSync(templatePath) || !existsSync(path))
490
+ return;
491
+ const specs = parseEnvExample(readFileSync(templatePath, 'utf8'));
492
+ const current = parseEnvFile(readFileSync(path, 'utf8'));
493
+ // ⚠ HEAL A DEPLOYMENT THAT PREDATES THE MARKER, or the fix only ever
494
+ // reaches fresh installs and every deployment in the field keeps
495
+ // mounting an empty deploy-info directory for ever. Writing it is
496
+ // inert: nothing derives container identity from it, unlike
497
+ // COMPOSE_PROJECT_NAME -- see install.ts's environment step for why
498
+ // that one is deliberately never written.
499
+ //
500
+ // Done BEFORE the drift diff below, so a value this CLI supplies is
501
+ // never mistaken for a variable the operator has to answer.
502
+ if (current.get('DEPLOY_ROOT') !== context.options.deployRoot) {
503
+ current.set('DEPLOY_ROOT', context.options.deployRoot);
504
+ writeEnvFile(path, current, specs);
505
+ context.journal.line(`Recorded DEPLOY_ROOT=${context.options.deployRoot}`);
506
+ }
507
+ const { missing, unknown } = diffEnv(specs, current);
508
+ if (unknown.length > 0) {
509
+ // Carried through, never dropped: it may be a fork's own variable.
510
+ context.journal.line(`Keeping ${unknown.length} variable(s) not in the template`);
511
+ }
512
+ const groups = groupsOf(context);
513
+ // ⚠ A PLACEHOLDER IS NOT A VALUE for a key the CLI generates itself
514
+ // (#567). A deployment whose `.env` still carries `change-me-*` for a
515
+ // GreptimeDB password -- or an empty one -- gets a generated value
516
+ // here, without a question. A real value is never touched.
517
+ const placeholders = specs.filter((spec) => {
518
+ const metadata = metadataFor(spec.key);
519
+ return (metadata.autoGenerate === true &&
520
+ current.has(spec.key) &&
521
+ (metadata.group === undefined || groups.includes(metadata.group)) &&
522
+ needsAutoGenerate(current.get(spec.key), spec.defaultValue));
523
+ });
524
+ if (missing.length === 0 && placeholders.length === 0)
525
+ return;
526
+ // "In the template and not in the file" is NOT the same question as
527
+ // "what did this revision add?". A key is permanently absent for three
528
+ // unrelated reasons - a declined optional, a `never` key, and an
529
+ // opt-in feature group the deployment never enabled - and none of them
530
+ // is drift. `genuinelyNewKeys` applies all three; filtering on
531
+ // `essential || secret` alone re-asked the ENTIRE wizard, database
532
+ // connection included, on an update whose template had not changed.
533
+ //
534
+ // The feature-group class is the one that looks handled and is not:
535
+ // those keys are NOT commented out, so `spec.optional` misses them.
536
+ // Enabled groups come from the flag, else from what install recorded -
537
+ // NEVER from reading the `.env`, for the reason `state.groups` gives.
538
+ //
539
+ // The always-on `observability` group (#567) is the upgrade path: a
540
+ // deployment recorded without it has none of its keys, and they count
541
+ // as genuinely new here -- GREPTIME_*_PASSWORD generated, the rest
542
+ // their template defaults.
543
+ const added = genuinelyNewKeys(missing, { groups });
544
+ if (added.length === 0 && placeholders.length === 0) {
545
+ context.journal.line(`Template has ${missing.length} variable(s) this deployment does not use; nothing new.`);
546
+ return;
547
+ }
548
+ const isAuto = (spec) => {
549
+ const metadata = metadataFor(spec.key);
550
+ return metadata.autoGenerate === true && metadata.generate !== undefined;
551
+ };
552
+ // Keys the CLI generates itself need no answer, no domain and no
553
+ // wizard (#567): an interactive update must not stop to ask about a
554
+ // password nobody has to know, and a deployment published without a
555
+ // domain must still be able to take them.
556
+ const generated = [...added.filter(isAuto), ...placeholders];
557
+ const rest = added.filter((spec) => !isAuto(spec));
558
+ // An `allowBlank` key does not NEED an answer: blank is a legitimate
559
+ // value for it, which is exactly what its template default gives. The
560
+ // PostgreSQL monitor login (#598) is the case: an upgrade must not stop
561
+ // to ask for an optional hardening, nor refuse a deployment recorded
562
+ // without a domain, when blank means "reuse the API's login". It is
563
+ // still asked when the wizard runs for some other key.
564
+ const needsAnswer = rest.filter((spec) => {
565
+ const metadata = metadataFor(spec.key);
566
+ if (metadata.allowBlank === true)
567
+ return false;
568
+ return metadata.essential === true || metadata.secret === true;
569
+ });
570
+ if (added.length > 0) {
571
+ context.journal.line(`This revision adds ${added.length} variable(s); ${needsAnswer.length} need a value.`);
572
+ }
573
+ // #1027: a key that is a published host port and is being ADDED (telemetry
574
+ // ports on a deployment from before they existed) gets a port that is
575
+ // free on this host instead of the template default, which another app
576
+ // on the server may hold. Only a missing key: a value already in `.env`,
577
+ // or one the operator supplied, is never moved -- `stack-ports-free`
578
+ // reports a clash on it, with the fix.
579
+ const ports = await freePortsForNewKeys(context, specs, added, current);
580
+ const merged = new Map(current);
581
+ for (const spec of generated) {
582
+ // A value from --answers is an operator's choice, kept like one.
583
+ const supplied = context.options.answers?.get(spec.key);
584
+ const kind = metadataFor(spec.key).generate;
585
+ merged.set(spec.key, needsAutoGenerate(supplied, spec.defaultValue) ? generateValue(kind) : supplied);
586
+ }
587
+ if (generated.length > 0) {
588
+ // Names only. The values are secrets and never reach the journal.
589
+ context.journal.line(`Generated ${generated.length} value(s): ${generated.map((spec) => spec.key).join(', ')}`);
590
+ }
591
+ if (needsAnswer.length === 0) {
592
+ // Everything new has a usable default; add them and say so.
593
+ for (const spec of rest) {
594
+ merged.set(spec.key, spec.defaultValue);
595
+ }
596
+ for (const [key, value] of ports)
597
+ merged.set(key, value);
598
+ // The WRITER still gets the full template spec list, so section
599
+ // banners and key order survive. Only the question list narrows.
600
+ writeEnvFile(path, merged, specs);
601
+ context.env = merged;
602
+ return;
603
+ }
604
+ const domain = context.state.domain;
605
+ if (domain === undefined) {
606
+ throw new UsageError('This revision needs new environment values, but no domain is recorded for this deployment. Re-run install, or set them by hand.');
607
+ }
608
+ const { values } = await runEnvWizard({
609
+ // ONLY the new keys. Handing over the full list is the other half of
610
+ // the same defect: even a genuine one-variable revision re-asked
611
+ // everything.
612
+ specs: rest,
613
+ domain,
614
+ groups,
615
+ // The generated values last, so an --answers placeholder cannot
616
+ // put back what was just replaced.
617
+ existing: context.options.answers === undefined
618
+ ? new Map([...merged, ...ports])
619
+ : new Map([
620
+ ...current,
621
+ ...ports,
622
+ ...context.options.answers,
623
+ ...generated.map((spec) => [spec.key, merged.get(spec.key)]),
624
+ ]),
625
+ ...(context.options.nonInteractive === undefined
626
+ ? {}
627
+ : { nonInteractive: context.options.nonInteractive }),
628
+ ...(context.options.promptContext === undefined
629
+ ? {}
630
+ : { ctx: context.options.promptContext }),
631
+ });
632
+ writeEnvFile(path, values, specs);
633
+ context.env = values;
634
+ },
635
+ },
636
+ {
637
+ // ⚠ BEFORE THE FIRST STEP THAT CAN TOUCH A CONTAINER (`database-role` may
638
+ // recreate the api). The preflight judged the OLD checkout and `.env`;
639
+ // `fetch` and `environment-drift` have just changed both, and a port the new
640
+ // revision publishes is only visible now. See stack-ports-gate.ts (#1024).
641
+ id: STACK_PORTS_STEP_ID,
642
+ title: 'Check the ports the stack publishes',
643
+ skip: skipWhenUnchanged,
644
+ async run(context) {
645
+ await assertStackPortsFree({
646
+ context: {
647
+ runCommand: context.runCommand,
648
+ deployRoot: context.options.deployRoot,
649
+ bindPort: context.state.bindPort,
650
+ composeProject: composeProjectFor(context.state),
651
+ groups: groupsOf(context),
652
+ proxyRoot: proxyRootFor(context),
653
+ ...(context.options.portFree === undefined ? {} : { portFree: context.options.portFree }),
654
+ },
655
+ line: (text) => context.journal.line(text),
656
+ warn: (text) => context.hooks?.onProgress?.(text),
657
+ });
658
+ },
659
+ },
660
+ {
661
+ id: 'database-role',
662
+ title: 'Check the database role',
663
+ // ⚠ NOT `skipWhenUnchanged`, but not unconditional either. A cron'd
664
+ // `update` that finds nothing new must stay cheap and quiet, so on an
665
+ // unchanged revision this runs only when the operator asked for role work
666
+ // -- which is also the only way an unchanged deployment ever gets
667
+ // migrated off a superuser login. A moved revision always checks.
668
+ skip: (context) => {
669
+ if (context.unchanged === true && !wantsRoleWork(context.options)) {
670
+ return `already up to date; pass --provision-app-role to check the database role anyway`;
671
+ }
672
+ return undefined;
673
+ },
674
+ async run(context) {
675
+ // #980: a deployment whose POSTGRES_USER is a superuser runs with
676
+ // row-level security inert. Offer the same migration install does --
677
+ // provision, transfer ownership, rewrite .env, restart -- from the
678
+ // login already in .env (it is the administrator), or --admin-user.
679
+ const env = environmentOfUpdate(context);
680
+ if (env === undefined) {
681
+ context.journal.line('No environment file; nothing to check.');
682
+ return;
683
+ }
684
+ const currentUser = env.get('POSTGRES_USER');
685
+ const warn = (message) => {
686
+ context.journal.line(message);
687
+ context.hooks?.onProgress?.(message);
688
+ };
689
+ // --skip-role-provisioning creates nothing, but a superuser login is
690
+ // still worth the same warning every other path gives.
691
+ if (context.options.skipRoleProvisioning === true) {
692
+ const settings = databaseSettings(env);
693
+ const probe = settings === undefined ? undefined : await readRoleAttributes(context.runCommand, settings);
694
+ if (probe?.attributes !== undefined && (probe.attributes.superuser || probe.attributes.bypassRls)) {
695
+ warn(`warning: --skip-role-provisioning: ${superuserConsequence(currentUser ?? 'the database login')}`);
696
+ }
697
+ else {
698
+ context.journal.line('--skip-role-provisioning: no role is created; database-role-ordinary verifies the one supplied');
699
+ }
700
+ return;
701
+ }
702
+ const admin = await resolveAdminLogin(context.options, {
703
+ promptContext: context.options.promptContext,
704
+ nonInteractive: context.options.nonInteractive,
705
+ });
706
+ if (admin !== undefined) {
707
+ context.journal.addSecrets([{ key: 'DB_ADMIN_PASSWORD', value: admin.password }]);
708
+ }
709
+ // The file as it is now: put back if the server refuses the new password,
710
+ // and the target of a revert if the API does not come up on it.
711
+ const envPath = envFilePath(context.options.deployRoot);
712
+ const templatePath = join(composeCwd(context.options.deployRoot), '.env.example');
713
+ const specs = existsSync(templatePath) ? parseEnvExample(readFileSync(templatePath, 'utf8')) : [];
714
+ const previousContents = existsSync(envPath) ? readFileSync(envPath, 'utf8') : undefined;
715
+ const previousLogin = { user: currentUser, password: env.get('POSTGRES_PASSWORD') ?? '' };
716
+ const role = await ensureApplicationRole({
717
+ env,
718
+ recordedEnv: env,
719
+ runCommand: context.runCommand,
720
+ onLine: (line) => context.journal.line(line),
721
+ onSecrets: (secrets) => context.journal.addSecrets(secrets),
722
+ // Atomic, 0600, over the file on disk (not the in-memory map, which a
723
+ // drift step may have only half-built) and BEFORE the server's password
724
+ // changes; put back byte for byte if that fails.
725
+ store: {
726
+ write: (credentials) => {
727
+ const values = existsSync(envPath) ? readEnvFile(envPath) : new Map(env);
728
+ values.set('POSTGRES_USER', credentials.user);
729
+ values.set('POSTGRES_PASSWORD', credentials.password);
730
+ writeEnvFile(envPath, values, specs);
731
+ },
732
+ restore: () => {
733
+ if (previousContents !== undefined)
734
+ writeEnvContents(envPath, previousContents);
735
+ },
736
+ },
737
+ // An unattended update must not start failing on a deployment that
738
+ // predates this: not consented, and anything wrong before the server
739
+ // changed, is a loud warning; install is where it is a refusal.
740
+ whenNotConsented: 'warn',
741
+ ...roleOptionsFrom(context.options, admin),
742
+ });
743
+ context.journal.line(`Database role: ${role.outcome}: ${role.detail}`);
744
+ if (role.outcome === 'superuser-allowed') {
745
+ warn(`warning: --allow-superuser: ${superuserConsequence(currentUser ?? 'the database login')}`);
746
+ recordSuperuser(context, currentUser, currentUser);
747
+ return;
748
+ }
749
+ if (role.outcome === 'declined') {
750
+ context.hooks?.onProgress?.(`warning: ${role.detail}`);
751
+ return;
752
+ }
753
+ // An ordinary login (it already was one, or it is now) means any recorded
754
+ // --allow-superuser no longer applies. Anything that could not tell leaves it.
755
+ if (role.outcome !== 'unknown')
756
+ recordSuperuser(context, undefined, undefined);
757
+ if (role.credentials === undefined)
758
+ return;
759
+ const credentials = role.credentials;
760
+ context.env = readEnvFile(envPath);
761
+ context.appCredentials = credentials;
762
+ context.hooks?.onProgress?.(`${role.outcome === 'rotated' ? 'Rotated' : 'Moved the deployment onto'} database role "${credentials.user}"; the generated password is saved to .env only.`);
763
+ // A moved revision restarts the stack further on, with this .env. An
764
+ // unchanged one restarts nothing, so the api is recreated here and
765
+ // proved up: it must not be left running on the old login or dead on the new.
766
+ if (context.unchanged === true) {
767
+ await compose(context, [...RECREATE_API], { timeoutMs: 5 * 60_000 });
768
+ const probe = await waitForHealthy({
769
+ runCommand: context.runCommand,
770
+ deployRoot: context.options.deployRoot,
771
+ bindPort: context.state.bindPort,
772
+ composeProject: composeProjectFor(context.state),
773
+ ...(context.options.healthWaitMs === undefined
774
+ ? {}
775
+ : { waitMs: context.options.healthWaitMs, intervalMs: Math.min(50, context.options.healthWaitMs) }),
776
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
777
+ });
778
+ if (!probe.ok) {
779
+ const why = `The API did not become ready on database role "${credentials.user}": ${probe.error ?? `HTTP ${probe.status ?? '?'}`}.`;
780
+ // The previous login can be returned to only if it still opens the
781
+ // database: the old administrator does; a rotated password does not.
782
+ const settings = databaseSettings(env);
783
+ const previousWorks = settings !== undefined &&
784
+ previousContents !== undefined &&
785
+ previousLogin.user !== undefined &&
786
+ previousLogin.user !== credentials.user &&
787
+ (await runPsql(context.runCommand, { ...settings, ...previousLogin, user: previousLogin.user }, 'postgres', 'select 1')).ok;
788
+ if (previousWorks && previousContents !== undefined) {
789
+ writeEnvContents(envPath, previousContents);
790
+ context.env = parseEnvFile(previousContents);
791
+ await compose(context, [...RECREATE_API], { timeoutMs: 5 * 60_000 }).catch(() => undefined);
792
+ throw new Error(`${why} .env was put back to the previous login "${previousLogin.user}", which still works, and the api was restarted on it. ` +
793
+ `The role "${credentials.user}" exists and owns the database; check the API logs (pg_hba.conf from the container network is the usual cause) and re-run.`);
794
+ }
795
+ throw new Error(`${why} .env now holds the login "${credentials.user}" with its NEW password` +
796
+ (previousLogin.user === credentials.user
797
+ ? ' (the previous password no longer works)'
798
+ : ' (the previous login could not be used again)') +
799
+ '. Check the API logs (pg_hba.conf from the container network is the usual cause); nothing else was changed.');
800
+ }
801
+ }
802
+ },
803
+ },
804
+ {
805
+ id: 'ensure-database',
806
+ title: 'Make sure the database exists',
807
+ skip: skipWhenUnchanged,
808
+ async run(context) {
809
+ // #391: the same gate install uses. A database that vanished (a
810
+ // restore gone wrong, a renamed POSTGRES_DB) is otherwise found by the
811
+ // migration, with the api container already stopped. #396: the same
812
+ // FUNCTION, too -- offer, create, re-verify -- so the two cannot drift.
813
+ const env = context.env;
814
+ if (env === undefined) {
815
+ context.journal.line('No environment file; nothing to check.');
816
+ return;
817
+ }
818
+ const result = await ensureDatabase({
819
+ env,
820
+ runCommand: context.runCommand,
821
+ createDatabase: context.options.createDatabase,
822
+ ...(context.options.allowSuperuser === true || superuserAllowedFor(context.state, env.get('POSTGRES_USER'))
823
+ ? { allowSuperuser: true }
824
+ : {}),
825
+ ...consentOptions(context),
826
+ envPath: envFilePath(context.options.deployRoot),
827
+ onLine: (line) => context.journal.line(line),
828
+ });
829
+ context.journal.line(result.detail);
830
+ if (result.outcome === 'created')
831
+ context.hooks?.onProgress?.(result.detail);
832
+ },
833
+ },
834
+ {
835
+ id: 'version',
836
+ title: 'Choose the release version',
837
+ // ⚠ `skipWhenUnchanged` FIRST, and it is load-bearing. An update that
838
+ // finds the remote has not moved rebuilds nothing -- so bumping the
839
+ // version here would commit and push a release for code nobody changed,
840
+ // then find the remote HAS moved next time and do it again: a bump
841
+ // treadmill driven entirely by its own commits. A version belongs to a
842
+ // deploy that actually deployed something.
843
+ // ⚠ `skipWhenUnchanged` ONLY, and it is load-bearing. An update that
844
+ // finds the remote has not moved rebuilds nothing -- so bumping here
845
+ // would commit and push a release for code nobody changed, then find the
846
+ // remote HAS moved next time and do it again: a bump treadmill driven
847
+ // entirely by its own commits. `--no-version-bump` is handled INSIDE the
848
+ // step instead, because it still stamps the current version.
849
+ skip: skipWhenUnchanged,
850
+ async run(context) {
851
+ // ⚠ IMMEDIATELY BEFORE `build`, AND IT COMMITS. The checkout step
852
+ // refuses a dirty tree, so leaving manifests dirty across a
853
+ // four-minute build would wedge the NEXT update behind a refusal about
854
+ // files the operator never touched. See version-step.ts's header.
855
+ const result = await runVersionStep({
856
+ checkoutPath: checkoutPathFor(context.options.deployRoot),
857
+ ...(context.options.appVersion === undefined
858
+ ? {}
859
+ : { requested: context.options.appVersion }),
860
+ ...(context.options.noVersionBump === undefined
861
+ ? {}
862
+ : { disabled: context.options.noVersionBump }),
863
+ runCommand: context.runCommand,
864
+ });
865
+ context.version = result;
866
+ context.journal.line(`Version: ${result.detail}`);
867
+ // ⚠ The DEPLOYED COMMIT IS THE BUMP COMMIT. Recording the pre-bump one
868
+ // leaves every server reporting itself a commit behind for ever,
869
+ // rebuilding identical code and bumping again on every update. It is
870
+ // also more accurate: the commit happens before `build`, so the images
871
+ // really were built with HEAD here.
872
+ if (result.commitSha !== undefined)
873
+ context.commitSha = result.commitSha;
874
+ // ⚠ STAMPED ON DISK, NOT JUST IN MEMORY. `context.env` is the wizard's
875
+ // map and nothing writes it again after the `environment` step, so an
876
+ // in-memory set alone would leave the running container on whatever
877
+ // APP_VERSION the last deploy wrote. The disk write is what the build
878
+ // and the api container actually read.
879
+ const stamped = stampAppVersion(envFilePath(context.options.deployRoot), join(composeCwd(context.options.deployRoot), '.env.example'), result.version);
880
+ context.env?.set('APP_VERSION', result.version);
881
+ if (!stamped) {
882
+ context.journal.line('APP_VERSION was not stamped: no .env on disk yet.');
883
+ }
884
+ },
885
+ },
886
+ {
887
+ id: 'maintenance-on',
888
+ title: 'Enter maintenance mode',
889
+ skip: (context) => skipWhenUnchanged(context) ??
890
+ (context.options.maintenance === true
891
+ ? undefined
892
+ : 'not requested; pass --maintenance to use it'),
893
+ async run(context) {
894
+ await enableMaintenanceMode(context);
895
+ },
896
+ },
897
+ {
898
+ id: 'build',
899
+ title: 'Build images',
900
+ skip: skipWhenUnchanged,
901
+ async run(context) {
902
+ await compose(context, [
903
+ 'build',
904
+ ...(context.options.noCache === true ? ['--no-cache'] : []),
905
+ ]);
906
+ },
907
+ },
908
+ {
909
+ id: 'migrate',
910
+ title: 'Apply migrations',
911
+ skip: skipWhenUnchanged,
912
+ async run(context) {
913
+ // The api container is stopped first so two instances cannot race the
914
+ // same migration, and brought back if the migration fails - leaving a
915
+ // working deployment down because a migration failed would turn a
916
+ // failed update into an outage.
917
+ await compose(context, ['stop', 'api'], { timeoutMs: 5 * 60_000 });
918
+ try {
919
+ await compose(context, ['run', '--rm', '--no-deps', 'api', 'npm', 'run', 'prisma:migrate'], { timeoutMs: 10 * 60_000 });
920
+ }
921
+ catch (error) {
922
+ await compose(context, ['start', 'api'], { timeoutMs: 5 * 60_000 }).catch(() => undefined);
923
+ throw error;
924
+ }
925
+ },
926
+ },
927
+ {
928
+ id: 'seed',
929
+ title: 'Refresh roles and permissions',
930
+ skip: (context) => skipWhenUnchanged(context) ??
931
+ (context.options.skipSeed === true ? 'skipped with --skip-seed' : undefined),
932
+ async run(context) {
933
+ // Idempotent, and the only way new permissions reach an existing
934
+ // deployment. See the header.
935
+ await compose(context, ['run', '--rm', '--no-deps', 'api', 'npm', 'run', 'prisma:seed'], { timeoutMs: 10 * 60_000 });
936
+ },
937
+ },
938
+ {
939
+ id: 'restart',
940
+ title: 'Restart the stack',
941
+ skip: skipWhenUnchanged,
942
+ async run(context) {
943
+ await compose(context, ['up', '-d']);
944
+ // nginx caches the api container's address, and a rebuilt container
945
+ // gets a new one, so a stale resolution outlives the update.
946
+ //
947
+ // ⚠ RECREATED, NOT RESTARTED. nginx.conf and csp.conf are
948
+ // SINGLE-FILE bind mounts, and git replaces a file's inode rather than
949
+ // editing it: `restart` keeps the old container and the old inode, so
950
+ // a config change in the release never reached the running site.
951
+ // Recreating re-binds the mounts as well as re-resolving the api.
952
+ await compose(context, [...RECREATE_NGINX], { timeoutMs: 5 * 60_000 });
953
+ },
954
+ },
955
+ {
956
+ id: 'maintenance-off',
957
+ title: 'Exit maintenance mode',
958
+ // ⚠ NO GATE ON `--maintenance`, unlike `maintenance-on`. This also
959
+ // self-heals a window a PREVIOUS run's `maintenance-on` set and never
960
+ // got to clear (a failure in `build`/`migrate`/`seed` before this step
961
+ // runs) -- the next update, flag or no flag, finds the leftover key and
962
+ // clears it, rather than leaving the deployment stuck until someone
963
+ // notices by hand.
964
+ //
965
+ // That holds because `skipWhenUnchanged` means "deployed AND unchanged":
966
+ // after a failed run the checkout has moved but `deployedHead` has not,
967
+ // so the retry is NOT unchanged and this step runs (see `fetch`). A
968
+ // retry that is a genuine no-op has no window to clear, because the last
969
+ // run finished.
970
+ skip: skipWhenUnchanged,
971
+ async run(context) {
972
+ await disableMaintenanceMode(context);
973
+ },
974
+ },
975
+ {
976
+ id: 'edge-config',
977
+ title: 'Check the nginx config is current',
978
+ // ⚠ NO `skipWhenUnchanged`, and that is the point of this step. Every
979
+ // other step after `fetch` stands down when the checkout has not
980
+ // moved -- so a checkout updated BY HAND (a `git pull` over SSH, a
981
+ // previous run that failed after `fetch`) would otherwise never get its
982
+ // nginx config applied: each later run finds "nothing to do". This asks
983
+ // the running container directly, which costs one `exec` when all is
984
+ // well.
985
+ //
986
+ // AFTER `restart` so a changed run checks what the recreate just did,
987
+ // and BEFORE `health` because the health probe goes through this nginx:
988
+ // a stale edge config is the stack's problem, not the API's, and should
989
+ // be named as such.
990
+ async run(context) {
991
+ const project = composeProjectFor(context.state);
992
+ await reconcileEdgeConfig({
993
+ checkoutPath: checkoutPathFor(context.options.deployRoot),
994
+ readRunning: () => readRunningEdgeConfig(context),
995
+ recreate: async () => {
996
+ await compose(context, [...RECREATE_NGINX], { timeoutMs: 5 * 60_000 });
997
+ },
998
+ manualCommand: `cd ${composeCwd(context.options.deployRoot)} && ` +
999
+ composeArgv([...RECREATE_NGINX], project, groupsOf(context), composeCwd(context.options.deployRoot)).join(' '),
1000
+ line: (text) => context.journal.line(text),
1001
+ notice: (text) => context.hooks?.onProgress?.(text),
1002
+ });
1003
+ },
1004
+ },
1005
+ {
1006
+ id: 'health',
1007
+ title: 'Wait for the API',
1008
+ skip: skipWhenUnchanged,
1009
+ async run(context) {
1010
+ const probe = await waitForHealthy({
1011
+ runCommand: context.runCommand,
1012
+ deployRoot: context.options.deployRoot,
1013
+ bindPort: context.state.bindPort,
1014
+ ...(composeProjectFor(context.state) === undefined
1015
+ ? {}
1016
+ : { composeProject: composeProjectFor(context.state) }),
1017
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
1018
+ });
1019
+ if (!probe.ok) {
1020
+ throw new Error(`The API did not become ready: ${probe.error ?? `HTTP ${probe.status ?? '?'}`}`);
1021
+ }
1022
+ },
1023
+ },
1024
+ {
1025
+ id: 'deploy-info',
1026
+ title: 'Record what was deployed',
1027
+ async run(context) {
1028
+ // ⚠ IMMEDIATELY AFTER `health`, NOT AT THE END. If the API is
1029
+ // answering, the application demonstrably IS deployed and the About
1030
+ // page should say so. Written at the end, a failure in `publish` --
1031
+ // which runs between here and there -- would leave that page reporting
1032
+ // nothing at all about a deployment that is up and serving, which is
1033
+ // exactly when somebody is looking at it.
1034
+ //
1035
+ // ⚠ AND REWRITTEN AT THE END of a successful update (see `runUpdate`),
1036
+ // the only point at which this run's history entry and a freshly read
1037
+ // certificate expiry exist.
1038
+ await hostFactsOf(context);
1039
+ const result = writeDeployInfo(context.options.deployRoot, updateDeployInfo(context, new Date().toISOString()));
1040
+ // ⚠ BOOKKEEPING, NOT THE DEPLOYMENT. By this point the stack is up and
1041
+ // answering; a file this CLI could not write is a warning, never a
1042
+ // failure that undoes a successful deploy.
1043
+ context.journal.line(result.written
1044
+ ? `Wrote ${result.path}`
1045
+ : `warning: could not write ${result.path}: ${result.error ?? 'unknown'}`);
1046
+ if (!result.written) {
1047
+ context.hooks?.onProgress?.(`warning: deployment record not written (${result.error ?? 'unknown'})`);
1048
+ }
1049
+ },
1050
+ },
1051
+ {
1052
+ id: 'publish',
1053
+ title: 'Refresh the vhost and certificate',
1054
+ skip: (context) => {
1055
+ if (context.unchanged === true)
1056
+ return 'already up to date';
1057
+ if (context.options.skipProxy === true)
1058
+ return 'skipped with --skip-proxy';
1059
+ if (context.state.domain === undefined)
1060
+ return 'this deployment is not published';
1061
+ return undefined;
1062
+ },
1063
+ async run(context) {
1064
+ const runtime = await proxyRuntimeOf(context);
1065
+ const target = {
1066
+ domain: context.state.domain,
1067
+ bindPort: context.state.bindPort,
1068
+ // From the record, not reconstructed. Deriving it as
1069
+ // `<deployRoot>/../../proxy` silently ignored a non-default
1070
+ // --proxy-root given at install time, and wrote the vhost somewhere
1071
+ // the proxy does not read.
1072
+ proxyRoot: proxyRootFor(context),
1073
+ };
1074
+ const status = certificateStatus(target);
1075
+ if (!status.exists) {
1076
+ const email = context.env?.get('INITIAL_ADMIN_EMAIL') ?? '';
1077
+ if (email !== '') {
1078
+ await issueCertificate(target, {
1079
+ runCommand: context.runCommand,
1080
+ runtime,
1081
+ email,
1082
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
1083
+ });
1084
+ }
1085
+ }
1086
+ // Rewritten and re-validated so a change to the template reaches an
1087
+ // existing deployment; identical content is a no-op with no reload.
1088
+ //
1089
+ // ⚠ `maxBodyBytes` must be passed here exactly as install passes it.
1090
+ // Omitting it does not leave the existing value alone -- the vhost is
1091
+ // RE-RENDERED from scratch, so a missing option silently reverts
1092
+ // `client_max_body_size` to the 100m default and every upload larger
1093
+ // than that starts failing with a 413 after an unrelated update.
1094
+ await installVhost(target, {
1095
+ runCommand: context.runCommand,
1096
+ runtime,
1097
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
1098
+ ...(context.env?.get('MAX_FILE_SIZE') === undefined
1099
+ ? {}
1100
+ : { maxBodyBytes: Number(context.env.get('MAX_FILE_SIZE')) }),
1101
+ });
1102
+ },
1103
+ },
1104
+ {
1105
+ id: 'renewal',
1106
+ title: 'Schedule certificate renewal',
1107
+ skip: (context) => {
1108
+ if (context.unchanged === true)
1109
+ return 'already up to date';
1110
+ if (context.options.skipRenewal === true)
1111
+ return 'skipped with --skip-renewal';
1112
+ if (context.options.skipProxy === true)
1113
+ return 'skipped with --skip-proxy';
1114
+ if (context.state.domain === undefined)
1115
+ return 'this deployment is not published';
1116
+ return undefined;
1117
+ },
1118
+ async run(context) {
1119
+ const proxyRoot = proxyRootFor(context);
1120
+ const status = certificateStatus({
1121
+ domain: context.state.domain,
1122
+ bindPort: context.state.bindPort,
1123
+ proxyRoot,
1124
+ });
1125
+ if (!status.exists) {
1126
+ context.journal.line(`No certificate at ${status.path}; nothing to renew yet.`);
1127
+ return;
1128
+ }
1129
+ await scheduleRenewal(context, proxyRoot, await proxyRuntimeOf(context));
1130
+ },
1131
+ },
1132
+ {
1133
+ id: 'verify',
1134
+ title: 'Verify the deployment',
1135
+ skip: skipWhenUnchanged,
1136
+ async run(context) {
1137
+ const report = await collectHealth({
1138
+ runCommand: context.runCommand,
1139
+ deployRoot: context.options.deployRoot,
1140
+ bindPort: context.state.bindPort,
1141
+ ...(composeProjectFor(context.state) === undefined
1142
+ ? {}
1143
+ : { composeProject: composeProjectFor(context.state) }),
1144
+ ...(context.state.domain === undefined || context.options.skipProxy === true
1145
+ ? {}
1146
+ : { domain: context.state.domain }),
1147
+ ...(context.options.fetch === undefined ? {} : { fetch: context.options.fetch }),
1148
+ ...oauthSmokeTarget(context.options.skipOAuthCheck, context.env),
1149
+ groups: groupsOf(context),
1150
+ });
1151
+ if (!isHealthy(report)) {
1152
+ // See install.ts's equivalent comment (#640, #642): the external
1153
+ // HTTPS probe can fail because the proxy is serving a different
1154
+ // certificate than the one on disk, which `deploy certs` is the
1155
+ // command that actually diagnoses.
1156
+ const certHint = report.external !== undefined && !report.external.probe.ok
1157
+ ? ` If the domain shows a certificate/SSL error in a browser, run \`${cliName()} deploy certs --domain ${context.state.domain}\` to check whether the proxy needs reloading.`
1158
+ : '';
1159
+ throw new Error(`The stack restarted but is not healthy. Run \`${cliName()} deploy status\` for the detail.${certHint}`);
1160
+ }
1161
+ reportOAuthSmoke(context, report.oauth);
1162
+ },
1163
+ },
1164
+ {
1165
+ id: 'publish-version',
1166
+ title: 'Publish the release version',
1167
+ // Keyed on what the `version` step actually did, so every reason it did
1168
+ // not bump -- unchanged remote, --no-version-bump, a version already
1169
+ // ahead -- lands here as one condition rather than three.
1170
+ skip: (context) => context.version?.bumped === true ? undefined : 'no version was bumped',
1171
+ async run(context) {
1172
+ // ⚠ PUSH LAST, AFTER VERIFY -- not at the health gate. Pushing to a
1173
+ // shared repository is irreversible and externally visible: a version
1174
+ // not pushed is re-derived next run, while a version pushed for a
1175
+ // deploy that did not finish is a commit someone has to reason about.
1176
+ const result = await publishVersion({
1177
+ checkoutPath: checkoutPathFor(context.options.deployRoot),
1178
+ ref: context.target?.ref ?? context.state?.ref ?? 'main',
1179
+ result: context.version,
1180
+ runCommand: context.runCommand,
1181
+ });
1182
+ // ⚠ A FAILED PUSH IS A WARNING, NEVER A FAILURE. By this point the app
1183
+ // is built, migrated, started, answering and verified. The rollback
1184
+ // keeps the clone level with origin; the deployment keeps the version.
1185
+ context.journal.line(`Publish: ${result.detail}`);
1186
+ if (!result.pushed)
1187
+ context.hooks?.onProgress?.(`warning: ${result.detail}`);
1188
+ },
1189
+ },
1190
+ ];
1191
+ }
1192
+ /**
1193
+ * The recorded state, or one rebuilt from the deployment itself.
1194
+ *
1195
+ * ⚠ An UNREADABLE state file is not an unrecorded deployment: the file is
1196
+ * there and this build cannot interpret it, which is a different problem
1197
+ * deserving a different message. `readState` throws in that case, and this
1198
+ * function deliberately does not catch it.
1199
+ */
1200
+ async function resolveStateForUpdate(options) {
1201
+ const recorded = readState(options.deployRoot);
1202
+ if (recorded !== undefined)
1203
+ return recorded;
1204
+ const evidence = describeEvidence(options.deployRoot);
1205
+ if (!evidence.isDeployment) {
1206
+ // Genuinely nothing here. Name which half is missing rather than asserting
1207
+ // a bare negative the operator cannot act on.
1208
+ const missing = [
1209
+ evidence.hasCheckout ? undefined : 'a checkout at repo/',
1210
+ evidence.hasEnv ? undefined : 'a readable environment file',
1211
+ ].filter((part) => part !== undefined);
1212
+ throw new NotInstalledError(`No deployment found at ${options.deployRoot}: it is missing ${missing.join(' and ')}. ` +
1213
+ `Run \`${cliName()} deploy install\` first, or pass --root if it is somewhere else.`);
1214
+ }
1215
+ // The clone's own origin is the only honest source for these; the CLI must
1216
+ // never name a repository of its own.
1217
+ const target = await resolveRepoTarget({
1218
+ ...(options.ref === undefined ? {} : { refFlag: options.ref }),
1219
+ cwd: join(options.deployRoot, 'repo'),
1220
+ runCommand: options.runCommand ?? defaultRunCommand,
1221
+ });
1222
+ return adoptDeployment({
1223
+ deployRoot: options.deployRoot,
1224
+ repoUrl: target.url,
1225
+ ref: target.ref,
1226
+ // Left empty on purpose: the `fetch` step resolves the real HEAD, and a
1227
+ // guess here would be recorded as the deployed commit.
1228
+ commitSha: '',
1229
+ fallbackBindPort: DEFAULT_ADOPTED_BIND_PORT,
1230
+ });
1231
+ }
1232
+ /** Only used when an adopted `.env` names no APP_BIND_PORT. */
1233
+ const DEFAULT_ADOPTED_BIND_PORT = 3535;
1234
+ export async function runUpdate(options) {
1235
+ // The precondition install does not have, and the reason this is its own
1236
+ // command: nothing to update is a different situation from nothing installed.
1237
+ //
1238
+ // But "nothing to update" is a question about the DEPLOYMENT, not about the
1239
+ // CLI's bookkeeping. Asking the second refused to update a live, serving
1240
+ // deployment because a JSON file was missing -- telling the operator there
1241
+ // was no deployment while they stood in one, and pointing them at `install`,
1242
+ // whose precondition is the opposite. Where the record is missing and the
1243
+ // evidence is there, ADOPT.
1244
+ const loaded = await resolveStateForUpdate(options);
1245
+ // ⚠ BEFORE ANY `composeArgv` CALL: a server installed by a pre-platform CLI
1246
+ // under an app-named project records none, and `composeProjectFor` would
1247
+ // then answer `compose` -- and `up -d` would start a second stack beside the
1248
+ // real one, on the bind port. Docker knows which project the containers are
1249
+ // in; see compose-project.ts. Never fails the update.
1250
+ const reconciled = await reconcileComposeProject({
1251
+ deployRoot: options.deployRoot,
1252
+ state: loaded,
1253
+ runCommand: options.runCommand ?? defaultRunCommand,
1254
+ });
1255
+ const state = reconciled.state ?? loaded;
1256
+ const startedAt = Date.now();
1257
+ const path = envFilePath(options.deployRoot);
1258
+ const journal = openJournal({
1259
+ deployRoot: options.deployRoot,
1260
+ command: 'update',
1261
+ secrets: existsSync(path) ? secretsFrom(parseEnvFile(readFileSync(path, 'utf8'))) : [],
1262
+ });
1263
+ // Announced at once, so a screen can show where the log is while it runs.
1264
+ options.hooks?.onJournal?.(journal.path);
1265
+ if (reconciled.message !== undefined) {
1266
+ journal.line(reconciled.message);
1267
+ options.hooks?.onProgress?.(reconciled.message);
1268
+ }
1269
+ const context = {
1270
+ options,
1271
+ runCommand: options.runCommand ?? defaultRunCommand,
1272
+ journal,
1273
+ hooks: options.hooks,
1274
+ completed: new Set(),
1275
+ // Appended by `runPipeline` as each step finishes; read by `deploy-info`.
1276
+ progress: [],
1277
+ state,
1278
+ ...(existsSync(path) ? { env: parseEnvFile(readFileSync(path, 'utf8')) } : {}),
1279
+ };
1280
+ // The app's steps (`registerDeployStep`, #715) go in after the built-in
1281
+ // step each one names; they see a narrow context, never this one.
1282
+ const steps = withRegisteredSteps('update', buildUpdateSteps(), (step) => appStepContext('update', step, () => environmentOfUpdate(step)));
1283
+ const result = await runPipeline(steps, context);
1284
+ if (result.failed !== undefined) {
1285
+ journal.finish('failure', `${result.failed.id}: ${result.failed.detail ?? ''}`);
1286
+ // The last revision that DEPLOYED. `fetch` has already moved the checkout
1287
+ // (and, on a retry, the checkout's own previous HEAD is the broken
1288
+ // revision), so it is never named here; see `deployedHead`.
1289
+ const previous = context.previousSha ?? state.deployedHead ?? state.commitSha;
1290
+ throw new Error(`${result.failed.title} failed: ${result.failed.detail ?? 'unknown error'}\n` +
1291
+ `The full log is at ${journal.path}\n` +
1292
+ // An honest manual recovery path. A partially-applied migration cannot
1293
+ // be undone by checking out the old code, so this does not pretend to.
1294
+ `To go back to the previous revision: ${cliName()} deploy update --ref ${previous} --force`);
1295
+ }
1296
+ if (context.unchanged === true) {
1297
+ journal.finish('success', 'already up to date');
1298
+ return {
1299
+ changed: false,
1300
+ commitSha: context.commitSha ?? state.commitSha,
1301
+ journalPath: journal.path,
1302
+ durationMs: Date.now() - startedAt,
1303
+ ...shownCredentials(options, context),
1304
+ };
1305
+ }
1306
+ // ⚠ ONLY THIS PATH APPENDS HISTORY: a failed update throws above, and an
1307
+ // unchanged one deployed nothing, so both leave the prior list untouched.
1308
+ const now = new Date().toISOString();
1309
+ const host = await hostFactsOf(context);
1310
+ const runtime = currentRuntime(context);
1311
+ const proxy = await observeProxy({
1312
+ domain: state.domain,
1313
+ bindPort: state.bindPort,
1314
+ proxyRoot: proxyRootFor(context),
1315
+ mode: runtime.mode,
1316
+ container: runtime.container,
1317
+ runCommand: context.runCommand,
1318
+ });
1319
+ // ⚠ MEASURED, NOT COPIED FROM `commitSha`: the version step may have
1320
+ // committed a bump that `publish-version` then pushed or rolled back out.
1321
+ // HEAD now is what the next `fetch` finds for an unmoved remote. Unreadable
1322
+ // means no marker (the previous rule), never a stale one.
1323
+ const deployedHead = await checkoutHead(options.deployRoot, context.runCommand);
1324
+ const history = appendHistory(state.history, {
1325
+ at: now,
1326
+ command: 'update',
1327
+ commitSha: (context.commitSha ?? state.commitSha) || null,
1328
+ previousCommitSha: (context.previousSha ?? state.commitSha) || null,
1329
+ ref: context.target?.ref ?? state.ref ?? null,
1330
+ durationMs: Date.now() - startedAt,
1331
+ cliVersion: cliVersion(),
1332
+ outcome: 'success',
1333
+ });
1334
+ writeState({
1335
+ // `context.state`, not `state`: a step may have recorded something on it
1336
+ // (`database-role` records --allow-superuser, #980).
1337
+ ...context.state,
1338
+ ref: context.target?.ref ?? state.ref,
1339
+ commitSha: context.commitSha ?? state.commitSha,
1340
+ previousSha: context.previousSha,
1341
+ deployedHead,
1342
+ lastDeployedAt: now,
1343
+ lastCommand: 'update',
1344
+ appctlVersion: cliVersion(),
1345
+ // The groups this run acted under: an explicit --group set replaces the
1346
+ // recorded one, and the always-on groups are added either way (#567). The
1347
+ // stack was just brought up with THOSE compose files, so `status`, the
1348
+ // next `update` and `uninstall` must name the same ones.
1349
+ groups: [...groupsOf(context)],
1350
+ // Only when `publish` ran: an update that did not touch the proxy has
1351
+ // learned nothing new about it, and keeps what was recorded.
1352
+ ...(context.proxyRuntime === undefined
1353
+ ? {}
1354
+ : { proxyMode: context.proxyRuntime.mode, proxyContainer: context.proxyRuntime.container }),
1355
+ host,
1356
+ history,
1357
+ proxy,
1358
+ });
1359
+ // The end-of-run rewrite of info.json; see install.ts's for why.
1360
+ const info = writeDeployInfo(options.deployRoot, {
1361
+ ...updateDeployInfo(context, now),
1362
+ proxy: proxyInfoOf(proxy),
1363
+ host,
1364
+ history,
1365
+ });
1366
+ journal.line(info.written
1367
+ ? `Wrote ${info.path}`
1368
+ : `warning: could not write ${info.path}: ${info.error ?? 'unknown'}`);
1369
+ journal.finish('success');
1370
+ return {
1371
+ changed: true,
1372
+ ...(context.previousSha === undefined ? {} : { previousSha: context.previousSha }),
1373
+ commitSha: context.commitSha ?? state.commitSha,
1374
+ journalPath: journal.path,
1375
+ durationMs: Date.now() - startedAt,
1376
+ ...shownCredentials(options, context),
1377
+ };
1378
+ }
1379
+ /** The credentials a run provisioned, when -- and only when -- `--show-credentials` asked. */
1380
+ function shownCredentials(options, context) {
1381
+ return options.showCredentials === true && context.appCredentials !== undefined
1382
+ ? { credentials: context.appCredentials }
1383
+ : {};
1384
+ }
1385
+ //# sourceMappingURL=update.js.map