@rocket.chat/houston 0.27.0-next.3 → 2.1.8

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 (293) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -15
  3. package/bin/houston +62 -0
  4. package/data/docs/ARCHITECTURE.md +387 -0
  5. package/data/docs/automation.md +107 -0
  6. package/data/docs/e2ee.md +76 -0
  7. package/data/docs/eks.md +258 -0
  8. package/data/docs/gui.md +282 -0
  9. package/data/docs/guide.md +669 -0
  10. package/data/docs/kubernetes.md +138 -0
  11. package/data/docs/troubleshooting.md +193 -0
  12. package/data/docs/upgrading.md +84 -0
  13. package/data/docs/voice.md +253 -0
  14. package/data/iam/engineer-policy.json +11 -0
  15. package/data/iam/engineer-rbac.yaml +42 -0
  16. package/data/iam/operator-policy.json +211 -0
  17. package/data/loadtest/badbot.js +22 -0
  18. package/data/loadtest/common.js +168 -0
  19. package/data/loadtest/custom.js +20 -0
  20. package/data/loadtest/journey.js +58 -0
  21. package/data/loadtest/login.js +18 -0
  22. package/data/loadtest/messages.js +13 -0
  23. package/data/loadtest/mixed.js +39 -0
  24. package/data/loadtest/read.js +12 -0
  25. package/data/loadtest/webhook.js +20 -0
  26. package/data/monitoring/houston-logs.json +98 -0
  27. package/data/monitoring/k6-loadtest.json +610 -0
  28. package/data/monitoring/mongodb-exporter.json +3007 -0
  29. package/data/monitoring/node-exporter-full.json +16114 -0
  30. package/data/monitoring/rocketchat-metrics.json +6471 -0
  31. package/data/presets/airgapped.yaml +16 -0
  32. package/data/presets/default.yaml +9 -0
  33. package/data/seed/avatar-0.png +0 -0
  34. package/data/seed/avatar-1.png +0 -0
  35. package/data/seed/avatar-2.png +0 -0
  36. package/data/seed/avatar-3.png +0 -0
  37. package/data/seed/avatar-4.png +0 -0
  38. package/data/seed/avatar-5.png +0 -0
  39. package/data/seed/avatar-6.png +0 -0
  40. package/data/seed/avatar-7.png +0 -0
  41. package/data/seed/seed-metrics.csv +3 -0
  42. package/data/seed/seed-preview.png +0 -0
  43. package/data/seed/seed-report.pdf +32 -0
  44. package/data/seed/seed-runbook.txt +3 -0
  45. package/data/skill/SKILL.md +399 -0
  46. package/data/versions.yaml +55 -0
  47. package/data/voice/freeswitch/drachtio.xml +52 -0
  48. package/data/voice/freeswitch/public.xml +87 -0
  49. package/data/webui/app.css +2003 -0
  50. package/data/webui/index.html +678 -0
  51. package/data/webui/js/api.js +561 -0
  52. package/data/webui/js/boot.js +44 -0
  53. package/data/webui/js/clusters-tail.js +1377 -0
  54. package/data/webui/js/clusters.js +896 -0
  55. package/data/webui/js/create.js +276 -0
  56. package/data/webui/js/detail.js +507 -0
  57. package/data/webui/js/jobs.js +636 -0
  58. package/data/webui/js/logs.js +634 -0
  59. package/data/webui/js/main.js +14 -0
  60. package/data/webui/js/options.js +408 -0
  61. package/data/webui/js/people.js +438 -0
  62. package/data/webui/js/perf.js +303 -0
  63. package/data/webui/js/render.js +438 -0
  64. package/data/webui/js/shared.js +3 -0
  65. package/data/webui/js/state.js +583 -0
  66. package/data/webui/js/theme.js +123 -0
  67. package/data/webui/js/util.js +584 -0
  68. package/dist/cli/app.js +593 -0
  69. package/dist/cli/capabilities.js +76 -0
  70. package/dist/cli/cell-widths.js +495 -0
  71. package/dist/cli/entry.js +10 -0
  72. package/dist/cli/error-panel.js +492 -0
  73. package/dist/cli/handlers/actor.js +84 -0
  74. package/dist/cli/handlers/https.js +614 -0
  75. package/dist/cli/handlers/prompt.js +299 -0
  76. package/dist/cli/handlers/users.js +226 -0
  77. package/dist/cli/handlers.js +3678 -0
  78. package/dist/cli/help.js +183 -0
  79. package/dist/cli/index.js +15 -0
  80. package/dist/cli/perf.js +810 -0
  81. package/dist/cli/render.js +254 -0
  82. package/dist/cli/serve.js +858 -0
  83. package/dist/cli/spec-data.js +2593 -0
  84. package/dist/cli/spec-types.js +8 -0
  85. package/dist/cli/usage-error.js +520 -0
  86. package/dist/cli/wire.js +70 -0
  87. package/dist/core/audit.js +346 -0
  88. package/dist/core/backup-compat.js +85 -0
  89. package/dist/core/backup.js +1639 -0
  90. package/dist/core/cluster.js +1398 -0
  91. package/dist/core/configimport.js +344 -0
  92. package/dist/core/data.js +267 -0
  93. package/dist/core/database-of.js +82 -0
  94. package/dist/core/diagnose.js +159 -0
  95. package/dist/core/doctor.js +1518 -0
  96. package/dist/core/edge/acme.js +338 -0
  97. package/dist/core/edge/engine.js +500 -0
  98. package/dist/core/edge/networks.js +174 -0
  99. package/dist/core/edge/paths.js +107 -0
  100. package/dist/core/edge/routes.js +251 -0
  101. package/dist/core/edge/routeyml.js +195 -0
  102. package/dist/core/edge/runtime.js +493 -0
  103. package/dist/core/edge/spec.js +305 -0
  104. package/dist/core/edge/types.js +202 -0
  105. package/dist/core/eks-docs.js +135 -0
  106. package/dist/core/eks.js +2240 -0
  107. package/dist/core/envvars.js +562 -0
  108. package/dist/core/eventlog.js +541 -0
  109. package/dist/core/firstrun.js +153 -0
  110. package/dist/core/journal.js +691 -0
  111. package/dist/core/kube/ask.js +231 -0
  112. package/dist/core/kube/capabilities.js +269 -0
  113. package/dist/core/kube/certmanager.js +452 -0
  114. package/dist/core/kube/chart.js +413 -0
  115. package/dist/core/kube/cluster.js +196 -0
  116. package/dist/core/kube/context.js +545 -0
  117. package/dist/core/kube/endpoints.js +448 -0
  118. package/dist/core/kube/exec.js +195 -0
  119. package/dist/core/kube/forward.js +732 -0
  120. package/dist/core/kube/grafana-ingress.js +110 -0
  121. package/dist/core/kube/ingress.js +218 -0
  122. package/dist/core/kube/manifests.js +361 -0
  123. package/dist/core/kube/monitoring.js +768 -0
  124. package/dist/core/kube/names.js +237 -0
  125. package/dist/core/kube/namespace.js +678 -0
  126. package/dist/core/kube/operator.js +941 -0
  127. package/dist/core/kube/probe.js +202 -0
  128. package/dist/core/kube/reachability.js +163 -0
  129. package/dist/core/kube/release.js +439 -0
  130. package/dist/core/kube/replicaset.js +180 -0
  131. package/dist/core/kube/scale.js +398 -0
  132. package/dist/core/kube/status.js +633 -0
  133. package/dist/core/kube/tools.js +238 -0
  134. package/dist/core/kube/transfer.js +173 -0
  135. package/dist/core/kube/workspace.js +423 -0
  136. package/dist/core/lifecycle/admin.js +64 -0
  137. package/dist/core/lifecycle/create-docker.js +1533 -0
  138. package/dist/core/lifecycle/create-k8s.js +939 -0
  139. package/dist/core/lifecycle/destroy.js +339 -0
  140. package/dist/core/lifecycle/inspect.js +635 -0
  141. package/dist/core/lifecycle/naming.js +298 -0
  142. package/dist/core/lifecycle/notes.js +726 -0
  143. package/dist/core/lifecycle/ownership.js +313 -0
  144. package/dist/core/lifecycle/payload.js +401 -0
  145. package/dist/core/lifecycle/ports.js +388 -0
  146. package/dist/core/lifecycle/preconditions.js +367 -0
  147. package/dist/core/lifecycle/pruning.js +551 -0
  148. package/dist/core/lifecycle/ready.js +753 -0
  149. package/dist/core/lifecycle/request.js +525 -0
  150. package/dist/core/lifecycle/seeding.js +281 -0
  151. package/dist/core/lifecycle/sizing.js +392 -0
  152. package/dist/core/lifecycle/state.js +286 -0
  153. package/dist/core/lifecycle/tlsplan.js +704 -0
  154. package/dist/core/lifecycle/types.js +232 -0
  155. package/dist/core/loadtest.js +995 -0
  156. package/dist/core/migrate.js +612 -0
  157. package/dist/core/monitor.js +494 -0
  158. package/dist/core/postready.js +969 -0
  159. package/dist/core/promote.js +804 -0
  160. package/dist/core/rcapi.js +1285 -0
  161. package/dist/core/recovery.js +75 -0
  162. package/dist/core/runner/engine.js +394 -0
  163. package/dist/core/runner/host.js +298 -0
  164. package/dist/core/runner/locks.js +129 -0
  165. package/dist/core/runner/paths.js +173 -0
  166. package/dist/core/runner/ports.js +172 -0
  167. package/dist/core/runner/queries.js +612 -0
  168. package/dist/core/runner/record.js +563 -0
  169. package/dist/core/scaleseed.js +271 -0
  170. package/dist/core/seed-db.js +208 -0
  171. package/dist/core/sessions.js +472 -0
  172. package/dist/core/skill.js +326 -0
  173. package/dist/core/sso-identities.js +172 -0
  174. package/dist/core/sso.js +703 -0
  175. package/dist/core/tls-local.js +311 -0
  176. package/dist/core/tls.js +878 -0
  177. package/dist/core/topology.js +482 -0
  178. package/dist/core/upgrade.js +868 -0
  179. package/dist/core/users.js +739 -0
  180. package/dist/lib/audit.js +100 -0
  181. package/dist/lib/close-matches.js +238 -0
  182. package/dist/lib/compose.js +672 -0
  183. package/dist/lib/config.js +1398 -0
  184. package/dist/lib/context.js +18 -0
  185. package/dist/lib/errors.js +305 -0
  186. package/dist/lib/events.js +208 -0
  187. package/dist/lib/float-text.js +126 -0
  188. package/dist/lib/format.js +1320 -0
  189. package/dist/lib/home.js +325 -0
  190. package/dist/lib/journal.js +122 -0
  191. package/dist/lib/json-text.js +733 -0
  192. package/dist/lib/jsonout.js +382 -0
  193. package/dist/lib/lock.js +516 -0
  194. package/dist/lib/login-name.js +202 -0
  195. package/dist/lib/map-limit.js +29 -0
  196. package/dist/lib/mkdir-parents.js +90 -0
  197. package/dist/lib/mongo-kernel.js +67 -0
  198. package/dist/lib/monitoring.js +492 -0
  199. package/dist/lib/platform-name.js +59 -0
  200. package/dist/lib/presets/common.js +390 -0
  201. package/dist/lib/presets/composite.js +326 -0
  202. package/dist/lib/presets/e2ee.js +143 -0
  203. package/dist/lib/presets/email.js +172 -0
  204. package/dist/lib/presets/guides.js +27 -0
  205. package/dist/lib/presets/index.js +490 -0
  206. package/dist/lib/presets/keycloak.js +369 -0
  207. package/dist/lib/presets/ldap.js +1285 -0
  208. package/dist/lib/presets/livechat.js +220 -0
  209. package/dist/lib/presets/multi-instance.js +124 -0
  210. package/dist/lib/presets/oidc.js +161 -0
  211. package/dist/lib/presets/public.js +496 -0
  212. package/dist/lib/presets/registry.js +64 -0
  213. package/dist/lib/presets/s3-minio.js +300 -0
  214. package/dist/lib/presets/saml.js +149 -0
  215. package/dist/lib/presets/scenario.js +51 -0
  216. package/dist/lib/presets/types.js +86 -0
  217. package/dist/lib/presets/voice-pbx.js +320 -0
  218. package/dist/lib/presets/voice.js +345 -0
  219. package/dist/lib/presets/webhooks.js +182 -0
  220. package/dist/lib/redact.js +106 -0
  221. package/dist/lib/seed-options.js +68 -0
  222. package/dist/lib/seed-profiles.js +59 -0
  223. package/dist/lib/targz.js +1383 -0
  224. package/dist/lib/teammode.js +25 -0
  225. package/dist/lib/tempdir.js +162 -0
  226. package/dist/lib/unicode-tables.js +2335 -0
  227. package/dist/lib/version-spec.js +357 -0
  228. package/dist/lib/versions.js +463 -0
  229. package/dist/lib/yaml-dump.js +1361 -0
  230. package/dist/perf/baseline.js +168 -0
  231. package/dist/perf/constrain.js +296 -0
  232. package/dist/perf/k6.js +235 -0
  233. package/dist/perf/mongoprof.js +171 -0
  234. package/dist/perf/rcmetrics.js +178 -0
  235. package/dist/perf/report.js +386 -0
  236. package/dist/perf/resources.js +224 -0
  237. package/dist/perf/slo.js +111 -0
  238. package/dist/perf/timeline.js +187 -0
  239. package/dist/perf/timings.js +85 -0
  240. package/dist/perf/verdict.js +201 -0
  241. package/dist/seams/aws-cli.js +126 -0
  242. package/dist/seams/docker-cli.js +280 -0
  243. package/dist/seams/exec.js +861 -0
  244. package/dist/seams/fs/lock.js +528 -0
  245. package/dist/seams/kubectl.js +83 -0
  246. package/dist/seams/rc-http.js +921 -0
  247. package/dist/seed/apply.js +190 -0
  248. package/dist/seed/assets.js +76 -0
  249. package/dist/seed/check.js +391 -0
  250. package/dist/seed/client.js +172 -0
  251. package/dist/seed/executor.js +726 -0
  252. package/dist/seed/history.js +281 -0
  253. package/dist/seed/kinds.js +91 -0
  254. package/dist/seed/plan.js +432 -0
  255. package/dist/seed/receipt.js +339 -0
  256. package/dist/seed/repairs.js +75 -0
  257. package/dist/seed/verification.js +363 -0
  258. package/dist/seed/wording.js +248 -0
  259. package/dist/web/app.js +326 -0
  260. package/dist/web/jobs.js +510 -0
  261. package/dist/web/route-deps.js +211 -0
  262. package/dist/web/route-table.js +213 -0
  263. package/dist/web/routes/backup.js +244 -0
  264. package/dist/web/routes/clusters.js +303 -0
  265. package/dist/web/routes/data.js +187 -0
  266. package/dist/web/routes/edge.js +82 -0
  267. package/dist/web/routes/index.js +63 -0
  268. package/dist/web/routes/jobs.js +95 -0
  269. package/dist/web/routes/logs.js +297 -0
  270. package/dist/web/routes/meta.js +191 -0
  271. package/dist/web/routes/people.js +151 -0
  272. package/dist/web/routes/perf.js +95 -0
  273. package/dist/web/routes/repros.js +550 -0
  274. package/dist/web/routes/session.js +361 -0
  275. package/dist/web/routes/spa.js +198 -0
  276. package/dist/web/security.js +475 -0
  277. package/dist/web/signin.js +246 -0
  278. package/package.json +67 -32
  279. package/.eslintrc +0 -94
  280. package/.swcrc +0 -18
  281. package/dist/bin.js +0 -3
  282. package/dist/cli.js +0 -184
  283. package/dist/commands/createBranch.js +0 -194
  284. package/dist/outputCI.js +0 -59
  285. package/src/bin.js +0 -4
  286. package/src/cli.ts +0 -25
  287. package/src/commands/createBranch.ts +0 -28
  288. package/src/outputCI.ts +0 -12
  289. package/src-old/logs.js +0 -323
  290. package/src-old/md.js +0 -191
  291. package/src-old/release-table.js +0 -60
  292. package/src-old/set-version.js +0 -614
  293. package/src-old/utils.js +0 -15
@@ -0,0 +1,593 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Aborted = void 0;
4
+ exports.commandOutcome = commandOutcome;
5
+ exports.buildCli = buildCli;
6
+ exports.usagePanelWritten = usagePanelWritten;
7
+ exports.runCli = runCli;
8
+ exports.reportBeforeCommand = reportBeforeCommand;
9
+ const commander_1 = require("commander");
10
+ const errors_1 = require("../lib/errors");
11
+ const format_1 = require("../lib/format");
12
+ const jsonout_1 = require("../lib/jsonout");
13
+ const usage_error_1 = require("./usage-error");
14
+ const help_1 = require("./help");
15
+ const spec_data_1 = require("./spec-data");
16
+ const wire_1 = require("./wire");
17
+ const PACKAGE_VERSION = require('../../package.json').version;
18
+ const exitCodes = new WeakMap();
19
+ /**
20
+ * `exitCode` from -255 to 255. A NEGATIVE one is a child's death by a signal handed on as
21
+ * the child's return code: the `end` record says -15 and the process exits 241, which is
22
+ * what Node's `process.exitCode = -15` does and what earlier releases exit with too
23
+ * (Kubernetes `logs`).
24
+ */
25
+ function commandOutcome(data, exitCode, failure) {
26
+ if (!Number.isInteger(exitCode) || exitCode < -255 || exitCode > 255) {
27
+ throw new Error(`invalid process exit code: ${String(exitCode)}`);
28
+ }
29
+ return failure === undefined
30
+ ? { data, exitCode, commandOutcome: true }
31
+ : { data, exitCode, commandOutcome: true, failure };
32
+ }
33
+ function isCommandOutcome(value) {
34
+ return (typeof value === 'object' &&
35
+ value !== null &&
36
+ value.commandOutcome === true);
37
+ }
38
+ /**
39
+ * The operator answered "no" to a destructive prompt.
40
+ *
41
+ * NOT A `ReproError`. A declined confirmation prints `Aborted.` on stderr and exits 1 -- no
42
+ * `error:` prefix, because nothing went wrong.
43
+ * An earlier version raised `ValidationError('cancelled')`, so every declined prompt exited 2
44
+ * with `error: cancelled`, and a script told "invalid input" about a question it declined.
45
+ * It is never reached in JSON mode: there is nobody to prompt, and the refusal to proceed
46
+ * without `--yes` comes first.
47
+ */
48
+ class Aborted extends Error {
49
+ constructor() {
50
+ super('Aborted.');
51
+ this.name = 'Aborted';
52
+ }
53
+ }
54
+ exports.Aborted = Aborted;
55
+ const processIo = {
56
+ writeOut: (text) => process.stdout.write(text),
57
+ writeErr: (text) => process.stderr.write(text),
58
+ };
59
+ /**
60
+ * An integer option's value: whitespace, a sign, underscores between digits and any decimal
61
+ * digit of Unicode 15.0 are all accepted, and `0x10` and `1e3` are not (`intArgument` in
62
+ * `./usage-error` says how). An earlier version took `/^-?\\d+$/`, so `--tail 1_0` and
63
+ * `--port ' 80'` were usage errors here, where earlier releases ran them.
64
+ *
65
+ * AN INTEGER JAVASCRIPT CANNOT HOLD EXACTLY IS STILL REFUSED, and that is a known
66
+ * deviation: `--tail 9007199254740993` runs in the previous implementation. It is kept
67
+ * because no numeric option means anything at that size -- a port, a replica count,
68
+ * seconds, lines -- and rounding the value to the nearest double would hand the command a
69
+ * number nobody typed. Only the value the command is given is refused (`keptNumber`):
70
+ * `--tail 9007199254740993 --tail 5` runs, as it always has.
71
+ */
72
+ function parseInteger(raw) {
73
+ let value;
74
+ try {
75
+ value = (0, usage_error_1.intArgument)(raw);
76
+ }
77
+ catch {
78
+ throw new commander_1.InvalidArgumentError(`not a valid integer: ${raw}`);
79
+ }
80
+ if (!Number.isSafeInteger(value)) {
81
+ throw new commander_1.InvalidArgumentError(`integer is out of range: ${raw}`);
82
+ }
83
+ return value;
84
+ }
85
+ /**
86
+ * A float option's value, as `floatArgument` reads it -- where `Number()` also accepts
87
+ * `0x10` and `''` and turns `1_0` into NaN. Infinity and NaN parse, as they always have; the
88
+ * command's own validation decides what to do with them.
89
+ */
90
+ function parseFloatValue(raw) {
91
+ try {
92
+ return (0, usage_error_1.floatArgument)(raw);
93
+ }
94
+ catch {
95
+ throw new commander_1.InvalidArgumentError(`not a valid number: ${raw}`);
96
+ }
97
+ }
98
+ function collect(value, previous) {
99
+ return [...previous, value];
100
+ }
101
+ function commanderName(long) {
102
+ const positive = long.includes('/--no-') ? long.split('/')[0] : long;
103
+ return positive
104
+ .slice(2)
105
+ .replace(/-([a-z0-9])/gu, (_match, letter) => letter.toUpperCase());
106
+ }
107
+ function optionFlags(option, long = option.long) {
108
+ const value = option.value === 'boolean'
109
+ ? ''
110
+ : ` <${option.value === 'integer' ? 'integer' : option.value === 'float' ? 'number' : 'string'}>`;
111
+ return `${option.short === undefined ? '' : `${option.short}, `}${long}${value}`;
112
+ }
113
+ /**
114
+ * The number an int or float option was given, converted ONCE, from the occurrence that is
115
+ * kept. Each occurrence is STORED over the one before and only what is left is type-cast,
116
+ * so an occurrence a later one overrides is never read as a number at all.
117
+ *
118
+ * Commander calls an `argParser` on EVERY occurrence, and while `parseInteger` and
119
+ * `parseFloatValue` were one, an occurrence that is thrown away still refused the whole
120
+ * argv here, in commander's words. Measured against the previous implementation (fresh
121
+ * HOUSTON_HOME, no network): `audit -n 𑛐 --lines 2` and `audit -n abc --lines 2` run there,
122
+ * exit 0, and were exit 2 here; `logs --name nope --tail abc --tail 5`, the same with 4301
123
+ * zeros or 9007199254740993 first, and `stats --name nope --for abc --for 1` are `no repro
124
+ * named 'nope'`, exit 4, there and were exit 2 here. So numeric options have no
125
+ * `argParser`, commander keeps the last text as it keeps any option's, and this converts
126
+ * that.
127
+ *
128
+ * `judgeArgv` has already put the kept text through the same conversion, so the one
129
+ * refusal left is `parseInteger`'s beyond 2**53, the known deviation -- reported as
130
+ * commander reported it from an `argParser`, and so, as before, as a usage error by `runCli`.
131
+ */
132
+ function keptNumber(command, option, raw) {
133
+ try {
134
+ return option.value === 'integer' ? parseInteger(raw) : parseFloatValue(raw);
135
+ }
136
+ catch (error) {
137
+ if (!(error instanceof commander_1.InvalidArgumentError))
138
+ throw error;
139
+ return command.error(`error: option '${optionFlags(option)}' argument '${raw}' is invalid. ${error.message}`, { exitCode: error.exitCode, code: error.code });
140
+ }
141
+ }
142
+ /**
143
+ * An ordinary `--no-X` is a flag of its own: `--no-domain` and `--domain` are two
144
+ * parameters of `serve`, `--no-rollback` and `--rollback` two of `upgrade`, and neither
145
+ * clears the other whatever the order.
146
+ *
147
+ * Commander reads any `--no-` spelling as the NEGATION of `--X` and stores it on X's
148
+ * attribute, as false. So `serve --no-domain` served, and rewrote the edge for, the name
149
+ * 'false'; `serve --domain ''` was read as --no-domain, because the flag was taken from X's
150
+ * value source; and `upgrade --rollback --no-rollback` ran the upgrade where it should roll
151
+ * back, because the last one won. Only a `negatablePair` (`--diag/--no-diag`) is one
152
+ * parameter with two spellings, and keeps commander's negation, last one winning. Every
153
+ * other `--no-X` is registered as a plain boolean under its own
154
+ * attribute (`noDomain`), and read from there.
155
+ */
156
+ function makeOption(spec, long = spec.long) {
157
+ const option = new commander_1.Option(optionFlags(spec, long), spec.description);
158
+ if (!spec.negatablePair)
159
+ option.negate = false;
160
+ if (spec.hidden)
161
+ option.hideHelp();
162
+ if (spec.required)
163
+ option.makeOptionMandatory();
164
+ // No `argParser` for an int or float: commander would call it on every occurrence, and
165
+ // only the one kept is converted (`keptNumber`).
166
+ if (spec.repeatable)
167
+ option.argParser(collect).default([]);
168
+ if (!spec.repeatable && spec.defaultValue !== null && spec.defaultValue !== undefined) {
169
+ option.default(spec.defaultValue);
170
+ }
171
+ return option;
172
+ }
173
+ function addOptions(command, spec) {
174
+ const merged = spec.options.map((value) => ({ kind: 'option', value }));
175
+ if (spec.json.mode === 'flag') {
176
+ merged.splice(spec.json.option?.index ?? merged.length, 0, { kind: 'json' });
177
+ }
178
+ for (const entry of merged) {
179
+ if (entry.kind === 'json') {
180
+ command.addOption(new commander_1.Option('--json', spec.json.option?.description ?? 'machine-readable JSON'));
181
+ continue;
182
+ }
183
+ if (entry.value.negatablePair) {
184
+ const [positive, negative] = entry.value.long.split('/');
185
+ command.addOption(makeOption(entry.value, positive));
186
+ const { short: _short, ...withoutShort } = entry.value;
187
+ command.addOption(makeOption(withoutShort, negative));
188
+ }
189
+ else {
190
+ command.addOption(makeOption(entry.value));
191
+ }
192
+ }
193
+ }
194
+ function normalizeOptions(command, spec) {
195
+ const raw = command.opts();
196
+ const out = {};
197
+ for (const option of spec.options) {
198
+ const name = commanderName(option.long);
199
+ let value = raw[name];
200
+ if ((option.value === 'integer' || option.value === 'float') &&
201
+ typeof value === 'string' &&
202
+ command.getOptionValueSource(name) === 'cli') {
203
+ value = keptNumber(command, option, value);
204
+ }
205
+ if (option.repeatable && value === undefined)
206
+ value = [];
207
+ if (value === undefined)
208
+ value = option.defaultValue ?? null;
209
+ if (typeof value !== 'string' &&
210
+ typeof value !== 'number' &&
211
+ typeof value !== 'boolean' &&
212
+ value !== null &&
213
+ !(Array.isArray(value) && value.every((item) => typeof item === 'string'))) {
214
+ throw new errors_1.ValidationError(`invalid value for ${option.long}`);
215
+ }
216
+ out[option.key] = value;
217
+ }
218
+ if (spec.json.mode === 'flag')
219
+ out.json_out = raw.json === true;
220
+ return out;
221
+ }
222
+ function normalizeArguments(spec, values) {
223
+ const out = {};
224
+ for (let index = 0; index < spec.arguments.length; index += 1) {
225
+ const argument = spec.arguments[index];
226
+ const value = values[index] ?? argument.defaultValue ?? null;
227
+ if (typeof value !== 'string' && typeof value !== 'number' && value !== null) {
228
+ throw new errors_1.ValidationError(`invalid value for ${argument.name}`);
229
+ }
230
+ out[argument.name] = value;
231
+ }
232
+ return out;
233
+ }
234
+ /**
235
+ * Refuse an action the command does not have, in the established wording, as a usage error.
236
+ *
237
+ * One place for the positional-action commands that refuse an unknown action FIRST, so it
238
+ * has to say what each of those commands has always said: `edge` lists `delete <host>` rather
239
+ * than a bare `delete`, and `cluster` has a sentence of its own. Every one is a
240
+ * `ValidationError` (exit 2, VALIDATION_FAILED): `edge frob` exited 1 where `cluster frob`
241
+ * exited 2, one mistake with two codes.
242
+ *
243
+ * Not `users`: its handler refuses an unknown action itself, before it asks for the name, in
244
+ * the same words.
245
+ */
246
+ function validateAction(value, path, choices) {
247
+ if (typeof value === 'string' && choices.includes(value))
248
+ return;
249
+ const shown = (0, format_1.quotedText)(String(value));
250
+ if (path === 'cluster') {
251
+ throw new errors_1.ValidationError(`unknown action ${shown}. Want: ${choices.join(' | ')}.`);
252
+ }
253
+ const want = path === 'edge'
254
+ ? 'status | start | stop | restart | logs | delete <host>'
255
+ : choices.join(' | ');
256
+ throw new errors_1.ValidationError(`unknown action ${shown} (want: ${want})`);
257
+ }
258
+ /**
259
+ * Commander results are an untrusted boundary; validate cross-field meaning here.
260
+ *
261
+ * NOTHING ABOUT `api` IS CHECKED HERE, and that is the established order rather than an
262
+ * omission. This used to refuse any method outside GET/POST/PUT/DELETE/PATCH and
263
+ * `JSON.parse` the `--data`, both before the handler ran -- so an unknown workspace exited 1
264
+ * (or 2) where `api` has always exited 4, a stopped engine 1 where it exits 3, a workspace
265
+ * still booting 1 where it exits 5; `--pat` with a bad body minted no token where `api`
266
+ * mints one (and audits it) before it ever reads the body; the refusal quoted V8's words
267
+ * rather than the established ones; and HEAD and OPTIONS, which `api` sends, were refused
268
+ * outright. `api` has NO method allowlist -- any method is sent upper-cased -- and it parses
269
+ * `--data` only after the name, the engine and the login. The handler already does both in
270
+ * that order.
271
+ *
272
+ * NOR ARE NUMBERS BOUNDED HERE. This refused a negative `--port`, `--replicas`, `--tail`,
273
+ * `--vus`, `--users`, `--slowms`, `--start`, `--max` or `--nodes`, and a `--port` over
274
+ * 65535, on every command before its handler ran. None of them has a declared min or max,
275
+ * so each command answers for itself, after its name resolution and its engine preflight:
276
+ * `up --port 70000` with Docker stopped is "Docker isn't running",
277
+ * exit 3, where this said "port must be between 0 and 65535", exit 2; with Docker running
278
+ * it is the create's own "--port 70000 is out of range (want 1024-65535)"; `up --replicas
279
+ * -1` is the topology's "--replicas must be at least 1."; and `logs --tail -3` runs
280
+ * `docker compose logs --tail -3`, exit 0.
281
+ */
282
+ function validateInvocation(invocation) {
283
+ const a = invocation.arguments;
284
+ // Not `config`: `config` checks the KEY before the action, so `config frob` has always
285
+ // been `unknown key ''` and was `unknown action 'frob'` here. Its handler refuses an
286
+ // unknown action itself, in the established order.
287
+ const actions = {
288
+ edge: ['status', 'start', 'stop', 'restart', 'logs', 'delete'],
289
+ };
290
+ const variants = invocation.spec.json.variants;
291
+ const choices = variants?.argument === 'action' ? Object.keys(variants.byValue) : actions[invocation.spec.path];
292
+ if (choices !== undefined)
293
+ validateAction(a.action, invocation.spec.path, choices);
294
+ }
295
+ function commandName(spec) {
296
+ return spec.path.split(' ').at(-1);
297
+ }
298
+ function replyKind(invocation) {
299
+ const advertised = invocation.spec.json.schema;
300
+ if (advertised === undefined)
301
+ throw new Error(`${invocation.spec.path} has no JSON schema`);
302
+ const variants = invocation.spec.json.variants;
303
+ if (variants === undefined)
304
+ return schemaKind(advertised);
305
+ const value = String(invocation.arguments[variants.argument]);
306
+ const schema = variants.byValue[value];
307
+ if (schema === undefined) {
308
+ throw new Error(`${invocation.spec.path} has no schema for ${variants.argument}=${value}`);
309
+ }
310
+ return schemaKind(schema);
311
+ }
312
+ function schemaKind(schema) {
313
+ const match = /^houston\.(.+)\.v1$/u.exec(schema);
314
+ if (match?.[1] === undefined)
315
+ throw new Error(`unsupported CLI schema ${schema}`);
316
+ return match[1];
317
+ }
318
+ function buildCli(options) {
319
+ const io = options.io ?? processIo;
320
+ const commandSpecs = new WeakMap();
321
+ const root = new commander_1.Command('houston');
322
+ commandSpecs.set(root, 'root');
323
+ root
324
+ .description('Launch throwaway, version-matched Rocket.Chat workspaces to reproduce an issue.')
325
+ .helpOption('--help', 'Show this message and exit.')
326
+ .enablePositionalOptions()
327
+ .version(`houston ${PACKAGE_VERSION}`, '--version, -V', 'print the installed houston version and exit')
328
+ .allowExcessArguments(false)
329
+ // There is no `help` command: `houston help up` is "No such command 'help'."
330
+ .helpCommand(false)
331
+ .exitOverride()
332
+ // Commander reports a parse error itself AND throws it, which printed every usage error
333
+ // twice ('error: X', then 'error: error: X'). Errors are `./usage-error`'s to report, so
334
+ // commander's own reporting is switched off and only the throw is used.
335
+ .configureOutput({ writeOut: io.writeOut, writeErr: io.writeErr, outputError: () => { } });
336
+ root.createHelp = () => new help_1.HoustonHelp(commandSpecs);
337
+ let skill = null;
338
+ for (const spec of spec_data_1.COMMAND_SPECS) {
339
+ let parent = root;
340
+ if (spec.path.startsWith('skill ')) {
341
+ if (skill === null) {
342
+ skill = root
343
+ .command('skill')
344
+ .description('Install the agent skill that teaches a caller to drive houston.');
345
+ skill.helpOption('--help', 'Show this message and exit.').allowExcessArguments(false);
346
+ commandSpecs.set(skill, 'skill');
347
+ skill.createHelp = () => new help_1.HoustonHelp(commandSpecs);
348
+ }
349
+ parent = skill;
350
+ }
351
+ const command = parent
352
+ .command(commandName(spec))
353
+ .description(spec.description.split('\n')[0]);
354
+ command.helpOption('--help', 'Show this message and exit.').allowExcessArguments(false);
355
+ commandSpecs.set(command, spec);
356
+ command.createHelp = () => new help_1.HoustonHelp(commandSpecs);
357
+ for (const argument of spec.arguments) {
358
+ const syntax = argument.required ? `<${argument.name}>` : `[${argument.name}]`;
359
+ if (argument.required)
360
+ command.argument(syntax, argument.description);
361
+ else
362
+ command.argument(syntax, argument.description, argument.defaultValue);
363
+ }
364
+ addOptions(command, spec);
365
+ command.action(async (...received) => {
366
+ const commander = received.at(-1);
367
+ if (!(commander instanceof commander_1.Command))
368
+ throw new Error('Commander did not supply its command');
369
+ const positional = received.slice(0, spec.arguments.length);
370
+ const normalizedOptions = normalizeOptions(commander, spec);
371
+ if (spec.json.mode === 'always' || normalizedOptions.json_out === true)
372
+ (0, jsonout_1.activate)();
373
+ const invocation = {
374
+ spec,
375
+ arguments: normalizeArguments(spec, positional),
376
+ options: normalizedOptions,
377
+ events: spec.json.streams && (0, jsonout_1.active)() ? new jsonout_1.EventWriter() : null,
378
+ };
379
+ validateInvocation(invocation);
380
+ const result = await options.execute(invocation);
381
+ const data = isCommandOutcome(result) ? result.data : result;
382
+ const failure = isCommandOutcome(result) ? result.failure : undefined;
383
+ if ((0, jsonout_1.active)() && failure !== undefined) {
384
+ (0, jsonout_1.emit)((0, jsonout_1.errorEnvelope)(failure, { data: (0, wire_1.preserveFloatFields)(data) }));
385
+ }
386
+ else if ((0, jsonout_1.active)()) {
387
+ (0, jsonout_1.reply)(replyKind(invocation), (0, wire_1.preserveFloatFields)(data));
388
+ }
389
+ if (isCommandOutcome(result))
390
+ exitCodes.set(root, result.exitCode);
391
+ });
392
+ }
393
+ return root;
394
+ }
395
+ function helpText(target) {
396
+ if (target === 'root')
397
+ return (0, help_1.renderRootHelp)();
398
+ if (target === 'skill')
399
+ return (0, help_1.renderSkillHelp)();
400
+ return (0, help_1.renderCommandHelp)(target);
401
+ }
402
+ /**
403
+ * The root callback: who is running this, from the accounts file.
404
+ *
405
+ * `./usage-error` calls it once a command name resolves, before that command's argv is parsed --
406
+ * so a `users` that cannot be read is the answer to `up --bogus` and `up --help`, as it has
407
+ * always been. It used to run only inside the executor, after commander had parsed and
408
+ * `validateInvocation` had checked the argv: measured with `users` a directory, earlier
409
+ * releases answered `up --bogus`, `up --help`, `skill install --help` and `users bogus` with
410
+ * `error: cannot read .../users: Is a directory` and exit 2, and this build
411
+ * with the usage panel, the help, the help, and `unknown action` exit 1.
412
+ *
413
+ * Only the READ is here. The executor publishes the answer around the command
414
+ * (`runWithContext`, which cannot outlive the call that opens it), reading it again, as
415
+ * every command reads the actor again.
416
+ */
417
+ function beforeAnyCommand() {
418
+ require('./handlers/actor').cliActorAndOrigin();
419
+ }
420
+ /** The spec commander was running when it threw, for the context of its usage error. */
421
+ function commanderTarget(argv) {
422
+ const words = argv.filter((arg) => !arg.startsWith('-'));
423
+ const [first, second] = words;
424
+ const found = spec_data_1.COMMAND_SPECS.find((spec) => spec.path === first || spec.path === `${first ?? ''} ${second ?? ''}`);
425
+ return found ?? 'root';
426
+ }
427
+ /**
428
+ * Whether this run wrote a usage panel. A broken pipe under the panel is answered with exit
429
+ * 1 and the stream is not pacified, so stderr still fails to flush at shutdown: exit 120,
430
+ * where a broken pipe anywhere else gives 1.
431
+ */
432
+ let panelUsage = false;
433
+ function usagePanelWritten() {
434
+ return panelUsage;
435
+ }
436
+ async function runCli(argv, options) {
437
+ (0, jsonout_1.jsonModeReset)();
438
+ panelUsage = false;
439
+ (0, jsonout_1.setHoustonVersion)(PACKAGE_VERSION);
440
+ const io = options.io ?? processIo;
441
+ // THE FROZEN VERDICT FIRST. Help, the version and every usage error are decided as the
442
+ // frozen CLI decides them, in its order (`./usage-error`), before commander sees argv. A usage
443
+ // error is the boxed usage-error panel on stderr and exit 2 -- and, under --json, ONE
444
+ // error envelope on stdout. There was none ("the argv fails before any command runs"),
445
+ // so a script parsing the last line of `up --json` with a mistyped `--port` read nothing,
446
+ // where automation.md promises every reply is an envelope.
447
+ try {
448
+ // Inside the try, so a defect in the verdict itself is still reported through the
449
+ // contract -- an envelope under --json, the stack trace on stderr, exit 1.
450
+ let verdict;
451
+ try {
452
+ verdict = (0, usage_error_1.judgeArgv)(argv, options.console, beforeAnyCommand);
453
+ }
454
+ catch (error) {
455
+ // The root callback refused, which is reported through `reportBeforeCommand`: JSON
456
+ // mode from argv, since no command has parsed `--json` yet, and LOGGED, since this
457
+ // home is not being refused -- its accounts file is.
458
+ if (error instanceof errors_1.ReproError)
459
+ return reportBeforeCommand(error, argv, io, { log: true });
460
+ // Anything else is unhandled, and the catch below reports it -- after JSON mode is
461
+ // taken from argv here, for the same reason: an unhandled failure at this point has
462
+ // always been reported through the same contract, so a `users` that is not UTF-8
463
+ // answers `list --json` with a REPRO_ERROR envelope, where this build, with no command
464
+ // yet to parse `--json`, wrote only the stack trace and the error line.
465
+ if (argv.includes('--json'))
466
+ (0, jsonout_1.activate)();
467
+ throw error;
468
+ }
469
+ if (verdict.kind === 'usage') {
470
+ panelUsage = true;
471
+ if (argv.includes('--json')) {
472
+ (0, jsonout_1.activate)();
473
+ const failure = new errors_1.ValidationError(verdict.message);
474
+ (0, jsonout_1.emit)((0, jsonout_1.errorEnvelope)(failure, { warnings: (0, jsonout_1.envelopeWarnings)(failure) }));
475
+ }
476
+ io.writeErr(verdict.stderr);
477
+ return 2;
478
+ }
479
+ if (verdict.kind === 'version') {
480
+ io.writeOut(`houston ${PACKAGE_VERSION}\n`);
481
+ return 0;
482
+ }
483
+ if (verdict.kind === 'help') {
484
+ io.writeOut(helpText(verdict.target));
485
+ return verdict.exit;
486
+ }
487
+ const cli = buildCli(options);
488
+ await cli.parseAsync([...verdict.argv], { from: 'user' });
489
+ return exitCodes.get(cli) ?? 0;
490
+ }
491
+ catch (error) {
492
+ // An interrupt: exit 130, and nothing more -- no `error:` line, no envelope under
493
+ // --json, no `error` record. Also for whatever a `catch` the interrupt passed through
494
+ // turned it into on its way here: a handler for errors never claims an interrupt.
495
+ const exec = require('../seams/exec');
496
+ if (error instanceof exec.Interrupted || exec.interruptRaised())
497
+ return 130;
498
+ if (error instanceof commander_1.CommanderError && error.exitCode === 0)
499
+ return 0;
500
+ if (error instanceof commander_1.CommanderError) {
501
+ // `judgeArgv` accepted this argv and commander did not: the two parsers disagree,
502
+ // which is a defect. It is still reported as a usage error, in the command's context,
503
+ // rather than in commander's words -- and recorded, so the event log shows the defect.
504
+ const message = error.message.replace(/^error: /u, '');
505
+ try {
506
+ const eventlog = require('../core/eventlog');
507
+ eventlog.failed(errors_1.ValidationError.code, `commander refused an argv the verdict accepts: ${message}`);
508
+ }
509
+ catch {
510
+ /* never let logging change the exit */
511
+ }
512
+ panelUsage = true;
513
+ io.writeErr((0, usage_error_1.renderUsage)(message, commanderTarget(argv), options.console));
514
+ return 2;
515
+ }
516
+ if (error instanceof Aborted) {
517
+ (options.io ?? processIo).writeErr('Aborted.\n');
518
+ return 1;
519
+ }
520
+ // THE CONTRACT'S LAST LINE: anything that is neither a domain error nor a parse error is
521
+ // unhandled, so its stack trace goes to stderr and it is still ONE envelope on stdout --
522
+ // worded to say where to look, since the usual cause is a damaged file under HOUSTON_HOME.
523
+ let failure = error;
524
+ // Whether a stack trace went to stderr: the log's `trace`, which marks a defect.
525
+ let traced = false;
526
+ if (!(error instanceof errors_1.ReproError)) {
527
+ const text = error.message;
528
+ const stack = error.stack;
529
+ if (typeof stack === 'string') {
530
+ (options.io ?? processIo).writeErr(`${stack}\n`);
531
+ traced = true;
532
+ }
533
+ failure = new errors_1.ReproError(`${typeof text === 'string' ? text : String(error)} ` +
534
+ '- this is unhandled, and the stack trace is on stderr. If it names a file under ' +
535
+ 'HOUSTON_HOME, that file is the problem.');
536
+ }
537
+ if ((0, jsonout_1.active)())
538
+ (0, jsonout_1.emit)((0, jsonout_1.errorEnvelope)(failure, { warnings: (0, jsonout_1.envelopeWarnings)(failure) }));
539
+ const message = failure instanceof Error ? failure.message : String(failure);
540
+ // The durable record carries the stable code beside the prose.
541
+ // Best-effort and silent -- the failure being reported matters more than logging it.
542
+ // Not for a failure the command reported directly (`doctor`): see `failDirectly`.
543
+ try {
544
+ const eventlog = require('../core/eventlog');
545
+ if ((0, jsonout_1.loggedFailure)(failure)) {
546
+ eventlog.failed(failure instanceof errors_1.ReproError ? failure.code : errors_1.ReproError.code, message, {
547
+ stackTraceOnStderr: traced,
548
+ });
549
+ }
550
+ }
551
+ catch {
552
+ /* never let logging change the exit */
553
+ }
554
+ (options.io ?? processIo).writeErr(`error: ${message}\n`);
555
+ return failure instanceof errors_1.ReproError ? failure.exitCode : 1;
556
+ }
557
+ }
558
+ /**
559
+ * A failure from OUTSIDE any command, through the same contract.
560
+ *
561
+ * The startup refusal happens before a command has parsed `--json`, so JSON mode comes from
562
+ * argv here -- a caller that asked for JSON still gets exactly one envelope, the class's
563
+ * own exit code, and no stack trace.
564
+ *
565
+ * NOT LOGGED BY DEFAULT -- a startup refusal is reported, never recorded, because the event
566
+ * log is the first write under HOUSTON_HOME, and that refusal is the refusal to write there,
567
+ * so nothing is appended to `logs/houston.log` in the home just refused, as an earlier
568
+ * version did. The root callback's failure is logged, as it always has been, and passes
569
+ * `{ log: true }`: it is recorded with its code before it is reported.
570
+ */
571
+ function reportBeforeCommand(failure, argv, io = processIo, { log = false } = {}) {
572
+ (0, jsonout_1.jsonModeReset)();
573
+ (0, jsonout_1.setHoustonVersion)(PACKAGE_VERSION);
574
+ if (log) {
575
+ // Best-effort and silent, as every other record of a failure is.
576
+ try {
577
+ require('../core/eventlog').failed(failure.code, failure.message);
578
+ }
579
+ catch {
580
+ /* never let logging change the exit */
581
+ }
582
+ }
583
+ if (argv.includes('--json'))
584
+ (0, jsonout_1.activate)();
585
+ if ((0, jsonout_1.active)())
586
+ (0, jsonout_1.emit)((0, jsonout_1.errorEnvelope)(failure, { warnings: (0, jsonout_1.envelopeWarnings)(failure) }));
587
+ // An envelope that could not be written ends the report before its error line; the
588
+ // failed write is not thrown on.
589
+ if (process.stdout.errored !== null)
590
+ return failure.exitCode;
591
+ io.writeErr(`error: ${failure.message}\n`);
592
+ return failure.exitCode;
593
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describeCommands = describeCommands;
4
+ exports.capabilities = capabilities;
5
+ const seed_options_1 = require("../lib/seed-options");
6
+ const skill_1 = require("../core/skill");
7
+ const topology_1 = require("../core/topology");
8
+ const config_1 = require("../lib/config");
9
+ const errors_1 = require("../lib/errors");
10
+ const jsonout_1 = require("../lib/jsonout");
11
+ const presets_1 = require("../lib/presets");
12
+ const format_1 = require("../lib/format");
13
+ const seed_profiles_1 = require("../lib/seed-profiles");
14
+ const spec_data_1 = require("./spec-data");
15
+ /** Read the parser's source objects, never a parallel capabilities catalogue. */
16
+ function describeCommands(specs = spec_data_1.COMMAND_SPECS) {
17
+ return specs
18
+ .map((spec) => {
19
+ const speaksJson = spec.json.mode !== 'none';
20
+ const flags = spec.options.map((option) => option.long);
21
+ if (spec.json.mode === 'flag')
22
+ flags.push('--json');
23
+ const result = {
24
+ name: spec.path,
25
+ flags: [...new Set(flags)].sort(),
26
+ json: speaksJson,
27
+ };
28
+ if (speaksJson) {
29
+ result.schema = spec.json.schema;
30
+ if (spec.json.variants !== undefined) {
31
+ result.schemas = [...Object.values(spec.json.variants.byValue)].sort();
32
+ }
33
+ result.streams = spec.json.streams;
34
+ }
35
+ return result;
36
+ })
37
+ .sort((left, right) => (0, format_1.compareCodePoints)(left.name, right.name));
38
+ }
39
+ function capabilities() {
40
+ let presets = [];
41
+ try {
42
+ presets = (0, presets_1.listPresets)()
43
+ .map((preset) => preset.name)
44
+ .sort(format_1.compareCodePoints);
45
+ }
46
+ catch {
47
+ // Capability discovery must remain offline and best-effort.
48
+ }
49
+ let skill = {};
50
+ try {
51
+ skill = (0, skill_1.state)();
52
+ }
53
+ catch {
54
+ // Optional host state must not hide the command contract.
55
+ }
56
+ return {
57
+ contract_versions: [jsonout_1.CONTRACT],
58
+ houston_version: (0, jsonout_1.getHoustonVersion)(),
59
+ commands: describeCommands(),
60
+ phases: [...jsonout_1.PHASES],
61
+ error_codes: (0, errors_1.errorCodes)(),
62
+ exit_codes: Object.fromEntries(Object.entries(errors_1.EXIT_CODES).sort(([left], [right]) => Number(left) - Number(right))),
63
+ presets,
64
+ seed_profiles: Object.keys(seed_profiles_1.PROFILES).sort(),
65
+ seed_options: (0, seed_options_1.seedCatalogue)(),
66
+ runtimes: Object.entries(topology_1.DEPLOYMENTS).map(([name, deployments]) => ({
67
+ name,
68
+ deployments: [...deployments],
69
+ default_deployment: deployments[0],
70
+ creatable: topology_1.REGISTERED.has(name),
71
+ })),
72
+ default_runtime: topology_1.DOCKER,
73
+ default_bind_host: config_1.DEFAULT_BIND_HOST,
74
+ skill,
75
+ };
76
+ }