@supatype/cli 0.8.0 → 0.9.1

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 (501) hide show
  1. package/CHANGELOG.md +415 -0
  2. package/bin/supatype.js +16 -1
  3. package/dist/after-hooks-health.d.ts +19 -0
  4. package/dist/after-hooks-health.d.ts.map +1 -0
  5. package/dist/after-hooks-health.js +69 -0
  6. package/dist/after-hooks-health.js.map +1 -0
  7. package/dist/app/proxy-dev-app.d.ts +13 -3
  8. package/dist/app/proxy-dev-app.d.ts.map +1 -1
  9. package/dist/app/proxy-dev-app.js +58 -62
  10. package/dist/app/proxy-dev-app.js.map +1 -1
  11. package/dist/app-vite-env.d.ts +5 -1
  12. package/dist/app-vite-env.d.ts.map +1 -1
  13. package/dist/app-vite-env.js +9 -15
  14. package/dist/app-vite-env.js.map +1 -1
  15. package/dist/augmentation-generator.d.ts +5 -0
  16. package/dist/augmentation-generator.d.ts.map +1 -1
  17. package/dist/augmentation-generator.js +13 -4
  18. package/dist/augmentation-generator.js.map +1 -1
  19. package/dist/auth-providers.d.ts +5 -4
  20. package/dist/auth-providers.d.ts.map +1 -1
  21. package/dist/auth-providers.js +3 -12
  22. package/dist/auth-providers.js.map +1 -1
  23. package/dist/binary-cache.d.ts +2 -1
  24. package/dist/binary-cache.d.ts.map +1 -1
  25. package/dist/binary-cache.js +2 -4
  26. package/dist/binary-cache.js.map +1 -1
  27. package/dist/build-spawn.d.ts +35 -0
  28. package/dist/build-spawn.d.ts.map +1 -0
  29. package/dist/build-spawn.js +75 -0
  30. package/dist/build-spawn.js.map +1 -0
  31. package/dist/byte-size.d.ts +9 -0
  32. package/dist/byte-size.d.ts.map +1 -0
  33. package/dist/byte-size.js +36 -0
  34. package/dist/byte-size.js.map +1 -0
  35. package/dist/cache-clean.d.ts +0 -2
  36. package/dist/cache-clean.d.ts.map +1 -1
  37. package/dist/cache-clean.js +1 -27
  38. package/dist/cache-clean.js.map +1 -1
  39. package/dist/cache-pins.d.ts.map +1 -1
  40. package/dist/cache-pins.js +1 -18
  41. package/dist/cache-pins.js.map +1 -1
  42. package/dist/cache-root.d.ts +7 -0
  43. package/dist/cache-root.d.ts.map +1 -0
  44. package/dist/cache-root.js +11 -0
  45. package/dist/cache-root.js.map +1 -0
  46. package/dist/cli-artifacts.d.ts.map +1 -1
  47. package/dist/cli-artifacts.js +2 -1
  48. package/dist/cli-artifacts.js.map +1 -1
  49. package/dist/cli-install-method.d.ts.map +1 -1
  50. package/dist/cli-install-method.js +7 -1
  51. package/dist/cli-install-method.js.map +1 -1
  52. package/dist/cli-launcher.d.ts +21 -0
  53. package/dist/cli-launcher.d.ts.map +1 -0
  54. package/dist/cli-launcher.js +112 -0
  55. package/dist/cli-launcher.js.map +1 -0
  56. package/dist/cli-old-versions.d.ts +44 -0
  57. package/dist/cli-old-versions.d.ts.map +1 -0
  58. package/dist/cli-old-versions.js +83 -0
  59. package/dist/cli-old-versions.js.map +1 -0
  60. package/dist/cli-program-path.d.ts +20 -0
  61. package/dist/cli-program-path.d.ts.map +1 -0
  62. package/dist/cli-program-path.js +41 -0
  63. package/dist/cli-program-path.js.map +1 -0
  64. package/dist/cli-standalone.d.ts +2 -3
  65. package/dist/cli-standalone.d.ts.map +1 -1
  66. package/dist/cli-standalone.js +51 -24
  67. package/dist/cli-standalone.js.map +1 -1
  68. package/dist/cli-version-embedded.js +1 -1
  69. package/dist/cli.d.ts.map +1 -1
  70. package/dist/cli.js +4 -0
  71. package/dist/cli.js.map +1 -1
  72. package/dist/cloud-credentials.d.ts.map +1 -1
  73. package/dist/cloud-credentials.js +3 -1
  74. package/dist/cloud-credentials.js.map +1 -1
  75. package/dist/commands/admin.d.ts.map +1 -1
  76. package/dist/commands/admin.js +6 -4
  77. package/dist/commands/admin.js.map +1 -1
  78. package/dist/commands/adopt.js +1 -1
  79. package/dist/commands/adopt.js.map +1 -1
  80. package/dist/commands/build.d.ts +29 -0
  81. package/dist/commands/build.d.ts.map +1 -0
  82. package/dist/commands/build.js +69 -0
  83. package/dist/commands/build.js.map +1 -0
  84. package/dist/commands/cache.d.ts.map +1 -1
  85. package/dist/commands/cache.js +37 -7
  86. package/dist/commands/cache.js.map +1 -1
  87. package/dist/commands/db.d.ts.map +1 -1
  88. package/dist/commands/db.js +46 -23
  89. package/dist/commands/db.js.map +1 -1
  90. package/dist/commands/deploy.d.ts +14 -0
  91. package/dist/commands/deploy.d.ts.map +1 -1
  92. package/dist/commands/deploy.js +68 -53
  93. package/dist/commands/deploy.js.map +1 -1
  94. package/dist/commands/dev.d.ts.map +1 -1
  95. package/dist/commands/dev.js +36 -19
  96. package/dist/commands/dev.js.map +1 -1
  97. package/dist/commands/diff.d.ts +3 -0
  98. package/dist/commands/diff.d.ts.map +1 -1
  99. package/dist/commands/diff.js +28 -34
  100. package/dist/commands/diff.js.map +1 -1
  101. package/dist/commands/doctor.d.ts +32 -0
  102. package/dist/commands/doctor.d.ts.map +1 -1
  103. package/dist/commands/doctor.js +67 -2
  104. package/dist/commands/doctor.js.map +1 -1
  105. package/dist/commands/functions.d.ts.map +1 -1
  106. package/dist/commands/functions.js +21 -16
  107. package/dist/commands/functions.js.map +1 -1
  108. package/dist/commands/hooks.d.ts.map +1 -1
  109. package/dist/commands/hooks.js +23 -15
  110. package/dist/commands/hooks.js.map +1 -1
  111. package/dist/commands/init.d.ts +33 -7
  112. package/dist/commands/init.d.ts.map +1 -1
  113. package/dist/commands/init.js +432 -333
  114. package/dist/commands/init.js.map +1 -1
  115. package/dist/commands/internal.d.ts.map +1 -1
  116. package/dist/commands/internal.js +27 -7
  117. package/dist/commands/internal.js.map +1 -1
  118. package/dist/commands/introspect.d.ts.map +1 -1
  119. package/dist/commands/introspect.js +3 -0
  120. package/dist/commands/introspect.js.map +1 -1
  121. package/dist/commands/keys-print.d.ts +20 -0
  122. package/dist/commands/keys-print.d.ts.map +1 -0
  123. package/dist/commands/keys-print.js +47 -0
  124. package/dist/commands/keys-print.js.map +1 -0
  125. package/dist/commands/keys.d.ts +10 -10
  126. package/dist/commands/keys.d.ts.map +1 -1
  127. package/dist/commands/keys.js +47 -43
  128. package/dist/commands/keys.js.map +1 -1
  129. package/dist/commands/link-helpers.d.ts.map +1 -1
  130. package/dist/commands/link-helpers.js +27 -7
  131. package/dist/commands/link-helpers.js.map +1 -1
  132. package/dist/commands/migrate.d.ts +5 -2
  133. package/dist/commands/migrate.d.ts.map +1 -1
  134. package/dist/commands/migrate.js +34 -36
  135. package/dist/commands/migrate.js.map +1 -1
  136. package/dist/commands/pull.d.ts.map +1 -1
  137. package/dist/commands/pull.js +6 -5
  138. package/dist/commands/pull.js.map +1 -1
  139. package/dist/commands/push.d.ts +2 -0
  140. package/dist/commands/push.d.ts.map +1 -1
  141. package/dist/commands/push.js +64 -26
  142. package/dist/commands/push.js.map +1 -1
  143. package/dist/commands/rename.js +1 -1
  144. package/dist/commands/rename.js.map +1 -1
  145. package/dist/commands/seed.d.ts +2 -11
  146. package/dist/commands/seed.d.ts.map +1 -1
  147. package/dist/commands/seed.js +11 -38
  148. package/dist/commands/seed.js.map +1 -1
  149. package/dist/commands/self-host.d.ts.map +1 -1
  150. package/dist/commands/self-host.js +88 -29
  151. package/dist/commands/self-host.js.map +1 -1
  152. package/dist/commands/self-update.d.ts.map +1 -1
  153. package/dist/commands/self-update.js +9 -3
  154. package/dist/commands/self-update.js.map +1 -1
  155. package/dist/commands/sso.d.ts +26 -0
  156. package/dist/commands/sso.d.ts.map +1 -0
  157. package/dist/commands/sso.js +362 -0
  158. package/dist/commands/sso.js.map +1 -0
  159. package/dist/commands/status.d.ts.map +1 -1
  160. package/dist/commands/status.js +25 -8
  161. package/dist/commands/status.js.map +1 -1
  162. package/dist/component-launch.d.ts.map +1 -1
  163. package/dist/component-launch.js +2 -1
  164. package/dist/component-launch.js.map +1 -1
  165. package/dist/compose-db-roles.d.ts +4 -4
  166. package/dist/compose-db-roles.d.ts.map +1 -1
  167. package/dist/compose-db-roles.js +11 -10
  168. package/dist/compose-db-roles.js.map +1 -1
  169. package/dist/compose-engine-run.d.ts +9 -2
  170. package/dist/compose-engine-run.d.ts.map +1 -1
  171. package/dist/compose-engine-run.js +30 -13
  172. package/dist/compose-engine-run.js.map +1 -1
  173. package/dist/compose-kong.d.ts +4 -0
  174. package/dist/compose-kong.d.ts.map +1 -1
  175. package/dist/compose-kong.js +13 -3
  176. package/dist/compose-kong.js.map +1 -1
  177. package/dist/compose-services.d.ts +18 -0
  178. package/dist/compose-services.d.ts.map +1 -1
  179. package/dist/compose-services.js +47 -22
  180. package/dist/compose-services.js.map +1 -1
  181. package/dist/config-mailer-env.d.ts +27 -0
  182. package/dist/config-mailer-env.d.ts.map +1 -0
  183. package/dist/config-mailer-env.js +47 -0
  184. package/dist/config-mailer-env.js.map +1 -0
  185. package/dist/config.d.ts +9 -1
  186. package/dist/config.d.ts.map +1 -1
  187. package/dist/config.js +18 -3
  188. package/dist/config.js.map +1 -1
  189. package/dist/database-url-owner.d.ts +5 -3
  190. package/dist/database-url-owner.d.ts.map +1 -1
  191. package/dist/database-url-owner.js +7 -4
  192. package/dist/database-url-owner.js.map +1 -1
  193. package/dist/db-port.d.ts +2 -0
  194. package/dist/db-port.d.ts.map +1 -1
  195. package/dist/db-port.js +1 -1
  196. package/dist/db-port.js.map +1 -1
  197. package/dist/db-preflight.d.ts +32 -3
  198. package/dist/db-preflight.d.ts.map +1 -1
  199. package/dist/db-preflight.js +211 -86
  200. package/dist/db-preflight.js.map +1 -1
  201. package/dist/db-rows.d.ts +3 -2
  202. package/dist/db-rows.d.ts.map +1 -1
  203. package/dist/db-rows.js +19 -4
  204. package/dist/db-rows.js.map +1 -1
  205. package/dist/dev-compose.d.ts +65 -5
  206. package/dist/dev-compose.d.ts.map +1 -1
  207. package/dist/dev-compose.js +262 -155
  208. package/dist/dev-compose.js.map +1 -1
  209. package/dist/dev-log-bus.d.ts +8 -0
  210. package/dist/dev-log-bus.d.ts.map +1 -1
  211. package/dist/dev-log-bus.js +13 -0
  212. package/dist/dev-log-bus.js.map +1 -1
  213. package/dist/dev-ports.d.ts +11 -4
  214. package/dist/dev-ports.d.ts.map +1 -1
  215. package/dist/dev-ports.js +87 -49
  216. package/dist/dev-ports.js.map +1 -1
  217. package/dist/dev-schema-watch.d.ts +8 -2
  218. package/dist/dev-schema-watch.d.ts.map +1 -1
  219. package/dist/dev-schema-watch.js +24 -13
  220. package/dist/dev-schema-watch.js.map +1 -1
  221. package/dist/dev-session.d.ts +27 -1
  222. package/dist/dev-session.d.ts.map +1 -1
  223. package/dist/dev-session.js +44 -4
  224. package/dist/dev-session.js.map +1 -1
  225. package/dist/dev-shutdown.d.ts.map +1 -1
  226. package/dist/dev-shutdown.js +19 -3
  227. package/dist/dev-shutdown.js.map +1 -1
  228. package/dist/diff-access.d.ts +10 -0
  229. package/dist/diff-access.d.ts.map +1 -0
  230. package/dist/diff-access.js +69 -0
  231. package/dist/diff-access.js.map +1 -0
  232. package/dist/diff-output.d.ts +7 -1
  233. package/dist/diff-output.d.ts.map +1 -1
  234. package/dist/diff-output.js +93 -3
  235. package/dist/diff-output.js.map +1 -1
  236. package/dist/docker-exec.d.ts.map +1 -1
  237. package/dist/docker-exec.js +4 -4
  238. package/dist/docker-exec.js.map +1 -1
  239. package/dist/docker-runtime.d.ts +10 -2
  240. package/dist/docker-runtime.d.ts.map +1 -1
  241. package/dist/docker-runtime.js +70 -23
  242. package/dist/docker-runtime.js.map +1 -1
  243. package/dist/engine-answers.d.ts +2 -1
  244. package/dist/engine-answers.d.ts.map +1 -1
  245. package/dist/engine-answers.js +11 -0
  246. package/dist/engine-answers.js.map +1 -1
  247. package/dist/engine-client.d.ts +20 -0
  248. package/dist/engine-client.d.ts.map +1 -1
  249. package/dist/engine-client.js +12 -8
  250. package/dist/engine-client.js.map +1 -1
  251. package/dist/engine-floor.d.ts +3 -2
  252. package/dist/engine-floor.d.ts.map +1 -1
  253. package/dist/engine-floor.js +2 -2
  254. package/dist/engine-floor.js.map +1 -1
  255. package/dist/engine-ownership-gate.d.ts +3 -1
  256. package/dist/engine-ownership-gate.d.ts.map +1 -1
  257. package/dist/engine-ownership-gate.js +5 -0
  258. package/dist/engine-ownership-gate.js.map +1 -1
  259. package/dist/engine-push-output.d.ts +8 -1
  260. package/dist/engine-push-output.d.ts.map +1 -1
  261. package/dist/engine-push-output.js +8 -1
  262. package/dist/engine-push-output.js.map +1 -1
  263. package/dist/env-file.d.ts +9 -2
  264. package/dist/env-file.d.ts.map +1 -1
  265. package/dist/env-file.js +56 -38
  266. package/dist/env-file.js.map +1 -1
  267. package/dist/env-lines.d.ts +3 -2
  268. package/dist/env-lines.d.ts.map +1 -1
  269. package/dist/env-lines.js +5 -2
  270. package/dist/env-lines.js.map +1 -1
  271. package/dist/env-value.d.ts +15 -0
  272. package/dist/env-value.d.ts.map +1 -0
  273. package/dist/env-value.js +34 -0
  274. package/dist/env-value.js.map +1 -0
  275. package/dist/error-message.d.ts +20 -0
  276. package/dist/error-message.d.ts.map +1 -1
  277. package/dist/error-message.js +42 -0
  278. package/dist/error-message.js.map +1 -1
  279. package/dist/frontend-env.d.ts +51 -0
  280. package/dist/frontend-env.d.ts.map +1 -0
  281. package/dist/frontend-env.js +101 -0
  282. package/dist/frontend-env.js.map +1 -0
  283. package/dist/frontend-values-linked.d.ts +22 -0
  284. package/dist/frontend-values-linked.d.ts.map +1 -0
  285. package/dist/frontend-values-linked.js +143 -0
  286. package/dist/frontend-values-linked.js.map +1 -0
  287. package/dist/frontend-values.d.ts +90 -0
  288. package/dist/frontend-values.d.ts.map +1 -0
  289. package/dist/frontend-values.js +208 -0
  290. package/dist/frontend-values.js.map +1 -0
  291. package/dist/functions-env-local.d.ts +13 -0
  292. package/dist/functions-env-local.d.ts.map +1 -0
  293. package/dist/functions-env-local.js +20 -0
  294. package/dist/functions-env-local.js.map +1 -0
  295. package/dist/generated/release-images.d.ts +4 -4
  296. package/dist/generated/release-images.js +2 -2
  297. package/dist/generated/release-images.js.map +1 -1
  298. package/dist/generated/typescript-libs.d.ts +4 -0
  299. package/dist/generated/typescript-libs.d.ts.map +1 -0
  300. package/dist/generated/typescript-libs.js +64 -0
  301. package/dist/generated/typescript-libs.js.map +1 -0
  302. package/dist/hook-actor.d.ts +17 -0
  303. package/dist/hook-actor.d.ts.map +1 -0
  304. package/dist/hook-actor.js +37 -0
  305. package/dist/hook-actor.js.map +1 -0
  306. package/dist/hook-columns.d.ts +30 -0
  307. package/dist/hook-columns.d.ts.map +1 -0
  308. package/dist/hook-columns.js +77 -0
  309. package/dist/hook-columns.js.map +1 -0
  310. package/dist/hook-events.d.ts +11 -0
  311. package/dist/hook-events.d.ts.map +1 -0
  312. package/dist/hook-events.js +11 -0
  313. package/dist/hook-events.js.map +1 -0
  314. package/dist/hooks-generator.d.ts.map +1 -1
  315. package/dist/hooks-generator.js +87 -21
  316. package/dist/hooks-generator.js.map +1 -1
  317. package/dist/host-database.d.ts +10 -10
  318. package/dist/host-database.d.ts.map +1 -1
  319. package/dist/host-database.js +18 -15
  320. package/dist/host-database.js.map +1 -1
  321. package/dist/init-answers.d.ts +18 -0
  322. package/dist/init-answers.d.ts.map +1 -0
  323. package/dist/init-answers.js +46 -0
  324. package/dist/init-answers.js.map +1 -0
  325. package/dist/init-dependency-versions.d.ts.map +1 -1
  326. package/dist/init-dependency-versions.js +11 -1
  327. package/dist/init-dependency-versions.js.map +1 -1
  328. package/dist/init-next-runtime-env.d.ts +30 -0
  329. package/dist/init-next-runtime-env.d.ts.map +1 -0
  330. package/dist/init-next-runtime-env.js +180 -0
  331. package/dist/init-next-runtime-env.js.map +1 -0
  332. package/dist/init-package-json.d.ts +38 -1
  333. package/dist/init-package-json.d.ts.map +1 -1
  334. package/dist/init-package-json.js +150 -39
  335. package/dist/init-package-json.js.map +1 -1
  336. package/dist/jwt.d.ts +5 -0
  337. package/dist/jwt.d.ts.map +1 -1
  338. package/dist/jwt.js +16 -0
  339. package/dist/jwt.js.map +1 -1
  340. package/dist/local-secrets.d.ts +22 -0
  341. package/dist/local-secrets.d.ts.map +1 -1
  342. package/dist/local-secrets.js +36 -0
  343. package/dist/local-secrets.js.map +1 -1
  344. package/dist/local-stack-guard.d.ts +37 -0
  345. package/dist/local-stack-guard.d.ts.map +1 -0
  346. package/dist/local-stack-guard.js +84 -0
  347. package/dist/local-stack-guard.js.map +1 -0
  348. package/dist/mailer-env.d.ts +4 -0
  349. package/dist/mailer-env.d.ts.map +1 -1
  350. package/dist/mailer-env.js +12 -1
  351. package/dist/mailer-env.js.map +1 -1
  352. package/dist/model-hooks.d.ts +5 -1
  353. package/dist/model-hooks.d.ts.map +1 -1
  354. package/dist/model-hooks.js +12 -2
  355. package/dist/model-hooks.js.map +1 -1
  356. package/dist/node-executable.d.ts +6 -0
  357. package/dist/node-executable.d.ts.map +1 -0
  358. package/dist/node-executable.js +43 -0
  359. package/dist/node-executable.js.map +1 -0
  360. package/dist/parent-watch.d.ts +8 -3
  361. package/dist/parent-watch.d.ts.map +1 -1
  362. package/dist/parent-watch.js +8 -3
  363. package/dist/parent-watch.js.map +1 -1
  364. package/dist/postgres-ctl.d.ts +2 -0
  365. package/dist/postgres-ctl.d.ts.map +1 -1
  366. package/dist/postgres-ctl.js +11 -5
  367. package/dist/postgres-ctl.js.map +1 -1
  368. package/dist/process-manager.d.ts +37 -5
  369. package/dist/process-manager.d.ts.map +1 -1
  370. package/dist/process-manager.js +127 -65
  371. package/dist/process-manager.js.map +1 -1
  372. package/dist/project-config.d.ts +31 -0
  373. package/dist/project-config.d.ts.map +1 -1
  374. package/dist/project-config.js +24 -0
  375. package/dist/project-config.js.map +1 -1
  376. package/dist/push-audit.d.ts +4 -1
  377. package/dist/push-audit.d.ts.map +1 -1
  378. package/dist/push-audit.js +33 -4
  379. package/dist/push-audit.js.map +1 -1
  380. package/dist/recorded-field-masking-tier.d.ts +2 -2
  381. package/dist/recorded-field-masking-tier.d.ts.map +1 -1
  382. package/dist/recorded-field-masking-tier.js +6 -6
  383. package/dist/recorded-field-masking-tier.js.map +1 -1
  384. package/dist/rename-journal.d.ts +1 -1
  385. package/dist/rename-journal.d.ts.map +1 -1
  386. package/dist/resolve-api-url.d.ts +2 -0
  387. package/dist/resolve-api-url.d.ts.map +1 -1
  388. package/dist/resolve-api-url.js +5 -1
  389. package/dist/resolve-api-url.js.map +1 -1
  390. package/dist/resolve-target.d.ts +18 -1
  391. package/dist/resolve-target.d.ts.map +1 -1
  392. package/dist/resolve-target.js +28 -16
  393. package/dist/resolve-target.js.map +1 -1
  394. package/dist/run-captured.d.ts +31 -0
  395. package/dist/run-captured.d.ts.map +1 -0
  396. package/dist/run-captured.js +36 -0
  397. package/dist/run-captured.js.map +1 -0
  398. package/dist/saml-config.d.ts +53 -0
  399. package/dist/saml-config.d.ts.map +1 -0
  400. package/dist/saml-config.js +177 -0
  401. package/dist/saml-config.js.map +1 -0
  402. package/dist/saml-key-rotation.d.ts +5 -0
  403. package/dist/saml-key-rotation.d.ts.map +1 -0
  404. package/dist/saml-key-rotation.js +26 -0
  405. package/dist/saml-key-rotation.js.map +1 -0
  406. package/dist/saml-sp-certificate.d.ts +15 -0
  407. package/dist/saml-sp-certificate.d.ts.map +1 -0
  408. package/dist/saml-sp-certificate.js +34 -0
  409. package/dist/saml-sp-certificate.js.map +1 -0
  410. package/dist/schema-reset.d.ts +41 -0
  411. package/dist/schema-reset.d.ts.map +1 -0
  412. package/dist/schema-reset.js +98 -0
  413. package/dist/schema-reset.js.map +1 -0
  414. package/dist/seed-child.d.ts +25 -0
  415. package/dist/seed-child.d.ts.map +1 -0
  416. package/dist/seed-child.js +61 -0
  417. package/dist/seed-child.js.map +1 -0
  418. package/dist/seed-runner.d.ts +3 -5
  419. package/dist/seed-runner.d.ts.map +1 -1
  420. package/dist/seed-runner.js +20 -42
  421. package/dist/seed-runner.js.map +1 -1
  422. package/dist/self-host-compose.d.ts +25 -4
  423. package/dist/self-host-compose.d.ts.map +1 -1
  424. package/dist/self-host-compose.js +108 -23
  425. package/dist/self-host-compose.js.map +1 -1
  426. package/dist/serial-runs.d.ts +7 -0
  427. package/dist/serial-runs.d.ts.map +1 -0
  428. package/dist/serial-runs.js +29 -0
  429. package/dist/serial-runs.js.map +1 -0
  430. package/dist/shell-ports.d.ts.map +1 -1
  431. package/dist/shell-ports.js +2 -8
  432. package/dist/shell-ports.js.map +1 -1
  433. package/dist/sso-admin.d.ts +114 -0
  434. package/dist/sso-admin.d.ts.map +1 -0
  435. package/dist/sso-admin.js +256 -0
  436. package/dist/sso-admin.js.map +1 -0
  437. package/dist/stack-engine.d.ts +28 -0
  438. package/dist/stack-engine.d.ts.map +1 -0
  439. package/dist/stack-engine.js +59 -0
  440. package/dist/stack-engine.js.map +1 -0
  441. package/dist/stack-exit-watch.d.ts +37 -0
  442. package/dist/stack-exit-watch.d.ts.map +1 -0
  443. package/dist/stack-exit-watch.js +70 -0
  444. package/dist/stack-exit-watch.js.map +1 -0
  445. package/dist/stack-setting-warnings.d.ts +8 -0
  446. package/dist/stack-setting-warnings.d.ts.map +1 -0
  447. package/dist/stack-setting-warnings.js +14 -0
  448. package/dist/stack-setting-warnings.js.map +1 -0
  449. package/dist/studio-dev-server.d.ts.map +1 -1
  450. package/dist/studio-dev-server.js +2 -1
  451. package/dist/studio-dev-server.js.map +1 -1
  452. package/dist/target-client.d.ts +12 -2
  453. package/dist/target-client.d.ts.map +1 -1
  454. package/dist/target-client.js +14 -1
  455. package/dist/target-client.js.map +1 -1
  456. package/dist/tsx-runner.d.ts +5 -0
  457. package/dist/tsx-runner.d.ts.map +1 -1
  458. package/dist/tsx-runner.js +18 -17
  459. package/dist/tsx-runner.js.map +1 -1
  460. package/dist/type-extractor.d.ts.map +1 -1
  461. package/dist/type-extractor.js +20 -11
  462. package/dist/type-extractor.js.map +1 -1
  463. package/dist/type-generation.d.ts +1 -1
  464. package/dist/type-generation.d.ts.map +1 -1
  465. package/dist/type-generation.js +2 -4
  466. package/dist/type-generation.js.map +1 -1
  467. package/dist/type-resolver.d.ts.map +1 -1
  468. package/dist/type-resolver.js +31 -12
  469. package/dist/type-resolver.js.map +1 -1
  470. package/dist/ui/clack-api.d.ts.map +1 -1
  471. package/dist/ui/clack-api.js +45 -23
  472. package/dist/ui/clack-api.js.map +1 -1
  473. package/dist/ui/components/LineInput.d.ts +26 -0
  474. package/dist/ui/components/LineInput.d.ts.map +1 -0
  475. package/dist/ui/components/LineInput.js +60 -0
  476. package/dist/ui/components/LineInput.js.map +1 -0
  477. package/dist/ui/dev/DevDashboard.d.ts.map +1 -1
  478. package/dist/ui/dev/DevDashboard.js +9 -3
  479. package/dist/ui/dev/DevDashboard.js.map +1 -1
  480. package/dist/ui/flows/FlowApp.d.ts +3 -1
  481. package/dist/ui/flows/FlowApp.d.ts.map +1 -1
  482. package/dist/ui/flows/FlowApp.js +14 -5
  483. package/dist/ui/flows/FlowApp.js.map +1 -1
  484. package/dist/ui/flows/prompt-fields.d.ts +14 -7
  485. package/dist/ui/flows/prompt-fields.d.ts.map +1 -1
  486. package/dist/ui/flows/prompt-fields.js +20 -12
  487. package/dist/ui/flows/prompt-fields.js.map +1 -1
  488. package/dist/ui/flows/types.d.ts +5 -1
  489. package/dist/ui/flows/types.d.ts.map +1 -1
  490. package/dist/ui/runtime/command-chrome.d.ts.map +1 -1
  491. package/dist/ui/runtime/command-chrome.js +2 -0
  492. package/dist/ui/runtime/command-chrome.js.map +1 -1
  493. package/dist/ui/runtime/flow-transcript.d.ts +17 -0
  494. package/dist/ui/runtime/flow-transcript.d.ts.map +1 -0
  495. package/dist/ui/runtime/flow-transcript.js +38 -0
  496. package/dist/ui/runtime/flow-transcript.js.map +1 -0
  497. package/dist/ui/runtime/run-clack-flow.d.ts +7 -0
  498. package/dist/ui/runtime/run-clack-flow.d.ts.map +1 -1
  499. package/dist/ui/runtime/run-clack-flow.js +131 -17
  500. package/dist/ui/runtime/run-clack-flow.js.map +1 -1
  501. package/package.json +16 -14
@@ -4,6 +4,9 @@
4
4
  import { setTimeout as sleep } from "node:timers/promises";
5
5
  import { projectOutputPaths, writeAstDerivedOutputs, writeSeedBuilder } from "./type-generation.js";
6
6
  import { errorMessage } from "./error-message.js";
7
+ import { printRoleAccess } from "./diff-access.js";
8
+ import { warn } from "./ui/messages.js";
9
+ import { FRONTEND_URL_KEYS, frontendEnv, writeFrontendEnv } from "./frontend-env.js";
7
10
  import { withPublishing } from "./model-versioning.js";
8
11
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
12
  import { homedir } from "node:os";
@@ -24,7 +27,7 @@ import { ensureDevDbPort, ensureKongPort } from "./dev-ports.js";
24
27
  import { applyForThisRun, splitShellPortUpdates } from "./shell-ports.js";
25
28
  import { handleComposeProjectRename } from "./compose-rename.js";
26
29
  import { devSessionLockFor, recoverStaleDevSession, writeDevSessionLock } from "./dev-session-lock.js";
27
- import { endDevSession, startDevSession } from "./dev-session.js";
30
+ import { endDevSession, showDevStep, startDevSession, withSavePushOutput } from "./dev-session.js";
28
31
  import { ensureDevApiConfig } from "./ensure-dev-api-config.js";
29
32
  import { cacheSeedingNotes } from "./api-config-cache.js";
30
33
  import { restartComposeFunctionsWorker, watchFunctionSources } from "./dev-functions-watch.js";
@@ -37,8 +40,9 @@ import { ENGINE_FALLBACK, generatedFilesEngine } from "./generated-files-engine.
37
40
  import { DEV_DESTRUCTIVE_POLICY, consentDepsFromDiff, pushConsentingToDestructive } from "./destructive-consent.js";
38
41
  import { auditFlags, auditWhenSupported } from "./push-audit.js";
39
42
  import { consentRefusal, reportDevPushFailure } from "./push-refusal.js";
40
- import { COMPOSE_PINNED_IMAGE_ENV_KEYS, composeDockerImageEnv, composeProjectName, exitComposeFailed, noteUnpinnedImages, publishesDbToHost, runDockerCompose, schemaEngineImageForPush, writeSelfHostCompose, composeFieldMaskingTier, selfHostComposePaths, } from "./self-host-compose.js";
43
+ import { COMPOSE_PINNED_IMAGE_ENV_KEYS, composeDockerImageEnv, composeProjectName, exitComposeFailed, noteUnpinnedImages, publishesDbToHost, runDockerCompose, runDockerComposeQuietly, settleComposeRuns, schemaEngineImageForPush, writeSelfHostCompose, composeFieldMaskingTier, selfHostComposePaths, } from "./self-host-compose.js";
41
44
  import { composeServiceIsRunning } from "./compose-kong.js";
45
+ import { requireStackDatabase } from "./local-stack-guard.js";
42
46
  import { hasEngineOverride } from "./binary-cache.js";
43
47
  import { STUDIO_DEV_PORT, startStudioViteDevServer } from "./studio-dev-server.js";
44
48
  import { ensureLocalServerDockerImage, usesLocalServerImage, LOCAL_SERVER_DOCKER_IMAGE, } from "./compose-local-server-image.js";
@@ -46,7 +50,7 @@ import { ensureEngine, enginePush, engineRequest } from "./engine-client.js";
46
50
  import { isAdoptOutcome, isAnyAnswer, isDiffResult, isEnginePushResult, isGenerateAnswer, } from "./engine-answers.js";
47
51
  import { writeSchemaSourcePushArtifacts } from "./schema-sources.js";
48
52
  import { readEnvFile, readEnvValue, upsertEnvFile } from "./env-file.js";
49
- import { warnProjectAuthProviderSecrets } from "./auth-providers.js";
53
+ import { warnMissingStackSettings } from "./stack-setting-warnings.js";
50
54
  import { devDatabaseIdentity, devDatabaseUrl, seedMissingDatabaseIdentity, seedMissingLocalSecrets, } from "./local-secrets.js";
51
55
  import { writeLocalEnvironment } from "./link.js";
52
56
  import { registerDevShutdown, waitForDevShutdown } from "./dev-shutdown.js";
@@ -63,15 +67,15 @@ import { adoptKeysNeed, assertSupported, engineCapabilities, identityColumnsNeed
63
67
  import { devPushConsentingToDrift } from "./drift-consent.js";
64
68
  import { capabilitiesCache, rememberCapabilitiesSync } from "@supatype/shared";
65
69
  import { waitForDatabaseAfterUp } from "./dev-db-ready.js";
66
- import { DERIVED_DSN_SOURCE, hostComposeDbUrl, requireRunningStack, resolveHostDatabaseUrl, stackHostDbUrl, } from "./host-database.js";
70
+ import { DERIVED_DSN_SOURCE, hostComposeDbUrl, NoStackRunning, requireRunningStack, resolveHostDatabaseUrl, stackHostDbUrl, } from "./host-database.js";
67
71
  import { studioUrlAt } from "./local-stack.js";
68
72
  import { grantAuthSchemaAccess, privatizeTableDefaults, reconcileAuthenticatorPassword, reconcileSqlEditorPassword, } from "./compose-db-roles.js";
69
- import { spawnComposeEngine } from "./compose-engine-run.js";
73
+ import { spawnComposeEngine, spawnComposeEngineSync } from "./compose-engine-run.js";
70
74
  import { waitForRestReady } from "./rest-ready.js";
71
- import { claimDevRenderMode, composeRenderMode, composeRenderOptions } from "./compose-render-mode.js";
72
- import { devMailerAutoconfirmUpdate, MAILER_AUTOCONFIRM_ENV } from "./mailer-autoconfirm.js";
73
- import { mailerProviderEnv } from "./mailer-env.js";
75
+ import { claimDevRenderMode, composeRenderMode, composeRenderOptions, runningStackMode } from "./compose-render-mode.js";
76
+ import { configMailerEnv } from "./config-mailer-env.js";
74
77
  import { fetchWithin } from "./fetch-within.js";
78
+ import { composeStackWatch, exitedServiceFailure } from "./stack-exit-watch.js";
75
79
  import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
76
80
  /**
77
81
  * The image pins config asks for, once the engine's is known not to be older than this CLI needs.
@@ -114,10 +118,14 @@ function projectDatabaseUrl(cwd, config, inNetwork = false) {
114
118
  return inNetwork ? composeDbUrl(cwd) : stackHostDbUrl(cwd, config.project.name);
115
119
  }
116
120
  /**
117
- * When `provider: docker` and `overrides.engine` is set, ensure Postgres is published
118
- * on the host (SUPATYPE_DEV_DB_PORT) so the local engine binary can connect.
121
+ * When `provider: docker` and `overrides.engine` is set: the stack's Postgres, which the local
122
+ * engine binary reaches on the host port the compose file publishes. Every layout publishes `db`
123
+ * ({@link publishesDbToHost}), dev on SUPATYPE_DEV_DB_PORT and standalone on SUPATYPE_DB_PORT, so
124
+ * on a running stack it is already there. Nothing is started (issue 46): this ran `up -d db`, and
125
+ * on a dev stack moved the dev port first, under a database that was already up. A stack that is
126
+ * not running, or whose `db` container is not, is refused instead.
119
127
  */
120
- export async function ensureDockerDbPublishedForHostEngine(cwd, config, brand) {
128
+ export function ensureDockerDbPublishedForHostEngine(cwd, config, command) {
121
129
  if (resolveRuntimeProvider(config) !== "docker") {
122
130
  throw new Error("ensureDockerDbPublishedForHostEngine requires provider: docker");
123
131
  }
@@ -125,15 +133,9 @@ export async function ensureDockerDbPublishedForHostEngine(cwd, config, brand) {
125
133
  throw new Error("This project uses an external database, so there is no Docker Postgres to publish. " +
126
134
  "Point DATABASE_URL at it, or pass --connection.");
127
135
  }
128
- const project = composeProjectName(config.project.name);
129
- // A standalone stack already publishes its database (SUPATYPE_DB_PORT), and its .env is the
130
- // operator's: only a dev stack gets the dev port and the dev values (SH1). With no stack running
131
- // the URL the engine is handed cannot be derived, so refuse before starting anything (M1b).
132
- const mode = requireRunningStack(cwd, config.project.name);
133
- if (mode === "dev")
134
- await prepareDevComposeEnv(cwd, config, project, await resolveKongPort(cwd, project));
135
- const paths = writeSelfHostCompose(cwd, config, { devLocal: mode === "dev" });
136
- await startComposeDatabase(config, paths, cwd, project, brand);
136
+ // With no stack running the URL the engine is handed cannot be derived (M1b).
137
+ requireRunningStack(cwd, config.project.name);
138
+ requireStackDatabase(cwd, config, command);
137
139
  }
138
140
  /**
139
141
  * True when CLI should publish local Compose Postgres for the host-side engine
@@ -159,10 +161,10 @@ export async function resolveHostEngineDatabaseUrl(cwd, config, explicit) {
159
161
  // The URL comes from the one resolver every host-side command uses. It is resolved first so a
160
162
  // derived URL with no stack running refuses before anything starts (M1b), and a DATABASE_URL
161
163
  // someone set is used without one. Then, when it is this project's local docker Postgres, the
162
- // database is published so the URL reaches something.
164
+ // stack's database is checked to be running, which is what the URL reaches.
163
165
  const resolved = resolveHostDatabaseUrl(cwd, config, { connection: explicit, allowDerived: true });
164
166
  if (resolved.source === DERIVED_DSN_SOURCE && usesLocalDockerEngineDb(config, explicit)) {
165
- await ensureDockerDbPublishedForHostEngine(cwd, config);
167
+ ensureDockerDbPublishedForHostEngine(cwd, config);
166
168
  }
167
169
  return resolved.dsn;
168
170
  }
@@ -210,10 +212,7 @@ async function startComposeDatabase(config, paths, cwd, project, brand, timeoutM
210
212
  if (usesExternalDatabase(config))
211
213
  return;
212
214
  warnUrlUnsafeComposePasswords(cwd, config);
213
- const up = runDockerCompose(paths.composePath, ["up", "-d", "db"], cwd, project, {
214
- quiet: true,
215
- ...(brand !== undefined && { brand }),
216
- });
215
+ const up = await runDockerComposeQuietly(paths.composePath, ["up", "-d", "db"], cwd, project, brand);
217
216
  if (up !== 0) {
218
217
  onFailure?.();
219
218
  exitComposeFailed(up, "Could not start Postgres (compose db service).", brand);
@@ -223,6 +222,7 @@ async function startComposeDatabase(config, paths, cwd, project, brand, timeoutM
223
222
  export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort) {
224
223
  const apiUrl = `http://localhost:${kongPort}`;
225
224
  const imagePins = checkedImagePins(config);
225
+ const mailer = configMailerEnv(cwd, config);
226
226
  // `POSTGRES_PASSWORD` and `JWT_SECRET` are deliberately absent.
227
227
  //
228
228
  // They used to be pinned here to published constants on every `dev` run, against the same
@@ -242,22 +242,16 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
242
242
  ...seedMissingLocalSecrets(cwd, config),
243
243
  // Project configuration, seeded not overwritten, see seedMissingDatabaseIdentity.
244
244
  ...seedMissingDatabaseIdentity(cwd, config),
245
- // Shared with `supatype keys --write`, so a front end's prefix cannot be written by one and
246
- // forgotten by the other. See `anonKeyEnvUpdates`.
247
- //
248
- // This list used to live here as well, and the two had already drifted: `dev` wrote
249
- // PUBLIC_ and EXPO_PUBLIC_ URLs and no VITE_SUPATYPE_URL, so a Vite app whose `.env` had only
250
- // ever been touched by `supatype dev` built against an empty string.
251
- ...anonKeyEnvUpdates(anonKey, serviceRoleKey, apiUrl),
245
+ // Shared with `supatype keys --write`, so a name cannot be written by one and forgotten by the
246
+ // other. See `anonKeyEnvUpdates`. The front end's copies are written below, not here.
247
+ ...anonKeyEnvUpdates(anonKey, serviceRoleKey),
252
248
  SUPATYPE_KONG_PORT: String(kongPort),
253
249
  API_EXTERNAL_URL: apiUrl,
254
250
  SITE_URL: apiUrl,
255
- // From auth.email.enableConfirmations, unless the developer set their own in .env.
256
- ...devMailerAutoconfirmUpdate(cwd, config),
257
- // email.provider and its settings, which the compose file passes to the server. The compose
258
- // path used to carry none of them, so a project that asked for smtp, Resend or SES got the auth
259
- // service's noop client and no message at all.
260
- ...mailerProviderEnv(config.email),
251
+ // auth.email.enableConfirmations (unless the developer set their own in .env), email.provider
252
+ // and its settings, which the compose file passes to the server. The compose path used to carry
253
+ // none of them, so a project that asked for smtp, Resend or SES got the noop mailer.
254
+ ...mailer.updates,
261
255
  ...imagePins,
262
256
  };
263
257
  // Never for an external database: this URL describes the `db` container, which that project does
@@ -285,17 +279,27 @@ export function upsertDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPo
285
279
  const retiredKeys = ["GOTRUE_MAILER_AUTOCONFIRM"];
286
280
  // A port the shell gave for this run is the run's, not the project's (DR9), unless `.env` holds it too.
287
281
  const dotEnv = readEnvFile(cwd);
288
- const { persist, runOnly } = splitShellPortUpdates(updates, process.env, dotEnv);
282
+ const { persist, runOnly } = splitShellPortUpdates({ ...updates, ...frontendEnv({ apiUrl }) }, process.env, dotEnv);
289
283
  applyForThisRun(runOnly);
290
- upsertEnvFile(cwd, persist, {
291
- removeManaged: removeImageKeys,
292
- managed: [...managedImageKeys, MAILER_AUTOCONFIRM_ENV],
284
+ const { urlsKept, rest } = takeFrontendUrls(persist);
285
+ upsertEnvFile(cwd, rest, {
286
+ removeManaged: [...removeImageKeys, ...mailer.removeManaged],
287
+ managed: [...managedImageKeys, ...mailer.managed],
293
288
  remove: [...retiredKeys, ...staleLocalServerImage(dotEnv["SUPATYPE_SERVER_IMAGE"], wantsLocalServer, imagePins)],
294
289
  });
290
+ // The front end's copies go where a development build reads them, not .env, which a production
291
+ // build reads (frontend-env.ts). The URL only when it is the project's port, not the shell's.
292
+ writeFrontendEnv(cwd, { anonKey, ...(urlsKept && { apiUrl }) }, { local: true });
295
293
  if (devDbPort !== undefined && !usesExternalDatabase(config)) {
296
294
  writeDevStackDatabaseUrl(cwd, devDbPort, runOnly.SUPATYPE_DEV_DB_PORT !== undefined);
297
295
  }
298
296
  }
297
+ /** `persist` less the front-end URL names, and whether they were among what is kept. */
298
+ function takeFrontendUrls(persist) {
299
+ const names = new Set(FRONTEND_URL_KEYS);
300
+ const rest = Object.fromEntries(Object.entries(persist).filter(([key]) => !names.has(key)));
301
+ return { urlsKept: FRONTEND_URL_KEYS.every((key) => key in persist), rest };
302
+ }
299
303
  /**
300
304
  * `SUPATYPE_SERVER_IMAGE` to remove from `.env`: the local-dev image this CLI wrote, once the project
301
305
  * stops asking for a local build and pins no server. It carries no marker for `removeManaged` to act
@@ -441,34 +445,49 @@ async function reportUnhealthyStack(composePath, cwd, project) {
441
445
  }
442
446
  console.error("");
443
447
  }
444
- async function waitKongReady(kongPort, maxSec, stack) {
448
+ /** One look at the gateway's two health routes: whether both answer OK, and what each said. */
449
+ async function gatewayHealth(base) {
450
+ try {
451
+ const [auth, realtime] = await Promise.all([
452
+ fetchWithin(`${base}/auth/v1/health`, 2000),
453
+ fetchWithin(`${base}/realtime/v1/health`, 2000),
454
+ ]);
455
+ return { ready: auth.ok && realtime.ok, auth: `HTTP ${auth.status}`, realtime: `HTTP ${realtime.status}` };
456
+ }
457
+ catch (err) {
458
+ return { ready: false, auth: errorMessage(err), realtime: errorMessage(err) };
459
+ }
460
+ }
461
+ /**
462
+ * Wait for the gateway at `kongPort`, watching `stack`'s essential services as it goes: one that
463
+ * has exited will not come back, so the wait stops there and prints its exit code and last log
464
+ * lines before the caller's cleanup removes them (issue 38). Either failure ends dev's dashboard
465
+ * first, so what it prints reaches the terminal rather than a screen that is about to close.
466
+ */
467
+ export async function waitKongReady(kongPort, maxSec, stack) {
445
468
  const base = loopbackBase(kongPort);
469
+ const watched = stack === undefined ? undefined : { watch: stack.watch ?? composeStackWatch(stack), cwd: stack.cwd };
446
470
  // Remembered so the failure can name the unhealthy upstream. Blaming "the
447
471
  // Kong gateway" sent more than one investigation after Kong when Kong was
448
472
  // fine and a service behind it was not.
449
- let lastAuth = "no response";
450
- let lastRealtime = "no response";
473
+ let last = { auth: "no response", realtime: "no response" };
451
474
  for (let i = 0; i < maxSec; i++) {
452
- try {
453
- const [auth, realtime] = await Promise.all([
454
- fetchWithin(`${base}/auth/v1/health`, 2000),
455
- fetchWithin(`${base}/realtime/v1/health`, 2000),
456
- ]);
457
- lastAuth = `HTTP ${auth.status}`;
458
- lastRealtime = `HTTP ${realtime.status}`;
459
- if (auth.ok && realtime.ok)
460
- return;
461
- }
462
- catch (err) {
463
- lastAuth = lastRealtime = errorMessage(err);
475
+ const [health, exited] = await Promise.all([gatewayHealth(base), watched?.watch.exited().catch(() => undefined)]);
476
+ if (health.ready)
477
+ return;
478
+ last = health;
479
+ if (exited !== undefined && watched !== undefined) {
480
+ endDevSession();
481
+ throw await exitedServiceFailure(exited, watched);
464
482
  }
465
483
  await sleep(1000);
466
484
  }
467
485
  if (stack !== undefined) {
486
+ endDevSession();
468
487
  await reportUnhealthyStack(stack.composePath, stack.cwd, stack.project);
469
488
  }
470
489
  throw new Error(`Gateway at ${base} did not become ready within ${maxSec}s ` +
471
- `(auth/v1/health: ${lastAuth}, realtime/v1/health: ${lastRealtime})`);
490
+ `(auth/v1/health: ${last.auth}, realtime/v1/health: ${last.realtime})`);
472
491
  }
473
492
  /** Kong may be up while server → storage is still starting (503 or upstream errors). */
474
493
  async function waitStorageApiReady(kongPort, serviceRoleKey, maxSec) {
@@ -675,6 +694,8 @@ export async function runComposeSchemaPush(cwd, config, paths, schemaPath, compo
675
694
  // asked by `engineRequest`).
676
695
  if (!hasEngineOverride(config))
677
696
  await requireDockerFeatures(cwd, config, identityColumnsNeed(ast));
697
+ if (opts.access === "plan")
698
+ await printPlannedAccess(cwd, config);
678
699
  try {
679
700
  if (hasEngineOverride(config))
680
701
  await applyViaHostEngine(cwd, config, ast, opts);
@@ -688,9 +709,27 @@ export async function runComposeSchemaPush(cwd, config, paths, schemaPath, compo
688
709
  _lastPushedAst = astJson;
689
710
  _lastFailedAst = null;
690
711
  if (astRelatesToAuthUsers(ast))
691
- grantAuthSchemaAccess(paths, cwd, composeProject);
712
+ await grantAuthSchemaAccess(paths, cwd, composeProject);
692
713
  await refreshSchemaArtifacts(cwd, config, ast);
693
714
  }
715
+ /**
716
+ * Each API role's access as the push about to apply leaves it, from a diff of the AST just written.
717
+ * Only a preview: a diff that fails says so and the push goes on, to report what is wrong itself.
718
+ */
719
+ async function printPlannedAccess(cwd, config) {
720
+ try {
721
+ const diff = await dockerDiff(cwd, config);
722
+ if (diff !== undefined)
723
+ printRoleAccess(diff);
724
+ }
725
+ catch (err) {
726
+ console.log(`[supatype] Could not read each role's access before the push: ${errorMessage(err)}`);
727
+ }
728
+ }
729
+ /** What a push reports of each role's access once applied: only `changes` prints anything. */
730
+ function appliedAccess(opts) {
731
+ return opts.access === undefined || opts.access === "changes" ? "changes" : "quiet";
732
+ }
694
733
  /** The schema on disk as a push sends it, and that AST serialized for comparing pushes. */
695
734
  function readSchemaToPush(schemaPath, cwd, config) {
696
735
  const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
@@ -727,12 +766,13 @@ async function applyViaHostEngine(cwd, config, ast, opts) {
727
766
  schema: pgSchema(config),
728
767
  force: opts.force === true,
729
768
  ...(opts.overwriteDrift === true && { overwrite_drift: true }),
769
+ ...(opts.runHooks === true && { run_hooks: true }),
730
770
  ...(sources !== null && {
731
771
  schema_sources_gz_base64: sources.payload.dataBase64,
732
772
  schema_sources_manifest: sources.payload.manifest,
733
773
  }),
734
774
  };
735
- reportAppliedPush(await enginePush(cwd, body, isEnginePushResult));
775
+ reportAppliedPush(await enginePush(cwd, body, isEnginePushResult), appliedAccess(opts));
736
776
  }
737
777
  /** Apply the AST on disk with the stack's schema-engine container. Throws when it is not applied. */
738
778
  async function applyViaComposeEngine(cwd, config, stack, opts) {
@@ -771,7 +811,7 @@ async function runComposeSchemaPushQueued(cwd, config, paths, schemaPath, compos
771
811
  _composePushQueued = false;
772
812
  await runDevSchemaPush(cwd, config, paths, schemaPath, composeProject, opts);
773
813
  } while (_composePushQueued);
774
- followRecordedTier(cwd, config, { recreate: true });
814
+ await followRecordedTier(cwd, config, { recreate: true });
775
815
  }
776
816
  finally {
777
817
  _composePushInFlight = false;
@@ -785,13 +825,13 @@ async function runComposeSchemaPushQueued(cwd, config, paths, schemaPath, compos
785
825
  * recreated so a running stack serves the new search path now; a caller about to run
786
826
  * `compose up -d` leaves that to it.
787
827
  */
788
- export function followRecordedTier(cwd, config, opts) {
828
+ export async function followRecordedTier(cwd, config, opts) {
789
829
  if (usesExternalDatabase(config))
790
830
  return;
791
831
  const project = composeProjectName(config.project.name);
792
832
  const paths = selfHostComposePaths(cwd);
793
833
  const served = composeFieldMaskingTier(cwd, config);
794
- const recorded = recordDatabaseTier(cwd, { project, composePath: paths.composePath });
834
+ const recorded = await recordDatabaseTier(cwd, { project, composePath: paths.composePath });
795
835
  if (recorded === undefined || sameApiSurface(config, served, recorded))
796
836
  return;
797
837
  writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
@@ -852,7 +892,7 @@ async function runComposeEnginePush(paths, cwd, composeProject, config, sources,
852
892
  const pushResult = parseEnginePushOutput(output);
853
893
  if (exitStatus === 0) {
854
894
  if (pushResult) {
855
- reportAppliedPush(pushResult);
895
+ reportAppliedPush(pushResult, appliedAccess(opts));
856
896
  }
857
897
  else {
858
898
  console.log("[supatype] Schema applied.");
@@ -873,7 +913,7 @@ export async function dockerEngineCapabilities(cwd, config) {
873
913
  const paths = writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
874
914
  const target = { cwd, project: composeProjectName(config.project.name), composePath: paths.composePath, engineImage };
875
915
  return checkedCapabilities((args) => {
876
- const run = spawnComposeEngine(target, args, { runFlags: ["--no-deps"] });
916
+ const run = spawnComposeEngineSync(target, args, { runFlags: ["--no-deps"] });
877
917
  return { status: run.status, stdout: run.stdout, stderr: run.error ?? run.stderr };
878
918
  });
879
919
  };
@@ -914,6 +954,8 @@ export function composeEnginePushArgs(sources, opts = {}) {
914
954
  // Only when asked: an engine older than the ledger rejects the flag.
915
955
  if (opts.overwriteDrift === true)
916
956
  args.push("--overwrite-drift");
957
+ if (opts.runHooks === true)
958
+ args.push("--run-hooks");
917
959
  if (sources) {
918
960
  args.push("--schema-sources-gz", sources.dockerGzPath, "--schema-sources-manifest", sources.dockerManifestPath);
919
961
  }
@@ -951,7 +993,7 @@ async function runComposeEngineCommand(paths, cwd, composeProject, config, comma
951
993
  async function runComposeEngine(paths, cwd, composeProject, config, engineArgs) {
952
994
  const engineImage = await schemaEngineImageForPush(config, cwd);
953
995
  const target = { cwd, project: composeProject, composePath: paths.composePath, engineImage };
954
- const result = spawnComposeEngine(target, engineArgs, {
996
+ const result = await spawnComposeEngine(target, engineArgs, {
955
997
  secrets: { DATABASE_URL: projectDatabaseUrl(cwd, config, true) },
956
998
  });
957
999
  return {
@@ -996,7 +1038,7 @@ export async function adoptSchemaDocker(cwd, config, yes, keys) {
996
1038
  if (keys !== undefined)
997
1039
  await requireDockerFeatures(cwd, config, [adoptKeysNeed(keys)]);
998
1040
  if (hasEngineOverride(config)) {
999
- await ensureDockerDbPublishedForHostEngine(cwd, config, { intro: "Adopt" });
1041
+ ensureDockerDbPublishedForHostEngine(cwd, config, "adopt");
1000
1042
  await ensureEngine();
1001
1043
  return engineRequest("/adopt", {
1002
1044
  ast: withPublishing(loadSchemaAst(schemaPathFromProject(config, cwd), cwd), config),
@@ -1020,6 +1062,9 @@ export async function adoptSchemaDocker(cwd, config, yes, keys) {
1020
1062
  * `supatype diff` when `provider: docker`. Uses in-compose schema-engine unless
1021
1063
  * `overrides.engine` is set: then Postgres is published to the host and diff runs
1022
1064
  * through the local engine binary.
1065
+ *
1066
+ * Only against a stack that is running (issue 41): a stopped one is refused, not started. The diff
1067
+ * used to start Postgres itself, and stop it again afterwards.
1023
1068
  */
1024
1069
  export async function diffSchemaDocker(cwd, config) {
1025
1070
  if (resolveRuntimeProvider(config) !== "docker") {
@@ -1027,29 +1072,35 @@ export async function diffSchemaDocker(cwd, config) {
1027
1072
  }
1028
1073
  const project = composeProjectName(config.project.name);
1029
1074
  if (hasEngineOverride(config)) {
1030
- const brand = { intro: "Schema diff" };
1031
- await ensureDockerDbPublishedForHostEngine(cwd, config, brand);
1032
- const schemaPath = schemaPathFromProject(config, cwd);
1033
- const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
1034
- await ensureEngine();
1035
- return engineRequest("/diff", { ast, database_url: projectDatabaseUrl(cwd, config), schema: pgSchema(config) }, isDiffResult);
1075
+ ensureDockerDbPublishedForHostEngine(cwd, config, "diff");
1076
+ return diffWithHostEngine(cwd, config);
1036
1077
  }
1037
- // A diff of a standalone stack must not write dev values over the operator's .env (SH1).
1038
- const mode = composeRenderMode(cwd, config.project.name);
1078
+ const running = runningStackMode(cwd, config.project.name);
1079
+ if (running === undefined && !usesExternalDatabase(config))
1080
+ throw new NoStackRunning("diff");
1081
+ // A diff of a standalone stack must not write dev values over the operator's .env (SH1). A dev
1082
+ // stack's is brought up to date as push does: compose interpolates the whole file.
1083
+ const mode = running ?? "standalone";
1039
1084
  if (mode === "dev") {
1040
1085
  const { anonKey, serviceRoleKey } = devApiKeys(cwd);
1041
1086
  ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, await resolveKongPort(cwd, project), undefined);
1042
1087
  }
1043
1088
  const paths = writeSelfHostCompose(cwd, config, { devLocal: mode === "dev" });
1044
- const diffBrand = { intro: "Schema diff" };
1045
- await startComposeDatabase(config, paths, cwd, project, diffBrand);
1046
- const schemaPath = schemaPathFromProject(config, cwd);
1047
- const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
1089
+ return diffWithComposeEngine(cwd, config, paths, project);
1090
+ }
1091
+ /** The diff from the host engine binary, against the database published to the host. */
1092
+ async function diffWithHostEngine(cwd, config) {
1093
+ const ast = withPublishing(loadSchemaAst(schemaPathFromProject(config, cwd), cwd), config);
1094
+ await ensureEngine();
1095
+ return engineRequest("/diff", { ast, database_url: projectDatabaseUrl(cwd, config), schema: pgSchema(config) }, isDiffResult);
1096
+ }
1097
+ /** The diff from the compose schema-engine, which reads the AST written beside the compose file. */
1098
+ async function diffWithComposeEngine(cwd, config, paths, project) {
1099
+ const ast = withPublishing(loadSchemaAst(schemaPathFromProject(config, cwd), cwd), config);
1048
1100
  await requireDockerFeatures(cwd, config, identityColumnsNeed(ast));
1049
1101
  const supatypeDir = join(cwd, ".supatype");
1050
1102
  mkdirSync(supatypeDir, { recursive: true });
1051
- const astPath = join(supatypeDir, "schema.ast.json");
1052
- writeFileSync(astPath, JSON.stringify(ast));
1103
+ writeFileSync(join(supatypeDir, "schema.ast.json"), JSON.stringify(ast));
1053
1104
  let result = await runComposeEngineDiff(paths, cwd, project, config);
1054
1105
  // Windows Docker bind mounts can lag briefly after the host write.
1055
1106
  if (result.status !== 0) {
@@ -1060,56 +1111,80 @@ export async function diffSchemaDocker(cwd, config) {
1060
1111
  const detail = filterComposeNoise(result.output) || result.output;
1061
1112
  throw new Error(detail || `Engine schema diff failed (exit ${result.status})`);
1062
1113
  }
1063
- if (!result.diff) {
1064
- // The engine exited 0 and produced nothing this could parse, which is a different failure from
1065
- // the engine exiting non-zero and is the harder one to act on. "Engine diff returned no result"
1066
- // named only the symptom, and running the same compose command by hand gave a clear error in
1067
- // one go, so the message was the only thing standing between the reader and the answer.
1068
- const output = (filterComposeNoise(result.output) || result.output || "").trim();
1069
- throw new Error(output === ""
1070
- ? "The schema engine exited 0 and printed nothing. Run `supatype self-host compose run --rm schema-engine diff` to see what it does."
1071
- : `The schema engine exited 0 but its output could not be parsed as a diff:\n${output}`);
1072
- }
1073
- return result.diff;
1114
+ return result.diff ?? unparsedDiffError(result.output);
1115
+ }
1116
+ /**
1117
+ * The engine exited 0 and produced nothing this could parse, which is a different failure from the
1118
+ * engine exiting non-zero and is the harder one to act on. "Engine diff returned no result" named
1119
+ * only the symptom, and running the same compose command by hand gave a clear error in one go, so
1120
+ * the message was the only thing standing between the reader and the answer.
1121
+ */
1122
+ function unparsedDiffError(rawOutput) {
1123
+ const output = (filterComposeNoise(rawOutput) || rawOutput || "").trim();
1124
+ throw new Error(output === ""
1125
+ ? "The schema engine exited 0 and printed nothing. Run `supatype self-host compose run --rm schema-engine diff` to see what it does."
1126
+ : `The schema engine exited 0 but its output could not be parsed as a diff:\n${output}`);
1074
1127
  }
1075
1128
  /**
1076
1129
  * `supatype push` when `provider: docker`. Uses in-compose schema-engine unless
1077
1130
  * `overrides.engine` is set: then Postgres is published to the host and push runs
1078
1131
  * through the local engine binary (AST v2, contributor builds).
1132
+ *
1133
+ * Only to a stack that is running (issue 41): a stopped one is refused, not started. The push used
1134
+ * to start Postgres, apply, then start the rest of the stack, and exited 1 with the schema applied
1135
+ * when that start failed. An external database is applied to with no stack running, and then no
1136
+ * stack is started.
1079
1137
  */
1080
1138
  export async function pushSchemaDocker(cwd, config, opts = {}) {
1081
1139
  if (resolveRuntimeProvider(config) !== "docker") {
1082
1140
  throw new Error("pushSchemaDocker requires provider: docker");
1083
1141
  }
1084
1142
  const project = composeProjectName(config.project.name);
1085
- // The stack's own mode, never dev by default: a push to a production stack used to render it as
1086
- // dev and recreate it that way, and write dev values over the operator's .env (SH1). A host
1087
- // engine is handed the database derived from the running stack, so with none running it refuses
1088
- // before anything starts (M1b).
1089
- const hostEngineDerivesDb = hasEngineOverride(config) && !usesExternalDatabase(config);
1090
- const mode = hostEngineDerivesDb
1091
- ? requireRunningStack(cwd, config.project.name)
1092
- : composeRenderMode(cwd, config.project.name);
1143
+ const running = pushStackMode(cwd, config);
1144
+ const mode = running ?? "standalone";
1093
1145
  const kongPort = await resolveKongPort(cwd, project);
1094
1146
  if (mode === "dev")
1095
1147
  await prepareDevComposeEnv(cwd, config, project, kongPort);
1096
- const gatewayPort = composeGatewayHostPort(config, mode, kongPort);
1097
- const { anonKey, serviceRoleKey } = devApiKeys(cwd);
1098
1148
  const paths = writeSelfHostCompose(cwd, config, { devLocal: mode === "dev" });
1099
- const pushBrand = { intro: "Push schema" };
1100
- await startComposeDatabase(config, paths, cwd, project, pushBrand);
1149
+ const stack = { paths, project, gatewayPort: composeGatewayHostPort(config, mode, kongPort), brand: { intro: "Push schema" } };
1101
1150
  if (!usesExternalDatabase(config))
1102
- privatizeTableDefaults(paths, cwd, project);
1151
+ await privatizeTableDefaults(paths, cwd, project);
1103
1152
  const schemaPath = schemaPathFromProject(config, cwd);
1104
1153
  const ast = withPublishing(loadSchemaAst(schemaPath, cwd), config);
1105
1154
  await runComposeSchemaPush(cwd, config, paths, schemaPath, project, opts);
1106
1155
  // `up -d` below recreates PostgREST when the tier changed its environment.
1107
- followRecordedTier(cwd, config, { recreate: false });
1108
- await bringPushedStackUp(cwd, config, { paths, project, gatewayPort, brand: pushBrand }, ast, {
1109
- anonKey,
1110
- serviceRoleKey,
1111
- });
1112
- console.log("[supatype] Schema pushed.");
1156
+ await followRecordedTier(cwd, config, { recreate: false });
1157
+ if (running === undefined) {
1158
+ console.log("[supatype] Schema pushed. The local stack isn't running, so nothing else was started.");
1159
+ return;
1160
+ }
1161
+ await bringUpAfterApply(() => bringPushedStackUp(cwd, config, stack, ast, devApiKeys(cwd)));
1162
+ }
1163
+ /**
1164
+ * The mode of the stack a push goes to, or undefined for an external database with no stack
1165
+ * running. A stopped stack with its own database is refused ({@link NoStackRunning}). The stack's
1166
+ * own mode, never dev by default: a push to a production stack used to render it as dev and
1167
+ * recreate it that way, and write dev values over the operator's .env (SH1).
1168
+ */
1169
+ function pushStackMode(cwd, config) {
1170
+ const running = runningStackMode(cwd, config.project.name);
1171
+ if (running === undefined && !usesExternalDatabase(config))
1172
+ throw new NoStackRunning("push");
1173
+ return running;
1174
+ }
1175
+ /**
1176
+ * What a push does on a running stack after it applied: `up -d` for what the schema changed, then
1177
+ * the buckets, the first admin and the REST wait. The schema is in by then, so a step that fails
1178
+ * does not fail the push (issue 41): it is warned about, and the push exits 0.
1179
+ */
1180
+ async function bringUpAfterApply(bringUp) {
1181
+ try {
1182
+ await bringUp();
1183
+ console.log("[supatype] Schema pushed.");
1184
+ }
1185
+ catch (err) {
1186
+ warn(`The schema was applied, but a step after it failed: ${errorMessage(err)}`);
1187
+ }
1113
1188
  }
1114
1189
  /**
1115
1190
  * The host port the stack's gateway answers plain HTTP on. A standalone stack with TLS publishes
@@ -1119,6 +1194,28 @@ export async function pushSchemaDocker(cwd, config, opts = {}) {
1119
1194
  export function composeGatewayHostPort(config, mode, kongPort) {
1120
1195
  return selfHostTlsEnabled(config, mode === "dev") ? 80 : kongPort;
1121
1196
  }
1197
+ /** A stack `up` started that never answered through its gateway: not up, whatever `up` said (issue 57). */
1198
+ export class StackNotServing extends Error {
1199
+ name = "StackNotServing";
1200
+ }
1201
+ /**
1202
+ * What a started stack needs once it answers: the gateway and storage waited for, then the schema's
1203
+ * declared buckets and the first admin user. A push to a running stack runs it after its `up -d`,
1204
+ * and `self-host compose up` after its own, so no command depends on a push to start the stack and
1205
+ * create them (issue 41).
1206
+ */
1207
+ export async function provisionStartedStack(cwd, config, stack, ast, serviceRoleKey) {
1208
+ const { composePath, project, gatewayPort } = stack;
1209
+ try {
1210
+ await waitKongReady(gatewayPort, 120, { composePath, cwd, project });
1211
+ }
1212
+ catch (err) {
1213
+ throw new StackNotServing(errorMessage(err), { cause: err });
1214
+ }
1215
+ await waitStorageApiReady(gatewayPort, serviceRoleKey, 90);
1216
+ await provisionDockerStorageBuckets(ast, gatewayPort, serviceRoleKey);
1217
+ await ensureFirstAdminUserForProject(cwd, config, { compose: { project, composePath } });
1218
+ }
1122
1219
  /**
1123
1220
  * After a compose push: the rest of the stack up, then what the schema asks of it once it answers
1124
1221
  * (buckets, the first admin), then REST, which is the last to catch up with the new schema.
@@ -1126,15 +1223,10 @@ export function composeGatewayHostPort(config, mode, kongPort) {
1126
1223
  async function bringPushedStackUp(cwd, config, stack, ast, keys) {
1127
1224
  const { paths, project, gatewayPort, brand } = stack;
1128
1225
  const upGateway = runDockerCompose(paths.composePath, ["up", "-d"], cwd, project, { quiet: true, brand });
1129
- if (upGateway !== 0) {
1130
- exitComposeFailed(upGateway, "Could not start the Compose gateway stack.", brand);
1131
- }
1132
- await waitKongReady(gatewayPort, 120, { composePath: paths.composePath, cwd, project });
1133
- await waitStorageApiReady(gatewayPort, keys.serviceRoleKey, 90);
1134
- await provisionDockerStorageBuckets(ast, gatewayPort, keys.serviceRoleKey);
1135
- await ensureFirstAdminUserForProject(cwd, config, {
1136
- compose: { project, composePath: paths.composePath },
1137
- });
1226
+ // Thrown, not exited: the schema is applied by now (bringUpAfterApply).
1227
+ if (upGateway !== 0)
1228
+ throw new Error(`docker compose up exited with status ${upGateway}`);
1229
+ await provisionStartedStack(cwd, config, { composePath: paths.composePath, project, gatewayPort }, ast, keys.serviceRoleKey);
1138
1230
  // Last, so the admin user and the buckets are not held up by it. `supatype dev` never comes
1139
1231
  // through here: it pushes before PostgREST starts, so PostgREST finds the schemas on its first try.
1140
1232
  await waitForRestReady(loopbackBase(gatewayPort), keys.anonKey);
@@ -1181,6 +1273,26 @@ async function devStackDbPort(cwd, config, project) {
1181
1273
  await offerToSaveShellDbPort(cwd);
1182
1274
  return port;
1183
1275
  }
1276
+ /** Stop the watchers and processes dev started, then bring the compose stack down. */
1277
+ export async function stopDevComposeStack(state, stack, cwd) {
1278
+ state.schemaWatcher?.close();
1279
+ state.schemaWatcher = null;
1280
+ state.functionsWatcher?.close();
1281
+ state.functionsWatcher = null;
1282
+ console.log("[supatype] Shutting down compose...");
1283
+ await state.studioProc?.stop();
1284
+ await state.appProc?.stop();
1285
+ await settleComposeRuns();
1286
+ // Docker was answering a moment ago, so the daemon probe is skipped: a slow `docker info` made it
1287
+ // report the daemon down and exit before `down` ran (issue 33).
1288
+ const downStatus = runDockerCompose(stack.composePath, ["down"], cwd, stack.project, { quiet: true, skipDaemonProbe: true });
1289
+ if (downStatus === 0) {
1290
+ console.log("[supatype] Compose stack stopped.");
1291
+ }
1292
+ else {
1293
+ console.warn(`[supatype] Compose down exited with status ${downStatus}.`);
1294
+ }
1295
+ }
1184
1296
  export async function runDevCompose(cwd, config, opts) {
1185
1297
  if (resolveRuntimeProvider(config) !== "docker") {
1186
1298
  throw new Error("runDevCompose requires provider: docker");
@@ -1204,8 +1316,9 @@ export async function runDevCompose(cwd, config, opts) {
1204
1316
  const devBrand = { intro: "Local development" };
1205
1317
  const localServerImage = await ensureLocalServerDockerImage(cwd, config, devBrand);
1206
1318
  ensureDevComposeEnv(cwd, config, anonKey, serviceRoleKey, kongPort, devDbPort);
1207
- warnProjectAuthProviderSecrets(cwd, config);
1319
+ warnMissingStackSettings(cwd, config);
1208
1320
  console.log(`[supatype] provider docker, starting self-host Compose stack (project ${project}, gateway :${kongPort})...`);
1321
+ await showDevStep("Preparing the Docker stack");
1209
1322
  noteUnpinnedImages(cwd);
1210
1323
  const paths = writeSelfHostCompose(cwd, config, composeRenderOptions(cwd, config.project.name));
1211
1324
  if (ensureDevApiConfig(cwd)) {
@@ -1217,22 +1330,7 @@ export async function runDevCompose(cwd, config, opts) {
1217
1330
  schemaWatcher: null,
1218
1331
  functionsWatcher: null,
1219
1332
  };
1220
- registerDevShutdown(async () => {
1221
- shutdownState.schemaWatcher?.close();
1222
- shutdownState.schemaWatcher = null;
1223
- shutdownState.functionsWatcher?.close();
1224
- shutdownState.functionsWatcher = null;
1225
- console.log("[supatype] Shutting down compose...");
1226
- await shutdownState.studioProc?.stop();
1227
- await shutdownState.appProc?.stop();
1228
- const downStatus = runDockerCompose(paths.composePath, ["down"], cwd, project, { quiet: true });
1229
- if (downStatus === 0) {
1230
- console.log("[supatype] Compose stack stopped.");
1231
- }
1232
- else {
1233
- console.warn(`[supatype] Compose down exited with status ${downStatus}.`);
1234
- }
1235
- }, {
1333
+ registerDevShutdown(() => stopDevComposeStack(shutdownState, { project, composePath: paths.composePath }, cwd), {
1236
1334
  cwd,
1237
1335
  compose: { cwd, composePath: paths.composePath, composeProject: project },
1238
1336
  });
@@ -1251,6 +1349,7 @@ export async function runDevCompose(cwd, config, opts) {
1251
1349
  }
1252
1350
  if (!usesExternalDatabase(config)) {
1253
1351
  console.log("[supatype] Bringing up Postgres (compose db)...");
1352
+ await showDevStep("Starting Postgres");
1254
1353
  }
1255
1354
  await startComposeDatabase(config, paths, cwd, project, devBrand, 180_000, endDevSession);
1256
1355
  // Settle before DDL: pg_isready can pass slightly before the instance is stable.
@@ -1258,29 +1357,29 @@ export async function runDevCompose(cwd, config, opts) {
1258
1357
  // With the stack's database up, so a hand-written URL naming it is not reported as silent.
1259
1358
  await warnIfHandWrittenUrlSilent(cwd);
1260
1359
  if (!usesExternalDatabase(config)) {
1261
- reconcileAuthenticatorPassword(paths, cwd, project);
1262
- reconcileSqlEditorPassword(paths, cwd, project);
1263
- privatizeTableDefaults(paths, cwd, project);
1360
+ await reconcileAuthenticatorPassword(paths, cwd, project);
1361
+ await reconcileSqlEditorPassword(paths, cwd, project);
1362
+ await privatizeTableDefaults(paths, cwd, project);
1264
1363
  }
1265
1364
  // A: apply schema before realtime (and the rest of the stack) starts decoding WAL.
1266
1365
  const schemaPath = schemaPathFromProject(config, cwd);
1267
1366
  // `dev --overwrite-drift`, already checked against this engine before the session began.
1268
1367
  const pushOptions = { overwriteDrift: opts.overwriteDrift === true };
1368
+ await showDevStep("Applying the schema");
1269
1369
  const schemaApplied = await applyInitialSchema(cwd, config, paths, schemaPath, project, devBrand, pushOptions);
1270
1370
  // Before the stack starts, so PostgREST comes up on the tier the push actually produced.
1271
- followRecordedTier(cwd, config, { recreate: false });
1371
+ await followRecordedTier(cwd, config, { recreate: false });
1272
1372
  console.log("[supatype] Bringing up Docker Compose services...");
1273
- const upStatus = runDockerCompose(paths.composePath, ["up", "-d"], cwd, project, {
1274
- quiet: true,
1275
- brand: devBrand,
1276
- });
1373
+ await showDevStep("Starting services (the first start downloads their images)");
1374
+ const upStatus = await runDockerComposeQuietly(paths.composePath, ["up", "-d"], cwd, project, devBrand);
1277
1375
  if (upStatus !== 0) {
1278
1376
  endDevSession();
1279
1377
  exitComposeFailed(upStatus, "Could not start the local Compose stack.", devBrand);
1280
1378
  }
1281
1379
  if (localServerImage !== undefined) {
1282
1380
  console.log("[supatype] Recreating server with local image...");
1283
- const recreateStatus = runDockerCompose(paths.composePath, ["up", "-d", "--force-recreate", "--no-deps", "server"], cwd, project, { quiet: true, brand: devBrand });
1381
+ await showDevStep("Recreating the server");
1382
+ const recreateStatus = await runDockerComposeQuietly(paths.composePath, ["up", "-d", "--force-recreate", "--no-deps", "server"], cwd, project, devBrand);
1284
1383
  if (recreateStatus !== 0) {
1285
1384
  endDevSession();
1286
1385
  exitComposeFailed(recreateStatus, "Could not recreate the server container with the local image.", devBrand);
@@ -1297,7 +1396,8 @@ export async function runDevCompose(cwd, config, opts) {
1297
1396
  if (readEnvValue(cwd, variable, "").trim() === "")
1298
1397
  continue;
1299
1398
  console.log(`[supatype] Recreating ${service} with pinned image...`);
1300
- const status = runDockerCompose(paths.composePath, ["up", "-d", "--force-recreate", "--no-deps", service], cwd, project, { quiet: true, brand: devBrand });
1399
+ await showDevStep(`Recreating ${service}`);
1400
+ const status = await runDockerComposeQuietly(paths.composePath, ["up", "-d", "--force-recreate", "--no-deps", service], cwd, project, devBrand);
1301
1401
  if (status !== 0) {
1302
1402
  endDevSession();
1303
1403
  exitComposeFailed(status, `Could not recreate the ${service} container.`, devBrand);
@@ -1317,9 +1417,12 @@ export async function runDevCompose(cwd, config, opts) {
1317
1417
  });
1318
1418
  }
1319
1419
  console.log("[supatype] Waiting for API gateway...");
1420
+ await showDevStep("Waiting for the API gateway");
1320
1421
  await waitKongReady(kongPort, 120, { composePath: paths.composePath, cwd, project });
1321
1422
  console.log("[supatype] Waiting for storage API...");
1423
+ await showDevStep("Waiting for storage");
1322
1424
  await waitStorageApiReady(kongPort, serviceRoleKey, 90);
1425
+ await showDevStep("Checking for an admin user");
1323
1426
  await ensureFirstAdminUserForProject(cwd, config, {
1324
1427
  compose: { project, composePath: paths.composePath },
1325
1428
  });
@@ -1390,14 +1493,18 @@ export async function runDevCompose(cwd, config, opts) {
1390
1493
  shutdownState.schemaWatcher = watchDevSchema({
1391
1494
  dir: schemaDir,
1392
1495
  changedSinceLastPush: () => schemaChangedSinceLastPush(schemaPath, cwd, config),
1496
+ // The failure is reported inside the scope too, so its hints reach the dashboard.
1393
1497
  push: (why) => {
1394
- console.log(`\n[supatype] ${why}, pushing schema...`);
1395
- runComposeSchemaPushQueued(cwd, config, paths, schemaPath, project, pushOptions)
1396
- .then(async () => {
1397
- const updatedAst = loadSchemaAst(schemaPath, cwd);
1398
- await provisionDockerStorageBuckets(updatedAst, kongPort, serviceRoleKey);
1399
- })
1400
- .catch(reportDevPushFailure);
1498
+ void withSavePushOutput(async () => {
1499
+ console.log(`\n[supatype] ${why}, pushing schema...`);
1500
+ try {
1501
+ await runComposeSchemaPushQueued(cwd, config, paths, schemaPath, project, pushOptions);
1502
+ await provisionDockerStorageBuckets(loadSchemaAst(schemaPath, cwd), kongPort, serviceRoleKey);
1503
+ }
1504
+ catch (err) {
1505
+ reportDevPushFailure(err);
1506
+ }
1507
+ });
1401
1508
  },
1402
1509
  });
1403
1510
  // The worker imports its handlers once; without this an edited function kept its old code.