@marinoscar/platform-cli 0.0.0-stage → 0.1.0-next.11

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