@kvbox/cli 0.5.36 → 0.5.37

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
@@ -149,7 +149,7 @@ async function spin(message, work, opts = {}) {
149
149
  }
150
150
 
151
151
  // src/program.ts
152
- import { Command as Command72 } from "commander";
152
+ import { Command as Command76 } from "commander";
153
153
 
154
154
  // ../shared/src/version.ts
155
155
  import { createRequire } from "module";
@@ -164,10 +164,10 @@ function versionOf(srcFileUrl, injected) {
164
164
  }
165
165
 
166
166
  // src/version.ts
167
- var VERSION = versionOf(import.meta.url, true ? "0.5.36" : void 0);
167
+ var VERSION = versionOf(import.meta.url, true ? "0.5.37" : void 0);
168
168
 
169
169
  // src/commands/vm/index.ts
170
- import { Command as Command33 } from "commander";
170
+ import { Command as Command37 } from "commander";
171
171
 
172
172
  // src/commands/vm/connect.ts
173
173
  import { spawnSync as spawnSync2 } from "child_process";
@@ -241,6 +241,8 @@ function paths(home = kvboxHome()) {
241
241
  env: join(dir, "env.json"),
242
242
  /** The box's writable layer, stacked on the read-only base image inside the guest. */
243
243
  overlay: join(dir, "overlay.ext4"),
244
+ /** A restore's disk while it downloads (a backup's chunks), renamed over `overlay` once complete. */
245
+ restoring: join(dir, "overlay.ext4.restore"),
244
246
  /**
245
247
  * The box's memory as of its last snapshot (a hard link to that snapshot's `mem`, never modified).
246
248
  * The next snapshot is a diff of the pages dirtied since, merged onto this. Absent after a boot.
@@ -279,6 +281,16 @@ function paths(home = kvboxHome()) {
279
281
  /** Each owner's environment variables as the control plane last sent them (#88): env/<owner>.json, mode 600. */
280
282
  env: join(home, "env"),
281
283
  ownerEnv: (owner) => join(home, "env", `${owner}.json`),
284
+ /**
285
+ * Backups in progress (decision "Backups: encrypted 4 MiB chunks in object storage"): backups/<id>/ holds the
286
+ * copy of the box's disk being uploaded and its chunk list, gone once the upload ends. Nothing here outlives
287
+ * a daemon restart.
288
+ */
289
+ backups: join(home, "backups"),
290
+ backup: (id) => {
291
+ const dir = join(home, "backups", id);
292
+ return { dir, disk: join(dir, "disk.ext4"), chunks: join(dir, "chunks.json") };
293
+ },
282
294
  snapshot: (owner, name) => {
283
295
  const dir = join(home, "snapshots", owner, name);
284
296
  return {
@@ -486,6 +498,52 @@ var WakeHookCallSchema = z2.object({
486
498
  action: z2.enum(["wake", "resume", "none"]),
487
499
  reason: z2.string().optional()
488
500
  });
501
+ var BACKUP_STATUSES = ["running", "ready", "failed"];
502
+ var BackupSchema = z2.object({
503
+ id: z2.string(),
504
+ owner: z2.string(),
505
+ box: z2.string(),
506
+ status: z2.enum(BACKUP_STATUSES),
507
+ /** Why it failed; null otherwise. */
508
+ error: z2.string().nullable(),
509
+ /** The image version the disk stacks on (a restore needs it on the host), and the image (absent: base). */
510
+ base: z2.string().nullable(),
511
+ image: z2.string().optional(),
512
+ vcpu: z2.number().int().nullable(),
513
+ memMib: z2.number().int().nullable(),
514
+ /** The disk's size. */
515
+ diskBytes: z2.number().int().nullable(),
516
+ /** What it holds: the slots that are not all zeros. */
517
+ dataBytes: z2.number().int().nullable(),
518
+ /** What this backup added to storage (encrypted, compressed): the chunks no earlier backup had. */
519
+ uploadedBytes: z2.number().int().nullable(),
520
+ createdBy: z2.string().nullable(),
521
+ createdAt: z2.string(),
522
+ finishedAt: z2.string().nullable()
523
+ });
524
+ var HostBackupRequest = z2.object({ id: z2.string(), key: z2.string() });
525
+ var HostBackupManifestSchema = z2.object({
526
+ id: z2.string(),
527
+ sizeBytes: z2.number().int(),
528
+ chunks: z2.array(z2.string().nullable()),
529
+ env: z2.string().nullable(),
530
+ base: z2.string(),
531
+ image: z2.string().optional(),
532
+ vcpu: z2.number().int(),
533
+ memMib: z2.number().int()
534
+ });
535
+ var HostUploadRequest = z2.object({ key: z2.string(), urls: z2.record(z2.string(), z2.string()) });
536
+ var HostUploadResultSchema = z2.object({ chunks: z2.number().int(), bytes: z2.number().int(), sizes: z2.record(z2.string(), z2.number().int()) });
537
+ var HostRestoreRequest = z2.object({
538
+ /** The backup's id: its variables were sealed under it. */
539
+ id: z2.string(),
540
+ key: z2.string(),
541
+ sizeBytes: z2.number().int().positive(),
542
+ base: z2.string(),
543
+ image: z2.string().optional(),
544
+ env: z2.string().nullable(),
545
+ chunks: z2.array(z2.object({ index: z2.number().int().nonnegative(), hash: z2.string(), url: z2.string() }))
546
+ });
489
547
  var MachineSchema = z2.object({
490
548
  /** Host-unique short id (the tap is `kv-<id>`). Missing only on a box made before ids that has not restarted since. */
491
549
  id: z2.string(),
@@ -1118,7 +1176,7 @@ var ServerClient = class {
1118
1176
  base;
1119
1177
  autoStart;
1120
1178
  startedOnce = false;
1121
- async call(method, path, schema, body, org = this.target.kind === "cloud" ? this.target.org : void 0) {
1179
+ async call(method, path, schema, body, org = this.target.kind === "cloud" ? this.target.org : void 0, timeoutMs) {
1122
1180
  const headers = {};
1123
1181
  if (body !== void 0) headers["content-type"] = "application/json";
1124
1182
  if (this.target.kind === "cloud" && this.target.token !== "") headers["authorization"] = `Bearer ${this.target.token}`;
@@ -1129,7 +1187,8 @@ var ServerClient = class {
1129
1187
  dispatcher: this.dispatcher,
1130
1188
  method,
1131
1189
  headers,
1132
- body: body === void 0 ? null : JSON.stringify(body)
1190
+ body: body === void 0 ? null : JSON.stringify(body),
1191
+ ...timeoutMs !== void 0 ? { headersTimeout: timeoutMs, bodyTimeout: timeoutMs } : {}
1133
1192
  });
1134
1193
  } catch (err) {
1135
1194
  const code = err.code ?? err.cause;
@@ -1137,7 +1196,7 @@ var ServerClient = class {
1137
1196
  if (this.autoStart && !this.startedOnce) {
1138
1197
  this.startedOnce = true;
1139
1198
  await spin("starting kvbox-server\u2026", startLocalServer(paths(), 5e3));
1140
- return this.call(method, path, schema, body);
1199
+ return this.call(method, path, schema, body, org, timeoutMs);
1141
1200
  }
1142
1201
  throw new KvboxError(`kvbox-server is not running (${String(code)}); start it with: kvbox server start`);
1143
1202
  }
@@ -1224,6 +1283,21 @@ var ServerClient = class {
1224
1283
  removeLink(name, req) {
1225
1284
  return this.call("DELETE", `/machines/${encodeURIComponent(name)}/links`, MachineSchema, req);
1226
1285
  }
1286
+ /** Backups, the control plane's only: a box's disk in object storage. Newest first. */
1287
+ boxBackups(name) {
1288
+ return this.call("GET", `/machines/${encodeURIComponent(name)}/backups`, z3.array(BackupSchema));
1289
+ }
1290
+ boxBackup(name, id) {
1291
+ return this.call("GET", `/machines/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}`, BackupSchema);
1292
+ }
1293
+ /** Starts one; it runs in the background (`running`), `boxBackup` says how it ended. */
1294
+ createBoxBackup(name) {
1295
+ return this.call("POST", `/machines/${encodeURIComponent(name)}/backups`, BackupSchema);
1296
+ }
1297
+ /** The box's disk becomes the backup's; a running box restarts. Waits for the whole download. */
1298
+ restoreBoxBackup(name, id) {
1299
+ return this.call("POST", `/machines/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}/restore`, MachineSchema, {}, void 0, 2 * 36e5);
1300
+ }
1227
1301
  /** Wake hooks (#101), the control plane's only: a URL and a secret that wake the box. */
1228
1302
  boxHooks(name) {
1229
1303
  return this.call("GET", `/machines/${encodeURIComponent(name)}/hooks`, z3.array(WakeHookSchema));
@@ -2575,9 +2649,136 @@ var rmCommand2 = new Command20("rm").alias("remove").description("remove a wake
2575
2649
  var hookCommand = new Command21("hook").description("URLs that wake a box when called (GitHub webhooks, cron, any automation)").addCommand(createCommand).addCommand(lsCommand3).addCommand(rmCommand2);
2576
2650
  for (const cmd of hookCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
2577
2651
 
2652
+ // src/commands/vm/backup/index.ts
2653
+ import { Command as Command25 } from "commander";
2654
+
2655
+ // src/commands/vm/backup/create.ts
2656
+ import { Command as Command22 } from "commander";
2657
+
2658
+ // src/commands/vm/backup/shared.ts
2659
+ import { setTimeout as sleep2 } from "timers/promises";
2660
+ function requireCloud3(client) {
2661
+ if (client.target.kind !== "cloud") throw new KvboxError("backups need the kvbox cloud: kvbox login (this host's own socket has none)");
2662
+ }
2663
+ var POLL_MS = 2e3;
2664
+ var POLL_TRIES = 30;
2665
+ var WAIT_MS = 7 * 36e5;
2666
+ async function untilDone(client, box, id, opts = {}) {
2667
+ const { pollMs = POLL_MS, tries = POLL_TRIES, waitMs = WAIT_MS } = opts;
2668
+ const until = Date.now() + waitMs;
2669
+ let failed = 0;
2670
+ for (; ; ) {
2671
+ try {
2672
+ const b = await client.boxBackup(box, id);
2673
+ if (b.status !== "running") return b;
2674
+ failed = 0;
2675
+ } catch (err) {
2676
+ failed += 1;
2677
+ if (failed >= tries) throw lostTrack(box, id, `could not ask how it is doing: ${err.message}`);
2678
+ }
2679
+ if (Date.now() >= until) throw lostTrack(box, id, "it is taking longer than a backup is given");
2680
+ await sleep2(pollMs);
2681
+ }
2682
+ }
2683
+ function lostTrack(box, id, why) {
2684
+ return new KvboxError(`stopped waiting for backup ${id} of box ${box} (${why}); it may still be running: kvbox vm backup ls ${box}`);
2685
+ }
2686
+ function sizeLine(b) {
2687
+ const data = b.dataBytes === null ? "?" : gb(b.dataBytes);
2688
+ const added = b.uploadedBytes === null ? "" : `, ${gb(b.uploadedBytes)} uploaded`;
2689
+ return `${data} of data${added}`;
2690
+ }
2691
+
2692
+ // src/commands/vm/backup/create.ts
2693
+ var createCommand2 = new Command22("create").description("back up a box's disk to the kvbox cloud (encrypted; memory and volumes not included)").argument("<box>", "box name").option("--no-wait", "start it and return; kvbox vm backup ls <box> shows when it is ready").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
2694
+ const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
2695
+ try {
2696
+ requireCloud3(client);
2697
+ const found = await findBox(client, name);
2698
+ const box = displayName(found, me(client));
2699
+ const started = await client.createBoxBackup(box);
2700
+ if (!opts.wait) {
2701
+ if (opts.json) json(started);
2702
+ else info(`${color.green("\u2713")} backup ${started.id} of box ${color.bold(box)} started; kvbox vm backup ls ${box} shows when it is ready`);
2703
+ return;
2704
+ }
2705
+ const done = await spin(`backing up ${box}\u2026`, untilDone(client, box, started.id));
2706
+ if (opts.json) json(done);
2707
+ if (done.status === "failed") throw new KvboxError(`backup ${done.id} of box ${box} failed: ${done.error ?? "no reason given"}`);
2708
+ if (opts.json) return;
2709
+ info(`${color.green("\u2713")} backup ${done.id} of box ${color.bold(box)}: ${sizeLine(done)}`);
2710
+ if ((found.volumes?.length ?? 0) > 0) info(color.dim(` not included: volume${found.volumes.length > 1 ? "s" : ""} ${found.volumes.map((v) => v.name).join(", ")}`));
2711
+ info(color.dim(` restore with: kvbox vm backup restore ${box} ${done.id}`));
2712
+ } finally {
2713
+ await client.close();
2714
+ }
2715
+ });
2716
+
2717
+ // src/commands/vm/backup/ls.ts
2718
+ import { Command as Command23 } from "commander";
2719
+ var lsCommand4 = new Command23("ls").alias("list").description("list a box's backups").argument("<box>", "box name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
2720
+ const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
2721
+ try {
2722
+ requireCloud3(client);
2723
+ const box = displayName(await findBox(client, name), me(client));
2724
+ const list = await client.boxBackups(box);
2725
+ if (opts.json) {
2726
+ json(list);
2727
+ return;
2728
+ }
2729
+ if (list.length === 0) {
2730
+ info(`box ${box} has no backups; make one with: kvbox vm backup create ${box}`);
2731
+ return;
2732
+ }
2733
+ table(
2734
+ list.map((b) => ({
2735
+ id: b.id,
2736
+ status: b.status === "ready" ? color.green(b.status) : b.status === "failed" ? color.red(b.status) : color.yellow(b.status),
2737
+ data: b.dataBytes === null ? "-" : gbShort(b.dataBytes),
2738
+ uploaded: b.uploadedBytes === null ? "-" : gbShort(b.uploadedBytes),
2739
+ disk: b.diskBytes === null ? "-" : gbShort(b.diskBytes),
2740
+ by: b.createdBy ?? "-",
2741
+ taken: age(b.createdAt),
2742
+ ...b.error !== null ? { error: b.error } : {}
2743
+ }))
2744
+ );
2745
+ } finally {
2746
+ await client.close();
2747
+ }
2748
+ });
2749
+
2750
+ // src/commands/vm/backup/restore.ts
2751
+ import { Command as Command24 } from "commander";
2752
+ var restoreCommand = new Command24("restore").description("put a backup back: the box's disk becomes the backup's (a running box restarts)").argument("<box>", "box name").argument("<id>", "the backup's id (kvbox vm backup ls <box>)").option("-y, --yes", "do not ask for confirmation").option("--json", "print the box as JSON").action(async (name, id, opts, cmd) => {
2753
+ const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
2754
+ try {
2755
+ requireCloud3(client);
2756
+ const box = displayName(await findBox(client, name), me(client));
2757
+ const backup = await client.boxBackup(box, id);
2758
+ const question = `Restore box ${box} from backup ${backup.id} (${age(backup.createdAt)} ago, ${sizeLine(backup)})? Everything written to its disk since is lost, and a running box restarts.`;
2759
+ if (!await confirm(question, opts.yes ?? false)) {
2760
+ info("cancelled");
2761
+ process.exitCode = 1;
2762
+ return;
2763
+ }
2764
+ const machine = await spin(`restoring ${box} from ${backup.id}\u2026`, client.restoreBoxBackup(box, id));
2765
+ if (opts.json) {
2766
+ json(machine);
2767
+ return;
2768
+ }
2769
+ info(`${color.green("\u2713")} box ${color.bold(box)} restored from backup ${backup.id}; it is ${machine.status}`);
2770
+ } finally {
2771
+ await client.close();
2772
+ }
2773
+ });
2774
+
2775
+ // src/commands/vm/backup/index.ts
2776
+ var backupCommand = new Command25("backup").description("back up a box's disk to the kvbox cloud, list backups, restore one").addCommand(createCommand2).addCommand(lsCommand4).addCommand(restoreCommand);
2777
+ for (const cmd of backupCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
2778
+
2578
2779
  // src/commands/vm/rescale.ts
2579
- import { Command as Command22, Option as Option3 } from "commander";
2580
- var rescaleCommand = new Command22("rescale").description("change a box's vCPUs, memory or disk (e.g. --vcpu 4 --mem 16GB); a running box restarts").argument("<name>", "box name").addOption(new Option3("-s, --size <size>", "a preset to start from").choices(SIZE_NAMES)).option("--vcpu <n>", "number of vCPUs").option("--mem <size>", "memory, e.g. 16GB or 4096MB").option("--disk <size>", "disk size, e.g. 32GB (grow only)").option("--force", "skip the capacity guard when a running box grows").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2780
+ import { Command as Command26, Option as Option3 } from "commander";
2781
+ var rescaleCommand = new Command26("rescale").description("change a box's vCPUs, memory or disk (e.g. --vcpu 4 --mem 16GB); a running box restarts").argument("<name>", "box name").addOption(new Option3("-s, --size <size>", "a preset to start from").choices(SIZE_NAMES)).option("--vcpu <n>", "number of vCPUs").option("--mem <size>", "memory, e.g. 16GB or 4096MB").option("--disk <size>", "disk size, e.g. 32GB (grow only)").option("--force", "skip the capacity guard when a running box grows").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2581
2782
  const req = {
2582
2783
  ...opts.size !== void 0 ? { size: opts.size } : {},
2583
2784
  ...opts.vcpu !== void 0 ? { vcpu: parseCount(opts.vcpu) } : {},
@@ -2623,8 +2824,8 @@ function parseGib(flag, text2) {
2623
2824
  }
2624
2825
 
2625
2826
  // src/commands/vm/resume.ts
2626
- import { Command as Command23 } from "commander";
2627
- var resumeCommand = new Command23("resume").description("continue a box that is in standby (kvbox pause)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2827
+ import { Command as Command27 } from "commander";
2828
+ var resumeCommand = new Command27("resume").description("continue a box that is in standby (kvbox pause)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2628
2829
  const client = await clientFor(cmd.optsWithGlobals());
2629
2830
  try {
2630
2831
  const box = await spin(`resuming ${name}\u2026`, client.resumeMachine(name));
@@ -2636,8 +2837,8 @@ var resumeCommand = new Command23("resume").description("continue a box that is
2636
2837
  });
2637
2838
 
2638
2839
  // src/commands/vm/rm.ts
2639
- import { Command as Command24 } from "commander";
2640
- var rmCommand3 = new Command24("rm").description("destroy a box (its disk is deleted; snapshots are kept)").argument("<name>", "box name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
2840
+ import { Command as Command28 } from "commander";
2841
+ var rmCommand3 = new Command28("rm").description("destroy a box (its disk is deleted; snapshots are kept)").argument("<name>", "box name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
2641
2842
  const client = await clientFor(cmd.optsWithGlobals());
2642
2843
  try {
2643
2844
  const box = pickRef(await boxesFor(client, name), name, me(client));
@@ -2657,7 +2858,7 @@ var rmCommand3 = new Command24("rm").description("destroy a box (its disk is del
2657
2858
  });
2658
2859
 
2659
2860
  // src/commands/vm/set.ts
2660
- import { Command as Command25 } from "commander";
2861
+ import { Command as Command29 } from "commander";
2661
2862
 
2662
2863
  // src/swap.ts
2663
2864
  import { spawn as spawn3 } from "child_process";
@@ -2733,7 +2934,7 @@ function runSwap(ep, mib) {
2733
2934
  }
2734
2935
 
2735
2936
  // src/commands/vm/set.ts
2736
- var setCommand = new Command25("set").description("change a box's settings, e.g. --auto-hibernate 30m (off: never), --idle-check /home/kvbox/idle.sh, --swap 2G").argument("<name>", "box name").option("--auto-hibernate <duration>", "hibernate the box after this long without network traffic (30m, 4h, 1d; off: never)").option("--idle-check <script>", "a script in the box that exits 0 when it is idle, asked instead of network traffic (off: none)").option("--swap <size>", "a swap file on the box's disk for memory spikes such as a build (2G, 512M; off: none)").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2937
+ var setCommand = new Command29("set").description("change a box's settings, e.g. --auto-hibernate 30m (off: never), --idle-check /home/kvbox/idle.sh, --swap 2G").argument("<name>", "box name").option("--auto-hibernate <duration>", "hibernate the box after this long without network traffic (30m, 4h, 1d; off: never)").option("--idle-check <script>", "a script in the box that exits 0 when it is idle, asked instead of network traffic (off: none)").option("--swap <size>", "a swap file on the box's disk for memory spikes such as a build (2G, 512M; off: none)").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2737
2938
  if (opts.autoHibernate === void 0 && opts.idleCheck === void 0 && opts.swap === void 0) {
2738
2939
  throw new KvboxError("nothing to change: give --auto-hibernate, --idle-check or --swap");
2739
2940
  }
@@ -2802,8 +3003,8 @@ function parseIdleCheck(text2) {
2802
3003
  }
2803
3004
 
2804
3005
  // src/commands/vm/start.ts
2805
- import { Command as Command26 } from "commander";
2806
- var startCommand = new Command26("start").description("boot a stopped box again (same name, IP and disk)").argument("<name>", "box name").option("--force", "skip the capacity guard").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3006
+ import { Command as Command30 } from "commander";
3007
+ var startCommand = new Command30("start").description("boot a stopped box again (same name, IP and disk)").argument("<name>", "box name").option("--force", "skip the capacity guard").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2807
3008
  const client = await clientFor(cmd.optsWithGlobals());
2808
3009
  try {
2809
3010
  const box = await spin(`booting ${name}\u2026`, client.startMachine(name, opts.force ?? false));
@@ -2815,8 +3016,8 @@ var startCommand = new Command26("start").description("boot a stopped box again
2815
3016
  });
2816
3017
 
2817
3018
  // src/commands/vm/stop.ts
2818
- import { Command as Command27 } from "commander";
2819
- var stopCommand = new Command27("stop").description("shut a box down (its disk is kept; start it again with kvbox start)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3019
+ import { Command as Command31 } from "commander";
3020
+ var stopCommand = new Command31("stop").description("shut a box down (its disk is kept; start it again with kvbox start)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2820
3021
  const client = await clientFor(cmd.optsWithGlobals());
2821
3022
  try {
2822
3023
  const box = await spin(`shutting ${name} down\u2026`, client.stopMachine(name));
@@ -2828,8 +3029,8 @@ var stopCommand = new Command27("stop").description("shut a box down (its disk i
2828
3029
  });
2829
3030
 
2830
3031
  // src/commands/vm/top.ts
2831
- import { Command as Command28 } from "commander";
2832
- var topCommand = new Command28("top").description("load, memory and disk of each running box, as the box itself sees them").option("-a, --all", "every running box on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
3032
+ import { Command as Command32 } from "commander";
3033
+ var topCommand = new Command32("top").description("load, memory and disk of each running box, as the box itself sees them").option("-a, --all", "every running box on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
2833
3034
  const client = await clientFor(cmd.optsWithGlobals());
2834
3035
  try {
2835
3036
  const running = (await client.listMachines({ all: opts.all })).filter((b) => b.status === "running");
@@ -2889,8 +3090,8 @@ function topRows(entries, cloud) {
2889
3090
  }
2890
3091
 
2891
3092
  // src/commands/vm/unlink.ts
2892
- import { Command as Command29 } from "commander";
2893
- var unlinkCommand = new Command29("unlink").description("take a link away (kvbox vm link)").argument("<from>", "the box that connects").argument("<box>", "the box it reaches").requiredOption("-p, --port <port>", "the port in <box>").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed link as JSON").action(async (from, name, opts, cmd) => {
3093
+ import { Command as Command33 } from "commander";
3094
+ var unlinkCommand = new Command33("unlink").description("take a link away (kvbox vm link)").argument("<from>", "the box that connects").argument("<box>", "the box it reaches").requiredOption("-p, --port <port>", "the port in <box>").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed link as JSON").action(async (from, name, opts, cmd) => {
2894
3095
  const port = parseLinkPort(opts.port);
2895
3096
  if (!await confirm(`Cut box ${from} off from box ${name} port ${port}? Its open connections close too.`, opts.yes ?? false)) {
2896
3097
  info("cancelled");
@@ -2911,8 +3112,8 @@ var unlinkCommand = new Command29("unlink").description("take a link away (kvbox
2911
3112
  });
2912
3113
 
2913
3114
  // src/commands/vm/update.ts
2914
- import { Command as Command30 } from "commander";
2915
- var updateCommand = new Command30("update").description("move a box onto the current base image (its files stay; a running box restarts)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3115
+ import { Command as Command34 } from "commander";
3116
+ var updateCommand = new Command34("update").description("move a box onto the current base image (its files stay; a running box restarts)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2916
3117
  const client = await clientFor(cmd.optsWithGlobals());
2917
3118
  try {
2918
3119
  const before = pickRef(await boxesFor(client, name), name, me(client));
@@ -2934,8 +3135,8 @@ var updateCommand = new Command30("update").description("move a box onto the cur
2934
3135
  });
2935
3136
 
2936
3137
  // src/commands/vm/usage.ts
2937
- import { Command as Command31 } from "commander";
2938
- var usageCommand = new Command31("usage").description("how long a box ran, slept and sat stopped, as vCPU-hours, RAM and disk GiB-hours (and cost, when the host prices them)").argument("<name>", "box name").option("--since <date>", "count from this date instead of the box's creation, e.g. 2026-10-01").option("--json", "print as JSON").action(async (name, opts, cmd) => {
3138
+ import { Command as Command35 } from "commander";
3139
+ var usageCommand = new Command35("usage").description("how long a box ran, slept and sat stopped, as vCPU-hours, RAM and disk GiB-hours (and cost, when the host prices them)").argument("<name>", "box name").option("--since <date>", "count from this date instead of the box's creation, e.g. 2026-10-01").option("--json", "print as JSON").action(async (name, opts, cmd) => {
2939
3140
  let since;
2940
3141
  if (opts.since !== void 0) {
2941
3142
  const t = Date.parse(opts.since);
@@ -2982,8 +3183,8 @@ function block(u) {
2982
3183
  }
2983
3184
 
2984
3185
  // src/commands/vm/wake.ts
2985
- import { Command as Command32 } from "commander";
2986
- var wakeCommand = new Command32("wake").description("continue a hibernated box where it left off (same name, IP and disk)").argument("<name>", "box name").option("--force", "skip the capacity guard").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3186
+ import { Command as Command36 } from "commander";
3187
+ var wakeCommand = new Command36("wake").description("continue a hibernated box where it left off (same name, IP and disk)").argument("<name>", "box name").option("--force", "skip the capacity guard").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
2987
3188
  const client = await clientFor(cmd.optsWithGlobals());
2988
3189
  try {
2989
3190
  const box = await spin(`waking ${name} (loading its memory from disk)\u2026`, client.wakeMachine(name, opts.force ?? false));
@@ -2995,20 +3196,20 @@ var wakeCommand = new Command32("wake").description("continue a hibernated box w
2995
3196
  });
2996
3197
 
2997
3198
  // src/commands/vm/index.ts
2998
- var vmCommand = new Command33("vm").enablePositionalOptions().description("manage boxes (each one is a Firecracker microVM)").addCommand(newCommand).addCommand(forkCommand).addCommand(lsCommand).addCommand(getCommand).addCommand(connectCommand).addCommand(execCommand).addCommand(stopCommand).addCommand(startCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(hibernateCommand).addCommand(wakeCommand).addCommand(updateCommand).addCommand(rescaleCommand).addCommand(setCommand).addCommand(usageCommand).addCommand(topCommand).addCommand(proxyCommand).addCommand(hookCommand).addCommand(linkCommand).addCommand(unlinkCommand).addCommand(linksCommand).addCommand(rmCommand3);
2999
- for (const cmd of vmCommand.commands) if (cmd !== proxyCommand && cmd !== hookCommand) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
3199
+ var vmCommand = new Command37("vm").enablePositionalOptions().description("manage boxes (each one is a Firecracker microVM)").addCommand(newCommand).addCommand(forkCommand).addCommand(lsCommand).addCommand(getCommand).addCommand(connectCommand).addCommand(execCommand).addCommand(stopCommand).addCommand(startCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(hibernateCommand).addCommand(wakeCommand).addCommand(updateCommand).addCommand(rescaleCommand).addCommand(setCommand).addCommand(usageCommand).addCommand(topCommand).addCommand(proxyCommand).addCommand(hookCommand).addCommand(backupCommand).addCommand(linkCommand).addCommand(unlinkCommand).addCommand(linksCommand).addCommand(rmCommand3);
3200
+ for (const cmd of vmCommand.commands) if (cmd !== proxyCommand && cmd !== hookCommand && cmd !== backupCommand) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
3000
3201
  var vmAliases = [newCommand, lsCommand, getCommand, connectCommand, execCommand, stopCommand, startCommand, pauseCommand, resumeCommand, hibernateCommand, wakeCommand, rmCommand3, claimCommand];
3001
3202
 
3002
3203
  // src/commands/server/index.ts
3003
- import { Command as Command41 } from "commander";
3204
+ import { Command as Command45 } from "commander";
3004
3205
 
3005
3206
  // src/commands/server/join.ts
3006
- import { Command as Command34 } from "commander";
3207
+ import { Command as Command38 } from "commander";
3007
3208
 
3008
3209
  // src/commands/server/daemon.ts
3009
3210
  import { spawn as spawn4 } from "child_process";
3010
3211
  import { readFile as readFile4 } from "fs/promises";
3011
- import { setTimeout as sleep2 } from "timers/promises";
3212
+ import { setTimeout as sleep3 } from "timers/promises";
3012
3213
  async function runningPid(p = paths()) {
3013
3214
  let pid;
3014
3215
  try {
@@ -3031,7 +3232,7 @@ async function stopLocalServer(pid, timeoutMs = 1e4) {
3031
3232
  const deadline = Date.now() + timeoutMs;
3032
3233
  while (alive(pid)) {
3033
3234
  if (Date.now() > deadline) throw new KvboxError(`kvbox-server (pid ${pid}) did not stop within ${timeoutMs / 1e3}s`);
3034
- await sleep2(100);
3235
+ await sleep3(100);
3035
3236
  }
3036
3237
  }
3037
3238
  async function restartLocalServer(p = paths()) {
@@ -3057,7 +3258,7 @@ function runKvboxServer(args) {
3057
3258
  }
3058
3259
 
3059
3260
  // src/commands/server/join.ts
3060
- var joinCommand = new Command34("join").description("put this machine behind a control plane (needs a one-time token minted there) and restart its server").argument("<control-plane-url>", "the control plane, e.g. https://api.kvbox.sh").requiredOption("--token <token>", "one-time join token from the control plane").option("--advertise <host-or-ip>", "address the control plane reaches this machine at (default: its default-route address)").option("--name <name>", "how the control plane lists this machine (default: hostname)").action(async (url, opts) => {
3261
+ var joinCommand = new Command38("join").description("put this machine behind a control plane (needs a one-time token minted there) and restart its server").argument("<control-plane-url>", "the control plane, e.g. https://api.kvbox.sh").requiredOption("--token <token>", "one-time join token from the control plane").option("--advertise <host-or-ip>", "address the control plane reaches this machine at (default: its default-route address)").option("--name <name>", "how the control plane lists this machine (default: hostname)").action(async (url, opts) => {
3061
3262
  const args = ["join", url, "--token", opts.token];
3062
3263
  if (opts.advertise !== void 0) args.push("--advertise", opts.advertise);
3063
3264
  if (opts.name !== void 0) args.push("--name", opts.name);
@@ -3067,8 +3268,8 @@ var joinCommand = new Command34("join").description("put this machine behind a c
3067
3268
  });
3068
3269
 
3069
3270
  // src/commands/server/leave.ts
3070
- import { Command as Command35 } from "commander";
3071
- var leaveCommand = new Command35("leave").description("take this machine out from behind its control plane and restart its server").action(async () => {
3271
+ import { Command as Command39 } from "commander";
3272
+ var leaveCommand = new Command39("leave").description("take this machine out from behind its control plane and restart its server").action(async () => {
3072
3273
  const p = paths();
3073
3274
  for (const line of (await runKvboxServer(["leave"])).split("\n")) info(line);
3074
3275
  if (await runningPid(p) === null) return;
@@ -3077,14 +3278,14 @@ var leaveCommand = new Command35("leave").description("take this machine out fro
3077
3278
  });
3078
3279
 
3079
3280
  // src/commands/server/relay.ts
3080
- import { Command as Command36 } from "commander";
3081
- var relayCommand = new Command36("relay").description("reach the internet through a relay (paste what `kvbox-relay add` printed on the relay VM); `off` takes the tunnel down").argument("<join-string>", "the line `kvbox-relay add` printed, or `off`").action(async (joinString) => {
3281
+ import { Command as Command40 } from "commander";
3282
+ var relayCommand = new Command40("relay").description("reach the internet through a relay (paste what `kvbox-relay add` printed on the relay VM); `off` takes the tunnel down").argument("<join-string>", "the line `kvbox-relay add` printed, or `off`").action(async (joinString) => {
3082
3283
  for (const line of (await runKvboxServer(["relay", joinString])).split("\n")) info(line);
3083
3284
  });
3084
3285
 
3085
3286
  // src/commands/server/start.ts
3086
- import { Command as Command37 } from "commander";
3087
- var startCommand2 = new Command37("start").description("start the local kvbox-server in the background").action(async (_opts, cmd) => {
3287
+ import { Command as Command41 } from "commander";
3288
+ var startCommand2 = new Command41("start").description("start the local kvbox-server in the background").action(async (_opts, cmd) => {
3088
3289
  const client = await clientFor({ ...cmd.optsWithGlobals(), local: true }, { autoStart: false });
3089
3290
  try {
3090
3291
  const health = await client.health();
@@ -3100,8 +3301,8 @@ var startCommand2 = new Command37("start").description("start the local kvbox-se
3100
3301
  });
3101
3302
 
3102
3303
  // src/commands/server/status.ts
3103
- import { Command as Command38 } from "commander";
3104
- var statusCommand = new Command38("status").description("show whether this machine's server is running, its control plane and which base image new boxes get").option("--json", "print as JSON").action(async (opts, cmd) => {
3304
+ import { Command as Command42 } from "commander";
3305
+ var statusCommand = new Command42("status").description("show whether this machine's server is running, its control plane and which base image new boxes get").option("--json", "print as JSON").action(async (opts, cmd) => {
3105
3306
  const client = await clientFor({ ...cmd.optsWithGlobals(), local: true });
3106
3307
  try {
3107
3308
  const health = await client.health();
@@ -3133,8 +3334,8 @@ var statusCommand = new Command38("status").description("show whether this machi
3133
3334
  });
3134
3335
 
3135
3336
  // src/commands/server/stop.ts
3136
- import { Command as Command39 } from "commander";
3137
- var stopCommand2 = new Command39("stop").description("stop the local server (running boxes are not affected)").action(async () => {
3337
+ import { Command as Command43 } from "commander";
3338
+ var stopCommand2 = new Command43("stop").description("stop the local server (running boxes are not affected)").action(async () => {
3138
3339
  const pid = await runningPid(paths());
3139
3340
  if (pid === null) throw new KvboxError("kvbox-server is not running");
3140
3341
  await stopLocalServer(pid);
@@ -3142,8 +3343,8 @@ var stopCommand2 = new Command39("stop").description("stop the local server (run
3142
3343
  });
3143
3344
 
3144
3345
  // src/commands/server/trust-ca.ts
3145
- import { Command as Command40 } from "commander";
3146
- var trustCaCommand = new Command40("trust-ca").description("make every cloud box on this machine trust a new SSH CA (after `ca rotate` on the control plane)").argument("[public-key]", "the CA public key (or its cert-authority line); or --from-cloud").option("--from-cloud", "ask the control plane this host joined for its current CA, show the fingerprint, then ask").option("-y, --yes", "do not ask for confirmation").option("--json", "print the report as JSON").action(async (publicKey, opts, cmd) => {
3346
+ import { Command as Command44 } from "commander";
3347
+ var trustCaCommand = new Command44("trust-ca").description("make every cloud box on this machine trust a new SSH CA (after `ca rotate` on the control plane)").argument("[public-key]", "the CA public key (or its cert-authority line); or --from-cloud").option("--from-cloud", "ask the control plane this host joined for its current CA, show the fingerprint, then ask").option("-y, --yes", "do not ask for confirmation").option("--json", "print the report as JSON").action(async (publicKey, opts, cmd) => {
3147
3348
  if (publicKey === void 0 && !opts.fromCloud) throw new KvboxError("give the CA public key, or --from-cloud to fetch it from the control plane this host joined");
3148
3349
  if (publicKey !== void 0 && opts.fromCloud) throw new KvboxError("either a public key or --from-cloud, not both");
3149
3350
  const client = await clientFor({ ...cmd.optsWithGlobals(), local: true });
@@ -3181,7 +3382,7 @@ function describeReport(report) {
3181
3382
  }
3182
3383
 
3183
3384
  // src/commands/server/index.ts
3184
- var serverCommand = new Command41("server").description("run or manage the kvbox server").addCommand(startCommand2).addCommand(statusCommand).addCommand(stopCommand2).addCommand(joinCommand).addCommand(leaveCommand).addCommand(relayCommand).addCommand(trustCaCommand);
3385
+ var serverCommand = new Command45("server").description("run or manage the kvbox server").addCommand(startCommand2).addCommand(statusCommand).addCommand(stopCommand2).addCommand(joinCommand).addCommand(leaveCommand).addCommand(relayCommand).addCommand(trustCaCommand);
3185
3386
 
3186
3387
  // src/commands/login.ts
3187
3388
  import { spawnSync as spawnSync3 } from "child_process";
@@ -3189,8 +3390,8 @@ import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile3 } from
3189
3390
  import { hostname as osHostname } from "os";
3190
3391
  import { createInterface as createInterface2 } from "readline/promises";
3191
3392
  import { Writable } from "stream";
3192
- import { Command as Command42 } from "commander";
3193
- var loginCommand = new Command42("login").description("log in to the kvbox cloud (or your own control plane) and target it from now on").argument("[url]", `control plane URL (default: ${DEFAULT_CLOUD_URL})`).option("-e, --email <email>", "account email (prompted otherwise)").option("--password-stdin", "read the password from the first line of stdin (for scripts)").action(async (urlArg, opts) => {
3393
+ import { Command as Command46 } from "commander";
3394
+ var loginCommand = new Command46("login").description("log in to the kvbox cloud (or your own control plane) and target it from now on").argument("[url]", `control plane URL (default: ${DEFAULT_CLOUD_URL})`).option("-e, --email <email>", "account email (prompted otherwise)").option("--password-stdin", "read the password from the first line of stdin (for scripts)").action(async (urlArg, opts) => {
3194
3395
  const url = normalizeUrl(urlArg ?? DEFAULT_CLOUD_URL);
3195
3396
  const creds = await readCredentials(opts);
3196
3397
  const session = await runLogin(url, creds, paths());
@@ -3270,8 +3471,8 @@ async function firstLine(stream) {
3270
3471
  }
3271
3472
 
3272
3473
  // src/commands/logout.ts
3273
- import { Command as Command43 } from "commander";
3274
- var logoutCommand = new Command43("logout").description("log out of the control plane; commands target this machine's kvbox-server again").action(async () => {
3474
+ import { Command as Command47 } from "commander";
3475
+ var logoutCommand = new Command47("logout").description("log out of the control plane; commands target this machine's kvbox-server again").action(async () => {
3275
3476
  const p = paths();
3276
3477
  const session = await readSession(p).catch(() => null);
3277
3478
  switch (await runLogout(p)) {
@@ -3308,8 +3509,8 @@ async function runLogout(p = paths()) {
3308
3509
  }
3309
3510
 
3310
3511
  // src/commands/whoami.ts
3311
- import { Command as Command44 } from "commander";
3312
- var whoamiCommand = new Command44("whoami").description("show which account and control plane commands target (or local mode)").option("--json", "print as JSON").action(async (opts) => {
3512
+ import { Command as Command48 } from "commander";
3513
+ var whoamiCommand = new Command48("whoami").description("show which account and control plane commands target (or local mode)").option("--json", "print as JSON").action(async (opts) => {
3313
3514
  const session = await readSession();
3314
3515
  if (opts.json) {
3315
3516
  json(session ? { user: session.user, url: session.url, sshCertExpires: session.sshCertExpires ?? null } : null);
@@ -3325,11 +3526,11 @@ function describeSession(session) {
3325
3526
  }
3326
3527
 
3327
3528
  // src/commands/snapshots/index.ts
3328
- import { Command as Command48 } from "commander";
3529
+ import { Command as Command52 } from "commander";
3329
3530
 
3330
3531
  // src/commands/snapshots/ls.ts
3331
- import { Command as Command45 } from "commander";
3332
- var lsCommand4 = new Command45("ls").description("list snapshots (yours and your orgs'; --org <slug> for one org)").option("-a, --all", "every snapshot on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
3532
+ import { Command as Command49 } from "commander";
3533
+ var lsCommand5 = new Command49("ls").description("list snapshots (yours and your orgs'; --org <slug> for one org)").option("-a, --all", "every snapshot on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
3333
3534
  const client = await clientFor(cmd.optsWithGlobals());
3334
3535
  try {
3335
3536
  const cloud = client.target.kind === "cloud";
@@ -3360,8 +3561,8 @@ var lsCommand4 = new Command45("ls").description("list snapshots (yours and your
3360
3561
  });
3361
3562
 
3362
3563
  // src/commands/snapshots/new.ts
3363
- import { Command as Command46 } from "commander";
3364
- var newCommand2 = new Command46("new").description("freeze a running box (memory + disk) into a snapshot; the box keeps running").argument("<box>", "box name").argument("<name>", "snapshot name").option("--replace", "retake a snapshot that exists under this name; the old one stays until the new one is complete").option("--json", "print the snapshot as JSON").action(async (box, name, opts, cmd) => {
3564
+ import { Command as Command50 } from "commander";
3565
+ var newCommand2 = new Command50("new").description("freeze a running box (memory + disk) into a snapshot; the box keeps running").argument("<box>", "box name").argument("<name>", "snapshot name").option("--replace", "retake a snapshot that exists under this name; the old one stays until the new one is complete").option("--json", "print the snapshot as JSON").action(async (box, name, opts, cmd) => {
3365
3566
  const client = await clientFor(cmd.optsWithGlobals());
3366
3567
  try {
3367
3568
  const req = { box, name, ...opts.replace ? { replace: true } : {} };
@@ -3374,8 +3575,8 @@ var newCommand2 = new Command46("new").description("freeze a running box (memory
3374
3575
  });
3375
3576
 
3376
3577
  // src/commands/snapshots/rm.ts
3377
- import { Command as Command47 } from "commander";
3378
- var rmCommand4 = new Command47("rm").description("delete a snapshot (boxes made from it are not affected)").argument("<name>", "snapshot name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
3578
+ import { Command as Command51 } from "commander";
3579
+ var rmCommand4 = new Command51("rm").description("delete a snapshot (boxes made from it are not affected)").argument("<name>", "snapshot name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
3379
3580
  if (!await confirm(`Delete snapshot ${name}?`, opts.yes ?? false)) {
3380
3581
  info("cancelled");
3381
3582
  process.exitCode = 1;
@@ -3391,14 +3592,14 @@ var rmCommand4 = new Command47("rm").description("delete a snapshot (boxes made
3391
3592
  });
3392
3593
 
3393
3594
  // src/commands/snapshots/index.ts
3394
- var snapshotsCommand = new Command48("snapshots").aliases(["snapshot", "snap"]).description("freeze running boxes into snapshots and manage them").addCommand(newCommand2).addCommand(lsCommand4).addCommand(rmCommand4);
3595
+ var snapshotsCommand = new Command52("snapshots").aliases(["snapshot", "snap"]).description("freeze running boxes into snapshots and manage them").addCommand(newCommand2).addCommand(lsCommand5).addCommand(rmCommand4);
3395
3596
  for (const cmd of snapshotsCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
3396
3597
 
3397
3598
  // src/commands/org/index.ts
3398
- import { Command as Command54 } from "commander";
3599
+ import { Command as Command58 } from "commander";
3399
3600
 
3400
3601
  // src/commands/org/ls.ts
3401
- import { Command as Command49 } from "commander";
3602
+ import { Command as Command53 } from "commander";
3402
3603
 
3403
3604
  // src/commands/org/context.ts
3404
3605
  var NOT_LOGGED_IN = "orgs live on the control plane: kvbox login first";
@@ -3418,7 +3619,7 @@ function orgFor(opts, target) {
3418
3619
  }
3419
3620
 
3420
3621
  // src/commands/org/ls.ts
3421
- var lsCommand5 = new Command49("ls").description("list the orgs you belong to and your role in each").option("--json", "print as JSON").action(async (opts, cmd) => {
3622
+ var lsCommand6 = new Command53("ls").description("list the orgs you belong to and your role in each").option("--json", "print as JSON").action(async (opts, cmd) => {
3422
3623
  const client = await cloudClientFor(cmd.optsWithGlobals());
3423
3624
  try {
3424
3625
  const orgs = await client.listOrgs();
@@ -3440,8 +3641,8 @@ function orgRows(orgs) {
3440
3641
  }
3441
3642
 
3442
3643
  // src/commands/org/members.ts
3443
- import { Command as Command50, Option as Option4 } from "commander";
3444
- var lsCommand6 = new Command50("ls").description("list an org's members and their roles").option("-o, --org <slug>", "the org (or --org before the command)").option("--json", "print as JSON").action(async (opts, cmd) => {
3644
+ import { Command as Command54, Option as Option4 } from "commander";
3645
+ var lsCommand7 = new Command54("ls").description("list an org's members and their roles").option("-o, --org <slug>", "the org (or --org before the command)").option("--json", "print as JSON").action(async (opts, cmd) => {
3445
3646
  const client = await cloudClientFor(cmd.optsWithGlobals());
3446
3647
  try {
3447
3648
  const org = await client.getOrg(orgFor(opts, client.target));
@@ -3455,7 +3656,7 @@ var lsCommand6 = new Command50("ls").description("list an org's members and thei
3455
3656
  await client.close();
3456
3657
  }
3457
3658
  });
3458
- var addCommand2 = new Command50("add").description("add a user to an org (admins and owners; only an owner can add an owner)").argument("<user>", "their username").addOption(new Option4("-r, --role <role>", "their role").choices(ORG_ROLES).default("member")).option("-o, --org <slug>", "the org (or --org before the command)").action(async (user, opts, cmd) => {
3659
+ var addCommand2 = new Command54("add").description("add a user to an org (admins and owners; only an owner can add an owner)").argument("<user>", "their username").addOption(new Option4("-r, --role <role>", "their role").choices(ORG_ROLES).default("member")).option("-o, --org <slug>", "the org (or --org before the command)").action(async (user, opts, cmd) => {
3459
3660
  const client = await cloudClientFor(cmd.optsWithGlobals());
3460
3661
  try {
3461
3662
  const slug = orgFor(opts, client.target);
@@ -3465,7 +3666,7 @@ var addCommand2 = new Command50("add").description("add a user to an org (admins
3465
3666
  await client.close();
3466
3667
  }
3467
3668
  });
3468
- var rmCommand5 = new Command50("rm").description("remove a member (or leave: remove yourself)").argument("<user>", "their username").option("-o, --org <slug>", "the org (or --org before the command)").option("-y, --yes", "do not ask for confirmation").action(async (user, opts, cmd) => {
3669
+ var rmCommand5 = new Command54("rm").description("remove a member (or leave: remove yourself)").argument("<user>", "their username").option("-o, --org <slug>", "the org (or --org before the command)").option("-y, --yes", "do not ask for confirmation").action(async (user, opts, cmd) => {
3469
3670
  const client = await cloudClientFor(cmd.optsWithGlobals());
3470
3671
  try {
3471
3672
  const slug = orgFor(opts, client.target);
@@ -3481,11 +3682,11 @@ var rmCommand5 = new Command50("rm").description("remove a member (or leave: rem
3481
3682
  await client.close();
3482
3683
  }
3483
3684
  });
3484
- var membersCommand = new Command50("members").description("who is in an org and what they may do").addCommand(lsCommand6).addCommand(addCommand2).addCommand(rmCommand5);
3685
+ var membersCommand = new Command54("members").description("who is in an org and what they may do").addCommand(lsCommand7).addCommand(addCommand2).addCommand(rmCommand5);
3485
3686
 
3486
3687
  // src/commands/org/new.ts
3487
- import { Command as Command51 } from "commander";
3488
- var newCommand3 = new Command51("new").description("create an org; you become its owner (the slug is permanent, the name is not)").argument("<slug>", "the org's slug: lowercase, like a username (acme)").option("-n, --name <name>", "display name (default: the slug)").option("--json", "print the org as JSON").action(async (slug, opts, cmd) => {
3688
+ import { Command as Command55 } from "commander";
3689
+ var newCommand3 = new Command55("new").description("create an org; you become its owner (the slug is permanent, the name is not)").argument("<slug>", "the org's slug: lowercase, like a username (acme)").option("-n, --name <name>", "display name (default: the slug)").option("--json", "print the org as JSON").action(async (slug, opts, cmd) => {
3489
3690
  const client = await cloudClientFor(cmd.optsWithGlobals());
3490
3691
  try {
3491
3692
  const org = await client.createOrg({ slug, name: opts.name ?? slug });
@@ -3501,8 +3702,8 @@ var newCommand3 = new Command51("new").description("create an org; you become it
3501
3702
  });
3502
3703
 
3503
3704
  // src/commands/org/rm.ts
3504
- import { Command as Command52 } from "commander";
3505
- var rmCommand6 = new Command52("rm").description("delete an org (owners only; remove its boxes and snapshots first)").argument("<slug>", "the org").option("-y, --yes", "do not ask for confirmation").action(async (slug, opts, cmd) => {
3705
+ import { Command as Command56 } from "commander";
3706
+ var rmCommand6 = new Command56("rm").description("delete an org (owners only; remove its boxes and snapshots first)").argument("<slug>", "the org").option("-y, --yes", "do not ask for confirmation").action(async (slug, opts, cmd) => {
3506
3707
  if (!await confirm(`Delete org ${slug}? Its members lose access; its slug stays taken.`, opts.yes ?? false)) {
3507
3708
  info("cancelled");
3508
3709
  process.exitCode = 1;
@@ -3518,8 +3719,8 @@ var rmCommand6 = new Command52("rm").description("delete an org (owners only; re
3518
3719
  });
3519
3720
 
3520
3721
  // src/commands/org/role.ts
3521
- import { Argument, Command as Command53 } from "commander";
3522
- var roleCommand = new Command53("role").description("change a member's role (owners only)").argument("<user>", "their username").addArgument(new Argument("<role>", "owner, admin or member").choices(ORG_ROLES)).option("-o, --org <slug>", "the org (default: the current context)").action(async (user, role, opts, cmd) => {
3722
+ import { Argument, Command as Command57 } from "commander";
3723
+ var roleCommand = new Command57("role").description("change a member's role (owners only)").argument("<user>", "their username").addArgument(new Argument("<role>", "owner, admin or member").choices(ORG_ROLES)).option("-o, --org <slug>", "the org (default: the current context)").action(async (user, role, opts, cmd) => {
3523
3724
  const client = await cloudClientFor(cmd.optsWithGlobals());
3524
3725
  try {
3525
3726
  const slug = orgFor(opts, client.target);
@@ -3531,10 +3732,10 @@ var roleCommand = new Command53("role").description("change a member's role (own
3531
3732
  });
3532
3733
 
3533
3734
  // src/commands/org/index.ts
3534
- var orgCommand = new Command54("org").description("orgs: shared slugs that own boxes, with owners, admins and members").addCommand(lsCommand5).addCommand(newCommand3).addCommand(membersCommand).addCommand(roleCommand).addCommand(rmCommand6);
3735
+ var orgCommand = new Command58("org").description("orgs: shared slugs that own boxes, with owners, admins and members").addCommand(lsCommand6).addCommand(newCommand3).addCommand(membersCommand).addCommand(roleCommand).addCommand(rmCommand6);
3535
3736
 
3536
3737
  // src/commands/usage.ts
3537
- import { Command as Command55 } from "commander";
3738
+ import { Command as Command59 } from "commander";
3538
3739
 
3539
3740
  // ../shared/src/usage.ts
3540
3741
  import { z as z4 } from "zod";
@@ -3572,7 +3773,7 @@ function sumUsage(items, pricing) {
3572
3773
  }
3573
3774
 
3574
3775
  // src/commands/usage.ts
3575
- var usageCommand2 = new Command55("usage").description("what your boxes and volumes used this month (or --since/--until): running time, vCPU-h, RAM and disk GiB-h, cost").option("--since <date>", "count from this date, e.g. 2026-10-01 (default: the 1st of this month)").option("--until <date>", "count up to this date (default: now)").option("--org <slug>", "one org's boxes only").option("-a, --all", "every box on the platform (platform admins only)").option("--by-user", "one line per user who made the boxes (e.g. who spent what in --org)").option("--json", "print as JSON").action(async (opts, cmd) => {
3776
+ var usageCommand2 = new Command59("usage").description("what your boxes and volumes used this month (or --since/--until): running time, vCPU-h, RAM and disk GiB-h, cost").option("--since <date>", "count from this date, e.g. 2026-10-01 (default: the 1st of this month)").option("--until <date>", "count up to this date (default: now)").option("--org <slug>", "one org's boxes only").option("-a, --all", "every box on the platform (platform admins only)").option("--by-user", "one line per user who made the boxes (e.g. who spent what in --org)").option("--json", "print as JSON").action(async (opts, cmd) => {
3576
3777
  for (const [name, value] of [
3577
3778
  ["since", opts.since],
3578
3779
  ["until", opts.until]
@@ -3718,8 +3919,8 @@ function userRows(r) {
3718
3919
  }
3719
3920
 
3720
3921
  // src/commands/credit.ts
3721
- import { Command as Command56 } from "commander";
3722
- var creditCommand = new Command56("credit").description("the prepaid credit left on your account and on each of your orgs").option("--org <slug>", "one org only").option("--json", "print as JSON").action(async (opts, cmd) => {
3922
+ import { Command as Command60 } from "commander";
3923
+ var creditCommand = new Command60("credit").description("the prepaid credit left on your account and on each of your orgs").option("--org <slug>", "one org only").option("--json", "print as JSON").action(async (opts, cmd) => {
3723
3924
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
3724
3925
  try {
3725
3926
  if (client.target.kind === "local") throw new KvboxError("credit lives on the control plane: kvbox login first");
@@ -3749,7 +3950,7 @@ function creditRow(b, me2) {
3749
3950
  // src/commands/deploy/index.ts
3750
3951
  import { readFile as readFile7 } from "fs/promises";
3751
3952
  import { basename, resolve as resolve2 } from "path";
3752
- import { Command as Command57, InvalidArgumentError as InvalidArgumentError2, Option as Option5 } from "commander";
3953
+ import { Command as Command61, InvalidArgumentError as InvalidArgumentError2, Option as Option5 } from "commander";
3753
3954
 
3754
3955
  // src/commands/deploy/config.ts
3755
3956
  import { readFile as readFile6, writeFile as writeFile4 } from "fs/promises";
@@ -4078,7 +4279,7 @@ async function ship(ep, dir, remote, exclude = []) {
4078
4279
  var shipping = { ship, measure, waitForSsh };
4079
4280
 
4080
4281
  // src/commands/deploy/index.ts
4081
- var deployCommand = new Command57("deploy").description("put the app in this directory (React, Next.js or a Node server) on a box with its own HTTPS address; redeploy by running it again").argument("[dir]", "the app's directory (default: the current one)").addOption(new Option5("-t, --template <template>", "what kind of app it is (detected from package.json when not given)").choices(TEMPLATE_IDS)).option("-n, --name <name>", "the box's name (default: the directory's name)").option("--sub <subdomain>", "its HTTPS name, https://<subdomain>.kvbox.app (default: the box's name)").addOption(new Option5("-s, --size <size>", "size of the box when it has to be made").choices(SIZE_NAMES)).option("--port <port>", "the port a Next.js app or Node server listens on (default 3000; saved to kvbox.json)", parsePort).option("-y, --yes", "ask nothing: take the defaults for whatever the flags and kvbox.json leave open").option("--json", "print the result as JSON").option("--org <slug>", "deploy into this org's boxes (saved to kvbox.json)").action(async (dirArg, opts, cmd) => {
4282
+ var deployCommand = new Command61("deploy").description("put the app in this directory (React, Next.js or a Node server) on a box with its own HTTPS address; redeploy by running it again").argument("[dir]", "the app's directory (default: the current one)").addOption(new Option5("-t, --template <template>", "what kind of app it is (detected from package.json when not given)").choices(TEMPLATE_IDS)).option("-n, --name <name>", "the box's name (default: the directory's name)").option("--sub <subdomain>", "its HTTPS name, https://<subdomain>.kvbox.app (default: the box's name)").addOption(new Option5("-s, --size <size>", "size of the box when it has to be made").choices(SIZE_NAMES)).option("--port <port>", "the port a Next.js app or Node server listens on (default 3000; saved to kvbox.json)", parsePort).option("-y, --yes", "ask nothing: take the defaults for whatever the flags and kvbox.json leave open").option("--json", "print the result as JSON").option("--org <slug>", "deploy into this org's boxes (saved to kvbox.json)").action(async (dirArg, opts, cmd) => {
4082
4283
  const dir = resolve2(dirArg ?? ".");
4083
4284
  const pkg = await readPackageJson(dir);
4084
4285
  const saved = await readConfig(dir);
@@ -4282,15 +4483,15 @@ the app is on box ${ref} but has no address yet: pick another with kvbox deploy
4282
4483
  }
4283
4484
 
4284
4485
  // src/commands/volume/index.ts
4285
- import { Command as Command63 } from "commander";
4486
+ import { Command as Command67 } from "commander";
4286
4487
 
4287
4488
  // src/commands/volume/attach.ts
4288
- import { Command as Command58 } from "commander";
4489
+ import { Command as Command62 } from "commander";
4289
4490
  function describeMount(machine, volume, box) {
4290
4491
  const path = machine.volumes?.find((v) => volume === v.name || volume.endsWith(`/${v.name}`))?.mountPath ?? volumeMountPath(volume.slice(volume.lastIndexOf("/") + 1));
4291
4492
  return machine.status === "running" ? ` the box was restarted; the volume is at ${path} inside it` : ` box ${box} is ${machine.status}; the volume is at ${path} once it runs`;
4292
4493
  }
4293
- var attachCommand = new Command58("attach").description("attach a volume to a box at /mnt/<volume> (a running box is restarted to take it)").argument("[volume]", "volume name (picked from a list when left out)").argument("[box]", "box name (picked from a list when left out)").option("--json", "print the box as JSON").action(async (volumeArg, boxArg, opts, cmd) => {
4494
+ var attachCommand = new Command62("attach").description("attach a volume to a box at /mnt/<volume> (a running box is restarted to take it)").argument("[volume]", "volume name (picked from a list when left out)").argument("[box]", "box name (picked from a list when left out)").option("--json", "print the box as JSON").action(async (volumeArg, boxArg, opts, cmd) => {
4294
4495
  if (volumeArg === void 0 || boxArg === void 0) askOrUsage("give the volume and the box: kvbox volume attach <volume> <box>");
4295
4496
  const client = await clientFor(cmd.optsWithGlobals());
4296
4497
  try {
@@ -4309,7 +4510,7 @@ var attachCommand = new Command58("attach").description("attach a volume to a bo
4309
4510
  });
4310
4511
 
4311
4512
  // src/commands/volume/create.ts
4312
- import { Command as Command59 } from "commander";
4513
+ import { Command as Command63 } from "commander";
4313
4514
  function parseGib2(text2) {
4314
4515
  const mib = parseMib(text2);
4315
4516
  if (mib === void 0 || mib % 1024 !== 0) throw new KvboxError(`--size ${text2}: write whole GB, like 50 or 50GB`);
@@ -4325,7 +4526,7 @@ function sizeProblem(answer) {
4325
4526
  return err instanceof KvboxError ? err.message.replace(/^--size \S+: /, "") : String(err);
4326
4527
  }
4327
4528
  }
4328
- var createCommand2 = new Command59("create").alias("new").description("create a volume for a box: an empty disk of its own at /mnt/<name> inside it (a running box is restarted)").argument("[name]", "volume name (1-12 chars; the box mounts it at /mnt/<name>; asked for when left out)").option("--size <gb>", "size in GB, like 50 or 50GB (whole GB; it only occupies what is written)").option("--box <box>", "the box it is for: made on that box's host and attached to it (required on kvbox.sh; optional with --local)").option("--json", "print the volume as JSON").action(async (nameArg, opts, cmd) => {
4529
+ var createCommand3 = new Command63("create").alias("new").description("create a volume for a box: an empty disk of its own at /mnt/<name> inside it (a running box is restarted)").argument("[name]", "volume name (1-12 chars; the box mounts it at /mnt/<name>; asked for when left out)").option("--size <gb>", "size in GB, like 50 or 50GB (whole GB; it only occupies what is written)").option("--box <box>", "the box it is for: made on that box's host and attached to it (required on kvbox.sh; optional with --local)").option("--json", "print the volume as JSON").action(async (nameArg, opts, cmd) => {
4329
4530
  const ask = interactive();
4330
4531
  if (nameArg === void 0 || opts.size === void 0) askOrUsage("give the name and the size: kvbox volume create <name> --size <gb> --box <box>");
4331
4532
  const name = nameArg ?? await text("Volume name", { validate: (a) => VOLUME_NAME_RE.test(a) ? void 0 : VOLUME_NAME_RULE });
@@ -4358,8 +4559,8 @@ var createCommand2 = new Command59("create").alias("new").description("create a
4358
4559
  });
4359
4560
 
4360
4561
  // src/commands/volume/detach.ts
4361
- import { Command as Command60 } from "commander";
4362
- var detachCommand = new Command60("detach").description("detach a volume from a box; its data is kept (a running box is restarted)").argument("[volume]", "volume name (picked from a list when left out)").argument("[box]", "box name (the one the volume is on when left out)").option("--json", "print the box as JSON").action(async (volumeArg, boxArg, opts, cmd) => {
4562
+ import { Command as Command64 } from "commander";
4563
+ var detachCommand = new Command64("detach").description("detach a volume from a box; its data is kept (a running box is restarted)").argument("[volume]", "volume name (picked from a list when left out)").argument("[box]", "box name (the one the volume is on when left out)").option("--json", "print the box as JSON").action(async (volumeArg, boxArg, opts, cmd) => {
4363
4564
  if (volumeArg === void 0) askOrUsage("give the volume: kvbox volume detach <volume> [box]");
4364
4565
  const client = await clientFor(cmd.optsWithGlobals());
4365
4566
  try {
@@ -4384,8 +4585,8 @@ var detachCommand = new Command60("detach").description("detach a volume from a
4384
4585
  });
4385
4586
 
4386
4587
  // src/commands/volume/ls.ts
4387
- import { Command as Command61 } from "commander";
4388
- var lsCommand7 = new Command61("ls").alias("list").description("list volumes: size, what they occupy, which box has them").option("-a, --all", "every volume on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
4588
+ import { Command as Command65 } from "commander";
4589
+ var lsCommand8 = new Command65("ls").alias("list").description("list volumes: size, what they occupy, which box has them").option("-a, --all", "every volume on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
4389
4590
  const client = await clientFor(cmd.optsWithGlobals());
4390
4591
  try {
4391
4592
  const cloud = client.target.kind === "cloud";
@@ -4416,8 +4617,8 @@ var lsCommand7 = new Command61("ls").alias("list").description("list volumes: si
4416
4617
  });
4417
4618
 
4418
4619
  // src/commands/volume/rm.ts
4419
- import { Command as Command62 } from "commander";
4420
- var rmCommand7 = new Command62("rm").alias("remove").description("delete a volume and everything on it (detach it first)").argument("<name>", "volume name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
4620
+ import { Command as Command66 } from "commander";
4621
+ var rmCommand7 = new Command66("rm").alias("remove").description("delete a volume and everything on it (detach it first)").argument("<name>", "volume name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
4421
4622
  if (!await confirm(`Delete volume ${name} and everything on it?`, opts.yes ?? false)) {
4422
4623
  info("cancelled");
4423
4624
  process.exitCode = 1;
@@ -4433,17 +4634,17 @@ var rmCommand7 = new Command62("rm").alias("remove").description("delete a volum
4433
4634
  });
4434
4635
 
4435
4636
  // src/commands/volume/index.ts
4436
- var volumeCommand = new Command63("volume").aliases(["volumes", "vol"]).description("disks of their own: create one, attach it to a box at /mnt/<name>, move it to another box later").addCommand(createCommand2).addCommand(lsCommand7).addCommand(attachCommand).addCommand(detachCommand).addCommand(rmCommand7);
4637
+ var volumeCommand = new Command67("volume").aliases(["volumes", "vol"]).description("disks of their own: create one, attach it to a box at /mnt/<name>, move it to another box later").addCommand(createCommand3).addCommand(lsCommand8).addCommand(attachCommand).addCommand(detachCommand).addCommand(rmCommand7);
4437
4638
  for (const cmd of volumeCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
4438
4639
 
4439
4640
  // src/commands/env/index.ts
4440
- import { Command as Command67 } from "commander";
4641
+ import { Command as Command71 } from "commander";
4441
4642
 
4442
4643
  // src/commands/env/ls.ts
4443
- import { Command as Command64 } from "commander";
4644
+ import { Command as Command68 } from "commander";
4444
4645
 
4445
4646
  // src/commands/env/shared.ts
4446
- function requireCloud3(client) {
4647
+ function requireCloud4(client) {
4447
4648
  if (client.target.kind === "local") throw new KvboxError("kvbox env needs kvbox.sh: kvbox login first");
4448
4649
  return client.target.org ?? client.target.user ?? "you";
4449
4650
  }
@@ -4467,7 +4668,7 @@ function firstBootHint(box, name) {
4467
4668
  }
4468
4669
 
4469
4670
  // src/commands/env/ls.ts
4470
- var lsCommand8 = new Command64("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) => {
4671
+ var lsCommand9 = new Command68("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) => {
4471
4672
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4472
4673
  try {
4473
4674
  if (opts.box !== void 0) {
@@ -4489,7 +4690,7 @@ var lsCommand8 = new Command64("ls").alias("list").description("list the variabl
4489
4690
  table([...own.vars.map((v) => row(v, "box")), ...inherited.map((v) => row(v, color.dim(slug)))]);
4490
4691
  return;
4491
4692
  }
4492
- const owner = requireCloud3(client);
4693
+ const owner = requireCloud4(client);
4493
4694
  const vars = await client.listEnv();
4494
4695
  if (opts.json) {
4495
4696
  json(vars);
@@ -4506,12 +4707,12 @@ var lsCommand8 = new Command64("ls").alias("list").description("list the variabl
4506
4707
  });
4507
4708
 
4508
4709
  // src/commands/env/rm.ts
4509
- import { Command as Command65 } from "commander";
4510
- var rmCommand8 = new Command65("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 (names, opts, cmd) => {
4710
+ import { Command as Command69 } from "commander";
4711
+ var rmCommand8 = new Command69("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 (names, opts, cmd) => {
4511
4712
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4512
4713
  try {
4513
4714
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
4514
- const owner = target === void 0 ? requireCloud3(client) : `box ${target.ref}`;
4715
+ const owner = target === void 0 ? requireCloud4(client) : `box ${target.ref}`;
4515
4716
  if (!await confirm(`Remove ${names.join(", ")} from ${owner}'s variables?`, opts.yes ?? false)) {
4516
4717
  info("cancelled");
4517
4718
  process.exitCode = 1;
@@ -4544,11 +4745,11 @@ var rmCommand8 = new Command65("rm").alias("remove").description("remove variabl
4544
4745
  });
4545
4746
 
4546
4747
  // src/commands/env/set.ts
4547
- import { Command as Command66 } from "commander";
4548
- var setCommand2 = new Command66("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) => {
4748
+ import { Command as Command70 } from "commander";
4749
+ var setCommand2 = new Command70("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) => {
4549
4750
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4550
4751
  try {
4551
- const owner = opts.box === void 0 ? requireCloud3(client) : void 0;
4752
+ const owner = opts.box === void 0 ? requireCloud4(client) : void 0;
4552
4753
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
4553
4754
  const ask = interactive();
4554
4755
  if ((nameArg === void 0 || valueArg === void 0) && !ask) throw new KvboxError("give the name and the value: kvbox env set NAME VALUE (or run it in a terminal to be asked)");
@@ -4582,17 +4783,17 @@ var setCommand2 = new Command66("set").description("add or change a variable; bo
4582
4783
  });
4583
4784
 
4584
4785
  // src/commands/env/index.ts
4585
- var envCommand = new Command67("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand8, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand8);
4786
+ var envCommand = new Command71("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand9, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand8);
4586
4787
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
4587
4788
 
4588
4789
  // src/commands/domain/index.ts
4589
- import { Command as Command71 } from "commander";
4790
+ import { Command as Command75 } from "commander";
4590
4791
 
4591
4792
  // src/commands/domain/add.ts
4592
- import { Command as Command68 } from "commander";
4793
+ import { Command as Command72 } from "commander";
4593
4794
 
4594
4795
  // src/commands/domain/shared.ts
4595
- function requireCloud4(client) {
4796
+ function requireCloud5(client) {
4596
4797
  if (client.target.kind !== "cloud") throw new KvboxError("custom domains need the kvbox cloud: kvbox login (this host's own socket has none)");
4597
4798
  }
4598
4799
  var boxOf2 = (d, user) => user !== void 0 && d.owner !== user ? `${d.owner}/${d.box}` : d.box;
@@ -4609,12 +4810,12 @@ function hostIn(name, zone) {
4609
4810
  }
4610
4811
 
4611
4812
  // src/commands/domain/add.ts
4612
- var addCommand3 = new Command68("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) => {
4813
+ var addCommand3 = new Command72("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) => {
4613
4814
  const domain = assertDomain(domainArg.trim().toLowerCase());
4614
4815
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
4615
4816
  const client = await clientFor(cmd.optsWithGlobals());
4616
4817
  try {
4617
- requireCloud4(client);
4818
+ requireCloud5(client);
4618
4819
  const user = me(client);
4619
4820
  const box = displayName(await findBox(client, name), user);
4620
4821
  const d = await spin(`adding ${domain}\u2026`, client.addDomain(box, { domain, ...port !== void 0 ? { port } : {} }));
@@ -4645,11 +4846,11 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
4645
4846
  });
4646
4847
 
4647
4848
  // src/commands/domain/ls.ts
4648
- import { Command as Command69 } from "commander";
4649
- var lsCommand9 = new Command69("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
4849
+ import { Command as Command73 } from "commander";
4850
+ var lsCommand10 = new Command73("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
4650
4851
  const client = await clientFor(cmd.optsWithGlobals());
4651
4852
  try {
4652
- requireCloud4(client);
4853
+ requireCloud5(client);
4653
4854
  const user = me(client);
4654
4855
  const domains = await client.listDomains();
4655
4856
  if (opts.json) {
@@ -4675,12 +4876,12 @@ var lsCommand9 = new Command69("ls").alias("list").description("list your custom
4675
4876
  });
4676
4877
 
4677
4878
  // src/commands/domain/rm.ts
4678
- import { Command as Command70 } from "commander";
4679
- var rmCommand9 = new Command70("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) => {
4879
+ import { Command as Command74 } from "commander";
4880
+ var rmCommand9 = new Command74("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) => {
4680
4881
  const domain = domainArg.trim().toLowerCase();
4681
4882
  const client = await clientFor(cmd.optsWithGlobals());
4682
4883
  try {
4683
- requireCloud4(client);
4884
+ requireCloud5(client);
4684
4885
  const found = (await client.listDomains()).find((d) => d.domain === domain);
4685
4886
  if (!found) throw new KvboxError(`domain ${domain}: not found (kvbox domain ls)`);
4686
4887
  const box = boxOf2(found, me(client));
@@ -4697,12 +4898,12 @@ var rmCommand9 = new Command70("rm").alias("remove").description("stop serving a
4697
4898
  });
4698
4899
 
4699
4900
  // src/commands/domain/index.ts
4700
- var domainCommand = new Command71("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand3).addCommand(lsCommand9).addCommand(rmCommand9);
4901
+ var domainCommand = new Command75("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand3).addCommand(lsCommand10).addCommand(rmCommand9);
4701
4902
  for (const cmd of domainCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
4702
4903
 
4703
4904
  // src/program.ts
4704
4905
  function buildProgram() {
4705
- const program = new Command72("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").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();
4906
+ const program = new Command76("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").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();
4706
4907
  program.addCommand(vmCommand);
4707
4908
  program.addCommand(snapshotsCommand);
4708
4909
  program.addCommand(volumeCommand);