@kvbox/cli 0.5.51 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 Command95 } from "commander";
152
+ import { Command as Command99 } from "commander";
153
153
 
154
154
  // ../shared/src/version.ts
155
155
  import { createRequire } from "module";
@@ -164,7 +164,7 @@ function versionOf(srcFileUrl, injected) {
164
164
  }
165
165
 
166
166
  // src/version.ts
167
- var VERSION = versionOf(import.meta.url, true ? "0.5.51" : void 0);
167
+ var VERSION = versionOf(import.meta.url, true ? "0.6.1" : void 0);
168
168
 
169
169
  // src/commands/vm/index.ts
170
170
  import { Command as Command37 } from "commander";
@@ -292,7 +292,9 @@ function paths(home = kvboxHome()) {
292
292
  dir,
293
293
  meta: join(dir, "meta.json"),
294
294
  /** The volume itself: a sparse ext4 the guest sees as a whole disk. */
295
- disk: join(dir, "disk.ext4")
295
+ disk: join(dir, "disk.ext4"),
296
+ /** A restore's disk while it downloads (a backup's chunks), renamed over `disk` once complete. */
297
+ restoring: join(dir, "disk.ext4.restore")
296
298
  };
297
299
  },
298
300
  /** Each owner's environment variables as the control plane last sent them (#88): env/<owner>.json, mode 600. */
@@ -523,6 +525,7 @@ var WakeHookCallSchema = z2.object({
523
525
  reason: z2.string().optional()
524
526
  });
525
527
  var BACKUP_STATUSES = ["running", "ready", "failed"];
528
+ var BACKUP_KINDS = ["box", "volume"];
526
529
  var BackupSchema = z2.object({
527
530
  id: z2.string(),
528
531
  owner: z2.string(),
@@ -570,6 +573,31 @@ var HostRestoreRequest = z2.object({
570
573
  /** The certificate fingerprint of the store the URLs point at (see HostUploadRequest). */
571
574
  pin: z2.string().optional()
572
575
  });
576
+ var VolumeBackupSchema = z2.object({
577
+ id: z2.string(),
578
+ owner: z2.string(),
579
+ volume: z2.string(),
580
+ status: z2.enum(BACKUP_STATUSES),
581
+ /** Why it failed; null otherwise. */
582
+ error: z2.string().nullable(),
583
+ /** The volume's size when taken. */
584
+ diskBytes: z2.number().int().nullable(),
585
+ /** What it holds: the slots that are not all zeros. */
586
+ dataBytes: z2.number().int().nullable(),
587
+ /** What this backup added to storage (encrypted, compressed): the chunks no earlier backup had. */
588
+ uploadedBytes: z2.number().int().nullable(),
589
+ createdBy: z2.string().nullable(),
590
+ createdAt: z2.string(),
591
+ finishedAt: z2.string().nullable()
592
+ });
593
+ var HostVolumeBackupManifestSchema = z2.object({ id: z2.string(), sizeBytes: z2.number().int(), chunks: z2.array(z2.string().nullable()) });
594
+ var HostVolumeRestoreRequest = z2.object({
595
+ id: z2.string(),
596
+ key: z2.string(),
597
+ sizeBytes: z2.number().int().positive(),
598
+ chunks: z2.array(z2.object({ index: z2.number().int().nonnegative(), hash: z2.string(), url: z2.string() })),
599
+ pin: z2.string().optional()
600
+ });
573
601
  var BackupStoreSetupRequest = z2.object({ path: z2.string().min(1), force: z2.boolean().optional(), newStore: z2.boolean().optional() });
574
602
  var BackupStoreStatusSchema = z2.object({
575
603
  path: z2.string(),
@@ -602,7 +630,38 @@ var CloudBackupStoreSchema = z2.object({
602
630
  freeBytes: z2.number().int().nullable(),
603
631
  /** Ready backups kept here, and what their chunks take (encrypted, compressed). */
604
632
  backups: z2.number().int(),
605
- storedBytes: z2.number().int()
633
+ storedBytes: z2.number().int(),
634
+ /** How many boxes have a ready backup here (a box and an earlier one of the same name count once), and how many volumes (#168). */
635
+ boxes: z2.number().int(),
636
+ volumes: z2.number().int(),
637
+ /** When the newest ready backup kept here finished; null when it keeps none. */
638
+ lastBackupAt: z2.string().nullable()
639
+ });
640
+ var StoredItemSchema = z2.object({
641
+ kind: z2.enum(BACKUP_KINDS),
642
+ owner: z2.string(),
643
+ name: z2.string(),
644
+ /** The host the box (or volume) is on now; null when it is gone (its backups stay). */
645
+ host: z2.string().nullable(),
646
+ /** It is on the store's own host: losing that host loses it and its backups together. */
647
+ sameHost: z2.boolean(),
648
+ /** Ready backups kept here, and what they added to the store together (encrypted, compressed). */
649
+ backups: z2.number().int(),
650
+ uploadedBytes: z2.number().int(),
651
+ /** The newest backup sent here, whatever became of it. */
652
+ latest: z2.object({ id: z2.string(), status: z2.enum(BACKUP_STATUSES), error: z2.string().nullable(), createdAt: z2.string() })
653
+ });
654
+ var FailedBackupSchema = z2.object({
655
+ id: z2.string(),
656
+ owner: z2.string(),
657
+ /** What it was a backup of: a box or a volume (#168), and its name. */
658
+ kind: z2.enum(BACKUP_KINDS),
659
+ name: z2.string(),
660
+ error: z2.string().nullable(),
661
+ /** The host that took it, and the host of the store it was going to; null when gone, or when it failed before a store was picked. */
662
+ host: z2.string().nullable(),
663
+ store: z2.string().nullable(),
664
+ createdAt: z2.string()
606
665
  });
607
666
  var MachineSchema = z2.object({
608
667
  /** Host-unique short id (the tap is `kv-<id>`). Missing only on a box made before ids that has not restarted since. */
@@ -651,6 +710,11 @@ var MachineSchema = z2.object({
651
710
  host: z2.string().optional(),
652
711
  /** The country code of that host (`RO`, `US`), when its admin gave one. Only the control plane fills it in. */
653
712
  country: z2.string().optional(),
713
+ /**
714
+ * The kind of managed service the box runs (`postgres`, `redis`, `storage`). Only an admin's
715
+ * `GET /machines?all=1` lists such boxes, so a host's boxes add up; every other listing hides them.
716
+ */
717
+ managed: z2.string().optional(),
654
718
  /** Seconds without network traffic before the host hibernates the box (#47). Absent: never. */
655
719
  autoHibernateSec: z2.number().int().positive().optional(),
656
720
  /** A script inside the box that says it is idle (#102, exit 0): auto-hibernate asks it instead of watching the traffic. */
@@ -1689,6 +1753,24 @@ var ServerClient = class {
1689
1753
  createBoxBackup(name) {
1690
1754
  return this.call("POST", `/machines/${encodeURIComponent(name)}/backups`, BackupSchema);
1691
1755
  }
1756
+ /** A volume's backups (#168): the same as a box's, of the volume's disk. Newest first. */
1757
+ listVolumeBackups() {
1758
+ return this.call("GET", "/backups?kind=volume", z6.array(VolumeBackupSchema));
1759
+ }
1760
+ volumeBackups(name) {
1761
+ return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups`, z6.array(VolumeBackupSchema));
1762
+ }
1763
+ volumeBackup(name, id) {
1764
+ return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}`, VolumeBackupSchema);
1765
+ }
1766
+ /** Starts one; it runs in the background (`running`), `volumeBackup` says how it ended. */
1767
+ createVolumeBackup(name) {
1768
+ return this.call("POST", `/volumes/${encodeURIComponent(name)}/backups`, VolumeBackupSchema);
1769
+ }
1770
+ /** The volume's disk becomes the backup's; a running box that holds it restarts. Waits for the whole download. */
1771
+ restoreVolumeBackup(name, id) {
1772
+ return this.call("POST", `/volumes/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}/restore`, VolumeSchema, {}, void 0, 2 * 36e5);
1773
+ }
1692
1774
  /** The box's disk becomes the backup's; a running box restarts. Waits for the whole download. */
1693
1775
  restoreBoxBackup(name, id) {
1694
1776
  return this.call("POST", `/machines/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}/restore`, MachineSchema, {}, void 0, 2 * 36e5);
@@ -2662,7 +2744,8 @@ var hostCell = (b) => b.host === void 0 ? "-" : b.country === void 0 ? b.host :
2662
2744
  function lsRows(boxes, cloud) {
2663
2745
  return boxes.map((b) => ({
2664
2746
  ...cloud ? { owner: ownerCell(b, cloud.me) } : {},
2665
- name: boxName(b.name),
2747
+ // a managed service's or storage's box, which only a platform admin's --all lists: `s3-1a2b3c (storage)`
2748
+ name: b.managed === void 0 ? boxName(b.name) : `${boxName(b.name)} ${color.dim(`(${b.managed})`)}`,
2666
2749
  status: status(b.status),
2667
2750
  ...cloud?.showHost ? { host: hostCell(b) } : {},
2668
2751
  address: addressOf(b),
@@ -3205,25 +3288,26 @@ function requireCloud3(client) {
3205
3288
  var POLL_MS = 2e3;
3206
3289
  var POLL_TRIES = 30;
3207
3290
  var WAIT_MS = 7 * 36e5;
3208
- async function untilDone(client, box, id, opts = {}) {
3291
+ async function untilSettled(ask, what, id, where, opts = {}) {
3209
3292
  const { pollMs = POLL_MS, tries = POLL_TRIES, waitMs = WAIT_MS } = opts;
3293
+ const lostTrack = (why) => new KvboxError(`stopped waiting for backup ${id} of ${what} (${why}); it may still be running: ${where}`);
3210
3294
  const until = Date.now() + waitMs;
3211
3295
  let failed = 0;
3212
3296
  for (; ; ) {
3213
3297
  try {
3214
- const b = await client.boxBackup(box, id);
3298
+ const b = await ask();
3215
3299
  if (b.status !== "running") return b;
3216
3300
  failed = 0;
3217
3301
  } catch (err) {
3218
3302
  failed += 1;
3219
- if (failed >= tries) throw lostTrack(box, id, `could not ask how it is doing: ${err.message}`);
3303
+ if (failed >= tries) throw lostTrack(`could not ask how it is doing: ${err.message}`);
3220
3304
  }
3221
- if (Date.now() >= until) throw lostTrack(box, id, "it is taking longer than a backup is given");
3305
+ if (Date.now() >= until) throw lostTrack("it is taking longer than a backup is given");
3222
3306
  await sleep2(pollMs);
3223
3307
  }
3224
3308
  }
3225
- function lostTrack(box, id, why) {
3226
- return new KvboxError(`stopped waiting for backup ${id} of box ${box} (${why}); it may still be running: kvbox vm backup ls ${box}`);
3309
+ function untilDone(client, box, id, opts = {}) {
3310
+ return untilSettled(() => client.boxBackup(box, id), `box ${box}`, id, `kvbox vm backup ls ${box}`, opts);
3227
3311
  }
3228
3312
  function sizeLine(b) {
3229
3313
  const data = b.dataBytes === null ? "?" : gb(b.dataBytes);
@@ -5738,7 +5822,7 @@ async function settle2(dir, pkg, facts, saved, opts, orgFlag, cloud) {
5738
5822
  }
5739
5823
 
5740
5824
  // src/commands/volume/index.ts
5741
- import { Command as Command61 } from "commander";
5825
+ import { Command as Command65 } from "commander";
5742
5826
 
5743
5827
  // src/commands/volume/attach.ts
5744
5828
  import { Command as Command55 } from "commander";
@@ -5764,8 +5848,99 @@ var attachCommand = new Command55("attach").description("attach a volume to a bo
5764
5848
  }
5765
5849
  });
5766
5850
 
5767
- // src/commands/volume/create.ts
5851
+ // src/commands/volume/backup/index.ts
5852
+ import { Command as Command59 } from "commander";
5853
+
5854
+ // src/commands/volume/backup/create.ts
5768
5855
  import { Command as Command56 } from "commander";
5856
+ var createCommand3 = new Command56("create").description("back up a volume's disk to the kvbox cloud (encrypted)").argument("<volume>", "volume 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 (volume, opts, cmd) => {
5857
+ const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
5858
+ try {
5859
+ requireCloud3(client);
5860
+ const started = await client.createVolumeBackup(volume);
5861
+ if (!opts.wait) {
5862
+ if (opts.json) json(started);
5863
+ else {
5864
+ info(`${color.green("\u2713")} backup ${started.id} of volume ${color.bold(volume)} started; it runs in the background`);
5865
+ info(color.dim(` status: kvbox volume backup ls ${volume}`));
5866
+ }
5867
+ return;
5868
+ }
5869
+ const done = await spin(`backing up volume ${volume}\u2026`, untilSettled(() => client.volumeBackup(volume, started.id), `volume ${volume}`, started.id, `kvbox volume backup ls ${volume}`));
5870
+ if (opts.json) json(done);
5871
+ if (done.status === "failed") throw new KvboxError(`backup ${done.id} of volume ${volume} failed: ${done.error ?? "no reason given"}`);
5872
+ if (opts.json) return;
5873
+ info(`${color.green("\u2713")} backup ${done.id} of volume ${color.bold(volume)}: ${sizeLine(done)}`);
5874
+ info(color.dim(` restore with: kvbox volume backup restore ${volume} ${done.id}`));
5875
+ } finally {
5876
+ await client.close();
5877
+ }
5878
+ });
5879
+
5880
+ // src/commands/volume/backup/ls.ts
5881
+ import { Command as Command57 } from "commander";
5882
+ var lsCommand8 = new Command57("ls").alias("list").description("list volume backups: every volume's, or one volume's").argument("[volume]", "volume name (default: every volume)").option("--json", "print as JSON").action(async (volume, opts, cmd) => {
5883
+ const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
5884
+ try {
5885
+ requireCloud3(client);
5886
+ const list = volume === void 0 ? await client.listVolumeBackups() : await client.volumeBackups(volume);
5887
+ if (opts.json) {
5888
+ json(list);
5889
+ return;
5890
+ }
5891
+ if (list.length === 0) {
5892
+ info(volume === void 0 ? "no volume backups yet; make one with: kvbox volume backup create <volume>" : `volume ${volume} has no backups; make one with: kvbox volume backup create ${volume}`);
5893
+ return;
5894
+ }
5895
+ const anyError = list.some((b) => b.error !== null);
5896
+ table(
5897
+ list.map((b) => ({
5898
+ id: b.id,
5899
+ ...volume === void 0 ? { volume: b.owner === me(client) ? b.volume : `${b.owner}/${b.volume}` } : {},
5900
+ status: b.status === "ready" ? color.green(b.status) : b.status === "failed" ? color.red(b.status) : color.yellow(b.status),
5901
+ data: b.dataBytes === null ? "-" : gbShort(b.dataBytes),
5902
+ uploaded: b.uploadedBytes === null ? "-" : gbShort(b.uploadedBytes),
5903
+ size: b.diskBytes === null ? "-" : gbShort(b.diskBytes),
5904
+ by: b.createdBy ?? "-",
5905
+ taken: age(b.createdAt),
5906
+ ...anyError ? { error: b.error ?? "" } : {}
5907
+ }))
5908
+ );
5909
+ } finally {
5910
+ await client.close();
5911
+ }
5912
+ });
5913
+
5914
+ // src/commands/volume/backup/restore.ts
5915
+ import { Command as Command58 } from "commander";
5916
+ var restoreCommand2 = new Command58("restore").description("put a backup back: the volume's data becomes the backup's (a running box holding it restarts)").argument("<volume>", "volume name").argument("<id>", "the backup's id (kvbox volume backup ls <volume>)").option("-y, --yes", "do not ask for confirmation").option("--json", "print the volume as JSON").action(async (volume, id, opts, cmd) => {
5917
+ const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
5918
+ try {
5919
+ requireCloud3(client);
5920
+ const backup = await client.volumeBackup(volume, id);
5921
+ const question = `Restore volume ${volume} from backup ${backup.id} (${age(backup.createdAt)} ago, ${sizeLine(backup)})? Everything written to it since is lost, and a running box that holds it restarts.`;
5922
+ if (!await confirm(question, opts.yes ?? false)) {
5923
+ info("cancelled");
5924
+ process.exitCode = 1;
5925
+ return;
5926
+ }
5927
+ const restored = await spin(`restoring volume ${volume} from ${backup.id}\u2026`, client.restoreVolumeBackup(volume, id));
5928
+ if (opts.json) {
5929
+ json(restored);
5930
+ return;
5931
+ }
5932
+ info(`${color.green("\u2713")} volume ${color.bold(volume)} restored from backup ${backup.id}${restored.attachedTo ? color.dim(` (box ${restored.attachedTo} was restarted if it was running)`) : ""}`);
5933
+ } finally {
5934
+ await client.close();
5935
+ }
5936
+ });
5937
+
5938
+ // src/commands/volume/backup/index.ts
5939
+ var backupCommand2 = new Command59("backup").description("back up a volume's disk to the kvbox cloud, list backups, restore one").addCommand(createCommand3).addCommand(lsCommand8).addCommand(restoreCommand2);
5940
+ for (const cmd of backupCommand2.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
5941
+
5942
+ // src/commands/volume/create.ts
5943
+ import { Command as Command60 } from "commander";
5769
5944
  function parseGib2(text2, label = "--size") {
5770
5945
  const mib = parseMib(text2);
5771
5946
  if (mib === void 0 || mib % 1024 !== 0) throw new KvboxError(`${label} ${text2}: write whole GB, like 50 or 50GB`);
@@ -5781,7 +5956,7 @@ function sizeProblem(answer) {
5781
5956
  return err instanceof KvboxError ? err.message.replace(/^--size \S+: /, "") : String(err);
5782
5957
  }
5783
5958
  }
5784
- var createCommand3 = new Command56("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) => {
5959
+ var createCommand4 = new Command60("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) => {
5785
5960
  const ask = interactive();
5786
5961
  if (nameArg === void 0 || opts.size === void 0) askOrUsage("give the name and the size: kvbox volume create <name> --size <gb> --box <box>");
5787
5962
  const name = nameArg ?? await text("Volume name", { validate: (a) => VOLUME_NAME_RE.test(a) ? void 0 : VOLUME_NAME_RULE });
@@ -5814,8 +5989,8 @@ var createCommand3 = new Command56("create").alias("new").description("create a
5814
5989
  });
5815
5990
 
5816
5991
  // src/commands/volume/detach.ts
5817
- import { Command as Command57 } from "commander";
5818
- var detachCommand = new Command57("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) => {
5992
+ import { Command as Command61 } from "commander";
5993
+ var detachCommand = new Command61("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) => {
5819
5994
  if (volumeArg === void 0) askOrUsage("give the volume: kvbox volume detach <volume> [box]");
5820
5995
  const client = await clientFor(cmd.optsWithGlobals());
5821
5996
  try {
@@ -5840,8 +6015,8 @@ var detachCommand = new Command57("detach").description("detach a volume from a
5840
6015
  });
5841
6016
 
5842
6017
  // src/commands/volume/grow.ts
5843
- import { Command as Command58 } from "commander";
5844
- var growCommand = new Command58("grow").alias("resize").description("make a volume larger (a running box holding it is restarted once)").argument("<volume>", "volume name").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print the volume as JSON").action(async (name, size, opts, cmd) => {
6018
+ import { Command as Command62 } from "commander";
6019
+ var growCommand = new Command62("grow").alias("resize").description("make a volume larger (a running box holding it is restarted once)").argument("<volume>", "volume name").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print the volume as JSON").action(async (name, size, opts, cmd) => {
5845
6020
  const sizeGib = parseGib2(size, "size");
5846
6021
  const client = await clientFor(cmd.optsWithGlobals());
5847
6022
  try {
@@ -5854,8 +6029,8 @@ var growCommand = new Command58("grow").alias("resize").description("make a volu
5854
6029
  });
5855
6030
 
5856
6031
  // src/commands/volume/ls.ts
5857
- import { Command as Command59 } from "commander";
5858
- var lsCommand8 = new Command59("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) => {
6032
+ import { Command as Command63 } from "commander";
6033
+ var lsCommand9 = new Command63("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) => {
5859
6034
  const client = await clientFor(cmd.optsWithGlobals());
5860
6035
  try {
5861
6036
  const cloud = client.target.kind === "cloud";
@@ -5886,8 +6061,8 @@ var lsCommand8 = new Command59("ls").alias("list").description("list volumes: si
5886
6061
  });
5887
6062
 
5888
6063
  // src/commands/volume/rm.ts
5889
- import { Command as Command60 } from "commander";
5890
- var rmCommand7 = new Command60("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) => {
6064
+ import { Command as Command64 } from "commander";
6065
+ var rmCommand7 = new Command64("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) => {
5891
6066
  if (!await confirm(`Delete volume ${name} and everything on it?`, opts.yes ?? false)) {
5892
6067
  info("cancelled");
5893
6068
  process.exitCode = 1;
@@ -5903,14 +6078,15 @@ var rmCommand7 = new Command60("rm").alias("remove").description("delete a volum
5903
6078
  });
5904
6079
 
5905
6080
  // src/commands/volume/index.ts
5906
- var volumeCommand = new Command61("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(growCommand).addCommand(rmCommand7);
6081
+ var volumeCommand = new Command65("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(createCommand4).addCommand(lsCommand9).addCommand(attachCommand).addCommand(detachCommand).addCommand(growCommand).addCommand(rmCommand7);
5907
6082
  for (const cmd of volumeCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
6083
+ volumeCommand.addCommand(backupCommand2);
5908
6084
 
5909
6085
  // src/commands/bucket/index.ts
5910
- import { Command as Command71 } from "commander";
6086
+ import { Command as Command75 } from "commander";
5911
6087
 
5912
6088
  // src/commands/bucket/create.ts
5913
- import { Command as Command62 } from "commander";
6089
+ import { Command as Command66 } from "commander";
5914
6090
 
5915
6091
  // src/commands/bucket/shared.ts
5916
6092
  async function bucketClient(cmd) {
@@ -5936,7 +6112,7 @@ function printRows(rows2) {
5936
6112
  }
5937
6113
 
5938
6114
  // src/commands/bucket/create.ts
5939
- var createCommand4 = new Command62("create").description("make a bucket (the first one also makes your object storage)").argument("<name>", "bucket name: 3-63 lowercase letters, digits and '-'").option("--size <GB>", "how much your object storage may hold, when this is your first bucket (default 10)").option("--region <region>", "the S3 region of your object storage (ro-west-1, de-center-1), when this is your first bucket").option("--near <box>", "put the object storage on the host of this box, when this is your first bucket").option("--json", "print as JSON").action(async (name, opts, cmd) => {
6115
+ var createCommand5 = new Command66("create").description("make a bucket (the first one also makes your object storage)").argument("<name>", "bucket name: 3-63 lowercase letters, digits and '-'").option("--size <GB>", "how much your object storage may hold, when this is your first bucket (default 10)").option("--region <region>", "the S3 region of your object storage (ro-west-1, de-center-1), when this is your first bucket").option("--near <box>", "put the object storage on the host of this box, when this is your first bucket").option("--json", "print as JSON").action(async (name, opts, cmd) => {
5940
6116
  const sizeGib = opts.size === void 0 ? void 0 : parseGib2(opts.size);
5941
6117
  const client = await bucketClient(cmd);
5942
6118
  try {
@@ -5956,8 +6132,8 @@ var createCommand4 = new Command62("create").description("make a bucket (the fir
5956
6132
  });
5957
6133
 
5958
6134
  // src/commands/bucket/grow.ts
5959
- import { Command as Command63 } from "commander";
5960
- var growCommand2 = new Command63("grow").description("make your object storage larger (all your buckets share it; it restarts once)").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print the object storage as JSON").action(async (size, opts, cmd) => {
6135
+ import { Command as Command67 } from "commander";
6136
+ var growCommand2 = new Command67("grow").description("make your object storage larger (all your buckets share it; it restarts once)").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print the object storage as JSON").action(async (size, opts, cmd) => {
5961
6137
  const sizeGib = parseGib2(size, "size");
5962
6138
  const client = await bucketClient(cmd);
5963
6139
  try {
@@ -5970,8 +6146,8 @@ var growCommand2 = new Command63("grow").description("make your object storage l
5970
6146
  });
5971
6147
 
5972
6148
  // src/commands/bucket/info.ts
5973
- import { Command as Command64 } from "commander";
5974
- var infoCommand = new Command64("info").description("one bucket: its address, what it holds, how full your object storage is").argument("<name>", "bucket name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
6149
+ import { Command as Command68 } from "commander";
6150
+ var infoCommand = new Command68("info").description("one bucket: its address, what it holds, how full your object storage is").argument("<name>", "bucket name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
5975
6151
  const client = await bucketClient(cmd);
5976
6152
  try {
5977
6153
  const b = await client.getBucket(name);
@@ -6000,11 +6176,11 @@ with the AWS CLI: aws s3 ls s3://${b.name} --endpoint-url ${b.endpoint}`));
6000
6176
  });
6001
6177
 
6002
6178
  // src/commands/bucket/key/index.ts
6003
- import { Command as Command68 } from "commander";
6179
+ import { Command as Command72 } from "commander";
6004
6180
 
6005
6181
  // src/commands/bucket/key/create.ts
6006
- import { Command as Command65 } from "commander";
6007
- var createCommand5 = new Command65("create").description("make an access key for a bucket (the secret is shown once)").argument("<bucket>", "bucket name").option("--name <label>", "what to call the key, to tell it from the others").option("--read-only", "the key reads the bucket but cannot write to it").option("--json", "print as JSON").action(async (bucket, opts, cmd) => {
6182
+ import { Command as Command69 } from "commander";
6183
+ var createCommand6 = new Command69("create").description("make an access key for a bucket (the secret is shown once)").argument("<bucket>", "bucket name").option("--name <label>", "what to call the key, to tell it from the others").option("--read-only", "the key reads the bucket but cannot write to it").option("--json", "print as JSON").action(async (bucket, opts, cmd) => {
6008
6184
  const client = await bucketClient(cmd);
6009
6185
  try {
6010
6186
  const key = await client.createBucketKey(bucket, { ...opts.name !== void 0 ? { name: opts.name } : {}, ...opts.readOnly ? { readOnly: true } : {} });
@@ -6027,8 +6203,8 @@ var createCommand5 = new Command65("create").description("make an access key for
6027
6203
  });
6028
6204
 
6029
6205
  // src/commands/bucket/key/ls.ts
6030
- import { Command as Command66 } from "commander";
6031
- var lsCommand9 = new Command66("ls").alias("list").description("list a bucket's access keys (never their secrets)").argument("<bucket>", "bucket name").option("--json", "print as JSON").action(async (bucket, opts, cmd) => {
6206
+ import { Command as Command70 } from "commander";
6207
+ var lsCommand10 = new Command70("ls").alias("list").description("list a bucket's access keys (never their secrets)").argument("<bucket>", "bucket name").option("--json", "print as JSON").action(async (bucket, opts, cmd) => {
6032
6208
  const client = await bucketClient(cmd);
6033
6209
  try {
6034
6210
  const keys = await client.listBucketKeys(bucket);
@@ -6047,8 +6223,8 @@ var lsCommand9 = new Command66("ls").alias("list").description("list a bucket's
6047
6223
  });
6048
6224
 
6049
6225
  // src/commands/bucket/key/rm.ts
6050
- import { Command as Command67 } from "commander";
6051
- var rmCommand8 = new Command67("rm").alias("remove").description("delete an access key: whatever uses it stops reaching the bucket").argument("<bucket>", "bucket name").argument("<access-key>", "the access key id (kvbox bucket key ls)").option("-y, --yes", "do not ask for confirmation").action(async (bucket, id, opts, cmd) => {
6226
+ import { Command as Command71 } from "commander";
6227
+ var rmCommand8 = new Command71("rm").alias("remove").description("delete an access key: whatever uses it stops reaching the bucket").argument("<bucket>", "bucket name").argument("<access-key>", "the access key id (kvbox bucket key ls)").option("-y, --yes", "do not ask for confirmation").action(async (bucket, id, opts, cmd) => {
6052
6228
  const client = await bucketClient(cmd);
6053
6229
  try {
6054
6230
  if (!await confirm(`Delete key ${id} of bucket ${bucket}? Whatever uses it stops working.`, opts.yes ?? false)) {
@@ -6064,11 +6240,11 @@ var rmCommand8 = new Command67("rm").alias("remove").description("delete an acce
6064
6240
  });
6065
6241
 
6066
6242
  // src/commands/bucket/key/index.ts
6067
- var keyCommand = new Command68("key").aliases(["keys"]).description("access keys of a bucket: what your app signs in with").addCommand(createCommand5).addCommand(lsCommand9).addCommand(rmCommand8);
6243
+ var keyCommand = new Command72("key").aliases(["keys"]).description("access keys of a bucket: what your app signs in with").addCommand(createCommand6).addCommand(lsCommand10).addCommand(rmCommand8);
6068
6244
 
6069
6245
  // src/commands/bucket/ls.ts
6070
- import { Command as Command69 } from "commander";
6071
- var lsCommand10 = new Command69("ls").alias("list").description("list buckets, and the object storage they are in").option("-a, --all", "every bucket on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
6246
+ import { Command as Command73 } from "commander";
6247
+ var lsCommand11 = new Command73("ls").alias("list").description("list buckets, and the object storage they are in").option("-a, --all", "every bucket on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
6072
6248
  const client = await bucketClient(cmd);
6073
6249
  try {
6074
6250
  const buckets = await client.listBuckets({ all: opts.all });
@@ -6098,8 +6274,8 @@ var lsCommand10 = new Command69("ls").alias("list").description("list buckets, a
6098
6274
  });
6099
6275
 
6100
6276
  // src/commands/bucket/rm.ts
6101
- import { Command as Command70 } from "commander";
6102
- var rmCommand9 = new Command70("rm").alias("remove").description("delete an empty bucket and its keys (the last one takes your object storage with it)").argument("<name>", "bucket name").option("--force", "your last bucket only: delete it with everything in it").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
6277
+ import { Command as Command74 } from "commander";
6278
+ var rmCommand9 = new Command74("rm").alias("remove").description("delete an empty bucket and its keys (the last one takes your object storage with it)").argument("<name>", "bucket name").option("--force", "your last bucket only: delete it with everything in it").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
6103
6279
  const client = await bucketClient(cmd);
6104
6280
  try {
6105
6281
  const question = opts.force ? `Delete bucket ${name} with everything in it, and the object storage it is in?` : `Delete bucket ${name} and its keys?`;
@@ -6118,7 +6294,7 @@ var rmCommand9 = new Command70("rm").alias("remove").description("delete an empt
6118
6294
  });
6119
6295
 
6120
6296
  // src/commands/bucket/index.ts
6121
- var bucketCommand = new Command71("bucket").aliases(["buckets"]).description("object storage: S3 buckets for your files, and the access keys your apps use").addCommand(createCommand4).addCommand(lsCommand10).addCommand(infoCommand).addCommand(growCommand2).addCommand(rmCommand9).addCommand(keyCommand);
6297
+ var bucketCommand = new Command75("bucket").aliases(["buckets"]).description("object storage: S3 buckets for your files, and the access keys your apps use").addCommand(createCommand5).addCommand(lsCommand11).addCommand(infoCommand).addCommand(growCommand2).addCommand(rmCommand9).addCommand(keyCommand);
6122
6298
  var withOrg = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal buckets)");
6123
6299
  for (const cmd of bucketCommand.commands) {
6124
6300
  if (cmd === keyCommand) cmd.commands.forEach(withOrg);
@@ -6126,10 +6302,10 @@ for (const cmd of bucketCommand.commands) {
6126
6302
  }
6127
6303
 
6128
6304
  // src/commands/managed/kind.ts
6129
- import { Command as Command84 } from "commander";
6305
+ import { Command as Command88 } from "commander";
6130
6306
 
6131
6307
  // src/commands/managed/create.ts
6132
- import { Command as Command73 } from "commander";
6308
+ import { Command as Command77 } from "commander";
6133
6309
  import { setTimeout as sleep3 } from "timers/promises";
6134
6310
 
6135
6311
  // src/commands/managed/shared.ts
@@ -6215,8 +6391,8 @@ function parseStorage(text2, flag) {
6215
6391
  // src/commands/managed/create.ts
6216
6392
  var READY_WAIT_MS = 9e4;
6217
6393
  var READY_STEP_MS = 2e3;
6218
- var createCommand6 = (spec) => {
6219
- const command = new Command73("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");
6394
+ var createCommand7 = (spec) => {
6395
+ const command = new Command77("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");
6220
6396
  for (const o of spec.options) command.option(`--${o.name} <${o.arg}>`, o.help);
6221
6397
  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 the box can be linked to it").option("--json", "print it as JSON, password included").action(async (name, opts, cmd) => {
6222
6398
  const options = Object.fromEntries(spec.options.flatMap((o) => typeof opts[o.name] === "string" ? [[o.name, opts[o.name]]] : []));
@@ -6257,8 +6433,8 @@ var createCommand6 = (spec) => {
6257
6433
  };
6258
6434
 
6259
6435
  // src/commands/managed/grow.ts
6260
- import { Command as Command74 } from "commander";
6261
- var growCommand3 = (spec) => new Command74("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) => {
6436
+ import { Command as Command78 } from "commander";
6437
+ var growCommand3 = (spec) => new Command78("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) => {
6262
6438
  const storageGib = parseStorage(size, "size");
6263
6439
  const client = await managedClient(cmd);
6264
6440
  try {
@@ -6271,8 +6447,8 @@ var growCommand3 = (spec) => new Command74("grow").description("give a database
6271
6447
  });
6272
6448
 
6273
6449
  // src/commands/managed/info.ts
6274
- import { Command as Command75 } from "commander";
6275
- var infoCommand2 = (spec) => new Command75("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) => {
6450
+ import { Command as Command79 } from "commander";
6451
+ var infoCommand2 = (spec) => new Command79("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) => {
6276
6452
  const client = await managedClient(cmd);
6277
6453
  try {
6278
6454
  const m = await client.getManaged(spec.kind, name);
@@ -6284,8 +6460,8 @@ var infoCommand2 = (spec) => new Command75("info").alias("get").description("sho
6284
6460
  });
6285
6461
 
6286
6462
  // src/commands/managed/link.ts
6287
- import { Command as Command76 } from "commander";
6288
- var linkCommand2 = (spec) => new Command76("link").description("let a box reach a database privately (same host)").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box, opts, cmd) => {
6463
+ import { Command as Command80 } from "commander";
6464
+ var linkCommand2 = (spec) => new Command80("link").description("let a box reach a database privately (same host)").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box, opts, cmd) => {
6289
6465
  const client = await managedClient(cmd);
6290
6466
  try {
6291
6467
  const m = await spin(`linking ${box} to ${name}\u2026`, client.linkManaged(spec.kind, name, box));
@@ -6301,7 +6477,7 @@ var linkCommand2 = (spec) => new Command76("link").description("let a box reach
6301
6477
  });
6302
6478
 
6303
6479
  // src/commands/managed/ls.ts
6304
- import { Command as Command77 } from "commander";
6480
+ import { Command as Command81 } from "commander";
6305
6481
  function listRows(items, user, kindColumn) {
6306
6482
  return items.map((m) => ({
6307
6483
  owner: m.owner === user ? "private" : m.owner,
@@ -6315,7 +6491,7 @@ function listRows(items, user, kindColumn) {
6315
6491
  created: age(m.createdAt)
6316
6492
  }));
6317
6493
  }
6318
- var lsCommand11 = (spec) => new Command77("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) => {
6494
+ var lsCommand12 = (spec) => new Command81("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) => {
6319
6495
  const client = await managedClient(cmd);
6320
6496
  try {
6321
6497
  const items = await client.listManaged(spec?.kind, { all: opts.all });
@@ -6335,8 +6511,8 @@ var lsCommand11 = (spec) => new Command77("ls").alias("list").description(spec ?
6335
6511
  });
6336
6512
 
6337
6513
  // src/commands/managed/password.ts
6338
- import { Command as Command78 } from "commander";
6339
- var passwordCommand = (spec) => new Command78("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) => {
6514
+ import { Command as Command82 } from "commander";
6515
+ var passwordCommand = (spec) => new Command82("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) => {
6340
6516
  const client = await managedClient(cmd);
6341
6517
  try {
6342
6518
  const secret = opts.reset ? await spin(`setting a new password on ${name}\u2026`, client.resetManagedPassword(spec.kind, name)) : await client.managedPassword(spec.kind, name);
@@ -6352,8 +6528,8 @@ var passwordCommand = (spec) => new Command78("password").description("show a da
6352
6528
  });
6353
6529
 
6354
6530
  // src/commands/managed/public.ts
6355
- import { Command as Command79 } from "commander";
6356
- var publicCommand = (spec) => new Command79("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) => {
6531
+ import { Command as Command83 } from "commander";
6532
+ var publicCommand = (spec) => new Command83("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) => {
6357
6533
  if (state !== "on" && state !== "off") throw new KvboxError(`write on or off: kvbox ${spec.command} public ${name} on`);
6358
6534
  const client = await managedClient(cmd);
6359
6535
  try {
@@ -6374,8 +6550,8 @@ var publicCommand = (spec) => new Command79("public").description("open a databa
6374
6550
  });
6375
6551
 
6376
6552
  // src/commands/managed/rm.ts
6377
- import { Command as Command80 } from "commander";
6378
- var rmCommand10 = (spec) => new Command80("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) => {
6553
+ import { Command as Command84 } from "commander";
6554
+ var rmCommand10 = (spec) => new Command84("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) => {
6379
6555
  const client = await managedClient(cmd);
6380
6556
  try {
6381
6557
  if (!await confirm(`Delete database ${name} and all its data? There is no backup.`, opts.yes ?? false)) {
@@ -6391,8 +6567,8 @@ var rmCommand10 = (spec) => new Command80("rm").alias("remove").description("del
6391
6567
  });
6392
6568
 
6393
6569
  // src/commands/managed/start.ts
6394
- import { Command as Command81 } from "commander";
6395
- var startCommand2 = (spec) => new Command81("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
6570
+ import { Command as Command85 } from "commander";
6571
+ var startCommand2 = (spec) => new Command85("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
6396
6572
  const client = await managedClient(cmd);
6397
6573
  try {
6398
6574
  const m = await spin(`starting ${name}\u2026`, client.startManaged(spec.kind, name));
@@ -6404,8 +6580,8 @@ var startCommand2 = (spec) => new Command81("start").description("run a stopped
6404
6580
  });
6405
6581
 
6406
6582
  // src/commands/managed/stop.ts
6407
- import { Command as Command82 } from "commander";
6408
- var stopCommand2 = (spec) => new Command82("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) => {
6583
+ import { Command as Command86 } from "commander";
6584
+ var stopCommand2 = (spec) => new Command86("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) => {
6409
6585
  const client = await managedClient(cmd);
6410
6586
  try {
6411
6587
  const m = await spin(`stopping ${name}\u2026`, client.stopManaged(spec.kind, name));
@@ -6417,8 +6593,8 @@ var stopCommand2 = (spec) => new Command82("stop").description("shut a database
6417
6593
  });
6418
6594
 
6419
6595
  // src/commands/managed/unlink.ts
6420
- import { Command as Command83 } from "commander";
6421
- var unlinkCommand2 = (spec) => new Command83("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, box, opts, cmd) => {
6596
+ import { Command as Command87 } from "commander";
6597
+ var unlinkCommand2 = (spec) => new Command87("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, box, opts, cmd) => {
6422
6598
  const client = await managedClient(cmd);
6423
6599
  try {
6424
6600
  const m = await spin(`unlinking ${box} from ${name}\u2026`, client.unlinkManaged(spec.kind, name, box));
@@ -6431,8 +6607,8 @@ var unlinkCommand2 = (spec) => new Command83("unlink").description("stop a box f
6431
6607
 
6432
6608
  // src/commands/managed/kind.ts
6433
6609
  function kindCommand(spec, description) {
6434
- const command = new Command84(spec.command).aliases(spec.aliases).description(description);
6435
- for (const make of [createCommand6, lsCommand11, infoCommand2, passwordCommand, publicCommand, linkCommand2, unlinkCommand2, growCommand3, stopCommand2, startCommand2, rmCommand10]) {
6610
+ const command = new Command88(spec.command).aliases(spec.aliases).description(description);
6611
+ for (const make of [createCommand7, lsCommand12, infoCommand2, passwordCommand, publicCommand, linkCommand2, unlinkCommand2, growCommand3, stopCommand2, startCommand2, rmCommand10]) {
6436
6612
  command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
6437
6613
  }
6438
6614
  return command;
@@ -6445,14 +6621,14 @@ var pgCommand = kindCommand(POSTGRES2, "managed PostgreSQL: a database kvbox run
6445
6621
  var redisCommand = kindCommand(REDIS, "managed Redis (Valkey): a Redis kvbox runs for you, private until you link a box or make it public");
6446
6622
 
6447
6623
  // src/commands/managed/index.ts
6448
- import { Command as Command85 } from "commander";
6449
- var managedCommand = new Command85("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand11().option("--org <slug>", "act in this org (- for your personal databases)"));
6624
+ import { Command as Command89 } from "commander";
6625
+ var managedCommand = new Command89("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand12().option("--org <slug>", "act in this org (- for your personal databases)"));
6450
6626
 
6451
6627
  // src/commands/env/index.ts
6452
- import { Command as Command89 } from "commander";
6628
+ import { Command as Command93 } from "commander";
6453
6629
 
6454
6630
  // src/commands/env/ls.ts
6455
- import { Command as Command86 } from "commander";
6631
+ import { Command as Command90 } from "commander";
6456
6632
 
6457
6633
  // src/commands/env/shared.ts
6458
6634
  function requireCloud4(client) {
@@ -6479,7 +6655,7 @@ function firstBootHint(box, name) {
6479
6655
  }
6480
6656
 
6481
6657
  // src/commands/env/ls.ts
6482
- var lsCommand12 = new Command86("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) => {
6658
+ var lsCommand13 = new Command90("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) => {
6483
6659
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
6484
6660
  try {
6485
6661
  if (opts.box !== void 0) {
@@ -6518,8 +6694,8 @@ var lsCommand12 = new Command86("ls").alias("list").description("list the variab
6518
6694
  });
6519
6695
 
6520
6696
  // src/commands/env/rm.ts
6521
- import { Command as Command87 } from "commander";
6522
- var rmCommand11 = new Command87("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) => {
6697
+ import { Command as Command91 } from "commander";
6698
+ var rmCommand11 = new Command91("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) => {
6523
6699
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
6524
6700
  try {
6525
6701
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
@@ -6556,8 +6732,8 @@ var rmCommand11 = new Command87("rm").alias("remove").description("remove variab
6556
6732
  });
6557
6733
 
6558
6734
  // src/commands/env/set.ts
6559
- import { Command as Command88 } from "commander";
6560
- var setCommand2 = new Command88("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) => {
6735
+ import { Command as Command92 } from "commander";
6736
+ var setCommand2 = new Command92("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) => {
6561
6737
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
6562
6738
  try {
6563
6739
  const owner = opts.box === void 0 ? requireCloud4(client) : void 0;
@@ -6594,14 +6770,14 @@ var setCommand2 = new Command88("set").description("add or change a variable; bo
6594
6770
  });
6595
6771
 
6596
6772
  // src/commands/env/index.ts
6597
- var envCommand = new Command89("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand12, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand11);
6773
+ var envCommand = new Command93("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand13, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand11);
6598
6774
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
6599
6775
 
6600
6776
  // src/commands/domain/index.ts
6601
- import { Command as Command93 } from "commander";
6777
+ import { Command as Command97 } from "commander";
6602
6778
 
6603
6779
  // src/commands/domain/add.ts
6604
- import { Command as Command90 } from "commander";
6780
+ import { Command as Command94 } from "commander";
6605
6781
 
6606
6782
  // src/commands/domain/shared.ts
6607
6783
  function requireCloud5(client) {
@@ -6621,7 +6797,7 @@ function hostIn(name, zone) {
6621
6797
  }
6622
6798
 
6623
6799
  // src/commands/domain/add.ts
6624
- var addCommand3 = new Command90("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) => {
6800
+ var addCommand3 = new Command94("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) => {
6625
6801
  const domain = assertDomain(domainArg.trim().toLowerCase());
6626
6802
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
6627
6803
  const client = await clientFor(cmd.optsWithGlobals());
@@ -6657,8 +6833,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
6657
6833
  });
6658
6834
 
6659
6835
  // src/commands/domain/ls.ts
6660
- import { Command as Command91 } from "commander";
6661
- var lsCommand13 = new Command91("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
6836
+ import { Command as Command95 } from "commander";
6837
+ var lsCommand14 = new Command95("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
6662
6838
  const client = await clientFor(cmd.optsWithGlobals());
6663
6839
  try {
6664
6840
  requireCloud5(client);
@@ -6687,8 +6863,8 @@ var lsCommand13 = new Command91("ls").alias("list").description("list your custo
6687
6863
  });
6688
6864
 
6689
6865
  // src/commands/domain/rm.ts
6690
- import { Command as Command92 } from "commander";
6691
- var rmCommand12 = new Command92("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) => {
6866
+ import { Command as Command96 } from "commander";
6867
+ var rmCommand12 = new Command96("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) => {
6692
6868
  const domain = domainArg.trim().toLowerCase();
6693
6869
  const client = await clientFor(cmd.optsWithGlobals());
6694
6870
  try {
@@ -6709,7 +6885,7 @@ var rmCommand12 = new Command92("rm").alias("remove").description("stop serving
6709
6885
  });
6710
6886
 
6711
6887
  // src/commands/domain/index.ts
6712
- var domainCommand = new Command93("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand3).addCommand(lsCommand13).addCommand(rmCommand12);
6888
+ var domainCommand = new Command97("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand3).addCommand(lsCommand14).addCommand(rmCommand12);
6713
6889
  for (const cmd of domainCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
6714
6890
 
6715
6891
  // src/commands/update.ts
@@ -6717,7 +6893,7 @@ import { spawn as spawn6 } from "child_process";
6717
6893
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
6718
6894
  import { tmpdir } from "os";
6719
6895
  import { join as join9 } from "path";
6720
- import { Command as Command94 } from "commander";
6896
+ import { Command as Command98 } from "commander";
6721
6897
 
6722
6898
  // src/update.ts
6723
6899
  import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
@@ -6836,7 +7012,7 @@ function run2(cmd, args) {
6836
7012
  child.on("exit", (code, signal) => resolve4(code ?? (signal ? 1 : 0)));
6837
7013
  });
6838
7014
  }
6839
- var selfUpdateCommand = new Command94("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
7015
+ var selfUpdateCommand = new Command98("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
6840
7016
  suppressUpdateNotice();
6841
7017
  const inst = installerFor(process.platform, process.env["KVBOX_INSTALL_URL"] || INSTALL_BASE);
6842
7018
  let code;
@@ -6961,7 +7137,7 @@ function installRootHelp(program) {
6961
7137
 
6962
7138
  // src/program.ts
6963
7139
  function buildProgram() {
6964
- const program = new Command95("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();
7140
+ const program = new Command99("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();
6965
7141
  program.addCommand(vmCommand);
6966
7142
  program.addCommand(snapshotsCommand);
6967
7143
  program.addCommand(volumeCommand);