@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,1166 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { basename, join, resolve } from 'node:path';
3
+ import { cliName, envVar } from '../identity.js';
4
+ import { extractRoleAnswers, superuserAllowedFor } from '../deploy/app-role.js';
5
+ import { allChecks, checksPassed, gitCredentialStateFor, runChecks, summarise, } from '../deploy/checks/index.js';
6
+ import { parseEnvFile } from '../deploy/env-spec.js';
7
+ import { collectHealth, isHealthy, } from '../deploy/health.js';
8
+ import { resolveRepoUrl } from '../deploy/repo.js';
9
+ import { readState } from '../deploy/state.js';
10
+ import { readAbout, renderAbout } from '../deploy/about.js';
11
+ import { readAnswersFile } from '../deploy/answers-file.js';
12
+ import { isDeployment, resolveEnvPath } from '../deploy/deployment-evidence.js';
13
+ import { readEnvFile } from '../deploy/env-file.js';
14
+ import { collectInventory, renderInventory } from '../deploy/inventory.js';
15
+ import { planUninstall, runUninstall, } from '../deploy/uninstall.js';
16
+ import { assertValidContainerName, certificateExpiry, certificateServedMatchesDisk, describeReloadCommand, parseProxyMode, renewCertificate, resolveRecordedProxyRuntime, RENEW_WITHIN_DAYS, } from '../deploy/proxy.js';
17
+ import { DEFAULT_APPS_ROOT, locateApp, } from '../deploy/layout.js';
18
+ import { composeProjectFor, oauthSmokeTarget, runInstall, } from '../deploy/install.js';
19
+ import { runUpdate } from '../deploy/update.js';
20
+ import { runCommand } from '../deploy/executor.js';
21
+ import { CliError, EXIT, PreconditionError, UsageError } from '../errors.js';
22
+ import { shouldUseColour } from '../output.js';
23
+ // =============================================================================
24
+ // `appctl deploy` (issue #178, epic #168)
25
+ // =============================================================================
26
+ //
27
+ // The first user-facing surface of the deployment work, and the place the
28
+ // command GROUP is established - so the shape chosen here is the one every
29
+ // later subcommand follows.
30
+ //
31
+ // Two rules inherited from program.ts, neither negotiable here:
32
+ //
33
+ // - HUMAN OUTPUT GOES TO STDERR. stdout carries `--json` and nothing else,
34
+ // so `appctl deploy doctor --json | jq` is clean.
35
+ // - FAILURE IS NON-ZERO. A doctor that prints failures and exits 0 makes
36
+ // `doctor || provision-the-box` silently useless.
37
+ // =============================================================================
38
+ export const DEFAULT_DEPLOY_ROOT = '/opt/infra/apps';
39
+ export { DEFAULT_APPS_ROOT };
40
+ export const DEFAULT_PROXY_ROOT = '/opt/infra/proxy';
41
+ export const DEFAULT_BIND_PORT = 3535;
42
+ const PROXY_CONTAINER_HELP = 'Name of the shared proxy container (default: as recorded, else proxy-nginx)';
43
+ const PROXY_MODE_HELP = 'How the shared proxy runs: container or host (default: as recorded, else detected)';
44
+ /**
45
+ * Validates the proxy-runtime flags BEFORE anything runs.
46
+ *
47
+ * Refused as a usage error rather than passed through: a mistyped mode must not
48
+ * quietly become detection, and a container name reaches a docker argv.
49
+ */
50
+ function proxyFlags(options) {
51
+ const mode = options.proxyMode === undefined ? undefined : parseProxyMode(options.proxyMode);
52
+ if (options.proxyContainer !== undefined)
53
+ assertValidContainerName(options.proxyContainer);
54
+ return {
55
+ ...(mode === undefined ? {} : { mode }),
56
+ ...(options.proxyContainer === undefined ? {} : { container: options.proxyContainer }),
57
+ };
58
+ }
59
+ const ESC = String.fromCharCode(27);
60
+ const RESET = ESC + '[0m';
61
+ export function registerDeployCommand(program, ctx) {
62
+ const deploy = program
63
+ .command('deploy')
64
+ .description('Check, install and update this application on a server');
65
+ deploy
66
+ .command('doctor')
67
+ .description('Check that this server meets the prerequisites')
68
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
69
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
70
+ .option('--name <app>', 'Which deployment to act on, by name')
71
+ .option('--proxy-root <path>', 'Shared reverse proxy directory', DEFAULT_PROXY_ROOT)
72
+ .option('--port <port>', 'Loopback port the proxy forwards to', String(DEFAULT_BIND_PORT))
73
+ .option('--domain <domain>', 'Public domain; enables the DNS and TLS checks')
74
+ .option('--proxy-container <name>', PROXY_CONTAINER_HELP)
75
+ .option('--proxy-mode <mode>', PROXY_MODE_HELP)
76
+ .option('--repo <url>', 'Repository whose access to check (default: the recorded one, then this checkout\'s origin)')
77
+ .option('--json', 'Print a machine-readable report on stdout')
78
+ .option('--no-color', 'Disable colour even on a terminal')
79
+ .addHelpText('after', [
80
+ '',
81
+ 'Examples:',
82
+ ` ${cliName()} deploy doctor`,
83
+ ` ${cliName()} deploy doctor --domain app.example.com`,
84
+ ` ${cliName()} deploy doctor --json | jq '.checks[] | select(.status=="fail")'`,
85
+ '',
86
+ 'Exit codes:',
87
+ ' 0 every required check passed (warnings do not fail the run)',
88
+ ' 6 a required check failed; nothing was changed',
89
+ '',
90
+ 'Nothing is installed, written or started. It is safe to run at any time.',
91
+ ].join('\n'))
92
+ .action(async (options) => {
93
+ await runDoctorCommand(options, ctx);
94
+ });
95
+ deploy
96
+ .command('install')
97
+ .description('Install this application on this server')
98
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
99
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
100
+ .option('--name <app>', 'Which deployment to act on, by name')
101
+ .option('--domain <domain>', 'Public domain to publish under')
102
+ .option('--proxy-root <path>', 'Shared reverse proxy directory', DEFAULT_PROXY_ROOT)
103
+ .option('--proxy-container <name>', PROXY_CONTAINER_HELP)
104
+ .option('--proxy-mode <mode>', PROXY_MODE_HELP)
105
+ .option('--port <port>', 'Loopback port the proxy forwards to', String(DEFAULT_BIND_PORT))
106
+ .option('--repo <url>', 'Repository to deploy (default: this checkout\'s origin)')
107
+ .option('--ref <ref>', 'Branch, tag or commit (default: the remote default branch)')
108
+ .option('--email <email>', 'Certificate registration address')
109
+ .option('--group <name>', 'Optional feature group; repeat for more', collectGroup, [])
110
+ .option('--all', 'Review every environment variable, not only the essential ones')
111
+ .option('--non-interactive', 'Never prompt; fail listing anything unresolved')
112
+ .option('--answer <key=value>', 'Supply one environment answer; repeat for more', collectAnswer, new Map())
113
+ .option('--answers-file <path>', 'Read answers from a KEY=value file (like .env)')
114
+ .option('--reinstall', 'Install over an existing deployment')
115
+ .option('--resume', 'Continue from the step that failed')
116
+ .option('--skip-doctor', 'Skip the prerequisite checks')
117
+ .option('--skip-proxy', 'Do not touch the reverse proxy or request a certificate')
118
+ .option('--skip-seed', 'Do not run the database seed')
119
+ .option('--bootstrap-proxy', 'Create the shared proxy if this server has none (no prompt)')
120
+ .option('--create-database', 'Create the database if it does not exist (no prompt)')
121
+ .option('--app-db-user <name>', 'Name of the dedicated application database role (default: <app>_app)')
122
+ .option('--admin-user <name>', 'Administrative database login that provisions the role (password: $' + envVar('DB_ADMIN_PASSWORD') + ' or DB_ADMIN_PASSWORD in the answers file; never a flag)')
123
+ .option('--skip-role-provisioning', 'Create no role; POSTGRES_USER must already be an ordinary role')
124
+ .option('--allow-superuser', 'Run the API as a superuser/BYPASSRLS login anyway (tenant isolation OFF)')
125
+ .option('--rotate-app-password', 'Generate a new password for the application role')
126
+ .option('--provision-app-role', 'Consent: create the role when the database login is a superuser (no prompt)')
127
+ .option('--transfer-ownership', 'Consent: change the owner of an existing database\'s objects to the role (no prompt)')
128
+ .option('--allow-reduced-role', 'Consent: accept a role the server would not give CREATEROLE/createrole_self_grant')
129
+ .option('--show-credentials', 'Print the generated application login once at the end (never journaled)')
130
+ .option('--skip-renewal', 'Do not schedule certificate renewal')
131
+ .option('--skip-oauth-check', 'Do not verify the Google OAuth credentials with Google')
132
+ .option('--no-cache', 'Rebuild images without the layer cache')
133
+ .option('--force', 'Discard uncommitted changes in the checkout')
134
+ .option('--staging', "Use Let's Encrypt staging while working out the setup")
135
+ .option('--app-version <version>', 'Release version to deploy (default: a patch bump of the current one)')
136
+ .option('--no-version-bump', 'Deploy the current version: no write, no commit, no push')
137
+ .option('--json', 'Print a machine-readable result on stdout')
138
+ .addHelpText('after', [
139
+ '',
140
+ 'Examples:',
141
+ ` ${cliName()} deploy install --domain app.example.com`,
142
+ ` ${cliName()} deploy install --domain app.example.com --staging`,
143
+ ` ${cliName()} deploy install --non-interactive --domain app.example.com`,
144
+ '',
145
+ 'What it does, in order: checks prerequisites, clones the repository,',
146
+ 'collects the environment, provisions a dedicated, ordinary database role',
147
+ 'when the login you enter is a superuser (row-level security does not',
148
+ 'apply to one), validates the database and the Google OAuth',
149
+ 'credentials, creates the database if it is missing (asked, or',
150
+ '--create-database), builds the images, migrates, seeds, starts the',
151
+ 'stack, waits for health, creates the shared proxy if the server has',
152
+ 'none (asked, or --bootstrap-proxy), issues the certificate and',
153
+ 'publishes the vhost, schedules renewal unless something already owns',
154
+ 'it, then verifies the result -- including that sign-in redirects to',
155
+ 'Google with the configured client.',
156
+ '',
157
+ 'The repository and branch come from THIS checkout\'s git remote unless',
158
+ 'you pass --repo/--ref, so a fork deploys itself with no configuration.',
159
+ ].join('\n'))
160
+ .action(async (options) => {
161
+ await runInstallCommand(options, ctx);
162
+ });
163
+ deploy
164
+ .command('update')
165
+ .description('Bring this server up to the latest revision')
166
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
167
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
168
+ .option('--name <app>', 'Which deployment to act on, by name')
169
+ .option('--ref <ref>', 'Branch, tag or commit to move to')
170
+ .option('--force', 'Rebuild even when the revision has not changed')
171
+ .option('--no-cache', 'Rebuild images without the layer cache')
172
+ .option('--non-interactive', 'Never prompt; fail listing anything unresolved')
173
+ .option('--answer <key=value>', 'Supply one environment answer; repeat for more', collectAnswer, new Map())
174
+ .option('--answers-file <path>', 'Read answers from a KEY=value file (like .env)')
175
+ .option('--skip-seed', 'Do not re-run the database seed')
176
+ .option('--skip-proxy', 'Do not touch the reverse proxy')
177
+ .option('--create-database', 'Create the database if it does not exist (no prompt)')
178
+ .option('--app-db-user <name>', 'Name of the dedicated application database role (default: <app>_app)')
179
+ .option('--admin-user <name>', 'Administrative database login that provisions the role (password: $' + envVar('DB_ADMIN_PASSWORD') + ' or DB_ADMIN_PASSWORD in the answers file; never a flag)')
180
+ .option('--skip-role-provisioning', 'Create no role; POSTGRES_USER must already be an ordinary role')
181
+ .option('--allow-superuser', 'Run the API as a superuser/BYPASSRLS login anyway (tenant isolation OFF)')
182
+ .option('--rotate-app-password', 'Generate a new password for the application role')
183
+ .option('--provision-app-role', 'Consent: create the role when the database login is a superuser (no prompt)')
184
+ .option('--transfer-ownership', 'Consent: change the owner of an existing database\'s objects to the role (no prompt)')
185
+ .option('--allow-reduced-role', 'Consent: accept a role the server would not give CREATEROLE/createrole_self_grant')
186
+ .option('--show-credentials', 'Print the generated application login once at the end (never journaled)')
187
+ .option('--skip-renewal', 'Do not schedule certificate renewal')
188
+ .option('--skip-oauth-check', 'Do not run the post-deploy OAuth sign-in smoke')
189
+ .option('--proxy-container <name>', PROXY_CONTAINER_HELP)
190
+ .option('--proxy-mode <mode>', PROXY_MODE_HELP)
191
+ .option('--app-version <version>', 'Release version to deploy (default: a patch bump of the current one)')
192
+ .option('--no-version-bump', 'Deploy the current version: no write, no commit, no push')
193
+ .option('--maintenance', 'Serve a 503 from before the build until just after restart, instead of whatever the stop/migrate/restart window looks like underneath')
194
+ .option('--json', 'Print a machine-readable result on stdout')
195
+ .addHelpText('after', [
196
+ '',
197
+ 'Examples:',
198
+ ` ${cliName()} deploy update`,
199
+ ` ${cliName()} deploy update --ref v1.4.0`,
200
+ ` ${cliName()} deploy update --maintenance`,
201
+ '',
202
+ 'Exits 0 without doing anything when the revision has not moved, so it',
203
+ 'is safe to run from cron.',
204
+ '',
205
+ 'The seed RE-RUNS by default. It is idempotent, and it is the only way',
206
+ 'permissions added by a new release reach an existing deployment —',
207
+ 'without it the feature ships and the permission does not exist, which',
208
+ 'surfaces as a confusing 403. Pass --skip-seed to opt out.',
209
+ '',
210
+ 'There is no automatic roll-back: a partly-applied migration cannot be',
211
+ 'undone by checking out the old code. On failure the previous revision',
212
+ 'and the command to redeploy it are printed.',
213
+ '',
214
+ '--maintenance forces MAINTENANCE_MODE on in the deployment\'s .env from',
215
+ 'just before the build until just after the restart, recreating the api',
216
+ 'container each time so it takes effect — the environment break-glass is',
217
+ 'the only layer this CLI can use without an admin session. A failure',
218
+ 'before the window closes leaves the deployment in maintenance mode; the',
219
+ 'next update (with or without this flag) clears a leftover window on its',
220
+ 'own.',
221
+ ].join('\n'))
222
+ .action(async (options) => {
223
+ await runUpdateCommand(options, ctx);
224
+ });
225
+ deploy
226
+ .command('status')
227
+ .description('Report whether the deployment on this server is healthy')
228
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
229
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
230
+ .option('--name <app>', 'Which deployment to act on, by name')
231
+ .option('--port <port>', 'Loopback port the proxy forwards to', String(DEFAULT_BIND_PORT))
232
+ .option('--domain <domain>', 'Public domain; adds an external HTTPS check')
233
+ .option('--json', 'Print a machine-readable report on stdout')
234
+ .option('--no-color', 'Disable colour even on a terminal')
235
+ .addHelpText('after', [
236
+ '',
237
+ 'Examples:',
238
+ ` ${cliName()} deploy status`,
239
+ ` ${cliName()} deploy status --domain app.example.com`,
240
+ ` ${cliName()} deploy status --json || alert 'deployment unhealthy'`,
241
+ '',
242
+ 'Exit codes:',
243
+ ' 0 serving, and the schema is current',
244
+ ' 1 installed but unhealthy',
245
+ ' 2 nothing is installed at --root',
246
+ '',
247
+ 'Note that /api/health/ready only proves SELECT 1 succeeded, so it',
248
+ 'passes against an empty database. Migration state is reported',
249
+ 'separately, and a green probe alone is not treated as proof.',
250
+ ].join('\n'))
251
+ .action(async (options) => {
252
+ await runStatusCommand(options, ctx);
253
+ });
254
+ deploy
255
+ .command('list')
256
+ .description('List every deployment on this server')
257
+ .option('--apps-root <path>', 'Directory holding the deployments', DEFAULT_APPS_ROOT)
258
+ .option('--json', 'Print a machine-readable inventory on stdout')
259
+ .addHelpText('after', [
260
+ '',
261
+ 'Reads only the filesystem: no git, no Docker, no network. A deployment',
262
+ 'with no record reports a null commit rather than having one looked up,',
263
+ 'so listing a host with several applications costs no subprocesses and',
264
+ 'cannot fail differently per application.',
265
+ '',
266
+ 'The SOURCE column says where each row came from:',
267
+ ' record a deployment record was read',
268
+ ' inferred reconstructed from the environment file; `update` adopts it',
269
+ ' unreadable a record is present and this build cannot interpret it',
270
+ ].join('\n'))
271
+ .action((options) => {
272
+ runListCommand(options, ctx);
273
+ });
274
+ deploy
275
+ .command('about')
276
+ .description('Show what this server says it is running')
277
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
278
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
279
+ .option('--name <app>', 'Which deployment to act on, by name')
280
+ .option('--json', 'Print the record itself on stdout')
281
+ .addHelpText('after', [
282
+ '',
283
+ 'Reads `deploy-info/info.json` off this disk — it does NOT ask the',
284
+ 'application. The moment you most want to know what was deployed here',
285
+ 'is the moment it is not answering, and that endpoint needs a login.',
286
+ '',
287
+ 'Exits 0 when there is no record. A deployment installed before this',
288
+ 'CLI wrote one, or whose run stopped before the API answered, simply',
289
+ 'has none — which is not the same as nothing being deployed.',
290
+ ].join('\n'))
291
+ .action((options) => {
292
+ runAboutCommand(options, ctx);
293
+ });
294
+ deploy
295
+ .command('certs')
296
+ .description('Inspect or renew this deployment\'s TLS certificate')
297
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
298
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
299
+ .option('--name <app>', 'Which deployment to act on, by name')
300
+ .option('--proxy-root <path>', 'Shared reverse proxy directory', DEFAULT_PROXY_ROOT)
301
+ .option('--domain <domain>', 'Domain to act on (default: the recorded one)')
302
+ .option('--proxy-container <name>', PROXY_CONTAINER_HELP)
303
+ .option('--proxy-mode <mode>', PROXY_MODE_HELP)
304
+ .option('--renew', 'Renew when the certificate is inside the renewal window')
305
+ .option('--force', 'Renew even when it is not due. Spends rate-limit budget.')
306
+ .option('--email <email>', 'Registration address (default: INITIAL_ADMIN_EMAIL)')
307
+ .option('--staging', "Use Let's Encrypt staging, which is not trusted by browsers")
308
+ .option('--json', 'Print a machine-readable report on stdout')
309
+ .addHelpText('after', [
310
+ '',
311
+ 'Without --renew this reports and changes nothing.',
312
+ '',
313
+ `With --renew it renews only when the certificate expires within ${String(RENEW_WITHIN_DAYS)} days.`,
314
+ "Let's Encrypt allows 5 DUPLICATE certificates per week, and a command that",
315
+ 're-issued on every invocation would exhaust that during one debugging',
316
+ 'session -- leaving the deployment unable to get a certificate at the moment',
317
+ 'it most needs one. --force overrides that and is deliberately not implied.',
318
+ '',
319
+ 'An unreadable expiry is reported, never treated as "not due": silently',
320
+ 'assuming a certificate is healthy is how one quietly expires.',
321
+ '',
322
+ 'A renewal validates and RELOADS the proxy afterwards: a renewed certificate',
323
+ 'on disk is not served until nginx reloads. A renewal whose reload failed',
324
+ 'exits 1, because the old certificate is still what browsers see.',
325
+ '',
326
+ 'Exit codes:',
327
+ ' 0 reported, or renewed and reloaded successfully',
328
+ ' 1 the certificate is due and --renew was not passed, or the reload failed',
329
+ ' 2 nothing is installed at --root',
330
+ ].join('\n'))
331
+ .action(async (options) => {
332
+ await runCertsCommand(options, ctx);
333
+ });
334
+ deploy
335
+ .command('uninstall')
336
+ .description('Remove a deployment from this server')
337
+ .option('--root <path>', 'Deployment directory (rank 1: an explicit path)')
338
+ .option('--apps-root <path>', 'Directory holding the deployments (rank 3 walks up inside it)', DEFAULT_APPS_ROOT)
339
+ .option('--name <app>', 'Which deployment to act on, by name')
340
+ .option('--proxy-root <path>', 'Shared reverse proxy directory', DEFAULT_PROXY_ROOT)
341
+ .option('--proxy-container <name>', PROXY_CONTAINER_HELP)
342
+ .option('--proxy-mode <mode>', PROXY_MODE_HELP)
343
+ .option('--dry-run', 'Report what would be removed and change nothing')
344
+ .option('--drop-database', 'Also DROP the PostgreSQL database named by POSTGRES_DB, after the stack stops (needs --confirm-database)')
345
+ .option('--confirm-database <name>', "The database's own name, typed back")
346
+ .option('--purge-storage', 'Also delete every object in storage (needs --confirm-bucket)')
347
+ .option('--confirm-bucket <name>', "The bucket's own name, typed back")
348
+ .option('--json', 'Print a machine-readable plan on stdout')
349
+ .addHelpText('after', [
350
+ '',
351
+ 'Removes the containers and their volumes, the clone, the vhost, the',
352
+ 'logs, the environment file and the deployment record.',
353
+ '',
354
+ 'ALWAYS REFUSES to remove four things, because they are shared with every',
355
+ 'other application on this host:',
356
+ ' - the shared Docker network',
357
+ ' - the shared proxy container',
358
+ " - the TLS certificate (Let's Encrypt allows 5 duplicates per week;",
359
+ ' keeping it is what makes a reinstall possible)',
360
+ " - the renewal cron entry (per-host; it renews the neighbours' certs too)",
361
+ '',
362
+ 'The two destructive extras each need their own flag AND that resource\'s',
363
+ 'own real name typed back -- not the word DELETE. A word typed for one',
364
+ 'must never authorise the other.',
365
+ '',
366
+ '--drop-database runs DROP DATABASE after the stack stops and before the',
367
+ 'files go. If it fails, the checkout and the environment file are kept',
368
+ '(they hold the credentials) so the same command can be re-run.',
369
+ '',
370
+ 'Run --dry-run first. It reports exactly what would go and what would stay.',
371
+ ].join('\n'))
372
+ .action(async (options) => {
373
+ await runUninstallCommand(options, ctx);
374
+ });
375
+ return deploy;
376
+ }
377
+ export async function runUninstallCommand(options, ctx) {
378
+ // ⚠ Resolved through the five ranks, not read off `--root`. See
379
+ // `resolveApp`: with a defaulted `--root` every rank below the first
380
+ // was dead code, including the cwd walk the resolver exists for.
381
+ const app = resolveApp(options);
382
+ const proxy = proxyFlags(options);
383
+ const stdout = ctx?.stdout ?? process.stdout;
384
+ const stderr = ctx?.stderr ?? process.stderr;
385
+ const plan = planUninstall({
386
+ deployRoot: app.deployRoot,
387
+ proxyRoot: options.proxyRoot,
388
+ ...(options.dropDatabase === undefined ? {} : { dropDatabase: options.dropDatabase }),
389
+ ...(options.purgeStorage === undefined ? {} : { purgeStorage: options.purgeStorage }),
390
+ });
391
+ // ⚠ THE INVENTORY COMES FIRST, ALWAYS. Nobody can consent to a number they
392
+ // were not shown, so the plan is rendered before any confirmation is judged.
393
+ if (options.json === true) {
394
+ stdout.write(`${JSON.stringify(plan, null, 2)}\n`);
395
+ }
396
+ else {
397
+ stderr.write(`${renderUninstallPlan(plan)}\n`);
398
+ }
399
+ if (options.dryRun === true)
400
+ return;
401
+ const result = await runUninstall({
402
+ deployRoot: app.deployRoot,
403
+ proxyRoot: options.proxyRoot,
404
+ ...(proxy.mode === undefined ? {} : { proxyMode: proxy.mode }),
405
+ ...(proxy.container === undefined ? {} : { proxyContainer: proxy.container }),
406
+ ...(options.dropDatabase === undefined ? {} : { dropDatabase: options.dropDatabase }),
407
+ ...(options.confirmDatabase === undefined ? {} : { confirmDatabase: options.confirmDatabase }),
408
+ ...(options.purgeStorage === undefined ? {} : { purgeStorage: options.purgeStorage }),
409
+ ...(options.confirmBucket === undefined ? {} : { confirmBucket: options.confirmBucket }),
410
+ ...(ctx?.runCommand === undefined ? {} : { runCommand: ctx.runCommand }),
411
+ });
412
+ for (const warning of result.warnings)
413
+ stderr.write(`warning: ${warning}\n`);
414
+ if (result.database !== undefined) {
415
+ // The count is always printed, even when zero: an operator not told a
416
+ // session was killed cannot know to go and ask whose it was.
417
+ stderr.write(`Dropped database ${result.database.name} ` +
418
+ `(terminated ${String(result.database.terminated)} session(s)).\n`);
419
+ }
420
+ stderr.write(`Removed ${app.deployRoot}. Log: ${result.journalPath}\n`);
421
+ }
422
+ export function renderUninstallPlan(plan) {
423
+ const lines = [`Uninstalling ${plan.deployRoot}`, '', 'This will REMOVE:'];
424
+ for (const entry of plan.removes)
425
+ lines.push(` - ${entry}`);
426
+ lines.push('', 'This will KEEP:');
427
+ for (const keep of plan.keeps)
428
+ lines.push(` - ${keep.what} (${keep.because})`);
429
+ return lines.join('\n');
430
+ }
431
+ export async function runCertsCommand(options, ctx) {
432
+ // ⚠ Resolved through the five ranks, not read off `--root`. See
433
+ // `resolveApp`: with a defaulted `--root` every rank below the first
434
+ // was dead code, including the cwd walk the resolver exists for.
435
+ const app = resolveApp(options);
436
+ const proxy = proxyFlags(options);
437
+ const stdout = ctx?.stdout ?? process.stdout;
438
+ const stderr = ctx?.stderr ?? process.stderr;
439
+ const run = ctx?.runCommand ?? runCommand;
440
+ const state = readState(app.deployRoot);
441
+ const domain = options.domain ?? state?.domain;
442
+ if (domain === undefined) {
443
+ throw new UsageError(`No domain is recorded for the deployment at ${app.deployRoot}, and none was given. Pass --domain.`);
444
+ }
445
+ const target = {
446
+ domain,
447
+ bindPort: state?.bindPort ?? DEFAULT_BIND_PORT,
448
+ proxyRoot: state?.proxyRoot ?? options.proxyRoot,
449
+ };
450
+ // Always resolved now (issue #642): the served-vs-disk check below needs it
451
+ // to name the exact remedy command whether or not --renew was asked for.
452
+ const runtime = await resolveRecordedProxyRuntime({
453
+ proxyRoot: target.proxyRoot,
454
+ flags: proxy,
455
+ recorded: state,
456
+ runCommand: run,
457
+ });
458
+ const report = options.renew === true
459
+ ? await renewCertificate(target, {
460
+ runCommand: run,
461
+ // Which certbot runs, and where the post-renewal reload happens.
462
+ runtime,
463
+ email: options.email ?? emailFor(app.deployRoot),
464
+ ...(options.force === undefined ? {} : { force: options.force }),
465
+ ...(options.staging === undefined ? {} : { staging: options.staging }),
466
+ }).then((result) => ({
467
+ ...result.expiry,
468
+ renewed: result.renewed,
469
+ reloaded: result.reloaded,
470
+ reason: result.reason,
471
+ }))
472
+ : await certificateExpiry(target, { runCommand: run }).then((expiry) => ({
473
+ ...expiry,
474
+ renewed: false,
475
+ reloaded: false,
476
+ reason: 'reported only; pass --renew to act',
477
+ }));
478
+ // Whether what the proxy actually SERVES matches what's on disk (#642):
479
+ // the one check neither the health probes (never go through TLS) nor the
480
+ // expiry/renewal report above (only ever reads the file) can catch. Run
481
+ // whenever there is a certificate to compare against, report-only calls
482
+ // included -- that is the ordinary way an operator asks "is this actually
483
+ // working", with no --renew involved at all.
484
+ const served = report.exists
485
+ ? await certificateServedMatchesDisk(target, { runCommand: run })
486
+ : { checked: false };
487
+ if (options.json === true) {
488
+ stdout.write(`${JSON.stringify({ domain, ...report, notAfter: report.notAfter?.toISOString() ?? null, served }, null, 2)}\n`);
489
+ }
490
+ else {
491
+ stderr.write(`${renderCerts(domain, report, served, runtime)}\n`);
492
+ }
493
+ // A certificate that is due and was not renewed is a non-zero exit, so a cron
494
+ // wrapper notices. Reporting it at exit 0 is how it goes unnoticed until the
495
+ // browser says so.
496
+ if (report.exists && report.dueForRenewal && report.renewed !== true) {
497
+ throw new DeploymentUnhealthyError(`The certificate for ${domain} is due for renewal. Re-run with --renew.`);
498
+ }
499
+ // Renewed but not reloaded: the new certificate is on disk and the OLD one is
500
+ // still what browsers get. Exit non-zero so a cron wrapper notices, exactly
501
+ // as for a certificate that was never renewed.
502
+ if (report.renewed && !report.reloaded) {
503
+ throw new DeploymentUnhealthyError(`The certificate for ${domain} was renewed, but the proxy was not reloaded, so the old certificate is still being served. ${report.reason}`);
504
+ }
505
+ // The proxy is serving something other than what's on disk -- most often a
506
+ // certificate that WAS replaced correctly, but that the proxy was never
507
+ // told to reload (#640, #642). Exit non-zero so this is never silently
508
+ // "fine" just because the file on disk looks right.
509
+ if (served.checked && served.matches === false) {
510
+ throw new DeploymentUnhealthyError(`The certificate for ${domain} on disk does not match what the proxy is serving ` +
511
+ `(served issuer: ${served.servedIssuer ?? 'unknown'}; disk issuer: ${served.diskIssuer ?? 'unknown'}). ` +
512
+ `The proxy needs to reload to pick up the certificate that is already on disk: ${describeReloadCommand(runtime)}`);
513
+ }
514
+ }
515
+ /** The registration address a renewal should use, from the deployment's own env. */
516
+ function emailFor(deployRoot) {
517
+ const path = join(deployRoot, 'repo', 'infra', 'compose', '.env');
518
+ try {
519
+ const email = parseEnvFile(readFileSync(path, 'utf8')).get('INITIAL_ADMIN_EMAIL');
520
+ if (email !== undefined && email !== '')
521
+ return email;
522
+ }
523
+ catch {
524
+ // No readable .env. The explicit --email below is the answer.
525
+ }
526
+ throw new UsageError('No registration address: pass --email, or set INITIAL_ADMIN_EMAIL in the deployment environment.');
527
+ }
528
+ export function renderCerts(domain, report, served, runtime) {
529
+ const lines = [`Certificate for ${domain}`, ` path ${report.path}`];
530
+ if (!report.exists) {
531
+ lines.push(' status not installed');
532
+ }
533
+ else if (report.problem !== undefined) {
534
+ // Surfaced, not swallowed: see certificateExpiry's own warning.
535
+ lines.push(` status expiry unreadable — ${report.problem}`);
536
+ }
537
+ else {
538
+ lines.push(` expires ${report.notAfter?.toISOString() ?? 'unknown'}`);
539
+ lines.push(` remaining ${String(report.daysRemaining)} day(s)`);
540
+ lines.push(` status ${report.dueForRenewal ? 'DUE for renewal' : 'current'}`);
541
+ }
542
+ lines.push(` action ${report.renewed ? 'renewed' : report.reason}`);
543
+ // Whether what's actually served matches the file just described above
544
+ // (#642) -- silent when there was nothing to compare (no certificate, or
545
+ // the live probe could not complete for its own reasons).
546
+ if (served?.checked === true) {
547
+ lines.push(` served ${served.matches === true ? 'matches disk' : 'DOES NOT MATCH disk'}`);
548
+ if (served.matches === false) {
549
+ lines.push(` served: ${served.servedIssuer ?? 'unknown'}`);
550
+ lines.push(` disk: ${served.diskIssuer ?? 'unknown'}`);
551
+ if (runtime !== undefined) {
552
+ lines.push(` remedy ${describeReloadCommand(runtime)}`);
553
+ }
554
+ }
555
+ }
556
+ return lines.join('\n');
557
+ }
558
+ export function runListCommand(options, ctx) {
559
+ const appsRoot = options.appsRoot ?? DEFAULT_APPS_ROOT;
560
+ const entries = collectInventory({ appsRoot });
561
+ if (options.json === true) {
562
+ (ctx?.stdout ?? process.stdout).write(`${JSON.stringify({ appsRoot, deployments: entries }, null, 2)}\n`);
563
+ return;
564
+ }
565
+ (ctx?.stderr ?? process.stderr).write(`${renderInventory(entries, appsRoot)}\n`);
566
+ }
567
+ export async function runDoctorCommand(options, ctx) {
568
+ // ⚠ Resolved through the five ranks, not read off `--root`. See
569
+ // `resolveApp`: with a defaulted `--root` every rank below the first
570
+ // was dead code, including the cwd walk the resolver exists for.
571
+ const app = resolveApp(options, { mayBeAbsent: true });
572
+ const stdout = ctx?.stdout ?? process.stdout;
573
+ const stderr = ctx?.stderr ?? process.stderr;
574
+ const checks = ctx?.checks ?? allChecks();
575
+ const json = options.json === true;
576
+ const run = ctx?.runCommand ?? runCommand;
577
+ // Flags, then what an installed deployment recorded, then detection. Read-
578
+ // only: `docker inspect` and `nginx -v` change nothing, so doctor stays safe
579
+ // to run against production at any time.
580
+ const recorded = readRecordSafely(app.deployRoot);
581
+ const proxyRuntime = await resolveRecordedProxyRuntime({
582
+ proxyRoot: options.proxyRoot,
583
+ flags: proxyFlags(options),
584
+ recorded,
585
+ runCommand: run,
586
+ });
587
+ // Where the code comes from, and whether git can already read it: decides
588
+ // whether the gh checks are required (#390). `git ls-remote` is read-only.
589
+ const repoUrl = await resolveRepoUrl({
590
+ cwd: process.cwd(),
591
+ runCommand: run,
592
+ ...(options.repo === undefined ? {} : { repoFlag: options.repo }),
593
+ ...(recorded === undefined ? {} : { state: recorded }),
594
+ });
595
+ const gitCredentialed = await gitCredentialStateFor(repoUrl, run);
596
+ const context = {
597
+ runCommand: run,
598
+ deployRoot: app.deployRoot,
599
+ proxyRoot: options.proxyRoot,
600
+ proxyRuntime,
601
+ // Only a recorded deployment has a project to name; a bare host has none.
602
+ ...(recorded === undefined ? {} : { composeProject: composeProjectFor(recorded) }),
603
+ ...(repoUrl === undefined ? {} : { repoUrl }),
604
+ ...(gitCredentialed === undefined ? {} : { gitCredentialed }),
605
+ bindPort: Number(options.port),
606
+ ...(options.domain === undefined ? {} : { domain: options.domain }),
607
+ // #980: a choice already made (--allow-superuser at install/update) is a
608
+ // warning that names the consequence, not a failure to fix.
609
+ ...(superuserAllowedFor(recorded, readEnvironment(app.deployRoot)?.env.get('POSTGRES_USER')) ? { allowSuperuser: true } : {}),
610
+ ...(readEnvironment(app.deployRoot) ?? {}),
611
+ };
612
+ // Under --json nothing is written until the end: a partial checklist on
613
+ // stderr is useless to a machine, and colour is never consulted at all so
614
+ // no FORCE_COLOR can inject escapes into the pipe.
615
+ const colour = !json &&
616
+ shouldUseColour({
617
+ // `--no-color` arrives as `color: false`, matching commander's handling
618
+ // of a `--no-` flag; `requested` is undefined when the user said nothing.
619
+ requested: options.color === false ? false : undefined,
620
+ env: process.env,
621
+ isTTY: ctx?.isTty ?? process.stderr.isTTY === true,
622
+ });
623
+ if (!json) {
624
+ stderr.write('\n Prerequisites\n\n');
625
+ stderr.write(` Proxy: ${proxyRuntime.mode === 'container' ? `container ${proxyRuntime.container}` : 'host nginx'} (${proxyRuntime.source})\n\n`);
626
+ }
627
+ const results = await runChecks(checks, context, (result) => {
628
+ // Streamed as each completes: a dozen subprocess probes take long enough
629
+ // that a silent terminal looks like a hang.
630
+ if (!json)
631
+ stderr.write(renderResult(result, colour));
632
+ });
633
+ const report = {
634
+ ...buildReport(results),
635
+ proxy: { mode: proxyRuntime.mode, container: proxyRuntime.container, source: proxyRuntime.source },
636
+ };
637
+ if (json) {
638
+ stdout.write(`${JSON.stringify(report)}\n`);
639
+ }
640
+ else {
641
+ stderr.write(renderSummary(report.summary, colour));
642
+ }
643
+ if (!report.ok) {
644
+ const failed = results.filter((result) => result.severity === 'required' && result.status === 'fail');
645
+ throw new PreconditionError(`${failed.length} required check(s) failed: ${failed.map((result) => result.id).join(', ')}`);
646
+ }
647
+ }
648
+ /**
649
+ * The deployment record, or undefined -- including when it cannot be read.
650
+ *
651
+ * Doctor must work on a server where nothing is installed, and on one whose
652
+ * record is from a newer appctl; neither is a reason not to run the checks.
653
+ */
654
+ function readRecordSafely(deployRoot) {
655
+ try {
656
+ return readState(deployRoot);
657
+ }
658
+ catch {
659
+ return undefined;
660
+ }
661
+ }
662
+ /** Reads the deployment's .env, when there is one, for the database checks. */
663
+ function readEnvironment(deployRoot) {
664
+ try {
665
+ const contents = readFileSync(join(deployRoot, 'repo', 'infra', 'compose', '.env'), 'utf8');
666
+ return { env: parseEnvFile(contents) };
667
+ }
668
+ catch {
669
+ // Absent before a first install; the database checks then report `skip`.
670
+ return undefined;
671
+ }
672
+ }
673
+ export function buildReport(results) {
674
+ return {
675
+ ok: checksPassed(results),
676
+ checks: results.map((result) => ({
677
+ id: result.id,
678
+ title: result.title,
679
+ severity: result.severity,
680
+ status: result.status,
681
+ detail: result.detail,
682
+ ...(result.remedy === undefined ? {} : { remedy: result.remedy }),
683
+ durationMs: result.durationMs,
684
+ })),
685
+ summary: summarise(results),
686
+ };
687
+ }
688
+ /** The status glyphs, shared with the deploy screens so both say the same thing. */
689
+ export const MARKS = {
690
+ pass: 'OK',
691
+ warn: '!!',
692
+ fail: 'XX',
693
+ skip: '--',
694
+ };
695
+ const COLOURS = {
696
+ pass: '32',
697
+ warn: '33',
698
+ fail: '31',
699
+ skip: '90',
700
+ };
701
+ const TITLE_WIDTH = 30;
702
+ /** Installed, reachable, and not working. Distinct from "not installed". */
703
+ export class DeploymentUnhealthyError extends CliError {
704
+ exitCode = EXIT.FAILURE;
705
+ }
706
+ /** One check, rendered. Exported for its test. */
707
+ export function renderResult(result, colour) {
708
+ // A GLYPH as well as a colour. These are read over SSH, piped into files,
709
+ // and by people who cannot distinguish red from green; colour alone would
710
+ // make the status invisible to all three.
711
+ const mark = MARKS[result.status];
712
+ const painted = colour ? `${ESC}[${COLOURS[result.status]}m${mark}${RESET}` : mark;
713
+ const lines = [` ${painted} ${result.title.padEnd(TITLE_WIDTH)}${result.detail}\n`];
714
+ if (result.remedy !== undefined && (result.status === 'fail' || result.status === 'warn')) {
715
+ // The arrow marks the remedy once; continuation lines are indented to
716
+ // line up under it, so a wrapped sentence reads as one sentence rather
717
+ // than as several separate instructions.
718
+ wrap(result.remedy, 66).forEach((line, index) => {
719
+ lines.push(` ${index === 0 ? '->' : ' '} ${line}\n`);
720
+ });
721
+ }
722
+ return lines.join('');
723
+ }
724
+ export function renderSummary(summary, colour) {
725
+ const parts = [`${summary.passed} passed`];
726
+ if (summary.warned > 0)
727
+ parts.unshift(`${summary.warned} warning(s)`);
728
+ if (summary.failed > 0)
729
+ parts.unshift(`${summary.failed} failed`);
730
+ if (summary.skipped > 0)
731
+ parts.push(`${summary.skipped} skipped`);
732
+ const line = parts.join(', ');
733
+ const painted = colour && summary.failed > 0 ? `${ESC}[31m${line}${RESET}` : line;
734
+ return `\n ${painted}\n\n`;
735
+ }
736
+ /** Wraps a remedy so it stays readable in an 80-column SSH session. */
737
+ function wrap(text, width) {
738
+ const words = text.split(/\s+/);
739
+ const lines = [];
740
+ let current = '';
741
+ for (const word of words) {
742
+ if (current === '') {
743
+ current = word;
744
+ }
745
+ else if (`${current} ${word}`.length <= width) {
746
+ current = `${current} ${word}`;
747
+ }
748
+ else {
749
+ lines.push(current);
750
+ current = word;
751
+ }
752
+ }
753
+ if (current !== '')
754
+ lines.push(current);
755
+ return lines;
756
+ }
757
+ /**
758
+ * ⚠ EXITS 0 WHEN THERE IS NO RECORD. An absent document is one of three normal
759
+ * states, not a failure: this command answers "what does this server say it is
760
+ * running", and "nothing has written that down here" is a real answer to it.
761
+ */
762
+ export function runAboutCommand(options, ctx) {
763
+ const app = resolveApp(options);
764
+ const report = readAbout(app.deployRoot);
765
+ if (options.json === true) {
766
+ (ctx?.stdout ?? process.stdout).write(`${JSON.stringify(report, null, 2)}\n`);
767
+ return;
768
+ }
769
+ (ctx?.stderr ?? process.stderr).write(`${renderAbout(report)}\n`);
770
+ }
771
+ export async function runStatusCommand(options, ctx) {
772
+ // ⚠ Resolved through the five ranks, not read off `--root`. See
773
+ // `resolveApp`: with a defaulted `--root` every rank below the first
774
+ // was dead code, including the cwd walk the resolver exists for.
775
+ const app = resolveApp(options);
776
+ const stdout = ctx?.stdout ?? process.stdout;
777
+ const stderr = ctx?.stderr ?? process.stderr;
778
+ const json = options.json === true;
779
+ // ⚠ EVIDENCE, NOT THE RECORD -- the same wrong question `update` used to
780
+ // ask, from the other side. Guarding on the state file meant a deployment
781
+ // whose record was lost -- containers up, certificate issued, site serving --
782
+ // was reported as "No deployment found" by the ONE command an operator runs
783
+ // when something is wrong. `status` needs no record to do its job: it probes
784
+ // the containers and the endpoints, and the record only supplies the compose
785
+ // project and the deployed revision.
786
+ //
787
+ // "Nothing installed" is still a USAGE problem, distinct from "installed and
788
+ // unhealthy" -- a monitoring script must be able to tell them apart. That
789
+ // distinction is preserved; it is just asked of the deployment rather than of
790
+ // the bookkeeping about it.
791
+ const state = readState(app.deployRoot);
792
+ if (state === undefined && !isDeployment(app.deployRoot)) {
793
+ throw new UsageError(`No deployment found at ${app.deployRoot}. Run \`${cliName()} deploy install\` first, or pass --root.`);
794
+ }
795
+ const report = await collectHealth({
796
+ runCommand: ctx?.runCommand ?? runCommand,
797
+ deployRoot: app.deployRoot,
798
+ bindPort: Number(options.port),
799
+ ...(options.domain === undefined ? {} : { domain: options.domain }),
800
+ // ⚠ From the RECORD, never derived. `status` reads the containers, so
801
+ // looking in the wrong compose project reports a healthy stack as absent.
802
+ // Absent when the record was lost: `composeProjectFor(undefined)` is the
803
+ // directory-derived default, which is what such a deployment is running
804
+ // under anyway -- it predates the naming or lost the file that recorded it.
805
+ ...(state === undefined || composeProjectFor(state) === undefined
806
+ ? {}
807
+ : { composeProject: composeProjectFor(state) }),
808
+ ...(state === undefined ? {} : { state }),
809
+ // The compose files this stack was started with depend on the groups
810
+ // install recorded (compose-files.ts), plus the always-on ones (#567).
811
+ ...(state?.groups === undefined ? {} : { groups: state.groups }),
812
+ ...(ctx?.fetch === undefined ? {} : { fetch: ctx.fetch }),
813
+ // #391: the sign-in wiring, from the deployment's own .env. Reported, and
814
+ // deliberately NOT part of `healthy` -- that stays "is it serving", which
815
+ // is what a monitoring script branches on.
816
+ ...oauthSmokeTarget(false, statusEnvironment(app.deployRoot)),
817
+ });
818
+ const healthy = isHealthy(report);
819
+ if (json) {
820
+ stdout.write(`${JSON.stringify({ healthy, ...report })}\n`);
821
+ }
822
+ else {
823
+ const colour = shouldUseColour({
824
+ requested: options.color === false ? false : undefined,
825
+ env: process.env,
826
+ isTTY: ctx?.isTty ?? process.stderr.isTTY === true,
827
+ });
828
+ stderr.write(renderHealth(report, healthy, colour));
829
+ }
830
+ if (!healthy) {
831
+ throw new DeploymentUnhealthyError(`The deployment at ${app.deployRoot} is not healthy.`);
832
+ }
833
+ }
834
+ /** The deployment's .env for the OAuth smoke, or undefined when unreadable. */
835
+ function statusEnvironment(deployRoot) {
836
+ const path = resolveEnvPath(deployRoot);
837
+ if (path === undefined)
838
+ return undefined;
839
+ try {
840
+ return readEnvFile(path);
841
+ }
842
+ catch {
843
+ return undefined;
844
+ }
845
+ }
846
+ function probeLine(label, result) {
847
+ const outcome = result.ok
848
+ ? `${result.status ?? 'ok'} (${result.durationMs}ms)`
849
+ : (result.error ?? `HTTP ${result.status ?? '?'}`);
850
+ return ` ${label.padEnd(TITLE_WIDTH)}${outcome}\n`;
851
+ }
852
+ /** The human report. Exported for its test. */
853
+ export function renderHealth(report, healthy, colour) {
854
+ const lines = ['\n Deployment\n\n'];
855
+ if (report.deployed !== undefined) {
856
+ lines.push(` ${'Revision'.padEnd(TITLE_WIDTH)}${report.deployed.commitSha.slice(0, 12)} (${report.deployed.ref})\n`);
857
+ lines.push(` ${'Last deployed'.padEnd(TITLE_WIDTH)}${report.deployed.lastDeployedAt} by ${report.deployed.lastCommand}\n`);
858
+ }
859
+ lines.push('\n Containers\n\n');
860
+ if (report.containers.length === 0) {
861
+ lines.push(' none reported\n');
862
+ if (report.composeProblem !== undefined) {
863
+ // docker compose refused over a required variable; say why, indented
864
+ // under the section it explains.
865
+ lines.push(`\n${report.composeProblem.split('\n').map((line) => ` ${line}`).join('\n')}\n`);
866
+ }
867
+ }
868
+ else {
869
+ for (const container of report.containers) {
870
+ const health = container.health === undefined ? '' : ` (${container.health})`;
871
+ lines.push(` ${container.service.padEnd(TITLE_WIDTH)}${container.state}${health}\n`);
872
+ }
873
+ }
874
+ lines.push('\n Probes\n\n');
875
+ lines.push(probeLine('Liveness', report.local.live));
876
+ lines.push(probeLine('Readiness', report.local.ready));
877
+ lines.push(probeLine('Frontend', report.local.frontend));
878
+ if (report.external !== undefined) {
879
+ lines.push(probeLine('External HTTPS', report.external.probe));
880
+ }
881
+ if (report.oauth !== undefined) {
882
+ const outcome = report.oauth.status === 'pass'
883
+ ? 'ok'
884
+ : `${report.oauth.status === 'fail' ? 'FAILED' : 'unverified'}: ${report.oauth.detail}`;
885
+ const painted = colour && report.oauth.status === 'fail' ? `${ESC}[31m${outcome}${RESET}` : outcome;
886
+ lines.push(` ${'Google sign-in'.padEnd(TITLE_WIDTH)}${painted}\n`);
887
+ if (report.oauth.status !== 'pass' && report.oauth.remedy !== undefined) {
888
+ lines.push(` -> ${report.oauth.remedy}\n`);
889
+ }
890
+ }
891
+ lines.push('\n Schema\n\n');
892
+ if (!report.migrations.known) {
893
+ lines.push(` ${'Migrations'.padEnd(TITLE_WIDTH)}could not be determined\n`);
894
+ }
895
+ else if (report.migrations.pending.length > 0) {
896
+ // Readiness can be green while this is red; that is the whole point of
897
+ // reporting it separately.
898
+ lines.push(` ${'Migrations'.padEnd(TITLE_WIDTH)}${report.migrations.pending.length} pending\n`);
899
+ for (const pending of report.migrations.pending) {
900
+ lines.push(` -> ${pending}\n`);
901
+ }
902
+ }
903
+ else {
904
+ lines.push(` ${'Migrations'.padEnd(TITLE_WIDTH)}up to date\n`);
905
+ }
906
+ const verdict = healthy ? 'healthy' : 'NOT healthy';
907
+ const painted = colour && !healthy ? `${ESC}[31m${verdict}${RESET}` : verdict;
908
+ lines.push(`\n ${painted}\n\n`);
909
+ return lines.join('');
910
+ }
911
+ /**
912
+ * The role options a run starts with: the flags, over the answers-file keys
913
+ * (`DB_ADMIN_USER`, `DB_ADMIN_PASSWORD`, `APP_DB_USER`), which are removed from
914
+ * the answers so none of them -- the administrative password above all -- can
915
+ * reach `.env`. A flag wins over the file, like `--answer` does.
916
+ */
917
+ function appRoleOptions(options, fromAnswers) {
918
+ const appDbUser = options.appDbUser ?? fromAnswers.appDbUser;
919
+ const adminUser = options.adminUser ?? fromAnswers.adminUser;
920
+ return {
921
+ ...(appDbUser === undefined ? {} : { appDbUser }),
922
+ ...(adminUser === undefined ? {} : { adminUser }),
923
+ ...(fromAnswers.adminPassword === undefined ? {} : { adminPassword: fromAnswers.adminPassword }),
924
+ ...(options.skipRoleProvisioning === true ? { skipRoleProvisioning: true } : {}),
925
+ ...(options.allowSuperuser === true ? { allowSuperuser: true } : {}),
926
+ ...(options.rotateAppPassword === true ? { rotateAppPassword: true } : {}),
927
+ ...(options.provisionAppRole === true ? { provisionAppRole: true } : {}),
928
+ ...(options.transferOwnership === true ? { transferOwnership: true } : {}),
929
+ ...(options.allowReducedRole === true ? { allowReducedRole: true } : {}),
930
+ ...(options.showCredentials === true ? { showCredentials: true } : {}),
931
+ };
932
+ }
933
+ function collectGroup(value, previous) {
934
+ return [...previous, value];
935
+ }
936
+ /**
937
+ * Which deployment a subcommand is acting on.
938
+ *
939
+ * =============================================================================
940
+ * ⚠ THE RESOLVER HAD NO CALLERS
941
+ * =============================================================================
942
+ *
943
+ * `locateApp` and its five ranks shipped with `deploy list` and nothing else,
944
+ * so every other subcommand still read a bare `--root` that defaulted to the
945
+ * apps root. That made ranks 2 through 5 unreachable from the command line:
946
+ * `--name` did not exist, the SOLE-APP case was never tried, the ambiguity
947
+ * refusal could never fire -- and, worst, neither could RANK 3, the cwd walk,
948
+ * which is the one defect the resolver was written to fix. An operator
949
+ * standing inside their own deployment was told to pass a flag that did not
950
+ * exist, by a command run from the directory the error had just left them in.
951
+ *
952
+ * ⚠ AND `--root` CARRIED A DEFAULT, which is what made this invisible. With a
953
+ * default, `options.root` is always defined and rank 1 always wins, so adding
954
+ * the lower ranks would have changed nothing at all. The default is gone; an
955
+ * unpassed `--root` is now genuinely absent.
956
+ * =============================================================================
957
+ */
958
+ /**
959
+ * Collects a repeated `--answer key=value` into a map.
960
+ *
961
+ * ⚠ SPLIT ON THE FIRST `=` ONLY. A signing secret is base64 and base64 ends in
962
+ * `=` padding, so splitting on every one truncates exactly the values that
963
+ * must not be truncated.
964
+ */
965
+ function collectAnswer(entry, previous) {
966
+ const at = entry.indexOf('=');
967
+ if (at <= 0) {
968
+ throw new UsageError(`--answer expects KEY=value, not \`${entry}\`.`);
969
+ }
970
+ return new Map(previous).set(entry.slice(0, at), entry.slice(at + 1));
971
+ }
972
+ /**
973
+ * The answers a run starts with, from `--answers-file` and `--answer`.
974
+ *
975
+ * ⚠ `--answer` WINS OVER THE FILE. The flag is the narrower, later, more
976
+ * deliberate statement -- an operator overriding one value of a shared answers
977
+ * file on one run. The other order makes the flag silently do nothing.
978
+ */
979
+ function collectedAnswers(options, warn) {
980
+ const fromFile = options.answersFile === undefined ? undefined : readAnswersFile(options.answersFile);
981
+ for (const warning of fromFile?.warnings ?? [])
982
+ warn(warning);
983
+ const merged = new Map([
984
+ ...(fromFile?.values ?? new Map()),
985
+ ...(options.answer ?? new Map()),
986
+ ]);
987
+ return merged.size === 0 ? undefined : merged;
988
+ }
989
+ function resolveApp(options, { mayBeAbsent = false } = {}) {
990
+ const request = {
991
+ ...(options.root === undefined ? {} : { root: options.root }),
992
+ ...(options.name === undefined ? {} : { name: options.name }),
993
+ ...(options.appsRoot === undefined ? {} : { appsRoot: options.appsRoot }),
994
+ };
995
+ try {
996
+ return locateApp(request);
997
+ }
998
+ catch (error) {
999
+ // ⚠ `doctor` AND `install` MUST WORK WHEN NOTHING IS INSTALLED. That is
1000
+ // the entire point of a preflight, and install's job is to create the
1001
+ // thing the other commands require. Ranks 4 and 5 both ask "which of the
1002
+ // deployments here?", which is not a question either of them has -- so a
1003
+ // refusal from those ranks becomes the apps root itself, exactly the value
1004
+ // `--root` used to default to.
1005
+ //
1006
+ // ⚠ NOT EXTENDED TO `update`/`status`/`certs`/`uninstall`. Those act on a
1007
+ // deployment that must already exist, and falling back would point them at
1008
+ // a directory nothing was installed into -- turning "which one did you
1009
+ // mean?" into a confusing failure somewhere further in.
1010
+ if (!mayBeAbsent || !(error instanceof UsageError))
1011
+ throw error;
1012
+ const appsRoot = resolve(options.appsRoot ?? DEFAULT_APPS_ROOT);
1013
+ return { name: basename(appsRoot), deployRoot: appsRoot, appsRoot, via: 'root' };
1014
+ }
1015
+ }
1016
+ export async function runInstallCommand(options, ctx) {
1017
+ // ⚠ Resolved through the five ranks, not read off `--root`. See
1018
+ // `resolveApp`: with a defaulted `--root` every rank below the first
1019
+ // was dead code, including the cwd walk the resolver exists for.
1020
+ const app = resolveApp(options, { mayBeAbsent: true });
1021
+ const proxy = proxyFlags(options);
1022
+ const stdout = ctx?.stdout ?? process.stdout;
1023
+ const stderr = ctx?.stderr ?? process.stderr;
1024
+ const json = options.json === true;
1025
+ const { answers, role } = extractRoleAnswers(collectedAnswers(options, (message) => stderr.write(`warning: ${message}\n`)));
1026
+ const installOptions = {
1027
+ ...appRoleOptions(options, role),
1028
+ deployRoot: app.deployRoot,
1029
+ bindPort: Number(options.port),
1030
+ proxyRoot: options.proxyRoot,
1031
+ ...(proxy.mode === undefined ? {} : { proxyMode: proxy.mode }),
1032
+ ...(proxy.container === undefined ? {} : { proxyContainer: proxy.container }),
1033
+ groups: options.group,
1034
+ ...(options.domain === undefined ? {} : { domain: options.domain }),
1035
+ ...(options.repo === undefined ? {} : { repo: options.repo }),
1036
+ ...(options.ref === undefined ? {} : { ref: options.ref }),
1037
+ ...(options.email === undefined ? {} : { email: options.email }),
1038
+ ...(options.all === undefined ? {} : { all: options.all }),
1039
+ ...(options.nonInteractive === undefined ? {} : { nonInteractive: options.nonInteractive }),
1040
+ ...(options.reinstall === undefined ? {} : { reinstall: options.reinstall }),
1041
+ ...(options.resume === undefined ? {} : { resume: options.resume }),
1042
+ ...(options.skipDoctor === undefined ? {} : { skipDoctor: options.skipDoctor }),
1043
+ ...(options.skipProxy === undefined ? {} : { skipProxy: options.skipProxy }),
1044
+ ...(options.skipSeed === undefined ? {} : { skipSeed: options.skipSeed }),
1045
+ ...(options.bootstrapProxy === undefined ? {} : { bootstrapProxy: options.bootstrapProxy }),
1046
+ ...(options.createDatabase === undefined ? {} : { createDatabase: options.createDatabase }),
1047
+ ...(options.skipRenewal === undefined ? {} : { skipRenewal: options.skipRenewal }),
1048
+ ...(options.skipOauthCheck === undefined ? {} : { skipOAuthCheck: options.skipOauthCheck }),
1049
+ ...(options.cache === false ? { noCache: true } : {}),
1050
+ ...(options.force === undefined ? {} : { force: options.force }),
1051
+ ...(options.staging === undefined ? {} : { staging: options.staging }),
1052
+ ...(options.appVersion === undefined ? {} : { appVersion: options.appVersion }),
1053
+ ...(options.versionBump === false ? { noVersionBump: true } : {}),
1054
+ ...(answers === undefined ? {} : { answers }),
1055
+ ...(ctx?.runCommand === undefined ? {} : { runCommand: ctx.runCommand }),
1056
+ // Rendered as lines on stderr here; #184's screen renders the identical
1057
+ // callbacks as React state. One implementation, two renderers.
1058
+ ...(json
1059
+ ? {}
1060
+ : {
1061
+ hooks: {
1062
+ onStepStart: ({ title, index, total }) => void stderr.write(`\n [${index + 1}/${total}] ${title}\n`),
1063
+ onStepResult: (result) => void stderr.write(result.outcome === 'ok'
1064
+ ? ` done (${result.durationMs}ms)\n`
1065
+ : ` ${result.outcome}: ${result.detail ?? ''}\n`),
1066
+ onProgress: (message) => void stderr.write(` ${message}\n`),
1067
+ onLog: (line) => void stderr.write(` ${line}\n`),
1068
+ },
1069
+ }),
1070
+ };
1071
+ const result = await runInstall(installOptions);
1072
+ if (json) {
1073
+ stdout.write(`${JSON.stringify(result)}\n`);
1074
+ return;
1075
+ }
1076
+ stderr.write([
1077
+ '',
1078
+ ' Installed.',
1079
+ '',
1080
+ ` Revision ${result.commitSha.slice(0, 12)}`,
1081
+ ` Log ${result.journalPath}`,
1082
+ '',
1083
+ ` ${result.nextStep}`,
1084
+ '',
1085
+ ].join('\n'));
1086
+ writeCredentials(stderr, result.credentials);
1087
+ }
1088
+ /**
1089
+ * Shows the generated application database login ONCE, on request
1090
+ * (`--show-credentials`, #980). To the terminal only: never the journal, and
1091
+ * the caller passes nothing unless it was asked.
1092
+ */
1093
+ function writeCredentials(stderr, credentials) {
1094
+ if (credentials === undefined)
1095
+ return;
1096
+ stderr.write([
1097
+ ' Application database login (shown once; it is also in the deployment\'s .env, mode 0600):',
1098
+ ` POSTGRES_USER=${credentials.user}`,
1099
+ ` POSTGRES_PASSWORD=${credentials.password}`,
1100
+ '',
1101
+ ].join('\n'));
1102
+ }
1103
+ export async function runUpdateCommand(options, ctx) {
1104
+ // ⚠ Resolved through the five ranks, not read off `--root`. See
1105
+ // `resolveApp`: with a defaulted `--root` every rank below the first
1106
+ // was dead code, including the cwd walk the resolver exists for.
1107
+ const app = resolveApp(options);
1108
+ const proxy = proxyFlags(options);
1109
+ const stdout = ctx?.stdout ?? process.stdout;
1110
+ const stderr = ctx?.stderr ?? process.stderr;
1111
+ const json = options.json === true;
1112
+ const { answers, role } = extractRoleAnswers(collectedAnswers(options, (message) => stderr.write(`warning: ${message}\n`)));
1113
+ const updateOptions = {
1114
+ ...appRoleOptions(options, role),
1115
+ deployRoot: app.deployRoot,
1116
+ ...(proxy.mode === undefined ? {} : { proxyMode: proxy.mode }),
1117
+ ...(proxy.container === undefined ? {} : { proxyContainer: proxy.container }),
1118
+ ...(options.ref === undefined ? {} : { ref: options.ref }),
1119
+ ...(options.force === undefined ? {} : { force: options.force }),
1120
+ ...(options.cache === false ? { noCache: true } : {}),
1121
+ ...(options.nonInteractive === undefined ? {} : { nonInteractive: options.nonInteractive }),
1122
+ ...(options.skipSeed === undefined ? {} : { skipSeed: options.skipSeed }),
1123
+ ...(options.skipProxy === undefined ? {} : { skipProxy: options.skipProxy }),
1124
+ ...(options.createDatabase === undefined ? {} : { createDatabase: options.createDatabase }),
1125
+ ...(options.skipRenewal === undefined ? {} : { skipRenewal: options.skipRenewal }),
1126
+ ...(options.skipOauthCheck === undefined ? {} : { skipOAuthCheck: options.skipOauthCheck }),
1127
+ ...(options.appVersion === undefined ? {} : { appVersion: options.appVersion }),
1128
+ ...(options.versionBump === false ? { noVersionBump: true } : {}),
1129
+ ...(options.maintenance === undefined ? {} : { maintenance: options.maintenance }),
1130
+ ...(answers === undefined ? {} : { answers }),
1131
+ ...(ctx?.runCommand === undefined ? {} : { runCommand: ctx.runCommand }),
1132
+ ...(json
1133
+ ? {}
1134
+ : {
1135
+ hooks: {
1136
+ onStepStart: ({ title, index, total }) => void stderr.write(`\n [${index + 1}/${total}] ${title}\n`),
1137
+ onStepResult: (result) => void stderr.write(result.outcome === 'ok'
1138
+ ? ` done (${result.durationMs}ms)\n`
1139
+ : ` ${result.outcome}: ${result.detail ?? ''}\n`),
1140
+ onProgress: (message) => void stderr.write(` ${message}\n`),
1141
+ onLog: (line) => void stderr.write(` ${line}\n`),
1142
+ },
1143
+ }),
1144
+ };
1145
+ const result = await runUpdate(updateOptions);
1146
+ if (json) {
1147
+ stdout.write(`${JSON.stringify(result)}\n`);
1148
+ return;
1149
+ }
1150
+ if (!result.changed) {
1151
+ stderr.write(`\n Already at ${result.commitSha.slice(0, 12)}. Nothing to do.\n\n`);
1152
+ writeCredentials(stderr, result.credentials);
1153
+ return;
1154
+ }
1155
+ stderr.write([
1156
+ '',
1157
+ ' Updated.',
1158
+ '',
1159
+ ` ${(result.previousSha ?? 'unknown').slice(0, 12)} -> ${result.commitSha.slice(0, 12)}`,
1160
+ ` Took ${Math.round(result.durationMs / 1000)}s`,
1161
+ ` Log ${result.journalPath}`,
1162
+ '',
1163
+ ].join('\n'));
1164
+ writeCredentials(stderr, result.credentials);
1165
+ }
1166
+ //# sourceMappingURL=deploy.js.map