home-hosted 0.13.0 → 0.20.0

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 (485) hide show
  1. package/README.md +117 -322
  2. package/bin/home-hosted.mjs +41 -0
  3. package/dist/chunks/account-DiLrSyww.js +359 -0
  4. package/dist/chunks/account-DiLrSyww.js.map +1 -0
  5. package/dist/chunks/add-DEIYVkNK.js +183 -0
  6. package/dist/chunks/add-DEIYVkNK.js.map +1 -0
  7. package/dist/chunks/{archive-DP-XQR8X.js → archive-DFi3qK1c.js} +25 -73
  8. package/dist/chunks/archive-DFi3qK1c.js.map +1 -0
  9. package/dist/chunks/{atomic-C1PfJpE7.js → atomic-SZUwDtGD.js} +3 -6
  10. package/dist/chunks/atomic-SZUwDtGD.js.map +1 -0
  11. package/dist/chunks/{backup-CZcVca2a.js → backup-DnyxIzw0.js} +110 -190
  12. package/dist/chunks/backup-DnyxIzw0.js.map +1 -0
  13. package/dist/chunks/backups-BrrN6cwW.js +2203 -0
  14. package/dist/chunks/backups-BrrN6cwW.js.map +1 -0
  15. package/dist/chunks/bind-DIxrnUst.js +43 -0
  16. package/dist/chunks/bind-DIxrnUst.js.map +1 -0
  17. package/dist/chunks/config-text-DxMOQQnk.js +34 -0
  18. package/dist/chunks/config-text-DxMOQQnk.js.map +1 -0
  19. package/dist/chunks/{contracts-CMBD1TF9.js → contracts-CxZ7u1L3.js} +1239 -1454
  20. package/dist/chunks/contracts-CxZ7u1L3.js.map +1 -0
  21. package/dist/chunks/daemon-BAAYUYQC.js +211 -0
  22. package/dist/chunks/daemon-BAAYUYQC.js.map +1 -0
  23. package/dist/chunks/daemon-log-Ccu-69vB.js +179 -0
  24. package/dist/chunks/daemon-log-Ccu-69vB.js.map +1 -0
  25. package/dist/chunks/deploy-CggSOEkq.js +144 -0
  26. package/dist/chunks/deploy-CggSOEkq.js.map +1 -0
  27. package/dist/chunks/{docker-Cy9Lyvda.js → docker--Un0uLfF.js} +32 -68
  28. package/dist/chunks/docker--Un0uLfF.js.map +1 -0
  29. package/dist/chunks/{down-pKbGCW9d.js → down-CpIN7LEQ.js} +34 -94
  30. package/dist/chunks/down-CpIN7LEQ.js.map +1 -0
  31. package/dist/chunks/exposure-CDJNvOCK.js +229 -0
  32. package/dist/chunks/exposure-CDJNvOCK.js.map +1 -0
  33. package/dist/chunks/import-Bd4VZH0f.js +205 -0
  34. package/dist/chunks/import-Bd4VZH0f.js.map +1 -0
  35. package/dist/chunks/import-plan--fDS_l5r.js +147 -0
  36. package/dist/chunks/import-plan--fDS_l5r.js.map +1 -0
  37. package/dist/chunks/import-write-BTfbeV26.js +42 -0
  38. package/dist/chunks/import-write-BTfbeV26.js.map +1 -0
  39. package/dist/chunks/{init-BZ7hK9Vf.js → init-Bv3oH65x.js} +14 -50
  40. package/dist/chunks/init-Bv3oH65x.js.map +1 -0
  41. package/dist/chunks/job-CYOdN6Ub.js +341 -0
  42. package/dist/chunks/job-CYOdN6Ub.js.map +1 -0
  43. package/dist/chunks/jobs-BX4ahcfh.js +489 -0
  44. package/dist/chunks/jobs-BX4ahcfh.js.map +1 -0
  45. package/dist/chunks/last-stop-DD3lHwo_.js +42 -0
  46. package/dist/chunks/last-stop-DD3lHwo_.js.map +1 -0
  47. package/dist/chunks/layout-D0ysDNav.js +18 -0
  48. package/dist/chunks/layout-D0ysDNav.js.map +1 -0
  49. package/dist/chunks/lazy-kfcBNeqj.js +48 -0
  50. package/dist/chunks/lazy-kfcBNeqj.js.map +1 -0
  51. package/dist/chunks/log-buffer-B7jmn7ts.js +110 -0
  52. package/dist/chunks/log-buffer-B7jmn7ts.js.map +1 -0
  53. package/dist/chunks/log-files-CZL2UhuE.js +488 -0
  54. package/dist/chunks/log-files-CZL2UhuE.js.map +1 -0
  55. package/dist/chunks/{logger-B5U4GD3j.js → logger-BnrKTBHQ.js} +2 -6
  56. package/dist/chunks/logger-BnrKTBHQ.js.map +1 -0
  57. package/dist/chunks/{logs---TI_bxM.js → logs-DxKI6OW2.js} +23 -73
  58. package/dist/chunks/logs-DxKI6OW2.js.map +1 -0
  59. package/dist/chunks/ls-BseUHy_m.js +128 -0
  60. package/dist/chunks/ls-BseUHy_m.js.map +1 -0
  61. package/dist/chunks/migrate-D4w_dXDm.js +268 -0
  62. package/dist/chunks/migrate-D4w_dXDm.js.map +1 -0
  63. package/dist/chunks/{nanny-B-Eu0sFW.js → nanny-BWh7nuvv.js} +21 -14
  64. package/dist/chunks/nanny-BWh7nuvv.js.map +1 -0
  65. package/dist/chunks/{nanny-ChMtq1Zl.js → nanny-BjF2-1pv.js} +3 -3
  66. package/dist/chunks/{nanny-ChMtq1Zl.js.map → nanny-BjF2-1pv.js.map} +1 -1
  67. package/dist/chunks/nanny-DGTXVq5d.js +806 -0
  68. package/dist/chunks/nanny-DGTXVq5d.js.map +1 -0
  69. package/dist/chunks/{nanny-sweep-DErnlPY1.js → nanny-sweep-hjmZ_p7S.js} +14 -24
  70. package/dist/chunks/nanny-sweep-hjmZ_p7S.js.map +1 -0
  71. package/dist/chunks/{nearest-6KgQEDUe.js → nearest-DOx4jySJ.js} +2 -10
  72. package/dist/chunks/nearest-DOx4jySJ.js.map +1 -0
  73. package/dist/chunks/{parse-DhmG26fI.js → parse-DVMPLUDe.js} +47 -72
  74. package/dist/chunks/parse-DVMPLUDe.js.map +1 -0
  75. package/dist/chunks/password-policy-Clq6PGE-.js +9 -0
  76. package/dist/chunks/password-policy-Clq6PGE-.js.map +1 -0
  77. package/dist/chunks/{paths-CGlGDrOU.js → paths-C34-TJLh.js} +32 -56
  78. package/dist/chunks/paths-C34-TJLh.js.map +1 -0
  79. package/dist/chunks/{port-B8WBTRMk.js → port-CnsrxKNR.js} +27 -71
  80. package/dist/chunks/port-CnsrxKNR.js.map +1 -0
  81. package/dist/chunks/process-CboOFPU_.js +192 -0
  82. package/dist/chunks/process-CboOFPU_.js.map +1 -0
  83. package/dist/chunks/{restart-Des4DrAN.js → restart-C0J8dZ2L.js} +11 -29
  84. package/dist/chunks/restart-C0J8dZ2L.js.map +1 -0
  85. package/dist/chunks/run-deploy-DoNDvwT4.js +91 -0
  86. package/dist/chunks/run-deploy-DoNDvwT4.js.map +1 -0
  87. package/dist/chunks/{schema-B240VXcV.js → schema-CZ6f-PHD.js} +7 -20
  88. package/dist/chunks/schema-CZ6f-PHD.js.map +1 -0
  89. package/dist/chunks/secret-MY397r90.js +219 -0
  90. package/dist/chunks/secret-MY397r90.js.map +1 -0
  91. package/dist/chunks/secrets-CG5N4lwY.js +1061 -0
  92. package/dist/chunks/secrets-CG5N4lwY.js.map +1 -0
  93. package/dist/chunks/server-Dm_dXfTW.js +255 -0
  94. package/dist/chunks/server-Dm_dXfTW.js.map +1 -0
  95. package/dist/chunks/server-attention-UQwYXqKe.js +10 -0
  96. package/dist/chunks/server-attention-UQwYXqKe.js.map +1 -0
  97. package/dist/chunks/server-create-D7nvhgBd.js +96 -0
  98. package/dist/chunks/server-create-D7nvhgBd.js.map +1 -0
  99. package/dist/chunks/server-ids-BEQD2rFz.js +23 -0
  100. package/dist/chunks/server-ids-BEQD2rFz.js.map +1 -0
  101. package/dist/chunks/server-vars-DMYmHutL.js +27 -0
  102. package/dist/chunks/server-vars-DMYmHutL.js.map +1 -0
  103. package/dist/chunks/service-C8l-ewNA.js +585 -0
  104. package/dist/chunks/service-C8l-ewNA.js.map +1 -0
  105. package/dist/chunks/{settings-xu-XTfWg.js → settings-CtYDs5PX.js} +62 -78
  106. package/dist/chunks/settings-CtYDs5PX.js.map +1 -0
  107. package/dist/chunks/{setup-temp-CAN4_bA-.js → setup-temp-TAtDmMMU.js} +43 -37
  108. package/dist/chunks/setup-temp-TAtDmMMU.js.map +1 -0
  109. package/dist/chunks/shape-CDGeYl_J.js +9 -0
  110. package/dist/chunks/shape-CDGeYl_J.js.map +1 -0
  111. package/dist/chunks/{src-BtWMFmzZ.js → src-BnzkVy_M.js} +12548 -10576
  112. package/dist/chunks/src-BnzkVy_M.js.map +1 -0
  113. package/dist/chunks/{status-DT1EsA-B.js → status-efbbfYZQ.js} +53 -26
  114. package/dist/chunks/status-efbbfYZQ.js.map +1 -0
  115. package/dist/chunks/store-Bs_Lljjm.js +2082 -0
  116. package/dist/chunks/store-Bs_Lljjm.js.map +1 -0
  117. package/dist/chunks/template-xan58bJh.js +28 -0
  118. package/dist/chunks/template-xan58bJh.js.map +1 -0
  119. package/dist/chunks/token-DDeWfZA4.js +142 -0
  120. package/dist/chunks/token-DDeWfZA4.js.map +1 -0
  121. package/dist/chunks/{ui-D562aqw5.js → ui-BcIAtyxE.js} +68 -79
  122. package/dist/chunks/ui-BcIAtyxE.js.map +1 -0
  123. package/dist/chunks/{ui-dir-CsU3uLNV.js → ui-dir-ClCzVRc3.js} +3 -7
  124. package/dist/chunks/ui-dir-ClCzVRc3.js.map +1 -0
  125. package/dist/chunks/ui-format-CDvvqOoi.js +53 -0
  126. package/dist/chunks/ui-format-CDvvqOoi.js.map +1 -0
  127. package/dist/chunks/{ui-release-DKzVvlLd.js → ui-release-XbJ85pYI.js} +36 -38
  128. package/dist/chunks/ui-release-XbJ85pYI.js.map +1 -0
  129. package/dist/chunks/{ui-revert-EkBBwRTt.js → ui-revert-Dgawq7ze.js} +4 -4
  130. package/dist/chunks/ui-revert-Dgawq7ze.js.map +1 -0
  131. package/dist/chunks/{ui-switch-BnZTdMDd.js → ui-switch-CfQMbZ0g.js} +31 -38
  132. package/dist/chunks/ui-switch-CfQMbZ0g.js.map +1 -0
  133. package/dist/chunks/{ui-update-_xryLYxw.js → ui-update-B3PPivUm.js} +30 -48
  134. package/dist/chunks/ui-update-B3PPivUm.js.map +1 -0
  135. package/dist/chunks/ui-update-CAiH2tFb.js +109 -0
  136. package/dist/chunks/ui-update-CAiH2tFb.js.map +1 -0
  137. package/dist/chunks/{up-Pdz-l6IH.js → up-BQSnYxYd.js} +47 -53
  138. package/dist/chunks/up-BQSnYxYd.js.map +1 -0
  139. package/dist/chunks/{usage-DFrCVXpT.js → usage-KG8TeOio.js} +7 -20
  140. package/dist/chunks/usage-KG8TeOio.js.map +1 -0
  141. package/dist/chunks/{workspaces-DYcfvKV_.js → workspaces-D9akpzU8.js} +80 -68
  142. package/dist/chunks/workspaces-D9akpzU8.js.map +1 -0
  143. package/dist/chunks/{wsl-temperature-BiCI4iK6.js → wsl-temperature-D-_d4Yk1.js} +47 -42
  144. package/dist/chunks/wsl-temperature-D-_d4Yk1.js.map +1 -0
  145. package/dist/cli.js +306 -238
  146. package/dist/cli.js.map +1 -1
  147. package/dist/client.js +76 -29
  148. package/dist/client.js.map +1 -1
  149. package/dist/types/api/acme.d.ts +3 -7
  150. package/dist/types/api/auth/$.routes.d.ts +107 -16
  151. package/dist/types/api/backups.d.ts +5 -5
  152. package/dist/types/api/control.d.ts +747 -38
  153. package/dist/types/api/ddns.d.ts +13 -18
  154. package/dist/types/api/events.d.ts +9 -3
  155. package/dist/types/api/health.d.ts +2 -4
  156. package/dist/types/api/jobs.d.ts +438 -0
  157. package/dist/types/api/logs.d.ts +20 -0
  158. package/dist/types/api/metrics.d.ts +2 -5
  159. package/dist/types/api/notifications.d.ts +3 -6
  160. package/dist/types/api/proxy.d.ts +63 -23
  161. package/dist/types/api/server-ops.d.ts +17 -0
  162. package/dist/types/api/servers/$.routes.d.ts +418 -186
  163. package/dist/types/api/session-required.d.ts +16 -0
  164. package/dist/types/api/settings.d.ts +7 -7
  165. package/dist/types/api/state.d.ts +100 -10
  166. package/dist/types/api/static.d.ts +2 -2
  167. package/dist/types/api/tls.d.ts +2 -5
  168. package/dist/types/api/workspaces/$.routes.d.ts +186 -12
  169. package/dist/types/api/wsl-temperature.d.ts +4 -10
  170. package/dist/types/app.d.ts +4511 -2778
  171. package/dist/types/cli/account.d.ts +23 -0
  172. package/dist/types/cli/add.d.ts +96 -0
  173. package/dist/types/cli/args.d.ts +24 -35
  174. package/dist/types/cli/backup-offline.d.ts +2 -8
  175. package/dist/types/cli/backup.d.ts +12 -21
  176. package/dist/types/cli/down.d.ts +15 -41
  177. package/dist/types/cli/import-plan.d.ts +55 -0
  178. package/dist/types/cli/import-write.d.ts +5 -0
  179. package/dist/types/cli/import.d.ts +86 -0
  180. package/dist/types/cli/io.d.ts +26 -35
  181. package/dist/types/cli/job.d.ts +99 -0
  182. package/dist/types/cli/logs.d.ts +1 -10
  183. package/dist/types/cli/ls.d.ts +57 -0
  184. package/dist/types/cli/migrate.d.ts +31 -8
  185. package/dist/types/cli/nearest.d.ts +1 -9
  186. package/dist/types/cli/run-deploy.d.ts +36 -0
  187. package/dist/types/cli/secret.d.ts +90 -0
  188. package/dist/types/cli/server.d.ts +6 -15
  189. package/dist/types/cli/service.d.ts +135 -0
  190. package/dist/types/cli/setup-temp.d.ts +17 -13
  191. package/dist/types/cli/status.d.ts +7 -1
  192. package/dist/types/cli/token.d.ts +6 -0
  193. package/dist/types/cli/ui-switch.d.ts +3 -14
  194. package/dist/types/cli/ui-update.d.ts +3 -16
  195. package/dist/types/cli/up.d.ts +9 -22
  196. package/dist/types/cli/usage.d.ts +2 -6
  197. package/dist/types/cli.d.ts +1 -10
  198. package/dist/types/client.d.ts +4099 -1142
  199. package/dist/types/config/accounts.d.ts +16 -0
  200. package/dist/types/config/jobs.d.ts +68 -0
  201. package/dist/types/config/layout.d.ts +2 -8
  202. package/dist/types/config/migrations.d.ts +9 -41
  203. package/dist/types/config/parse.d.ts +8 -13
  204. package/dist/types/config/patch.d.ts +1 -6
  205. package/dist/types/config/schema.d.ts +16 -18
  206. package/dist/types/config/secret-parts.d.ts +6 -27
  207. package/dist/types/config/secrets.d.ts +167 -88
  208. package/dist/types/config/seed.d.ts +1 -6
  209. package/dist/types/config/server-ids.d.ts +2 -11
  210. package/dist/types/config/settings.d.ts +13 -49
  211. package/dist/types/config/store.d.ts +17 -54
  212. package/dist/types/config/workspaces.d.ts +24 -56
  213. package/dist/types/helpers/action-result.d.ts +18 -32
  214. package/dist/types/helpers/atomic.d.ts +1 -4
  215. package/dist/types/helpers/backoff.d.ts +0 -1
  216. package/dist/types/helpers/bind.d.ts +3 -11
  217. package/dist/types/helpers/config-text.d.ts +4 -19
  218. package/dist/types/helpers/cookies.d.ts +2 -7
  219. package/dist/types/helpers/copy-tree.d.ts +4 -12
  220. package/dist/types/helpers/daemon-log.d.ts +8 -33
  221. package/dist/types/helpers/daemon.d.ts +20 -70
  222. package/dist/types/helpers/deferred.d.ts +2 -4
  223. package/dist/types/helpers/env-file.d.ts +2 -7
  224. package/dist/types/helpers/error.d.ts +3 -14
  225. package/dist/types/helpers/event-stream.d.ts +18 -10
  226. package/dist/types/helpers/factory.d.ts +2 -3
  227. package/dist/types/helpers/last-stop.d.ts +5 -12
  228. package/dist/types/helpers/logger.d.ts +1 -5
  229. package/dist/types/helpers/open.d.ts +0 -1
  230. package/dist/types/helpers/openapi.d.ts +19 -5
  231. package/dist/types/helpers/paths.d.ts +18 -53
  232. package/dist/types/helpers/restore-lock.d.ts +2 -17
  233. package/dist/types/helpers/runtime.d.ts +3 -13
  234. package/dist/types/helpers/secret-compare.d.ts +2 -10
  235. package/dist/types/helpers/server-create.d.ts +15 -0
  236. package/dist/types/helpers/shell.d.ts +2 -16
  237. package/dist/types/helpers/sse.d.ts +8 -6
  238. package/dist/types/helpers/ui-dir.d.ts +1 -5
  239. package/dist/types/helpers/utf8-chunks.d.ts +2 -8
  240. package/dist/types/helpers/validate.d.ts +2 -4
  241. package/dist/types/helpers/validator.d.ts +8 -4
  242. package/dist/types/helpers/version.d.ts +1 -6
  243. package/dist/types/helpers/workspace.d.ts +24 -16
  244. package/dist/types/index.d.ts +2 -3
  245. package/dist/types/middleware/auth.d.ts +8 -27
  246. package/dist/types/middleware/body-limit.d.ts +10 -0
  247. package/dist/types/middleware/host.d.ts +4 -23
  248. package/dist/types/middleware/loopback.d.ts +1 -8
  249. package/dist/types/middleware/token-scope.d.ts +34 -0
  250. package/dist/types/node-compat.d.ts +43 -0
  251. package/dist/types/openapi-reference.d.ts +4 -19
  252. package/dist/types/openapi.d.ts +5 -8
  253. package/dist/types/providers/archive.d.ts +8 -25
  254. package/dist/types/providers/backup-hook.d.ts +4 -19
  255. package/dist/types/providers/ddns/dyndns2.d.ts +0 -3
  256. package/dist/types/providers/ddns/index.d.ts +2 -3
  257. package/dist/types/providers/ddns/ip.d.ts +2 -12
  258. package/dist/types/providers/ddns/namecheap-api.d.ts +3 -2
  259. package/dist/types/providers/ddns/types.d.ts +6 -32
  260. package/dist/types/providers/ddns/zone.d.ts +1 -4
  261. package/dist/types/providers/docker.d.ts +18 -45
  262. package/dist/types/providers/entry-state.d.ts +4 -9
  263. package/dist/types/providers/health-check.d.ts +1 -5
  264. package/dist/types/providers/host.d.ts +33 -108
  265. package/dist/types/providers/identity.d.ts +9 -34
  266. package/dist/types/providers/log-tail.d.ts +14 -24
  267. package/dist/types/providers/nanny-sweep.d.ts +8 -25
  268. package/dist/types/providers/nanny.d.ts +16 -58
  269. package/dist/types/providers/port.d.ts +28 -83
  270. package/dist/types/providers/proc.d.ts +22 -80
  271. package/dist/types/providers/process.d.ts +12 -36
  272. package/dist/types/providers/proxy/admin.d.ts +11 -0
  273. package/dist/types/providers/proxy/types.d.ts +4 -16
  274. package/dist/types/providers/telegram.d.ts +1 -17
  275. package/dist/types/providers/ui-release.d.ts +15 -25
  276. package/dist/types/providers/webhook.d.ts +8 -29
  277. package/dist/types/providers/wsl-temperature.d.ts +13 -22
  278. package/dist/types/services/acme-challenge.d.ts +2 -16
  279. package/dist/types/services/auth.d.ts +65 -80
  280. package/dist/types/services/backups/archive-safety.d.ts +30 -0
  281. package/dist/types/services/backups/paths.d.ts +31 -0
  282. package/dist/types/services/backups.d.ts +61 -271
  283. package/dist/types/services/config-watch.d.ts +3 -15
  284. package/dist/types/services/control-server.d.ts +6 -10
  285. package/dist/types/services/ddns.d.ts +12 -13
  286. package/dist/types/services/dependencies.d.ts +3 -14
  287. package/dist/types/services/deploy.d.ts +34 -0
  288. package/dist/types/services/events.d.ts +15 -9
  289. package/dist/types/services/exposure.d.ts +13 -63
  290. package/dist/types/services/history.d.ts +5 -14
  291. package/dist/types/services/host-monitor.d.ts +6 -11
  292. package/dist/types/services/init.d.ts +5 -35
  293. package/dist/types/services/job-ledger.d.ts +27 -0
  294. package/dist/types/services/jobs.d.ts +113 -0
  295. package/dist/types/services/log-buffer.d.ts +7 -8
  296. package/dist/types/services/log-files.d.ts +12 -42
  297. package/dist/types/services/log-relay.d.ts +3 -13
  298. package/dist/types/services/nanny.d.ts +3 -10
  299. package/dist/types/services/notifications.d.ts +31 -61
  300. package/dist/types/services/panel.d.ts +32 -78
  301. package/dist/types/services/proxy-certificates/certificates.d.ts +31 -69
  302. package/dist/types/services/proxy-config.d.ts +15 -36
  303. package/dist/types/services/proxy-dns01.d.ts +14 -0
  304. package/dist/types/services/proxy.d.ts +73 -254
  305. package/dist/types/services/scheduler.d.ts +46 -0
  306. package/dist/types/services/state.d.ts +17 -8
  307. package/dist/types/services/supervisor/compose.d.ts +2 -6
  308. package/dist/types/services/supervisor/entry.d.ts +29 -32
  309. package/dist/types/services/supervisor/health.d.ts +8 -31
  310. package/dist/types/services/supervisor/job-run.d.ts +36 -0
  311. package/dist/types/services/supervisor/output.d.ts +13 -77
  312. package/dist/types/services/supervisor/persistent.d.ts +5 -11
  313. package/dist/types/services/supervisor/port-preflight.d.ts +4 -10
  314. package/dist/types/services/supervisor/records.d.ts +27 -60
  315. package/dist/types/services/supervisor/restart-required.d.ts +13 -0
  316. package/dist/types/services/supervisor/spawn.d.ts +3 -5
  317. package/dist/types/services/supervisor/view.d.ts +3 -1
  318. package/dist/types/services/supervisor.d.ts +31 -43
  319. package/dist/types/services/tls.d.ts +6 -17
  320. package/dist/types/services/ui-update.d.ts +19 -17
  321. package/dist/types/services/ui.d.ts +10 -19
  322. package/dist/types/shared/action-outcome.d.ts +2 -7
  323. package/dist/types/shared/api-client.d.ts +133 -177
  324. package/dist/types/shared/api-scopes.d.ts +17 -0
  325. package/dist/types/shared/backup-scope.d.ts +16 -90
  326. package/dist/types/shared/clone.d.ts +2 -11
  327. package/dist/types/shared/contracts/accounts.d.ts +99 -0
  328. package/dist/types/shared/contracts/backups.d.ts +219 -0
  329. package/dist/types/shared/contracts/ddns.d.ts +208 -0
  330. package/dist/types/shared/contracts/frames.d.ts +1395 -0
  331. package/dist/types/shared/contracts/index.d.ts +3 -0
  332. package/dist/types/shared/contracts/logs.d.ts +107 -0
  333. package/dist/types/shared/contracts/proxy.d.ts +303 -0
  334. package/dist/types/shared/contracts.d.ts +852 -1982
  335. package/dist/types/shared/cpu-scale.d.ts +3 -19
  336. package/dist/types/shared/crash-cause.d.ts +8 -0
  337. package/dist/types/shared/cron.d.ts +70 -0
  338. package/dist/types/shared/ddns-form.d.ts +9 -43
  339. package/dist/types/shared/endpoint.d.ts +1 -7
  340. package/dist/types/shared/error-codes.d.ts +438 -0
  341. package/dist/types/shared/error-message.d.ts +1 -7
  342. package/dist/types/shared/fields.d.ts +7 -17
  343. package/dist/types/shared/form-repair.d.ts +1 -5
  344. package/dist/types/shared/generated.d.ts +3 -19
  345. package/dist/types/shared/host-readings.d.ts +25 -128
  346. package/dist/types/shared/lazy.d.ts +1 -1
  347. package/dist/types/shared/live-frames.d.ts +2 -8
  348. package/dist/types/shared/live-series.d.ts +2 -8
  349. package/dist/types/shared/live-store.d.ts +4 -8
  350. package/dist/types/shared/log-download.d.ts +6 -0
  351. package/dist/types/shared/meta.d.ts +6 -0
  352. package/dist/types/shared/password-policy.d.ts +10 -0
  353. package/dist/types/shared/patch-diff.d.ts +13 -72
  354. package/dist/types/shared/port-reading.d.ts +18 -0
  355. package/dist/types/shared/probe-latency.d.ts +3 -21
  356. package/dist/types/shared/proxy-form.d.ts +33 -74
  357. package/dist/types/shared/proxy-validate.d.ts +11 -0
  358. package/dist/types/shared/query-params.d.ts +8 -0
  359. package/dist/types/shared/server-attention.d.ts +2 -27
  360. package/dist/types/shared/server-form.d.ts +15 -54
  361. package/dist/types/shared/server-key.d.ts +1 -12
  362. package/dist/types/shared/server-readings.d.ts +7 -32
  363. package/dist/types/shared/server-url.d.ts +9 -31
  364. package/dist/types/shared/shape.d.ts +1 -16
  365. package/dist/types/shared/stream-access.d.ts +2 -8
  366. package/dist/types/shared/ui-format.d.ts +25 -65
  367. package/docs/API.md +315 -107
  368. package/docs/BACKUPS.md +61 -56
  369. package/docs/CLI.md +255 -49
  370. package/docs/DDNS.md +35 -49
  371. package/docs/JOBS.md +129 -0
  372. package/docs/NOTIFICATIONS.md +58 -90
  373. package/docs/REVERSE_PROXY.md +116 -188
  374. package/docs/SECURITY.md +126 -44
  375. package/docs/SERVERS.md +282 -409
  376. package/docs/UI_CREATION.md +90 -47
  377. package/docs/demo/blank-host-restore.sh +31 -7
  378. package/package.json +15 -6
  379. package/scripts/prepare.mjs +47 -0
  380. package/uis/stock/dist/assets/CopyButton-8mliL0xi.js +1 -0
  381. package/uis/stock/dist/assets/GlobalSettingsView-BINXY77E.js +1 -0
  382. package/uis/stock/dist/assets/LogViewer-kiSnTwdY.js +1 -0
  383. package/uis/stock/dist/assets/LogsView-DDXf_ONs.js +1 -0
  384. package/uis/stock/dist/assets/Modal-lrUuViF2.js +39 -0
  385. package/uis/stock/dist/assets/ProxyView-uXMaJdSQ.js +1 -0
  386. package/uis/stock/dist/assets/ServerDetailView-CW0Vb_c0.js +4 -0
  387. package/uis/stock/dist/assets/SettingsShell-B135xWjJ.js +1 -0
  388. package/uis/stock/dist/assets/SettingsView-BLtWxVkl.js +2 -0
  389. package/uis/stock/dist/assets/de-BIoTrHBQ.js +1 -0
  390. package/uis/stock/dist/assets/es-x4-ih8lH.js +1 -0
  391. package/uis/stock/dist/assets/fr-DatqBBkO.js +1 -0
  392. package/uis/stock/dist/assets/index-CnojaKcA.css +2 -0
  393. package/uis/stock/dist/assets/index-D-CiZReu.js +16 -0
  394. package/uis/stock/dist/assets/ja-CW1703Gw.js +1 -0
  395. package/uis/stock/dist/assets/ko-wFbT4XtK.js +1 -0
  396. package/uis/stock/dist/assets/ru-C1p5C4VN.js +1 -0
  397. package/uis/stock/dist/assets/useUnsavedGuard-BcsXsfCC.js +9 -0
  398. package/uis/stock/dist/assets/vi-CDqr0uie.js +1 -0
  399. package/uis/stock/dist/assets/zh-CN-BJ7iit-X.js +1 -0
  400. package/uis/stock/dist/index.html +4 -3
  401. package/uis/stock/dist/ui.json +3 -3
  402. package/dist/chunks/archive-DP-XQR8X.js.map +0 -1
  403. package/dist/chunks/atomic-C1PfJpE7.js.map +0 -1
  404. package/dist/chunks/backup-CZcVca2a.js.map +0 -1
  405. package/dist/chunks/backups-CFRaWe_m.js +0 -4691
  406. package/dist/chunks/backups-CFRaWe_m.js.map +0 -1
  407. package/dist/chunks/config-text-DifCHhnz.js +0 -50
  408. package/dist/chunks/config-text-DifCHhnz.js.map +0 -1
  409. package/dist/chunks/contracts-CMBD1TF9.js.map +0 -1
  410. package/dist/chunks/daemon-log-BVj8cDEo.js +0 -241
  411. package/dist/chunks/daemon-log-BVj8cDEo.js.map +0 -1
  412. package/dist/chunks/daemon-qKVECISl.js +0 -247
  413. package/dist/chunks/daemon-qKVECISl.js.map +0 -1
  414. package/dist/chunks/docker-Cy9Lyvda.js.map +0 -1
  415. package/dist/chunks/down-pKbGCW9d.js.map +0 -1
  416. package/dist/chunks/init-BZ7hK9Vf.js.map +0 -1
  417. package/dist/chunks/last-stop-C-BXz_XI.js +0 -53
  418. package/dist/chunks/last-stop-C-BXz_XI.js.map +0 -1
  419. package/dist/chunks/layout-DwTtmund.js +0 -24
  420. package/dist/chunks/layout-DwTtmund.js.map +0 -1
  421. package/dist/chunks/lazy-Ce5zEAq1.js +0 -66
  422. package/dist/chunks/lazy-Ce5zEAq1.js.map +0 -1
  423. package/dist/chunks/log-buffer-Dy9HHDMD.js +0 -414
  424. package/dist/chunks/log-buffer-Dy9HHDMD.js.map +0 -1
  425. package/dist/chunks/logger-B5U4GD3j.js.map +0 -1
  426. package/dist/chunks/logs---TI_bxM.js.map +0 -1
  427. package/dist/chunks/migrate-Cfoq-Vgh.js +0 -155
  428. package/dist/chunks/migrate-Cfoq-Vgh.js.map +0 -1
  429. package/dist/chunks/nanny-B-Eu0sFW.js.map +0 -1
  430. package/dist/chunks/nanny-BtWfy0QH.js +0 -1167
  431. package/dist/chunks/nanny-BtWfy0QH.js.map +0 -1
  432. package/dist/chunks/nanny-sweep-DErnlPY1.js.map +0 -1
  433. package/dist/chunks/nearest-6KgQEDUe.js.map +0 -1
  434. package/dist/chunks/parse-DhmG26fI.js.map +0 -1
  435. package/dist/chunks/paths-CGlGDrOU.js.map +0 -1
  436. package/dist/chunks/port-B8WBTRMk.js.map +0 -1
  437. package/dist/chunks/restart-Des4DrAN.js.map +0 -1
  438. package/dist/chunks/schema-B240VXcV.js.map +0 -1
  439. package/dist/chunks/secrets-BieELnZh.js +0 -562
  440. package/dist/chunks/secrets-BieELnZh.js.map +0 -1
  441. package/dist/chunks/server-Bge2r2qQ.js +0 -169
  442. package/dist/chunks/server-Bge2r2qQ.js.map +0 -1
  443. package/dist/chunks/server-ids-DRuNLVCV.js +0 -32
  444. package/dist/chunks/server-ids-DRuNLVCV.js.map +0 -1
  445. package/dist/chunks/set-password-D5vZqqSX.js +0 -43
  446. package/dist/chunks/set-password-D5vZqqSX.js.map +0 -1
  447. package/dist/chunks/set-token-obPiEJYk.js +0 -78
  448. package/dist/chunks/set-token-obPiEJYk.js.map +0 -1
  449. package/dist/chunks/settings-xu-XTfWg.js.map +0 -1
  450. package/dist/chunks/setup-temp-CAN4_bA-.js.map +0 -1
  451. package/dist/chunks/shape-DnTKzjQ2.js +0 -24
  452. package/dist/chunks/shape-DnTKzjQ2.js.map +0 -1
  453. package/dist/chunks/src-BtWMFmzZ.js.map +0 -1
  454. package/dist/chunks/status-DT1EsA-B.js.map +0 -1
  455. package/dist/chunks/ui-D562aqw5.js.map +0 -1
  456. package/dist/chunks/ui-dir-CsU3uLNV.js.map +0 -1
  457. package/dist/chunks/ui-release-DKzVvlLd.js.map +0 -1
  458. package/dist/chunks/ui-revert-EkBBwRTt.js.map +0 -1
  459. package/dist/chunks/ui-switch-BnZTdMDd.js.map +0 -1
  460. package/dist/chunks/ui-update-_xryLYxw.js.map +0 -1
  461. package/dist/chunks/up-Pdz-l6IH.js.map +0 -1
  462. package/dist/chunks/usage-DFrCVXpT.js.map +0 -1
  463. package/dist/chunks/workspaces-DYcfvKV_.js.map +0 -1
  464. package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +0 -1
  465. package/dist/types/cli/set-password.d.ts +0 -14
  466. package/dist/types/cli/set-token.d.ts +0 -21
  467. package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +0 -1
  468. package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +0 -1
  469. package/uis/stock/dist/assets/LogViewer-DIliXy62.js +0 -1
  470. package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +0 -1
  471. package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +0 -39
  472. package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +0 -1
  473. package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +0 -2
  474. package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +0 -1
  475. package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +0 -2
  476. package/uis/stock/dist/assets/de-BRITeb0H.js +0 -1
  477. package/uis/stock/dist/assets/es-B2zIEssV.js +0 -1
  478. package/uis/stock/dist/assets/fr-s0ZOBEqh.js +0 -1
  479. package/uis/stock/dist/assets/index-C1MehbKy.css +0 -2
  480. package/uis/stock/dist/assets/index-CnBN54wF.js +0 -15
  481. package/uis/stock/dist/assets/ja-CU7MR85V.js +0 -1
  482. package/uis/stock/dist/assets/ko-tL5Me6d-.js +0 -1
  483. package/uis/stock/dist/assets/ru-92yrvkNJ.js +0 -1
  484. package/uis/stock/dist/assets/vi-CzvY16k2.js +0 -1
  485. package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +0 -1
package/dist/cli.js CHANGED
@@ -1,25 +1,42 @@
1
1
  import { t as __exportAll } from "./chunks/rolldown-runtime-D7D4PA-g.js";
2
- import { t as nearestWord } from "./chunks/nearest-6KgQEDUe.js";
2
+ import { t as nearestWord } from "./chunks/nearest-DOx4jySJ.js";
3
3
  import process from "node:process";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { defineCommand, runCommand } from "citty";
6
6
  import path from "node:path";
7
7
  import readline from "node:readline";
8
8
  import fs from "node:fs";
9
- //#region src/shared/error-message.ts
9
+ //#region src/shared/api-scopes.ts
10
+ /**
11
+ * The API scope names, apart from `#src/config/secrets.ts` (which re-exports them) so `src/cli.ts` can
12
+ * read them without importing a state module before `--home` applies.
13
+ */
10
14
  /**
11
- * One rendering for a thrown value, so a caught error reads the same everywhere.
15
+ * What a credential may do.
12
16
  *
13
- * `catch` binds `unknown`, and the same ternary was written out in ~60 places across the
14
- * panel and both UIs. Two idioms in one codebase is how they drift, and the UIs are
15
- * separate bundles: a fix applied to one copy silently misses the others.
17
+ * - `read` — every `GET`;
18
+ * - `lifecycle` — start, stop, restart, free-port, clear-logs;
19
+ * - `config` — server, workspace and settings writes, and backups;
20
+ * - `proxy` — the reverse proxy: the engine, its routes and its certificates;
21
+ * - `admin` — everything, including tokens, the password, UI install and restoring secrets.
16
22
  */
23
+ var API_TOKEN_SCOPES = [
24
+ "read",
25
+ "lifecycle",
26
+ "config",
27
+ "proxy",
28
+ "admin"
29
+ ];
30
+ /** Scopes with no per-workspace meaning: granting either grants the whole panel whatever `workspaces` says. */
31
+ var PANEL_WIDE_SCOPES = ["proxy", "admin"];
32
+ //#endregion
33
+ //#region src/shared/error-message.ts
34
+ /** One rendering for a thrown value, so a caught error reads the same everywhere. */
17
35
  function errorMessage(caught) {
18
36
  return caught instanceof Error ? caught.message : String(caught);
19
37
  }
20
38
  //#endregion
21
39
  //#region src/cli/args.ts
22
- /** `--home`/`--project` are handled for every command, so they are peeled off first. */
23
40
  function extractDirFlags(argv) {
24
41
  const rest = [];
25
42
  let project;
@@ -48,7 +65,6 @@ function extractDirFlags(argv) {
48
65
  home
49
66
  };
50
67
  }
51
- /** Set before any state module is imported, so it decides where state lives. */
52
68
  function applyDirFlags(flags) {
53
69
  if (flags.project !== void 0) process.env.HHOSTED_PROJECT = path.resolve(flags.project);
54
70
  if (flags.home !== void 0) process.env.HHOSTED_HOME = path.resolve(flags.home);
@@ -64,7 +80,6 @@ var VERSION_TOKENS = /* @__PURE__ */ new Set([
64
80
  "-v"
65
81
  ]);
66
82
  var HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h"]);
67
- /** Commands whose first bare word is a server id, so `<command> help` names a server, not help. */
68
83
  var ID_FIRST = /* @__PURE__ */ new Set([
69
84
  "start",
70
85
  "stop",
@@ -74,15 +89,8 @@ var ID_FIRST = /* @__PURE__ */ new Set([
74
89
  ]);
75
90
  var VERSION_FLAGS = /* @__PURE__ */ new Set(["--version", "-v"]);
76
91
  /**
77
- * What the stripped argv means, before citty sees it.
78
- *
79
- * `help`/`version` are commands here, not flags, and a help or version flag on a
80
- * command is answered the same way instead of being parsed as one of that
81
- * command's options. A help flag after a command keeps that command's name, so
82
- * the curated text can stay scoped to it; the bare `help` (or a top-level flag)
83
- * is the whole reference. A first token that starts with `-` is the one-shot
84
- * form (`home-hosted -p 4000`), so `up` is prepended. Anything else has to name
85
- * a command, which keeps the old `unknown command:` text exact.
92
+ * What the stripped argv means, before citty sees it. `help`/`version` are commands; a help flag after
93
+ * a command keeps it scoped; a first token starting with `-` is the `up` shorthand (`-p 4000`).
86
94
  */
87
95
  function resolveInvocation(argv, commands) {
88
96
  if (argv.length === 0) return {
@@ -120,7 +128,6 @@ function resolveInvocation(argv, commands) {
120
128
  };
121
129
  }
122
130
  var CAMEL = /[A-Z]/g;
123
- /** citty takes camelCase definitions; the flag a person types is kebab-case. */
124
131
  function kebab(name) {
125
132
  return name.replace(CAMEL, (match) => `-${match.toLowerCase()}`);
126
133
  }
@@ -128,11 +135,7 @@ function aliasesOf(def) {
128
135
  if (def === void 0 || !("alias" in def) || def.alias === void 0) return [];
129
136
  return Array.isArray(def.alias) ? def.alias : [def.alias];
130
137
  }
131
- /**
132
- * Every spelling that reaches one declared option: the key, its kebab form, each alias, and the
133
- * `no-` negation citty gives a boolean. `findArg` accepts on this set and the suggestion offers from
134
- * it, so a suggestion can never name a spelling the parser would then refuse.
135
- */
138
+ /** Every spelling that reaches one option (key, kebab form, aliases, `no-`), so a suggestion is always accepted. */
136
139
  function namesOf(key, def) {
137
140
  return [
138
141
  key,
@@ -140,7 +143,6 @@ function namesOf(key, def) {
140
143
  ...aliasesOf(def)
141
144
  ];
142
145
  }
143
- /** The spellings of every option this command declares, for a suggestion. */
144
146
  function declaredOptionNames(argsDef) {
145
147
  const names = [];
146
148
  for (const [key, def] of Object.entries(argsDef)) {
@@ -159,19 +161,9 @@ function findArg(argsDef, name) {
159
161
  }
160
162
  }
161
163
  /**
162
- * citty parses permissively (`strict: false`), so a mistyped flag would quietly do
163
- * nothing — `--autostart` where `--no-autostart` was meant would start the panel
164
- * with the wrong policy. This keeps the refusal the command line always had, from
165
- * citty's own definitions rather than a second list.
166
- *
167
- * `undefined` means the command parses its own argv — `ui-switch` calls `node:util`'s
168
- * `parseArgs` with its own options, which is strict already — so it is left alone. An
169
- * **empty** definition is different: it declares that this command takes nothing, so
170
- * every flag and every bare word is refused here. Reading `{}` as "parses its own argv"
171
- * is what let `ui-revert`, which has no parser at all, accept and discard anything:
172
- * `ui-revert --dry-run` deleted the installed UI and exited 0.
173
- *
174
- * Returns the message to print, or null.
164
+ * citty parses permissively, so a mistyped flag would quietly do nothing. Returns the message to
165
+ * print, or null. `undefined` means the command parses its own argv (`ui-switch`); an empty `{}`
166
+ * means it takes nothing, so everything is refused. A group's flags come from `flagTarget`.
175
167
  */
176
168
  function rejectUnknownFlags(argv, argsDef) {
177
169
  if (argsDef === void 0) return null;
@@ -197,11 +189,43 @@ function rejectUnknownFlags(argv, argsDef) {
197
189
  }
198
190
  return null;
199
191
  }
192
+ async function resolveLazy(value) {
193
+ if (value === void 0) return void 0;
194
+ return typeof value === "function" ? await value() : await value;
195
+ }
200
196
  /**
201
- * The daemon gets the same instructions, but never `--foreground` (that is what
202
- * makes it the daemon) and never `--print-config` (that one is answered in the
203
- * calling process).
197
+ * The definition whose `args` govern this argv: the subcommand's, for a group (`job ls --json`),
198
+ * else the command's own. `CommandShape` rather than `CommandDef` because citty's generic args make
199
+ * two commands' definitions mutually unassignable.
204
200
  */
201
+ async function flagTarget(argv, command) {
202
+ if (command === void 0) return {
203
+ args: void 0,
204
+ argsFor: argv
205
+ };
206
+ const subCommands = await resolveLazy(command.subCommands);
207
+ if (subCommands === void 0) return {
208
+ args: await resolveLazy(command.args),
209
+ argsFor: argv
210
+ };
211
+ const dashDash = argv.indexOf("--");
212
+ const searchable = dashDash === -1 ? argv : argv.slice(0, dashDash);
213
+ const index = searchable.findIndex((token) => !token.startsWith("-"));
214
+ if (index === -1) return {
215
+ args: await resolveLazy(command.args),
216
+ argsFor: argv
217
+ };
218
+ const sub = await resolveLazy(subCommands[searchable[index]]);
219
+ if (sub === void 0) return {
220
+ args: await resolveLazy(command.args),
221
+ argsFor: argv
222
+ };
223
+ return {
224
+ args: await resolveLazy(sub.args),
225
+ argsFor: [...argv.slice(0, index), ...argv.slice(index + 1)]
226
+ };
227
+ }
228
+ /** The daemon's argv: never `--foreground` (that makes it the daemon) or `--print-config`. */
205
229
  function buildDaemonArgv(flags) {
206
230
  const args = ["up", "--foreground"];
207
231
  if (flags.port !== void 0) args.push("--port", String(flags.port));
@@ -213,22 +237,8 @@ function buildDaemonArgv(flags) {
213
237
  //#endregion
214
238
  //#region src/helpers/shell.ts
215
239
  /**
216
- * A value quoted for the shell it will be pasted into.
217
- *
218
- * One rule for every string this package prints for a person to copy: a directory, an id, a
219
- * workspace. `init` printed `cd my servers && npm run up` for the default `./my-servers`-style
220
- * directory a person picks, which the shell answers `cd: too many arguments` — a failure in the one
221
- * line the scaffold exists to hand over.
222
- *
223
- * POSIX gets single quotes, with an embedded quote closed and reopened (`'\''`), the one form that is
224
- * safe inside a single-quoted string. Windows' `cmd.exe` has no single-quote quoting at all, so it
225
- * gets double quotes: that is what it understands, and a path whose name contains a `"` is not
226
- * representable there either way.
227
- *
228
- * It cannot use the platform to *decide the shell*, only to pick the dialect: a POSIX path is
229
- * quoted for `sh` even when the process is running on Windows (the panel's CLI under Git Bash), and
230
- * a Windows path for `cmd.exe`. `process.platform` is the only signal available, so the rule is
231
- * documented rather than guessed at each call site.
240
+ * A value quoted for the shell a person will paste it into. POSIX gets single quotes (`'\''` for an
241
+ * embedded one); `cmd.exe` has no single-quote quoting, so Windows gets double quotes.
232
242
  */
233
243
  function shellQuote(value) {
234
244
  return process.platform === "win32" ? `"${value}"` : `'${value.replace(/'/g, `'\\''`)}'`;
@@ -236,12 +246,8 @@ function shellQuote(value) {
236
246
  //#endregion
237
247
  //#region src/cli/io.ts
238
248
  /**
239
- * The bits every command shares: the colours, the failure shape, and the one
240
- * place readline is set up. Imported by `src/cli.ts` and by the command modules
241
- * it loads lazily, so it may not read the state directories. Its only imports are
242
- * node builtins and `helpers/shell.ts`, which reads neither the filesystem nor
243
- * `helpers/paths.ts` — the two ways a `#src` import here would pull the state
244
- * graph in before citty is even asked anything.
249
+ * The bits every command shares: colours, the failure shape, readline. Imported before citty runs, so
250
+ * it may not read the state directories or `helpers/paths.ts`.
245
251
  */
246
252
  var isTty = () => process.stdout.isTTY === true;
247
253
  var paint = (code, text) => isTty() ? `\x1B[${code}m${text}\x1B[0m` : text;
@@ -249,7 +255,6 @@ var dim = (text) => paint("2", text);
249
255
  var bold = (text) => paint("1", text);
250
256
  var cyan = (text) => paint("36", text);
251
257
  var green = (text) => paint("32", text);
252
- /** A section title in the help output. */
253
258
  var heading = (text) => paint("1;4", text);
254
259
  /** The seam `ui-switch` takes, so the command stays testable without a terminal. */
255
260
  var style = {
@@ -258,29 +263,15 @@ var style = {
258
263
  green
259
264
  };
260
265
  /**
261
- * How this process was invoked, so a hint names a command the person can actually run.
262
- *
263
- * `npx home-hosted` leaves no `home-hosted` on `PATH`, so a hard-coded "run `home-hosted down`"
264
- * fails with `command not found`. A package-manager cache path means npx/dlx; `cli.ts` means a
265
- * source checkout. A string to print, not a parser. `HHOSTED_INVOCATION` overrides it.
266
- *
267
- * **The state directory travels with it.** A command that was told `--home` (or inherited
268
- * `HHOSTED_HOME`) prints hints about *that* home, and a hint without the flag reaches the default
269
- * one instead: measured, `pnpm run cli backup list` — the documented way to try anything in this
270
- * repo — printed "`pnpm exec tsx src/cli.ts backup create --all` takes one", and running that
271
- * verbatim created `~/.home-hosted` beside the `.dev-state/` it was asked about. The same shape hits
272
- * every project `init` scaffolds, because its scripts all pass `--home ./state`. So the flag is part
273
- * of the invocation whenever a state directory was chosen, quoted for the shell that will run it.
274
- *
275
- * `HHOSTED_INVOCATION` overrides the *program*, never the state: a wrapper that sets it still wants
276
- * its hints pointed at the home it is driving.
266
+ * How this process was invoked, so a hint names a command the person can run (`npx` leaves no
267
+ * `home-hosted` on PATH). Carries `--home` whenever one was chosen, so a pasted hint reaches the same
268
+ * state. `HHOSTED_INVOCATION` overrides the program, never the state.
277
269
  */
278
270
  function invocation() {
279
271
  const program = invocationProgram();
280
272
  const home = process.env.HHOSTED_HOME?.trim();
281
273
  return home === void 0 || home.length === 0 ? program : `${program} --home ${shellQuote(home)}`;
282
274
  }
283
- /** The program alone — what a hint would say if every home were the default one. */
284
275
  function invocationProgram() {
285
276
  const override = process.env.HHOSTED_INVOCATION?.trim();
286
277
  if (override !== void 0 && override.length > 0) return override;
@@ -290,33 +281,10 @@ function invocationProgram() {
290
281
  return "home-hosted";
291
282
  }
292
283
  /**
293
- * A reader that hangs up is a finished conversation, not a crash.
294
- *
295
- * Node's stdout is a socket. When the reader closes it, the next write raises `EPIPE` as an **error
296
- * event**, and an unhandled one kills the process with an engine stack trace and exit 1: measured on
297
- * the built CLI, `dist/cli.js status | head -1` printed `Error: write EPIPE … at runStatus` and exited
298
- * 1, so `set -o pipefail` turned a working panel into a failed deploy step. `logs --lines all | head`
299
- * and `logs --follow | head` did the same.
300
- *
301
- * GNU tools die of SIGPIPE (141), which `pipefail` reports as a failure too; Node's own CLI and
302
- * Python's exit 0. This follows the latter, because the command *succeeded* and only the reader
303
- * stopped listening — nothing was refused, and no work was lost.
304
- *
305
- * **The code for "the reader is gone" is not the same on every platform.** `EPIPE` is what Linux
306
- * reports; libuv elsewhere can surface the same condition as `ERR_STREAM_DESTROYED`, and a write to an
307
- * already-destroyed stream arrives with no `code` at all and the message `closed`. Matching only
308
- * `EPIPE` left the macOS gate failing with exit 1 and an **empty stderr** — nothing was printed and
309
- * nothing was explained, because the error was a stream state, not a failed write. So the test is
310
- * "does this error say the reader went away"; a full disk or an EIO still ends the process.
311
- *
312
- * `ENOTCONN` is the one the macOS runner actually produced: a stdout **socket** whose peer has closed
313
- * reports "socket is not connected", not a broken pipe (measured in the cross-platform workflow —
314
- * `write ENOTCONN` at the write site, with the reader long gone). It means the same thing here and
315
- * nowhere else in this codebase: nothing in the CLI opens a socket of its own, so a write reaching
316
- * this handler with `ENOTCONN` is always the stdout pipe's reader having hung up.
317
- *
318
- * Installed once at the entry so every command shares it. A per-command copy is the shape that leaves
319
- * the next command broken, and every release adds more write sites.
284
+ * A reader that hangs up (`status | head -1`) is a finished conversation: exit 0 rather than an
285
+ * EPIPE stack trace. The code differs per platform (`EPIPE`, `ENOTCONN` on macOS,
286
+ * `ERR_STREAM_DESTROYED`), so the test is whether the error says the reader went away. Other write
287
+ * failures still end the process.
320
288
  */
321
289
  var READER_GONE = /^(?:EPIPE|ENOTCONN|ERR_STREAM_DESTROYED|ERR_STREAM_WRITE_AFTER_END|ECONNRESET)$/;
322
290
  function isClosedReaderError(error) {
@@ -331,28 +299,27 @@ function treatClosedReaderAsDone() {
331
299
  throw error;
332
300
  });
333
301
  }
334
- /** One shape for every failure: a red `error <message>` on stderr and exit 1. */
335
302
  function fail(message) {
336
303
  process.stderr.write(`${paint("31", "error")} ${message}\n`);
337
304
  process.exit(1);
338
305
  }
339
306
  /**
340
- * The same red `error <message>` line on stderr, for a refusal that still has something to do
341
- * afterwards — `logs --json` has already written its document, and `down` has a persistent sweep to
342
- * report. `fail()` cannot serve those because it exits.
343
- *
344
- * **Every refusal goes to stderr**, whether or not the command has more to say: a `--json` caller
345
- * parses stdout, so a refusal written there makes stdout not-a-document — a script sees prose where
346
- * it expected JSON. `logs` printed its unreadable-file refusal on stdout while the exit code said 1,
347
- * and `down` printed "could not stop pid N" there too. Both go through here now.
307
+ * The same red `error <message>` on stderr, for a refusal that still has work to do after it. Every
308
+ * refusal goes to stderr: a `--json` caller parses stdout.
348
309
  */
349
310
  function refusal(message) {
350
311
  process.stderr.write(`${paint("31", "error")} ${message}\n`);
351
312
  }
313
+ /**
314
+ * A `--json` answer: one pretty-printed document on stdout. Every command prints through this, so a
315
+ * script sees one shape everywhere.
316
+ */
317
+ function printJson(document) {
318
+ process.stdout.write(`${JSON.stringify(document, null, 2)}\n`);
319
+ }
352
320
  function delay(ms) {
353
321
  return new Promise((resolve) => setTimeout(resolve, ms));
354
322
  }
355
- /** A plain y/N question, for decisions that are not secrets. */
356
323
  function prompt(question) {
357
324
  return new Promise((resolve) => {
358
325
  const rl = readline.createInterface({
@@ -387,32 +354,44 @@ function promptHidden(question) {
387
354
  });
388
355
  });
389
356
  }
390
- /** Asks a yes/no question with a default, so an empty answer is a real answer. */
391
357
  async function confirm(question, fallback) {
392
358
  const answer = (await prompt(`${question} ${fallback ? "[Y/n]" : "[y/N]"} `)).trim().toLowerCase();
393
359
  if (answer.length === 0) return fallback;
394
360
  return answer === "y" || answer === "yes";
395
361
  }
396
- /** The first-run password while it is still the one in use, read from this machine's secrets file. */
397
- async function firstRunPassword() {
398
- const { SecretsStore } = await import("./chunks/secrets-BieELnZh.js").then((n) => n.a);
399
- const { globalSecretsPath } = await import("./chunks/paths-CGlGDrOU.js").then((n) => n.d);
362
+ async function firstRunPasswordState(file) {
363
+ const { SecretsStore } = await import("./chunks/secrets-CG5N4lwY.js").then((n) => n.o);
364
+ const path = file ?? (await import("./chunks/paths-C34-TJLh.js").then((n) => n.d)).globalSecretsPath;
400
365
  try {
401
- return new SecretsStore(globalSecretsPath, void 0, "global").initialPassword;
366
+ const store = new SecretsStore(path, void 0, "global");
367
+ const account = store.listAccounts().find((entry) => entry.isDefault)?.id;
368
+ if (account === void 0) return null;
369
+ const password = store.initialPassword;
370
+ return password === null ? {
371
+ kind: "unrecorded",
372
+ account
373
+ } : {
374
+ kind: "recorded",
375
+ account,
376
+ password
377
+ };
402
378
  } catch {
403
379
  return null;
404
380
  }
405
381
  }
382
+ function unrecordedFirstRunHint() {
383
+ return `the first-run secret is in use but no longer recorded — run \`${invocation()} account reset\``;
384
+ }
406
385
  //#endregion
407
386
  //#region src/helpers/runtime.ts
387
+ var runtime_exports = /* @__PURE__ */ __exportAll({
388
+ NANNY_COMMAND: () => NANNY_COMMAND,
389
+ nannyArgv: () => nannyArgv,
390
+ runtimeArgs: () => runtimeArgs
391
+ });
408
392
  /**
409
- * How to run this CLI again in the same runtime. Under tsx that means passing the
410
- * resolved loader too, because a spawned child's working directory is the project's,
411
- * not the package's. Shared by `up` (which re-spawns itself detached) and by the
412
- * panel (which spawns a persistent entry's nanny).
413
- *
414
- * Nothing here reads a state directory, which is why the CLI can import it before
415
- * `--home`/`--project` have been applied.
393
+ * How to run this CLI again in the same runtime (under tsx, with the resolved loader). Reads no
394
+ * state directory, so the CLI can import it before `--home`/`--project` are applied.
416
395
  */
417
396
  function runtimeArgs() {
418
397
  let resolved = null;
@@ -423,12 +402,7 @@ function runtimeArgs() {
423
402
  return arg;
424
403
  });
425
404
  }
426
- /**
427
- * The hidden command a persistent entry runs under. It is spawned by the panel and
428
- * never typed by a person, so it stays out of the curated CLI surface (help, the
429
- * unknown-command message, flag refusal) — but the argv has to be one definition,
430
- * because process identity reads it back: see `providers/identity.ts`.
431
- */
405
+ /** The hidden command a persistent entry runs under; one definition, because `providers/identity.ts` reads the argv back. */
432
406
  var NANNY_COMMAND = "__nanny";
433
407
  function nannyArgv(entry, id, specPath, statePath) {
434
408
  return [
@@ -452,13 +426,9 @@ var version_exports = /* @__PURE__ */ __exportAll({
452
426
  });
453
427
  var cachedRoot = null;
454
428
  /**
455
- * The package's own directory and release, found by walking up to the manifest named `home-hosted`.
456
- *
457
- * The caller may be `src/**` under tsx, `dist/cli.js`, or a code-split chunk under `dist/chunks/`,
458
- * so no fixed relative path is right for all of them; a nested manifest is not trusted.
459
- *
460
- * `src/cli.ts` reaches this through a **relative** import, not `#src/*`: the bootstrap may only pull
461
- * in modules that load node builtins statically.
429
+ * The package's own directory and release, found by walking up to the manifest named `home-hosted`
430
+ * (callers may be `src/**`, `dist/cli.js` or a chunk). `src/cli.ts` imports this relatively: the
431
+ * bootstrap may only load modules with static node builtins.
462
432
  */
463
433
  function findPackage() {
464
434
  if (cachedRoot !== null) return cachedRoot;
@@ -485,7 +455,6 @@ function findPackage() {
485
455
  };
486
456
  return cachedRoot;
487
457
  }
488
- /** The running release, read from the package manifest. */
489
458
  function appVersion() {
490
459
  return findPackage().version;
491
460
  }
@@ -493,11 +462,7 @@ function appVersion() {
493
462
  function packageRoot() {
494
463
  return findPackage().dir;
495
464
  }
496
- /**
497
- * The one line to add when this CLI and the panel it is talking to are not the same
498
- * release — which is what a linked checkout, a global install and a project pin
499
- * produce. `null` when they agree.
500
- */
465
+ /** The line to add when this CLI and the panel are different releases; `null` when they agree. */
501
466
  function versionMismatchNote(panelVersion) {
502
467
  const cli = appVersion();
503
468
  return cli === panelVersion ? null : `note: this CLI is ${cli}, the panel is ${panelVersion}`;
@@ -505,28 +470,13 @@ function versionMismatchNote(panelVersion) {
505
470
  //#endregion
506
471
  //#region src/cli.ts
507
472
  /**
508
- * The command line, and nothing else. Two things happen before citty is asked
509
- * anything: `--home`/`--project` are peeled off and applied (because
510
- * `#src/helpers/paths.ts` resolves at import time), and the curated surface —
511
- * `help`, `version`, `unknown command`, and the `-p 4000` shorthand for `up` —
512
- * is decided. The command modules are then resolved lazily by citty, so their
513
- * own `#src` imports are safe: by the time one is imported, the directories are
514
- * already in the environment.
515
- *
516
- * The only static imports here are node builtins, citty, and the path-free local
517
- * modules the pre-pass needs (`helpers/runtime.ts` only names the hidden nanny
518
- * command); every command (and so every state-reading module) is a dynamic import
519
- * behind `subCommands`.
473
+ * The command line. Before citty sees anything, `--home`/`--project` are applied (because
474
+ * `#src/helpers/paths.ts` resolves at import time) and the curated surface is decided. Only node
475
+ * builtins, citty and path-free modules are imported statically; every command is a lazy import.
520
476
  */
521
477
  var CLI_ENTRY = fileURLToPath(import.meta.url);
522
- /**
523
- * The curated prose, kept here because citty cannot generate it. One named
524
- * piece per command, so the full reference and a single command's help are
525
- * composed from the same lines and can never drift apart. Every section lays
526
- * its left column out at the same width, so the two views read alike.
527
- */
478
+ /** The curated prose: one piece per command, so the full reference and `<command> --help` share lines. */
528
479
  var HEADER = "home-hosted — a control panel for the processes on your home server";
529
- /** The one line the full reference lists for a command. */
530
480
  var SYNOPSIS = {
531
481
  "up": "home-hosted up [options]",
532
482
  "down": "home-hosted down [--with-persistent]",
@@ -538,14 +488,21 @@ var SYNOPSIS = {
538
488
  "start": "home-hosted start <id> [--workspace <id>] [--free-port]",
539
489
  "stop": "home-hosted stop <id> [--workspace <id>]",
540
490
  "free-port": "home-hosted free-port <id> [--workspace <id>]",
541
- "set-password": "home-hosted set-password [--clear]",
542
- "set-token": "home-hosted set-token [--generate|--clear]",
491
+ "account": "home-hosted account create|ls|edit|secret|revoke|reset|disable-auth|enable-auth [<id>] [options]",
543
492
  "setup-temp": "home-hosted setup-temp [--wsl] [--download|--no-download] [--clear]",
544
493
  "migrate": "home-hosted migrate [--dry-run] [--yes]",
545
494
  "init": "home-hosted init [options]",
546
495
  "ui-switch": "home-hosted ui-switch [options]",
547
496
  "ui-update": "home-hosted ui-update [options]",
548
- "ui-revert": "home-hosted ui-revert"
497
+ "ui-revert": "home-hosted ui-revert",
498
+ "service": "home-hosted service [install|uninstall|status] [--user|--system|--startup] [--print]",
499
+ "add": "home-hosted add <id> [--port <n>] [--cwd <dir>] [--workspace <id>] [--persistent] [--autostart] [--secret-env <names>] -- <command> [args…]",
500
+ "ls": "home-hosted ls [--workspace <id>] [--json]",
501
+ "secret": "home-hosted secret set|unset|ls <id> [NAME] [--stdin] [--workspace <id>] [--json]",
502
+ "import": "home-hosted import pm2|compose <file> [--confirm] [--dry-run] [--allow-js] [--env <name>] [--id <id>] [--workspace <id>] [--json]",
503
+ "token": "home-hosted token create|ls|revoke [--name <name>] [--scope <scopes>] [--workspace <ids>] [--json]",
504
+ "deploy": "home-hosted deploy <id> [--workspace <id>] [--json]",
505
+ "job": "home-hosted job ls|run|stop|enable|disable|runs|log [<id>] [--detach] [--run <runId>] [--follow] [--workspace <id>] [--json]"
549
506
  };
550
507
  var SUMMARIES = {
551
508
  "up": "start it in the background (detached)",
@@ -558,16 +515,22 @@ var SUMMARIES = {
558
515
  "start": "start one server, leaving the panel up",
559
516
  "stop": "stop one server, leaving the panel up",
560
517
  "free-port": "free the port a server needs, so it can start",
561
- "set-password": "set the panel password without the API",
562
- "set-token": "set the API token that scripts and agents use",
563
518
  "setup-temp": "teach the panel how to read this machine's CPU temperature",
564
519
  "migrate": "bring the config up to this release's schema",
565
520
  "init": "scaffold a project that keeps its state in the repo",
566
521
  "ui-switch": "install a UI from a release asset, a zip file or a URL",
567
522
  "ui-update": "bring the installed UI up to date, or pick a release",
568
- "ui-revert": "go back to the stock control panel UI"
523
+ "ui-revert": "go back to the stock control panel UI",
524
+ "service": "start the panel at boot with systemd, launchd or Task Scheduler",
525
+ "add": "declare a server, through the panel or straight into servers.config.json",
526
+ "ls": "list the servers a workspace declares, live when the panel is up",
527
+ "secret": "a server's secret environment — the names are listed, the values never printed",
528
+ "import": "bring a pm2 ecosystem or a compose stack in as server entries",
529
+ "token": "named, scoped API tokens — create, list or revoke",
530
+ "deploy": "run an entry's deploy steps and report the outcome",
531
+ "job": "a workspace's jobs: `ls` what is scheduled, `run` or `stop` one now, read its `runs` and `log`",
532
+ "account": "the panel's accounts: create, list, edit, set a secret, revoke, recover"
569
533
  };
570
- /** Every section lays its left column out at this width, so the two views align. */
571
534
  var OPTION_WIDTH = 21;
572
535
  var UP_SECTION = {
573
536
  heading: "Options for up",
@@ -577,7 +540,7 @@ var UP_SECTION = {
577
540
  ["--open", "open the panel in a browser once it is up"],
578
541
  ["--no-autostart", "do not start the entries marked autostart"],
579
542
  ["--foreground", "run in this process instead of detaching (systemd/docker)"],
580
- ["--print-config", "print the effective config and exit — starts nothing, sets no password"]
543
+ ["--print-config", "print the effective config and exit — starts nothing, sets no secret"]
581
544
  ]
582
545
  };
583
546
  var STATUS_SECTION = {
@@ -606,8 +569,9 @@ var BACKUP_SECTION = {
606
569
  ["--from <path>", "restore from an archive file anywhere on this machine, instead of a name"],
607
570
  ["--include <ids>", "comma-separated item ids to act on (required for create/restore)"],
608
571
  ["--all", "act on everything; one of --include or --all is required"],
609
- ["--exclude <ids>", "leave these out; --all --exclude global:secrets keeps the password and token out of the archive"],
610
- ["--password <text>", "encrypt a new archive, or unlock one on restore"],
572
+ ["--exclude <ids>", "leave these out; --all --exclude global:secrets keeps the accounts and API tokens out of the archive"],
573
+ ["--encrypt", "create: encrypt it with a password asked for without echo"],
574
+ ["--password <text>", "deprecated — shows in shell history; use HHOSTED_BACKUP_PASSWORD or --encrypt"],
611
575
  ["--confirm", "apply without asking (create and restore plan first)"],
612
576
  ["--json", "print the plan or the result as JSON"]
613
577
  ]
@@ -637,13 +601,22 @@ var RESTART_SECTION = {
637
601
  PERSISTENT_LINE
638
602
  ]
639
603
  };
640
- var SET_PASSWORD_SECTION = {
641
- heading: "Options for set-password",
642
- lines: [["--clear", "remove the password: nobody can sign in until a new one is set"]]
643
- };
644
- var SET_TOKEN_SECTION = {
645
- heading: "Options for set-token",
646
- lines: [["--generate", "create a strong token and print it once"], ["--clear", "remove the token, so it stops working"]]
604
+ var ACCOUNT_SECTION = {
605
+ heading: "Commands for account",
606
+ lines: [
607
+ ["create <id>", "a new account; the secret is generated and shown once (HHOSTED_SECRET sets your own)"],
608
+ ["--scope <scopes>", `comma-separated, any of ${API_TOKEN_SCOPES.join(", ")} (default: all)`],
609
+ ["-w, --workspace <ids>", "limit it to those workspaces (default: every workspace)"],
610
+ ["ls", "the ids, labels, scopes and whether each is enabled — never a secret"],
611
+ ["--label <text>", "create/edit: a human label (default: the id)"],
612
+ ["edit <id>", "change --scope, -w ('' clears the limit), --label, or --enable/--disable"],
613
+ ["secret <id>", "set that account's secret (prompts, or HHOSTED_SECRET for a script)"],
614
+ ["revoke <id>", "delete it; its sessions end immediately"],
615
+ ["reset [id]", "the recovery path: a fresh secret (or HHOSTED_SECRET) for an admin account, enabled"],
616
+ ["disable-auth", "switch the guard off; the accounts are kept"],
617
+ ["enable-auth", "switch it back on"],
618
+ ["--json", "create, ls, edit, revoke, reset: print one document on stdout"]
619
+ ]
647
620
  };
648
621
  var SETUP_TEMP_SECTION = {
649
622
  heading: "Options for setup-temp",
@@ -675,6 +648,7 @@ var UI_SWITCH_SECTION = {
675
648
  ["--tag <tag>", "release tag (default: this release's tag, or latest for another repo)"],
676
649
  ["--asset <name>", "asset to install (exact or unambiguous match)"],
677
650
  ["--file <path|url>", "install a zip from a local path or an http(s) URL"],
651
+ ["--insecure", "allow a plain http:// URL for --file"],
678
652
  ["--list", "list the usable assets and install nothing"],
679
653
  ["--token <token>", "GitHub token (or GITHUB_TOKEN / GH_TOKEN)"],
680
654
  ["-y, --yes", "take the only asset instead of asking"]
@@ -692,6 +666,90 @@ var UI_UPDATE_SECTION = {
692
666
  ["-y, --yes", "take the only release instead of asking"]
693
667
  ]
694
668
  };
669
+ var SERVICE_SECTION = {
670
+ heading: "Options for service",
671
+ lines: [
672
+ ["install | uninstall | status", "what to do (default: status)"],
673
+ ["--user", "a service for this account (default); on Linux, see loginctl enable-linger"],
674
+ ["--system", "a machine-wide service started at boot (needs sudo / an administrator)"],
675
+ ["--startup", "Windows: a Startup-folder entry at logon — needs no administrator, no restart policy"],
676
+ ["--print", "with install: print the unit to stdout and install nothing"]
677
+ ]
678
+ };
679
+ var ADD_SECTION = {
680
+ heading: "Arguments for add",
681
+ lines: [
682
+ ["<id>", "the new server id: lowercase letters, digits, - and _"],
683
+ ["-- <command> [args…]", "the command it runs, after a bare --"],
684
+ ["--port <n>", "the port it listens on"],
685
+ ["--cwd <dir>", "its working directory (relative: to --project)"],
686
+ ["-w, --workspace <id>", "the workspace to add it to (default: the default workspace)"],
687
+ ["--persistent", "keep it running when the panel stops"],
688
+ ["--autostart", "start it whenever the panel starts (an add does not start it)"],
689
+ ["--secret-env <names>", "declare secret variable names (repeatable or comma-separated); then `secret set`"]
690
+ ]
691
+ };
692
+ var LS_SECTION = {
693
+ heading: "Options for ls",
694
+ lines: [["-w, --workspace <id>", "the workspace to list (default: the default workspace)"], ["--json", "print machine-readable JSON"]]
695
+ };
696
+ var SECRET_SECTION = {
697
+ heading: "Commands for secret",
698
+ lines: [
699
+ ["set <id> NAME", "store a value: prompts without echo, or read one line from --stdin"],
700
+ ["unset <id> NAME", "forget the value (the name stays declared in the entry)"],
701
+ ["ls <id>", "the declared names, and which of them have a value"],
702
+ ["<id>", "a server or a job — both declare `secretEnv`"]
703
+ ]
704
+ };
705
+ var IMPORT_SECTION = {
706
+ heading: "Options for import",
707
+ lines: [
708
+ ["pm2 <file>", "a pm2 ecosystem (.json, or .js with --allow-js): each app becomes one entry"],
709
+ ["compose <file>", "one entry for the stack, running `docker compose -f <file> up`"],
710
+ ["--confirm", "write the plan; without it nothing is written and a non-interactive run exits 1"],
711
+ ["--dry-run", "print the plan and write nothing, even with --confirm"],
712
+ ["--allow-js", "evaluate a .js ecosystem file — it is code, and it runs in this process"],
713
+ ["--env <name>", "pm2 only: read that env block (pm2 injects `env_<name>`; this reads the one you name)"],
714
+ ["-w, --workspace <id>", "the workspace to write into (default: the default workspace)"],
715
+ ["--id <id>", "compose only: the server id (default: the file's directory name)"],
716
+ ["--json", "print the plan and the outcome as one document"]
717
+ ]
718
+ };
719
+ var TOKEN_SECTION = {
720
+ heading: "Commands for token",
721
+ lines: [
722
+ ["create --name <name> --scope <scopes>", `a new token; scopes are comma-separated (${API_TOKEN_SCOPES.join(", ")}) and cumulative`],
723
+ ["create … -w, --workspace <ids>", "limit it to those workspaces (default: every workspace)"],
724
+ ["ls", "the ids, names, scopes and when each was last used — never a value"],
725
+ ["revoke <id>", "stop a token working, immediately"],
726
+ ["--json", "print one document on stdout"]
727
+ ]
728
+ };
729
+ var DEPLOY_SECTION = {
730
+ heading: "Options for deploy",
731
+ lines: [
732
+ ["<id>", "the server whose `deploy` steps to run"],
733
+ ["-w, --workspace <id>", "the workspace that owns it (default: the default workspace)"],
734
+ ["--json", "print one document on stdout"]
735
+ ]
736
+ };
737
+ var JOB_SECTION = {
738
+ heading: "Options for job",
739
+ lines: [
740
+ ["ls", "what is scheduled: expression, next run, how the last run ended"],
741
+ ["run <id>", "run it now and wait for the outcome (anything but success exits 1)"],
742
+ ["--detach", "with run: start it and return at once"],
743
+ ["stop <id>", "end the run in flight"],
744
+ ["enable|disable <id>", "switch its schedule on or off"],
745
+ ["runs <id>", "its recent runs, newest first"],
746
+ ["log <id>", "what its runs wrote, newest last"],
747
+ ["--run <runId>", "with log: only that run's lines"],
748
+ ["-f, --follow", "with log: keep printing new lines"],
749
+ ["-w, --workspace <id>", "the workspace that owns it (default: the panel's default workspace)"],
750
+ ["--json", "print one document on stdout"]
751
+ ]
752
+ };
695
753
  var EVERYWHERE_SECTION = {
696
754
  heading: "Everywhere",
697
755
  lines: [
@@ -710,22 +768,17 @@ var ENVIRONMENT_SECTION = {
710
768
  lines: [
711
769
  ["HHOSTED_HOME", "where config, secrets, logs, TLS and backups live"],
712
770
  ["HHOSTED_PROJECT", "base for relative entry paths"],
713
- ["HHOSTED_PASSWORD", "the password for a non-interactive set-password"],
714
- ["HHOSTED_TOKEN", "the token for a non-interactive set-token"],
771
+ ["HHOSTED_SECRET", "the secret for a non-interactive account create/secret/reset"],
772
+ ["HHOSTED_BACKUP_PASSWORD", "the archive password for backup create/restore, without a prompt"],
715
773
  ["HHOSTED_MIGRATE", "`allow` lets migrate apply without asking, for an unattended run"],
716
774
  ["HHOSTED_DDNS_SECRET", "the key DDNS credentials are sealed with"],
717
775
  ["GITHUB_TOKEN", "a GitHub token for ui-switch and ui-update (GH_TOKEN also works)"]
718
776
  ]
719
777
  };
720
- /**
721
- * The command name a typo most likely meant, or null when nothing is close. The candidates are
722
- * `SYNOPSIS`, the same source the reference renders, so a suggestion cannot name a command the CLI
723
- * does not have.
724
- */
778
+ /** The command a typo most likely meant, from `SYNOPSIS`, or null. */
725
779
  function suggestCommand(input) {
726
780
  return nearestWord(input, Object.keys(SYNOPSIS));
727
781
  }
728
- /** The command list of the full reference, aligned as it always was. */
729
782
  function renderCommandList() {
730
783
  const width = Math.max(...Object.values(SYNOPSIS).map((synopsis) => synopsis.length));
731
784
  return Object.keys(SYNOPSIS).map((name) => {
@@ -737,7 +790,6 @@ function renderSection(section) {
737
790
  const lines = section.lines.map(([left, right]) => ` ${cyan(left)}${" ".repeat(Math.max(0, OPTION_WIDTH - left.length))} ${right}`).join("\n");
738
791
  return `${heading(section.heading)}\n${lines}`;
739
792
  }
740
- /** The trailer every command shares: the global flags, the alias and the environment. */
741
793
  var SHARED_TRAILER = [
742
794
  renderSection(EVERYWHERE_SECTION),
743
795
  "",
@@ -746,7 +798,6 @@ var SHARED_TRAILER = [
746
798
  renderSection(ENVIRONMENT_SECTION),
747
799
  ""
748
800
  ].join("\n");
749
- /** Each command's own options; a command missing here takes none. */
750
801
  var SECTIONS = {
751
802
  "up": UP_SECTION,
752
803
  "down": DOWN_SECTION,
@@ -758,19 +809,22 @@ var SECTIONS = {
758
809
  "start": START_SECTION,
759
810
  "stop": SERVER_SECTION,
760
811
  "free-port": SERVER_SECTION,
761
- "set-password": SET_PASSWORD_SECTION,
762
- "set-token": SET_TOKEN_SECTION,
812
+ "account": ACCOUNT_SECTION,
763
813
  "setup-temp": SETUP_TEMP_SECTION,
764
814
  "migrate": MIGRATE_SECTION,
765
815
  "init": INIT_SECTION,
766
816
  "ui-switch": UI_SWITCH_SECTION,
767
- "ui-update": UI_UPDATE_SECTION
817
+ "ui-update": UI_UPDATE_SECTION,
818
+ "service": SERVICE_SECTION,
819
+ "add": ADD_SECTION,
820
+ "ls": LS_SECTION,
821
+ "secret": SECRET_SECTION,
822
+ "import": IMPORT_SECTION,
823
+ "token": TOKEN_SECTION,
824
+ "deploy": DEPLOY_SECTION,
825
+ "job": JOB_SECTION
768
826
  };
769
- /**
770
- * The full reference: every command, then every command's options in the same order, then the
771
- * trailer. Built from `SECTIONS`, the same map `<command> --help` reads, so a command cannot be
772
- * listed without its options (logs, usage, backup, setup-temp and ui-update once were).
773
- */
827
+ /** The full reference, built from `SECTIONS` so a command cannot be listed without its options. */
774
828
  var USAGE = [
775
829
  dim(HEADER),
776
830
  "",
@@ -780,11 +834,6 @@ var USAGE = [
780
834
  ...[...new Set(Object.keys(SYNOPSIS).map((name) => SECTIONS[name]).filter((section) => section !== void 0))].flatMap((section) => [renderSection(section), ""]),
781
835
  SHARED_TRAILER
782
836
  ].join("\n");
783
- /**
784
- * `home-hosted <command> --help`: the usage line, that command's own options,
785
- * and the shared trailer. A command with no options says so instead of printing
786
- * an empty heading.
787
- */
788
837
  function commandHelp(command) {
789
838
  const synopsis = SYNOPSIS[command];
790
839
  if (synopsis === void 0) return USAGE;
@@ -797,35 +846,40 @@ function commandHelp(command) {
797
846
  "",
798
847
  options,
799
848
  "",
800
- SHARED_TRAILER
849
+ dim("`home-hosted --help` lists every command, the options every command takes, and the environment"),
850
+ ""
801
851
  ].join("\n");
802
852
  }
803
853
  function version() {
804
854
  process.stdout.write(`${appVersion()}\n`);
805
855
  }
806
- /**
807
- * citty owns dispatch and argument parsing. Each entry is a lazy import, so a
808
- * command's `#src` modules are only evaluated once `applyDirFlags()` has run.
809
- */
856
+ /** Lazy imports, so a command's `#src` modules load only after `applyDirFlags()`. */
810
857
  var COMMANDS = {
811
- "up": () => import("./chunks/up-Pdz-l6IH.js").then((module) => module.upCommand(CLI_ENTRY)),
812
- "down": () => import("./chunks/down-pKbGCW9d.js").then((module) => module.downCommand),
813
- "restart": () => import("./chunks/restart-Des4DrAN.js").then((module) => module.restartCommand(CLI_ENTRY)),
814
- "status": () => import("./chunks/status-DT1EsA-B.js").then((module) => module.statusCommand),
815
- "logs": () => import("./chunks/logs---TI_bxM.js").then((module) => module.logsCommand),
816
- "usage": () => import("./chunks/usage-DFrCVXpT.js").then((module) => module.usageCommand),
817
- "start": () => import("./chunks/server-Bge2r2qQ.js").then((module) => module.startCommand),
818
- "stop": () => import("./chunks/server-Bge2r2qQ.js").then((module) => module.stopCommand),
819
- "free-port": () => import("./chunks/server-Bge2r2qQ.js").then((module) => module.freePortCommand),
820
- "set-password": () => import("./chunks/set-password-D5vZqqSX.js").then((module) => module.setPasswordCommand),
821
- "set-token": () => import("./chunks/set-token-obPiEJYk.js").then((module) => module.setTokenCommand),
822
- "setup-temp": () => import("./chunks/setup-temp-CAN4_bA-.js").then((module) => module.setupTempCommand),
823
- "migrate": () => import("./chunks/migrate-Cfoq-Vgh.js").then((module) => module.migrateCommand),
824
- "init": () => import("./chunks/init-BZ7hK9Vf.js").then((module) => module.initCommand),
825
- "ui-switch": () => import("./chunks/ui-switch-BnZTdMDd.js").then((module) => module.uiSwitchCommand),
826
- "ui-update": () => import("./chunks/ui-update-_xryLYxw.js").then((module) => module.uiUpdateCommand),
827
- "ui-revert": () => import("./chunks/ui-revert-EkBBwRTt.js").then((module) => module.uiRevertCommand),
828
- "backup": () => import("./chunks/backup-CZcVca2a.js").then((module) => module.backupCommand)
858
+ "up": () => import("./chunks/up-BQSnYxYd.js").then((module) => module.upCommand(CLI_ENTRY)),
859
+ "down": () => import("./chunks/down-CpIN7LEQ.js").then((module) => module.downCommand),
860
+ "restart": () => import("./chunks/restart-C0J8dZ2L.js").then((module) => module.restartCommand(CLI_ENTRY)),
861
+ "status": () => import("./chunks/status-efbbfYZQ.js").then((module) => module.statusCommand),
862
+ "logs": () => import("./chunks/logs-DxKI6OW2.js").then((module) => module.logsCommand),
863
+ "usage": () => import("./chunks/usage-KG8TeOio.js").then((module) => module.usageCommand),
864
+ "start": () => import("./chunks/server-Dm_dXfTW.js").then((module) => module.startCommand),
865
+ "stop": () => import("./chunks/server-Dm_dXfTW.js").then((module) => module.stopCommand),
866
+ "free-port": () => import("./chunks/server-Dm_dXfTW.js").then((module) => module.freePortCommand),
867
+ "account": () => import("./chunks/account-DiLrSyww.js").then((module) => module.accountCommand),
868
+ "setup-temp": () => import("./chunks/setup-temp-TAtDmMMU.js").then((module) => module.setupTempCommand),
869
+ "migrate": () => import("./chunks/migrate-D4w_dXDm.js").then((module) => module.migrateCommand),
870
+ "init": () => import("./chunks/init-Bv3oH65x.js").then((module) => module.initCommand),
871
+ "ui-switch": () => import("./chunks/ui-switch-CfQMbZ0g.js").then((module) => module.uiSwitchCommand),
872
+ "ui-update": () => import("./chunks/ui-update-B3PPivUm.js").then((module) => module.uiUpdateCommand),
873
+ "ui-revert": () => import("./chunks/ui-revert-Dgawq7ze.js").then((module) => module.uiRevertCommand),
874
+ "backup": () => import("./chunks/backup-DnyxIzw0.js").then((module) => module.backupCommand),
875
+ "service": () => import("./chunks/service-C8l-ewNA.js").then((module) => module.serviceCommand(CLI_ENTRY)),
876
+ "add": () => import("./chunks/add-DEIYVkNK.js").then((module) => module.addCommand),
877
+ "ls": () => import("./chunks/ls-BseUHy_m.js").then((module) => module.lsCommand),
878
+ "secret": () => import("./chunks/secret-MY397r90.js").then((module) => module.secretCommand),
879
+ "import": () => import("./chunks/import-Bd4VZH0f.js").then((module) => module.importCommand),
880
+ "token": () => import("./chunks/token-DDeWfZA4.js").then((module) => module.tokenCommand),
881
+ "deploy": () => import("./chunks/run-deploy-DoNDvwT4.js").then((module) => module.deployCommand),
882
+ "job": () => import("./chunks/job-CYOdN6Ub.js").then((module) => module.jobCommand)
829
883
  };
830
884
  var rootCommand = defineCommand({
831
885
  meta: {
@@ -836,13 +890,22 @@ var rootCommand = defineCommand({
836
890
  subCommands: COMMANDS
837
891
  });
838
892
  var commandNames = Object.keys(COMMANDS);
893
+ /** `engines` is advisory (`npx` ignores it), so the floor is checked first, with no `#src` import. */
894
+ function assertNodeFloor() {
895
+ const required = 24;
896
+ const found = Number(process.versions.node.split(".")[0]);
897
+ if (Number.isFinite(found) && found >= required) return;
898
+ process.stderr.write(`This CLI needs Node ${required} or newer, and this is Node ${process.versions.node}.\n install a newer one (https://nodejs.org), then run the command again.\n`);
899
+ process.exit(1);
900
+ }
839
901
  async function main() {
902
+ assertNodeFloor();
840
903
  treatClosedReaderAsDone();
841
904
  const dirFlags = extractDirFlags(process.argv.slice(2));
842
905
  if (dirFlags.error !== void 0) fail(dirFlags.error);
843
906
  applyDirFlags(dirFlags);
844
907
  if (dirFlags.rest[0] === "__nanny") {
845
- const { nannyCommand } = await import("./chunks/nanny-ChMtq1Zl.js");
908
+ const { nannyCommand } = await import("./chunks/nanny-BjF2-1pv.js");
846
909
  try {
847
910
  await runCommand(nannyCommand, { rawArgs: dirFlags.rest });
848
911
  } catch (error) {
@@ -862,19 +925,24 @@ async function main() {
862
925
  if (invocation.kind === "unknown") {
863
926
  const suggestion = suggestCommand(invocation.command);
864
927
  process.stderr.write(`unknown command: ${invocation.command}\n`);
865
- if (suggestion !== null) process.stderr.write(`${dim(`did you mean \`${suggestion}\`?`)}\n`);
866
- process.stderr.write(`\n${USAGE}`);
928
+ if (suggestion !== null) process.stderr.write(`did you mean \`${suggestion}\`?\n`);
929
+ process.stderr.write(`${dim("`home-hosted --help` lists commands")}\n`);
867
930
  process.exit(1);
868
931
  }
869
- const { ensureLayout } = await import("./chunks/layout-DwTtmund.js");
932
+ const { ensureLayout } = await import("./chunks/layout-D0ysDNav.js");
870
933
  ensureLayout();
871
934
  const sub = COMMANDS[invocation.argv[0]];
872
935
  const command = typeof sub === "function" ? await sub() : sub;
873
- const problem = rejectUnknownFlags(invocation.argv.slice(1), command?.args);
936
+ const target = await flagTarget(invocation.argv.slice(1), command);
937
+ const problem = rejectUnknownFlags(target.argsFor, target.args);
874
938
  if (problem !== null) fail(problem);
875
939
  try {
876
940
  await runCommand(rootCommand, { rawArgs: invocation.argv });
877
941
  } catch (error) {
942
+ if (error?.code === "E_UNKNOWN_COMMAND") {
943
+ const word = errorMessage(error).replace(/\u001B\[[0-9;]*m/g, "").replace(/^Unknown command /, "");
944
+ fail(`unknown ${invocation.argv[0]} command: ${word} — \`home-hosted ${invocation.argv[0]} --help\` lists them`);
945
+ }
878
946
  fail(errorMessage(error));
879
947
  }
880
948
  }
@@ -882,6 +950,6 @@ main().catch((error) => {
882
950
  fail(errorMessage(error));
883
951
  });
884
952
  //#endregion
885
- export { errorMessage as C, buildDaemonArgv as S, prompt as _, NANNY_COMMAND as a, style as b, bold as c, commandHelp, dim as d, fail as f, paint as g, invocation as h, version_exports as i, confirm as l, green as m, packageRoot as n, nannyArgv as o, firstRunPassword as p, versionMismatchNote as r, runtimeArgs as s, suggestCommand, appVersion as t, delay as u, promptHidden as v, shellQuote as x, refusal as y };
953
+ export { unrecordedFirstRunHint as C, API_TOKEN_SCOPES as D, errorMessage as E, PANEL_WIDE_SCOPES as O, style as S, buildDaemonArgv as T, paint as _, NANNY_COMMAND as a, promptHidden as b, runtime_exports as c, commandHelp, delay as d, dim as f, invocation as g, green as h, version_exports as i, bold as l, firstRunPasswordState as m, packageRoot as n, nannyArgv as o, fail as p, versionMismatchNote as r, runtimeArgs as s, suggestCommand, appVersion as t, confirm as u, printJson as v, shellQuote as w, refusal as x, prompt as y };
886
954
 
887
955
  //# sourceMappingURL=cli.js.map