@kvbox/cli 0.6.23 → 0.6.25

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.
package/dist/kvbox.js CHANGED
@@ -155,7 +155,7 @@ async function spin(message, work, opts = {}) {
155
155
  }
156
156
 
157
157
  // src/program.ts
158
- import { Command as Command171 } from "commander";
158
+ import { Command as Command174 } from "commander";
159
159
 
160
160
  // ../shared/src/version.ts
161
161
  import { createRequire } from "module";
@@ -170,7 +170,7 @@ function versionOf(srcFileUrl, injected) {
170
170
  }
171
171
 
172
172
  // src/version.ts
173
- var VERSION = versionOf(import.meta.url, true ? "0.6.23" : void 0);
173
+ var VERSION = versionOf(import.meta.url, true ? "0.6.25" : void 0);
174
174
 
175
175
  // src/commands/vm/index.ts
176
176
  import { Command as Command44 } from "commander";
@@ -2104,6 +2104,8 @@ var ClusterNodeSchema = z6.object({
2104
2104
  roles: z6.array(z6.string()),
2105
2105
  version: z6.string().nullable().optional(),
2106
2106
  address: z6.string().optional(),
2107
+ /** The node's boot id, new at every boot of its box (k3s image v0.1.5): a Ready under an older one is from before a restart. */
2108
+ bootId: z6.string().optional(),
2107
2109
  /** Bound persistent volumes kept on this node's own disk: what removing the node would lose. */
2108
2110
  volumes: z6.number().int(),
2109
2111
  /** Those volumes by their claim, `namespace/name` (k3s image v0.1.2 and later). */
@@ -2116,8 +2118,28 @@ var ClusterHealthSchema = z6.object({
2116
2118
  ingress: z6.boolean(),
2117
2119
  /** k3s's own version: `v1.37.2+k3s1`. */
2118
2120
  version: z6.string().optional(),
2121
+ /**
2122
+ * When the first of the master's own certificates ends (k3s image v0.1.5; #230). They last a year and
2123
+ * are renewed only when k3s starts within 120 days of that: a master that never restarts runs out.
2124
+ */
2125
+ certificatesEndAt: z6.string().optional(),
2119
2126
  nodes: z6.array(ClusterNodeSchema)
2120
2127
  });
2128
+ var CLUSTER_STATES = ["ready", "starting", "degraded", "down", "unknown"];
2129
+ var ClusterProblemSchema = z6.object({
2130
+ /** The node it is about and its pool; neither when it is the master's or the host's. */
2131
+ node: z6.string().optional(),
2132
+ pool: z6.string().optional(),
2133
+ what: z6.string(),
2134
+ /** A command to run; absent when only waiting or the operator helps. */
2135
+ fix: z6.string().optional()
2136
+ });
2137
+ var ClusterConditionSchema = z6.object({
2138
+ /** A state a later control plane adds reads as `unknown` here, so the cluster itself still parses (F8). */
2139
+ state: z6.enum(CLUSTER_STATES).catch("unknown"),
2140
+ /** What is wrong, the master's first; none when `ready`. */
2141
+ problems: z6.array(ClusterProblemSchema)
2142
+ });
2121
2143
  var ClusterPoolSchema = z6.object({
2122
2144
  name: z6.string(),
2123
2145
  size: z6.enum(NODE_SIZES),
@@ -2152,8 +2174,8 @@ var ClusterSchema = z6.object({
2152
2174
  */
2153
2175
  room: z6.object({ s: z6.number().int(), m: z6.number().int(), l: z6.number().int() }).nullable().optional(),
2154
2176
  /**
2155
- * What is changing it right now (one thing at a time); absent when nothing is. `since` is the lease's last
2156
- * stamp, renewed while the change goes on: when it was last seen alive, not when it began.
2177
+ * What is changing it right now (one thing at a time); absent when nothing is. `since` is when the
2178
+ * change began, the same for as long as it goes on: a client tells its own change from the next by it.
2157
2179
  */
2158
2180
  operation: z6.object({ what: z6.string(), since: z6.string() }).optional(),
2159
2181
  /**
@@ -2168,12 +2190,22 @@ var ClusterSchema = z6.object({
2168
2190
  addresses: z6.array(z6.string()).optional(),
2169
2191
  /** Only in `GET /k8s/<name>` (asked live): null when the master is not running or did not answer. */
2170
2192
  health: ClusterHealthSchema.nullable().optional(),
2193
+ /**
2194
+ * Only in `GET /k8s/<name>` (#228): the cluster as one thing, from its master's answer and its boxes'
2195
+ * states as their host has them, with what is wrong and what to do about it.
2196
+ */
2197
+ condition: ClusterConditionSchema.optional(),
2171
2198
  /**
2172
2199
  * When the cluster's state is backed up on its own (#221): nightly from its creation, included in its
2173
2200
  * price. Null for one whose create stopped before its schedule was written (the backup job gives it one).
2174
2201
  */
2175
2202
  backupSchedule: BackupScheduleSchema.nullable().optional()
2176
2203
  });
2204
+ function allReady(c2) {
2205
+ if (c2.health?.ready !== true) return false;
2206
+ const joined = new Set(c2.health.nodes.filter((n2) => n2.ready).map((n2) => n2.name));
2207
+ return c2.pools.every((p) => p.boxes.length >= p.nodes && p.boxes.every((name) => joined.has(name)));
2208
+ }
2177
2209
  var ClusterRestoreSchema = z6.object({
2178
2210
  backup: z6.string(),
2179
2211
  cluster: ClusterSchema,
@@ -2786,8 +2818,123 @@ var Integrations = class {
2786
2818
  }
2787
2819
  };
2788
2820
 
2789
- // ../sdk/src/volumes.ts
2821
+ // ../sdk/src/k8s.ts
2790
2822
  import { z as z13 } from "zod";
2823
+ var CLUSTER_READY_TIMEOUT_MS = 3e5;
2824
+ var CLUSTER_SETTLED_TIMEOUT_MS = 9e5;
2825
+ var cluster = (name, rest = "") => `/k8s/${encodeURIComponent(name)}${rest}`;
2826
+ var Clusters = class {
2827
+ constructor(transport) {
2828
+ this.transport = transport;
2829
+ const pool = (name, named, rest = "") => cluster(name, `/pools/${encodeURIComponent(named)}${rest}`);
2830
+ this.pools = {
2831
+ list: async (name, opts = {}) => (await this.get(name, opts)).pools,
2832
+ add: (name, req, opts = {}) => this.transport.request("POST", cluster(name, "/pools"), ClusterSchema, { body: req, org: opts.org }),
2833
+ resize: (name, named, nodes, opts = {}) => this.transport.request("PUT", pool(name, named), ClusterSchema, { body: { nodes, ...opts.force ? { force: true } : {} }, org: opts.org }),
2834
+ remove: (name, named, opts = {}) => this.transport.request("DELETE", pool(name, named, opts.force ? "?force=1" : ""), ClusterSchema, { org: opts.org })
2835
+ };
2836
+ }
2837
+ transport;
2838
+ /** A cluster's node pools. One change per cluster at a time: a second is a `ConflictError` (`cluster-busy`). */
2839
+ pools;
2840
+ /** Every cluster the caller can read, without `health`, `room` and `addresses` (those are `get`'s). */
2841
+ list(opts = {}) {
2842
+ return this.transport.request("GET", `/k8s${listQuery(opts)}`, z13.array(ClusterSchema), { org: opts.org });
2843
+ }
2844
+ /**
2845
+ * One cluster, with what only this call answers: `health` (asked of the cluster now; null when its master
2846
+ * is not running or did not answer), `condition` (`ready`, `starting`, `degraded`, `down` or `unknown`,
2847
+ * with what is wrong and the command that puts it right), `room` (how many more nodes of each size its host can take),
2848
+ * `addresses`, and `operation` / `operationError` (a change going on, and what the last one could not do).
2849
+ */
2850
+ get(name, opts = {}) {
2851
+ return this.transport.request("GET", cluster(name), ClusterSchema, { org: opts.org });
2852
+ }
2853
+ /**
2854
+ * Make a cluster: its master and a first pool `default` of `nodes` (2) nodes of `size`, all on one host
2855
+ * with room for all of it, or nothing is made. The answer comes once the boxes are made, about a
2856
+ * minute; Kubernetes itself takes a few more (`waitUntilReady`). `org` (this call's, else the client's):
2857
+ * the cluster goes to that org, else to the caller's own slug. A slug that may not spend gets a
2858
+ * `PaymentRequiredError`.
2859
+ */
2860
+ create(req, opts = {}) {
2861
+ return this.transport.request("POST", "/k8s", ClusterSchema, { body: req, org: opts.org });
2862
+ }
2863
+ /** Bring the master and every node that is not running back up (after the account ran out of credit, or its host restarted). */
2864
+ start(name, opts = {}) {
2865
+ return this.transport.request("POST", cluster(name, "/start"), ClusterSchema, { org: opts.org });
2866
+ }
2867
+ /**
2868
+ * Stop one box of the cluster and boot it again: a node that runs while the cluster gets no answer from
2869
+ * it (`condition` names it), or the master (`node` is the cluster's own name). Pods on the other nodes
2870
+ * keep running and the box joins again by itself; one that is asleep or paused is booted cold too, a stopped one started.
2871
+ */
2872
+ restartNode(name, node, opts = {}) {
2873
+ return this.transport.request("POST", cluster(name, `/nodes/${encodeURIComponent(node)}/restart`), ClusterSchema, { org: opts.org });
2874
+ }
2875
+ /**
2876
+ * New credentials for the cluster, for when somebody who had them should no longer: every kubeconfig
2877
+ * handed out so far stops working (`kubeconfig` gives the new one), and so do the tokens its boxes join
2878
+ * with. Answered once the master has stored them; the master then restarts and every node after it,
2879
+ * together, so apps on the cluster are down for a few minutes (`waitUntilSettled` resolves when that is over, or throws what could not be done; the same
2880
+ * call starts over). Every box of the cluster must be running. What was made inside the cluster (a
2881
+ * service account's token) is not ended.
2882
+ */
2883
+ rotate(name, opts = {}) {
2884
+ return this.transport.request("POST", cluster(name, "/rotate"), ClusterSchema, { org: opts.org });
2885
+ }
2886
+ /** Remove the cluster: its nodes (undrained), its master and everything in it. Its backups stay listed. */
2887
+ async remove(name, opts = {}) {
2888
+ await this.transport.request("DELETE", cluster(name), z13.undefined(), { org: opts.org });
2889
+ }
2890
+ /**
2891
+ * The cluster's admin kubeconfig, as the text of the file. Made by the cluster when asked and kept
2892
+ * nowhere: whoever holds it is cluster-admin, so treat it as a secret. Only a running cluster gives one.
2893
+ */
2894
+ async kubeconfig(name, opts = {}) {
2895
+ return (await this.transport.request("GET", cluster(name, "/kubeconfig"), KubeconfigSchema, { org: opts.org })).kubeconfig;
2896
+ }
2897
+ /**
2898
+ * Resolve with the cluster once its API answers and every node of every pool has joined and is Ready,
2899
+ * looking every `intervalMs`; a `KvboxTimeoutError` after `timeoutMs` (default `CLUSTER_READY_TIMEOUT_MS`).
2900
+ * Not found is thrown at once; nothing answering, or a 502/503/504, is waited through.
2901
+ */
2902
+ waitUntilReady(name, opts = {}) {
2903
+ return this.wait(name, opts, opts.timeoutMs ?? CLUSTER_READY_TIMEOUT_MS, "ready", allReady);
2904
+ }
2905
+ /**
2906
+ * Resolve with the cluster once no change is going on in it (`operation` gone): the end of a pool's
2907
+ * shrink or removal, and of the watch over new nodes after `pools.add` or a grow. What the change could
2908
+ * not do (a node that would not drain, a new node that never joined) is thrown as a `KvboxSdkError`
2909
+ * with the control plane's words. Default `timeoutMs`: `CLUSTER_SETTLED_TIMEOUT_MS`.
2910
+ */
2911
+ async waitUntilSettled(name, opts = {}) {
2912
+ const settled2 = await this.wait(name, opts, opts.timeoutMs ?? CLUSTER_SETTLED_TIMEOUT_MS, "settled", (c2) => c2.operation === void 0);
2913
+ if (settled2.operationError !== void 0) throw new KvboxSdkError(settled2.operationError);
2914
+ return settled2;
2915
+ }
2916
+ async wait(name, opts, timeoutMs, word, done) {
2917
+ const intervalMs = opts.intervalMs ?? 3e3;
2918
+ const deadline = Date.now() + timeoutMs;
2919
+ let last;
2920
+ for (; ; ) {
2921
+ try {
2922
+ const c2 = await this.transport.request("GET", cluster(name), ClusterSchema, { org: opts.org, timeoutMs: Math.max(1, Math.min(deadline - Date.now(), this.transport.timeoutMs)) });
2923
+ if (done(c2)) return c2;
2924
+ last = c2.operation?.what ?? (c2.health == null ? `${c2.status}, its master not answering` : c2.status);
2925
+ } catch (err) {
2926
+ if (!passing(err)) throw err;
2927
+ last = err.message;
2928
+ }
2929
+ const left = deadline - Date.now();
2930
+ if (left <= 0) throw new KvboxTimeoutError(`cluster ${name} was not ${word} within ${Math.round(timeoutMs / 1e3)}s (last: ${last})`, timeoutMs);
2931
+ await sleep(Math.min(intervalMs, left));
2932
+ }
2933
+ }
2934
+ };
2935
+
2936
+ // ../sdk/src/volumes.ts
2937
+ import { z as z14 } from "zod";
2791
2938
  var volume = (name, rest = "") => `/volumes/${encodeURIComponent(name)}${rest}`;
2792
2939
  var Volumes = class {
2793
2940
  constructor(transport) {
@@ -2795,7 +2942,7 @@ var Volumes = class {
2795
2942
  }
2796
2943
  transport;
2797
2944
  list(opts = {}) {
2798
- return this.transport.request("GET", `/volumes${listQuery(opts)}`, z13.array(VolumeSchema), { org: opts.org });
2945
+ return this.transport.request("GET", `/volumes${listQuery(opts)}`, z14.array(VolumeSchema), { org: opts.org });
2799
2946
  }
2800
2947
  /**
2801
2948
  * Make a volume of `sizeGib` GiB. Through the cloud `box` is required: the volume is made on that
@@ -2818,7 +2965,7 @@ var Volumes = class {
2818
2965
  }
2819
2966
  /** Remove the volume and its data; it must be detached first. */
2820
2967
  async remove(name, opts = {}) {
2821
- await this.transport.request("DELETE", volume(name), z13.undefined(), { org: opts.org });
2968
+ await this.transport.request("DELETE", volume(name), z14.undefined(), { org: opts.org });
2822
2969
  }
2823
2970
  };
2824
2971
 
@@ -2841,6 +2988,7 @@ var Kvbox = class {
2841
2988
  volumes;
2842
2989
  integrations;
2843
2990
  hooks;
2991
+ k8s;
2844
2992
  transport;
2845
2993
  constructor(opts = {}) {
2846
2994
  this.transport = new Transport({
@@ -2855,6 +3003,7 @@ var Kvbox = class {
2855
3003
  this.volumes = new Volumes(this.transport);
2856
3004
  this.integrations = new Integrations(this.transport);
2857
3005
  this.hooks = new Hooks(this.transport);
3006
+ this.k8s = new Clusters(this.transport);
2858
3007
  }
2859
3008
  /** The API this client talks to, without a trailing slash. */
2860
3009
  get baseUrl() {
@@ -2870,201 +3019,201 @@ var Kvbox = class {
2870
3019
  };
2871
3020
 
2872
3021
  // src/client.ts
2873
- import { z as z16 } from "zod";
3022
+ import { z as z17 } from "zod";
2874
3023
 
2875
3024
  // ../shared/src/cron.ts
2876
- import { z as z14 } from "zod";
3025
+ import { z as z15 } from "zod";
2877
3026
  var DEFAULT_CRON_COMMAND_TIMEOUT_SEC = 600;
2878
3027
  var MAX_CRON_COMMAND_TIMEOUT_SEC = 3600;
2879
3028
  var CRON_RUN_LOG_DIR = "/var/log/kvbox/runs";
2880
3029
  var CRON_METHODS = ["GET", "POST"];
2881
3030
  var CRON_OUTCOMES = ["running", "ok", "failed", "timeout", "no-credit", "box-stopped", "host-down", "host-outdated", "lost", "still-running", "box-outdated"];
2882
- var CronServiceSchema = z14.object({
2883
- owner: z14.string(),
2884
- ownerKind: z14.enum(["user", "org"]),
2885
- name: z14.string(),
3031
+ var CronServiceSchema = z15.object({
3032
+ owner: z15.string(),
3033
+ ownerKind: z15.enum(["user", "org"]),
3034
+ name: z15.string(),
2886
3035
  /** Runs kept per trigger. */
2887
- keepRuns: z14.number().int(),
2888
- triggers: z14.number().int(),
2889
- createdBy: z14.string().nullable(),
2890
- createdAt: z14.string(),
3036
+ keepRuns: z15.number().int(),
3037
+ triggers: z15.number().int(),
3038
+ createdBy: z15.string().nullable(),
3039
+ createdAt: z15.string(),
2891
3040
  /** What it costs while it exists; on the answer to `POST /cron` only. */
2892
- price: z14.object({ perMonth: z14.number(), currency: z14.string() }).optional()
3041
+ price: z15.object({ perMonth: z15.number(), currency: z15.string() }).optional()
2893
3042
  });
2894
3043
  var triggerCommon = {
2895
- id: z14.string(),
2896
- service: z14.string(),
2897
- owner: z14.string(),
3044
+ id: z15.string(),
3045
+ service: z15.string(),
3046
+ owner: z15.string(),
2898
3047
  /** The box it acts on; a trigger is removed with its box. */
2899
- box: z14.string(),
3048
+ box: z15.string(),
2900
3049
  /** Five fields, `minute hour day-of-month month day-of-week`. */
2901
- expr: z14.string(),
3050
+ expr: z15.string(),
2902
3051
  /** An IANA zone (`Europe/Bucharest`) the expression is read in; `UTC` unless said. */
2903
- timezone: z14.string(),
3052
+ timezone: z15.string(),
2904
3053
  /** False: paused, it fires again when resumed. */
2905
- enabled: z14.boolean(),
3054
+ enabled: z15.boolean(),
2906
3055
  /** When it fires next (ISO); null while paused. */
2907
- nextRunAt: z14.string().nullable(),
2908
- lastRunAt: z14.string().nullable(),
2909
- lastOutcome: z14.enum(CRON_OUTCOMES).nullable(),
2910
- createdBy: z14.string().nullable(),
2911
- createdAt: z14.string()
3056
+ nextRunAt: z15.string().nullable(),
3057
+ lastRunAt: z15.string().nullable(),
3058
+ lastOutcome: z15.enum(CRON_OUTCOMES).nullable(),
3059
+ createdBy: z15.string().nullable(),
3060
+ createdAt: z15.string()
2912
3061
  };
2913
- var CronHttpTriggerSchema = z14.object({
3062
+ var CronHttpTriggerSchema = z15.object({
2914
3063
  ...triggerCommon,
2915
- kind: z14.literal("http"),
2916
- method: z14.enum(CRON_METHODS),
2917
- port: z14.number().int(),
3064
+ kind: z15.literal("http"),
3065
+ method: z15.enum(CRON_METHODS),
3066
+ port: z15.number().int(),
2918
3067
  /** Path and query, starting with `/`. */
2919
- path: z14.string()
3068
+ path: z15.string()
2920
3069
  });
2921
- var CronCommandTriggerSchema = z14.object({
3070
+ var CronCommandTriggerSchema = z15.object({
2922
3071
  ...triggerCommon,
2923
- kind: z14.literal("command"),
3072
+ kind: z15.literal("command"),
2924
3073
  /** Run by a login shell as the box's user, in its home. */
2925
- command: z14.string(),
3074
+ command: z15.string(),
2926
3075
  /** The command is stopped after this long. */
2927
- timeoutSec: z14.number().int()
3076
+ timeoutSec: z15.number().int()
2928
3077
  });
2929
- var CronTriggerSchema = z14.discriminatedUnion("kind", [CronHttpTriggerSchema, CronCommandTriggerSchema]);
2930
- var CronRunSchema = z14.object({
3078
+ var CronTriggerSchema = z15.discriminatedUnion("kind", [CronHttpTriggerSchema, CronCommandTriggerSchema]);
3079
+ var CronRunSchema = z15.object({
2931
3080
  /** The slot this run was for (ISO); a run asked for by hand has the moment it was asked. */
2932
- scheduledFor: z14.string(),
2933
- startedAt: z14.string(),
3081
+ scheduledFor: z15.string(),
3082
+ startedAt: z15.string(),
2934
3083
  /** Null while `running`, and for a run that was never sent. */
2935
- durationMs: z14.number().int().nullable(),
3084
+ durationMs: z15.number().int().nullable(),
2936
3085
  /** The box's HTTP status; null when it never answered, and for a command. */
2937
- status: z14.number().int().nullable(),
3086
+ status: z15.number().int().nullable(),
2938
3087
  /** A command's exit code (128 + the signal when one ended it); null until it ends, and for a request. */
2939
- exitCode: z14.number().int().nullable(),
3088
+ exitCode: z15.number().int().nullable(),
2940
3089
  /** The files in the box that hold what a command printed (a shell pattern, `cron-<n>.*`); null for a request and for a command that never started. */
2941
- output: z14.string().nullable(),
2942
- outcome: z14.enum(CRON_OUTCOMES),
3090
+ output: z15.string().nullable(),
3091
+ outcome: z15.enum(CRON_OUTCOMES),
2943
3092
  /** Why it did not end `ok`, in a line. */
2944
- error: z14.string().nullable(),
3093
+ error: z15.string().nullable(),
2945
3094
  /** The box was hibernated and this run woke it. */
2946
- woke: z14.boolean()
3095
+ woke: z15.boolean()
2947
3096
  });
2948
- var CronCatalogSchema = z14.object({
2949
- price: z14.object({ perMonth: z14.number(), currency: z14.string() }),
2950
- maxServices: z14.number().int(),
2951
- maxTriggers: z14.number().int(),
2952
- keepRuns: z14.number().int(),
3097
+ var CronCatalogSchema = z15.object({
3098
+ price: z15.object({ perMonth: z15.number(), currency: z15.string() }),
3099
+ maxServices: z15.number().int(),
3100
+ maxTriggers: z15.number().int(),
3101
+ keepRuns: z15.number().int(),
2953
3102
  /** The shortest time between two runs of one trigger, in seconds. */
2954
- minIntervalSeconds: z14.number().int(),
3103
+ minIntervalSeconds: z15.number().int(),
2955
3104
  /** How long a box has to answer, in seconds. */
2956
- timeoutSeconds: z14.number().int(),
3105
+ timeoutSeconds: z15.number().int(),
2957
3106
  /** How long a command may run: unless the trigger says, and at most. */
2958
- commandTimeoutSeconds: z14.number().int(),
2959
- maxCommandTimeoutSeconds: z14.number().int(),
2960
- docs: z14.string().optional()
2961
- });
2962
- var CreateCronServiceRequest = z14.object({ name: z14.string() });
2963
- var CreateCronTriggerRequest = z14.object({
2964
- box: z14.string().min(1),
2965
- expr: z14.string().min(1),
2966
- timezone: z14.string().optional(),
3107
+ commandTimeoutSeconds: z15.number().int(),
3108
+ maxCommandTimeoutSeconds: z15.number().int(),
3109
+ docs: z15.string().optional()
3110
+ });
3111
+ var CreateCronServiceRequest = z15.object({ name: z15.string() });
3112
+ var CreateCronTriggerRequest = z15.object({
3113
+ box: z15.string().min(1),
3114
+ expr: z15.string().min(1),
3115
+ timezone: z15.string().optional(),
2967
3116
  /** A request: `port`, with `method` and `path`. */
2968
- method: z14.enum(CRON_METHODS).optional(),
2969
- port: z14.number().int().min(1).max(65535).optional(),
2970
- path: z14.string().optional(),
3117
+ method: z15.enum(CRON_METHODS).optional(),
3118
+ port: z15.number().int().min(1).max(65535).optional(),
3119
+ path: z15.string().optional(),
2971
3120
  /** Or a command, with `timeoutSec`; exactly one of `port` and `command`. */
2972
- command: z14.string().optional(),
2973
- timeoutSec: z14.number().int().optional()
3121
+ command: z15.string().optional(),
3122
+ timeoutSec: z15.number().int().optional()
2974
3123
  });
2975
- var UpdateCronTriggerRequest = z14.object({ enabled: z14.boolean() });
3124
+ var UpdateCronTriggerRequest = z15.object({ enabled: z15.boolean() });
2976
3125
  var cronTarget = (t) => t.kind === "command" ? `${t.box}$ ${t.command}` : `${t.method} ${t.box}:${t.port}${t.path}`;
2977
3126
 
2978
3127
  // ../shared/src/storage.ts
2979
- import { z as z15 } from "zod";
2980
- var RegionSchema = z15.object({ name: z15.string(), country: z15.string().nullable() });
3128
+ import { z as z16 } from "zod";
3129
+ var RegionSchema = z16.object({ name: z16.string(), country: z16.string().nullable() });
2981
3130
  var MAX_PUBLIC_BUCKETS = 10;
2982
3131
  var STORAGE_BOX_SUBDOMAINS = MAX_PUBLIC_BUCKETS + 2;
2983
- var ObjectStorageSchema = z15.object({
2984
- owner: z15.string(),
2985
- ownerKind: z15.enum(["user", "org"]),
3132
+ var ObjectStorageSchema = z16.object({
3133
+ owner: z16.string(),
3134
+ ownerKind: z16.enum(["user", "org"]),
2986
3135
  /** `https://s3-<slug>.<domain>`: what an S3 client is given, with path-style addressing. Null while the address is not claimed. */
2987
- endpoint: z15.string().nullable(),
3136
+ endpoint: z16.string().nullable(),
2988
3137
  /** The S3 region every client of it signs with (`ro-west-1`): its host's when it was made. */
2989
- region: z15.string(),
3138
+ region: z16.string(),
2990
3139
  /** The most it may hold. */
2991
- sizeGib: z15.number().int(),
3140
+ sizeGib: z16.number().int(),
2992
3141
  /** `running` when it answers; `unknown` while its host is not heard from. */
2993
3142
  status: BoxStatusSchema,
2994
3143
  /** With `?live=1`, when the storage answered: what is on its disk, and the disk's real size. */
2995
- usedBytes: z15.number().optional(),
2996
- totalBytes: z15.number().optional(),
3144
+ usedBytes: z16.number().optional(),
3145
+ totalBytes: z16.number().optional(),
2997
3146
  /** With `?live=1`, when the storage answered: what each bucket holds. */
2998
- bucketUsage: z15.array(z15.object({ name: z15.string(), objects: z15.number(), bytes: z15.number() })).optional(),
2999
- host: z15.string(),
3000
- country: z15.string().optional(),
3001
- buckets: z15.number().int(),
3002
- price: z15.object({ perMonth: z15.number(), currency: z15.string() }),
3003
- createdAt: z15.string()
3004
- });
3005
- var BucketSchema = z15.object({
3006
- name: z15.string(),
3007
- owner: z15.string(),
3008
- ownerKind: z15.enum(["user", "org"]),
3009
- endpoint: z15.string().nullable(),
3010
- publicUrl: z15.string().optional(),
3011
- region: z15.string(),
3012
- keys: z15.number().int(),
3013
- objects: z15.number().optional(),
3014
- bytes: z15.number().optional(),
3015
- createdBy: z15.string().nullable(),
3016
- createdAt: z15.string()
3017
- });
3018
- var CreateBucketRequest = z15.object({
3019
- name: z15.string(),
3020
- sizeGib: z15.number().int().optional(),
3021
- near: z15.string().optional(),
3022
- region: z15.string().optional()
3023
- });
3024
- var CreatedBucketSchema = BucketSchema.extend({ storage: ObjectStorageSchema, storageCreated: z15.boolean() });
3147
+ bucketUsage: z16.array(z16.object({ name: z16.string(), objects: z16.number(), bytes: z16.number() })).optional(),
3148
+ host: z16.string(),
3149
+ country: z16.string().optional(),
3150
+ buckets: z16.number().int(),
3151
+ price: z16.object({ perMonth: z16.number(), currency: z16.string() }),
3152
+ createdAt: z16.string()
3153
+ });
3154
+ var BucketSchema = z16.object({
3155
+ name: z16.string(),
3156
+ owner: z16.string(),
3157
+ ownerKind: z16.enum(["user", "org"]),
3158
+ endpoint: z16.string().nullable(),
3159
+ publicUrl: z16.string().optional(),
3160
+ region: z16.string(),
3161
+ keys: z16.number().int(),
3162
+ objects: z16.number().optional(),
3163
+ bytes: z16.number().optional(),
3164
+ createdBy: z16.string().nullable(),
3165
+ createdAt: z16.string()
3166
+ });
3167
+ var CreateBucketRequest = z16.object({
3168
+ name: z16.string(),
3169
+ sizeGib: z16.number().int().optional(),
3170
+ near: z16.string().optional(),
3171
+ region: z16.string().optional()
3172
+ });
3173
+ var CreatedBucketSchema = BucketSchema.extend({ storage: ObjectStorageSchema, storageCreated: z16.boolean() });
3025
3174
  var BucketInfoSchema = BucketSchema.extend({ storage: ObjectStorageSchema });
3026
- var SetBucketPublicRequest = z15.object({ on: z15.boolean(), sub: z15.string().optional() });
3027
- var BucketKeySchema = z15.object({
3028
- id: z15.string(),
3029
- name: z15.string(),
3030
- bucket: z15.string(),
3031
- owner: z15.string(),
3032
- readOnly: z15.boolean(),
3033
- createdBy: z15.string().nullable(),
3034
- createdAt: z15.string()
3035
- });
3036
- var CreateBucketKeyRequest = z15.object({ name: z15.string().optional(), readOnly: z15.boolean().optional() });
3037
- var CreatedBucketKeySchema = BucketKeySchema.extend({ secret: z15.string(), endpoint: z15.string().nullable(), region: z15.string() });
3038
- var GrowStorageRequest = z15.object({ sizeGib: z15.number().int() });
3039
- var StorageBackupSchema = z15.object({
3040
- id: z15.string(),
3041
- owner: z15.string(),
3042
- status: z15.enum(BACKUP_STATUSES),
3175
+ var SetBucketPublicRequest = z16.object({ on: z16.boolean(), sub: z16.string().optional() });
3176
+ var BucketKeySchema = z16.object({
3177
+ id: z16.string(),
3178
+ name: z16.string(),
3179
+ bucket: z16.string(),
3180
+ owner: z16.string(),
3181
+ readOnly: z16.boolean(),
3182
+ createdBy: z16.string().nullable(),
3183
+ createdAt: z16.string()
3184
+ });
3185
+ var CreateBucketKeyRequest = z16.object({ name: z16.string().optional(), readOnly: z16.boolean().optional() });
3186
+ var CreatedBucketKeySchema = BucketKeySchema.extend({ secret: z16.string(), endpoint: z16.string().nullable(), region: z16.string() });
3187
+ var GrowStorageRequest = z16.object({ sizeGib: z16.number().int() });
3188
+ var StorageBackupSchema = z16.object({
3189
+ id: z16.string(),
3190
+ owner: z16.string(),
3191
+ status: z16.enum(BACKUP_STATUSES),
3043
3192
  /** Why it failed; null otherwise. */
3044
- error: z15.string().nullable(),
3193
+ error: z16.string().nullable(),
3045
3194
  /** The storage's volume when taken. */
3046
- diskBytes: z15.number().int().nullable(),
3195
+ diskBytes: z16.number().int().nullable(),
3047
3196
  /** What it holds: the slots that are not all zeros. */
3048
- dataBytes: z15.number().int().nullable(),
3197
+ dataBytes: z16.number().int().nullable(),
3049
3198
  /** What this backup added to the backup store (encrypted, compressed). */
3050
- uploadedBytes: z15.number().int().nullable(),
3199
+ uploadedBytes: z16.number().int().nullable(),
3051
3200
  /** The buckets it holds, and how many access keys they had, as kvbox knew them when it was taken. */
3052
- buckets: z15.array(z15.string()),
3053
- keys: z15.number().int(),
3054
- createdBy: z15.string().nullable(),
3201
+ buckets: z16.array(z16.string()),
3202
+ keys: z16.number().int(),
3203
+ createdBy: z16.string().nullable(),
3055
3204
  /** Taken by the storage's nightly schedule rather than by a person: free, and outside the daily limit. */
3056
- scheduled: z15.boolean().default(false),
3057
- createdAt: z15.string(),
3058
- finishedAt: z15.string().nullable()
3205
+ scheduled: z16.boolean().default(false),
3206
+ createdAt: z16.string(),
3207
+ finishedAt: z16.string().nullable()
3059
3208
  });
3060
- var RestoredKeySchema = z15.object({ bucket: z15.string(), id: z15.string(), name: z15.string() });
3061
- var StorageRestoreSchema = z15.object({
3062
- backup: z15.string(),
3209
+ var RestoredKeySchema = z16.object({ bucket: z16.string(), id: z16.string(), name: z16.string() });
3210
+ var StorageRestoreSchema = z16.object({
3211
+ backup: z16.string(),
3063
3212
  storage: ObjectStorageSchema,
3064
- buckets: z15.object({ kept: z15.array(z15.string()), returned: z15.array(z15.string()), removed: z15.array(z15.string()) }),
3065
- keys: z15.object({ dropped: z15.array(RestoredKeySchema), revoked: z15.array(RestoredKeySchema) }),
3066
- checked: z15.boolean(),
3067
- warnings: z15.array(z15.string())
3213
+ buckets: z16.object({ kept: z16.array(z16.string()), returned: z16.array(z16.string()), removed: z16.array(z16.string()) }),
3214
+ keys: z16.object({ dropped: z16.array(RestoredKeySchema), revoked: z16.array(RestoredKeySchema) }),
3215
+ checked: z16.boolean(),
3216
+ warnings: z16.array(z16.string())
3068
3217
  });
3069
3218
  var OBJECT_LIST_MAX = 1e3;
3070
3219
  var SHARE_LINK_MAX_SEC = 7 * 24 * 3600;
@@ -3074,56 +3223,56 @@ var MULTIPART_PART_BYTES = 16 * 1024 * 1024;
3074
3223
  var UPLOAD_MAX_BYTES = 50 * 1024 * 1024 * 1024;
3075
3224
  var MOVE_MAX_BYTES = 5 * 1024 * 1024 * 1024;
3076
3225
  var DELETE_PREFIXES_MAX = 100;
3077
- var StoredObjectSchema = z15.object({
3078
- key: z15.string(),
3079
- size: z15.number(),
3080
- etag: z15.string(),
3226
+ var StoredObjectSchema = z16.object({
3227
+ key: z16.string(),
3228
+ size: z16.number(),
3229
+ etag: z16.string(),
3081
3230
  /** ISO 8601. */
3082
- modified: z15.string()
3083
- });
3084
- var ObjectListingSchema = z15.object({
3085
- prefix: z15.string(),
3086
- folders: z15.array(z15.string()),
3087
- objects: z15.array(StoredObjectSchema),
3088
- next: z15.string().optional(),
3089
- canWrite: z15.boolean()
3090
- });
3091
- var ObjectInfoSchema = StoredObjectSchema.extend({ contentType: z15.string() });
3092
- var ObjectCountSchema = z15.object({ objects: z15.number(), bytes: z15.number(), more: z15.boolean() });
3093
- var ObjectLinkRequest = z15.object({
3094
- key: z15.string(),
3095
- expiresSec: z15.number().int().positive(),
3231
+ modified: z16.string()
3232
+ });
3233
+ var ObjectListingSchema = z16.object({
3234
+ prefix: z16.string(),
3235
+ folders: z16.array(z16.string()),
3236
+ objects: z16.array(StoredObjectSchema),
3237
+ next: z16.string().optional(),
3238
+ canWrite: z16.boolean()
3239
+ });
3240
+ var ObjectInfoSchema = StoredObjectSchema.extend({ contentType: z16.string() });
3241
+ var ObjectCountSchema = z16.object({ objects: z16.number(), bytes: z16.number(), more: z16.boolean() });
3242
+ var ObjectLinkRequest = z16.object({
3243
+ key: z16.string(),
3244
+ expiresSec: z16.number().int().positive(),
3096
3245
  /** Answer as a download (`Content-Disposition: attachment`) instead of showing it. */
3097
- download: z15.boolean().optional(),
3246
+ download: z16.boolean().optional(),
3098
3247
  /**
3099
3248
  * Let the browser keep what the link answers until the link expires (`Cache-Control: private`, `Expires`),
3100
3249
  * so the same link shown twice is fetched once. Asked again within the hour, for the same file as it
3101
3250
  * is, it is the same URL, and it lasts up to an hour longer than `expiresSec`. For the app's own previews.
3102
3251
  * Only a fetch of the whole file is kept so: the storage answers a part of one (`Range`) without the two headers.
3103
3252
  */
3104
- cached: z15.boolean().optional()
3253
+ cached: z16.boolean().optional()
3105
3254
  });
3106
- var ObjectLinkSchema = z15.object({ url: z15.string(), expiresAt: z15.string() });
3255
+ var ObjectLinkSchema = z16.object({ url: z16.string(), expiresAt: z16.string() });
3107
3256
  var MEDIA_TYPE_RE = /^[\w.+-]+\/[\w.+-]+(?:\s*;[\x20-\x7e]*)?$/;
3108
- var StartUploadRequest = z15.object({ key: z15.string(), size: z15.number().int().nonnegative(), contentType: z15.string().max(200).regex(MEDIA_TYPE_RE, "not a media type like image/png").optional(), overwrite: z15.boolean().optional() });
3109
- var UploadPlanSchema = z15.discriminatedUnion("kind", [
3110
- z15.object({ kind: z15.literal("single"), url: z15.string() }),
3111
- z15.object({ kind: z15.literal("multipart"), uploadId: z15.string(), partSize: z15.number(), urls: z15.array(z15.string()) })
3257
+ var StartUploadRequest = z16.object({ key: z16.string(), size: z16.number().int().nonnegative(), contentType: z16.string().max(200).regex(MEDIA_TYPE_RE, "not a media type like image/png").optional(), overwrite: z16.boolean().optional() });
3258
+ var UploadPlanSchema = z16.discriminatedUnion("kind", [
3259
+ z16.object({ kind: z16.literal("single"), url: z16.string() }),
3260
+ z16.object({ kind: z16.literal("multipart"), uploadId: z16.string(), partSize: z16.number(), urls: z16.array(z16.string()) })
3112
3261
  ]);
3113
- var CompleteUploadRequest = z15.object({
3114
- key: z15.string(),
3115
- uploadId: z15.string(),
3116
- parts: z15.array(z15.object({ part: z15.number().int().positive(), etag: z15.string() })).min(1)
3262
+ var CompleteUploadRequest = z16.object({
3263
+ key: z16.string(),
3264
+ uploadId: z16.string(),
3265
+ parts: z16.array(z16.object({ part: z16.number().int().positive(), etag: z16.string() })).min(1)
3117
3266
  });
3118
- var AbortUploadRequest = z15.object({ key: z15.string(), uploadId: z15.string() });
3119
- var DeleteObjectsRequest = z15.object({ keys: z15.array(z15.string()).max(OBJECT_LIST_MAX).optional(), prefixes: z15.array(z15.string()).max(DELETE_PREFIXES_MAX).optional() });
3120
- var DeletedObjectsSchema = z15.object({
3121
- deleted: z15.number(),
3122
- more: z15.boolean(),
3123
- errors: z15.array(z15.object({ key: z15.string(), message: z15.string() }))
3267
+ var AbortUploadRequest = z16.object({ key: z16.string(), uploadId: z16.string() });
3268
+ var DeleteObjectsRequest = z16.object({ keys: z16.array(z16.string()).max(OBJECT_LIST_MAX).optional(), prefixes: z16.array(z16.string()).max(DELETE_PREFIXES_MAX).optional() });
3269
+ var DeletedObjectsSchema = z16.object({
3270
+ deleted: z16.number(),
3271
+ more: z16.boolean(),
3272
+ errors: z16.array(z16.object({ key: z16.string(), message: z16.string() }))
3124
3273
  });
3125
- var MoveObjectRequest = z15.object({ from: z15.string(), to: z15.string(), overwrite: z15.boolean().optional() });
3126
- var CreateFolderRequest = z15.object({ prefix: z15.string() });
3274
+ var MoveObjectRequest = z16.object({ from: z16.string(), to: z16.string(), overwrite: z16.boolean().optional() });
3275
+ var CreateFolderRequest = z16.object({ prefix: z16.string() });
3127
3276
 
3128
3277
  // src/kvm.ts
3129
3278
  import { accessSync, constants, readFileSync, statSync } from "fs";
@@ -3293,7 +3442,7 @@ var ServerClient = class {
3293
3442
  * `all`: every box on the platform (platform admins only, #78).
3294
3443
  */
3295
3444
  listMachines(opts = {}) {
3296
- return this.call("GET", `/machines${allQuery(opts)}`, z16.array(MachineSchema), void 0, opts.org);
3445
+ return this.call("GET", `/machines${allQuery(opts)}`, z17.array(MachineSchema), void 0, opts.org);
3297
3446
  }
3298
3447
  createMachine(req) {
3299
3448
  return this.call("POST", "/machines", MachineSchema, req, void 0, req.fromBackup !== void 0 ? 2 * 36e5 : void 0);
@@ -3351,10 +3500,10 @@ var ServerClient = class {
3351
3500
  }
3352
3501
  /** Backups, the control plane's only: a box's disk in object storage. Newest first. */
3353
3502
  listBackups() {
3354
- return this.call("GET", "/backups", z16.array(BackupSchema));
3503
+ return this.call("GET", "/backups", z17.array(BackupSchema));
3355
3504
  }
3356
3505
  boxBackups(name) {
3357
- return this.call("GET", `/machines/${encodeURIComponent(name)}/backups`, z16.array(BackupSchema));
3506
+ return this.call("GET", `/machines/${encodeURIComponent(name)}/backups`, z17.array(BackupSchema));
3358
3507
  }
3359
3508
  boxBackup(name, id) {
3360
3509
  return this.call("GET", `/machines/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}`, BackupSchema);
@@ -3376,14 +3525,14 @@ var ServerClient = class {
3376
3525
  * later. Works for a backup whose box, volume or database is gone too.
3377
3526
  */
3378
3527
  removeBackup(id) {
3379
- return this.call("DELETE", `/backups/${encodeURIComponent(id)}`, z16.undefined());
3528
+ return this.call("DELETE", `/backups/${encodeURIComponent(id)}`, z17.undefined());
3380
3529
  }
3381
3530
  /** A volume's backups (#168): the same as a box's, of the volume's disk. Newest first. */
3382
3531
  listVolumeBackups() {
3383
- return this.call("GET", "/backups?kind=volume", z16.array(VolumeBackupSchema));
3532
+ return this.call("GET", "/backups?kind=volume", z17.array(VolumeBackupSchema));
3384
3533
  }
3385
3534
  volumeBackups(name) {
3386
- return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups`, z16.array(VolumeBackupSchema));
3535
+ return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups`, z17.array(VolumeBackupSchema));
3387
3536
  }
3388
3537
  volumeBackup(name, id) {
3389
3538
  return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}`, VolumeBackupSchema);
@@ -3409,7 +3558,7 @@ var ServerClient = class {
3409
3558
  }
3410
3559
  /** Wake hooks (#101), the control plane's only: a URL and a secret that wake the box. */
3411
3560
  boxHooks(name) {
3412
- return this.call("GET", `/machines/${encodeURIComponent(name)}/hooks`, z16.array(WakeHookSchema));
3561
+ return this.call("GET", `/machines/${encodeURIComponent(name)}/hooks`, z17.array(WakeHookSchema));
3413
3562
  }
3414
3563
  createBoxHook(name) {
3415
3564
  return this.call("POST", `/machines/${encodeURIComponent(name)}/hooks`, CreatedWakeHookSchema);
@@ -3437,7 +3586,7 @@ var ServerClient = class {
3437
3586
  }
3438
3587
  /** Every readable box's subdomains, one entry each. */
3439
3588
  listSubdomains() {
3440
- return this.call("GET", "/subdomains", z16.array(SubdomainSchema));
3589
+ return this.call("GET", "/subdomains", z17.array(SubdomainSchema));
3441
3590
  }
3442
3591
  /** Custom domains (#89), the control plane's only: serve the box at the user's own name. */
3443
3592
  addDomain(name, req) {
@@ -3448,7 +3597,7 @@ var ServerClient = class {
3448
3597
  }
3449
3598
  /** Every readable box's custom domains. */
3450
3599
  listDomains() {
3451
- return this.call("GET", "/domains", z16.array(DomainSchema));
3600
+ return this.call("GET", "/domains", z17.array(DomainSchema));
3452
3601
  }
3453
3602
  /** A running box's own load, memory and disk, asked of its guest (#67). */
3454
3603
  machineStats(name) {
@@ -3489,22 +3638,22 @@ var ServerClient = class {
3489
3638
  return this.call("POST", "/billing/redeem", RedeemResponseSchema, { code });
3490
3639
  }
3491
3640
  deleteMachine(name) {
3492
- return this.call("DELETE", `/machines/${encodeURIComponent(name)}`, z16.undefined());
3641
+ return this.call("DELETE", `/machines/${encodeURIComponent(name)}`, z17.undefined());
3493
3642
  }
3494
3643
  /** Like `listMachines`, for snapshots. */
3495
3644
  listSnapshots(opts = {}) {
3496
- return this.call("GET", `/snapshots${allQuery(opts)}`, z16.array(SnapshotSchema), void 0, opts.org);
3645
+ return this.call("GET", `/snapshots${allQuery(opts)}`, z17.array(SnapshotSchema), void 0, opts.org);
3497
3646
  }
3498
3647
  createSnapshot(req) {
3499
3648
  return this.call("POST", "/snapshots", SnapshotSchema, req);
3500
3649
  }
3501
3650
  deleteSnapshot(name) {
3502
- return this.call("DELETE", `/snapshots/${encodeURIComponent(name)}`, z16.undefined());
3651
+ return this.call("DELETE", `/snapshots/${encodeURIComponent(name)}`, z17.undefined());
3503
3652
  }
3504
3653
  // ---- environment variables (#88), a control plane only: the caller's slug, or `--org`'s ----
3505
3654
  /** `org`: that org's list instead of `--org`'s (or the caller's own). */
3506
3655
  listEnv(org) {
3507
- return this.call("GET", "/vars", z16.array(EnvVarSchema), void 0, org);
3656
+ return this.call("GET", "/vars", z17.array(EnvVarSchema), void 0, org);
3508
3657
  }
3509
3658
  setEnv(name, req) {
3510
3659
  return this.call("PUT", `/vars/${encodeURIComponent(name)}`, EnvChangeSchema, req);
@@ -3524,13 +3673,13 @@ var ServerClient = class {
3524
3673
  }
3525
3674
  // ---- volumes (#52) ----
3526
3675
  listVolumes(opts = {}) {
3527
- return this.call("GET", `/volumes${allQuery(opts)}`, z16.array(VolumeSchema), void 0, opts.org);
3676
+ return this.call("GET", `/volumes${allQuery(opts)}`, z17.array(VolumeSchema), void 0, opts.org);
3528
3677
  }
3529
3678
  createVolume(req) {
3530
3679
  return this.call("POST", "/volumes", VolumeSchema, req);
3531
3680
  }
3532
3681
  deleteVolume(name) {
3533
- return this.call("DELETE", `/volumes/${encodeURIComponent(name)}`, z16.undefined());
3682
+ return this.call("DELETE", `/volumes/${encodeURIComponent(name)}`, z17.undefined());
3534
3683
  }
3535
3684
  /** Both answer with the box as it is afterwards (restarted when it was running). */
3536
3685
  attachVolume(name, req) {
@@ -3545,7 +3694,7 @@ var ServerClient = class {
3545
3694
  }
3546
3695
  // ---- cron service (#190): the control plane's alone ----
3547
3696
  listCronServices(opts = {}) {
3548
- return this.call("GET", `/cron${allQuery(opts)}`, z16.array(CronServiceSchema), void 0, opts.org);
3697
+ return this.call("GET", `/cron${allQuery(opts)}`, z17.array(CronServiceSchema), void 0, opts.org);
3549
3698
  }
3550
3699
  createCronService(name) {
3551
3700
  return this.call("POST", "/cron", CronServiceSchema, { name });
@@ -3554,10 +3703,10 @@ var ServerClient = class {
3554
3703
  return this.call("GET", `/cron/${encodeURIComponent(name)}`, CronServiceSchema);
3555
3704
  }
3556
3705
  deleteCronService(name) {
3557
- return this.call("DELETE", `/cron/${encodeURIComponent(name)}`, z16.undefined());
3706
+ return this.call("DELETE", `/cron/${encodeURIComponent(name)}`, z17.undefined());
3558
3707
  }
3559
3708
  listCronTriggers(service) {
3560
- return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers`, z16.array(CronTriggerSchema));
3709
+ return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers`, z17.array(CronTriggerSchema));
3561
3710
  }
3562
3711
  addCronTrigger(service, req) {
3563
3712
  return this.call("POST", `/cron/${encodeURIComponent(service)}/triggers`, CronTriggerSchema, req);
@@ -3567,18 +3716,18 @@ var ServerClient = class {
3567
3716
  return this.call("PATCH", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}`, CronTriggerSchema, { enabled: enabled2 });
3568
3717
  }
3569
3718
  deleteCronTrigger(service, id) {
3570
- return this.call("DELETE", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}`, z16.undefined());
3719
+ return this.call("DELETE", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}`, z17.undefined());
3571
3720
  }
3572
3721
  /** Marks it due: kvbox-cron fires it within a few seconds. */
3573
3722
  runCronTrigger(service, id) {
3574
3723
  return this.call("POST", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}/run`, CronTriggerSchema);
3575
3724
  }
3576
3725
  listCronRuns(service, id, limit) {
3577
- return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}/runs${limit === void 0 ? "" : `?limit=${limit}`}`, z16.array(CronRunSchema));
3726
+ return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}/runs${limit === void 0 ? "" : `?limit=${limit}`}`, z17.array(CronRunSchema));
3578
3727
  }
3579
3728
  // ---- Kubernetes clusters (#216): the control plane's alone ----
3580
3729
  listClusters(opts = {}) {
3581
- return this.call("GET", `/k8s${allQuery(opts)}`, z16.array(ClusterSchema), void 0, opts.org);
3730
+ return this.call("GET", `/k8s${allQuery(opts)}`, z17.array(ClusterSchema), void 0, opts.org);
3582
3731
  }
3583
3732
  /** The master boots twice (its volume is attached after it is made), so this may take a minute. */
3584
3733
  createCluster(req) {
@@ -3594,84 +3743,92 @@ var ServerClient = class {
3594
3743
  startCluster(name) {
3595
3744
  return this.call("POST", `/k8s/${encodeURIComponent(name)}/start`, ClusterSchema);
3596
3745
  }
3746
+ /** One box of a cluster stopped and booted again (#228); the cluster's own name is its master. */
3747
+ restartClusterNode(cluster2, node) {
3748
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/nodes/${encodeURIComponent(node)}/restart`, ClusterSchema);
3749
+ }
3750
+ /** New credentials for a cluster (#230): answered once its master has stored them, its boxes restart after. */
3751
+ rotateCluster(name) {
3752
+ return this.call("POST", `/k8s/${encodeURIComponent(name)}/rotate`, ClusterSchema);
3753
+ }
3597
3754
  /** One more pool with its nodes (#217): each node is a box the host makes, so a few seconds a node. */
3598
- addPool(cluster, req) {
3599
- return this.call("POST", `/k8s/${encodeURIComponent(cluster)}/pools`, ClusterSchema, req);
3755
+ addPool(cluster2, req) {
3756
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/pools`, ClusterSchema, req);
3600
3757
  }
3601
3758
  /**
3602
3759
  * How many nodes a pool is meant to have; the missing ones are made. Fewer is only begun when this
3603
3760
  * answers (`operation`): the nodes are drained one by one; `force` removes them undrained.
3604
3761
  */
3605
- resizePool(cluster, pool, nodes, force = false) {
3606
- return this.call("PUT", `/k8s/${encodeURIComponent(cluster)}/pools/${encodeURIComponent(pool)}`, ClusterSchema, { nodes, ...force ? { force } : {} });
3762
+ resizePool(cluster2, pool, nodes, force = false) {
3763
+ return this.call("PUT", `/k8s/${encodeURIComponent(cluster2)}/pools/${encodeURIComponent(pool)}`, ClusterSchema, { nodes, ...force ? { force } : {} });
3607
3764
  }
3608
3765
  /** A pool with its nodes, drained first like a shrink: begun when this answers, over when `operation` is gone. */
3609
- removePool(cluster, pool, force = false) {
3610
- return this.call("DELETE", `/k8s/${encodeURIComponent(cluster)}/pools/${encodeURIComponent(pool)}${force ? "?force=1" : ""}`, ClusterSchema);
3766
+ removePool(cluster2, pool, force = false) {
3767
+ return this.call("DELETE", `/k8s/${encodeURIComponent(cluster2)}/pools/${encodeURIComponent(pool)}${force ? "?force=1" : ""}`, ClusterSchema);
3611
3768
  }
3612
3769
  /** A cluster's HTTPS addresses (#219): `kvbox.app` names and custom domains, all to its Traefik. */
3613
- listClusterSubdomains(cluster) {
3614
- return this.call("GET", `/k8s/${encodeURIComponent(cluster)}/subdomains`, z16.array(SubdomainSchema));
3770
+ listClusterSubdomains(cluster2) {
3771
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/subdomains`, z17.array(SubdomainSchema));
3615
3772
  }
3616
- claimClusterSubdomain(cluster, name) {
3617
- return this.call("POST", `/k8s/${encodeURIComponent(cluster)}/subdomains`, SubdomainSchema, { name });
3773
+ claimClusterSubdomain(cluster2, name) {
3774
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/subdomains`, SubdomainSchema, { name });
3618
3775
  }
3619
- releaseClusterSubdomain(cluster, name) {
3620
- return this.call("DELETE", `/k8s/${encodeURIComponent(cluster)}/subdomains/${encodeURIComponent(name)}`, SubdomainSchema);
3776
+ releaseClusterSubdomain(cluster2, name) {
3777
+ return this.call("DELETE", `/k8s/${encodeURIComponent(cluster2)}/subdomains/${encodeURIComponent(name)}`, SubdomainSchema);
3621
3778
  }
3622
- listClusterDomains(cluster) {
3623
- return this.call("GET", `/k8s/${encodeURIComponent(cluster)}/domains`, z16.array(DomainSchema));
3779
+ listClusterDomains(cluster2) {
3780
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/domains`, z17.array(DomainSchema));
3624
3781
  }
3625
- addClusterDomain(cluster, domain) {
3626
- return this.call("POST", `/k8s/${encodeURIComponent(cluster)}/domains`, DomainSchema, { domain });
3782
+ addClusterDomain(cluster2, domain) {
3783
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/domains`, DomainSchema, { domain });
3627
3784
  }
3628
- removeClusterDomain(cluster, domain) {
3629
- return this.call("DELETE", `/k8s/${encodeURIComponent(cluster)}/domains/${encodeURIComponent(domain)}`, DomainSchema);
3785
+ removeClusterDomain(cluster2, domain) {
3786
+ return this.call("DELETE", `/k8s/${encodeURIComponent(cluster2)}/domains/${encodeURIComponent(domain)}`, DomainSchema);
3630
3787
  }
3631
3788
  /** What a cluster reaches (#220): a database or a box, from every one of its boxes. */
3632
- listClusterLinks(cluster) {
3633
- return this.call("GET", `/k8s/${encodeURIComponent(cluster)}/links`, z16.array(ClusterLinkSchema));
3789
+ listClusterLinks(cluster2) {
3790
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/links`, z17.array(ClusterLinkSchema));
3634
3791
  }
3635
- linkCluster(cluster, req) {
3636
- return this.call("POST", `/k8s/${encodeURIComponent(cluster)}/links`, ClusterLinkSchema, req);
3792
+ linkCluster(cluster2, req) {
3793
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/links`, ClusterLinkSchema, req);
3637
3794
  }
3638
- unlinkCluster(cluster, req) {
3639
- return this.call("DELETE", `/k8s/${encodeURIComponent(cluster)}/links`, ClusterLinkSchema, req);
3795
+ unlinkCluster(cluster2, req) {
3796
+ return this.call("DELETE", `/k8s/${encodeURIComponent(cluster2)}/links`, ClusterLinkSchema, req);
3640
3797
  }
3641
3798
  /** A cluster's backups (#221): its master's state, by the engine a database's uses. Every cluster's, removed ones' too. */
3642
3799
  listClusterBackups() {
3643
- return this.call("GET", "/backups?managed=k8s", z16.array(ManagedBackupSchema));
3800
+ return this.call("GET", "/backups?managed=k8s", z17.array(ManagedBackupSchema));
3644
3801
  }
3645
- clusterBackups(cluster) {
3646
- return this.call("GET", `/k8s/${encodeURIComponent(cluster)}/backups`, z16.array(ManagedBackupSchema));
3802
+ clusterBackups(cluster2) {
3803
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/backups`, z17.array(ManagedBackupSchema));
3647
3804
  }
3648
- clusterBackup(cluster, id) {
3649
- return this.call("GET", `/k8s/${encodeURIComponent(cluster)}/backups/${encodeURIComponent(id)}`, ManagedBackupSchema);
3805
+ clusterBackup(cluster2, id) {
3806
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/backups/${encodeURIComponent(id)}`, ManagedBackupSchema);
3650
3807
  }
3651
3808
  /** Starts one; it runs in the background (`running`), `clusterBackup` says how it ended. */
3652
- createClusterBackup(cluster) {
3653
- return this.call("POST", `/k8s/${encodeURIComponent(cluster)}/backups`, ManagedBackupSchema);
3809
+ createClusterBackup(cluster2) {
3810
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/backups`, ManagedBackupSchema);
3654
3811
  }
3655
3812
  /**
3656
3813
  * The cluster's state becomes the backup's; its master restarts. Waits for the whole download (the
3657
3814
  * control plane gives its host 2 h) and for the master to answer again (5 min more), so 2 h 10 min.
3658
3815
  */
3659
- restoreClusterBackup(cluster, id) {
3660
- return this.call("POST", `/k8s/${encodeURIComponent(cluster)}/backups/${encodeURIComponent(id)}/restore`, ClusterRestoreSchema, {}, void 0, 2 * 36e5 + 10 * 6e4);
3816
+ restoreClusterBackup(cluster2, id) {
3817
+ return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/backups/${encodeURIComponent(id)}/restore`, ClusterRestoreSchema, {}, void 0, 2 * 36e5 + 10 * 6e4);
3661
3818
  }
3662
3819
  /** When the cluster's state is backed up on its own: nightly from its creation. */
3663
- clusterBackupSchedule(cluster) {
3664
- return this.call("GET", `/k8s/${encodeURIComponent(cluster)}/backup-schedule`, BackupScheduleSchema);
3820
+ clusterBackupSchedule(cluster2) {
3821
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/backup-schedule`, BackupScheduleSchema);
3665
3822
  }
3666
- setClusterBackupSchedule(cluster, change) {
3667
- return this.call("PUT", `/k8s/${encodeURIComponent(cluster)}/backup-schedule`, BackupScheduleSchema, change);
3823
+ setClusterBackupSchedule(cluster2, change) {
3824
+ return this.call("PUT", `/k8s/${encodeURIComponent(cluster2)}/backup-schedule`, BackupScheduleSchema, change);
3668
3825
  }
3669
3826
  deleteCluster(name) {
3670
- return this.call("DELETE", `/k8s/${encodeURIComponent(name)}`, z16.undefined());
3827
+ return this.call("DELETE", `/k8s/${encodeURIComponent(name)}`, z17.undefined());
3671
3828
  }
3672
3829
  // ---- object storage (#182): the control plane's alone ----
3673
3830
  listBuckets(opts = {}) {
3674
- return this.call("GET", `/buckets${allQuery(opts)}`, z16.array(BucketSchema), void 0, opts.org);
3831
+ return this.call("GET", `/buckets${allQuery(opts)}`, z17.array(BucketSchema), void 0, opts.org);
3675
3832
  }
3676
3833
  /** The first bucket of a slug also makes its storage: a box boots twice, so this may take a couple of minutes. */
3677
3834
  createBucket(req) {
@@ -3685,26 +3842,26 @@ var ServerClient = class {
3685
3842
  return this.call("PUT", `/buckets/${encodeURIComponent(name)}/public`, BucketSchema, req);
3686
3843
  }
3687
3844
  deleteBucket(name, force = false) {
3688
- return this.call("DELETE", `/buckets/${encodeURIComponent(name)}${force ? "?force=1" : ""}`, z16.undefined());
3845
+ return this.call("DELETE", `/buckets/${encodeURIComponent(name)}${force ? "?force=1" : ""}`, z17.undefined());
3689
3846
  }
3690
3847
  listBucketKeys(name) {
3691
- return this.call("GET", `/buckets/${encodeURIComponent(name)}/keys`, z16.array(BucketKeySchema));
3848
+ return this.call("GET", `/buckets/${encodeURIComponent(name)}/keys`, z17.array(BucketKeySchema));
3692
3849
  }
3693
3850
  createBucketKey(name, req) {
3694
3851
  return this.call("POST", `/buckets/${encodeURIComponent(name)}/keys`, CreatedBucketKeySchema, req);
3695
3852
  }
3696
3853
  deleteBucketKey(name, id) {
3697
- return this.call("DELETE", `/buckets/${encodeURIComponent(name)}/keys/${encodeURIComponent(id)}`, z16.undefined());
3854
+ return this.call("DELETE", `/buckets/${encodeURIComponent(name)}/keys/${encodeURIComponent(id)}`, z17.undefined());
3698
3855
  }
3699
3856
  listStorage(opts = {}) {
3700
- return this.call("GET", `/storage${allQuery(opts)}`, z16.array(ObjectStorageSchema), void 0, opts.org);
3857
+ return this.call("GET", `/storage${allQuery(opts)}`, z17.array(ObjectStorageSchema), void 0, opts.org);
3701
3858
  }
3702
3859
  growStorage(sizeGib) {
3703
3860
  return this.call("POST", "/storage/grow", ObjectStorageSchema, { sizeGib });
3704
3861
  }
3705
3862
  /** Backups of the slug's whole object storage (#186 slice 3), newest first. */
3706
3863
  storageBackups() {
3707
- return this.call("GET", "/storage/backups", z16.array(StorageBackupSchema));
3864
+ return this.call("GET", "/storage/backups", z17.array(StorageBackupSchema));
3708
3865
  }
3709
3866
  storageBackup(id) {
3710
3867
  return this.call("GET", `/storage/backups/${encodeURIComponent(id)}`, StorageBackupSchema);
@@ -3732,11 +3889,11 @@ var ServerClient = class {
3732
3889
  return `/managed/${encodeURIComponent(kind)}${name === void 0 ? "" : `/${encodeURIComponent(name)}`}${rest}`;
3733
3890
  }
3734
3891
  managedCatalog() {
3735
- return this.call("GET", "/managed/catalog", z16.array(ManagedCatalogEntrySchema));
3892
+ return this.call("GET", "/managed/catalog", z17.array(ManagedCatalogEntrySchema));
3736
3893
  }
3737
3894
  /** One kind's services, or every kind's when `kind` is left out. */
3738
3895
  listManaged(kind, opts = {}) {
3739
- return this.call("GET", `${kind === void 0 ? "/managed" : this.managedPath(kind)}${allQuery(opts)}`, z16.array(ManagedSchema), void 0, opts.org);
3896
+ return this.call("GET", `${kind === void 0 ? "/managed" : this.managedPath(kind)}${allQuery(opts)}`, z17.array(ManagedSchema), void 0, opts.org);
3740
3897
  }
3741
3898
  /** From a backup (`fromBackup`) it waits for the restore too: the control plane gives its host 2 h for the download. */
3742
3899
  createManaged(kind, req) {
@@ -3747,7 +3904,7 @@ var ServerClient = class {
3747
3904
  return this.call("GET", this.managedPath(kind, name), ManagedSchema);
3748
3905
  }
3749
3906
  deleteManaged(kind, name) {
3750
- return this.call("DELETE", this.managedPath(kind, name), z16.undefined());
3907
+ return this.call("DELETE", this.managedPath(kind, name), z17.undefined());
3751
3908
  }
3752
3909
  managedPassword(kind, name) {
3753
3910
  return this.call("GET", this.managedPath(kind, name, "/password"), ManagedSecretSchema);
@@ -3769,10 +3926,10 @@ var ServerClient = class {
3769
3926
  }
3770
3927
  /** A managed service's backups (#186): its storage's, by the volume backup engine. Every one of a kind, those of removed services too. */
3771
3928
  listManagedBackups(kind) {
3772
- return this.call("GET", `/backups?managed=${encodeURIComponent(kind)}`, z16.array(ManagedBackupSchema));
3929
+ return this.call("GET", `/backups?managed=${encodeURIComponent(kind)}`, z17.array(ManagedBackupSchema));
3773
3930
  }
3774
3931
  managedBackups(kind, name) {
3775
- return this.call("GET", this.managedPath(kind, name, "/backups"), z16.array(ManagedBackupSchema));
3932
+ return this.call("GET", this.managedPath(kind, name, "/backups"), z17.array(ManagedBackupSchema));
3776
3933
  }
3777
3934
  managedBackup(kind, name, id) {
3778
3935
  return this.call("GET", this.managedPath(kind, name, `/backups/${encodeURIComponent(id)}`), ManagedBackupSchema);
@@ -3814,7 +3971,7 @@ var ServerClient = class {
3814
3971
  return this.call("POST", "/login/device/token", DeviceLoginPollSchema, { deviceCode });
3815
3972
  }
3816
3973
  logout() {
3817
- return this.call("POST", "/logout", z16.unknown()).then(() => void 0);
3974
+ return this.call("POST", "/logout", z17.unknown()).then(() => void 0);
3818
3975
  }
3819
3976
  me() {
3820
3977
  return this.call("GET", "/me", MeResponseSchema);
@@ -3825,25 +3982,25 @@ var ServerClient = class {
3825
3982
  * credential. Null: each readable slug whatever `--org` says, which is how the caller's own slug is read.
3826
3983
  */
3827
3984
  listIntegrations(org) {
3828
- return this.call("GET", "/integrations", z16.array(IntegrationSchema), void 0, org);
3985
+ return this.call("GET", "/integrations", z17.array(IntegrationSchema), void 0, org);
3829
3986
  }
3830
3987
  /** What can be connected on this control plane, and by which kind of slug. */
3831
3988
  integrationCatalog() {
3832
- return this.call("GET", "/integrations/catalog", z16.array(IntegrationCatalogEntrySchema), void 0, null);
3989
+ return this.call("GET", "/integrations/catalog", z17.array(IntegrationCatalogEntrySchema), void 0, null);
3833
3990
  }
3834
3991
  // ---- API keys (`kvbox key …`, #189) ----
3835
3992
  listApiKeys() {
3836
- return this.call("GET", "/keys", z16.array(ApiKeySchema));
3993
+ return this.call("GET", "/keys", z17.array(ApiKeySchema));
3837
3994
  }
3838
3995
  createApiKey(req) {
3839
3996
  return this.call("POST", "/keys", CreatedApiKeySchema, req);
3840
3997
  }
3841
3998
  deleteApiKey(name) {
3842
- return this.call("DELETE", `/keys/${encodeURIComponent(name)}`, z16.unknown()).then(() => void 0);
3999
+ return this.call("DELETE", `/keys/${encodeURIComponent(name)}`, z17.unknown()).then(() => void 0);
3843
4000
  }
3844
4001
  // ---- orgs (`kvbox org …`) ----
3845
4002
  listOrgs() {
3846
- return this.call("GET", "/orgs", z16.array(OrgMembershipSchema));
4003
+ return this.call("GET", "/orgs", z17.array(OrgMembershipSchema));
3847
4004
  }
3848
4005
  createOrg(req) {
3849
4006
  return this.call("POST", "/orgs", CloudOrgSchema, req);
@@ -3852,16 +4009,16 @@ var ServerClient = class {
3852
4009
  return this.call("GET", `/orgs/${encodeURIComponent(slug)}`, OrgDetailSchema);
3853
4010
  }
3854
4011
  deleteOrg(slug) {
3855
- return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}`, z16.undefined());
4012
+ return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}`, z17.undefined());
3856
4013
  }
3857
4014
  addMember(slug, req) {
3858
- return this.call("POST", `/orgs/${encodeURIComponent(slug)}/members`, z16.undefined(), req);
4015
+ return this.call("POST", `/orgs/${encodeURIComponent(slug)}/members`, z17.undefined(), req);
3859
4016
  }
3860
4017
  setRole(slug, username, role) {
3861
- return this.call("PATCH", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z16.unknown(), { role }).then(() => void 0);
4018
+ return this.call("PATCH", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z17.unknown(), { role }).then(() => void 0);
3862
4019
  }
3863
4020
  removeMember(slug, username) {
3864
- return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z16.undefined());
4021
+ return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z17.undefined());
3865
4022
  }
3866
4023
  /** Sign this machine's key again (#51); the key must be one the user logged in with. */
3867
4024
  sshCert(req) {
@@ -6933,7 +7090,7 @@ import { Command as Command67, InvalidArgumentError as InvalidArgumentError2, Op
6933
7090
  // src/commands/deploy/config.ts
6934
7091
  import { readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
6935
7092
  import { isAbsolute, join as join6, normalize, relative as relative2 } from "path";
6936
- import { z as z17 } from "zod";
7093
+ import { z as z18 } from "zod";
6937
7094
 
6938
7095
  // src/commands/deploy/templates/docker.ts
6939
7096
  import { readFile as readFile4 } from "fs/promises";
@@ -7357,21 +7514,21 @@ function detectTemplates(pkg, dir = NO_FACTS) {
7357
7514
  var DEPLOY_AUTO_HIBERNATE_SEC = 3600;
7358
7515
  var CONFIG_FILE = "kvbox.json";
7359
7516
  var BOX_NAME_RE = /^[a-z0-9][a-z0-9-]{0,11}$/;
7360
- var DeployConfigSchema = z17.object({
7361
- template: z17.enum(TEMPLATE_IDS),
7362
- name: z17.string().regex(BOX_NAME_RE, "1-12 chars, lowercase letters, digits and '-', starting with a letter or digit"),
7517
+ var DeployConfigSchema = z18.object({
7518
+ template: z18.enum(TEMPLATE_IDS),
7519
+ name: z18.string().regex(BOX_NAME_RE, "1-12 chars, lowercase letters, digits and '-', starting with a letter or digit"),
7363
7520
  /** The org whose box it is; absent for the user's own. */
7364
- org: z17.string().regex(ORG_SLUG_RE, "not an org slug").optional(),
7521
+ org: z18.string().regex(ORG_SLUG_RE, "not an org slug").optional(),
7365
7522
  /** The HTTPS name (`<subdomain>.kvbox.app`); absent when deploying to this machine's own host. */
7366
- subdomain: z17.string().check((ctx) => {
7523
+ subdomain: z18.string().check((ctx) => {
7367
7524
  const problem = subdomainProblem(ctx.value);
7368
7525
  if (problem) ctx.issues.push({ code: "custom", message: problem, input: ctx.value });
7369
7526
  }).optional(),
7370
- size: z17.enum(SIZE_NAMES).optional(),
7527
+ size: z18.enum(SIZE_NAMES).optional(),
7371
7528
  /** The build output directory, relative to the app; the template's default when absent. */
7372
- dist: z17.string().optional(),
7529
+ dist: z18.string().optional(),
7373
7530
  /** The port a Next.js app or Node server serves; the template's (3000) when absent. */
7374
- port: z17.number().int().min(1).max(65535).optional()
7531
+ port: z18.number().int().min(1).max(65535).optional()
7375
7532
  });
7376
7533
  var SERVICE_KEY_RE = /^[a-z][a-z0-9-]{0,19}$/;
7377
7534
  var RESERVED_SERVICE_KEYS = ["app", "agent", "init", "volumes"];
@@ -7383,38 +7540,38 @@ var POSTGRES_PORT = 5432;
7383
7540
  var POSTGRES_IMAGE = "postgres:17";
7384
7541
  var POSTGRES_ENV = "DATABASE_URL";
7385
7542
  var IMAGE_RE = /^[a-z0-9][a-z0-9._/:@-]*$/;
7386
- var ServiceSchema = z17.strictObject({
7387
- template: z17.enum([...TEMPLATE_IDS, POSTGRES]),
7543
+ var ServiceSchema = z18.strictObject({
7544
+ template: z18.enum([...TEMPLATE_IDS, POSTGRES]),
7388
7545
  /** The service's directory, relative to the one holding kvbox.json; every template but postgres has one. */
7389
- dir: z17.string().min(1).optional(),
7546
+ dir: z18.string().min(1).optional(),
7390
7547
  /** A postgres service's image, `postgres:17` when absent (`pgvector/pgvector:pg17` for vectors). */
7391
- image: z17.string().regex(IMAGE_RE, "an image name like postgres:17").optional(),
7548
+ image: z18.string().regex(IMAGE_RE, "an image name like postgres:17").optional(),
7392
7549
  /** The volume (a key of `volumes`) a postgres service keeps its data on. */
7393
- volume: z17.string().optional(),
7550
+ volume: z18.string().optional(),
7394
7551
  /** The box variable a postgres service's URL is written to, `DATABASE_URL` when absent. */
7395
- env: z17.string().optional(),
7552
+ env: z18.string().optional(),
7396
7553
  /** A docker service's build context, relative to kvbox.json, when it is not `dir` (a monorepo built from its root); the Dockerfile stays in `dir`. */
7397
- context: z17.string().min(1).optional(),
7398
- dist: z17.string().optional(),
7554
+ context: z18.string().min(1).optional(),
7555
+ dist: z18.string().optional(),
7399
7556
  /**
7400
7557
  * A command run once per deploy in the service's new version (a docker service: in a container of
7401
7558
  * the new image; node, nextjs: in the new source, installed and built), with the box's variables,
7402
7559
  * before it replaces the running one. Migrations, mostly. A failing one stops that service's deploy.
7403
7560
  */
7404
- release: z17.string().optional(),
7561
+ release: z18.string().optional(),
7405
7562
  /** The box port of a service with its own server; the template's (3000) when absent. */
7406
- port: z17.number().int().min(1).max(65535).optional(),
7563
+ port: z18.number().int().min(1).max(65535).optional(),
7407
7564
  /** The URL paths that go to this service, each with everything under it; the prefix is kept. */
7408
- paths: z17.array(z17.string().regex(ROUTE_RE, "a path like / or /api, no trailing slash")).min(1).optional()
7565
+ paths: z18.array(z18.string().regex(ROUTE_RE, "a path like / or /api, no trailing slash")).min(1).optional()
7409
7566
  });
7410
- var StackConfigSchema = z17.strictObject({
7567
+ var StackConfigSchema = z18.strictObject({
7411
7568
  name: DeployConfigSchema.shape.name.optional(),
7412
7569
  org: DeployConfigSchema.shape.org,
7413
7570
  subdomain: DeployConfigSchema.shape.subdomain,
7414
7571
  size: DeployConfigSchema.shape.size,
7415
7572
  /** The stack's volumes, name to size ("10GB"): made for its box and attached to it on the first deploy that needs one. */
7416
- volumes: z17.record(z17.string(), z17.string()).optional(),
7417
- services: z17.record(z17.string(), ServiceSchema)
7573
+ volumes: z18.record(z18.string(), z18.string()).optional(),
7574
+ services: z18.record(z18.string(), ServiceSchema)
7418
7575
  });
7419
7576
  function volumeGib(text2) {
7420
7577
  const mib2 = parseMib(text2);
@@ -9029,7 +9186,7 @@ for (const cmd of bucketCommand.commands) {
9029
9186
  }
9030
9187
 
9031
9188
  // src/commands/k8s/index.ts
9032
- import { Command as Command126 } from "commander";
9189
+ import { Command as Command129 } from "commander";
9033
9190
 
9034
9191
  // src/commands/k8s/backup/index.ts
9035
9192
  import { Command as Command103 } from "commander";
@@ -9066,11 +9223,6 @@ function printRows2(rows2) {
9066
9223
  var READY_WAIT_MS = 5 * 6e4;
9067
9224
  var READY_EVERY_MS = 3e3;
9068
9225
  var readyWait = () => Number(process.env["KVBOX_K8S_WAIT_MS"] ?? READY_WAIT_MS);
9069
- function allReady(c2) {
9070
- if (c2.health?.ready !== true) return false;
9071
- const joined = new Set(c2.health.nodes.filter((n2) => n2.ready).map((n2) => n2.name));
9072
- return c2.pools.every((p) => p.boxes.length >= p.nodes && p.boxes.every((name) => joined.has(name)));
9073
- }
9074
9226
  async function untilReady(client, name, made, waitMs, everyMs = Math.min(READY_EVERY_MS, waitMs), done = allReady, fatal = () => false) {
9075
9227
  const deadline = Date.now() + waitMs;
9076
9228
  let last = made;
@@ -9179,8 +9331,8 @@ var restoreCommand4 = new Command100("restore").description("put a backup back:
9179
9331
  }
9180
9332
  const done = await spin(`restoring cluster ${name} from ${backup.id}\u2026`, client.restoreClusterBackup(name, id));
9181
9333
  if (opts.json) {
9182
- const cluster = opts.wait ? await spin("waiting for its nodes to be Ready again\u2026", untilReady(client, name, done.cluster, readyWait())) : done.cluster;
9183
- json({ ...done, cluster });
9334
+ const cluster2 = opts.wait ? await spin("waiting for its nodes to be Ready again\u2026", untilReady(client, name, done.cluster, readyWait())) : done.cluster;
9335
+ json({ ...done, cluster: cluster2 });
9184
9336
  return;
9185
9337
  }
9186
9338
  info(`${color.green("\u2713")} cluster ${color.bold(name)} restored from backup ${backup.id}`);
@@ -9235,17 +9387,17 @@ var createCommand10 = new Command104("create").description("make a Kubernetes cl
9235
9387
  const client = await k8sClient(cmd);
9236
9388
  try {
9237
9389
  const made = await spin(`making cluster ${name} and its ${nodes} node${nodes === 1 ? "" : "s"}\u2026`, client.createCluster({ name, size: opts.size, nodes, ...opts.near !== void 0 ? { near: opts.near } : {} }));
9238
- const cluster = opts.wait ? await spin("waiting for its API and its nodes\u2026", untilReady(client, name, made, readyWait())) : made;
9390
+ const cluster2 = opts.wait ? await spin("waiting for its API and its nodes\u2026", untilReady(client, name, made, readyWait())) : made;
9239
9391
  if (opts.json) {
9240
- json(cluster);
9392
+ json(cluster2);
9241
9393
  return;
9242
9394
  }
9243
- const shown = shownName2(cluster, client);
9244
- info(`${color.green("\u2713")} cluster ${color.bold(shown)} made on ${cluster.host}: Kubernetes ${cluster.version}, ${priceText2(cluster)}`);
9245
- info(` API: ${apiText(cluster)}`);
9246
- info(` nodes: ${poolsText(cluster)}`);
9247
- if (opts.wait && !allReady(cluster)) warn(`it is not all ready yet; look again with: kvbox k8s info ${shown}`);
9248
- info(color.dim(` next: kvbox k8s kubeconfig ${shown} > ${cluster.name}.yaml (then: kubectl --kubeconfig ${cluster.name}.yaml get nodes)`));
9395
+ const shown = shownName2(cluster2, client);
9396
+ info(`${color.green("\u2713")} cluster ${color.bold(shown)} made on ${cluster2.host}: Kubernetes ${cluster2.version}, ${priceText2(cluster2)}`);
9397
+ info(` API: ${apiText(cluster2)}`);
9398
+ info(` nodes: ${poolsText(cluster2)}`);
9399
+ if (opts.wait && !allReady(cluster2)) warn(`it is not all ready yet; look again with: kvbox k8s info ${shown}`);
9400
+ info(color.dim(` next: kvbox k8s kubeconfig ${shown} > ${cluster2.name}.yaml (then: kubectl --kubeconfig ${cluster2.name}.yaml get nodes)`));
9249
9401
  } finally {
9250
9402
  await client.close();
9251
9403
  }
@@ -9275,26 +9427,26 @@ function hostIn(name, zone) {
9275
9427
  }
9276
9428
 
9277
9429
  // src/commands/k8s/domain/add.ts
9278
- var clusterDomainJson = (d, cluster) => ({ domain: d.domain, cluster, status: d.status, www: d.www, url: d.url, error: d.error, records: d.records, createdAt: d.createdAt });
9279
- var addCommand3 = new Command105("add").description("serve a cluster at a domain of your own, https://<domain>, with its certificate made for you; an Ingress for that host picks the app").argument("<cluster>", "cluster name").argument("<domain>", "a domain you control, like example.com or app.example.com").option("--json", "print the domain as JSON").action(async (cluster, domainArg, opts, cmd) => {
9430
+ var clusterDomainJson = (d, cluster2) => ({ domain: d.domain, cluster: cluster2, status: d.status, www: d.www, url: d.url, error: d.error, records: d.records, createdAt: d.createdAt });
9431
+ var addCommand3 = new Command105("add").description("serve a cluster at a domain of your own, https://<domain>, with its certificate made for you; an Ingress for that host picks the app").argument("<cluster>", "cluster name").argument("<domain>", "a domain you control, like example.com or app.example.com").option("--json", "print the domain as JSON").action(async (cluster2, domainArg, opts, cmd) => {
9280
9432
  const domain = assertDomain(domainArg.trim().toLowerCase());
9281
9433
  const client = await k8sClient(cmd);
9282
9434
  try {
9283
- const d = await spin(`adding ${domain}\u2026`, client.addClusterDomain(cluster, domain));
9435
+ const d = await spin(`adding ${domain}\u2026`, client.addClusterDomain(cluster2, domain));
9284
9436
  if (opts.json) {
9285
- json(clusterDomainJson(d, cluster));
9437
+ json(clusterDomainJson(d, cluster2));
9286
9438
  return;
9287
9439
  }
9288
9440
  const apex = d.records.some((r) => r.type === "CNAME");
9289
9441
  const hosts = apex ? `the hosts ${domain} and www.${domain}` : `the host ${domain}`;
9290
9442
  const ingress = `it answers once an Ingress in the cluster has ${hosts} (ingress class traefik, plain HTTP inside: kvbox ends TLS)`;
9291
9443
  if (d.status === "live") {
9292
- info(`${color.green("\u2713")} ${color.bold(d.url)} \u2192 cluster ${color.bold(cluster)}`);
9444
+ info(`${color.green("\u2713")} ${color.bold(d.url)} \u2192 cluster ${color.bold(cluster2)}`);
9293
9445
  info(" the certificate is made on the first visit, which can take a few seconds");
9294
9446
  info(` ${ingress}`);
9295
9447
  return;
9296
9448
  }
9297
- info(`${color.green("\u2713")} ${domain} added for cluster ${color.bold(cluster)}, waiting for its DNS`);
9449
+ info(`${color.green("\u2713")} ${domain} added for cluster ${color.bold(cluster2)}, waiting for its DNS`);
9298
9450
  const zone = zoneOf(domain);
9299
9451
  info(`
9300
9452
  At the company that runs the DNS of ${zone}, add:
@@ -9304,7 +9456,7 @@ At the company that runs the DNS of ${zone}, add:
9304
9456
  (the TXT record shows ${domain} is yours; keep it, it is checked again if the domain ever goes back to pending)`);
9305
9457
  if (apex) info(` (the www record is optional: with it, www.${domain} reaches the cluster too, and an Ingress must name that host as well)`);
9306
9458
  info(`
9307
- kvbox checks every minute; ${domain} is served at ${d.url} once its records are set (kvbox k8s domain ls ${cluster}).`);
9459
+ kvbox checks every minute; ${domain} is served at ${d.url} once its records are set (kvbox k8s domain ls ${cluster2}).`);
9308
9460
  info(` ${ingress}`);
9309
9461
  if (d.error) info(color.dim(` now: ${d.error}`));
9310
9462
  } finally {
@@ -9314,16 +9466,16 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
9314
9466
 
9315
9467
  // src/commands/k8s/domain/ls.ts
9316
9468
  import { Command as Command106 } from "commander";
9317
- var lsCommand16 = new Command106("ls").alias("list").description("list a cluster's custom domains and whether they are live").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster, opts, cmd) => {
9469
+ var lsCommand16 = new Command106("ls").alias("list").description("list a cluster's custom domains and whether they are live").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9318
9470
  const client = await k8sClient(cmd);
9319
9471
  try {
9320
- const domains = await client.listClusterDomains(cluster);
9472
+ const domains = await client.listClusterDomains(cluster2);
9321
9473
  if (opts.json) {
9322
- json(domains.map((d) => clusterDomainJson(d, cluster)));
9474
+ json(domains.map((d) => clusterDomainJson(d, cluster2)));
9323
9475
  return;
9324
9476
  }
9325
9477
  if (domains.length === 0) {
9326
- info(`cluster ${cluster} has no custom domain (kvbox k8s domain add ${cluster} <domain>)`);
9478
+ info(`cluster ${cluster2} has no custom domain (kvbox k8s domain add ${cluster2} <domain>)`);
9327
9479
  return;
9328
9480
  }
9329
9481
  table(domains.map((d) => ({ domain: d.www ? `${d.domain} (+www)` : d.domain, status: d.status === "live" ? "live" : "pending dns", note: d.status === "live" ? d.url : d.error ?? "" })));
@@ -9334,17 +9486,17 @@ var lsCommand16 = new Command106("ls").alias("list").description("list a cluster
9334
9486
 
9335
9487
  // src/commands/k8s/domain/rm.ts
9336
9488
  import { Command as Command107 } from "commander";
9337
- var rmCommand15 = new Command107("rm").alias("remove").description("stop serving a cluster at a custom domain").argument("<cluster>", "cluster name").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (cluster, domainArg, opts, cmd) => {
9489
+ var rmCommand15 = new Command107("rm").alias("remove").description("stop serving a cluster at a custom domain").argument("<cluster>", "cluster name").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (cluster2, domainArg, opts, cmd) => {
9338
9490
  const domain = domainArg.trim().toLowerCase();
9339
9491
  const client = await k8sClient(cmd);
9340
9492
  try {
9341
- if (!await confirm(`Stop serving cluster ${cluster} at ${domain}?`, opts.yes ?? false)) {
9493
+ if (!await confirm(`Stop serving cluster ${cluster2} at ${domain}?`, opts.yes ?? false)) {
9342
9494
  info("cancelled");
9343
9495
  process.exitCode = 1;
9344
9496
  return;
9345
9497
  }
9346
- await spin(`removing ${domain}\u2026`, client.removeClusterDomain(cluster, domain));
9347
- info(`${color.green("\u2713")} ${domain} no longer reaches cluster ${cluster} (you can remove its DNS record)`);
9498
+ await spin(`removing ${domain}\u2026`, client.removeClusterDomain(cluster2, domain));
9499
+ info(`${color.green("\u2713")} ${domain} no longer reaches cluster ${cluster2} (you can remove its DNS record)`);
9348
9500
  } finally {
9349
9501
  await client.close();
9350
9502
  }
@@ -9371,9 +9523,12 @@ var infoCommand2 = new Command109("info").description("one cluster: its API addr
9371
9523
  if (h === null) return name2;
9372
9524
  return `${name2}${n2 === void 0 ? color.yellow(" (not joined)") : `${n2.ready ? "" : color.yellow(" (not ready)")}${n2.schedulable ? "" : color.dim(" (cordoned)")}`}`;
9373
9525
  };
9526
+ const cond = c2.condition;
9527
+ const paint = { ready: color.green, starting: color.yellow, degraded: color.yellow, down: color.red, unknown: color.dim };
9374
9528
  const rows2 = [
9375
9529
  ["name", color.bold(shown)],
9376
- ["status", h === null ? `${status(c2.status)}${c2.status === "running" ? color.dim(" (not answering yet)") : ""}` : h.ready ? color.green("ready") : color.yellow("starting")],
9530
+ ["status", cond !== void 0 ? paint[cond.state](cond.state) : h === null ? `${status(c2.status)}${c2.status === "running" ? color.dim(" (not answering yet)") : ""}` : h.ready ? color.green("ready") : color.yellow("starting")],
9531
+ ...(cond?.problems ?? []).map((p, i) => [i === 0 ? "wrong" : "", `${p.what}${p.fix ? color.dim(`: ${p.fix}`) : ""}`]),
9377
9532
  ["version", h?.version ?? c2.version],
9378
9533
  ["API", apiText(c2)],
9379
9534
  ["ingress", h === null ? color.dim("unknown") : h.ingress ? "Traefik, ports 80 and 443" : color.dim("not up yet")],
@@ -9409,17 +9564,17 @@ var kubeconfigCommand = new Command110("kubeconfig").description("print the clus
9409
9564
  // src/commands/k8s/link.ts
9410
9565
  import { Command as Command111 } from "commander";
9411
9566
  var reachedText = (l) => `${l.kind} ${l.to}`;
9412
- var linkJson = (l, cluster) => ({ cluster, to: l.to, owner: l.owner, kind: l.kind, port: l.port, host: l.host, ...l.boxes ? { boxes: l.boxes } : {} });
9413
- var linkCommand2 = new Command111("link").description("let every pod of a cluster reach a database or a box's port (private; never public)").argument("<cluster>", "cluster name").argument("<target>", "a database (kvbox pg, kvbox redis) or a box; <slug>/<name> for another account's").option("-p, --port <port>", "the port, for a box (a database has its own)").option("--json", "print the link as JSON").action(async (cluster, target, opts, cmd) => {
9567
+ var linkJson = (l, cluster2) => ({ cluster: cluster2, to: l.to, owner: l.owner, kind: l.kind, port: l.port, host: l.host, ...l.boxes ? { boxes: l.boxes } : {} });
9568
+ var linkCommand2 = new Command111("link").description("let every pod of a cluster reach a database or a box's port (private; never public)").argument("<cluster>", "cluster name").argument("<target>", "a database (kvbox pg, kvbox redis) or a box; <slug>/<name> for another account's").option("-p, --port <port>", "the port, for a box (a database has its own)").option("--json", "print the link as JSON").action(async (cluster2, target, opts, cmd) => {
9414
9569
  const port = opts.port === void 0 ? void 0 : parseLinkPort(opts.port);
9415
9570
  const client = await k8sClient(cmd);
9416
9571
  try {
9417
- const link2 = await spin(`linking ${cluster} to ${target}\u2026`, client.linkCluster(cluster, { to: target, ...port !== void 0 ? { port } : {} }));
9572
+ const link2 = await spin(`linking ${cluster2} to ${target}\u2026`, client.linkCluster(cluster2, { to: target, ...port !== void 0 ? { port } : {} }));
9418
9573
  if (opts.json) {
9419
- json(linkJson(link2, cluster));
9574
+ json(linkJson(link2, cluster2));
9420
9575
  return;
9421
9576
  }
9422
- info(`${color.green("\u2713")} cluster ${color.bold(cluster)} reaches ${reachedText(link2)} at ${color.bold(`${link2.host}:${link2.port}`)}`);
9577
+ info(`${color.green("\u2713")} cluster ${color.bold(cluster2)} reaches ${reachedText(link2)} at ${color.bold(`${link2.host}:${link2.port}`)}`);
9423
9578
  info(` from its ${link2.boxes?.length ?? 0} boxes (the master and every node); a node added later gets it too`);
9424
9579
  info(" in a pod, connect to that name: it resolves inside the cluster");
9425
9580
  } finally {
@@ -9429,15 +9584,15 @@ var linkCommand2 = new Command111("link").description("let every pod of a cluste
9429
9584
 
9430
9585
  // src/commands/k8s/links.ts
9431
9586
  import { Command as Command112 } from "commander";
9432
- var linksCommand2 = new Command112("links").description("list what a cluster reaches (kvbox k8s link)").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster, opts, cmd) => {
9587
+ var linksCommand2 = new Command112("links").description("list what a cluster reaches (kvbox k8s link)").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9433
9588
  const client = await k8sClient(cmd);
9434
9589
  try {
9435
- const links = await client.listClusterLinks(cluster);
9590
+ const links = await client.listClusterLinks(cluster2);
9436
9591
  if (opts.json) {
9437
- json(links.map((l) => linkJson(l, cluster)));
9592
+ json(links.map((l) => linkJson(l, cluster2)));
9438
9593
  return;
9439
9594
  }
9440
- if (links.length === 0) info(`cluster ${cluster} reaches nothing (kvbox k8s link ${cluster} <database or box>)`);
9595
+ if (links.length === 0) info(`cluster ${cluster2} reaches nothing (kvbox k8s link ${cluster2} <database or box>)`);
9441
9596
  else table(links.map((l) => ({ reaches: reachedText(l), address: `${l.host}:${l.port}` })));
9442
9597
  } finally {
9443
9598
  await client.close();
@@ -9476,11 +9631,30 @@ var lsCommand17 = new Command113("ls").alias("list").description("list Kubernete
9476
9631
  }
9477
9632
  });
9478
9633
 
9634
+ // src/commands/k8s/node/index.ts
9635
+ import { Command as Command115 } from "commander";
9636
+
9637
+ // src/commands/k8s/node/restart.ts
9638
+ import { Command as Command114 } from "commander";
9639
+ var restartCommand2 = new Command114("restart").description("stop and boot one node of a cluster again (the cluster's own name restarts its master)").argument("<cluster>", "cluster name").argument("<node>", "the node's name, as kvbox k8s info lists it; the cluster's name for its master").option("--json", "print as JSON").action(async (name, node, opts, cmd) => {
9640
+ const client = await k8sClient(cmd);
9641
+ try {
9642
+ const c2 = await spin(`restarting ${node}\u2026`, client.restartClusterNode(name, node));
9643
+ if (opts.json) json(c2);
9644
+ else info(`${color.green("\u2713")} ${node === c2.name ? `the master of cluster ${shownName2(c2, client)}` : `node ${node}`} was restarted; it joins again by itself: kvbox k8s info ${shownName2(c2, client)}`);
9645
+ } finally {
9646
+ await client.close();
9647
+ }
9648
+ });
9649
+
9650
+ // src/commands/k8s/node/index.ts
9651
+ var nodeCommand = new Command115("node").description("one node of a cluster: restart it").addCommand(restartCommand2);
9652
+
9479
9653
  // src/commands/k8s/pool/index.ts
9480
- import { Command as Command118 } from "commander";
9654
+ import { Command as Command120 } from "commander";
9481
9655
 
9482
9656
  // src/commands/k8s/pool/add.ts
9483
- import { Command as Command114 } from "commander";
9657
+ import { Command as Command116 } from "commander";
9484
9658
 
9485
9659
  // src/commands/k8s/pool/shared.ts
9486
9660
  function poolReady(c2, pool) {
@@ -9532,14 +9706,14 @@ function printPool(client, c2, pool, done, waited) {
9532
9706
  }
9533
9707
 
9534
9708
  // src/commands/k8s/pool/add.ts
9535
- var addCommand4 = new Command114("add").description("add a pool of nodes to a cluster").argument("<cluster>", "cluster name").requiredOption("--size <size>", `what each node is sized at: ${NODE_SIZES.join(", ")}`).option("--nodes <n>", `how many nodes (1-${MAX_POOL_NODES})`, String(DEFAULT_POOL_NODES)).option("--name <pool>", "the pool's name (default: its size)").option("--no-wait", "do not wait for the nodes to join").option("--json", "print as JSON").action(async (cluster, opts, cmd) => {
9709
+ var addCommand4 = new Command116("add").description("add a pool of nodes to a cluster").argument("<cluster>", "cluster name").requiredOption("--size <size>", `what each node is sized at: ${NODE_SIZES.join(", ")}`).option("--nodes <n>", `how many nodes (1-${MAX_POOL_NODES})`, String(DEFAULT_POOL_NODES)).option("--name <pool>", "the pool's name (default: its size)").option("--no-wait", "do not wait for the nodes to join").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9536
9710
  if (!NODE_SIZES.includes(opts.size)) throw new KvboxError(`--size ${opts.size}: a node is one of ${NODE_SIZES.join(", ")}`);
9537
9711
  const nodes = nodeCount(opts.nodes);
9538
9712
  const pool = opts.name ?? opts.size;
9539
9713
  const client = await k8sClient(cmd);
9540
9714
  try {
9541
- const made = await spin(`adding pool ${pool} to ${cluster}: ${nodes} ${opts.size} node${nodes === 1 ? "" : "s"}\u2026`, client.addPool(cluster, { size: opts.size, nodes, ...opts.name !== void 0 ? { name: opts.name } : {} }));
9542
- const now = opts.wait ? await untilJoined(client, cluster, made, pool) : made;
9715
+ const made = await spin(`adding pool ${pool} to ${cluster2}: ${nodes} ${opts.size} node${nodes === 1 ? "" : "s"}\u2026`, client.addPool(cluster2, { size: opts.size, nodes, ...opts.name !== void 0 ? { name: opts.name } : {} }));
9716
+ const now = opts.wait ? await untilJoined(client, cluster2, made, pool) : made;
9543
9717
  if (opts.json) json(now);
9544
9718
  else printPool(client, now, pool, `pool ${pool} added to cluster ${shownName2(now, client)}`, opts.wait);
9545
9719
  failIfNot(now);
@@ -9549,16 +9723,16 @@ var addCommand4 = new Command114("add").description("add a pool of nodes to a cl
9549
9723
  });
9550
9724
 
9551
9725
  // src/commands/k8s/pool/ls.ts
9552
- import { Command as Command115 } from "commander";
9553
- var lsCommand18 = new Command115("ls").alias("list").description("list a cluster's pools").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster, opts, cmd) => {
9726
+ import { Command as Command117 } from "commander";
9727
+ var lsCommand18 = new Command117("ls").alias("list").description("list a cluster's pools").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9554
9728
  const client = await k8sClient(cmd);
9555
9729
  try {
9556
- const c2 = await client.getCluster(cluster);
9730
+ const c2 = await client.getCluster(cluster2);
9557
9731
  if (opts.json) {
9558
9732
  json(c2.pools);
9559
9733
  return;
9560
9734
  }
9561
- if (c2.pools.length === 0) info(`no pools yet; add one with: kvbox k8s pool add ${cluster} --size m`);
9735
+ if (c2.pools.length === 0) info(`no pools yet; add one with: kvbox k8s pool add ${cluster2} --size m`);
9562
9736
  else table(c2.pools.map((p) => ({ pool: p.name, size: p.size, nodes: nodesText(p), boxes: p.boxes.join(", ") || "-" })));
9563
9737
  if (c2.operation) info(color.yellow(`${c2.operation.what}, since ${age(c2.operation.since)}`));
9564
9738
  else if (c2.operationError) warn(`the last change did not finish: ${c2.operationError}`);
@@ -9569,24 +9743,24 @@ var lsCommand18 = new Command115("ls").alias("list").description("list a cluster
9569
9743
  });
9570
9744
 
9571
9745
  // src/commands/k8s/pool/resize.ts
9572
- import { Command as Command116 } from "commander";
9573
- var resizeCommand = new Command116("resize").description("change how many nodes a pool has").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").requiredOption("--nodes <n>", "how many nodes the pool should have").option("--force", "fewer nodes: remove them at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation (fewer nodes)").option("--no-wait", "do not wait for new nodes to join, or for removed ones to drain").option("--json", "print as JSON").action(async (cluster, pool, opts, cmd) => {
9746
+ import { Command as Command118 } from "commander";
9747
+ var resizeCommand = new Command118("resize").description("change how many nodes a pool has").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").requiredOption("--nodes <n>", "how many nodes the pool should have").option("--force", "fewer nodes: remove them at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation (fewer nodes)").option("--no-wait", "do not wait for new nodes to join, or for removed ones to drain").option("--json", "print as JSON").action(async (cluster2, pool, opts, cmd) => {
9574
9748
  const nodes = nodeCount(opts.nodes);
9575
9749
  const client = await k8sClient(cmd);
9576
9750
  try {
9577
- const before = opts.yes ? void 0 : (await client.getCluster(cluster)).pools.find((p) => p.name === pool);
9751
+ const before = opts.yes ? void 0 : (await client.getCluster(cluster2)).pools.find((p) => p.name === pool);
9578
9752
  const going = before === void 0 ? [] : before.boxes.slice(nodes).reverse();
9579
9753
  const shrinks = opts.force || going.length > 0;
9580
- const what = going.length > 0 ? `${going.length === 1 ? "node" : "nodes"} ${going.join(", ")} of pool ${pool}` : `the nodes pool ${pool} of ${cluster} has beyond ${nodes}`;
9581
- const question = opts.force ? `Remove ${what} without draining, with whatever they keep on their disks?` : `Drain and remove ${what} (cluster ${cluster})?`;
9754
+ const what = going.length > 0 ? `${going.length === 1 ? "node" : "nodes"} ${going.join(", ")} of pool ${pool}` : `the nodes pool ${pool} of ${cluster2} has beyond ${nodes}`;
9755
+ const question = opts.force ? `Remove ${what} without draining, with whatever they keep on their disks?` : `Drain and remove ${what} (cluster ${cluster2})?`;
9582
9756
  if (shrinks && !await confirm(question, opts.yes ?? false)) {
9583
9757
  info("cancelled");
9584
9758
  process.exitCode = 1;
9585
9759
  return;
9586
9760
  }
9587
- const changed = await spin(`resizing pool ${pool} of ${cluster} to ${nodes} node${nodes === 1 ? "" : "s"}\u2026`, client.resizePool(cluster, pool, nodes, opts.force ?? false));
9588
- const now = !opts.wait ? changed : leaving(changed, pool) > 0 ? await untilDrained(client, cluster, changed, pool) : await untilJoined(client, cluster, changed, pool);
9589
- const again = opts.wait && leaving(now, pool) > 0 ? `kvbox k8s pool resize ${cluster} ${pool} --nodes ${nodes}${opts.force ? " --force -y" : ""}` : void 0;
9761
+ const changed = await spin(`resizing pool ${pool} of ${cluster2} to ${nodes} node${nodes === 1 ? "" : "s"}\u2026`, client.resizePool(cluster2, pool, nodes, opts.force ?? false));
9762
+ const now = !opts.wait ? changed : leaving(changed, pool) > 0 ? await untilDrained(client, cluster2, changed, pool) : await untilJoined(client, cluster2, changed, pool);
9763
+ const again = opts.wait && leaving(now, pool) > 0 ? `kvbox k8s pool resize ${cluster2} ${pool} --nodes ${nodes}${opts.force ? " --force -y" : ""}` : void 0;
9590
9764
  const ours = opts.wait && leaving(changed, pool) > 0 ? changed.operation : void 0;
9591
9765
  if (opts.json) json(now);
9592
9766
  else if (!fails(now, again, ours)) printPool(client, now, pool, `pool ${pool} of cluster ${shownName2(now, client)}`, opts.wait);
@@ -9597,18 +9771,18 @@ var resizeCommand = new Command116("resize").description("change how many nodes
9597
9771
  });
9598
9772
 
9599
9773
  // src/commands/k8s/pool/rm.ts
9600
- import { Command as Command117 } from "commander";
9601
- var rmCommand16 = new Command117("rm").alias("remove").description("remove a pool and its nodes from a cluster").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").option("--force", "remove the nodes at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the nodes to drain").option("--json", "print as JSON").action(async (cluster, pool, opts, cmd) => {
9774
+ import { Command as Command119 } from "commander";
9775
+ var rmCommand16 = new Command119("rm").alias("remove").description("remove a pool and its nodes from a cluster").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").option("--force", "remove the nodes at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the nodes to drain").option("--json", "print as JSON").action(async (cluster2, pool, opts, cmd) => {
9602
9776
  const client = await k8sClient(cmd);
9603
9777
  try {
9604
- if (!await confirm(`Remove pool ${pool} of cluster ${cluster} and its nodes${opts.force ? " without draining them, with whatever they keep on their disks" : ""}?`, opts.yes ?? false)) {
9778
+ if (!await confirm(`Remove pool ${pool} of cluster ${cluster2} and its nodes${opts.force ? " without draining them, with whatever they keep on their disks" : ""}?`, opts.yes ?? false)) {
9605
9779
  info("cancelled");
9606
9780
  process.exitCode = 1;
9607
9781
  return;
9608
9782
  }
9609
- const changed = await spin(`removing pool ${pool} of ${cluster}\u2026`, client.removePool(cluster, pool, opts.force ?? false));
9610
- const now = opts.wait ? await untilDrained(client, cluster, changed, pool) : changed;
9611
- const again = opts.wait && now.pools.some((p) => p.name === pool) ? `kvbox k8s pool rm ${cluster} ${pool}${opts.force ? " --force" : ""} -y` : void 0;
9783
+ const changed = await spin(`removing pool ${pool} of ${cluster2}\u2026`, client.removePool(cluster2, pool, opts.force ?? false));
9784
+ const now = opts.wait ? await untilDrained(client, cluster2, changed, pool) : changed;
9785
+ const again = opts.wait && now.pools.some((p) => p.name === pool) ? `kvbox k8s pool rm ${cluster2} ${pool}${opts.force ? " --force" : ""} -y` : void 0;
9612
9786
  if (opts.json) json(now);
9613
9787
  failIfNot(now, again, opts.wait ? changed.operation : void 0);
9614
9788
  if (opts.json) return;
@@ -9621,24 +9795,24 @@ var rmCommand16 = new Command117("rm").alias("remove").description("remove a poo
9621
9795
  });
9622
9796
 
9623
9797
  // src/commands/k8s/pool/index.ts
9624
- var poolCommand = new Command118("pool").description("a cluster's node pools: add one, list them, change how many nodes one has, remove one").addCommand(addCommand4).addCommand(lsCommand18).addCommand(resizeCommand).addCommand(rmCommand16);
9798
+ var poolCommand = new Command120("pool").description("a cluster's node pools: add one, list them, change how many nodes one has, remove one").addCommand(addCommand4).addCommand(lsCommand18).addCommand(resizeCommand).addCommand(rmCommand16);
9625
9799
 
9626
9800
  // src/commands/k8s/proxy/index.ts
9627
- import { Command as Command122 } from "commander";
9801
+ import { Command as Command124 } from "commander";
9628
9802
 
9629
9803
  // src/commands/k8s/proxy/claim.ts
9630
- import { Command as Command119 } from "commander";
9631
- var claimCommand2 = new Command119("claim").description(`give a cluster an HTTPS address, https://<subdomain>.kvbox.app (up to ${MAX_BOX_SUBDOMAINS} per cluster); an Ingress for that host picks the app`).argument("<cluster>", "cluster name").argument("<subdomain>", "3-63 lowercase letters, digits and '-'; must be free").option("--json", "print the address as JSON").action(async (cluster, subArg, opts, cmd) => {
9804
+ import { Command as Command121 } from "commander";
9805
+ var claimCommand2 = new Command121("claim").description(`give a cluster an HTTPS address, https://<subdomain>.kvbox.app (up to ${MAX_BOX_SUBDOMAINS} per cluster); an Ingress for that host picks the app`).argument("<cluster>", "cluster name").argument("<subdomain>", "3-63 lowercase letters, digits and '-'; must be free").option("--json", "print the address as JSON").action(async (cluster2, subArg, opts, cmd) => {
9632
9806
  const subdomain = assertSubdomain(subArg);
9633
9807
  const client = await k8sClient(cmd);
9634
9808
  try {
9635
- const sub = await spin(`claiming ${subdomain}\u2026`, client.claimClusterSubdomain(cluster, subdomain));
9809
+ const sub = await spin(`claiming ${subdomain}\u2026`, client.claimClusterSubdomain(cluster2, subdomain));
9636
9810
  if (opts.json) {
9637
- json({ cluster, subdomain: sub.subdomain, url: sub.url });
9811
+ json({ cluster: cluster2, subdomain: sub.subdomain, url: sub.url });
9638
9812
  return;
9639
9813
  }
9640
9814
  const host = sub.url.replace(/^https:\/\//, "");
9641
- info(`${color.green("\u2713")} ${color.bold(sub.url)} \u2192 cluster ${color.bold(cluster)}`);
9815
+ info(`${color.green("\u2713")} ${color.bold(sub.url)} \u2192 cluster ${color.bold(cluster2)}`);
9642
9816
  info(` it answers once an Ingress in the cluster has the host ${host} (ingress class traefik, plain HTTP inside: kvbox ends TLS)`);
9643
9817
  } finally {
9644
9818
  await client.close();
@@ -9646,16 +9820,16 @@ var claimCommand2 = new Command119("claim").description(`give a cluster an HTTPS
9646
9820
  });
9647
9821
 
9648
9822
  // src/commands/k8s/proxy/ls.ts
9649
- import { Command as Command120 } from "commander";
9650
- var lsCommand19 = new Command120("ls").alias("list").description("list a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster, opts, cmd) => {
9823
+ import { Command as Command122 } from "commander";
9824
+ var lsCommand19 = new Command122("ls").alias("list").description("list a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9651
9825
  const client = await k8sClient(cmd);
9652
9826
  try {
9653
- const subs = await client.listClusterSubdomains(cluster);
9827
+ const subs = await client.listClusterSubdomains(cluster2);
9654
9828
  if (opts.json) {
9655
- json(subs.map((s) => ({ cluster, subdomain: s.subdomain, url: s.url })));
9829
+ json(subs.map((s) => ({ cluster: cluster2, subdomain: s.subdomain, url: s.url })));
9656
9830
  return;
9657
9831
  }
9658
- if (subs.length === 0) info(`cluster ${cluster} has no kvbox.app address (kvbox k8s proxy claim ${cluster} <subdomain>)`);
9832
+ if (subs.length === 0) info(`cluster ${cluster2} has no kvbox.app address (kvbox k8s proxy claim ${cluster2} <subdomain>)`);
9659
9833
  else table(subs.map((s) => ({ subdomain: s.subdomain, url: s.url })));
9660
9834
  } finally {
9661
9835
  await client.close();
@@ -9663,28 +9837,28 @@ var lsCommand19 = new Command120("ls").alias("list").description("list a cluster
9663
9837
  });
9664
9838
 
9665
9839
  // src/commands/k8s/proxy/release.ts
9666
- import { Command as Command121 } from "commander";
9667
- var releaseCommand2 = new Command121("release").description("give up one of a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").argument("<subdomain>", "the subdomain (kvbox k8s proxy ls <cluster>)").option("-y, --yes", "do not ask for confirmation").action(async (cluster, subdomain, opts, cmd) => {
9840
+ import { Command as Command123 } from "commander";
9841
+ var releaseCommand2 = new Command123("release").description("give up one of a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").argument("<subdomain>", "the subdomain (kvbox k8s proxy ls <cluster>)").option("-y, --yes", "do not ask for confirmation").action(async (cluster2, subdomain, opts, cmd) => {
9668
9842
  const client = await k8sClient(cmd);
9669
9843
  try {
9670
- if (!await confirm(`Give up ${subdomain}, one of cluster ${cluster}'s HTTPS addresses? Anyone may claim it after.`, opts.yes ?? false)) {
9844
+ if (!await confirm(`Give up ${subdomain}, one of cluster ${cluster2}'s HTTPS addresses? Anyone may claim it after.`, opts.yes ?? false)) {
9671
9845
  info("cancelled");
9672
9846
  process.exitCode = 1;
9673
9847
  return;
9674
9848
  }
9675
- const sub = await spin(`releasing ${subdomain}\u2026`, client.releaseClusterSubdomain(cluster, subdomain));
9676
- info(`${color.green("\u2713")} ${sub.url.replace(/^https:\/\//, "")} no longer reaches cluster ${color.bold(cluster)}`);
9849
+ const sub = await spin(`releasing ${subdomain}\u2026`, client.releaseClusterSubdomain(cluster2, subdomain));
9850
+ info(`${color.green("\u2713")} ${sub.url.replace(/^https:\/\//, "")} no longer reaches cluster ${color.bold(cluster2)}`);
9677
9851
  } finally {
9678
9852
  await client.close();
9679
9853
  }
9680
9854
  });
9681
9855
 
9682
9856
  // src/commands/k8s/proxy/index.ts
9683
- var proxyCommand2 = new Command122("proxy").description("a cluster's HTTPS addresses, https://<name>.kvbox.app: claim one, list them, give one up").addCommand(claimCommand2).addCommand(lsCommand19).addCommand(releaseCommand2);
9857
+ var proxyCommand2 = new Command124("proxy").description("a cluster's HTTPS addresses, https://<name>.kvbox.app: claim one, list them, give one up").addCommand(claimCommand2).addCommand(lsCommand19).addCommand(releaseCommand2);
9684
9858
 
9685
9859
  // src/commands/k8s/rm.ts
9686
- import { Command as Command123 } from "commander";
9687
- var rmCommand17 = new Command123("rm").alias("remove").description("delete a cluster with everything running in it").argument("<name>", "cluster name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
9860
+ import { Command as Command125 } from "commander";
9861
+ var rmCommand17 = new Command125("rm").alias("remove").description("delete a cluster with everything running in it").argument("<name>", "cluster name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
9688
9862
  const client = await k8sClient(cmd);
9689
9863
  try {
9690
9864
  if (!await confirm(`Delete cluster ${name} with everything running in it?`, opts.yes ?? false)) {
@@ -9699,9 +9873,37 @@ var rmCommand17 = new Command123("rm").alias("remove").description("delete a clu
9699
9873
  }
9700
9874
  });
9701
9875
 
9876
+ // src/commands/k8s/rotate.ts
9877
+ import { Command as Command126 } from "commander";
9878
+ var ROTATE_WAIT_MS = 30 * 6e4;
9879
+ var rotateCommand = new Command126("rotate").description("give a cluster new credentials: every kubeconfig handed out so far stops working").argument("<cluster>", "cluster name").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the master and the nodes to restart").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9880
+ const client = await k8sClient(cmd);
9881
+ try {
9882
+ if (!await confirm(`Give cluster ${name} new credentials? Every kubeconfig handed out so far stops working, and its master, then its nodes, restart: apps on it are down for a few minutes.`, opts.yes ?? false)) {
9883
+ info("cancelled");
9884
+ process.exitCode = 1;
9885
+ return;
9886
+ }
9887
+ const changed = await spin(`storing new credentials in ${name}\u2026`, client.rotateCluster(name));
9888
+ const ours = changed.operation?.since;
9889
+ const waitMs = process.env["KVBOX_K8S_WAIT_MS"] !== void 0 ? readyWait() : ROTATE_WAIT_MS;
9890
+ const refused2 = (err) => !(err instanceof CallError) || err.status >= 400 && err.status < 500;
9891
+ const now = opts.wait && ours !== void 0 ? await spin("restarting its master, then its nodes\u2026", untilReady(client, name, changed, waitMs, void 0, (c2) => c2.operation === void 0 || c2.operation.since !== ours, refused2)) : changed;
9892
+ if (opts.json) json(now);
9893
+ failIfNot(now, void 0, opts.wait ? changed.operation : void 0);
9894
+ if (opts.json) return;
9895
+ const shown = shownName2(now, client);
9896
+ if (now.operation !== void 0) info(`cluster ${shown} is taking its new credentials: its master and nodes are still restarting; look again with: kvbox k8s info ${shown}`);
9897
+ else info(`${color.green("\u2713")} cluster ${shown} has new credentials; every kubeconfig from before is refused`);
9898
+ info(color.dim(` next: kvbox k8s kubeconfig ${shown} > ${now.name}.yaml`));
9899
+ } finally {
9900
+ await client.close();
9901
+ }
9902
+ });
9903
+
9702
9904
  // src/commands/k8s/start.ts
9703
- import { Command as Command124 } from "commander";
9704
- var startCommand2 = new Command124("start").description("run a cluster's master and nodes again after they stopped").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9905
+ import { Command as Command127 } from "commander";
9906
+ var startCommand2 = new Command127("start").description("run a cluster's master and nodes again after they stopped").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9705
9907
  const client = await k8sClient(cmd);
9706
9908
  try {
9707
9909
  const c2 = await spin(`starting cluster ${name}\u2026`, client.startCluster(name));
@@ -9713,29 +9915,29 @@ var startCommand2 = new Command124("start").description("run a cluster's master
9713
9915
  });
9714
9916
 
9715
9917
  // src/commands/k8s/unlink.ts
9716
- import { Command as Command125 } from "commander";
9717
- var unlinkCommand2 = new Command125("unlink").description("take a cluster's link away (kvbox k8s link)").argument("<cluster>", "cluster name").argument("<target>", "the database or box it reaches").option("-p, --port <port>", "the port, when the cluster reaches several of that box's").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed link as JSON").action(async (cluster, target, opts, cmd) => {
9918
+ import { Command as Command128 } from "commander";
9919
+ var unlinkCommand2 = new Command128("unlink").description("take a cluster's link away (kvbox k8s link)").argument("<cluster>", "cluster name").argument("<target>", "the database or box it reaches").option("-p, --port <port>", "the port, when the cluster reaches several of that box's").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed link as JSON").action(async (cluster2, target, opts, cmd) => {
9718
9920
  const port = opts.port === void 0 ? void 0 : parseLinkPort(opts.port);
9719
- if (!await confirm(`Cut cluster ${cluster} off from ${target}${port !== void 0 ? ` port ${port}` : ""}? Its pods' open connections close too.`, opts.yes ?? false)) {
9921
+ if (!await confirm(`Cut cluster ${cluster2} off from ${target}${port !== void 0 ? ` port ${port}` : ""}? Its pods' open connections close too.`, opts.yes ?? false)) {
9720
9922
  info("cancelled");
9721
9923
  process.exitCode = 1;
9722
9924
  return;
9723
9925
  }
9724
9926
  const client = await k8sClient(cmd);
9725
9927
  try {
9726
- const link2 = await spin(`unlinking ${cluster} from ${target}\u2026`, client.unlinkCluster(cluster, { to: target, ...port !== void 0 ? { port } : {} }));
9928
+ const link2 = await spin(`unlinking ${cluster2} from ${target}\u2026`, client.unlinkCluster(cluster2, { to: target, ...port !== void 0 ? { port } : {} }));
9727
9929
  if (opts.json) {
9728
- json(linkJson(link2, cluster));
9930
+ json(linkJson(link2, cluster2));
9729
9931
  return;
9730
9932
  }
9731
- info(`${color.green("\u2713")} cluster ${color.bold(cluster)} no longer reaches ${reachedText(link2)} port ${link2.port}`);
9933
+ info(`${color.green("\u2713")} cluster ${color.bold(cluster2)} no longer reaches ${reachedText(link2)} port ${link2.port}`);
9732
9934
  } finally {
9733
9935
  await client.close();
9734
9936
  }
9735
9937
  });
9736
9938
 
9737
9939
  // src/commands/k8s/index.ts
9738
- var k8sCommand = new Command126("k8s").description("Kubernetes clusters kvbox runs for you").addCommand(createCommand10).addCommand(lsCommand17).addCommand(infoCommand2).addCommand(kubeconfigCommand).addCommand(poolCommand).addCommand(proxyCommand2).addCommand(domainCommand).addCommand(linkCommand2).addCommand(unlinkCommand2).addCommand(linksCommand2).addCommand(backupCommand4).addCommand(startCommand2).addCommand(rmCommand17);
9940
+ var k8sCommand = new Command129("k8s").description("Kubernetes clusters kvbox runs for you").addCommand(createCommand10).addCommand(lsCommand17).addCommand(infoCommand2).addCommand(kubeconfigCommand).addCommand(poolCommand).addCommand(nodeCommand).addCommand(proxyCommand2).addCommand(domainCommand).addCommand(linkCommand2).addCommand(unlinkCommand2).addCommand(linksCommand2).addCommand(backupCommand4).addCommand(startCommand2).addCommand(rotateCommand).addCommand(rmCommand17);
9739
9941
  var withOrg3 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal clusters)");
9740
9942
  for (const cmd of k8sCommand.commands) {
9741
9943
  if (cmd.commands.length > 0) cmd.commands.forEach(withOrg3);
@@ -9743,10 +9945,10 @@ for (const cmd of k8sCommand.commands) {
9743
9945
  }
9744
9946
 
9745
9947
  // src/commands/cron/index.ts
9746
- import { Command as Command139 } from "commander";
9948
+ import { Command as Command142 } from "commander";
9747
9949
 
9748
9950
  // src/commands/cron/create.ts
9749
- import { Command as Command127 } from "commander";
9951
+ import { Command as Command130 } from "commander";
9750
9952
 
9751
9953
  // src/commands/cron/shared.ts
9752
9954
  async function cronClient(cmd) {
@@ -9807,7 +10009,7 @@ function printRows3(rows2) {
9807
10009
  var noTriggers = (service) => info(`cron service ${service} has no triggers yet; add one with: kvbox cron trigger add ${service} <box> "0 6 * * *" --port 3000 (or --run "<command>")`);
9808
10010
 
9809
10011
  // src/commands/cron/create.ts
9810
- var createCommand11 = new Command127("create").description("make a cron service: a named set of triggers").argument("<name>", "what to call it (lowercase letters, digits and '-')").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10012
+ var createCommand11 = new Command130("create").description("make a cron service: a named set of triggers").argument("<name>", "what to call it (lowercase letters, digits and '-')").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9811
10013
  const client = await cronClient(cmd);
9812
10014
  try {
9813
10015
  const service = await client.createCronService(name);
@@ -9824,8 +10026,8 @@ var createCommand11 = new Command127("create").description("make a cron service:
9824
10026
  });
9825
10027
 
9826
10028
  // src/commands/cron/info.ts
9827
- import { Command as Command128 } from "commander";
9828
- var infoCommand3 = new Command128("info").alias("get").description("show a cron service and its triggers").argument("<name>", "cron service name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10029
+ import { Command as Command131 } from "commander";
10030
+ var infoCommand3 = new Command131("info").alias("get").description("show a cron service and its triggers").argument("<name>", "cron service name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9829
10031
  const client = await cronClient(cmd);
9830
10032
  try {
9831
10033
  const service = await client.getCronService(name);
@@ -9849,8 +10051,8 @@ var infoCommand3 = new Command128("info").alias("get").description("show a cron
9849
10051
  });
9850
10052
 
9851
10053
  // src/commands/cron/ls.ts
9852
- import { Command as Command129 } from "commander";
9853
- var lsCommand20 = new Command129("ls").alias("list").description("list cron services").option("-a, --all", "every cron service on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10054
+ import { Command as Command132 } from "commander";
10055
+ var lsCommand20 = new Command132("ls").alias("list").description("list cron services").option("-a, --all", "every cron service on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
9854
10056
  const client = await cronClient(cmd);
9855
10057
  try {
9856
10058
  const services = await client.listCronServices({ all: opts.all });
@@ -9870,8 +10072,8 @@ var lsCommand20 = new Command129("ls").alias("list").description("list cron serv
9870
10072
  });
9871
10073
 
9872
10074
  // src/commands/cron/rm.ts
9873
- import { Command as Command130 } from "commander";
9874
- var rmCommand18 = new Command130("rm").alias("remove").description("delete a cron service, its triggers and their run history").argument("<name>", "cron service name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10075
+ import { Command as Command133 } from "commander";
10076
+ var rmCommand18 = new Command133("rm").alias("remove").description("delete a cron service, its triggers and their run history").argument("<name>", "cron service name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
9875
10077
  const client = await cronClient(cmd);
9876
10078
  try {
9877
10079
  if (!await confirm(`Delete cron service ${name}? Its triggers stop firing and their run history is deleted.`, opts.yes ?? false)) {
@@ -9887,10 +10089,10 @@ var rmCommand18 = new Command130("rm").alias("remove").description("delete a cro
9887
10089
  });
9888
10090
 
9889
10091
  // src/commands/cron/trigger/index.ts
9890
- import { Command as Command138 } from "commander";
10092
+ import { Command as Command141 } from "commander";
9891
10093
 
9892
10094
  // src/commands/cron/trigger/add.ts
9893
- import { Command as Command131 } from "commander";
10095
+ import { Command as Command134 } from "commander";
9894
10096
  function portOf(value) {
9895
10097
  const n2 = Number(value);
9896
10098
  if (!Number.isInteger(n2) || n2 < 1 || n2 > 65535) throw new KvboxError(`--port ${value}: a port is a number from 1 to 65535`);
@@ -9910,7 +10112,7 @@ function timeoutOf(value) {
9910
10112
  if (sec > MAX_CRON_COMMAND_TIMEOUT_SEC) throw new KvboxError(`--timeout ${value}: a command may run for ${MAX_CRON_COMMAND_TIMEOUT_SEC / 60} minutes at most`);
9911
10113
  return sec;
9912
10114
  }
9913
- var addCommand5 = new Command131("add").description("add a trigger: on a schedule, call a port of a box or run a command in it").argument("<service>", "cron service name").argument("<box>", "the box it acts on").argument("<expr>", 'cron expression in quotes, five fields: "0 6 * * *" is every day at 06:00').option("--port <n>", "call this port, the one your app listens on in the box").option("--path <path>", "with --port: path and query to request (default: /)").option("--method <method>", `with --port: HTTP method, ${CRON_METHODS.join(" or ")} (default: POST)`).option("--run <command>", 'or run this command in the box, in quotes: "node ~/app/embed.js"').option("--timeout <duration>", `with --run: stop the command after this long (90s, 10m, 1h; default: ${DEFAULT_CRON_COMMAND_TIMEOUT_SEC / 60}m)`).option("--tz <zone>", "time zone the schedule is read in, like Europe/Bucharest", "UTC").option("--json", "print as JSON").action(async (service, box2, expr, opts, cmd) => {
10115
+ var addCommand5 = new Command134("add").description("add a trigger: on a schedule, call a port of a box or run a command in it").argument("<service>", "cron service name").argument("<box>", "the box it acts on").argument("<expr>", 'cron expression in quotes, five fields: "0 6 * * *" is every day at 06:00').option("--port <n>", "call this port, the one your app listens on in the box").option("--path <path>", "with --port: path and query to request (default: /)").option("--method <method>", `with --port: HTTP method, ${CRON_METHODS.join(" or ")} (default: POST)`).option("--run <command>", 'or run this command in the box, in quotes: "node ~/app/embed.js"').option("--timeout <duration>", `with --run: stop the command after this long (90s, 10m, 1h; default: ${DEFAULT_CRON_COMMAND_TIMEOUT_SEC / 60}m)`).option("--tz <zone>", "time zone the schedule is read in, like Europe/Bucharest", "UTC").option("--json", "print as JSON").action(async (service, box2, expr, opts, cmd) => {
9914
10116
  let action;
9915
10117
  if (opts.run !== void 0) {
9916
10118
  if (opts.port !== void 0 || opts.path !== void 0 || opts.method !== void 0) throw new KvboxError("a trigger runs a command or calls a port: use --run, or --port with --path and --method, not both");
@@ -9937,8 +10139,8 @@ var addCommand5 = new Command131("add").description("add a trigger: on a schedul
9937
10139
  });
9938
10140
 
9939
10141
  // src/commands/cron/trigger/ls.ts
9940
- import { Command as Command132 } from "commander";
9941
- var lsCommand21 = new Command132("ls").alias("list").description("list a cron service's triggers").argument("<service>", "cron service name").option("--json", "print as JSON").action(async (service, opts, cmd) => {
10142
+ import { Command as Command135 } from "commander";
10143
+ var lsCommand21 = new Command135("ls").alias("list").description("list a cron service's triggers").argument("<service>", "cron service name").option("--json", "print as JSON").action(async (service, opts, cmd) => {
9942
10144
  const client = await cronClient(cmd);
9943
10145
  try {
9944
10146
  const triggers = await client.listCronTriggers(service);
@@ -9954,8 +10156,8 @@ var lsCommand21 = new Command132("ls").alias("list").description("list a cron se
9954
10156
  });
9955
10157
 
9956
10158
  // src/commands/cron/trigger/pause.ts
9957
- import { Command as Command133 } from "commander";
9958
- var pauseCommand2 = new Command133("pause").description("stop a trigger from firing until it is resumed").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10159
+ import { Command as Command136 } from "commander";
10160
+ var pauseCommand2 = new Command136("pause").description("stop a trigger from firing until it is resumed").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
9959
10161
  const client = await cronClient(cmd);
9960
10162
  try {
9961
10163
  const trigger = await client.setCronTriggerEnabled(service, id, false);
@@ -9970,8 +10172,8 @@ var pauseCommand2 = new Command133("pause").description("stop a trigger from fir
9970
10172
  });
9971
10173
 
9972
10174
  // src/commands/cron/trigger/resume.ts
9973
- import { Command as Command134 } from "commander";
9974
- var resumeCommand2 = new Command134("resume").description("let a paused trigger fire again").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10175
+ import { Command as Command137 } from "commander";
10176
+ var resumeCommand2 = new Command137("resume").description("let a paused trigger fire again").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
9975
10177
  const client = await cronClient(cmd);
9976
10178
  try {
9977
10179
  const trigger = await client.setCronTriggerEnabled(service, id, true);
@@ -9986,8 +10188,8 @@ var resumeCommand2 = new Command134("resume").description("let a paused trigger
9986
10188
  });
9987
10189
 
9988
10190
  // src/commands/cron/trigger/rm.ts
9989
- import { Command as Command135 } from "commander";
9990
- var rmCommand19 = new Command135("rm").alias("remove").description("delete a trigger and its run history").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-y, --yes", "do not ask for confirmation").action(async (service, id, opts, cmd) => {
10191
+ import { Command as Command138 } from "commander";
10192
+ var rmCommand19 = new Command138("rm").alias("remove").description("delete a trigger and its run history").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-y, --yes", "do not ask for confirmation").action(async (service, id, opts, cmd) => {
9991
10193
  const client = await cronClient(cmd);
9992
10194
  try {
9993
10195
  if (!await confirm(`Delete trigger ${id} of cron service ${service}? Its run history is deleted too.`, opts.yes ?? false)) {
@@ -10003,8 +10205,8 @@ var rmCommand19 = new Command135("rm").alias("remove").description("delete a tri
10003
10205
  });
10004
10206
 
10005
10207
  // src/commands/cron/trigger/run.ts
10006
- import { Command as Command136 } from "commander";
10007
- var runCommand = new Command136("run").description("fire a trigger now, once, besides its schedule").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10208
+ import { Command as Command139 } from "commander";
10209
+ var runCommand = new Command139("run").description("fire a trigger now, once, besides its schedule").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10008
10210
  const client = await cronClient(cmd);
10009
10211
  try {
10010
10212
  const trigger = await client.runCronTrigger(service, id);
@@ -10020,13 +10222,13 @@ var runCommand = new Command136("run").description("fire a trigger now, once, be
10020
10222
  });
10021
10223
 
10022
10224
  // src/commands/cron/trigger/runs.ts
10023
- import { Command as Command137 } from "commander";
10225
+ import { Command as Command140 } from "commander";
10024
10226
  function limitOf(value) {
10025
10227
  const n2 = Number(value);
10026
10228
  if (!Number.isInteger(n2) || n2 < 1) throw new KvboxError(`-n ${value}: a number of runs, 1 or more`);
10027
10229
  return n2;
10028
10230
  }
10029
- var runsCommand = new Command137("runs").aliases(["logs"]).description("show how a trigger's last runs ended").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-n, --limit <count>", "how many runs to show", "20").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10231
+ var runsCommand = new Command140("runs").aliases(["logs"]).description("show how a trigger's last runs ended").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-n, --limit <count>", "how many runs to show", "20").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10030
10232
  const limit = limitOf(opts.limit);
10031
10233
  const client = await cronClient(cmd);
10032
10234
  try {
@@ -10056,10 +10258,10 @@ var runsCommand = new Command137("runs").aliases(["logs"]).description("show how
10056
10258
  });
10057
10259
 
10058
10260
  // src/commands/cron/trigger/index.ts
10059
- var triggerCommand = new Command138("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand5).addCommand(lsCommand21).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand19);
10261
+ var triggerCommand = new Command141("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand5).addCommand(lsCommand21).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand19);
10060
10262
 
10061
10263
  // src/commands/cron/index.ts
10062
- var cronCommand = new Command139("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand11).addCommand(lsCommand20).addCommand(infoCommand3).addCommand(rmCommand18).addCommand(triggerCommand);
10264
+ var cronCommand = new Command142("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand11).addCommand(lsCommand20).addCommand(infoCommand3).addCommand(rmCommand18).addCommand(triggerCommand);
10063
10265
  var withOrg4 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal cron services)");
10064
10266
  for (const cmd of cronCommand.commands) {
10065
10267
  if (cmd === triggerCommand) cmd.commands.forEach(withOrg4);
@@ -10067,13 +10269,13 @@ for (const cmd of cronCommand.commands) {
10067
10269
  }
10068
10270
 
10069
10271
  // src/commands/managed/kind.ts
10070
- import { Command as Command158 } from "commander";
10272
+ import { Command as Command161 } from "commander";
10071
10273
 
10072
10274
  // src/commands/managed/backup/index.ts
10073
- import { Command as Command146 } from "commander";
10275
+ import { Command as Command149 } from "commander";
10074
10276
 
10075
10277
  // src/commands/managed/backup/create.ts
10076
- import { Command as Command141 } from "commander";
10278
+ import { Command as Command144 } from "commander";
10077
10279
 
10078
10280
  // src/commands/managed/shared.ts
10079
10281
  import "commander";
@@ -10160,7 +10362,7 @@ function parseStorage(text2, flag) {
10160
10362
  }
10161
10363
 
10162
10364
  // src/commands/managed/backup/create.ts
10163
- var createCommand12 = (spec) => new Command141("create").description("back up a database to the kvbox cloud (encrypted)").argument("<db>", "its name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
10365
+ var createCommand12 = (spec) => new Command144("create").description("back up a database to the kvbox cloud (encrypted)").argument("<db>", "its name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
10164
10366
  const client = await managedClient(cmd);
10165
10367
  const ls = `kvbox ${spec.command} backup ls ${name}`;
10166
10368
  try {
@@ -10187,7 +10389,7 @@ var createCommand12 = (spec) => new Command141("create").description("back up a
10187
10389
  });
10188
10390
 
10189
10391
  // src/commands/managed/backup/ls.ts
10190
- import { Command as Command142 } from "commander";
10392
+ import { Command as Command145 } from "commander";
10191
10393
  var lsCommand22 = (spec) => {
10192
10394
  const removedOnes = async (err, name, client) => {
10193
10395
  if (!(err instanceof CallError && err.status === 404)) throw err;
@@ -10196,7 +10398,7 @@ var lsCommand22 = (spec) => {
10196
10398
  const own = name.includes("/") ? [] : gone.filter((b) => b.owner === me(client));
10197
10399
  return own.length > 0 ? own : gone;
10198
10400
  };
10199
- return new Command142("ls").alias("list").description("list backups: every database's, or one database's").argument("[db]", "its name (default: every database)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10401
+ return new Command145("ls").alias("list").description("list backups: every database's, or one database's").argument("[db]", "its name (default: every database)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10200
10402
  const client = await managedClient(cmd);
10201
10403
  try {
10202
10404
  const list = name === void 0 ? await client.listManagedBackups(spec.kind) : await client.managedBackups(spec.kind, name).catch((err) => removedOnes(err, name, client));
@@ -10239,8 +10441,8 @@ var lsCommand22 = (spec) => {
10239
10441
  };
10240
10442
 
10241
10443
  // src/commands/managed/backup/restore.ts
10242
- import { Command as Command143 } from "commander";
10243
- var restoreCommand5 = (spec) => new Command143("restore").description("put a backup back: the database's data becomes the backup's (it restarts)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").option("--json", "print the database as JSON").action(async (name, id, opts, cmd) => {
10444
+ import { Command as Command146 } from "commander";
10445
+ var restoreCommand5 = (spec) => new Command146("restore").description("put a backup back: the database's data becomes the backup's (it restarts)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").option("--json", "print the database as JSON").action(async (name, id, opts, cmd) => {
10244
10446
  const client = await managedClient(cmd);
10245
10447
  try {
10246
10448
  const backup = await client.managedBackup(spec.kind, name, id);
@@ -10262,8 +10464,8 @@ var restoreCommand5 = (spec) => new Command143("restore").description("put a bac
10262
10464
  });
10263
10465
 
10264
10466
  // src/commands/managed/backup/rm.ts
10265
- import { Command as Command144 } from "commander";
10266
- var rmCommand20 = (spec) => new Command144("rm").alias("remove").description("remove a backup for good (a database's that is gone too)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
10467
+ import { Command as Command147 } from "commander";
10468
+ var rmCommand20 = (spec) => new Command147("rm").alias("remove").description("remove a backup for good (a database's that is gone too)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
10267
10469
  const client = await managedClient(cmd);
10268
10470
  try {
10269
10471
  await removeListed(client, await client.listManagedBackups(spec.kind), (b) => b.name, name, id, `database ${name}`, opts.yes ?? false);
@@ -10273,8 +10475,8 @@ var rmCommand20 = (spec) => new Command144("rm").alias("remove").description("re
10273
10475
  });
10274
10476
 
10275
10477
  // src/commands/managed/backup/schedule.ts
10276
- import { Command as Command145 } from "commander";
10277
- var scheduleCommand5 = (spec) => scheduleFlags(new Command145("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
10478
+ import { Command as Command148 } from "commander";
10479
+ var scheduleCommand5 = (spec) => scheduleFlags(new Command148("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
10278
10480
  async (name, flags, cmd) => {
10279
10481
  const change = changeOf(flags);
10280
10482
  const client = await managedClient(cmd);
@@ -10290,18 +10492,18 @@ var scheduleCommand5 = (spec) => scheduleFlags(new Command145("schedule").descri
10290
10492
 
10291
10493
  // src/commands/managed/backup/index.ts
10292
10494
  var backupCommand5 = (spec) => {
10293
- const command = new Command146("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
10495
+ const command = new Command149("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
10294
10496
  for (const make of [createCommand12, lsCommand22, restoreCommand5, rmCommand20, scheduleCommand5]) command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
10295
10497
  return command;
10296
10498
  };
10297
10499
 
10298
10500
  // src/commands/managed/create.ts
10299
- import { Command as Command147 } from "commander";
10501
+ import { Command as Command150 } from "commander";
10300
10502
  import { setTimeout as sleep5 } from "timers/promises";
10301
10503
  var READY_WAIT_MS2 = 9e4;
10302
10504
  var READY_STEP_MS = 2e3;
10303
10505
  var createCommand13 = (spec) => {
10304
- const command = new Command147("create").alias("new").description(`create a ${spec.title} database: a name is all it needs`).argument("<name>", "its name (1-12 chars, lowercase letters, digits and '-'); a linked box reaches it at <name>.<account>.kvbox");
10506
+ const command = new Command150("create").alias("new").description(`create a ${spec.title} database: a name is all it needs`).argument("<name>", "its name (1-12 chars, lowercase letters, digits and '-'); a linked box reaches it at <name>.<account>.kvbox");
10305
10507
  for (const o of spec.options) command.option(`--${o.name} <${o.arg}>`, o.help);
10306
10508
  return command.option("--password <password>", "its password (default: generated)").option("--storage <gb>", `storage for the data in GB (default: ${spec.storageGib}; it can grow later)`).option("--near <box>", "run it on the host of this box, so a link between them stays on that host").option("--from-backup <id>", `start it on this backup's data, a removed database's too (kvbox ${spec.command} backup ls)`).option("--json", "print it as JSON, password included").action(async (name, opts, cmd) => {
10307
10509
  const options = Object.fromEntries(spec.options.flatMap((o) => typeof opts[o.name] === "string" ? [[o.name, opts[o.name]]] : []));
@@ -10350,8 +10552,8 @@ var createCommand13 = (spec) => {
10350
10552
  };
10351
10553
 
10352
10554
  // src/commands/managed/grow.ts
10353
- import { Command as Command148 } from "commander";
10354
- var growCommand3 = (spec) => new Command148("grow").description("give a database more storage (it restarts once)").argument("<db>", "its name").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print as JSON").action(async (name, size, opts, cmd) => {
10555
+ import { Command as Command151 } from "commander";
10556
+ var growCommand3 = (spec) => new Command151("grow").description("give a database more storage (it restarts once)").argument("<db>", "its name").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print as JSON").action(async (name, size, opts, cmd) => {
10355
10557
  const storageGib = parseStorage(size, "size");
10356
10558
  const client = await managedClient(cmd);
10357
10559
  try {
@@ -10364,8 +10566,8 @@ var growCommand3 = (spec) => new Command148("grow").description("give a database
10364
10566
  });
10365
10567
 
10366
10568
  // src/commands/managed/info.ts
10367
- import { Command as Command149 } from "commander";
10368
- var infoCommand4 = (spec) => new Command149("info").alias("get").description("show one database: status, storage used, how to connect").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10569
+ import { Command as Command152 } from "commander";
10570
+ var infoCommand4 = (spec) => new Command152("info").alias("get").description("show one database: status, storage used, how to connect").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10369
10571
  const client = await managedClient(cmd);
10370
10572
  try {
10371
10573
  const m = await client.getManaged(spec.kind, name);
@@ -10377,8 +10579,8 @@ var infoCommand4 = (spec) => new Command149("info").alias("get").description("sh
10377
10579
  });
10378
10580
 
10379
10581
  // src/commands/managed/link.ts
10380
- import { Command as Command150 } from "commander";
10381
- var linkCommand3 = (spec) => new Command150("link").description("let a box reach a database privately").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10582
+ import { Command as Command153 } from "commander";
10583
+ var linkCommand3 = (spec) => new Command153("link").description("let a box reach a database privately").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10382
10584
  const client = await managedClient(cmd);
10383
10585
  try {
10384
10586
  const m = await spin(`linking ${box2} to ${name}\u2026`, client.linkManaged(spec.kind, name, box2));
@@ -10394,7 +10596,7 @@ var linkCommand3 = (spec) => new Command150("link").description("let a box reach
10394
10596
  });
10395
10597
 
10396
10598
  // src/commands/managed/ls.ts
10397
- import { Command as Command151 } from "commander";
10599
+ import { Command as Command154 } from "commander";
10398
10600
  function listRows(items, user, kindColumn) {
10399
10601
  return items.map((m) => ({
10400
10602
  owner: m.owner === user ? "private" : m.owner,
@@ -10408,7 +10610,7 @@ function listRows(items, user, kindColumn) {
10408
10610
  created: age(m.createdAt)
10409
10611
  }));
10410
10612
  }
10411
- var lsCommand23 = (spec) => new Command151("ls").alias("list").description(spec ? `list your ${spec.title} databases` : "list every managed database, whatever its kind").option("-a, --all", "every one on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10613
+ var lsCommand23 = (spec) => new Command154("ls").alias("list").description(spec ? `list your ${spec.title} databases` : "list every managed database, whatever its kind").option("-a, --all", "every one on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10412
10614
  const client = await managedClient(cmd);
10413
10615
  try {
10414
10616
  const items = await client.listManaged(spec?.kind, { all: opts.all });
@@ -10428,8 +10630,8 @@ var lsCommand23 = (spec) => new Command151("ls").alias("list").description(spec
10428
10630
  });
10429
10631
 
10430
10632
  // src/commands/managed/password.ts
10431
- import { Command as Command152 } from "commander";
10432
- var passwordCommand = (spec) => new Command152("password").description("show a database's password, or set a new one with --reset").argument("<db>", "its name").option("--reset", "make a new password; the old one stops working").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10633
+ import { Command as Command155 } from "commander";
10634
+ var passwordCommand = (spec) => new Command155("password").description("show a database's password, or set a new one with --reset").argument("<db>", "its name").option("--reset", "make a new password; the old one stops working").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10433
10635
  const client = await managedClient(cmd);
10434
10636
  try {
10435
10637
  const secret = opts.reset ? await spin(`setting a new password on ${name}\u2026`, client.resetManagedPassword(spec.kind, name)) : await client.managedPassword(spec.kind, name);
@@ -10445,8 +10647,8 @@ var passwordCommand = (spec) => new Command152("password").description("show a d
10445
10647
  });
10446
10648
 
10447
10649
  // src/commands/managed/public.ts
10448
- import { Command as Command153 } from "commander";
10449
- var publicCommand2 = (spec) => new Command153("public").description("open a database to the internet, or close it again").argument("<db>", "its name").argument("<state>", "on: reachable from anywhere with the password; off: only linked boxes").option("--json", "print as JSON").action(async (name, state, opts, cmd) => {
10650
+ import { Command as Command156 } from "commander";
10651
+ var publicCommand2 = (spec) => new Command156("public").description("open a database to the internet, or close it again").argument("<db>", "its name").argument("<state>", "on: reachable from anywhere with the password; off: only linked boxes").option("--json", "print as JSON").action(async (name, state, opts, cmd) => {
10450
10652
  if (state !== "on" && state !== "off") throw new KvboxError(`write on or off: kvbox ${spec.command} public ${name} on`);
10451
10653
  const client = await managedClient(cmd);
10452
10654
  try {
@@ -10467,8 +10669,8 @@ var publicCommand2 = (spec) => new Command153("public").description("open a data
10467
10669
  });
10468
10670
 
10469
10671
  // src/commands/managed/rm.ts
10470
- import { Command as Command154 } from "commander";
10471
- var rmCommand21 = (spec) => new Command154("rm").alias("remove").description("delete a database and all its data").argument("<db>", "its name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10672
+ import { Command as Command157 } from "commander";
10673
+ var rmCommand21 = (spec) => new Command157("rm").alias("remove").description("delete a database and all its data").argument("<db>", "its name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10472
10674
  const client = await managedClient(cmd);
10473
10675
  try {
10474
10676
  if (!await confirm(`Delete database ${name} and all its data? There is no backup.`, opts.yes ?? false)) {
@@ -10484,8 +10686,8 @@ var rmCommand21 = (spec) => new Command154("rm").alias("remove").description("de
10484
10686
  });
10485
10687
 
10486
10688
  // src/commands/managed/start.ts
10487
- import { Command as Command155 } from "commander";
10488
- var startCommand3 = (spec) => new Command155("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10689
+ import { Command as Command158 } from "commander";
10690
+ var startCommand3 = (spec) => new Command158("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10489
10691
  const client = await managedClient(cmd);
10490
10692
  try {
10491
10693
  const m = await spin(`starting ${name}\u2026`, client.startManaged(spec.kind, name));
@@ -10497,8 +10699,8 @@ var startCommand3 = (spec) => new Command155("start").description("run a stopped
10497
10699
  });
10498
10700
 
10499
10701
  // src/commands/managed/stop.ts
10500
- import { Command as Command156 } from "commander";
10501
- var stopCommand2 = (spec) => new Command156("stop").description("shut a database down, keeping its data (only its storage is charged)").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10702
+ import { Command as Command159 } from "commander";
10703
+ var stopCommand2 = (spec) => new Command159("stop").description("shut a database down, keeping its data (only its storage is charged)").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10502
10704
  const client = await managedClient(cmd);
10503
10705
  try {
10504
10706
  const m = await spin(`stopping ${name}\u2026`, client.stopManaged(spec.kind, name));
@@ -10510,8 +10712,8 @@ var stopCommand2 = (spec) => new Command156("stop").description("shut a database
10510
10712
  });
10511
10713
 
10512
10714
  // src/commands/managed/unlink.ts
10513
- import { Command as Command157 } from "commander";
10514
- var unlinkCommand3 = (spec) => new Command157("unlink").description("stop a box from reaching a database").argument("<db>", "the database").argument("<box>", "the box that was linked to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10715
+ import { Command as Command160 } from "commander";
10716
+ var unlinkCommand3 = (spec) => new Command160("unlink").description("stop a box from reaching a database").argument("<db>", "the database").argument("<box>", "the box that was linked to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10515
10717
  const client = await managedClient(cmd);
10516
10718
  try {
10517
10719
  const m = await spin(`unlinking ${box2} from ${name}\u2026`, client.unlinkManaged(spec.kind, name, box2));
@@ -10524,7 +10726,7 @@ var unlinkCommand3 = (spec) => new Command157("unlink").description("stop a box
10524
10726
 
10525
10727
  // src/commands/managed/kind.ts
10526
10728
  function kindCommand(spec, description) {
10527
- const command = new Command158(spec.command).aliases(spec.aliases).description(description);
10729
+ const command = new Command161(spec.command).aliases(spec.aliases).description(description);
10528
10730
  for (const make of [createCommand13, lsCommand23, infoCommand4, passwordCommand, publicCommand2, linkCommand3, unlinkCommand3, growCommand3, stopCommand2, startCommand3, rmCommand21]) {
10529
10731
  command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
10530
10732
  }
@@ -10539,14 +10741,14 @@ var pgCommand = kindCommand(POSTGRES2, "managed PostgreSQL: a database kvbox run
10539
10741
  var redisCommand = kindCommand(REDIS, "managed Redis (Valkey): a Redis kvbox runs for you, private until you link a box or make it public");
10540
10742
 
10541
10743
  // src/commands/managed/index.ts
10542
- import { Command as Command159 } from "commander";
10543
- var managedCommand = new Command159("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand23().option("--org <slug>", "act in this org (- for your personal databases)"));
10744
+ import { Command as Command162 } from "commander";
10745
+ var managedCommand = new Command162("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand23().option("--org <slug>", "act in this org (- for your personal databases)"));
10544
10746
 
10545
10747
  // src/commands/env/index.ts
10546
- import { Command as Command163 } from "commander";
10748
+ import { Command as Command166 } from "commander";
10547
10749
 
10548
10750
  // src/commands/env/ls.ts
10549
- import { Command as Command160 } from "commander";
10751
+ import { Command as Command163 } from "commander";
10550
10752
 
10551
10753
  // src/commands/env/shared.ts
10552
10754
  function requireCloud5(client) {
@@ -10573,7 +10775,7 @@ function firstBootHint(box2, name) {
10573
10775
  }
10574
10776
 
10575
10777
  // src/commands/env/ls.ts
10576
- var lsCommand24 = new Command160("ls").alias("list").description("list the variables (a secret shows as (sealed))").option("--box <box>", "what this box gets: its own variables and the ones it inherits").option("--json", "print as JSON").action(async (opts, cmd) => {
10778
+ var lsCommand24 = new Command163("ls").alias("list").description("list the variables (a secret shows as (sealed))").option("--box <box>", "what this box gets: its own variables and the ones it inherits").option("--json", "print as JSON").action(async (opts, cmd) => {
10577
10779
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10578
10780
  try {
10579
10781
  if (opts.box !== void 0) {
@@ -10612,8 +10814,8 @@ var lsCommand24 = new Command160("ls").alias("list").description("list the varia
10612
10814
  });
10613
10815
 
10614
10816
  // src/commands/env/rm.ts
10615
- import { Command as Command161 } from "commander";
10616
- var rmCommand22 = new Command161("rm").alias("remove").description("remove variables; boxes lose them when they next start").argument("<names...>", "variable names").option("-y, --yes", "do not ask for confirmation").option("--box <box>", "remove this box's own variables (yours, or the org's, of the same name come back)").option("--json", "print as JSON").action(async (names2, opts, cmd) => {
10817
+ import { Command as Command164 } from "commander";
10818
+ var rmCommand22 = new Command164("rm").alias("remove").description("remove variables; boxes lose them when they next start").argument("<names...>", "variable names").option("-y, --yes", "do not ask for confirmation").option("--box <box>", "remove this box's own variables (yours, or the org's, of the same name come back)").option("--json", "print as JSON").action(async (names2, opts, cmd) => {
10617
10819
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10618
10820
  try {
10619
10821
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
@@ -10650,8 +10852,8 @@ var rmCommand22 = new Command161("rm").alias("remove").description("remove varia
10650
10852
  });
10651
10853
 
10652
10854
  // src/commands/env/set.ts
10653
- import { Command as Command162 } from "commander";
10654
- var setCommand2 = new Command162("set").description("add or change a variable; boxes get it when they next start").argument("[name]", "variable name, e.g. DATABASE_URL (asked for when left out)").argument("[value]", "its value (asked for when left out; hidden with --secret)").option("--secret", "write-only: the value is never shown again, by any command").option("--box <box>", "this box's own variable, over yours (or the org's) of the same name").option("--json", "print as JSON").action(async (nameArg, valueArg, opts, cmd) => {
10855
+ import { Command as Command165 } from "commander";
10856
+ var setCommand2 = new Command165("set").description("add or change a variable; boxes get it when they next start").argument("[name]", "variable name, e.g. DATABASE_URL (asked for when left out)").argument("[value]", "its value (asked for when left out; hidden with --secret)").option("--secret", "write-only: the value is never shown again, by any command").option("--box <box>", "this box's own variable, over yours (or the org's) of the same name").option("--json", "print as JSON").action(async (nameArg, valueArg, opts, cmd) => {
10655
10857
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10656
10858
  try {
10657
10859
  const owner = opts.box === void 0 ? requireCloud5(client) : void 0;
@@ -10688,15 +10890,15 @@ var setCommand2 = new Command162("set").description("add or change a variable; b
10688
10890
  });
10689
10891
 
10690
10892
  // src/commands/env/index.ts
10691
- var envCommand = new Command163("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand24, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand22);
10893
+ var envCommand = new Command166("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand24, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand22);
10692
10894
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
10693
10895
 
10694
10896
  // src/commands/domain/index.ts
10695
- import { Command as Command167 } from "commander";
10897
+ import { Command as Command170 } from "commander";
10696
10898
 
10697
10899
  // src/commands/domain/add.ts
10698
- import { Command as Command164 } from "commander";
10699
- var addCommand6 = new Command164("add").description("serve a box at a domain of your own, https://<domain>, with its certificate made for you").argument("<domain>", "a domain you control, like example.com or app.example.com").argument("<box>", "box name").option("--port <port>", "the box port the domain serves (default: the port of its kvbox.app address)").option("--json", "print the domain as JSON").action(async (domainArg, name, opts, cmd) => {
10900
+ import { Command as Command167 } from "commander";
10901
+ var addCommand6 = new Command167("add").description("serve a box at a domain of your own, https://<domain>, with its certificate made for you").argument("<domain>", "a domain you control, like example.com or app.example.com").argument("<box>", "box name").option("--port <port>", "the box port the domain serves (default: the port of its kvbox.app address)").option("--json", "print the domain as JSON").action(async (domainArg, name, opts, cmd) => {
10700
10902
  const domain = assertDomain(domainArg.trim().toLowerCase());
10701
10903
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
10702
10904
  const client = await clientFor(cmd.optsWithGlobals());
@@ -10732,8 +10934,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
10732
10934
  });
10733
10935
 
10734
10936
  // src/commands/domain/ls.ts
10735
- import { Command as Command165 } from "commander";
10736
- var lsCommand25 = new Command165("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
10937
+ import { Command as Command168 } from "commander";
10938
+ var lsCommand25 = new Command168("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
10737
10939
  const client = await clientFor(cmd.optsWithGlobals());
10738
10940
  try {
10739
10941
  requireCloud4(client);
@@ -10762,8 +10964,8 @@ var lsCommand25 = new Command165("ls").alias("list").description("list your cust
10762
10964
  });
10763
10965
 
10764
10966
  // src/commands/domain/rm.ts
10765
- import { Command as Command166 } from "commander";
10766
- var rmCommand23 = new Command166("rm").alias("remove").description("stop serving a box at a custom domain").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (domainArg, opts, cmd) => {
10967
+ import { Command as Command169 } from "commander";
10968
+ var rmCommand23 = new Command169("rm").alias("remove").description("stop serving a box at a custom domain").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (domainArg, opts, cmd) => {
10767
10969
  const domain = domainArg.trim().toLowerCase();
10768
10970
  const client = await clientFor(cmd.optsWithGlobals());
10769
10971
  try {
@@ -10784,7 +10986,7 @@ var rmCommand23 = new Command166("rm").alias("remove").description("stop serving
10784
10986
  });
10785
10987
 
10786
10988
  // src/commands/domain/index.ts
10787
- var domainCommand2 = new Command167("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand6).addCommand(lsCommand25).addCommand(rmCommand23);
10989
+ var domainCommand2 = new Command170("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand6).addCommand(lsCommand25).addCommand(rmCommand23);
10788
10990
  for (const cmd of domainCommand2.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
10789
10991
 
10790
10992
  // src/commands/update.ts
@@ -10792,7 +10994,7 @@ import { spawn as spawn8 } from "child_process";
10792
10994
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
10793
10995
  import { tmpdir } from "os";
10794
10996
  import { join as join9 } from "path";
10795
- import { Command as Command168 } from "commander";
10997
+ import { Command as Command171 } from "commander";
10796
10998
 
10797
10999
  // src/update.ts
10798
11000
  import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
@@ -10911,7 +11113,7 @@ function run2(cmd, args) {
10911
11113
  child.on("exit", (code, signal) => resolve4(code ?? (signal ? 1 : 0)));
10912
11114
  });
10913
11115
  }
10914
- var selfUpdateCommand = new Command168("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
11116
+ var selfUpdateCommand = new Command171("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
10915
11117
  suppressUpdateNotice();
10916
11118
  const inst = installerFor(process.platform, process.env["KVBOX_INSTALL_URL"] || INSTALL_BASE);
10917
11119
  let code;
@@ -10935,7 +11137,7 @@ var selfUpdateCommand = new Command168("update").description("update kvbox to th
10935
11137
  import { chmod as chmod2, mkdir as mkdir4, readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
10936
11138
  import { homedir as homedir2 } from "os";
10937
11139
  import { dirname as dirname2, join as join11 } from "path";
10938
- import { Command as Command169 } from "commander";
11140
+ import { Command as Command172 } from "commander";
10939
11141
 
10940
11142
  // src/sshConfig.ts
10941
11143
  import { spawnSync as spawnSync4 } from "child_process";
@@ -11057,7 +11259,7 @@ async function forgetReplacedBox(alias, id, p) {
11057
11259
  }
11058
11260
 
11059
11261
  // src/commands/sshConfig.ts
11060
- var sshConfigCommand = new Command169("ssh-config").description("add your boxes to ~/.ssh/config, so ssh and VS Code Remote-SSH reach them as <box>.kvbox").argument("[box...]", "only these boxes, added to the ones listed already (default: every box)").option("--remove", "take these boxes off the list; with no box, take the whole kvbox block out").option("--file <path>", "the ssh config file to write (default: ~/.ssh/config)").option("--json", "print the result as JSON").action(async (boxes, opts, cmd) => {
11262
+ var sshConfigCommand = new Command172("ssh-config").description("add your boxes to ~/.ssh/config, so ssh and VS Code Remote-SSH reach them as <box>.kvbox").argument("[box...]", "only these boxes, added to the ones listed already (default: every box)").option("--remove", "take these boxes off the list; with no box, take the whole kvbox block out").option("--file <path>", "the ssh config file to write (default: ~/.ssh/config)").option("--json", "print the result as JSON").action(async (boxes, opts, cmd) => {
11061
11263
  const file = opts.file ?? join11(homedir2(), ".ssh", "config");
11062
11264
  const before = await readFile9(file, "utf8").catch((err) => {
11063
11265
  if (err.code === "ENOENT") return "";
@@ -11123,8 +11325,8 @@ async function aliasesOf(client, boxes, gone) {
11123
11325
 
11124
11326
  // src/commands/sshProxy.ts
11125
11327
  import { connect } from "net";
11126
- import { Command as Command170 } from "commander";
11127
- var sshProxyCommand = new Command170("ssh-proxy").description("connect ssh to a box (used by kvbox ssh-config)").argument("<host>", "the ssh name: <box>.kvbox or <box>.<org>.kvbox").option("--renew", "only renew the SSH certificate if it is about to expire").action(async (host, opts, cmd) => {
11328
+ import { Command as Command173 } from "commander";
11329
+ var sshProxyCommand = new Command173("ssh-proxy").description("connect ssh to a box (used by kvbox ssh-config)").argument("<host>", "the ssh name: <box>.kvbox or <box>.<org>.kvbox").option("--renew", "only renew the SSH certificate if it is about to expire").action(async (host, opts, cmd) => {
11128
11330
  const ref = parseAlias(host);
11129
11331
  if (ref === void 0) throw new KvboxError(`${host}: not a kvbox name (<box>.kvbox or <box>.<org>.kvbox)`);
11130
11332
  const client = await clientFor(cmd.optsWithGlobals());
@@ -11287,7 +11489,7 @@ function installRootHelp(program) {
11287
11489
 
11288
11490
  // src/program.ts
11289
11491
  function buildProgram() {
11290
- const program = new Command171("kvbox").description("self-hosted Firecracker microVMs with Docker-like ergonomics").version(VERSION, "-v, --version").option("--local", "use this machine's kvbox-server over its socket, ignoring kvbox login and KVBOX_TOKEN").option("--org <slug>", "the org: where kvbox new creates, and which box a name means when it is not one of yours; before the command here, or after it").showHelpAfterError().enablePositionalOptions();
11492
+ const program = new Command174("kvbox").description("self-hosted Firecracker microVMs with Docker-like ergonomics").version(VERSION, "-v, --version").option("--local", "use this machine's kvbox-server over its socket, ignoring kvbox login and KVBOX_TOKEN").option("--org <slug>", "the org: where kvbox new creates, and which box a name means when it is not one of yours; before the command here, or after it").showHelpAfterError().enablePositionalOptions();
11291
11493
  program.addCommand(vmCommand);
11292
11494
  program.addCommand(snapshotsCommand);
11293
11495
  program.addCommand(volumeCommand);