@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,1318 @@
1
+ import { existsSync, mkdirSync, readFileSync, rmSync } 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, checksPassed, gitCredentialStateFor, requiredChecks, runChecks, } from './checks/index.js';
6
+ import { parseEnvExample, parseEnvFile } from './env-spec.js';
7
+ import { composeFileArgs, composeFilesFor, effectiveGroups } from './compose-files.js';
8
+ import { writeEnvContents, writeEnvFile } from './env-file.js';
9
+ import { isDeployment } from './deployment-evidence.js';
10
+ import { runEnvWizard } from './env-wizard.js';
11
+ import { runCommand as defaultRunCommand } from './executor.js';
12
+ import { canObtainConsent, consented, obtainConsent, } from './consent.js';
13
+ import { ensureApplicationRole, loginHelpMetadata, plannedRoleName, provisioningMetadata, resolveAdminLogin, roleOptionsFrom, superuserRecord, } from './app-role.js';
14
+ import { ensureDatabase, onlyDatabaseMissing, unattendedDatabaseRefusal } from './database.js';
15
+ import { waitForHealthy, collectHealth, isHealthy } from './health.js';
16
+ import { runOAuthCheck } from './oauth-check.js';
17
+ import { bootstrapProxy, ensureExternalNetworks, externalNetworksIn, inspectProxy, } from './proxy-bootstrap.js';
18
+ import { ensureRenewal } from './renewal.js';
19
+ import { openJournal } from './journal.js';
20
+ import { bootstrapProxyRoot, certificateStatus, describeProxyRuntime, installVhost, issueCertificate, resolveRecordedProxyRuntime, } from './proxy.js';
21
+ import { checkoutHead, ensureCheckout, resolveRepoTarget, resolveRepoUrl } from './repo.js';
22
+ import { explainComposeFailure } from './compose-hints.js';
23
+ import { DEPLOY_STATE_VERSION, 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 { metadataFor } from './env-metadata.js';
32
+ /**
33
+ * The environment this run acts on: the wizard's, or -- on a resumed run that
34
+ * skipped the `environment` step -- the file on disk.
35
+ */
36
+ function environmentOf(context) {
37
+ if (context.env !== undefined)
38
+ return context.env;
39
+ const path = envFilePath(context.options.deployRoot);
40
+ return existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
41
+ }
42
+ /** The question the proxy-bootstrap gate asks. */
43
+ function bootstrapQuestion(proxyRoot, container) {
44
+ return (`This server has no shared reverse proxy. Create one in ${proxyRoot} ` +
45
+ `(nginx container "${container}" on ports 80/443, serving every application on this host)?`);
46
+ }
47
+ /** The refusal when the proxy is absent and nobody consented to create it. */
48
+ function bootstrapRefusal(outcome, proxyRoot) {
49
+ return new PreconditionError((outcome === 'declined'
50
+ ? 'Creating the shared proxy was declined.'
51
+ : 'This server has no shared reverse proxy, and nothing could be asked in this mode.') +
52
+ ` Re-run with --bootstrap-proxy to have install create it in ${proxyRoot}, ` +
53
+ `bring up an existing one (cd ${proxyRoot} && docker compose up -d), or pass --skip-proxy.`);
54
+ }
55
+ /**
56
+ * The proxy runtime this run acts under, resolved ONCE and then reused, so the
57
+ * preflight, the certificate and the vhost can never disagree about it.
58
+ */
59
+ async function proxyRuntimeOf(context) {
60
+ if (context.proxyRuntime !== undefined)
61
+ return context.proxyRuntime;
62
+ const runtime = await resolveRecordedProxyRuntime({
63
+ proxyRoot: context.options.proxyRoot,
64
+ flags: { mode: context.options.proxyMode, container: context.options.proxyContainer },
65
+ recorded: context.recordedProxy,
66
+ runCommand: context.runCommand,
67
+ });
68
+ context.proxyRuntime = runtime;
69
+ context.journal.line(describeProxyRuntime(runtime));
70
+ return runtime;
71
+ }
72
+ /**
73
+ * The host facts for this run, collected ONCE on first use and then reused, so
74
+ * the health-gate info.json and the final state/info.json agree. Lazy rather
75
+ * than up front: by the health gate Docker is demonstrably there to answer.
76
+ */
77
+ async function hostFactsOf(context) {
78
+ context.hostFacts ??= await collectHostFacts({ runCommand: context.runCommand });
79
+ return context.hostFacts;
80
+ }
81
+ /**
82
+ * The info.json input for this run, as known at `at`.
83
+ *
84
+ * One builder for both writes -- the health gate and the end of a successful
85
+ * run -- so the second can only ADD what the run learned since (the new
86
+ * history entry, the certificate), never describe the deployment differently.
87
+ */
88
+ function installDeployInfo(context, at) {
89
+ const existing = context.existingState;
90
+ const runtime = recordedRuntime(context);
91
+ const domain = context.options.domain;
92
+ return {
93
+ name: basename(context.options.deployRoot),
94
+ ...(context.version?.version === undefined ? {} : { version: context.version.version }),
95
+ ...(context.commitSha === undefined ? {} : { commitSha: context.commitSha }),
96
+ ...(context.target?.ref === undefined ? {} : { ref: context.target.ref }),
97
+ // The first install is `at`; a --reinstall keeps the original.
98
+ installedAt: existing?.installedAt ?? at,
99
+ updatedAt: at,
100
+ cliVersion: cliVersion(),
101
+ ...(domain === undefined ? {} : { domain }),
102
+ // What THIS run has finished so far -- not the resume set, which is what a
103
+ // PREVIOUS run finished.
104
+ completed: [...(context.progress ?? [])],
105
+ lastCommand: 'install',
106
+ bindPort: context.options.bindPort,
107
+ // Before `publish` the certificate is whatever a previous run observed for
108
+ // the SAME domain; the end-of-run rewrite replaces it with a fresh read.
109
+ proxy: proxyInfoOf(domain === undefined
110
+ ? undefined
111
+ : {
112
+ domain,
113
+ bindPort: context.options.bindPort,
114
+ mode: runtime.proxyMode ?? null,
115
+ container: runtime.proxyContainer ?? null,
116
+ certificateExpiresAt: existing?.proxy?.domain === domain ? existing.proxy.certificateExpiresAt : null,
117
+ }),
118
+ ...(context.hostFacts === undefined ? {} : { host: context.hostFacts }),
119
+ // Success-only: THIS run is not in it until it has succeeded.
120
+ history: existing?.history ?? [],
121
+ };
122
+ }
123
+ /** The state fields that record the runtime, when one was resolved. */
124
+ function recordedRuntime(context) {
125
+ const runtime = context.proxyRuntime;
126
+ // A run that never touched the proxy keeps whatever was recorded before.
127
+ if (runtime === undefined)
128
+ return context.recordedProxy ?? {};
129
+ return { proxyMode: runtime.mode, proxyContainer: runtime.container };
130
+ }
131
+ export function composeCwd(deployRoot) {
132
+ // The relative build contexts in base.compose.yml (`../..`, `../nginx`)
133
+ // resolve against the COMPOSE FILE's directory, so this is not incidental.
134
+ return join(deployRoot, 'repo', 'infra', 'compose');
135
+ }
136
+ /**
137
+ * The compose project name for a deployment.
138
+ *
139
+ * ⚠ THIS IS AN OUTAGE WAITING TO HAPPEN IF GOT WRONG, so read before changing.
140
+ *
141
+ * Without `-p`, Compose derives the project name from the compose file's
142
+ * DIRECTORY, which is `compose` for every deployment on the host -- so two
143
+ * applications collide on one project and each `up -d` fights the other. That
144
+ * is the bug this fixes.
145
+ *
146
+ * But naming an EXISTING deployment's project renames it, and Compose then
147
+ * sees no existing containers: it builds a parallel stack that collides with
148
+ * the old one still holding the bind port. A bookkeeping change would have
149
+ * caused an outage.
150
+ *
151
+ * So the name is RECORDED, never derived at the call site. A deployment that
152
+ * was installed before this existed stays on `compose` for ever; only a fresh
153
+ * install gets its own name. `state.composeProject` is the record, and the
154
+ * absence of it means `compose` -- which is exactly what every deployment in
155
+ * the field has.
156
+ */
157
+ export const LEGACY_COMPOSE_PROJECT = 'compose';
158
+ export function composeProjectFor(state) {
159
+ return state?.composeProject ?? LEGACY_COMPOSE_PROJECT;
160
+ }
161
+ /**
162
+ * The full `docker compose` argv for this deployment.
163
+ *
164
+ * `groups` are the deployment's groups -- this run's flag, else what install
165
+ * recorded -- and decide which compose files take part; see compose-files.ts.
166
+ * The always-on telemetry files are included whatever is passed (#567).
167
+ */
168
+ export function composeArgv(extra, project, groups, composeDir) {
169
+ return [
170
+ 'docker',
171
+ 'compose',
172
+ ...(project === undefined ? [] : ['-p', project]),
173
+ // With the checkout's compose dir, the app's overlays come last (#714).
174
+ ...composeFileArgs(groups, composeDir),
175
+ ...extra,
176
+ ];
177
+ }
178
+ /**
179
+ * Creates every directory compose bind-mounts from, before compose runs.
180
+ *
181
+ * =============================================================================
182
+ * ⚠ CALLED BEFORE **EVERY** COMPOSE INVOCATION, NOT JUST BEFORE `up`
183
+ * =============================================================================
184
+ *
185
+ * Docker creates a missing bind SOURCE itself, as `root:root`, the moment it
186
+ * instantiates the service that mounts it -- and
187
+ * `compose run --rm --no-deps api` instantiates the api service just as thoroughly as `up` does. So
188
+ * `migrate`, two steps before `start`, was already creating
189
+ * `<deployRoot>/deploy-info` owned by root; the `mkdirSync` at `start` then
190
+ * no-opped on a directory that already existed, and the `deploy-info` step
191
+ * later got EACCES writing into it.
192
+ *
193
+ * Every step reported green. The deployment was up, healthy and serving; only
194
+ * the About page was permanently empty, and the one line saying why was a
195
+ * warning in a journal nobody reads on a successful run.
196
+ *
197
+ * Guarding the ORDER was the original fix and it was the wrong shape: it left
198
+ * the invariant depending on which step happens to come first, so adding a
199
+ * compose call earlier in the pipeline silently reintroduces the bug. Guarding
200
+ * the CALL makes that unrepresentable. `mkdirSync` with `recursive` is a no-op
201
+ * when the directory is already there, so the cost is one syscall.
202
+ */
203
+ function ensureBindSources(deployRoot) {
204
+ mkdirSync(join(deployRoot, 'deploy-info'), { recursive: true });
205
+ }
206
+ function envFilePath(deployRoot) {
207
+ return join(composeCwd(deployRoot), '.env');
208
+ }
209
+ /**
210
+ * What the wizard will start from: the `.env` on disk, with the caller's
211
+ * non-blank answers over it. Shared by the `environment` step and preflight's
212
+ * database gate (#396), so the gate probes the settings the run will write.
213
+ */
214
+ function plannedEnvironment(options) {
215
+ const path = envFilePath(options.deployRoot);
216
+ const onDisk = existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
217
+ // Answers supplied by a caller win over what is on disk: they are the
218
+ // more recent statement of intent.
219
+ //
220
+ // A BLANK ANSWER IS NOT AN ANSWER, though, and this is the guard that
221
+ // says so. The TUI collects every essential key into a form and hands
222
+ // the whole map over, so a field the operator left alone arrives as
223
+ // `''`. Letting that beat the on-disk value means a re-install over a
224
+ // live deployment overwrites the secrets it did not ask about - and for
225
+ // `SECRETS_ENCRYPTION_KEY` that makes every credential encrypted under
226
+ // the old key permanently undecryptable, with no visible symptom.
227
+ //
228
+ // Dropping blanks here means "leave it as it is" survives the round
229
+ // trip, which is what an untouched field means in every UI anyone has
230
+ // ever used.
231
+ if (options.answers === undefined)
232
+ return onDisk;
233
+ const supplied = [...options.answers].filter(([, value]) => value !== '');
234
+ return new Map([...(onDisk ?? new Map()), ...supplied]);
235
+ }
236
+ /**
237
+ * The POSTGRES_* keys that must all be known, non-blank, before checkout for
238
+ * preflight to probe the database (#396). POSTGRES_SSL is left out: absent
239
+ * means `false` both here and in the template.
240
+ */
241
+ const PRE_CHECKOUT_DATABASE_KEYS = [
242
+ 'POSTGRES_HOST',
243
+ 'POSTGRES_PORT',
244
+ 'POSTGRES_USER',
245
+ 'POSTGRES_PASSWORD',
246
+ 'POSTGRES_DB',
247
+ ];
248
+ /**
249
+ * The environment preflight may probe the database with, or undefined when
250
+ * the settings are not knowable until the wizard has run -- a first install
251
+ * whose answers leave a POSTGRES_* key to the template, which is not on disk
252
+ * until `checkout`. A template default is never guessed at here: probing a
253
+ * database the run will not use could refuse an install that would work.
254
+ */
255
+ function preCheckoutDatabaseEnvironment(options) {
256
+ const env = plannedEnvironment(options);
257
+ if (env === undefined)
258
+ return undefined;
259
+ return PRE_CHECKOUT_DATABASE_KEYS.every((key) => (env.get(key) ?? '') !== '') ? env : undefined;
260
+ }
261
+ /** Secrets for the journal's redactor, from the metadata rather than a guess. */
262
+ export function secretsFrom(env) {
263
+ return [...env.entries()]
264
+ .filter(([key]) => metadataFor(key).secret === true)
265
+ .map(([key, value]) => ({ key, value }));
266
+ }
267
+ async function compose(context, extra, options) {
268
+ ensureBindSources(context.options.deployRoot);
269
+ await ensureStackNetworks(context, extra, context.options.groups);
270
+ const argv = composeArgv(extra, context.composeProject, context.options.groups, composeCwd(context.options.deployRoot));
271
+ let result;
272
+ try {
273
+ result = await context.runCommand(argv, {
274
+ cwd: composeCwd(context.options.deployRoot),
275
+ timeoutMs: options?.timeoutMs ?? 30 * 60_000,
276
+ redact: context.journal.redact,
277
+ ...(context.hooks?.onLog === undefined
278
+ ? {}
279
+ : { onLine: (line) => context.hooks?.onLog?.(line) }),
280
+ });
281
+ }
282
+ catch (error) {
283
+ // See compose-hints.ts: a required compose variable with no value.
284
+ throw explainComposeFailure(error, join(composeCwd(context.options.deployRoot), '.env'));
285
+ }
286
+ context.journal.command(result);
287
+ }
288
+ /** Compose subcommands that instantiate services, and so need their networks. */
289
+ const INSTANTIATING = new Set(['up', 'run', 'create', 'start', 'restart']);
290
+ /**
291
+ * Ensures the stack's external networks exist before the FIRST compose call
292
+ * that instantiates a service -- `migrate`'s `compose run`, before `start`'s
293
+ * `up`. Once per run (`networksEnsured`), and guarded on the CALL for the same
294
+ * reason `ensureBindSources` is: an earlier compose step added later cannot
295
+ * reintroduce the fresh-box failure. Shared with update.
296
+ */
297
+ export async function ensureStackNetworks(context, extra, groups) {
298
+ if (context.networksEnsured === true || !INSTANTIATING.has(extra[0] ?? ''))
299
+ return;
300
+ const composeDir = composeCwd(context.options.deployRoot);
301
+ await ensureExternalNetworks({
302
+ // The same files the compose call itself will use; see compose-files.ts.
303
+ composeFiles: composeFilesFor(groups, composeDir).map((file) => join(composeDir, file)),
304
+ runCommand: context.runCommand,
305
+ onLine: (line) => context.journal.line(line),
306
+ });
307
+ context.networksEnsured = true;
308
+ }
309
+ /**
310
+ * Preflight's database gate (#396): the refusal `ensure-database` is certain
311
+ * to give, or undefined. Asks nothing and creates nothing; see the call site.
312
+ */
313
+ async function preflightDatabaseRefusal(context) {
314
+ if (canObtainConsent(consentOptions(context, context.options.createDatabase)))
315
+ return undefined;
316
+ const env = preCheckoutDatabaseEnvironment(context.options);
317
+ if (env === undefined) {
318
+ context.journal.line('Database settings are not known until the environment is configured; ensure-database will check.');
319
+ return undefined;
320
+ }
321
+ // The existence checks carry the password in PGPASSWORD; a fresh journal
322
+ // has not seen it yet, and a psql error must not put it in the log.
323
+ context.journal.addSecrets?.(secretsFrom(env));
324
+ return await unattendedDatabaseRefusal({
325
+ env,
326
+ runCommand: context.runCommand,
327
+ envPath: envFilePath(context.options.deployRoot),
328
+ onLine: (line) => context.journal.line(line),
329
+ });
330
+ }
331
+ export function buildInstallSteps() {
332
+ return [
333
+ {
334
+ id: 'preflight',
335
+ title: 'Check prerequisites',
336
+ skip: (context) => context.options.skipDoctor === true
337
+ ? 'skipped with --skip-doctor'
338
+ : undefined,
339
+ async run(context) {
340
+ // Create the shared proxy's directory layout BEFORE the checks that
341
+ // look for it. Both the spec and the runbook promise install does this;
342
+ // until now the checks simply failed instead, so an operator following
343
+ // the documentation on a fresh VPS hit a refusal it told them would not
344
+ // happen. Directories only -- the proxy itself is shared infrastructure
345
+ // this deployment is a tenant of, not an owner of.
346
+ if (context.options.skipProxy !== true) {
347
+ const { created } = bootstrapProxyRoot(context.options.proxyRoot, context.hooks);
348
+ for (const path of created)
349
+ context.journal.line(`Created ${path}`);
350
+ }
351
+ // The repository `checkout` will clone, by the same precedence, and
352
+ // whether git can already read it. Probed ONCE here because it decides
353
+ // whether gh-installed/gh-authenticated are required (#390): an HTTPS
354
+ // GitHub URL git cannot read would otherwise stop the clone at an
355
+ // authentication prompt, after this preflight said it was fine.
356
+ const repoUrl = await resolveRepoUrl({
357
+ cwd: context.options.cwd ?? process.cwd(),
358
+ runCommand: context.runCommand,
359
+ ...(context.options.repo === undefined ? {} : { repoFlag: context.options.repo }),
360
+ });
361
+ const gitCredentialed = await gitCredentialStateFor(repoUrl, context.runCommand);
362
+ // #391: a box with no proxy at all is bootstrappable -- ask NOW, with
363
+ // the other questions, rather than after a four-minute build. Consent
364
+ // lets the proxy-container check stand down; the `proxy-bootstrap`
365
+ // step does the work later, just before `publish`.
366
+ const runtime = await proxyRuntimeOf(context);
367
+ if (context.options.skipProxy !== true &&
368
+ context.options.domain !== undefined &&
369
+ runtime.mode === 'container') {
370
+ const presence = await inspectProxy({
371
+ proxyRoot: context.options.proxyRoot,
372
+ runtime,
373
+ runCommand: context.runCommand,
374
+ });
375
+ if (presence.state === 'absent') {
376
+ context.proxyBootstrapConsent = await obtainConsent(bootstrapQuestion(context.options.proxyRoot, runtime.container), consentOptions(context, context.options.bootstrapProxy));
377
+ context.journal.line(`Shared proxy absent; bootstrap consent: ${context.proxyBootstrapConsent}`);
378
+ }
379
+ }
380
+ const checkContext = {
381
+ runCommand: context.runCommand,
382
+ deployRoot: context.options.deployRoot,
383
+ bindPort: context.options.bindPort,
384
+ // What this install will record, so install and doctor agree.
385
+ composeProject: context.composeProject,
386
+ proxyRoot: context.options.proxyRoot,
387
+ // Resolved before the checks, because it decides which of them are
388
+ // required: certbot-installed only on the host, renewal-path hygiene
389
+ // only in a container.
390
+ proxyRuntime: runtime,
391
+ ...(context.options.domain === undefined
392
+ ? {}
393
+ : { domain: context.options.domain }),
394
+ ...(repoUrl === undefined ? {} : { repoUrl }),
395
+ ...(gitCredentialed === undefined ? {} : { gitCredentialed }),
396
+ ...(context.options.skipProxy === true ? { skipProxy: true } : {}),
397
+ ...(context.proxyBootstrapConsent !== undefined && consented(context.proxyBootstrapConsent)
398
+ ? { proxyBootstrap: true }
399
+ : {}),
400
+ };
401
+ const results = await runChecks(requiredChecks(allChecks(), checkContext), checkContext);
402
+ for (const result of results) {
403
+ context.journal.line(`${result.status} ${result.id}: ${result.detail}`);
404
+ }
405
+ // #396: a missing database is a QUESTION, and `ensure-database` asks
406
+ // it -- after `validate-environment`, with the settings the wizard
407
+ // actually wrote. The one case decided HERE is the one whose answer is
408
+ // already certain: nobody can be asked (--non-interactive, no
409
+ // terminal) and --create-database was not given, so the install is
410
+ // bound to stop at `ensure-database` -- and stopping now spares the
411
+ // clone. Only when the settings are knowable before checkout (a
412
+ // re-install's `.env`, or answers naming every POSTGRES_* key); on a
413
+ // first install that leaves one to the template, the refusal still
414
+ // comes from `ensure-database`, before anything is built or migrated.
415
+ // Never prompts: an interactive run is asked later, once.
416
+ const databaseRefusal = await preflightDatabaseRefusal(context);
417
+ if (!checksPassed(results) || databaseRefusal !== undefined) {
418
+ const failed = results.filter((result) => result.status === 'fail');
419
+ // Aborts BEFORE anything is cloned or written.
420
+ throw new PreconditionError(`Prerequisites not met:\n` +
421
+ [
422
+ ...failed.map((result) => ` - ${result.id}: ${result.detail}\n ${result.remedy ?? ''}`),
423
+ ...(databaseRefusal === undefined
424
+ ? []
425
+ : [` - database-exists: ${databaseRefusal.message.split('\n').join('\n ')}`]),
426
+ ].join('\n') +
427
+ `\nRun \`${cliName()} deploy doctor\` for the full report.`);
428
+ }
429
+ },
430
+ },
431
+ {
432
+ id: 'checkout',
433
+ title: 'Fetch the application',
434
+ async run(context) {
435
+ const target = await resolveRepoTarget({
436
+ cwd: context.options.cwd ?? process.cwd(),
437
+ runCommand: context.runCommand,
438
+ ...(context.options.repo === undefined ? {} : { repoFlag: context.options.repo }),
439
+ ...(context.options.ref === undefined ? {} : { refFlag: context.options.ref }),
440
+ });
441
+ context.journal.line(`Deploying ${target.url} @ ${target.ref} (${target.source})`);
442
+ const checkout = await ensureCheckout(target, {
443
+ deployRoot: context.options.deployRoot,
444
+ runCommand: context.runCommand,
445
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
446
+ ...(context.options.force === undefined ? {} : { force: context.options.force }),
447
+ });
448
+ context.target = target;
449
+ context.checkoutPath = checkout.path;
450
+ context.commitSha = checkout.sha;
451
+ context.journal.line(`Checked out ${checkout.sha}`);
452
+ },
453
+ },
454
+ {
455
+ id: 'environment',
456
+ title: 'Configure the environment',
457
+ async run(context) {
458
+ const templatePath = join(context.options.deployRoot, 'repo', 'infra', 'compose', '.env.example');
459
+ const specs = parseEnvExample(readFileSync(templatePath, 'utf8'));
460
+ const path = envFilePath(context.options.deployRoot);
461
+ // On disk, with the caller's non-blank answers over it -- see
462
+ // plannedEnvironment for why a blank answer is not an answer.
463
+ const existing = plannedEnvironment(context.options);
464
+ const domain = context.options.domain;
465
+ if (domain === undefined && context.options.skipProxy !== true) {
466
+ throw new UsageError('A domain is required so APP_URL and the OAuth callback can be derived. Pass --domain.');
467
+ }
468
+ // #980: an explicitly named administrative login (--admin-user) is the
469
+ // one that provisions; POSTGRES_USER / POSTGRES_PASSWORD are then the
470
+ // APPLICATION's, decided below, and not asked.
471
+ const admin = await resolveAdminLogin(context.options, {
472
+ promptContext: context.options.promptContext,
473
+ nonInteractive: context.options.nonInteractive,
474
+ });
475
+ const onDisk = existsSync(path) ? parseEnvFile(readFileSync(path, 'utf8')) : undefined;
476
+ const { values } = await runEnvWizard({
477
+ specs,
478
+ // With --skip-proxy and no --domain there is no public hostname to
479
+ // derive from, and localhost is the honest stand-in: APP_URL and the
480
+ // OAuth callback then point where the stack actually answers.
481
+ domain: domain ?? 'localhost',
482
+ ...(admin === undefined || context.options.skipRoleProvisioning === true
483
+ ? context.options.skipRoleProvisioning === true
484
+ ? {}
485
+ : { metadata: loginHelpMetadata }
486
+ : {
487
+ metadata: provisioningMetadata(plannedRoleName({
488
+ flag: context.options.appDbUser,
489
+ recordedUser: onDisk?.get('POSTGRES_USER'),
490
+ adminUser: admin.user,
491
+ })),
492
+ }),
493
+ ...(existing === undefined ? {} : { existing }),
494
+ ...(context.options.all === undefined ? {} : { all: context.options.all }),
495
+ ...(context.options.nonInteractive === undefined
496
+ ? {}
497
+ : { nonInteractive: context.options.nonInteractive }),
498
+ ...(context.options.groups === undefined ? {} : { groups: context.options.groups }),
499
+ ...(context.options.promptContext === undefined
500
+ ? {}
501
+ : { ctx: context.options.promptContext }),
502
+ });
503
+ values.set('APP_BIND_PORT', String(context.options.bindPort));
504
+ // ⚠ THE CLI'S OWN KEY, AND THE BIND MOUNT DOES NOT WORK WITHOUT IT.
505
+ //
506
+ // `DEPLOY_ROOT` was READ in three places and written in none:
507
+ //
508
+ // - `vps.compose.yml` interpolates it for the deploy-info bind mount
509
+ // source. Unset, it falls back to `./.deploy/deploy-info` --
510
+ // relative to the compose directory -- so the api container mounts
511
+ // an empty directory Docker created, and the About page reports
512
+ // `absent` for ever. Every step still reports green, because the
513
+ // stack is up and the fallback path is perfectly valid.
514
+ // - `layout.ts` uses it as the marker identifying an `.env` THIS CLI
515
+ // wrote, so `deploy list` and the ambiguity refusal labelled every
516
+ // deployment we had written as unmarked.
517
+ // - `version-step.ts`'s comment describes it as already being there.
518
+ //
519
+ // It is deliberately absent from `.env.example` -- that is what makes
520
+ // it a usable marker, since a stranger's file cannot have it -- so it
521
+ // lands under the serializer's own `# Not in .env.example` banner.
522
+ //
523
+ // ⚠ `COMPOSE_PROJECT_NAME` is deliberately NOT written here. The
524
+ // project name reaches compose through `-p` on every invocation this
525
+ // CLI makes, and writing it into an EXISTING deployment's `.env`
526
+ // renames the project: compose then sees no existing containers,
527
+ // builds a parallel stack, and collides with the old one on the bind
528
+ // port. That is an outage caused by a bookkeeping change, and `-p`
529
+ // already solves the problem it would solve.
530
+ values.set('DEPLOY_ROOT', context.options.deployRoot);
531
+ // ⚠ BEFORE ANYTHING USES THEM, and BEFORE the provisioning below replaces
532
+ // the login the operator typed: the redactor learns the entered password
533
+ // (it may be an administrator's) and the administrative one, so no line
534
+ // of this run can carry either.
535
+ context.journal.addSecrets([
536
+ ...secretsFrom(values),
537
+ ...(admin === undefined ? [] : [{ key: 'DB_ADMIN_PASSWORD', value: admin.password }]),
538
+ ]);
539
+ // #980: the API must not run as the operator's (often superuser) login.
540
+ // Detect a privileged one, offer a dedicated role, provision it with the
541
+ // login used ONCE and held in memory, and write the role's generated
542
+ // credentials instead. The administrator never reaches `.env`.
543
+ //
544
+ // ⚠ THE STORE IS WRITTEN BEFORE THE SERVER'S PASSWORD CHANGES, and put
545
+ // back if that fails: `values` is complete here (APP_BIND_PORT and
546
+ // DEPLOY_ROOT are set above), so what lands on disk first is a whole
547
+ // `.env`, not a fragment.
548
+ const previousEnvironment = existsSync(path) ? readFileSync(path, 'utf8') : undefined;
549
+ const role = await ensureApplicationRole({
550
+ env: values,
551
+ ...(onDisk === undefined ? {} : { recordedEnv: onDisk }),
552
+ runCommand: context.runCommand,
553
+ onLine: (line) => context.journal.line(line),
554
+ onSecrets: (secrets) => context.journal.addSecrets(secrets),
555
+ store: {
556
+ write: (credentials) => {
557
+ values.set('POSTGRES_USER', credentials.user);
558
+ values.set('POSTGRES_PASSWORD', credentials.password);
559
+ mkdirSync(composeCwd(context.options.deployRoot), { recursive: true });
560
+ writeEnvFile(path, values, specs);
561
+ },
562
+ restore: () => {
563
+ if (previousEnvironment === undefined)
564
+ rmSync(path, { force: true });
565
+ else
566
+ writeEnvContents(path, previousEnvironment);
567
+ },
568
+ },
569
+ whenNotConsented: 'refuse',
570
+ ...roleOptionsFrom(context.options, admin),
571
+ });
572
+ context.journal.line(`Database role: ${role.outcome}: ${role.detail}`);
573
+ if (role.outcome === 'superuser-allowed') {
574
+ const warning = `warning: --allow-superuser: ${values.get('POSTGRES_USER') ?? 'the database login'} bypasses row-level security. Tenant isolation is OFF.`;
575
+ context.journal.line(warning);
576
+ context.hooks?.onProgress?.(warning);
577
+ context.superuserKept = values.get('POSTGRES_USER');
578
+ }
579
+ if (role.credentials !== undefined) {
580
+ values.set('POSTGRES_USER', role.credentials.user);
581
+ values.set('POSTGRES_PASSWORD', role.credentials.password);
582
+ context.appCredentials = role.credentials;
583
+ context.hooks?.onProgress?.(`Database role "${role.credentials.user}" is ready; its generated password is saved to .env only.`);
584
+ }
585
+ mkdirSync(composeCwd(context.options.deployRoot), { recursive: true });
586
+ writeEnvFile(path, values, specs);
587
+ context.env = values;
588
+ // ⚠ BEFORE ANYTHING USES THEM. A fresh install's journal was opened
589
+ // with no secrets (there was no .env to seed it from); the OAuth probe
590
+ // in the next step sends GOOGLE_CLIENT_SECRET over the network, and an
591
+ // error quoting the request must not put it in the log.
592
+ context.journal.addSecrets(secretsFrom(values));
593
+ context.journal.line(`Wrote ${path} (${values.size} variables)`);
594
+ },
595
+ },
596
+ {
597
+ id: 'validate-environment',
598
+ title: 'Validate the environment',
599
+ async run(context) {
600
+ if (context.env === undefined)
601
+ return;
602
+ const results = await runChecks(allChecks().filter((check) => check.id.startsWith('database-')), {
603
+ runCommand: context.runCommand,
604
+ deployRoot: context.options.deployRoot,
605
+ bindPort: context.options.bindPort,
606
+ composeProject: context.composeProject,
607
+ proxyRoot: context.options.proxyRoot,
608
+ env: context.env,
609
+ ...(context.options.allowSuperuser === true ? { allowSuperuser: true } : {}),
610
+ });
611
+ for (const result of results) {
612
+ context.journal.line(`${result.status} ${result.id}: ${result.detail}`);
613
+ // A warned `database-role-ordinary` is --allow-superuser: say it on screen too.
614
+ if (result.id === 'database-role-ordinary' && result.status === 'warn') {
615
+ context.hooks?.onProgress?.(`warning: ${result.detail}`);
616
+ }
617
+ }
618
+ if (checksPassed(results)) {
619
+ context.database = 'exists';
620
+ }
621
+ else if (onlyDatabaseMissing(results)) {
622
+ // #391: the ONE failure `ensure-database` may act on -- reachable,
623
+ // authenticated, and only the database itself absent. Deferred, not
624
+ // thrown; every other failure still stops the install right here.
625
+ context.database = 'missing';
626
+ context.journal.line('The database does not exist yet; ensure-database decides what to do about it.');
627
+ }
628
+ else {
629
+ throw new PreconditionError(`The database is not usable with these settings:\n` +
630
+ results
631
+ .filter((result) => result.status === 'fail')
632
+ .map((result) => ` - ${result.detail}\n ${result.remedy ?? ''}`)
633
+ .join('\n'));
634
+ }
635
+ // #391: the OAuth credentials, BEFORE the build -- a wrong secret was
636
+ // otherwise found by the first user to sign in, after everything.
637
+ const oauth = await runOAuthCheck({
638
+ env: context.env,
639
+ ...(context.options.domain === undefined ? {} : { domain: context.options.domain }),
640
+ skipLiveProbe: context.options.skipOAuthCheck === true,
641
+ ...(context.options.fetch === undefined ? {} : { fetch: context.options.fetch }),
642
+ });
643
+ for (const finding of oauth.findings) {
644
+ context.journal.line(`${finding.status} ${finding.id}: ${finding.detail}`);
645
+ if (finding.status === 'warn') {
646
+ context.hooks?.onProgress?.(`warning: ${finding.detail}`);
647
+ }
648
+ }
649
+ if (!oauth.ok) {
650
+ throw new PreconditionError('The Google OAuth settings would fail every sign-in:\n' +
651
+ oauth.findings
652
+ .filter((finding) => finding.status === 'fail')
653
+ .map((finding) => ` - ${finding.detail}\n ${finding.remedy ?? ''}`)
654
+ .join('\n') +
655
+ '\nFix them in the environment file (or pass --skip-oauth-check for placeholder credentials), then re-run with --resume.');
656
+ }
657
+ },
658
+ },
659
+ {
660
+ id: 'ensure-database',
661
+ title: 'Make sure the database exists',
662
+ async run(context) {
663
+ // Already known to exist: no second round of psql containers.
664
+ if (context.database === 'exists')
665
+ return;
666
+ const env = environmentOf(context);
667
+ if (env === undefined) {
668
+ context.journal.line('No environment file; nothing to check.');
669
+ return;
670
+ }
671
+ // #396: the one "offer, create, re-verify" implementation -- see
672
+ // ensureDatabase's own comment.
673
+ const result = await ensureDatabase({
674
+ env,
675
+ runCommand: context.runCommand,
676
+ createDatabase: context.options.createDatabase,
677
+ ...(context.options.allowSuperuser === true ? { allowSuperuser: true } : {}),
678
+ ...consentOptions(context),
679
+ envPath: envFilePath(context.options.deployRoot),
680
+ onLine: (line) => context.journal.line(line),
681
+ });
682
+ context.database = 'exists';
683
+ context.journal.line(result.detail);
684
+ if (result.outcome === 'created')
685
+ context.hooks?.onProgress?.(result.detail);
686
+ },
687
+ },
688
+ {
689
+ id: 'version',
690
+ title: 'Choose the release version',
691
+ // ⚠ NO `skip` FOR --no-version-bump. The flag means "do not bump", not
692
+ // "do not stamp": the step still writes the clone's CURRENT version into
693
+ // the `.env`, because skipping it entirely would leave the container
694
+ // reporting whatever APP_VERSION the last deploy happened to set.
695
+ async run(context) {
696
+ // ⚠ IMMEDIATELY BEFORE `build`, AND IT COMMITS. The checkout step
697
+ // refuses a dirty tree, so leaving manifests dirty across a
698
+ // four-minute build would wedge the NEXT update behind a refusal about
699
+ // files the operator never touched. See version-step.ts's header.
700
+ const result = await runVersionStep({
701
+ checkoutPath: checkoutPathFor(context.options.deployRoot),
702
+ ...(context.options.appVersion === undefined
703
+ ? {}
704
+ : { requested: context.options.appVersion }),
705
+ ...(context.options.noVersionBump === undefined
706
+ ? {}
707
+ : { disabled: context.options.noVersionBump }),
708
+ runCommand: context.runCommand,
709
+ });
710
+ context.version = result;
711
+ context.journal.line(`Version: ${result.detail}`);
712
+ // ⚠ The DEPLOYED COMMIT IS THE BUMP COMMIT. Recording the pre-bump one
713
+ // leaves every server reporting itself a commit behind for ever,
714
+ // rebuilding identical code and bumping again on every update. It is
715
+ // also more accurate: the commit happens before `build`, so the images
716
+ // really were built with HEAD here.
717
+ if (result.commitSha !== undefined)
718
+ context.commitSha = result.commitSha;
719
+ // ⚠ STAMPED ON DISK, NOT JUST IN MEMORY. `context.env` is the wizard's
720
+ // map and nothing writes it again after the `environment` step, so an
721
+ // in-memory set alone would leave the running container on whatever
722
+ // APP_VERSION the last deploy wrote. The disk write is what the build
723
+ // and the api container actually read.
724
+ const stamped = stampAppVersion(envFilePath(context.options.deployRoot), join(composeCwd(context.options.deployRoot), '.env.example'), result.version);
725
+ context.env?.set('APP_VERSION', result.version);
726
+ if (!stamped) {
727
+ context.journal.line('APP_VERSION was not stamped: no .env on disk yet.');
728
+ }
729
+ },
730
+ },
731
+ {
732
+ id: 'build',
733
+ title: 'Build images',
734
+ async run(context) {
735
+ await compose(context, [
736
+ 'build',
737
+ ...(context.options.noCache === true ? ['--no-cache'] : []),
738
+ ]);
739
+ },
740
+ },
741
+ {
742
+ id: 'migrate',
743
+ title: 'Apply migrations',
744
+ async run(context) {
745
+ // `run --rm` rather than `exec`: the stack is not up yet, and this must
746
+ // not depend on the api container already running.
747
+ await compose(context, [
748
+ 'run', '--rm', '--no-deps', 'api',
749
+ 'npm', 'run', 'prisma:migrate',
750
+ ], { timeoutMs: 10 * 60_000 });
751
+ },
752
+ },
753
+ {
754
+ id: 'seed',
755
+ title: 'Seed roles and permissions',
756
+ skip: (context) => context.options.skipSeed === true ? 'skipped with --skip-seed' : undefined,
757
+ async run(context) {
758
+ await compose(context, [
759
+ 'run', '--rm', '--no-deps', 'api',
760
+ 'npm', 'run', 'prisma:seed',
761
+ ], { timeoutMs: 10 * 60_000 });
762
+ },
763
+ },
764
+ {
765
+ id: 'start',
766
+ title: 'Start the stack',
767
+ async run(context) {
768
+ // The bind sources are created by `ensureBindSources`, which runs
769
+ // before EVERY compose invocation -- see its header for why doing it
770
+ // here, one step before `up`, was not enough.
771
+ await compose(context, ['up', '-d']);
772
+ },
773
+ },
774
+ {
775
+ id: 'health',
776
+ title: 'Wait for the API',
777
+ async run(context) {
778
+ const probe = await waitForHealthy({
779
+ runCommand: context.runCommand,
780
+ deployRoot: context.options.deployRoot,
781
+ bindPort: context.options.bindPort,
782
+ ...(context.composeProject === undefined
783
+ ? {}
784
+ : { composeProject: context.composeProject }),
785
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
786
+ });
787
+ if (!probe.ok) {
788
+ throw new Error(`The API did not become ready: ${probe.error ?? `HTTP ${probe.status ?? '?'}`}`);
789
+ }
790
+ },
791
+ },
792
+ {
793
+ id: 'deploy-info',
794
+ title: 'Record what was deployed',
795
+ async run(context) {
796
+ // ⚠ IMMEDIATELY AFTER `health`, NOT AT THE END. If the API is
797
+ // answering, the application demonstrably IS deployed and the About
798
+ // page should say so. Written at the end, a failure in `publish` --
799
+ // which runs between here and there -- would leave that page reporting
800
+ // nothing at all about a deployment that is up and serving, which is
801
+ // exactly when somebody is looking at it.
802
+ //
803
+ // ⚠ AND REWRITTEN AT THE END of a successful run (see `runInstall`),
804
+ // which is the only point at which this run's history entry and a
805
+ // freshly read certificate expiry exist. This write describes what is
806
+ // answering NOW; that one supersedes it with the finished run.
807
+ await hostFactsOf(context);
808
+ const result = writeDeployInfo(context.options.deployRoot, installDeployInfo(context, new Date().toISOString()));
809
+ // ⚠ BOOKKEEPING, NOT THE DEPLOYMENT. By this point the stack is up and
810
+ // answering; a file this CLI could not write is a warning, never a
811
+ // failure that undoes a successful deploy.
812
+ context.journal.line(result.written
813
+ ? `Wrote ${result.path}`
814
+ : `warning: could not write ${result.path}: ${result.error ?? 'unknown'}`);
815
+ if (!result.written) {
816
+ context.hooks?.onProgress?.(`warning: deployment record not written (${result.error ?? 'unknown'})`);
817
+ }
818
+ },
819
+ },
820
+ {
821
+ id: 'proxy-bootstrap',
822
+ title: 'Make sure the shared proxy is running',
823
+ skip: (context) => {
824
+ if (context.options.skipProxy === true)
825
+ return 'skipped with --skip-proxy';
826
+ if (context.options.domain === undefined)
827
+ return 'no --domain given';
828
+ return undefined;
829
+ },
830
+ async run(context) {
831
+ const runtime = await proxyRuntimeOf(context);
832
+ if (runtime.mode !== 'container') {
833
+ context.journal.line('The proxy runs on the host; it is the host\'s to run, and nothing is bootstrapped.');
834
+ return;
835
+ }
836
+ const proxyRoot = context.options.proxyRoot;
837
+ const presence = await inspectProxy({
838
+ proxyRoot,
839
+ runtime,
840
+ runCommand: context.runCommand,
841
+ });
842
+ context.journal.line(presence.detail);
843
+ switch (presence.state) {
844
+ case 'running':
845
+ // The ordinary case on every deployment after a box's first.
846
+ return;
847
+ case 'stopped':
848
+ // ⚠ NOT STARTED FOR THEM. It is shared, and somebody stopped it --
849
+ // possibly on purpose. Say so and let them decide.
850
+ throw new PreconditionError(`The shared proxy container ${runtime.container} exists but is stopped. It is shared infrastructure, so ` +
851
+ `this install will not start it. Start it: docker start ${runtime.container} (or: cd ${proxyRoot} && docker compose up -d), then re-run with --resume.`);
852
+ case 'configured':
853
+ throw new PreconditionError(`${presence.detail}. That proxy belongs to whatever created it, so this install will not touch it. ` +
854
+ `Start it: cd ${proxyRoot} && docker compose up -d -- or, if its container has another name, pass --proxy-container <name>. Then re-run with --resume.`);
855
+ case 'unknown':
856
+ throw new PreconditionError(`${presence.detail}. Check it by hand: docker inspect ${runtime.container}`);
857
+ case 'absent':
858
+ break;
859
+ }
860
+ // Asked once: preflight's answer, when it asked; otherwise now (a
861
+ // resumed run, or --skip-doctor). A "no" is not asked twice.
862
+ const consent = context.proxyBootstrapConsent ??
863
+ (await obtainConsent(bootstrapQuestion(proxyRoot, runtime.container), consentOptions(context, context.options.bootstrapProxy)));
864
+ if (!consented(consent))
865
+ throw bootstrapRefusal(consent, proxyRoot);
866
+ const composeDir = composeCwd(context.options.deployRoot);
867
+ const result = await bootstrapProxy({
868
+ proxyRoot,
869
+ runtime,
870
+ runCommand: context.runCommand,
871
+ hooks: context.hooks,
872
+ // The networks the APPLICATION's compose files declare external,
873
+ // read from the checkout -- never a name this CLI makes up.
874
+ networks: externalNetworksIn(composeFilesFor(context.options.groups, composeDir).map((file) => join(composeDir, file))),
875
+ onLine: (line) => context.journal.line(line),
876
+ });
877
+ context.hooks?.onProgress?.(`Created the shared proxy in ${proxyRoot} (${result.created.length} file(s)/directories)`);
878
+ },
879
+ },
880
+ {
881
+ id: 'publish',
882
+ title: 'Publish over HTTPS',
883
+ skip: (context) => {
884
+ if (context.options.skipProxy === true)
885
+ return 'skipped with --skip-proxy';
886
+ if (context.options.domain === undefined)
887
+ return 'no --domain given';
888
+ return undefined;
889
+ },
890
+ async run(context) {
891
+ const target = {
892
+ domain: context.options.domain,
893
+ bindPort: context.options.bindPort,
894
+ proxyRoot: context.options.proxyRoot,
895
+ };
896
+ const email = context.options.email ?? context.env?.get('INITIAL_ADMIN_EMAIL') ?? '';
897
+ if (email === '') {
898
+ throw new UsageError('A registration email is required for the certificate. Pass --email, or set INITIAL_ADMIN_EMAIL.');
899
+ }
900
+ const runtime = await proxyRuntimeOf(context);
901
+ // Certificate FIRST. See rule 4 in the header.
902
+ const cert = await issueCertificate(target, {
903
+ runCommand: context.runCommand,
904
+ runtime,
905
+ email,
906
+ ...(context.options.staging === undefined ? {} : { staging: context.options.staging }),
907
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
908
+ });
909
+ await installVhost(target, {
910
+ runCommand: context.runCommand,
911
+ // Paths in the vhost, and where `nginx -t` / the reload run, both
912
+ // come from here. Omitting it is the host-binary assumption.
913
+ runtime,
914
+ ...(context.hooks === undefined ? {} : { hooks: context.hooks }),
915
+ ...(context.env?.get('MAX_FILE_SIZE') === undefined
916
+ ? {}
917
+ : { maxBodyBytes: Number(context.env.get('MAX_FILE_SIZE')) }),
918
+ // A (re)issued certificate never changes the vhost TEXT -- same
919
+ // domain, same path -- so the ordinary "already current" fast path
920
+ // would never reload nginx and the new certificate would sit on
921
+ // disk, unserved, forever (issue #640).
922
+ forceReload: cert.issued,
923
+ });
924
+ },
925
+ },
926
+ {
927
+ id: 'renewal',
928
+ title: 'Schedule certificate renewal',
929
+ skip: (context) => {
930
+ if (context.options.skipRenewal === true)
931
+ return 'skipped with --skip-renewal';
932
+ if (context.options.skipProxy === true)
933
+ return 'skipped with --skip-proxy';
934
+ if (context.options.domain === undefined)
935
+ return 'no --domain given';
936
+ return undefined;
937
+ },
938
+ async run(context) {
939
+ const proxyRoot = context.options.proxyRoot;
940
+ const status = certificateStatus({
941
+ domain: context.options.domain,
942
+ bindPort: context.options.bindPort,
943
+ proxyRoot,
944
+ });
945
+ if (!status.exists) {
946
+ context.journal.line(`No certificate at ${status.path}; nothing to renew yet.`);
947
+ return;
948
+ }
949
+ await scheduleRenewal(context, proxyRoot, await proxyRuntimeOf(context));
950
+ },
951
+ },
952
+ {
953
+ id: 'verify',
954
+ title: 'Verify the deployment',
955
+ async run(context) {
956
+ const report = await collectHealth({
957
+ runCommand: context.runCommand,
958
+ deployRoot: context.options.deployRoot,
959
+ bindPort: context.options.bindPort,
960
+ ...(context.composeProject === undefined
961
+ ? {}
962
+ : { composeProject: context.composeProject }),
963
+ ...(context.options.domain === undefined || context.options.skipProxy === true
964
+ ? {}
965
+ : { domain: context.options.domain }),
966
+ ...(context.options.fetch === undefined ? {} : { fetch: context.options.fetch }),
967
+ ...oauthSmokeTarget(context.options.skipOAuthCheck, environmentOf(context)),
968
+ ...(context.options.groups === undefined ? {} : { groups: context.options.groups }),
969
+ });
970
+ context.journal.line(`containers=${report.containers.length} ready=${report.local.ready.ok} frontend=${report.local.frontend.ok} migrations=${report.migrations.known ? report.migrations.pending.length : 'unknown'}`);
971
+ if (!isHealthy(report)) {
972
+ // The external HTTPS probe is the one check that can fail for a
973
+ // reason `deploy status` does not specifically diagnose: the proxy
974
+ // serving a different certificate than the one on disk (#640,
975
+ // #642) -- `deploy certs` is the command that actually compares
976
+ // them and names the exact remedy for this deployment's runtime.
977
+ const certHint = report.external !== undefined && !report.external.probe.ok
978
+ ? ` If the domain shows a certificate/SSL error in a browser, run \`${cliName()} deploy certs --domain ${context.options.domain}\` to check whether the proxy needs reloading.`
979
+ : '';
980
+ throw new Error('The stack is up but not healthy. Run `' +
981
+ cliName() +
982
+ ' deploy status` for the detail.' +
983
+ certHint);
984
+ }
985
+ reportOAuthSmoke(context, report.oauth);
986
+ },
987
+ },
988
+ {
989
+ id: 'publish-version',
990
+ title: 'Publish the release version',
991
+ skip: (context) => context.version?.bumped === true ? undefined : 'no version was bumped',
992
+ async run(context) {
993
+ // ⚠ PUSH LAST, AFTER VERIFY -- not at the health gate. Pushing to a
994
+ // shared repository is irreversible and externally visible: a version
995
+ // not pushed is re-derived next run, while a version pushed for a
996
+ // deploy that did not finish is a commit someone has to reason about.
997
+ const result = await publishVersion({
998
+ checkoutPath: checkoutPathFor(context.options.deployRoot),
999
+ ref: context.target?.ref ?? 'main',
1000
+ result: context.version,
1001
+ runCommand: context.runCommand,
1002
+ });
1003
+ // ⚠ A FAILED PUSH IS A WARNING, NEVER A FAILURE. By this point the app
1004
+ // is built, migrated, started, answering and verified. The rollback
1005
+ // keeps the clone level with origin; the deployment keeps the version.
1006
+ context.journal.line(`Publish: ${result.detail}`);
1007
+ if (!result.pushed)
1008
+ context.hooks?.onProgress?.(`warning: ${result.detail}`);
1009
+ },
1010
+ },
1011
+ ];
1012
+ }
1013
+ /**
1014
+ * The consent options every gate in this pipeline shares. `flag` is the one
1015
+ * gate-specific part.
1016
+ */
1017
+ export function consentOptions(context, flag) {
1018
+ return {
1019
+ flag,
1020
+ nonInteractive: context.options.nonInteractive,
1021
+ promptContext: context.options.promptContext,
1022
+ ask: context.options.ask,
1023
+ };
1024
+ }
1025
+ /**
1026
+ * What the post-deploy OAuth smoke checks against, or nothing when it is
1027
+ * skipped or the environment names no Google client. Shared with update.
1028
+ */
1029
+ export function oauthSmokeTarget(skip, env) {
1030
+ if (skip === true || env === undefined)
1031
+ return {};
1032
+ const clientId = env.get('GOOGLE_CLIENT_ID') ?? '';
1033
+ const callbackUrl = env.get('GOOGLE_CALLBACK_URL') ?? '';
1034
+ if (clientId === '' || callbackUrl === '')
1035
+ return {};
1036
+ return { oauth: { clientId, callbackUrl } };
1037
+ }
1038
+ /**
1039
+ * What a smoke result means for a deploy (#391): `fail` fails `verify` -- the
1040
+ * API answered, and what it said means nobody can sign in; `warn` (the API
1041
+ * could not be asked) is reported and does not, since the health probes above
1042
+ * already judged reachability.
1043
+ */
1044
+ export function reportOAuthSmoke(context, smoke) {
1045
+ if (smoke === undefined)
1046
+ return;
1047
+ context.journal.line(`${smoke.status} oauth-smoke: ${smoke.detail}`);
1048
+ if (smoke.status === 'warn') {
1049
+ context.hooks?.onProgress?.(`warning: OAuth smoke: ${smoke.detail}`);
1050
+ return;
1051
+ }
1052
+ if (smoke.status === 'fail') {
1053
+ throw new Error(`Sign-in is broken: ${smoke.detail}${smoke.remedy === undefined ? '' : `\n${smoke.remedy}`}`);
1054
+ }
1055
+ }
1056
+ /**
1057
+ * Acts on the renewal-ownership answer and reports it. Shared with update.
1058
+ *
1059
+ * ⚠ NEVER FAILS THE DEPLOY. Renewal is not the deployment: a file that could
1060
+ * not be written is a loud warning carrying the exact content to install.
1061
+ */
1062
+ export async function scheduleRenewal(context, proxyRoot, runtime) {
1063
+ const result = await ensureRenewal({ proxyRoot, runtime, runCommand: context.runCommand });
1064
+ context.journal.line(`renewal ${result.action}: ${result.detail}`);
1065
+ if (result.action === 'not-writable') {
1066
+ context.journal.line(result.remedy ?? '');
1067
+ context.hooks?.onProgress?.(`warning: ${result.detail}`);
1068
+ context.hooks?.onProgress?.(result.remedy ?? '');
1069
+ return;
1070
+ }
1071
+ if (result.warning !== undefined) {
1072
+ context.hooks?.onProgress?.(`warning: ${result.warning}. ${result.remedy ?? ''}`);
1073
+ }
1074
+ context.hooks?.onProgress?.(result.detail);
1075
+ }
1076
+ export async function runInstall(requested) {
1077
+ // Every step reads `options.groups`, so widening it once here is what puts
1078
+ // the always-on groups (#567) into the wizard, the compose file list, the
1079
+ // health gate and the recorded state alike.
1080
+ const options = { ...requested, groups: effectiveGroups(requested.groups) };
1081
+ // The duration a history entry records is the whole run, precondition
1082
+ // checks included -- what the operator actually waited.
1083
+ const startedAt = Date.now();
1084
+ const existingState = readState(options.deployRoot);
1085
+ // The mirror of the defect `update` had, and the same wrong question asked
1086
+ // from the other side. Guarding on the RECORD means a deployment whose state
1087
+ // file was lost -- containers running, certificate issued, site serving -- is
1088
+ // not recognised here either, so `install` proceeds and clobbers it: a fresh
1089
+ // checkout over the live one, a re-run wizard over the live `.env`.
1090
+ //
1091
+ // The guard is EVIDENCE OR RECORD. Either is enough to say something is
1092
+ // already here; requiring both would reintroduce the same gap.
1093
+ const alreadyDeployed = existingState !== undefined || isDeployment(options.deployRoot);
1094
+ if (alreadyDeployed && options.reinstall !== true && options.resume !== true) {
1095
+ const at = existingState === undefined
1096
+ ? 'it has a checkout and an environment file, but no deployment record'
1097
+ : `${existingState.commitSha.slice(0, 12)}`;
1098
+ throw new UsageError(`A deployment already exists at ${options.deployRoot} (${at}). Use \`${cliName()} deploy update\` to bring it up to date, or --reinstall to start over.`);
1099
+ }
1100
+ mkdirSync(options.deployRoot, { recursive: true });
1101
+ const journal = openJournal({
1102
+ deployRoot: options.deployRoot,
1103
+ command: 'install',
1104
+ // Seeded from an existing .env so a resumed run redacts from the first
1105
+ // line, before the wizard has run again.
1106
+ secrets: existsSync(envFilePath(options.deployRoot))
1107
+ ? secretsFrom(parseEnvFile(readFileSync(envFilePath(options.deployRoot), 'utf8')))
1108
+ : [],
1109
+ });
1110
+ // Announced at once, so a screen can show where the log is while it runs.
1111
+ options.hooks?.onJournal?.(journal.path);
1112
+ // A FRESH install gets its own compose project; anything already here keeps
1113
+ // the one it is running under. See composeProjectFor for why renaming an
1114
+ // existing deployment's project is an outage rather than a tidy-up.
1115
+ const composeProject = existingState === undefined && !isDeployment(options.deployRoot)
1116
+ ? basename(options.deployRoot)
1117
+ : composeProjectFor(existingState);
1118
+ const context = {
1119
+ options,
1120
+ runCommand: options.runCommand ?? defaultRunCommand,
1121
+ journal,
1122
+ hooks: options.hooks,
1123
+ composeProject,
1124
+ existingState,
1125
+ ...(existingState === undefined
1126
+ ? {}
1127
+ : {
1128
+ recordedProxy: {
1129
+ ...(existingState.proxyMode === undefined ? {} : { proxyMode: existingState.proxyMode }),
1130
+ ...(existingState.proxyContainer === undefined
1131
+ ? {}
1132
+ : { proxyContainer: existingState.proxyContainer }),
1133
+ },
1134
+ }),
1135
+ completed: options.resume === true && existingState !== undefined
1136
+ ? new Set(existingState.completedSteps ?? [])
1137
+ : new Set(),
1138
+ // Appended by `runPipeline` as each step finishes; read by `deploy-info`.
1139
+ progress: [],
1140
+ };
1141
+ // The app's steps (`registerDeployStep`, #715) go in after the built-in
1142
+ // step each one names; they see a narrow context, never this one.
1143
+ const steps = withRegisteredSteps('install', buildInstallSteps(), (step) => appStepContext('install', step, () => environmentOf(step)));
1144
+ const result = await runPipeline(steps, context);
1145
+ if (result.failed !== undefined) {
1146
+ journal.finish('failure', `${result.failed.id}: ${result.failed.detail ?? ''}`);
1147
+ // ⚠ THE FAILURE PATH RECORDS WHAT COMPLETED, AND WITHOUT THIS `--resume`
1148
+ // RESUMES NOTHING. `completedSteps` was written only on the SUCCESS path
1149
+ // below, so the one run that needs resuming -- a failed one -- left no
1150
+ // record of its progress, and the flag the error message recommends in the
1151
+ // very next line skipped zero steps and rebuilt everything. The message
1152
+ // was true about intent and false about behaviour.
1153
+ //
1154
+ // The record is marked `lastOutcome: 'failure'` so nothing downstream
1155
+ // mistakes a half-applied attempt for a deployment: `commitSha` is
1156
+ // whatever the checkout reached, which may be nothing.
1157
+ const attemptedAt = new Date().toISOString();
1158
+ try {
1159
+ writeState({
1160
+ ...(existingState ?? {}),
1161
+ version: DEPLOY_STATE_VERSION,
1162
+ repoUrl: context.target?.url ?? existingState?.repoUrl ?? '',
1163
+ ref: context.target?.ref ?? existingState?.ref ?? '',
1164
+ commitSha: context.commitSha ?? existingState?.commitSha ?? '',
1165
+ bindPort: options.bindPort,
1166
+ deployRoot: options.deployRoot,
1167
+ installedAt: existingState?.installedAt ?? '',
1168
+ lastDeployedAt: existingState?.lastDeployedAt ?? '',
1169
+ lastCommand: 'install',
1170
+ appctlVersion: cliVersion(),
1171
+ composeProject,
1172
+ ...(options.domain === undefined ? {} : { domain: options.domain }),
1173
+ ...(options.proxyRoot === undefined ? {} : { proxyRoot: options.proxyRoot }),
1174
+ ...recordedRuntime(context),
1175
+ completedSteps: result.completed,
1176
+ ...allowSuperuserRecord(context, existingState),
1177
+ lastOutcome: 'failure',
1178
+ lastFailedStep: result.failed.id,
1179
+ lastAttemptAt: attemptedAt,
1180
+ });
1181
+ }
1182
+ catch {
1183
+ // ⚠ BOOKKEEPING, NEVER THE FAILURE ITSELF. The deploy has already failed
1184
+ // and the operator needs THAT reason, not a second one about a file the
1185
+ // CLI could not write while reporting the first.
1186
+ }
1187
+ throw new Error(`${result.failed.title} failed: ${result.failed.detail ?? 'unknown error'}\n` +
1188
+ `The full log is at ${journal.path}\n` +
1189
+ `Fix the cause and re-run with --resume to continue from this step.`);
1190
+ }
1191
+ const now = new Date().toISOString();
1192
+ // ⚠ ONLY THE SUCCESS PATH APPENDS HISTORY. The failure path above spreads
1193
+ // the existing record, so a failed run keeps every prior entry and adds none.
1194
+ const host = await hostFactsOf(context);
1195
+ const runtime = recordedRuntime(context);
1196
+ const proxy = await observeProxy({
1197
+ domain: options.domain,
1198
+ bindPort: options.bindPort,
1199
+ proxyRoot: options.proxyRoot,
1200
+ mode: runtime.proxyMode,
1201
+ container: runtime.proxyContainer,
1202
+ runCommand: context.runCommand,
1203
+ });
1204
+ const history = appendHistory(existingState?.history, {
1205
+ at: now,
1206
+ command: 'install',
1207
+ commitSha: context.commitSha || null,
1208
+ previousCommitSha: previousDeployedCommit(existingState),
1209
+ ref: context.target?.ref ?? null,
1210
+ durationMs: Date.now() - startedAt,
1211
+ cliVersion: cliVersion(),
1212
+ outcome: 'success',
1213
+ });
1214
+ const installedAt = existingState?.installedAt ?? now;
1215
+ // The marker `update` compares the checkout against; see DeployState.deployedHead.
1216
+ const deployedHead = await checkoutHead(options.deployRoot, context.runCommand);
1217
+ writeState({
1218
+ version: DEPLOY_STATE_VERSION,
1219
+ repoUrl: context.target?.url ?? '',
1220
+ ref: context.target?.ref ?? '',
1221
+ commitSha: context.commitSha ?? '',
1222
+ ...(deployedHead === undefined ? {} : { deployedHead }),
1223
+ ...(options.domain === undefined ? {} : { domain: options.domain }),
1224
+ bindPort: options.bindPort,
1225
+ deployRoot: options.deployRoot,
1226
+ installedAt,
1227
+ lastDeployedAt: now,
1228
+ lastCommand: 'install',
1229
+ appctlVersion: cliVersion(),
1230
+ // Recorded, never re-derived: see composeProjectFor.
1231
+ composeProject,
1232
+ // Recorded so update writes the vhost where install put it, rather than
1233
+ // re-deriving a path that ignores a non-default --proxy-root.
1234
+ ...(options.proxyRoot === undefined ? {} : { proxyRoot: options.proxyRoot }),
1235
+ // Recorded so update, certs and uninstall act under the runtime this
1236
+ // install actually used, rather than re-detecting it.
1237
+ ...recordedRuntime(context),
1238
+ // Recorded so a later `update` knows which groups this deployment uses.
1239
+ // It cannot be re-derived from the `.env`: a group's keys look identical
1240
+ // whether the feature is on or off. Always includes the always-on groups
1241
+ // (`effectiveGroups`, #567), so the record says what actually runs.
1242
+ groups: effectiveGroups(options.groups),
1243
+ completedSteps: result.completed,
1244
+ ...allowSuperuserRecord(context, existingState),
1245
+ // Stated explicitly rather than left absent, so a later reader never has
1246
+ // to infer success from the shape of the record.
1247
+ lastOutcome: 'success',
1248
+ lastAttemptAt: now,
1249
+ host,
1250
+ history,
1251
+ proxy,
1252
+ });
1253
+ // The end-of-run rewrite of info.json: the same document the health gate
1254
+ // wrote, now carrying this run's history entry, every completed step and the
1255
+ // certificate `publish` just issued. Never throws; see writeDeployInfo.
1256
+ const info = writeDeployInfo(options.deployRoot, {
1257
+ ...installDeployInfo(context, now),
1258
+ installedAt,
1259
+ proxy: proxyInfoOf(proxy),
1260
+ host,
1261
+ history,
1262
+ });
1263
+ journal.line(info.written
1264
+ ? `Wrote ${info.path}`
1265
+ : `warning: could not write ${info.path}: ${info.error ?? 'unknown'}`);
1266
+ journal.finish('success');
1267
+ const admin = context.env?.get('INITIAL_ADMIN_EMAIL') ?? 'the admin address';
1268
+ const url = options.domain === undefined
1269
+ ? `http://127.0.0.1:${options.bindPort}`
1270
+ : `https://${options.domain}`;
1271
+ return {
1272
+ deployRoot: options.deployRoot,
1273
+ commitSha: context.commitSha ?? '',
1274
+ journalPath: journal.path,
1275
+ ...(options.domain === undefined ? {} : { domain: options.domain }),
1276
+ // The seed writes the ALLOWLIST row, not a user account. Nobody is an
1277
+ // admin until this login happens, and an install that does not say so
1278
+ // looks broken.
1279
+ nextStep: `Log in at ${url} as ${admin} to claim the Admin role.`,
1280
+ ...(options.showCredentials === true && context.appCredentials !== undefined
1281
+ ? { credentials: context.appCredentials }
1282
+ : {}),
1283
+ };
1284
+ }
1285
+ /**
1286
+ * `allowSuperuser` as the state records it (#980): the login `--allow-superuser`
1287
+ * kept in THIS run, or the one a previous run recorded while `.env` still holds
1288
+ * that same login. Anything else records nothing, so a choice never outlives the
1289
+ * login it was made for -- once POSTGRES_USER is an ordinary role the flag is
1290
+ * gone, and a later superuser fails `deploy doctor` instead of being waved through.
1291
+ */
1292
+ function allowSuperuserRecord(context, existing) {
1293
+ return superuserRecord(context.superuserKept, existing, environmentOf(context)?.get('POSTGRES_USER'));
1294
+ }
1295
+ /**
1296
+ * The commit a fresh install replaces, for its history entry.
1297
+ *
1298
+ * The last SUCCESSFUL run's commit when there is history. Without it, a record
1299
+ * that did not end in failure still names a deployed commit (a v1 record, an
1300
+ * adopted one); a failed first install names only the checkout it reached,
1301
+ * which was never deployed, so it answers null.
1302
+ */
1303
+ function previousDeployedCommit(existing) {
1304
+ if (existing === undefined)
1305
+ return null;
1306
+ const last = existing.history?.[0];
1307
+ if (last !== undefined)
1308
+ return last.commitSha;
1309
+ if (existing.lastOutcome === 'failure')
1310
+ return null;
1311
+ return existing.commitSha || null;
1312
+ }
1313
+ /** Slug used for the default deploy root, from the repository name. */
1314
+ export function defaultRootFor(repoUrl, base) {
1315
+ const name = basename(repoUrl).replace(/\.git$/, '') || 'app';
1316
+ return join(base, name.toLowerCase());
1317
+ }
1318
+ //# sourceMappingURL=install.js.map