@kvbox/cli 0.6.10 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kvbox.js CHANGED
@@ -155,7 +155,7 @@ async function spin(message, work, opts = {}) {
155
155
  }
156
156
 
157
157
  // src/program.ts
158
- import { Command as Command129 } from "commander";
158
+ import { Command as Command130 } from "commander";
159
159
 
160
160
  // ../shared/src/version.ts
161
161
  import { createRequire } from "module";
@@ -170,10 +170,10 @@ function versionOf(srcFileUrl, injected) {
170
170
  }
171
171
 
172
172
  // src/version.ts
173
- var VERSION = versionOf(import.meta.url, true ? "0.6.10" : void 0);
173
+ var VERSION = versionOf(import.meta.url, true ? "0.6.11" : void 0);
174
174
 
175
175
  // src/commands/vm/index.ts
176
- import { Command as Command38 } from "commander";
176
+ import { Command as Command39 } from "commander";
177
177
 
178
178
  // src/commands/vm/connect.ts
179
179
  import { spawnSync as spawnSync3 } from "child_process";
@@ -896,6 +896,11 @@ var CapacitySchema = z.object({
896
896
  reservedMemMib: z.number().int(),
897
897
  reservedVcpu: z.number().int(),
898
898
  running: z.number().int(),
899
+ /**
900
+ * MiB of RAM the host keeps back from its boxes (config.json `memHeadroomMib`). Absent on a kvbox-server
901
+ * from before the setting, which keeps 2 GB (`OLD_HOST_MEM_HEADROOM_MIB`).
902
+ */
903
+ memHeadroomMib: z.number().int().optional(),
899
904
  /** Absent on a host from before volumes (#91): it cannot take one. */
900
905
  disk: DiskCapacitySchema.optional(),
901
906
  /**
@@ -3724,25 +3729,25 @@ async function runSsh(ssh, opts) {
3724
3729
  }).finally(() => clearTimeout(timer));
3725
3730
  return { status: status2, chunks, timedOut };
3726
3731
  }
3727
- var execCommand = new Command3("exec").description("run a command in a box and exit with its status (kvbox exec <name> -- <cmd>)").argument("<name>", "box name").argument("<cmd...>", "command, passed to the box's shell as one string (pipes, &&, cd work)").option("-e, --env <KEY=VALUE>", "set an environment variable for the command (repeatable)", collect2).option("--timeout <seconds>", "kill the command after N seconds and exit 124", positiveSeconds).option("--tty", "allocate a pseudo-terminal (for interactive tools like htop)").option("--json", 'capture output and print {"output": "...", "exit_code": N}').option("--direct", "on the box's host: ssh to the box's private ip, not through the public address or relay").action(async (name, cmdArgs, opts, cmd) => {
3728
- const client = await clientFor(cmd.optsWithGlobals());
3729
- let ep;
3730
- let cert;
3731
- let owner;
3732
+ async function reachBox(globals, name, direct) {
3733
+ const client = await clientFor(globals);
3732
3734
  try {
3733
3735
  let box2 = pickRef(await boxesFor(client, name), name, me(client));
3734
3736
  if (!box2) throw new KvboxError(`box ${name}: not found (kvbox ls)`);
3735
3737
  if (box2.status === "stopped") throw new KvboxError(`box ${name} is stopped (kvbox start ${name})`);
3736
- cert = await ensureCert(client, void 0, void 0, { owner: box2.owner });
3737
- owner = box2.owner;
3738
+ const cert = await ensureCert(client, void 0, void 0, { owner: box2.owner });
3738
3739
  const wasRunning = box2.status === "running";
3739
3740
  if (!wasRunning) box2 = await wakeUp(client, box2, displayName(box2, me(client)));
3740
- ep = sshEndpoint(box2, client.target, opts.direct);
3741
+ const ep = sshEndpoint(box2, client.target, direct);
3741
3742
  if (!wasRunning) await spin(`waiting for ${name} to accept SSH\u2026`, waitForSsh(ep));
3742
- else if (opts.direct) await checkDirect(ep);
3743
+ else if (direct) await checkDirect(ep);
3744
+ return { ep, cert, owner: box2.owner };
3743
3745
  } finally {
3744
3746
  await client.close();
3745
3747
  }
3748
+ }
3749
+ var execCommand = new Command3("exec").description("run a command in a box and exit with its status (kvbox exec <name> -- <cmd>)").argument("<name>", "box name").argument("<cmd...>", "command, passed to the box's shell as one string (pipes, &&, cd work)").option("-e, --env <KEY=VALUE>", "set an environment variable for the command (repeatable)", collect2).option("--timeout <seconds>", "kill the command after N seconds and exit 124", positiveSeconds).option("--tty", "allocate a pseudo-terminal (for interactive tools like htop)").option("--json", 'capture output and print {"output": "...", "exit_code": N}').option("--direct", "on the box's host: ssh to the box's private ip, not through the public address or relay").action(async (name, cmdArgs, opts, cmd) => {
3750
+ const { ep, cert, owner } = await reachBox(cmd.optsWithGlobals(), name, opts.direct);
3746
3751
  const remote = remoteCommand(cmdArgs, opts.env ?? []);
3747
3752
  const stdinIsTty = process.stdin.isTTY === true;
3748
3753
  const ssh = [
@@ -3773,9 +3778,66 @@ var execCommand = new Command3("exec").description("run a command in a box and e
3773
3778
  process.exit(status2);
3774
3779
  });
3775
3780
 
3781
+ // src/commands/vm/cp.ts
3782
+ import { spawn as spawn3 } from "child_process";
3783
+ import { Command as Command4 } from "commander";
3784
+ function parseSide(arg, platform = process.platform) {
3785
+ if (platform === "win32" && /^[A-Za-z]:[\\/]/.test(arg)) return { box: void 0, path: arg };
3786
+ const m = /^([^/:\\]+(?:\/[^/:\\]+)?):(.*)$/s.exec(arg);
3787
+ if (!m || arg.startsWith("./") || arg.startsWith("../")) return { box: void 0, path: arg };
3788
+ return { box: m[1], path: m[2] };
3789
+ }
3790
+ function parseCopy(src, dest, platform = process.platform) {
3791
+ const from = parseSide(src, platform);
3792
+ const to = parseSide(dest, platform);
3793
+ if (from.box !== void 0 && to.box !== void 0) {
3794
+ throw new KvboxError("both sides are in a box: copy between this machine and one box (kvbox cp <file> <box>:<path>)");
3795
+ }
3796
+ const box2 = from.box ?? to.box;
3797
+ if (box2 === void 0) {
3798
+ throw new KvboxError("neither side is in a box: write the box side as <box>:<path> (kvbox cp ./app.apk dev:app.apk)");
3799
+ }
3800
+ return { box: box2, from, to };
3801
+ }
3802
+ function scpArgs(ep, from, to, recursive) {
3803
+ const ssh = sshArgs(ep);
3804
+ const options = ssh.slice(0, -1).map((a) => a === "-p" ? "-P" : a);
3805
+ const host = ep.host.includes(":") ? `[${ep.host}]` : ep.host;
3806
+ const side = (s) => s.box === void 0 ? s.path : `${ep.user}@${host}:${s.path === "" ? "." : s.path}`;
3807
+ return [...recursive ? ["-r"] : [], ...options, side(from), side(to)];
3808
+ }
3809
+ async function runScp(args) {
3810
+ const child = spawn3("scp", args, { stdio: ["inherit", "inherit", "pipe"] });
3811
+ let refused = false;
3812
+ child.stderr?.on("data", (c2) => {
3813
+ process.stderr.write(c2);
3814
+ if (c2.toString("utf8").includes("Permission denied")) refused = true;
3815
+ });
3816
+ const status2 = await new Promise((resolve4, reject) => {
3817
+ child.once("error", (err) => reject(new KvboxError(`could not run scp: ${err.message}`)));
3818
+ child.once("close", (code, signal) => resolve4(code ?? (signal === "SIGINT" ? 130 : 1)));
3819
+ });
3820
+ return { status: status2, refused };
3821
+ }
3822
+ var cpCommand = new Command4("cp").description("copy files between this machine and a box (kvbox cp ./f <box>:f, kvbox cp <box>:f .)").argument("<src>", "a local path, or <box>:<path>").argument("<dest>", "a local path, or <box>:<path>").option("-r, --recursive", "copy directories").option("--direct", "on the box's host: ssh to the box's private ip, not through the public address or relay").action(async (src, dest, opts, cmd) => {
3823
+ const { box: box2, from, to } = parseCopy(src, dest);
3824
+ const { ep, cert, owner } = await reachBox(cmd.optsWithGlobals(), box2, opts.direct);
3825
+ const args = scpArgs(ep, from, to, opts.recursive === true);
3826
+ const first = await runScp(args);
3827
+ let status2 = first.status;
3828
+ if (status2 !== 0 && first.refused) {
3829
+ const again = await clientFor(cmd.optsWithGlobals());
3830
+ if (await renewAfterRefusal(again, cert, owner).finally(() => again.close())) {
3831
+ info("renewed your SSH certificate, trying again\u2026");
3832
+ ({ status: status2 } = await runScp(args));
3833
+ }
3834
+ }
3835
+ if (status2 !== 0) process.exit(status2);
3836
+ });
3837
+
3776
3838
  // src/commands/vm/fork.ts
3777
- import { Command as Command4, Option as Option2 } from "commander";
3778
- var forkCommand = new Command4("fork").description("copy a box, running or stopped, into a new one on the same host (--org: into an org)").argument("<box>", "the box to copy").argument("[name]", "the copy's name (box1, box2, \u2026 when omitted)").addOption(new Option2("-s, --size <size>", "the copy's size, for a stopped box only (default: the box's)").choices(SIZE_NAMES)).option("--auto-hibernate <duration>", "hibernate the copy after this long without network traffic (30m, 4h, 1d; off: never; default: the box's)").option("--force", "skip the capacity guard").option("--json", "print the new box as JSON").action(async (source, name, opts, cmd) => {
3839
+ import { Command as Command5, Option as Option2 } from "commander";
3840
+ var forkCommand = new Command5("fork").description("copy a box, running or stopped, into a new one on the same host (--org: into an org)").argument("<box>", "the box to copy").argument("[name]", "the copy's name (box1, box2, \u2026 when omitted)").addOption(new Option2("-s, --size <size>", "the copy's size, for a stopped box only (default: the box's)").choices(SIZE_NAMES)).option("--auto-hibernate <duration>", "hibernate the copy after this long without network traffic (30m, 4h, 1d; off: never; default: the box's)").option("--force", "skip the capacity guard").option("--json", "print the new box as JSON").action(async (source, name, opts, cmd) => {
3779
3841
  const autoHibernateSec = opts.autoHibernate === void 0 ? void 0 : parseIdleTimeout(opts.autoHibernate);
3780
3842
  const client = await clientFor(cmd.optsWithGlobals());
3781
3843
  try {
@@ -3801,10 +3863,10 @@ var forkCommand = new Command4("fork").description("copy a box, running or stopp
3801
3863
  });
3802
3864
 
3803
3865
  // src/commands/vm/get.ts
3804
- import { Command as Command6 } from "commander";
3866
+ import { Command as Command7 } from "commander";
3805
3867
 
3806
3868
  // src/commands/vm/ls.ts
3807
- import { Command as Command5 } from "commander";
3869
+ import { Command as Command6 } from "commander";
3808
3870
  function ownerCell(b, me2) {
3809
3871
  const slug = slugOf(b.owner);
3810
3872
  if (slug === me2) return "private";
@@ -3814,7 +3876,7 @@ function addressOf(b) {
3814
3876
  if (b.ssh !== void 0) return b.ssh.host;
3815
3877
  return b.ip === "" ? "-" : b.ip;
3816
3878
  }
3817
- var lsCommand = new Command5("ls").description("list boxes with status and address (yours and your orgs'; --org <slug> for one org)").option("-a, --all", "every box on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
3879
+ var lsCommand = new Command6("ls").description("list boxes with status and address (yours and your orgs'; --org <slug> for one org)").option("-a, --all", "every box on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
3818
3880
  const client = await clientFor(cmd.optsWithGlobals());
3819
3881
  try {
3820
3882
  const cloud = client.target.kind === "cloud";
@@ -3886,7 +3948,7 @@ async function findBox(client, text2) {
3886
3948
  }
3887
3949
 
3888
3950
  // src/commands/vm/get.ts
3889
- var getCommand = new Command6("get").description("show one box in full: status, size, address, HTTPS name, ports, auto-hibernate").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3951
+ var getCommand = new Command7("get").description("show one box in full: status, size, address, HTTPS name, ports, auto-hibernate").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3890
3952
  const client = await clientFor(cmd.optsWithGlobals());
3891
3953
  try {
3892
3954
  const user = me(client);
@@ -3939,8 +4001,8 @@ function getRows(box2, subs, user) {
3939
4001
  }
3940
4002
 
3941
4003
  // src/commands/vm/hibernate.ts
3942
- import { Command as Command7 } from "commander";
3943
- var hibernateCommand = new Command7("hibernate").description("save a box's memory to disk and free its RAM (kvbox wake continues it where it left off)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
4004
+ import { Command as Command8 } from "commander";
4005
+ var hibernateCommand = new Command8("hibernate").description("save a box's memory to disk and free its RAM (kvbox wake continues it where it left off)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
3944
4006
  const client = await clientFor(cmd.optsWithGlobals());
3945
4007
  try {
3946
4008
  const box2 = await spin(`hibernating ${name} (saving its memory to disk)\u2026`, client.hibernateMachine(name));
@@ -3952,13 +4014,13 @@ var hibernateCommand = new Command7("hibernate").description("save a box's memor
3952
4014
  });
3953
4015
 
3954
4016
  // src/commands/vm/link.ts
3955
- import { Command as Command8 } from "commander";
4017
+ import { Command as Command9 } from "commander";
3956
4018
  function parseLinkPort(text2) {
3957
4019
  const port = Number(text2);
3958
4020
  if (!Number.isInteger(port) || port < 1 || port > 65535) throw new KvboxError(`--port: expected a port from 1 to 65535, got "${text2}"`);
3959
4021
  return port;
3960
4022
  }
3961
- var linkCommand = new Command8("link").description("let one box reach a port of another (private, same host; never public)").argument("<from>", "the box that connects").argument("<box>", "the box it may reach").requiredOption("-p, --port <port>", "the port in <box>").option("--json", "print the link as JSON").action(async (from, name, opts, cmd) => {
4023
+ var linkCommand = new Command9("link").description("let one box reach a port of another (private, same host; never public)").argument("<from>", "the box that connects").argument("<box>", "the box it may reach").requiredOption("-p, --port <port>", "the port in <box>").option("--json", "print the link as JSON").action(async (from, name, opts, cmd) => {
3962
4024
  const port = parseLinkPort(opts.port);
3963
4025
  const client = await clientFor(cmd.optsWithGlobals());
3964
4026
  try {
@@ -3981,8 +4043,8 @@ var linkCommand = new Command8("link").description("let one box reach a port of
3981
4043
  });
3982
4044
 
3983
4045
  // src/commands/vm/links.ts
3984
- import { Command as Command9 } from "commander";
3985
- var linksCommand = new Command9("links").description("list the links between boxes (kvbox vm link)").argument("[box]", "only links into or out of this box").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4046
+ import { Command as Command10 } from "commander";
4047
+ var linksCommand = new Command10("links").description("list the links between boxes (kvbox vm link)").argument("[box]", "only links into or out of this box").option("--json", "print as JSON").action(async (name, opts, cmd) => {
3986
4048
  const client = await clientFor(cmd.optsWithGlobals());
3987
4049
  try {
3988
4050
  const user = me(client);
@@ -4015,8 +4077,8 @@ var linksCommand = new Command9("links").description("list the links between box
4015
4077
  });
4016
4078
 
4017
4079
  // src/commands/vm/pause.ts
4018
- import { Command as Command10 } from "commander";
4019
- var pauseCommand = new Command10("pause").description("freeze a box in place (memory and processes kept, no CPU used; kvbox resume continues it instantly)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
4080
+ import { Command as Command11 } from "commander";
4081
+ var pauseCommand = new Command11("pause").description("freeze a box in place (memory and processes kept, no CPU used; kvbox resume continues it instantly)").argument("<name>", "box name").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
4020
4082
  const client = await clientFor(cmd.optsWithGlobals());
4021
4083
  try {
4022
4084
  const box2 = await spin(`pausing ${name}\u2026`, client.pauseMachine(name));
@@ -4028,7 +4090,7 @@ var pauseCommand = new Command10("pause").description("freeze a box in place (me
4028
4090
  });
4029
4091
 
4030
4092
  // src/commands/vm/proxy/claim.ts
4031
- import { Command as Command11 } from "commander";
4093
+ import { Command as Command12 } from "commander";
4032
4094
 
4033
4095
  // ../shared/src/names.ts
4034
4096
  import { createHmac } from "crypto";
@@ -4099,7 +4161,7 @@ function assertDomain(text2, proxyDomain) {
4099
4161
  }
4100
4162
 
4101
4163
  // src/commands/vm/proxy/claim.ts
4102
- var claimCommand = new Command11("claim").description(`give a box an HTTPS address, https://<subdomain>.kvbox.app, serving one of its ports (up to ${MAX_BOX_SUBDOMAINS} per box)`).argument("[box]", "box name (picked from a list when left out)").argument("[subdomain]", "3-63 lowercase letters, digits and '-'; must be free (asked for when left out)").option("--port <port>", "the box port the address serves (asked for when left out)").option("--json", "print the subdomain as JSON").action(async (nameArg, subArg, opts, cmd) => {
4164
+ var claimCommand = new Command12("claim").description(`give a box an HTTPS address, https://<subdomain>.kvbox.app, serving one of its ports (up to ${MAX_BOX_SUBDOMAINS} per box)`).argument("[box]", "box name (picked from a list when left out)").argument("[subdomain]", "3-63 lowercase letters, digits and '-'; must be free (asked for when left out)").option("--port <port>", "the box port the address serves (asked for when left out)").option("--json", "print the subdomain as JSON").action(async (nameArg, subArg, opts, cmd) => {
4103
4165
  if (nameArg === void 0 || subArg === void 0 || opts.port === void 0) askOrUsage("give the box, the subdomain and the port: kvbox vm proxy claim <box> <subdomain> --port <port>");
4104
4166
  if (subArg !== void 0) assertSubdomain(subArg);
4105
4167
  if (opts.port !== void 0) parsePorts([opts.port]);
@@ -4128,11 +4190,11 @@ var claimCommand = new Command11("claim").description(`give a box an HTTPS addre
4128
4190
  });
4129
4191
 
4130
4192
  // src/commands/vm/proxy/index.ts
4131
- import { Command as Command17 } from "commander";
4193
+ import { Command as Command18 } from "commander";
4132
4194
 
4133
4195
  // src/commands/vm/proxy/add.ts
4134
- import { Command as Command12 } from "commander";
4135
- var addCommand = new Command12("add").description("publish box ports on the internet; each gets a random public port, or an HTTPS name with --name").argument("<box>", "box name").argument("<port...>", "ports inside the box, e.g. 3000 8080").option("--udp", "UDP instead of TCP").option("--name <name>", "serve the port at https://<name>.<subdomain>.kvbox.app (one port; needs kvbox vm proxy claim first)").option("--sub <subdomain>", "with --name: which of the box's subdomains it goes under (needed when it has more than one)").option("--json", "print the new forwards as JSON").action(async (name, portTexts, opts, cmd) => {
4196
+ import { Command as Command13 } from "commander";
4197
+ var addCommand = new Command13("add").description("publish box ports on the internet; each gets a random public port, or an HTTPS name with --name").argument("<box>", "box name").argument("<port...>", "ports inside the box, e.g. 3000 8080").option("--udp", "UDP instead of TCP").option("--name <name>", "serve the port at https://<name>.<subdomain>.kvbox.app (one port; needs kvbox vm proxy claim first)").option("--sub <subdomain>", "with --name: which of the box's subdomains it goes under (needed when it has more than one)").option("--json", "print the new forwards as JSON").action(async (name, portTexts, opts, cmd) => {
4136
4198
  const guestPorts = parsePorts(portTexts);
4137
4199
  if (opts.name !== void 0) {
4138
4200
  assertRouteName(opts.name);
@@ -4175,7 +4237,7 @@ var addCommand = new Command12("add").description("publish box ports on the inte
4175
4237
  });
4176
4238
 
4177
4239
  // src/commands/vm/proxy/ls.ts
4178
- import { Command as Command13 } from "commander";
4240
+ import { Command as Command14 } from "commander";
4179
4241
  async function subdomainsOf2(client) {
4180
4242
  try {
4181
4243
  return await client.listSubdomains();
@@ -4184,7 +4246,7 @@ async function subdomainsOf2(client) {
4184
4246
  return [];
4185
4247
  }
4186
4248
  }
4187
- var lsCommand2 = new Command13("ls").description("list the box ports published on the internet").argument("[box]", "only this box").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4249
+ var lsCommand2 = new Command14("ls").description("list the box ports published on the internet").argument("[box]", "only this box").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4188
4250
  const client = await clientFor(cmd.optsWithGlobals());
4189
4251
  try {
4190
4252
  const user = me(client);
@@ -4210,8 +4272,8 @@ var lsCommand2 = new Command13("ls").description("list the box ports published o
4210
4272
  });
4211
4273
 
4212
4274
  // src/commands/vm/proxy/release.ts
4213
- import { Command as Command14 } from "commander";
4214
- var releaseCommand = new Command14("release").description("give up one of a box's HTTPS addresses and every name under it").argument("<box>", "box name").option("--sub <subdomain>", "which of the box's subdomains (needed when it has more than one)").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
4275
+ import { Command as Command15 } from "commander";
4276
+ var releaseCommand = new Command15("release").description("give up one of a box's HTTPS addresses and every name under it").argument("<box>", "box name").option("--sub <subdomain>", "which of the box's subdomains (needed when it has more than one)").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
4215
4277
  const client = await clientFor(cmd.optsWithGlobals());
4216
4278
  try {
4217
4279
  requireCloud(client);
@@ -4230,8 +4292,8 @@ var releaseCommand = new Command14("release").description("give up one of a box'
4230
4292
  });
4231
4293
 
4232
4294
  // src/commands/vm/proxy/rm.ts
4233
- import { Command as Command15 } from "commander";
4234
- var rmCommand = new Command15("rm").description("stop publishing box ports, or an HTTPS name with --name").argument("<box>", "box name").argument("[port...]", "ports inside the box, as given to add").option("--udp", "the UDP forwards of those ports").option("--name <name>", "the HTTPS name to free (kvbox vm proxy release frees the whole subdomain)").option("--sub <subdomain>", "with --name: which of the box's subdomains the name is under (needed when it has more than one)").option("-y, --yes", "do not ask for confirmation").action(async (name, portTexts, opts, cmd) => {
4295
+ import { Command as Command16 } from "commander";
4296
+ var rmCommand = new Command16("rm").description("stop publishing box ports, or an HTTPS name with --name").argument("<box>", "box name").argument("[port...]", "ports inside the box, as given to add").option("--udp", "the UDP forwards of those ports").option("--name <name>", "the HTTPS name to free (kvbox vm proxy release frees the whole subdomain)").option("--sub <subdomain>", "with --name: which of the box's subdomains the name is under (needed when it has more than one)").option("-y, --yes", "do not ask for confirmation").action(async (name, portTexts, opts, cmd) => {
4235
4297
  if (opts.name !== void 0) {
4236
4298
  assertRouteName(opts.name);
4237
4299
  if (portTexts.length > 0) throw new KvboxError("--name frees a name, not ports: kvbox vm proxy rm <box> --name <name>");
@@ -4265,8 +4327,8 @@ var rmCommand = new Command15("rm").description("stop publishing box ports, or a
4265
4327
  });
4266
4328
 
4267
4329
  // src/commands/vm/proxy/set-port.ts
4268
- import { Command as Command16 } from "commander";
4269
- var setPortCommand = new Command16("set-port").description("point a box's HTTPS address at another of its ports").argument("<box>", "box name").argument("<port>", "the box port https://<subdomain>.kvbox.app serves from now on").option("--sub <subdomain>", "which of the box's subdomains (needed when it has more than one)").option("--json", "print the subdomain as JSON").action(async (name, portText, opts, cmd) => {
4330
+ import { Command as Command17 } from "commander";
4331
+ var setPortCommand = new Command17("set-port").description("point a box's HTTPS address at another of its ports").argument("<box>", "box name").argument("<port>", "the box port https://<subdomain>.kvbox.app serves from now on").option("--sub <subdomain>", "which of the box's subdomains (needed when it has more than one)").option("--json", "print the subdomain as JSON").action(async (name, portText, opts, cmd) => {
4270
4332
  const [port] = parsePorts([portText]);
4271
4333
  const client = await clientFor(cmd.optsWithGlobals());
4272
4334
  try {
@@ -4284,14 +4346,14 @@ var setPortCommand = new Command16("set-port").description("point a box's HTTPS
4284
4346
  });
4285
4347
 
4286
4348
  // src/commands/vm/proxy/index.ts
4287
- var proxyCommand = new Command17("proxy").description("publish box ports on the internet").addCommand(addCommand).addCommand(lsCommand2).addCommand(rmCommand).addCommand(claimCommand).addCommand(setPortCommand).addCommand(releaseCommand);
4349
+ var proxyCommand = new Command18("proxy").description("publish box ports on the internet").addCommand(addCommand).addCommand(lsCommand2).addCommand(rmCommand).addCommand(claimCommand).addCommand(setPortCommand).addCommand(releaseCommand);
4288
4350
  for (const cmd of proxyCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
4289
4351
 
4290
4352
  // src/commands/vm/hook/index.ts
4291
- import { Command as Command21 } from "commander";
4353
+ import { Command as Command22 } from "commander";
4292
4354
 
4293
4355
  // src/commands/vm/hook/create.ts
4294
- import { Command as Command18 } from "commander";
4356
+ import { Command as Command19 } from "commander";
4295
4357
 
4296
4358
  // src/commands/vm/hook/shared.ts
4297
4359
  function requireCloud2(client) {
@@ -4299,7 +4361,7 @@ function requireCloud2(client) {
4299
4361
  }
4300
4362
 
4301
4363
  // src/commands/vm/hook/create.ts
4302
- var createCommand = new Command18("create").description("make a URL that wakes the box when called (a GitHub webhook, cron, any automation)").argument("<box>", "box name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4364
+ var createCommand = new Command19("create").description("make a URL that wakes the box when called (a GitHub webhook, cron, any automation)").argument("<box>", "box name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4303
4365
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4304
4366
  try {
4305
4367
  requireCloud2(client);
@@ -4323,8 +4385,8 @@ var createCommand = new Command18("create").description("make a URL that wakes t
4323
4385
  });
4324
4386
 
4325
4387
  // src/commands/vm/hook/ls.ts
4326
- import { Command as Command19 } from "commander";
4327
- var lsCommand3 = new Command19("ls").alias("list").description("list a box's wake hooks").argument("<box>", "box name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4388
+ import { Command as Command20 } from "commander";
4389
+ var lsCommand3 = new Command20("ls").alias("list").description("list a box's wake hooks").argument("<box>", "box name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4328
4390
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4329
4391
  try {
4330
4392
  requireCloud2(client);
@@ -4345,8 +4407,8 @@ var lsCommand3 = new Command19("ls").alias("list").description("list a box's wak
4345
4407
  });
4346
4408
 
4347
4409
  // src/commands/vm/hook/rm.ts
4348
- import { Command as Command20 } from "commander";
4349
- var rmCommand2 = new Command20("rm").alias("remove").description("remove a wake hook: its URL stops working").argument("<box>", "box name").argument("<id>", "the hook's id (kvbox vm hook ls <box>)").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed hook as JSON").action(async (name, id, opts, cmd) => {
4410
+ import { Command as Command21 } from "commander";
4411
+ var rmCommand2 = new Command21("rm").alias("remove").description("remove a wake hook: its URL stops working").argument("<box>", "box name").argument("<id>", "the hook's id (kvbox vm hook ls <box>)").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed hook as JSON").action(async (name, id, opts, cmd) => {
4350
4412
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4351
4413
  try {
4352
4414
  requireCloud2(client);
@@ -4368,21 +4430,21 @@ var rmCommand2 = new Command20("rm").alias("remove").description("remove a wake
4368
4430
  });
4369
4431
 
4370
4432
  // src/commands/vm/hook/index.ts
4371
- var hookCommand = new Command21("hook").description("URLs that wake a box when called (GitHub webhooks, cron, any automation)").addCommand(createCommand).addCommand(lsCommand3).addCommand(rmCommand2);
4433
+ var hookCommand = new Command22("hook").description("URLs that wake a box when called (GitHub webhooks, cron, any automation)").addCommand(createCommand).addCommand(lsCommand3).addCommand(rmCommand2);
4372
4434
  for (const cmd of hookCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
4373
4435
 
4374
4436
  // src/commands/vm/backup/index.ts
4375
- import { Command as Command27 } from "commander";
4437
+ import { Command as Command28 } from "commander";
4376
4438
 
4377
4439
  // src/commands/vm/backup/create.ts
4378
- import { Command as Command23 } from "commander";
4440
+ import { Command as Command24 } from "commander";
4379
4441
 
4380
4442
  // src/commands/vm/backup/shared.ts
4381
4443
  import { setTimeout as sleep3 } from "timers/promises";
4382
4444
 
4383
4445
  // src/commands/vm/usage.ts
4384
- import { Command as Command22 } from "commander";
4385
- var usageCommand = new Command22("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) => {
4446
+ import { Command as Command23 } from "commander";
4447
+ var usageCommand = new Command23("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) => {
4386
4448
  let since;
4387
4449
  if (opts.since !== void 0) {
4388
4450
  const t = Date.parse(opts.since);
@@ -4482,7 +4544,7 @@ async function removeListed(client, listed, nameOf, name, id, what, yes) {
4482
4544
  }
4483
4545
 
4484
4546
  // src/commands/vm/backup/create.ts
4485
- var createCommand2 = new Command23("create").description("back up a box's disk to the kvbox cloud (encrypted; memory and volumes not included)").argument("<box>", "box name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
4547
+ var createCommand2 = new Command24("create").description("back up a box's disk to the kvbox cloud (encrypted; memory and volumes not included)").argument("<box>", "box name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
4486
4548
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4487
4549
  try {
4488
4550
  requireCloud3(client);
@@ -4512,8 +4574,8 @@ var createCommand2 = new Command23("create").description("back up a box's disk t
4512
4574
  });
4513
4575
 
4514
4576
  // src/commands/vm/backup/ls.ts
4515
- import { Command as Command24 } from "commander";
4516
- var lsCommand4 = new Command24("ls").alias("list").description("list backups: every box's, or one box's").argument("[box]", "box name (default: every box)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4577
+ import { Command as Command25 } from "commander";
4578
+ var lsCommand4 = new Command25("ls").alias("list").description("list backups: every box's, or one box's").argument("[box]", "box name (default: every box)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
4517
4579
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4518
4580
  try {
4519
4581
  requireCloud3(client);
@@ -4547,8 +4609,8 @@ var lsCommand4 = new Command24("ls").alias("list").description("list backups: ev
4547
4609
  });
4548
4610
 
4549
4611
  // src/commands/vm/backup/restore.ts
4550
- import { Command as Command25 } from "commander";
4551
- var restoreCommand = new Command25("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) => {
4612
+ import { Command as Command26 } from "commander";
4613
+ var restoreCommand = new Command26("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) => {
4552
4614
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4553
4615
  try {
4554
4616
  requireCloud3(client);
@@ -4572,8 +4634,8 @@ var restoreCommand = new Command25("restore").description("put a backup back: th
4572
4634
  });
4573
4635
 
4574
4636
  // src/commands/vm/backup/rm.ts
4575
- import { Command as Command26 } from "commander";
4576
- var rmCommand3 = new Command26("rm").alias("remove").description("remove a backup for good (a box's that is gone too)").argument("<box>", "box name").argument("<id>", "the backup's id (kvbox vm backup ls <box>)").option("-y, --yes", "do not ask for confirmation").action(async (box2, id, opts, cmd) => {
4637
+ import { Command as Command27 } from "commander";
4638
+ var rmCommand3 = new Command27("rm").alias("remove").description("remove a backup for good (a box's that is gone too)").argument("<box>", "box name").argument("<id>", "the backup's id (kvbox vm backup ls <box>)").option("-y, --yes", "do not ask for confirmation").action(async (box2, id, opts, cmd) => {
4577
4639
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
4578
4640
  try {
4579
4641
  requireCloud3(client);
@@ -4584,12 +4646,12 @@ var rmCommand3 = new Command26("rm").alias("remove").description("remove a backu
4584
4646
  });
4585
4647
 
4586
4648
  // src/commands/vm/backup/index.ts
4587
- var backupCommand = new Command27("backup").description("back up a box's disk to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand2).addCommand(lsCommand4).addCommand(restoreCommand).addCommand(rmCommand3);
4649
+ var backupCommand = new Command28("backup").description("back up a box's disk to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand2).addCommand(lsCommand4).addCommand(restoreCommand).addCommand(rmCommand3);
4588
4650
  for (const cmd of backupCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
4589
4651
 
4590
4652
  // src/commands/vm/rescale.ts
4591
- import { Command as Command28, Option as Option3 } from "commander";
4592
- var rescaleCommand = new Command28("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) => {
4653
+ import { Command as Command29, Option as Option3 } from "commander";
4654
+ var rescaleCommand = new Command29("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) => {
4593
4655
  const req = {
4594
4656
  ...opts.size !== void 0 ? { size: opts.size } : {},
4595
4657
  ...opts.vcpu !== void 0 ? { vcpu: parseCount(opts.vcpu) } : {},
@@ -4635,8 +4697,8 @@ function parseGib(flag, text2) {
4635
4697
  }
4636
4698
 
4637
4699
  // src/commands/vm/resume.ts
4638
- import { Command as Command29 } from "commander";
4639
- var resumeCommand = new Command29("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) => {
4700
+ import { Command as Command30 } from "commander";
4701
+ var resumeCommand = new Command30("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) => {
4640
4702
  const client = await clientFor(cmd.optsWithGlobals());
4641
4703
  try {
4642
4704
  const box2 = await spin(`resuming ${name}\u2026`, client.resumeMachine(name));
@@ -4648,8 +4710,8 @@ var resumeCommand = new Command29("resume").description("continue a box that is
4648
4710
  });
4649
4711
 
4650
4712
  // src/commands/vm/rm.ts
4651
- import { Command as Command30 } from "commander";
4652
- var rmCommand4 = new Command30("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) => {
4713
+ import { Command as Command31 } from "commander";
4714
+ var rmCommand4 = new Command31("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) => {
4653
4715
  const client = await clientFor(cmd.optsWithGlobals());
4654
4716
  try {
4655
4717
  const box2 = pickRef(await boxesFor(client, name), name, me(client));
@@ -4669,10 +4731,10 @@ var rmCommand4 = new Command30("rm").description("destroy a box (its disk is del
4669
4731
  });
4670
4732
 
4671
4733
  // src/commands/vm/set.ts
4672
- import { Command as Command31 } from "commander";
4734
+ import { Command as Command32 } from "commander";
4673
4735
 
4674
4736
  // src/swap.ts
4675
- import { spawn as spawn3 } from "child_process";
4737
+ import { spawn as spawn4 } from "child_process";
4676
4738
  var SWAP_FILE = "/rom/overlay/swapfile";
4677
4739
  var SWAP_KEEP_FREE_MIB = 1024;
4678
4740
  var SWAP_MIN_MIB = 256;
@@ -4734,7 +4796,7 @@ function parseSwapReport(output) {
4734
4796
  return { sizeMib: Math.round(Number(m[1]) / 1024), usedMib: Math.round(Number(m[2]) / 1024), zswap: m[3] === "Y" || m[3] === "1" };
4735
4797
  }
4736
4798
  function runSwap(ep, mib) {
4737
- const child = spawn3("ssh", ["-n", ...sshArgs(ep), swapCommand(mib)], { stdio: ["ignore", "pipe", "pipe"] });
4799
+ const child = spawn4("ssh", ["-n", ...sshArgs(ep), swapCommand(mib)], { stdio: ["ignore", "pipe", "pipe"] });
4738
4800
  const chunks = [];
4739
4801
  child.stdout.on("data", (c2) => chunks.push(c2));
4740
4802
  child.stderr.on("data", (c2) => chunks.push(c2));
@@ -4745,7 +4807,7 @@ function runSwap(ep, mib) {
4745
4807
  }
4746
4808
 
4747
4809
  // src/commands/vm/set.ts
4748
- var setCommand = new Command31("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) => {
4810
+ var setCommand = new Command32("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) => {
4749
4811
  if (opts.autoHibernate === void 0 && opts.idleCheck === void 0 && opts.swap === void 0) {
4750
4812
  throw new KvboxError("nothing to change: give --auto-hibernate, --idle-check or --swap");
4751
4813
  }
@@ -4814,8 +4876,8 @@ function parseIdleCheck(text2) {
4814
4876
  }
4815
4877
 
4816
4878
  // src/commands/vm/start.ts
4817
- import { Command as Command32 } from "commander";
4818
- var startCommand = new Command32("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) => {
4879
+ import { Command as Command33 } from "commander";
4880
+ var startCommand = new Command33("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) => {
4819
4881
  const client = await clientFor(cmd.optsWithGlobals());
4820
4882
  try {
4821
4883
  const box2 = await spin(`booting ${name}\u2026`, client.startMachine(name, opts.force ?? false));
@@ -4827,8 +4889,8 @@ var startCommand = new Command32("start").description("boot a stopped box again
4827
4889
  });
4828
4890
 
4829
4891
  // src/commands/vm/stop.ts
4830
- import { Command as Command33 } from "commander";
4831
- var stopCommand = new Command33("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) => {
4892
+ import { Command as Command34 } from "commander";
4893
+ var stopCommand = new Command34("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) => {
4832
4894
  const client = await clientFor(cmd.optsWithGlobals());
4833
4895
  try {
4834
4896
  const box2 = await spin(`shutting ${name} down\u2026`, client.stopMachine(name));
@@ -4840,8 +4902,8 @@ var stopCommand = new Command33("stop").description("shut a box down (its disk i
4840
4902
  });
4841
4903
 
4842
4904
  // src/commands/vm/top.ts
4843
- import { Command as Command34 } from "commander";
4844
- var topCommand = new Command34("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) => {
4905
+ import { Command as Command35 } from "commander";
4906
+ var topCommand = new Command35("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) => {
4845
4907
  const client = await clientFor(cmd.optsWithGlobals());
4846
4908
  try {
4847
4909
  const running = (await client.listMachines({ all: opts.all })).filter((b) => b.status === "running");
@@ -4901,8 +4963,8 @@ function topRows(entries, cloud) {
4901
4963
  }
4902
4964
 
4903
4965
  // src/commands/vm/unlink.ts
4904
- import { Command as Command35 } from "commander";
4905
- var unlinkCommand = new Command35("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) => {
4966
+ import { Command as Command36 } from "commander";
4967
+ var unlinkCommand = new Command36("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) => {
4906
4968
  const port = parseLinkPort(opts.port);
4907
4969
  if (!await confirm(`Cut box ${from} off from box ${name} port ${port}? Its open connections close too.`, opts.yes ?? false)) {
4908
4970
  info("cancelled");
@@ -4923,8 +4985,8 @@ var unlinkCommand = new Command35("unlink").description("take a link away (kvbox
4923
4985
  });
4924
4986
 
4925
4987
  // src/commands/vm/update.ts
4926
- import { Command as Command36 } from "commander";
4927
- var updateCommand = new Command36("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) => {
4988
+ import { Command as Command37 } from "commander";
4989
+ var updateCommand = new Command37("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) => {
4928
4990
  const client = await clientFor(cmd.optsWithGlobals());
4929
4991
  try {
4930
4992
  const before = pickRef(await boxesFor(client, name), name, me(client));
@@ -4946,8 +5008,8 @@ var updateCommand = new Command36("update").description("move a box onto the cur
4946
5008
  });
4947
5009
 
4948
5010
  // src/commands/vm/wake.ts
4949
- import { Command as Command37 } from "commander";
4950
- var wakeCommand = new Command37("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) => {
5011
+ import { Command as Command38 } from "commander";
5012
+ var wakeCommand = new Command38("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) => {
4951
5013
  const client = await clientFor(cmd.optsWithGlobals());
4952
5014
  try {
4953
5015
  const box2 = await spin(`waking ${name} (loading its memory from disk)\u2026`, client.wakeMachine(name, opts.force ?? false));
@@ -4959,19 +5021,19 @@ var wakeCommand = new Command37("wake").description("continue a hibernated box w
4959
5021
  });
4960
5022
 
4961
5023
  // src/commands/vm/index.ts
4962
- var vmCommand = new Command38("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(rmCommand4);
5024
+ var vmCommand = new Command39("vm").enablePositionalOptions().description("manage boxes (each one is a Firecracker microVM)").addCommand(newCommand).addCommand(forkCommand).addCommand(lsCommand).addCommand(getCommand).addCommand(connectCommand).addCommand(execCommand).addCommand(cpCommand).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(rmCommand4);
4963
5025
  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)");
4964
- var vmAliases = [newCommand, lsCommand, getCommand, connectCommand, execCommand, stopCommand, startCommand, pauseCommand, resumeCommand, hibernateCommand, wakeCommand, rmCommand4, claimCommand];
5026
+ var vmAliases = [newCommand, lsCommand, getCommand, connectCommand, execCommand, cpCommand, stopCommand, startCommand, pauseCommand, resumeCommand, hibernateCommand, wakeCommand, rmCommand4, claimCommand];
4965
5027
 
4966
5028
  // src/commands/login.ts
4967
5029
  import { hostname as osHostname2 } from "os";
4968
5030
  import { createInterface as createInterface2 } from "readline/promises";
4969
5031
  import { setTimeout as sleep4 } from "timers/promises";
4970
5032
  import { Writable } from "stream";
4971
- import { Command as Command39 } from "commander";
5033
+ import { Command as Command40 } from "commander";
4972
5034
 
4973
5035
  // src/browser.ts
4974
- import { spawn as spawn4 } from "child_process";
5036
+ import { spawn as spawn5 } from "child_process";
4975
5037
  function isWebLink(url) {
4976
5038
  if (/[^\x21-\x7e]/.test(url)) return false;
4977
5039
  let parsed;
@@ -4996,7 +5058,7 @@ function openBrowser(url) {
4996
5058
  const argv = browserCommand(url);
4997
5059
  if (argv === null) return;
4998
5060
  try {
4999
- const child = spawn4(argv[0], argv.slice(1), { stdio: "ignore", detached: true });
5061
+ const child = spawn5(argv[0], argv.slice(1), { stdio: "ignore", detached: true });
5000
5062
  child.on("error", () => {
5001
5063
  });
5002
5064
  child.unref();
@@ -5005,7 +5067,7 @@ function openBrowser(url) {
5005
5067
  }
5006
5068
 
5007
5069
  // src/commands/login.ts
5008
- var loginCommand = new Command39("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("--password", "log in with email and password instead of approving a code in the web app").option("-e, --email <email>", "account email, for a password login (prompted otherwise)").option("--password-stdin", "read the password from the first line of stdin (for scripts)").action(async (urlArg, opts) => {
5070
+ var loginCommand = new Command40("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("--password", "log in with email and password instead of approving a code in the web app").option("-e, --email <email>", "account email, for a password login (prompted otherwise)").option("--password-stdin", "read the password from the first line of stdin (for scripts)").action(async (urlArg, opts) => {
5009
5071
  const url = normalizeUrl(urlArg ?? DEFAULT_CLOUD_URL);
5010
5072
  const byPassword = opts.password === true || opts.passwordStdin === true || opts.email !== void 0;
5011
5073
  const session = byPassword ? await runLogin(url, await readCredentials(opts), paths()) : await runDeviceLogin(url, paths());
@@ -5115,8 +5177,8 @@ async function firstLine(stream) {
5115
5177
  }
5116
5178
 
5117
5179
  // src/commands/logout.ts
5118
- import { Command as Command40 } from "commander";
5119
- var logoutCommand = new Command40("logout").description("log out of the control plane; commands target this machine's kvbox-server again").action(async () => {
5180
+ import { Command as Command41 } from "commander";
5181
+ var logoutCommand = new Command41("logout").description("log out of the control plane; commands target this machine's kvbox-server again").action(async () => {
5120
5182
  const p = paths();
5121
5183
  const session = await readSession(p).catch(() => null);
5122
5184
  switch (await runLogout(p)) {
@@ -5154,8 +5216,8 @@ async function runLogout(p = paths()) {
5154
5216
  }
5155
5217
 
5156
5218
  // src/commands/whoami.ts
5157
- import { Command as Command41 } from "commander";
5158
- var whoamiCommand = new Command41("whoami").description("show which account and control plane commands target (or local mode)").option("--json", "print as JSON").action(async (opts, cmd) => {
5219
+ import { Command as Command42 } from "commander";
5220
+ var whoamiCommand = new Command42("whoami").description("show which account and control plane commands target (or local mode)").option("--json", "print as JSON").action(async (opts, cmd) => {
5159
5221
  if (!cmd.optsWithGlobals().local && envLogin()) {
5160
5222
  const target = await resolveTarget({});
5161
5223
  if (target.kind !== "cloud") return;
@@ -5180,10 +5242,10 @@ function describeSession(session) {
5180
5242
  }
5181
5243
 
5182
5244
  // src/commands/key/index.ts
5183
- import { Command as Command45 } from "commander";
5245
+ import { Command as Command46 } from "commander";
5184
5246
 
5185
5247
  // src/commands/key/create.ts
5186
- import { Command as Command42 } from "commander";
5248
+ import { Command as Command43 } from "commander";
5187
5249
 
5188
5250
  // src/commands/key/shared.ts
5189
5251
  async function keyClient(cmd) {
@@ -5220,7 +5282,7 @@ function expiryText(expiresAt, now = Date.now()) {
5220
5282
  }
5221
5283
 
5222
5284
  // src/commands/key/create.ts
5223
- var createCommand3 = new Command42("create").description("make an API key for a program: CI, an agent, the SDK (the key is shown once)").argument("<name>", "what to call the key: lowercase letters, digits, '.', '_' or '-'").option("--expires <when>", `when it stops working: a duration (30d, 12h; m is minutes), a day (2027-01-31), or never; ${DEFAULT_API_KEY_DAYS}d by default`).option("--json", "print as JSON").action(async (name, opts, cmd) => {
5285
+ var createCommand3 = new Command43("create").description("make an API key for a program: CI, an agent, the SDK (the key is shown once)").argument("<name>", "what to call the key: lowercase letters, digits, '.', '_' or '-'").option("--expires <when>", `when it stops working: a duration (30d, 12h; m is minutes), a day (2027-01-31), or never; ${DEFAULT_API_KEY_DAYS}d by default`).option("--json", "print as JSON").action(async (name, opts, cmd) => {
5224
5286
  const expiresAt = opts.expires === void 0 ? void 0 : parseExpires(opts.expires);
5225
5287
  const client = await keyClient(cmd);
5226
5288
  try {
@@ -5238,8 +5300,8 @@ var createCommand3 = new Command42("create").description("make an API key for a
5238
5300
  });
5239
5301
 
5240
5302
  // src/commands/key/ls.ts
5241
- import { Command as Command43 } from "commander";
5242
- var lsCommand5 = new Command43("ls").alias("list").description("list your API keys (never the keys themselves)").option("--json", "print as JSON").action(async (opts, cmd) => {
5303
+ import { Command as Command44 } from "commander";
5304
+ var lsCommand5 = new Command44("ls").alias("list").description("list your API keys (never the keys themselves)").option("--json", "print as JSON").action(async (opts, cmd) => {
5243
5305
  const client = await keyClient(cmd);
5244
5306
  try {
5245
5307
  const keys = await client.listApiKeys();
@@ -5258,8 +5320,8 @@ var lsCommand5 = new Command43("ls").alias("list").description("list your API ke
5258
5320
  });
5259
5321
 
5260
5322
  // src/commands/key/rm.ts
5261
- import { Command as Command44 } from "commander";
5262
- var rmCommand5 = new Command44("rm").alias("remove").description("remove an API key: whatever uses it stops working").argument("<name>", "the key's name (kvbox key ls)").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
5323
+ import { Command as Command45 } from "commander";
5324
+ var rmCommand5 = new Command45("rm").alias("remove").description("remove an API key: whatever uses it stops working").argument("<name>", "the key's name (kvbox key ls)").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
5263
5325
  const client = await keyClient(cmd);
5264
5326
  try {
5265
5327
  if (!await confirm(`Remove API key ${name}? Whatever uses it stops working.`, opts.yes ?? false)) {
@@ -5275,14 +5337,14 @@ var rmCommand5 = new Command44("rm").alias("remove").description("remove an API
5275
5337
  });
5276
5338
 
5277
5339
  // src/commands/key/index.ts
5278
- var keyCommand = new Command45("key").aliases(["keys"]).description("API keys: named tokens a program (CI, an agent, the SDK) uses as KVBOX_TOKEN in place of a login").addCommand(createCommand3).addCommand(lsCommand5).addCommand(rmCommand5);
5340
+ var keyCommand = new Command46("key").aliases(["keys"]).description("API keys: named tokens a program (CI, an agent, the SDK) uses as KVBOX_TOKEN in place of a login").addCommand(createCommand3).addCommand(lsCommand5).addCommand(rmCommand5);
5279
5341
 
5280
5342
  // src/commands/snapshots/index.ts
5281
- import { Command as Command49 } from "commander";
5343
+ import { Command as Command50 } from "commander";
5282
5344
 
5283
5345
  // src/commands/snapshots/ls.ts
5284
- import { Command as Command46 } from "commander";
5285
- var lsCommand6 = new Command46("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) => {
5346
+ import { Command as Command47 } from "commander";
5347
+ var lsCommand6 = new Command47("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) => {
5286
5348
  const client = await clientFor(cmd.optsWithGlobals());
5287
5349
  try {
5288
5350
  const cloud = client.target.kind === "cloud";
@@ -5313,8 +5375,8 @@ var lsCommand6 = new Command46("ls").description("list snapshots (yours and your
5313
5375
  });
5314
5376
 
5315
5377
  // src/commands/snapshots/new.ts
5316
- import { Command as Command47 } from "commander";
5317
- var newCommand2 = new Command47("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 (box2, name, opts, cmd) => {
5378
+ import { Command as Command48 } from "commander";
5379
+ var newCommand2 = new Command48("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 (box2, name, opts, cmd) => {
5318
5380
  const client = await clientFor(cmd.optsWithGlobals());
5319
5381
  try {
5320
5382
  const req = { box: box2, name, ...opts.replace ? { replace: true } : {} };
@@ -5327,8 +5389,8 @@ var newCommand2 = new Command47("new").description("freeze a running box (memory
5327
5389
  });
5328
5390
 
5329
5391
  // src/commands/snapshots/rm.ts
5330
- import { Command as Command48 } from "commander";
5331
- var rmCommand6 = new Command48("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) => {
5392
+ import { Command as Command49 } from "commander";
5393
+ var rmCommand6 = new Command49("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) => {
5332
5394
  if (!await confirm(`Delete snapshot ${name}?`, opts.yes ?? false)) {
5333
5395
  info("cancelled");
5334
5396
  process.exitCode = 1;
@@ -5344,14 +5406,14 @@ var rmCommand6 = new Command48("rm").description("delete a snapshot (boxes made
5344
5406
  });
5345
5407
 
5346
5408
  // src/commands/snapshots/index.ts
5347
- var snapshotsCommand = new Command49("snapshots").aliases(["snapshot", "snap"]).description("freeze running boxes into snapshots and manage them").addCommand(newCommand2).addCommand(lsCommand6).addCommand(rmCommand6);
5409
+ var snapshotsCommand = new Command50("snapshots").aliases(["snapshot", "snap"]).description("freeze running boxes into snapshots and manage them").addCommand(newCommand2).addCommand(lsCommand6).addCommand(rmCommand6);
5348
5410
  for (const cmd of snapshotsCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
5349
5411
 
5350
5412
  // src/commands/org/index.ts
5351
- import { Command as Command55 } from "commander";
5413
+ import { Command as Command56 } from "commander";
5352
5414
 
5353
5415
  // src/commands/org/ls.ts
5354
- import { Command as Command50 } from "commander";
5416
+ import { Command as Command51 } from "commander";
5355
5417
 
5356
5418
  // src/commands/org/context.ts
5357
5419
  var NOT_LOGGED_IN2 = "orgs live on the control plane: kvbox login first";
@@ -5371,7 +5433,7 @@ function orgFor(opts, target) {
5371
5433
  }
5372
5434
 
5373
5435
  // src/commands/org/ls.ts
5374
- var lsCommand7 = new Command50("ls").description("list the orgs you belong to and your role in each").option("--json", "print as JSON").action(async (opts, cmd) => {
5436
+ var lsCommand7 = new Command51("ls").description("list the orgs you belong to and your role in each").option("--json", "print as JSON").action(async (opts, cmd) => {
5375
5437
  const client = await cloudClientFor(cmd.optsWithGlobals());
5376
5438
  try {
5377
5439
  const orgs = await client.listOrgs();
@@ -5393,8 +5455,8 @@ function orgRows(orgs) {
5393
5455
  }
5394
5456
 
5395
5457
  // src/commands/org/members.ts
5396
- import { Command as Command51, Option as Option4 } from "commander";
5397
- var lsCommand8 = new Command51("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) => {
5458
+ import { Command as Command52, Option as Option4 } from "commander";
5459
+ var lsCommand8 = new Command52("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) => {
5398
5460
  const client = await cloudClientFor(cmd.optsWithGlobals());
5399
5461
  try {
5400
5462
  const org = await client.getOrg(orgFor(opts, client.target));
@@ -5408,7 +5470,7 @@ var lsCommand8 = new Command51("ls").description("list an org's members and thei
5408
5470
  await client.close();
5409
5471
  }
5410
5472
  });
5411
- var addCommand2 = new Command51("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) => {
5473
+ var addCommand2 = new Command52("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) => {
5412
5474
  const client = await cloudClientFor(cmd.optsWithGlobals());
5413
5475
  try {
5414
5476
  const slug = orgFor(opts, client.target);
@@ -5418,7 +5480,7 @@ var addCommand2 = new Command51("add").description("add a user to an org (admins
5418
5480
  await client.close();
5419
5481
  }
5420
5482
  });
5421
- var rmCommand7 = new Command51("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) => {
5483
+ var rmCommand7 = new Command52("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) => {
5422
5484
  const client = await cloudClientFor(cmd.optsWithGlobals());
5423
5485
  try {
5424
5486
  const slug = orgFor(opts, client.target);
@@ -5434,11 +5496,11 @@ var rmCommand7 = new Command51("rm").description("remove a member (or leave: rem
5434
5496
  await client.close();
5435
5497
  }
5436
5498
  });
5437
- var membersCommand = new Command51("members").description("who is in an org and what they may do").addCommand(lsCommand8).addCommand(addCommand2).addCommand(rmCommand7);
5499
+ var membersCommand = new Command52("members").description("who is in an org and what they may do").addCommand(lsCommand8).addCommand(addCommand2).addCommand(rmCommand7);
5438
5500
 
5439
5501
  // src/commands/org/new.ts
5440
- import { Command as Command52 } from "commander";
5441
- var newCommand3 = new Command52("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) => {
5502
+ import { Command as Command53 } from "commander";
5503
+ var newCommand3 = new Command53("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) => {
5442
5504
  const client = await cloudClientFor(cmd.optsWithGlobals());
5443
5505
  try {
5444
5506
  const org = await client.createOrg({ slug, name: opts.name ?? slug });
@@ -5454,8 +5516,8 @@ var newCommand3 = new Command52("new").description("create an org; you become it
5454
5516
  });
5455
5517
 
5456
5518
  // src/commands/org/rm.ts
5457
- import { Command as Command53 } from "commander";
5458
- var rmCommand8 = new Command53("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) => {
5519
+ import { Command as Command54 } from "commander";
5520
+ var rmCommand8 = new Command54("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) => {
5459
5521
  if (!await confirm(`Delete org ${slug}? Its members lose access; its slug stays taken.`, opts.yes ?? false)) {
5460
5522
  info("cancelled");
5461
5523
  process.exitCode = 1;
@@ -5471,8 +5533,8 @@ var rmCommand8 = new Command53("rm").description("delete an org (owners only; re
5471
5533
  });
5472
5534
 
5473
5535
  // src/commands/org/role.ts
5474
- import { Argument, Command as Command54 } from "commander";
5475
- var roleCommand = new Command54("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) => {
5536
+ import { Argument, Command as Command55 } from "commander";
5537
+ var roleCommand = new Command55("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) => {
5476
5538
  const client = await cloudClientFor(cmd.optsWithGlobals());
5477
5539
  try {
5478
5540
  const slug = orgFor(opts, client.target);
@@ -5484,11 +5546,11 @@ var roleCommand = new Command54("role").description("change a member's role (own
5484
5546
  });
5485
5547
 
5486
5548
  // src/commands/org/index.ts
5487
- var orgCommand = new Command55("org").description("orgs: shared slugs that own boxes, with owners, admins and members").addCommand(lsCommand7).addCommand(newCommand3).addCommand(membersCommand).addCommand(roleCommand).addCommand(rmCommand8);
5549
+ var orgCommand = new Command56("org").description("orgs: shared slugs that own boxes, with owners, admins and members").addCommand(lsCommand7).addCommand(newCommand3).addCommand(membersCommand).addCommand(roleCommand).addCommand(rmCommand8);
5488
5550
 
5489
5551
  // src/commands/usage.ts
5490
- import { Command as Command56 } from "commander";
5491
- var usageCommand2 = new Command56("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) => {
5552
+ import { Command as Command57 } from "commander";
5553
+ var usageCommand2 = new Command57("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) => {
5492
5554
  for (const [name, value] of [
5493
5555
  ["since", opts.since],
5494
5556
  ["until", opts.until]
@@ -5685,8 +5747,8 @@ function userRows(r) {
5685
5747
  }
5686
5748
 
5687
5749
  // src/commands/credit.ts
5688
- import { Command as Command57 } from "commander";
5689
- var creditCommand = new Command57("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) => {
5750
+ import { Command as Command58 } from "commander";
5751
+ var creditCommand = new Command58("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) => {
5690
5752
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
5691
5753
  try {
5692
5754
  if (client.target.kind === "local") throw new KvboxError("credit lives on the control plane: kvbox login first");
@@ -5715,8 +5777,8 @@ function creditRow(b, me2) {
5715
5777
  }
5716
5778
 
5717
5779
  // src/commands/redeem.ts
5718
- import { Command as Command58 } from "commander";
5719
- var redeemCommand = new Command58("redeem").description("redeem a promo code for credit, on your account or (--org) an org you own").argument("<code>", "the code, like KV-7F3K-9QXM-2HBD").option("--org <slug>", "give the credit to this org, which you own; it cannot be moved later").option("--json", "print as JSON").action(async (code, opts, cmd) => {
5780
+ import { Command as Command59 } from "commander";
5781
+ var redeemCommand = new Command59("redeem").description("redeem a promo code for credit, on your account or (--org) an org you own").argument("<code>", "the code, like KV-7F3K-9QXM-2HBD").option("--org <slug>", "give the credit to this org, which you own; it cannot be moved later").option("--json", "print as JSON").action(async (code, opts, cmd) => {
5720
5782
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
5721
5783
  try {
5722
5784
  if (client.target.kind === "local") throw new KvboxError("codes are redeemed on the control plane: kvbox login first");
@@ -5736,7 +5798,7 @@ var redeemCommand = new Command58("redeem").description("redeem a promo code for
5736
5798
  // src/commands/deploy/index.ts
5737
5799
  import { access as access5, readFile as readFile7 } from "fs/promises";
5738
5800
  import { basename as basename2, resolve as resolve3 } from "path";
5739
- import { Command as Command59, InvalidArgumentError as InvalidArgumentError2, Option as Option5 } from "commander";
5801
+ import { Command as Command60, InvalidArgumentError as InvalidArgumentError2, Option as Option5 } from "commander";
5740
5802
 
5741
5803
  // src/commands/deploy/config.ts
5742
5804
  import { readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
@@ -6046,7 +6108,7 @@ var nodeTemplate = {
6046
6108
  };
6047
6109
 
6048
6110
  // src/commands/deploy/templates/react.ts
6049
- import { spawn as spawn5 } from "child_process";
6111
+ import { spawn as spawn6 } from "child_process";
6050
6112
  import { access as access2 } from "fs/promises";
6051
6113
  import { join as join4 } from "path";
6052
6114
  var OUT_DIRS = ["dist", "build"];
@@ -6054,7 +6116,7 @@ async function runBuild(dir, pm) {
6054
6116
  const args = runScript(pm, "build");
6055
6117
  info(`${color.dim("$")} ${pm} ${args.join(" ")}`);
6056
6118
  const status2 = await new Promise((resolve4, reject) => {
6057
- const child = spawn5(pm, args, { cwd: dir, stdio: ["ignore", process.stderr, process.stderr], shell: process.platform === "win32" });
6119
+ const child = spawn6(pm, args, { cwd: dir, stdio: ["ignore", process.stderr, process.stderr], shell: process.platform === "win32" });
6058
6120
  child.once("error", (err) => reject(new KvboxError(`could not run ${pm}: ${err.message}`)));
6059
6121
  child.once("close", (code) => resolve4(code ?? 1));
6060
6122
  });
@@ -6353,7 +6415,7 @@ function subdomainFor(name) {
6353
6415
  }
6354
6416
 
6355
6417
  // src/commands/deploy/ship.ts
6356
- import { spawn as spawn6 } from "child_process";
6418
+ import { spawn as spawn7 } from "child_process";
6357
6419
  import { readdir, stat as stat2 } from "fs/promises";
6358
6420
  import { join as join7 } from "path";
6359
6421
  var IMAGE_TOO_OLD = 3;
@@ -6375,8 +6437,8 @@ async function measure(dir, exclude = []) {
6375
6437
  return total;
6376
6438
  }
6377
6439
  async function ship(ep, dir, remote, exclude = []) {
6378
- const tar = spawn6("tar", ["-cf", "-", ...exclude.map((e) => `--exclude=${e}`), "-C", dir, "."], { stdio: ["ignore", "pipe", "pipe"] });
6379
- const ssh = spawn6("ssh", [...sshArgs(ep), remote], { stdio: ["pipe", "pipe", "pipe"] });
6440
+ const tar = spawn7("tar", ["-cf", "-", ...exclude.map((e) => `--exclude=${e}`), "-C", dir, "."], { stdio: ["ignore", "pipe", "pipe"] });
6441
+ const ssh = spawn7("ssh", [...sshArgs(ep), remote], { stdio: ["pipe", "pipe", "pipe"] });
6380
6442
  tar.stdout.pipe(ssh.stdin);
6381
6443
  const chunks = [];
6382
6444
  ssh.stdout.on("data", (c2) => chunks.push(c2));
@@ -6404,7 +6466,7 @@ async function ship(ep, dir, remote, exclude = []) {
6404
6466
  return { status: status2, output: Buffer.concat(chunks).toString("utf8") };
6405
6467
  }
6406
6468
  async function run(ep, remote) {
6407
- const ssh = spawn6("ssh", [...sshArgs(ep), remote], { stdio: ["ignore", "pipe", "pipe"] });
6469
+ const ssh = spawn7("ssh", [...sshArgs(ep), remote], { stdio: ["ignore", "pipe", "pipe"] });
6408
6470
  const chunks = [];
6409
6471
  ssh.stdout.on("data", (c2) => chunks.push(c2));
6410
6472
  ssh.stderr.on("data", (c2) => chunks.push(c2));
@@ -7001,7 +7063,7 @@ async function readPackageJson(dir) {
7001
7063
  }
7002
7064
 
7003
7065
  // src/commands/deploy/index.ts
7004
- var deployCommand = new Command59("deploy").description("put the app in this directory (React, Next.js, a Node server, a Dockerfile or a static site) 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 and the directory 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 box port of a Next.js app, Node server or container (default 3000; saved to kvbox.json)", parsePort).option("--only <service>", "with several services in kvbox.json: deploy this one only (repeatable)", (v, all) => [...all ?? [], v]).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) => {
7066
+ var deployCommand = new Command60("deploy").description("put the app in this directory (React, Next.js, a Node server, a Dockerfile or a static site) 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 and the directory 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 box port of a Next.js app, Node server or container (default 3000; saved to kvbox.json)", parsePort).option("--only <service>", "with several services in kvbox.json: deploy this one only (repeatable)", (v, all) => [...all ?? [], v]).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) => {
7005
7067
  const dir = resolve3(dirArg ?? ".");
7006
7068
  const pkg = await readPackageJson2(dir);
7007
7069
  const facts = { indexHtml: await exists2(resolve3(dir, "index.html")), dockerfile: await exists2(resolve3(dir, "Dockerfile")) };
@@ -7158,15 +7220,15 @@ async function settle2(dir, pkg, facts, saved, opts, orgFlag, cloud) {
7158
7220
  }
7159
7221
 
7160
7222
  // src/commands/volume/index.ts
7161
- import { Command as Command71 } from "commander";
7223
+ import { Command as Command72 } from "commander";
7162
7224
 
7163
7225
  // src/commands/volume/attach.ts
7164
- import { Command as Command60 } from "commander";
7226
+ import { Command as Command61 } from "commander";
7165
7227
  function describeMount(machine, volume2, box2) {
7166
7228
  const path = machine.volumes?.find((v) => volume2 === v.name || volume2.endsWith(`/${v.name}`))?.mountPath ?? volumeMountPath(volume2.slice(volume2.lastIndexOf("/") + 1));
7167
7229
  return machine.status === "running" ? ` the box was restarted; the volume is at ${path} inside it` : ` box ${box2} is ${machine.status}; the volume is at ${path} once it runs`;
7168
7230
  }
7169
- var attachCommand = new Command60("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) => {
7231
+ var attachCommand = new Command61("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) => {
7170
7232
  if (volumeArg === void 0 || boxArg === void 0) askOrUsage("give the volume and the box: kvbox volume attach <volume> <box>");
7171
7233
  const client = await clientFor(cmd.optsWithGlobals());
7172
7234
  try {
@@ -7185,11 +7247,11 @@ var attachCommand = new Command60("attach").description("attach a volume to a bo
7185
7247
  });
7186
7248
 
7187
7249
  // src/commands/volume/backup/index.ts
7188
- import { Command as Command65 } from "commander";
7250
+ import { Command as Command66 } from "commander";
7189
7251
 
7190
7252
  // src/commands/volume/backup/create.ts
7191
- import { Command as Command61 } from "commander";
7192
- var createCommand4 = new Command61("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 (volume2, opts, cmd) => {
7253
+ import { Command as Command62 } from "commander";
7254
+ var createCommand4 = new Command62("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 (volume2, opts, cmd) => {
7193
7255
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
7194
7256
  try {
7195
7257
  requireCloud3(client);
@@ -7216,8 +7278,8 @@ var createCommand4 = new Command61("create").description("back up a volume's dis
7216
7278
  });
7217
7279
 
7218
7280
  // src/commands/volume/backup/ls.ts
7219
- import { Command as Command62 } from "commander";
7220
- var lsCommand9 = new Command62("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 (volume2, opts, cmd) => {
7281
+ import { Command as Command63 } from "commander";
7282
+ var lsCommand9 = new Command63("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 (volume2, opts, cmd) => {
7221
7283
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
7222
7284
  try {
7223
7285
  requireCloud3(client);
@@ -7250,8 +7312,8 @@ var lsCommand9 = new Command62("ls").alias("list").description("list volume back
7250
7312
  });
7251
7313
 
7252
7314
  // src/commands/volume/backup/restore.ts
7253
- import { Command as Command63 } from "commander";
7254
- var restoreCommand2 = new Command63("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 (volume2, id, opts, cmd) => {
7315
+ import { Command as Command64 } from "commander";
7316
+ var restoreCommand2 = new Command64("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 (volume2, id, opts, cmd) => {
7255
7317
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
7256
7318
  try {
7257
7319
  requireCloud3(client);
@@ -7274,8 +7336,8 @@ var restoreCommand2 = new Command63("restore").description("put a backup back: t
7274
7336
  });
7275
7337
 
7276
7338
  // src/commands/volume/backup/rm.ts
7277
- import { Command as Command64 } from "commander";
7278
- var rmCommand9 = new Command64("rm").alias("remove").description("remove a backup for good (a volume's that is gone too)").argument("<volume>", "volume name").argument("<id>", "the backup's id (kvbox volume backup ls <volume>)").option("-y, --yes", "do not ask for confirmation").action(async (volume2, id, opts, cmd) => {
7339
+ import { Command as Command65 } from "commander";
7340
+ var rmCommand9 = new Command65("rm").alias("remove").description("remove a backup for good (a volume's that is gone too)").argument("<volume>", "volume name").argument("<id>", "the backup's id (kvbox volume backup ls <volume>)").option("-y, --yes", "do not ask for confirmation").action(async (volume2, id, opts, cmd) => {
7279
7341
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
7280
7342
  try {
7281
7343
  requireCloud3(client);
@@ -7286,11 +7348,11 @@ var rmCommand9 = new Command64("rm").alias("remove").description("remove a backu
7286
7348
  });
7287
7349
 
7288
7350
  // src/commands/volume/backup/index.ts
7289
- var backupCommand2 = new Command65("backup").description("back up a volume's disk to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand4).addCommand(lsCommand9).addCommand(restoreCommand2).addCommand(rmCommand9);
7351
+ var backupCommand2 = new Command66("backup").description("back up a volume's disk to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand4).addCommand(lsCommand9).addCommand(restoreCommand2).addCommand(rmCommand9);
7290
7352
  for (const cmd of backupCommand2.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
7291
7353
 
7292
7354
  // src/commands/volume/create.ts
7293
- import { Command as Command66 } from "commander";
7355
+ import { Command as Command67 } from "commander";
7294
7356
  function parseGib2(text2, label = "--size") {
7295
7357
  const mib = parseMib(text2);
7296
7358
  if (mib === void 0 || mib % 1024 !== 0) throw new KvboxError(`${label} ${text2}: write whole GB, like 50 or 50GB`);
@@ -7306,7 +7368,7 @@ function sizeProblem(answer) {
7306
7368
  return err instanceof KvboxError ? err.message.replace(/^--size \S+: /, "") : String(err);
7307
7369
  }
7308
7370
  }
7309
- var createCommand5 = new Command66("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) => {
7371
+ var createCommand5 = new Command67("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) => {
7310
7372
  const ask = interactive();
7311
7373
  if (nameArg === void 0 || opts.size === void 0) askOrUsage("give the name and the size: kvbox volume create <name> --size <gb> --box <box>");
7312
7374
  const name = nameArg ?? await text("Volume name", { validate: (a) => VOLUME_NAME_RE.test(a) ? void 0 : VOLUME_NAME_RULE });
@@ -7339,8 +7401,8 @@ var createCommand5 = new Command66("create").alias("new").description("create a
7339
7401
  });
7340
7402
 
7341
7403
  // src/commands/volume/detach.ts
7342
- import { Command as Command67 } from "commander";
7343
- var detachCommand = new Command67("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) => {
7404
+ import { Command as Command68 } from "commander";
7405
+ var detachCommand = new Command68("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) => {
7344
7406
  if (volumeArg === void 0) askOrUsage("give the volume: kvbox volume detach <volume> [box]");
7345
7407
  const client = await clientFor(cmd.optsWithGlobals());
7346
7408
  try {
@@ -7365,8 +7427,8 @@ var detachCommand = new Command67("detach").description("detach a volume from a
7365
7427
  });
7366
7428
 
7367
7429
  // src/commands/volume/grow.ts
7368
- import { Command as Command68 } from "commander";
7369
- var growCommand = new Command68("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) => {
7430
+ import { Command as Command69 } from "commander";
7431
+ var growCommand = new Command69("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) => {
7370
7432
  const sizeGib = parseGib2(size, "size");
7371
7433
  const client = await clientFor(cmd.optsWithGlobals());
7372
7434
  try {
@@ -7379,8 +7441,8 @@ var growCommand = new Command68("grow").alias("resize").description("make a volu
7379
7441
  });
7380
7442
 
7381
7443
  // src/commands/volume/ls.ts
7382
- import { Command as Command69 } from "commander";
7383
- var lsCommand10 = new Command69("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) => {
7444
+ import { Command as Command70 } from "commander";
7445
+ var lsCommand10 = new Command70("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) => {
7384
7446
  const client = await clientFor(cmd.optsWithGlobals());
7385
7447
  try {
7386
7448
  const cloud = client.target.kind === "cloud";
@@ -7411,8 +7473,8 @@ var lsCommand10 = new Command69("ls").alias("list").description("list volumes: s
7411
7473
  });
7412
7474
 
7413
7475
  // src/commands/volume/rm.ts
7414
- import { Command as Command70 } from "commander";
7415
- var rmCommand10 = new Command70("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) => {
7476
+ import { Command as Command71 } from "commander";
7477
+ var rmCommand10 = new Command71("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) => {
7416
7478
  if (!await confirm(`Delete volume ${name} and everything on it?`, opts.yes ?? false)) {
7417
7479
  info("cancelled");
7418
7480
  process.exitCode = 1;
@@ -7428,18 +7490,18 @@ var rmCommand10 = new Command70("rm").alias("remove").description("delete a volu
7428
7490
  });
7429
7491
 
7430
7492
  // src/commands/volume/index.ts
7431
- var volumeCommand = new Command71("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(createCommand5).addCommand(lsCommand10).addCommand(attachCommand).addCommand(detachCommand).addCommand(growCommand).addCommand(rmCommand10);
7493
+ var volumeCommand = new Command72("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(createCommand5).addCommand(lsCommand10).addCommand(attachCommand).addCommand(detachCommand).addCommand(growCommand).addCommand(rmCommand10);
7432
7494
  for (const cmd of volumeCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
7433
7495
  volumeCommand.addCommand(backupCommand2);
7434
7496
 
7435
7497
  // src/commands/bucket/index.ts
7436
- import { Command as Command86 } from "commander";
7498
+ import { Command as Command87 } from "commander";
7437
7499
 
7438
7500
  // src/commands/bucket/backup/index.ts
7439
- import { Command as Command76 } from "commander";
7501
+ import { Command as Command77 } from "commander";
7440
7502
 
7441
7503
  // src/commands/bucket/backup/create.ts
7442
- import { Command as Command72 } from "commander";
7504
+ import { Command as Command73 } from "commander";
7443
7505
 
7444
7506
  // src/commands/bucket/shared.ts
7445
7507
  async function bucketClient(cmd) {
@@ -7465,7 +7527,7 @@ function printRows(rows2) {
7465
7527
  }
7466
7528
 
7467
7529
  // src/commands/bucket/backup/create.ts
7468
- var createCommand6 = new Command72("create").description("back up your object storage (every bucket and key) to the kvbox cloud, encrypted").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (opts, cmd) => {
7530
+ var createCommand6 = new Command73("create").description("back up your object storage (every bucket and key) to the kvbox cloud, encrypted").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (opts, cmd) => {
7469
7531
  const client = await bucketClient(cmd);
7470
7532
  const ls = "kvbox bucket backup ls";
7471
7533
  try {
@@ -7493,8 +7555,8 @@ var createCommand6 = new Command72("create").description("back up your object st
7493
7555
  });
7494
7556
 
7495
7557
  // src/commands/bucket/backup/ls.ts
7496
- import { Command as Command73 } from "commander";
7497
- var lsCommand11 = new Command73("ls").alias("list").description("list the backups of your object storage").option("--json", "print as JSON").action(async (opts, cmd) => {
7558
+ import { Command as Command74 } from "commander";
7559
+ var lsCommand11 = new Command74("ls").alias("list").description("list the backups of your object storage").option("--json", "print as JSON").action(async (opts, cmd) => {
7498
7560
  const client = await bucketClient(cmd);
7499
7561
  try {
7500
7562
  const list = await client.storageBackups();
@@ -7526,8 +7588,8 @@ var lsCommand11 = new Command73("ls").alias("list").description("list the backup
7526
7588
  });
7527
7589
 
7528
7590
  // src/commands/bucket/backup/restore.ts
7529
- import { Command as Command74 } from "commander";
7530
- var restoreCommand3 = new Command74("restore").description("put a backup back: every bucket and key becomes the backup's (the storage restarts)").argument("<id>", "the backup's id (kvbox bucket backup ls)").option("-y, --yes", "do not ask for confirmation").option("--json", "print what changed as JSON").action(async (id, opts, cmd) => {
7591
+ import { Command as Command75 } from "commander";
7592
+ var restoreCommand3 = new Command75("restore").description("put a backup back: every bucket and key becomes the backup's (the storage restarts)").argument("<id>", "the backup's id (kvbox bucket backup ls)").option("-y, --yes", "do not ask for confirmation").option("--json", "print what changed as JSON").action(async (id, opts, cmd) => {
7531
7593
  const client = await bucketClient(cmd);
7532
7594
  try {
7533
7595
  const backup = await client.storageBackup(id);
@@ -7557,8 +7619,8 @@ var restoreCommand3 = new Command74("restore").description("put a backup back: e
7557
7619
  });
7558
7620
 
7559
7621
  // src/commands/bucket/backup/rm.ts
7560
- import { Command as Command75 } from "commander";
7561
- var rmCommand11 = new Command75("rm").alias("remove").description("remove a backup of your object storage for good").argument("<id>", "the backup's id (kvbox bucket backup ls)").option("-y, --yes", "do not ask for confirmation").action(async (id, opts, cmd) => {
7622
+ import { Command as Command76 } from "commander";
7623
+ var rmCommand11 = new Command76("rm").alias("remove").description("remove a backup of your object storage for good").argument("<id>", "the backup's id (kvbox bucket backup ls)").option("-y, --yes", "do not ask for confirmation").action(async (id, opts, cmd) => {
7562
7624
  const client = await bucketClient(cmd);
7563
7625
  try {
7564
7626
  const backup = (await client.storageBackups()).find((b) => b.id === id);
@@ -7577,11 +7639,11 @@ var rmCommand11 = new Command75("rm").alias("remove").description("remove a back
7577
7639
  });
7578
7640
 
7579
7641
  // src/commands/bucket/backup/index.ts
7580
- var backupCommand3 = new Command76("backup").aliases(["backups"]).description("back up your object storage to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand6).addCommand(lsCommand11).addCommand(restoreCommand3).addCommand(rmCommand11);
7642
+ var backupCommand3 = new Command77("backup").aliases(["backups"]).description("back up your object storage to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand6).addCommand(lsCommand11).addCommand(restoreCommand3).addCommand(rmCommand11);
7581
7643
 
7582
7644
  // src/commands/bucket/create.ts
7583
- import { Command as Command77 } from "commander";
7584
- var createCommand7 = new Command77("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) => {
7645
+ import { Command as Command78 } from "commander";
7646
+ var createCommand7 = new Command78("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) => {
7585
7647
  const sizeGib = opts.size === void 0 ? void 0 : parseGib2(opts.size);
7586
7648
  const client = await bucketClient(cmd);
7587
7649
  try {
@@ -7601,8 +7663,8 @@ var createCommand7 = new Command77("create").description("make a bucket (the fir
7601
7663
  });
7602
7664
 
7603
7665
  // src/commands/bucket/grow.ts
7604
- import { Command as Command78 } from "commander";
7605
- var growCommand2 = new Command78("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) => {
7666
+ import { Command as Command79 } from "commander";
7667
+ var growCommand2 = new Command79("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) => {
7606
7668
  const sizeGib = parseGib2(size, "size");
7607
7669
  const client = await bucketClient(cmd);
7608
7670
  try {
@@ -7615,8 +7677,8 @@ var growCommand2 = new Command78("grow").description("make your object storage l
7615
7677
  });
7616
7678
 
7617
7679
  // src/commands/bucket/info.ts
7618
- import { Command as Command79 } from "commander";
7619
- var infoCommand = new Command79("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) => {
7680
+ import { Command as Command80 } from "commander";
7681
+ var infoCommand = new Command80("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) => {
7620
7682
  const client = await bucketClient(cmd);
7621
7683
  try {
7622
7684
  const b = await client.getBucket(name);
@@ -7645,11 +7707,11 @@ with the AWS CLI: aws s3 ls s3://${b.name} --endpoint-url ${b.endpoint}`));
7645
7707
  });
7646
7708
 
7647
7709
  // src/commands/bucket/key/index.ts
7648
- import { Command as Command83 } from "commander";
7710
+ import { Command as Command84 } from "commander";
7649
7711
 
7650
7712
  // src/commands/bucket/key/create.ts
7651
- import { Command as Command80 } from "commander";
7652
- var createCommand8 = new Command80("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) => {
7713
+ import { Command as Command81 } from "commander";
7714
+ var createCommand8 = new Command81("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) => {
7653
7715
  const client = await bucketClient(cmd);
7654
7716
  try {
7655
7717
  const key = await client.createBucketKey(bucket, { ...opts.name !== void 0 ? { name: opts.name } : {}, ...opts.readOnly ? { readOnly: true } : {} });
@@ -7672,8 +7734,8 @@ var createCommand8 = new Command80("create").description("make an access key for
7672
7734
  });
7673
7735
 
7674
7736
  // src/commands/bucket/key/ls.ts
7675
- import { Command as Command81 } from "commander";
7676
- var lsCommand12 = new Command81("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) => {
7737
+ import { Command as Command82 } from "commander";
7738
+ var lsCommand12 = new Command82("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) => {
7677
7739
  const client = await bucketClient(cmd);
7678
7740
  try {
7679
7741
  const keys = await client.listBucketKeys(bucket);
@@ -7692,8 +7754,8 @@ var lsCommand12 = new Command81("ls").alias("list").description("list a bucket's
7692
7754
  });
7693
7755
 
7694
7756
  // src/commands/bucket/key/rm.ts
7695
- import { Command as Command82 } from "commander";
7696
- var rmCommand12 = new Command82("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) => {
7757
+ import { Command as Command83 } from "commander";
7758
+ var rmCommand12 = new Command83("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) => {
7697
7759
  const client = await bucketClient(cmd);
7698
7760
  try {
7699
7761
  if (!await confirm(`Delete key ${id} of bucket ${bucket}? Whatever uses it stops working.`, opts.yes ?? false)) {
@@ -7709,11 +7771,11 @@ var rmCommand12 = new Command82("rm").alias("remove").description("delete an acc
7709
7771
  });
7710
7772
 
7711
7773
  // src/commands/bucket/key/index.ts
7712
- var keyCommand2 = new Command83("key").aliases(["keys"]).description("access keys of a bucket: what your app signs in with").addCommand(createCommand8).addCommand(lsCommand12).addCommand(rmCommand12);
7774
+ var keyCommand2 = new Command84("key").aliases(["keys"]).description("access keys of a bucket: what your app signs in with").addCommand(createCommand8).addCommand(lsCommand12).addCommand(rmCommand12);
7713
7775
 
7714
7776
  // src/commands/bucket/ls.ts
7715
- import { Command as Command84 } from "commander";
7716
- var lsCommand13 = new Command84("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) => {
7777
+ import { Command as Command85 } from "commander";
7778
+ var lsCommand13 = new Command85("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) => {
7717
7779
  const client = await bucketClient(cmd);
7718
7780
  try {
7719
7781
  const buckets = await client.listBuckets({ all: opts.all });
@@ -7743,8 +7805,8 @@ var lsCommand13 = new Command84("ls").alias("list").description("list buckets, a
7743
7805
  });
7744
7806
 
7745
7807
  // src/commands/bucket/rm.ts
7746
- import { Command as Command85 } from "commander";
7747
- var rmCommand13 = new Command85("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) => {
7808
+ import { Command as Command86 } from "commander";
7809
+ var rmCommand13 = new Command86("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) => {
7748
7810
  const client = await bucketClient(cmd);
7749
7811
  try {
7750
7812
  const question = opts.force ? `Delete bucket ${name} with everything in it, and the object storage it is in?` : `Delete bucket ${name} and its keys?`;
@@ -7763,7 +7825,7 @@ var rmCommand13 = new Command85("rm").alias("remove").description("delete an emp
7763
7825
  });
7764
7826
 
7765
7827
  // src/commands/bucket/index.ts
7766
- var bucketCommand = new Command86("bucket").aliases(["buckets"]).description("object storage: S3 buckets for your files, and the access keys your apps use").addCommand(createCommand7).addCommand(lsCommand13).addCommand(infoCommand).addCommand(growCommand2).addCommand(rmCommand13).addCommand(keyCommand2).addCommand(backupCommand3);
7828
+ var bucketCommand = new Command87("bucket").aliases(["buckets"]).description("object storage: S3 buckets for your files, and the access keys your apps use").addCommand(createCommand7).addCommand(lsCommand13).addCommand(infoCommand).addCommand(growCommand2).addCommand(rmCommand13).addCommand(keyCommand2).addCommand(backupCommand3);
7767
7829
  var withOrg = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal buckets)");
7768
7830
  for (const cmd of bucketCommand.commands) {
7769
7831
  if (cmd === keyCommand2 || cmd === backupCommand3) cmd.commands.forEach(withOrg);
@@ -7771,10 +7833,10 @@ for (const cmd of bucketCommand.commands) {
7771
7833
  }
7772
7834
 
7773
7835
  // src/commands/cron/index.ts
7774
- import { Command as Command99 } from "commander";
7836
+ import { Command as Command100 } from "commander";
7775
7837
 
7776
7838
  // src/commands/cron/create.ts
7777
- import { Command as Command87 } from "commander";
7839
+ import { Command as Command88 } from "commander";
7778
7840
 
7779
7841
  // src/commands/cron/shared.ts
7780
7842
  async function cronClient(cmd) {
@@ -7835,7 +7897,7 @@ function printRows2(rows2) {
7835
7897
  var noTriggers = (service) => info(`cron service ${service} has no triggers yet; add one with: kvbox cron trigger add ${service} <box> "0 6 * * *" --port 3000 (or --run "<command>")`);
7836
7898
 
7837
7899
  // src/commands/cron/create.ts
7838
- var createCommand9 = new Command87("create").description("make a cron service: a named set of triggers").argument("<name>", "what to call it (lowercase letters, digits and '-')").option("--json", "print as JSON").action(async (name, opts, cmd) => {
7900
+ var createCommand9 = new Command88("create").description("make a cron service: a named set of triggers").argument("<name>", "what to call it (lowercase letters, digits and '-')").option("--json", "print as JSON").action(async (name, opts, cmd) => {
7839
7901
  const client = await cronClient(cmd);
7840
7902
  try {
7841
7903
  const service = await client.createCronService(name);
@@ -7852,8 +7914,8 @@ var createCommand9 = new Command87("create").description("make a cron service: a
7852
7914
  });
7853
7915
 
7854
7916
  // src/commands/cron/info.ts
7855
- import { Command as Command88 } from "commander";
7856
- var infoCommand2 = new Command88("info").alias("get").description("show a cron service and its triggers").argument("<name>", "cron service name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
7917
+ import { Command as Command89 } from "commander";
7918
+ var infoCommand2 = new Command89("info").alias("get").description("show a cron service and its triggers").argument("<name>", "cron service name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
7857
7919
  const client = await cronClient(cmd);
7858
7920
  try {
7859
7921
  const service = await client.getCronService(name);
@@ -7877,8 +7939,8 @@ var infoCommand2 = new Command88("info").alias("get").description("show a cron s
7877
7939
  });
7878
7940
 
7879
7941
  // src/commands/cron/ls.ts
7880
- import { Command as Command89 } from "commander";
7881
- var lsCommand14 = new Command89("ls").alias("list").description("list cron services").option("-a, --all", "every cron service on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
7942
+ import { Command as Command90 } from "commander";
7943
+ var lsCommand14 = new Command90("ls").alias("list").description("list cron services").option("-a, --all", "every cron service on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
7882
7944
  const client = await cronClient(cmd);
7883
7945
  try {
7884
7946
  const services = await client.listCronServices({ all: opts.all });
@@ -7898,8 +7960,8 @@ var lsCommand14 = new Command89("ls").alias("list").description("list cron servi
7898
7960
  });
7899
7961
 
7900
7962
  // src/commands/cron/rm.ts
7901
- import { Command as Command90 } from "commander";
7902
- var rmCommand14 = new Command90("rm").alias("remove").description("delete a cron service, its triggers and their run history").argument("<name>", "cron service name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
7963
+ import { Command as Command91 } from "commander";
7964
+ var rmCommand14 = new Command91("rm").alias("remove").description("delete a cron service, its triggers and their run history").argument("<name>", "cron service name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
7903
7965
  const client = await cronClient(cmd);
7904
7966
  try {
7905
7967
  if (!await confirm(`Delete cron service ${name}? Its triggers stop firing and their run history is deleted.`, opts.yes ?? false)) {
@@ -7915,10 +7977,10 @@ var rmCommand14 = new Command90("rm").alias("remove").description("delete a cron
7915
7977
  });
7916
7978
 
7917
7979
  // src/commands/cron/trigger/index.ts
7918
- import { Command as Command98 } from "commander";
7980
+ import { Command as Command99 } from "commander";
7919
7981
 
7920
7982
  // src/commands/cron/trigger/add.ts
7921
- import { Command as Command91 } from "commander";
7983
+ import { Command as Command92 } from "commander";
7922
7984
  function portOf(value) {
7923
7985
  const n = Number(value);
7924
7986
  if (!Number.isInteger(n) || n < 1 || n > 65535) throw new KvboxError(`--port ${value}: a port is a number from 1 to 65535`);
@@ -7938,7 +8000,7 @@ function timeoutOf(value) {
7938
8000
  if (sec > MAX_CRON_COMMAND_TIMEOUT_SEC) throw new KvboxError(`--timeout ${value}: a command may run for ${MAX_CRON_COMMAND_TIMEOUT_SEC / 60} minutes at most`);
7939
8001
  return sec;
7940
8002
  }
7941
- var addCommand3 = new Command91("add").description("add a trigger: on a schedule, call a port of a box or run a command in it").argument("<service>", "cron service name").argument("<box>", "the box it acts on").argument("<expr>", 'cron expression in quotes, five fields: "0 6 * * *" is every day at 06:00').option("--port <n>", "call this port, the one your app listens on in the box").option("--path <path>", "with --port: path and query to request (default: /)").option("--method <method>", `with --port: HTTP method, ${CRON_METHODS.join(" or ")} (default: POST)`).option("--run <command>", 'or run this command in the box, in quotes: "node ~/app/embed.js"').option("--timeout <duration>", `with --run: stop the command after this long (90s, 10m, 1h; default: ${DEFAULT_CRON_COMMAND_TIMEOUT_SEC / 60}m)`).option("--tz <zone>", "time zone the schedule is read in, like Europe/Bucharest", "UTC").option("--json", "print as JSON").action(async (service, box2, expr, opts, cmd) => {
8003
+ var addCommand3 = new Command92("add").description("add a trigger: on a schedule, call a port of a box or run a command in it").argument("<service>", "cron service name").argument("<box>", "the box it acts on").argument("<expr>", 'cron expression in quotes, five fields: "0 6 * * *" is every day at 06:00').option("--port <n>", "call this port, the one your app listens on in the box").option("--path <path>", "with --port: path and query to request (default: /)").option("--method <method>", `with --port: HTTP method, ${CRON_METHODS.join(" or ")} (default: POST)`).option("--run <command>", 'or run this command in the box, in quotes: "node ~/app/embed.js"').option("--timeout <duration>", `with --run: stop the command after this long (90s, 10m, 1h; default: ${DEFAULT_CRON_COMMAND_TIMEOUT_SEC / 60}m)`).option("--tz <zone>", "time zone the schedule is read in, like Europe/Bucharest", "UTC").option("--json", "print as JSON").action(async (service, box2, expr, opts, cmd) => {
7942
8004
  let action;
7943
8005
  if (opts.run !== void 0) {
7944
8006
  if (opts.port !== void 0 || opts.path !== void 0 || opts.method !== void 0) throw new KvboxError("a trigger runs a command or calls a port: use --run, or --port with --path and --method, not both");
@@ -7965,8 +8027,8 @@ var addCommand3 = new Command91("add").description("add a trigger: on a schedule
7965
8027
  });
7966
8028
 
7967
8029
  // src/commands/cron/trigger/ls.ts
7968
- import { Command as Command92 } from "commander";
7969
- var lsCommand15 = new Command92("ls").alias("list").description("list a cron service's triggers").argument("<service>", "cron service name").option("--json", "print as JSON").action(async (service, opts, cmd) => {
8030
+ import { Command as Command93 } from "commander";
8031
+ var lsCommand15 = new Command93("ls").alias("list").description("list a cron service's triggers").argument("<service>", "cron service name").option("--json", "print as JSON").action(async (service, opts, cmd) => {
7970
8032
  const client = await cronClient(cmd);
7971
8033
  try {
7972
8034
  const triggers = await client.listCronTriggers(service);
@@ -7982,8 +8044,8 @@ var lsCommand15 = new Command92("ls").alias("list").description("list a cron ser
7982
8044
  });
7983
8045
 
7984
8046
  // src/commands/cron/trigger/pause.ts
7985
- import { Command as Command93 } from "commander";
7986
- var pauseCommand2 = new Command93("pause").description("stop a trigger from firing until it is resumed").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8047
+ import { Command as Command94 } from "commander";
8048
+ var pauseCommand2 = new Command94("pause").description("stop a trigger from firing until it is resumed").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
7987
8049
  const client = await cronClient(cmd);
7988
8050
  try {
7989
8051
  const trigger = await client.setCronTriggerEnabled(service, id, false);
@@ -7998,8 +8060,8 @@ var pauseCommand2 = new Command93("pause").description("stop a trigger from firi
7998
8060
  });
7999
8061
 
8000
8062
  // src/commands/cron/trigger/resume.ts
8001
- import { Command as Command94 } from "commander";
8002
- var resumeCommand2 = new Command94("resume").description("let a paused trigger fire again").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8063
+ import { Command as Command95 } from "commander";
8064
+ var resumeCommand2 = new Command95("resume").description("let a paused trigger fire again").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8003
8065
  const client = await cronClient(cmd);
8004
8066
  try {
8005
8067
  const trigger = await client.setCronTriggerEnabled(service, id, true);
@@ -8014,8 +8076,8 @@ var resumeCommand2 = new Command94("resume").description("let a paused trigger f
8014
8076
  });
8015
8077
 
8016
8078
  // src/commands/cron/trigger/rm.ts
8017
- import { Command as Command95 } from "commander";
8018
- var rmCommand15 = new Command95("rm").alias("remove").description("delete a trigger and its run history").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-y, --yes", "do not ask for confirmation").action(async (service, id, opts, cmd) => {
8079
+ import { Command as Command96 } from "commander";
8080
+ var rmCommand15 = new Command96("rm").alias("remove").description("delete a trigger and its run history").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-y, --yes", "do not ask for confirmation").action(async (service, id, opts, cmd) => {
8019
8081
  const client = await cronClient(cmd);
8020
8082
  try {
8021
8083
  if (!await confirm(`Delete trigger ${id} of cron service ${service}? Its run history is deleted too.`, opts.yes ?? false)) {
@@ -8031,8 +8093,8 @@ var rmCommand15 = new Command95("rm").alias("remove").description("delete a trig
8031
8093
  });
8032
8094
 
8033
8095
  // src/commands/cron/trigger/run.ts
8034
- import { Command as Command96 } from "commander";
8035
- var runCommand = new Command96("run").description("fire a trigger now, once, besides its schedule").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8096
+ import { Command as Command97 } from "commander";
8097
+ var runCommand = new Command97("run").description("fire a trigger now, once, besides its schedule").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8036
8098
  const client = await cronClient(cmd);
8037
8099
  try {
8038
8100
  const trigger = await client.runCronTrigger(service, id);
@@ -8048,13 +8110,13 @@ var runCommand = new Command96("run").description("fire a trigger now, once, bes
8048
8110
  });
8049
8111
 
8050
8112
  // src/commands/cron/trigger/runs.ts
8051
- import { Command as Command97 } from "commander";
8113
+ import { Command as Command98 } from "commander";
8052
8114
  function limitOf(value) {
8053
8115
  const n = Number(value);
8054
8116
  if (!Number.isInteger(n) || n < 1) throw new KvboxError(`-n ${value}: a number of runs, 1 or more`);
8055
8117
  return n;
8056
8118
  }
8057
- var runsCommand = new Command97("runs").aliases(["logs"]).description("show how a trigger's last runs ended").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-n, --limit <count>", "how many runs to show", "20").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8119
+ var runsCommand = new Command98("runs").aliases(["logs"]).description("show how a trigger's last runs ended").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-n, --limit <count>", "how many runs to show", "20").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
8058
8120
  const limit = limitOf(opts.limit);
8059
8121
  const client = await cronClient(cmd);
8060
8122
  try {
@@ -8084,10 +8146,10 @@ var runsCommand = new Command97("runs").aliases(["logs"]).description("show how
8084
8146
  });
8085
8147
 
8086
8148
  // src/commands/cron/trigger/index.ts
8087
- var triggerCommand = new Command98("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand3).addCommand(lsCommand15).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand15);
8149
+ var triggerCommand = new Command99("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand3).addCommand(lsCommand15).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand15);
8088
8150
 
8089
8151
  // src/commands/cron/index.ts
8090
- var cronCommand = new Command99("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand9).addCommand(lsCommand14).addCommand(infoCommand2).addCommand(rmCommand14).addCommand(triggerCommand);
8152
+ var cronCommand = new Command100("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand9).addCommand(lsCommand14).addCommand(infoCommand2).addCommand(rmCommand14).addCommand(triggerCommand);
8091
8153
  var withOrg2 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal cron services)");
8092
8154
  for (const cmd of cronCommand.commands) {
8093
8155
  if (cmd === triggerCommand) cmd.commands.forEach(withOrg2);
@@ -8095,13 +8157,13 @@ for (const cmd of cronCommand.commands) {
8095
8157
  }
8096
8158
 
8097
8159
  // src/commands/managed/kind.ts
8098
- import { Command as Command118 } from "commander";
8160
+ import { Command as Command119 } from "commander";
8099
8161
 
8100
8162
  // src/commands/managed/backup/index.ts
8101
- import { Command as Command106 } from "commander";
8163
+ import { Command as Command107 } from "commander";
8102
8164
 
8103
8165
  // src/commands/managed/backup/create.ts
8104
- import { Command as Command101 } from "commander";
8166
+ import { Command as Command102 } from "commander";
8105
8167
 
8106
8168
  // src/commands/managed/shared.ts
8107
8169
  import "commander";
@@ -8199,7 +8261,7 @@ function parseStorage(text2, flag) {
8199
8261
  }
8200
8262
 
8201
8263
  // src/commands/managed/backup/create.ts
8202
- var createCommand10 = (spec) => new Command101("create").description("back up a database to the kvbox cloud (encrypted)").argument("<db>", "its name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
8264
+ var createCommand10 = (spec) => new Command102("create").description("back up a database to the kvbox cloud (encrypted)").argument("<db>", "its name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
8203
8265
  const client = await managedClient(cmd);
8204
8266
  const ls = `kvbox ${spec.command} backup ls ${name}`;
8205
8267
  try {
@@ -8226,7 +8288,7 @@ var createCommand10 = (spec) => new Command101("create").description("back up a
8226
8288
  });
8227
8289
 
8228
8290
  // src/commands/managed/backup/ls.ts
8229
- import { Command as Command102 } from "commander";
8291
+ import { Command as Command103 } from "commander";
8230
8292
  var lsCommand16 = (spec) => {
8231
8293
  const removedOnes = async (err, name, client) => {
8232
8294
  if (!(err instanceof CallError && err.status === 404)) throw err;
@@ -8235,7 +8297,7 @@ var lsCommand16 = (spec) => {
8235
8297
  const own = name.includes("/") ? [] : gone.filter((b) => b.owner === me(client));
8236
8298
  return own.length > 0 ? own : gone;
8237
8299
  };
8238
- return new Command102("ls").alias("list").description("list backups: every database's, or one database's").argument("[db]", "its name (default: every database)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
8300
+ return new Command103("ls").alias("list").description("list backups: every database's, or one database's").argument("[db]", "its name (default: every database)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
8239
8301
  const client = await managedClient(cmd);
8240
8302
  try {
8241
8303
  const list = name === void 0 ? await client.listManagedBackups(spec.kind) : await client.managedBackups(spec.kind, name).catch((err) => removedOnes(err, name, client));
@@ -8278,8 +8340,8 @@ var lsCommand16 = (spec) => {
8278
8340
  };
8279
8341
 
8280
8342
  // src/commands/managed/backup/restore.ts
8281
- import { Command as Command103 } from "commander";
8282
- var restoreCommand4 = (spec) => new Command103("restore").description("put a backup back: the database's data becomes the backup's (it restarts)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").option("--json", "print the database as JSON").action(async (name, id, opts, cmd) => {
8343
+ import { Command as Command104 } from "commander";
8344
+ var restoreCommand4 = (spec) => new Command104("restore").description("put a backup back: the database's data becomes the backup's (it restarts)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").option("--json", "print the database as JSON").action(async (name, id, opts, cmd) => {
8283
8345
  const client = await managedClient(cmd);
8284
8346
  try {
8285
8347
  const backup = await client.managedBackup(spec.kind, name, id);
@@ -8301,8 +8363,8 @@ var restoreCommand4 = (spec) => new Command103("restore").description("put a bac
8301
8363
  });
8302
8364
 
8303
8365
  // src/commands/managed/backup/rm.ts
8304
- import { Command as Command104 } from "commander";
8305
- var rmCommand16 = (spec) => new Command104("rm").alias("remove").description("remove a backup for good (a database's that is gone too)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
8366
+ import { Command as Command105 } from "commander";
8367
+ var rmCommand16 = (spec) => new Command105("rm").alias("remove").description("remove a backup for good (a database's that is gone too)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
8306
8368
  const client = await managedClient(cmd);
8307
8369
  try {
8308
8370
  await removeListed(client, await client.listManagedBackups(spec.kind), (b) => b.name, name, id, `database ${name}`, opts.yes ?? false);
@@ -8312,8 +8374,8 @@ var rmCommand16 = (spec) => new Command104("rm").alias("remove").description("re
8312
8374
  });
8313
8375
 
8314
8376
  // src/commands/managed/backup/schedule.ts
8315
- import { Command as Command105 } from "commander";
8316
- var scheduleCommand = (spec) => new Command105("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name").option("--at <hour>", "back it up daily at this hour, 0-23 UTC (turns it on)").option("--off", "stop backing it up on its own").option("--on", "back it up on its own again, at the hour it had").option("--json", "print the schedule as JSON").action(async (name, opts, cmd) => {
8377
+ import { Command as Command106 } from "commander";
8378
+ var scheduleCommand = (spec) => new Command106("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name").option("--at <hour>", "back it up daily at this hour, 0-23 UTC (turns it on)").option("--off", "stop backing it up on its own").option("--on", "back it up on its own again, at the hour it had").option("--json", "print the schedule as JSON").action(async (name, opts, cmd) => {
8317
8379
  if (opts.off && (opts.on || opts.at !== void 0)) throw new KvboxError("--off takes neither --on nor --at");
8318
8380
  const hour = opts.at === void 0 ? void 0 : parseHour(opts.at);
8319
8381
  const client = await managedClient(cmd);
@@ -8343,18 +8405,18 @@ function parseHour(text2) {
8343
8405
 
8344
8406
  // src/commands/managed/backup/index.ts
8345
8407
  var backupCommand4 = (spec) => {
8346
- const command = new Command106("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
8408
+ const command = new Command107("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
8347
8409
  for (const make of [createCommand10, lsCommand16, restoreCommand4, rmCommand16, scheduleCommand]) command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
8348
8410
  return command;
8349
8411
  };
8350
8412
 
8351
8413
  // src/commands/managed/create.ts
8352
- import { Command as Command107 } from "commander";
8414
+ import { Command as Command108 } from "commander";
8353
8415
  import { setTimeout as sleep5 } from "timers/promises";
8354
8416
  var READY_WAIT_MS = 9e4;
8355
8417
  var READY_STEP_MS = 2e3;
8356
8418
  var createCommand11 = (spec) => {
8357
- const command = new Command107("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");
8419
+ const command = new Command108("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");
8358
8420
  for (const o of spec.options) command.option(`--${o.name} <${o.arg}>`, o.help);
8359
8421
  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("--from-backup <id>", `start it on this backup's data, a removed database's too (kvbox ${spec.command} backup ls)`).option("--json", "print it as JSON, password included").action(async (name, opts, cmd) => {
8360
8422
  const options = Object.fromEntries(spec.options.flatMap((o) => typeof opts[o.name] === "string" ? [[o.name, opts[o.name]]] : []));
@@ -8403,8 +8465,8 @@ var createCommand11 = (spec) => {
8403
8465
  };
8404
8466
 
8405
8467
  // src/commands/managed/grow.ts
8406
- import { Command as Command108 } from "commander";
8407
- var growCommand3 = (spec) => new Command108("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) => {
8468
+ import { Command as Command109 } from "commander";
8469
+ var growCommand3 = (spec) => new Command109("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) => {
8408
8470
  const storageGib = parseStorage(size, "size");
8409
8471
  const client = await managedClient(cmd);
8410
8472
  try {
@@ -8417,8 +8479,8 @@ var growCommand3 = (spec) => new Command108("grow").description("give a database
8417
8479
  });
8418
8480
 
8419
8481
  // src/commands/managed/info.ts
8420
- import { Command as Command109 } from "commander";
8421
- var infoCommand3 = (spec) => new Command109("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) => {
8482
+ import { Command as Command110 } from "commander";
8483
+ var infoCommand3 = (spec) => new Command110("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) => {
8422
8484
  const client = await managedClient(cmd);
8423
8485
  try {
8424
8486
  const m = await client.getManaged(spec.kind, name);
@@ -8430,8 +8492,8 @@ var infoCommand3 = (spec) => new Command109("info").alias("get").description("sh
8430
8492
  });
8431
8493
 
8432
8494
  // src/commands/managed/link.ts
8433
- import { Command as Command110 } from "commander";
8434
- var linkCommand2 = (spec) => new Command110("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, box2, opts, cmd) => {
8495
+ import { Command as Command111 } from "commander";
8496
+ var linkCommand2 = (spec) => new Command111("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, box2, opts, cmd) => {
8435
8497
  const client = await managedClient(cmd);
8436
8498
  try {
8437
8499
  const m = await spin(`linking ${box2} to ${name}\u2026`, client.linkManaged(spec.kind, name, box2));
@@ -8447,7 +8509,7 @@ var linkCommand2 = (spec) => new Command110("link").description("let a box reach
8447
8509
  });
8448
8510
 
8449
8511
  // src/commands/managed/ls.ts
8450
- import { Command as Command111 } from "commander";
8512
+ import { Command as Command112 } from "commander";
8451
8513
  function listRows(items, user, kindColumn) {
8452
8514
  return items.map((m) => ({
8453
8515
  owner: m.owner === user ? "private" : m.owner,
@@ -8461,7 +8523,7 @@ function listRows(items, user, kindColumn) {
8461
8523
  created: age(m.createdAt)
8462
8524
  }));
8463
8525
  }
8464
- var lsCommand17 = (spec) => new Command111("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) => {
8526
+ var lsCommand17 = (spec) => new Command112("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) => {
8465
8527
  const client = await managedClient(cmd);
8466
8528
  try {
8467
8529
  const items = await client.listManaged(spec?.kind, { all: opts.all });
@@ -8481,8 +8543,8 @@ var lsCommand17 = (spec) => new Command111("ls").alias("list").description(spec
8481
8543
  });
8482
8544
 
8483
8545
  // src/commands/managed/password.ts
8484
- import { Command as Command112 } from "commander";
8485
- var passwordCommand = (spec) => new Command112("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) => {
8546
+ import { Command as Command113 } from "commander";
8547
+ var passwordCommand = (spec) => new Command113("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) => {
8486
8548
  const client = await managedClient(cmd);
8487
8549
  try {
8488
8550
  const secret = opts.reset ? await spin(`setting a new password on ${name}\u2026`, client.resetManagedPassword(spec.kind, name)) : await client.managedPassword(spec.kind, name);
@@ -8498,8 +8560,8 @@ var passwordCommand = (spec) => new Command112("password").description("show a d
8498
8560
  });
8499
8561
 
8500
8562
  // src/commands/managed/public.ts
8501
- import { Command as Command113 } from "commander";
8502
- var publicCommand = (spec) => new Command113("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) => {
8563
+ import { Command as Command114 } from "commander";
8564
+ var publicCommand = (spec) => new Command114("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) => {
8503
8565
  if (state !== "on" && state !== "off") throw new KvboxError(`write on or off: kvbox ${spec.command} public ${name} on`);
8504
8566
  const client = await managedClient(cmd);
8505
8567
  try {
@@ -8520,8 +8582,8 @@ var publicCommand = (spec) => new Command113("public").description("open a datab
8520
8582
  });
8521
8583
 
8522
8584
  // src/commands/managed/rm.ts
8523
- import { Command as Command114 } from "commander";
8524
- var rmCommand17 = (spec) => new Command114("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) => {
8585
+ import { Command as Command115 } from "commander";
8586
+ var rmCommand17 = (spec) => new Command115("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) => {
8525
8587
  const client = await managedClient(cmd);
8526
8588
  try {
8527
8589
  if (!await confirm(`Delete database ${name} and all its data? There is no backup.`, opts.yes ?? false)) {
@@ -8537,8 +8599,8 @@ var rmCommand17 = (spec) => new Command114("rm").alias("remove").description("de
8537
8599
  });
8538
8600
 
8539
8601
  // src/commands/managed/start.ts
8540
- import { Command as Command115 } from "commander";
8541
- var startCommand2 = (spec) => new Command115("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
8602
+ import { Command as Command116 } from "commander";
8603
+ var startCommand2 = (spec) => new Command116("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
8542
8604
  const client = await managedClient(cmd);
8543
8605
  try {
8544
8606
  const m = await spin(`starting ${name}\u2026`, client.startManaged(spec.kind, name));
@@ -8550,8 +8612,8 @@ var startCommand2 = (spec) => new Command115("start").description("run a stopped
8550
8612
  });
8551
8613
 
8552
8614
  // src/commands/managed/stop.ts
8553
- import { Command as Command116 } from "commander";
8554
- var stopCommand2 = (spec) => new Command116("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) => {
8615
+ import { Command as Command117 } from "commander";
8616
+ var stopCommand2 = (spec) => new Command117("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) => {
8555
8617
  const client = await managedClient(cmd);
8556
8618
  try {
8557
8619
  const m = await spin(`stopping ${name}\u2026`, client.stopManaged(spec.kind, name));
@@ -8563,8 +8625,8 @@ var stopCommand2 = (spec) => new Command116("stop").description("shut a database
8563
8625
  });
8564
8626
 
8565
8627
  // src/commands/managed/unlink.ts
8566
- import { Command as Command117 } from "commander";
8567
- var unlinkCommand2 = (spec) => new Command117("unlink").description("stop a box from reaching a database").argument("<db>", "the database").argument("<box>", "the box that was linked to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
8628
+ import { Command as Command118 } from "commander";
8629
+ var unlinkCommand2 = (spec) => new Command118("unlink").description("stop a box from reaching a database").argument("<db>", "the database").argument("<box>", "the box that was linked to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
8568
8630
  const client = await managedClient(cmd);
8569
8631
  try {
8570
8632
  const m = await spin(`unlinking ${box2} from ${name}\u2026`, client.unlinkManaged(spec.kind, name, box2));
@@ -8577,7 +8639,7 @@ var unlinkCommand2 = (spec) => new Command117("unlink").description("stop a box
8577
8639
 
8578
8640
  // src/commands/managed/kind.ts
8579
8641
  function kindCommand(spec, description) {
8580
- const command = new Command118(spec.command).aliases(spec.aliases).description(description);
8642
+ const command = new Command119(spec.command).aliases(spec.aliases).description(description);
8581
8643
  for (const make of [createCommand11, lsCommand17, infoCommand3, passwordCommand, publicCommand, linkCommand2, unlinkCommand2, growCommand3, stopCommand2, startCommand2, rmCommand17]) {
8582
8644
  command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
8583
8645
  }
@@ -8592,14 +8654,14 @@ var pgCommand = kindCommand(POSTGRES2, "managed PostgreSQL: a database kvbox run
8592
8654
  var redisCommand = kindCommand(REDIS, "managed Redis (Valkey): a Redis kvbox runs for you, private until you link a box or make it public");
8593
8655
 
8594
8656
  // src/commands/managed/index.ts
8595
- import { Command as Command119 } from "commander";
8596
- var managedCommand = new Command119("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand17().option("--org <slug>", "act in this org (- for your personal databases)"));
8657
+ import { Command as Command120 } from "commander";
8658
+ var managedCommand = new Command120("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand17().option("--org <slug>", "act in this org (- for your personal databases)"));
8597
8659
 
8598
8660
  // src/commands/env/index.ts
8599
- import { Command as Command123 } from "commander";
8661
+ import { Command as Command124 } from "commander";
8600
8662
 
8601
8663
  // src/commands/env/ls.ts
8602
- import { Command as Command120 } from "commander";
8664
+ import { Command as Command121 } from "commander";
8603
8665
 
8604
8666
  // src/commands/env/shared.ts
8605
8667
  function requireCloud4(client) {
@@ -8626,7 +8688,7 @@ function firstBootHint(box2, name) {
8626
8688
  }
8627
8689
 
8628
8690
  // src/commands/env/ls.ts
8629
- var lsCommand18 = new Command120("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) => {
8691
+ var lsCommand18 = new Command121("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) => {
8630
8692
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
8631
8693
  try {
8632
8694
  if (opts.box !== void 0) {
@@ -8665,8 +8727,8 @@ var lsCommand18 = new Command120("ls").alias("list").description("list the varia
8665
8727
  });
8666
8728
 
8667
8729
  // src/commands/env/rm.ts
8668
- import { Command as Command121 } from "commander";
8669
- var rmCommand18 = new Command121("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) => {
8730
+ import { Command as Command122 } from "commander";
8731
+ var rmCommand18 = new Command122("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) => {
8670
8732
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
8671
8733
  try {
8672
8734
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
@@ -8703,8 +8765,8 @@ var rmCommand18 = new Command121("rm").alias("remove").description("remove varia
8703
8765
  });
8704
8766
 
8705
8767
  // src/commands/env/set.ts
8706
- import { Command as Command122 } from "commander";
8707
- var setCommand2 = new Command122("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) => {
8768
+ import { Command as Command123 } from "commander";
8769
+ var setCommand2 = new Command123("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) => {
8708
8770
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
8709
8771
  try {
8710
8772
  const owner = opts.box === void 0 ? requireCloud4(client) : void 0;
@@ -8741,14 +8803,14 @@ var setCommand2 = new Command122("set").description("add or change a variable; b
8741
8803
  });
8742
8804
 
8743
8805
  // src/commands/env/index.ts
8744
- var envCommand = new Command123("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand18, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand18);
8806
+ var envCommand = new Command124("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand18, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand18);
8745
8807
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
8746
8808
 
8747
8809
  // src/commands/domain/index.ts
8748
- import { Command as Command127 } from "commander";
8810
+ import { Command as Command128 } from "commander";
8749
8811
 
8750
8812
  // src/commands/domain/add.ts
8751
- import { Command as Command124 } from "commander";
8813
+ import { Command as Command125 } from "commander";
8752
8814
 
8753
8815
  // src/commands/domain/shared.ts
8754
8816
  function requireCloud5(client) {
@@ -8768,7 +8830,7 @@ function hostIn(name, zone) {
8768
8830
  }
8769
8831
 
8770
8832
  // src/commands/domain/add.ts
8771
- var addCommand4 = new Command124("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) => {
8833
+ var addCommand4 = new Command125("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) => {
8772
8834
  const domain = assertDomain(domainArg.trim().toLowerCase());
8773
8835
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
8774
8836
  const client = await clientFor(cmd.optsWithGlobals());
@@ -8804,8 +8866,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
8804
8866
  });
8805
8867
 
8806
8868
  // src/commands/domain/ls.ts
8807
- import { Command as Command125 } from "commander";
8808
- var lsCommand19 = new Command125("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
8869
+ import { Command as Command126 } from "commander";
8870
+ var lsCommand19 = new Command126("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
8809
8871
  const client = await clientFor(cmd.optsWithGlobals());
8810
8872
  try {
8811
8873
  requireCloud5(client);
@@ -8834,8 +8896,8 @@ var lsCommand19 = new Command125("ls").alias("list").description("list your cust
8834
8896
  });
8835
8897
 
8836
8898
  // src/commands/domain/rm.ts
8837
- import { Command as Command126 } from "commander";
8838
- var rmCommand19 = new Command126("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) => {
8899
+ import { Command as Command127 } from "commander";
8900
+ var rmCommand19 = new Command127("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) => {
8839
8901
  const domain = domainArg.trim().toLowerCase();
8840
8902
  const client = await clientFor(cmd.optsWithGlobals());
8841
8903
  try {
@@ -8856,15 +8918,15 @@ var rmCommand19 = new Command126("rm").alias("remove").description("stop serving
8856
8918
  });
8857
8919
 
8858
8920
  // src/commands/domain/index.ts
8859
- var domainCommand = new Command127("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand4).addCommand(lsCommand19).addCommand(rmCommand19);
8921
+ var domainCommand = new Command128("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand4).addCommand(lsCommand19).addCommand(rmCommand19);
8860
8922
  for (const cmd of domainCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
8861
8923
 
8862
8924
  // src/commands/update.ts
8863
- import { spawn as spawn7 } from "child_process";
8925
+ import { spawn as spawn8 } from "child_process";
8864
8926
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
8865
8927
  import { tmpdir } from "os";
8866
8928
  import { join as join9 } from "path";
8867
- import { Command as Command128 } from "commander";
8929
+ import { Command as Command129 } from "commander";
8868
8930
 
8869
8931
  // src/update.ts
8870
8932
  import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
@@ -8978,12 +9040,12 @@ async function download(url) {
8978
9040
  }
8979
9041
  function run2(cmd, args) {
8980
9042
  return new Promise((resolve4, reject) => {
8981
- const child = spawn7(cmd, args, { stdio: "inherit" });
9043
+ const child = spawn8(cmd, args, { stdio: "inherit" });
8982
9044
  child.on("error", (err) => reject(new KvboxError(`could not run ${cmd}: ${err.message}`)));
8983
9045
  child.on("exit", (code, signal) => resolve4(code ?? (signal ? 1 : 0)));
8984
9046
  });
8985
9047
  }
8986
- var selfUpdateCommand = new Command128("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
9048
+ var selfUpdateCommand = new Command129("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
8987
9049
  suppressUpdateNotice();
8988
9050
  const inst = installerFor(process.platform, process.env["KVBOX_INSTALL_URL"] || INSTALL_BASE);
8989
9051
  let code;
@@ -9025,6 +9087,7 @@ var HELP_GROUPS = [
9025
9087
  ["get", "show one box in full"],
9026
9088
  ["connect", "open a shell in a box, or run a command there (short: cn)"],
9027
9089
  ["exec", "run a command in a box and exit with its status"],
9090
+ ["cp", "copy files between this machine and a box"],
9028
9091
  ["claim", "give a box an HTTPS address, https://<name>.kvbox.app"],
9029
9092
  ["deploy", "put the app in this directory on a box with its own HTTPS address"],
9030
9093
  ["rm", "destroy a box and its disk"]
@@ -9110,7 +9173,7 @@ function installRootHelp(program) {
9110
9173
 
9111
9174
  // src/program.ts
9112
9175
  function buildProgram() {
9113
- const program = new Command129("kvbox").description("self-hosted Firecracker microVMs with Docker-like ergonomics").version(VERSION, "-v, --version").option("--local", "use this machine's kvbox-server over its socket, ignoring kvbox login and KVBOX_TOKEN").option("--org <slug>", "the org: where kvbox new creates, and which box a name means when it is not one of yours; before the command here, or after it").showHelpAfterError().enablePositionalOptions();
9176
+ const program = new Command130("kvbox").description("self-hosted Firecracker microVMs with Docker-like ergonomics").version(VERSION, "-v, --version").option("--local", "use this machine's kvbox-server over its socket, ignoring kvbox login and KVBOX_TOKEN").option("--org <slug>", "the org: where kvbox new creates, and which box a name means when it is not one of yours; before the command here, or after it").showHelpAfterError().enablePositionalOptions();
9114
9177
  program.addCommand(vmCommand);
9115
9178
  program.addCommand(snapshotsCommand);
9116
9179
  program.addCommand(volumeCommand);