@kvbox/cli 0.6.19 → 0.6.21

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 Command141 } from "commander";
158
+ import { Command as Command142 } 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.19" : void 0);
173
+ var VERSION = versionOf(import.meta.url, true ? "0.6.21" : void 0);
174
174
 
175
175
  // src/commands/vm/index.ts
176
- import { Command as Command43 } from "commander";
176
+ import { Command as Command44 } from "commander";
177
177
 
178
178
  // src/commands/vm/connect.ts
179
179
  import { spawnSync as spawnSync3 } from "child_process";
@@ -545,6 +545,7 @@ var WakeHookSchema = z2.object({
545
545
  createdAt: z2.string(),
546
546
  lastCalledAt: z2.string().nullable()
547
547
  });
548
+ var WakeHookListSchema = z2.array(WakeHookSchema);
548
549
  var CreatedWakeHookSchema = WakeHookSchema.extend({ secret: z2.string() });
549
550
  var WakeHookCallSchema = z2.object({
550
551
  box: z2.string(),
@@ -753,6 +754,13 @@ var MachineSchema = z2.object({
753
754
  */
754
755
  latestBase: z2.string().optional(),
755
756
  createdAt: z2.string(),
757
+ /**
758
+ * When the guest last got its variables by a fresh start (#155): the host's clock at a cold boot (`new`, `start`
759
+ * and the restarts behind rescale, update, volume attach), or at a warm `new --from`/fork, which hands the copy
760
+ * its variables of that moment. A wake or resume keeps it. A variable changed after it waits for the next start.
761
+ * Absent: a host before it, or a box not booted since.
762
+ */
763
+ bootedAt: z2.string().optional(),
756
764
  source: z2.string(),
757
765
  // "base", "snapshot:<owner/name>", "fork:<owner/name>" (#79) or "backup:<id>" (#141)
758
766
  status: BoxStatusSchema,
@@ -817,7 +825,9 @@ var VolumeSchema = z2.object({
817
825
  /** Whether the owner slug is a user or an org. Only the control plane knows; it fills it in on `GET /volumes`. */
818
826
  ownerKind: z2.enum(["user", "org"]).optional(),
819
827
  /** The name of the host the volume lives on; only the control plane fills it in. It attaches only to a box there. */
820
- host: z2.string().optional()
828
+ host: z2.string().optional(),
829
+ /** The country code of that host (`RO`, `US`), when its admin gave one (#140). Only the control plane fills it in. */
830
+ country: z2.string().optional()
821
831
  });
822
832
  var MAX_VOLUME_GIB = 4096;
823
833
  var VOLUME_NAME_RE = /^[a-z0-9][a-z0-9-]{0,11}$/;
@@ -1089,6 +1099,7 @@ var LatestImagesSchema = z2.object({
1089
1099
  images: ImageIndexSchema.shape.images,
1090
1100
  checkedAt: z2.string().nullable()
1091
1101
  });
1102
+ var LatestServerSchema = z2.object({ version: z2.string().nullable(), checkedAt: z2.string().nullable() });
1092
1103
  var RecoveryReportSchema = z2.object({
1093
1104
  at: z2.string(),
1094
1105
  booted: z2.array(z2.string()),
@@ -1369,6 +1380,18 @@ var BalanceSchema = z2.object({
1369
1380
  balance: z2.number(),
1370
1381
  currency: z2.string(),
1371
1382
  topUps: z2.number(),
1383
+ /**
1384
+ * `topUps` split by where the money came from (#144), so a page can say "you added $X" and an org can
1385
+ * tell a top-up from a transfer: `topUps = added + welcome + transferredIn - transferredOut`. `added` is
1386
+ * card payments and an admin's top-ups (an admin's correction, negative, included); `welcome` the
1387
+ * welcome credit of a first card (`trial` rows); `transferredIn` what an owner moved into this org and
1388
+ * `transferredOut` what this user moved to their orgs, both positive. Promo credit is in none of them
1389
+ * (`promo`). Absent from a control plane older than these fields: 0.
1390
+ */
1391
+ added: z2.number().default(0),
1392
+ welcome: z2.number().default(0),
1393
+ transferredIn: z2.number().default(0),
1394
+ transferredOut: z2.number().default(0),
1372
1395
  spent: z2.number(),
1373
1396
  /** The first moment usage counts from: the slug's first top-up or redeemed code; null when it has none. */
1374
1397
  since: z2.string().nullable(),
@@ -2042,6 +2065,15 @@ var Machines = class {
2042
2065
  stop(name, opts = {}) {
2043
2066
  return this.transport.request("POST", box(name, "/stop"), MachineSchema, { org: opts.org });
2044
2067
  }
2068
+ /**
2069
+ * Stop and boot again in one step (#143); what would refuse the boot (credit, room) refuses before the stop,
2070
+ * and a boot that fails after it leaves the box stopped, with an error that says so. A running or paused
2071
+ * box shuts down cleanly, a hibernated one loses its saved memory (as `stop` does), a stopped one just boots.
2072
+ * Costs and checks what `start` does.
2073
+ */
2074
+ restart(name, opts = {}) {
2075
+ return this.transport.request("POST", box(name, "/restart"), MachineSchema, { body: opts.force ? { force: true } : void 0, org: opts.org });
2076
+ }
2045
2077
  /** Freeze the running box in memory (standby). */
2046
2078
  pause(name, opts = {}) {
2047
2079
  return this.transport.request("POST", box(name, "/pause"), MachineSchema, { org: opts.org });
@@ -2319,6 +2351,18 @@ function errorCode(err) {
2319
2351
  return void 0;
2320
2352
  }
2321
2353
 
2354
+ // ../sdk/src/hooks.ts
2355
+ var Hooks = class {
2356
+ constructor(transport) {
2357
+ this.transport = transport;
2358
+ }
2359
+ transport;
2360
+ /** Every readable slug's hooks (`org`: one org's). */
2361
+ list(opts = {}) {
2362
+ return this.transport.request("GET", "/hooks", WakeHookListSchema, { org: opts.org });
2363
+ }
2364
+ };
2365
+
2322
2366
  // ../sdk/src/integrations.ts
2323
2367
  import { z as z9 } from "zod";
2324
2368
  var Integrations = class {
@@ -2386,6 +2430,7 @@ var Kvbox = class {
2386
2430
  snapshots;
2387
2431
  volumes;
2388
2432
  integrations;
2433
+ hooks;
2389
2434
  transport;
2390
2435
  constructor(opts = {}) {
2391
2436
  this.transport = new Transport({
@@ -2399,6 +2444,7 @@ var Kvbox = class {
2399
2444
  this.snapshots = new Snapshots(this.transport);
2400
2445
  this.volumes = new Volumes(this.transport);
2401
2446
  this.integrations = new Integrations(this.transport);
2447
+ this.hooks = new Hooks(this.transport);
2402
2448
  }
2403
2449
  /** The API this client talks to, without a trailing slash. */
2404
2450
  get baseUrl() {
@@ -3033,6 +3079,10 @@ var ServerClient = class {
3033
3079
  startMachine(name, force = false) {
3034
3080
  return this.call("POST", `/machines/${encodeURIComponent(name)}/start`, MachineSchema, force ? { force } : void 0);
3035
3081
  }
3082
+ /** Stop and boot again in one step (#143): what would refuse the boot refuses before the stop. */
3083
+ restartMachine(name, force = false) {
3084
+ return this.call("POST", `/machines/${encodeURIComponent(name)}/restart`, MachineSchema, force ? { force } : void 0);
3085
+ }
3036
3086
  pauseMachine(name) {
3037
3087
  return this.call("POST", `/machines/${encodeURIComponent(name)}/pause`, MachineSchema);
3038
3088
  }
@@ -4449,6 +4499,7 @@ function getRows(box2, subs, user) {
4449
4499
  const update = box2.latestBase === void 0 ? "" : ` ${color.yellow(`(${box2.latestBase} available: ${box2.status === "hibernated" ? `kvbox wake ${displayName(box2, user)}, then ` : ""}kvbox vm update ${displayName(box2, user)})`)}`;
4450
4500
  rows2.push(["base", `${box2.image === void 0 ? box2.base : `${box2.image} ${box2.base}`}${update}`]);
4451
4501
  rows2.push(["created", `${age(box2.createdAt)} ${color.dim(`(${box2.createdAt})`)}`]);
4502
+ if (box2.bootedAt !== void 0) rows2.push(["booted", `${age(box2.bootedAt)} ${color.dim(`(${box2.bootedAt})`)}`]);
4452
4503
  return rows2;
4453
4504
  }
4454
4505
 
@@ -5347,9 +5398,22 @@ function block3(r) {
5347
5398
  `;
5348
5399
  }
5349
5400
 
5350
- // src/commands/vm/resume.ts
5401
+ // src/commands/vm/restart.ts
5351
5402
  import { Command as Command34 } from "commander";
5352
- var resumeCommand = new Command34("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) => {
5403
+ var restartCommand = new Command34("restart").description("stop a box and boot it again in one step (a hibernated box loses its saved memory)").argument("<name>", "box name").option("--force", "skip the capacity guard").option("--json", "print the box as JSON").action(async (name, opts, cmd) => {
5404
+ const client = await clientFor(cmd.optsWithGlobals());
5405
+ try {
5406
+ const box2 = await spin(`restarting ${name}\u2026`, client.restartMachine(name, opts.force ?? false));
5407
+ if (opts.json) json(box2);
5408
+ else info(`${color.green("\u2713")} ${describe(box2)}`);
5409
+ } finally {
5410
+ await client.close();
5411
+ }
5412
+ });
5413
+
5414
+ // src/commands/vm/resume.ts
5415
+ import { Command as Command35 } from "commander";
5416
+ var resumeCommand = new Command35("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) => {
5353
5417
  const client = await clientFor(cmd.optsWithGlobals());
5354
5418
  try {
5355
5419
  const box2 = await spin(`resuming ${name}\u2026`, client.resumeMachine(name));
@@ -5361,8 +5425,8 @@ var resumeCommand = new Command34("resume").description("continue a box that is
5361
5425
  });
5362
5426
 
5363
5427
  // src/commands/vm/rm.ts
5364
- import { Command as Command35 } from "commander";
5365
- var rmCommand4 = new Command35("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) => {
5428
+ import { Command as Command36 } from "commander";
5429
+ var rmCommand4 = new Command36("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) => {
5366
5430
  const client = await clientFor(cmd.optsWithGlobals());
5367
5431
  try {
5368
5432
  const box2 = pickRef(await boxesFor(client, name), name, me(client));
@@ -5382,7 +5446,7 @@ var rmCommand4 = new Command35("rm").description("destroy a box (its disk is del
5382
5446
  });
5383
5447
 
5384
5448
  // src/commands/vm/set.ts
5385
- import { Command as Command36 } from "commander";
5449
+ import { Command as Command37 } from "commander";
5386
5450
 
5387
5451
  // src/swap.ts
5388
5452
  import { spawn as spawn4 } from "child_process";
@@ -5458,7 +5522,7 @@ function runSwap(ep, mib2) {
5458
5522
  }
5459
5523
 
5460
5524
  // src/commands/vm/set.ts
5461
- var setCommand = new Command36("set").description("change a box's settings, e.g. --auto-hibernate 30m (off: never), --idle-check /home/kvbox/idle.sh, --integration github, --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("--integration <list>", "the integrations turned on for the box, replacing its list, e.g. github,claude (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) => {
5525
+ var setCommand = new Command37("set").description("change a box's settings, e.g. --auto-hibernate 30m (off: never), --idle-check /home/kvbox/idle.sh, --integration github, --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("--integration <list>", "the integrations turned on for the box, replacing its list, e.g. github,claude (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) => {
5462
5526
  if (opts.autoHibernate === void 0 && opts.idleCheck === void 0 && opts.integration === void 0 && opts.swap === void 0) {
5463
5527
  throw new KvboxError("nothing to change: give --auto-hibernate, --idle-check, --integration or --swap");
5464
5528
  }
@@ -5536,8 +5600,8 @@ function parseIdleCheck(text2) {
5536
5600
  }
5537
5601
 
5538
5602
  // src/commands/vm/start.ts
5539
- import { Command as Command37 } from "commander";
5540
- var startCommand = new Command37("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) => {
5603
+ import { Command as Command38 } from "commander";
5604
+ var startCommand = new Command38("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) => {
5541
5605
  const client = await clientFor(cmd.optsWithGlobals());
5542
5606
  try {
5543
5607
  const box2 = await spin(`booting ${name}\u2026`, client.startMachine(name, opts.force ?? false));
@@ -5549,8 +5613,8 @@ var startCommand = new Command37("start").description("boot a stopped box again
5549
5613
  });
5550
5614
 
5551
5615
  // src/commands/vm/stop.ts
5552
- import { Command as Command38 } from "commander";
5553
- var stopCommand = new Command38("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) => {
5616
+ import { Command as Command39 } from "commander";
5617
+ var stopCommand = new Command39("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) => {
5554
5618
  const client = await clientFor(cmd.optsWithGlobals());
5555
5619
  try {
5556
5620
  const box2 = await spin(`shutting ${name} down\u2026`, client.stopMachine(name));
@@ -5562,8 +5626,8 @@ var stopCommand = new Command38("stop").description("shut a box down (its disk i
5562
5626
  });
5563
5627
 
5564
5628
  // src/commands/vm/top.ts
5565
- import { Command as Command39 } from "commander";
5566
- var topCommand = new Command39("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) => {
5629
+ import { Command as Command40 } from "commander";
5630
+ var topCommand = new Command40("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) => {
5567
5631
  const client = await clientFor(cmd.optsWithGlobals());
5568
5632
  try {
5569
5633
  const running = (await client.listMachines({ all: opts.all })).filter((b) => b.status === "running");
@@ -5623,8 +5687,8 @@ function topRows(entries, cloud) {
5623
5687
  }
5624
5688
 
5625
5689
  // src/commands/vm/unlink.ts
5626
- import { Command as Command40 } from "commander";
5627
- var unlinkCommand = new Command40("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) => {
5690
+ import { Command as Command41 } from "commander";
5691
+ var unlinkCommand = new Command41("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) => {
5628
5692
  const port = parseLinkPort(opts.port);
5629
5693
  if (!await confirm(`Cut box ${from} off from box ${name} port ${port}? Its open connections close too.`, opts.yes ?? false)) {
5630
5694
  info("cancelled");
@@ -5645,8 +5709,8 @@ var unlinkCommand = new Command40("unlink").description("take a link away (kvbox
5645
5709
  });
5646
5710
 
5647
5711
  // src/commands/vm/update.ts
5648
- import { Command as Command41 } from "commander";
5649
- var updateCommand = new Command41("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) => {
5712
+ import { Command as Command42 } from "commander";
5713
+ var updateCommand = new Command42("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) => {
5650
5714
  const client = await clientFor(cmd.optsWithGlobals());
5651
5715
  try {
5652
5716
  const before = pickRef(await boxesFor(client, name), name, me(client));
@@ -5668,8 +5732,8 @@ var updateCommand = new Command41("update").description("move a box onto the cur
5668
5732
  });
5669
5733
 
5670
5734
  // src/commands/vm/wake.ts
5671
- import { Command as Command42 } from "commander";
5672
- var wakeCommand = new Command42("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) => {
5735
+ import { Command as Command43 } from "commander";
5736
+ var wakeCommand = new Command43("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) => {
5673
5737
  const client = await clientFor(cmd.optsWithGlobals());
5674
5738
  try {
5675
5739
  const box2 = await spin(`waking ${name} (loading its memory from disk)\u2026`, client.wakeMachine(name, opts.force ?? false));
@@ -5681,7 +5745,7 @@ var wakeCommand = new Command42("wake").description("continue a hibernated box w
5681
5745
  });
5682
5746
 
5683
5747
  // src/commands/vm/index.ts
5684
- var vmCommand = new Command43("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(trafficCommand).addCommand(resourcesCommand).addCommand(topCommand).addCommand(proxyCommand).addCommand(hookCommand).addCommand(backupCommand).addCommand(linkCommand).addCommand(unlinkCommand).addCommand(linksCommand).addCommand(rmCommand4);
5748
+ var vmCommand = new Command44("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(restartCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(hibernateCommand).addCommand(wakeCommand).addCommand(updateCommand).addCommand(rescaleCommand).addCommand(setCommand).addCommand(usageCommand).addCommand(trafficCommand).addCommand(resourcesCommand).addCommand(topCommand).addCommand(proxyCommand).addCommand(hookCommand).addCommand(backupCommand).addCommand(linkCommand).addCommand(unlinkCommand).addCommand(linksCommand).addCommand(rmCommand4);
5685
5749
  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)");
5686
5750
  var vmAliases = [newCommand, lsCommand, getCommand, connectCommand, execCommand, cpCommand, stopCommand, startCommand, pauseCommand, resumeCommand, hibernateCommand, wakeCommand, rmCommand4, claimCommand];
5687
5751
 
@@ -5690,7 +5754,7 @@ import { hostname as osHostname2 } from "os";
5690
5754
  import { createInterface as createInterface2 } from "readline/promises";
5691
5755
  import { setTimeout as sleep4 } from "timers/promises";
5692
5756
  import { Writable } from "stream";
5693
- import { Command as Command44 } from "commander";
5757
+ import { Command as Command45 } from "commander";
5694
5758
 
5695
5759
  // src/browser.ts
5696
5760
  import { spawn as spawn5 } from "child_process";
@@ -5727,7 +5791,7 @@ function openBrowser(url) {
5727
5791
  }
5728
5792
 
5729
5793
  // src/commands/login.ts
5730
- var loginCommand = new Command44("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) => {
5794
+ var loginCommand = new Command45("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) => {
5731
5795
  const url = normalizeUrl(urlArg ?? DEFAULT_CLOUD_URL);
5732
5796
  const byPassword = opts.password === true || opts.passwordStdin === true || opts.email !== void 0;
5733
5797
  const session = byPassword ? await runLogin(url, await readCredentials(opts), paths()) : await runDeviceLogin(url, paths());
@@ -5837,8 +5901,8 @@ async function firstLine(stream) {
5837
5901
  }
5838
5902
 
5839
5903
  // src/commands/logout.ts
5840
- import { Command as Command45 } from "commander";
5841
- var logoutCommand = new Command45("logout").description("log out of the control plane; commands target this machine's kvbox-server again").action(async () => {
5904
+ import { Command as Command46 } from "commander";
5905
+ var logoutCommand = new Command46("logout").description("log out of the control plane; commands target this machine's kvbox-server again").action(async () => {
5842
5906
  const p = paths();
5843
5907
  const session = await readSession(p).catch(() => null);
5844
5908
  switch (await runLogout(p)) {
@@ -5876,8 +5940,8 @@ async function runLogout(p = paths()) {
5876
5940
  }
5877
5941
 
5878
5942
  // src/commands/whoami.ts
5879
- import { Command as Command46 } from "commander";
5880
- var whoamiCommand = new Command46("whoami").description("show which account and control plane commands target (or local mode)").option("--json", "print as JSON").action(async (opts, cmd) => {
5943
+ import { Command as Command47 } from "commander";
5944
+ var whoamiCommand = new Command47("whoami").description("show which account and control plane commands target (or local mode)").option("--json", "print as JSON").action(async (opts, cmd) => {
5881
5945
  if (!cmd.optsWithGlobals().local && envLogin()) {
5882
5946
  const target = await resolveTarget({});
5883
5947
  if (target.kind !== "cloud") return;
@@ -5902,10 +5966,10 @@ function describeSession(session) {
5902
5966
  }
5903
5967
 
5904
5968
  // src/commands/key/index.ts
5905
- import { Command as Command50 } from "commander";
5969
+ import { Command as Command51 } from "commander";
5906
5970
 
5907
5971
  // src/commands/key/create.ts
5908
- import { Command as Command47 } from "commander";
5972
+ import { Command as Command48 } from "commander";
5909
5973
 
5910
5974
  // src/commands/key/shared.ts
5911
5975
  async function keyClient(cmd) {
@@ -5942,7 +6006,7 @@ function expiryText(expiresAt, now = Date.now()) {
5942
6006
  }
5943
6007
 
5944
6008
  // src/commands/key/create.ts
5945
- var createCommand3 = new Command47("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) => {
6009
+ var createCommand3 = new Command48("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) => {
5946
6010
  const expiresAt = opts.expires === void 0 ? void 0 : parseExpires(opts.expires);
5947
6011
  const client = await keyClient(cmd);
5948
6012
  try {
@@ -5960,8 +6024,8 @@ var createCommand3 = new Command47("create").description("make an API key for a
5960
6024
  });
5961
6025
 
5962
6026
  // src/commands/key/ls.ts
5963
- import { Command as Command48 } from "commander";
5964
- var lsCommand5 = new Command48("ls").alias("list").description("list your API keys (never the keys themselves)").option("--json", "print as JSON").action(async (opts, cmd) => {
6027
+ import { Command as Command49 } from "commander";
6028
+ var lsCommand5 = new Command49("ls").alias("list").description("list your API keys (never the keys themselves)").option("--json", "print as JSON").action(async (opts, cmd) => {
5965
6029
  const client = await keyClient(cmd);
5966
6030
  try {
5967
6031
  const keys = await client.listApiKeys();
@@ -5980,8 +6044,8 @@ var lsCommand5 = new Command48("ls").alias("list").description("list your API ke
5980
6044
  });
5981
6045
 
5982
6046
  // src/commands/key/rm.ts
5983
- import { Command as Command49 } from "commander";
5984
- var rmCommand5 = new Command49("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) => {
6047
+ import { Command as Command50 } from "commander";
6048
+ var rmCommand5 = new Command50("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) => {
5985
6049
  const client = await keyClient(cmd);
5986
6050
  try {
5987
6051
  if (!await confirm(`Remove API key ${name}? Whatever uses it stops working.`, opts.yes ?? false)) {
@@ -5997,14 +6061,14 @@ var rmCommand5 = new Command49("rm").alias("remove").description("remove an API
5997
6061
  });
5998
6062
 
5999
6063
  // src/commands/key/index.ts
6000
- var keyCommand = new Command50("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);
6064
+ var keyCommand = new Command51("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);
6001
6065
 
6002
6066
  // src/commands/integration/index.ts
6003
- import { Command as Command52 } from "commander";
6067
+ import { Command as Command53 } from "commander";
6004
6068
 
6005
6069
  // src/commands/integration/ls.ts
6006
- import { Command as Command51 } from "commander";
6007
- var lsCommand6 = new Command51("ls").alias("list").description("list the accounts connected for your boxes (GitHub, Claude Code), per slug; connect one in the web app").option("--json", "print as JSON").action(async (opts, cmd) => {
6070
+ import { Command as Command52 } from "commander";
6071
+ var lsCommand6 = new Command52("ls").alias("list").description("list the accounts connected for your boxes (GitHub, Claude Code), per slug; connect one in the web app").option("--json", "print as JSON").action(async (opts, cmd) => {
6008
6072
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
6009
6073
  try {
6010
6074
  if (client.target.kind !== "cloud") throw new KvboxError("integrations belong to an account on the kvbox cloud: kvbox login first");
@@ -6033,14 +6097,14 @@ var lsCommand6 = new Command51("ls").alias("list").description("list the account
6033
6097
  });
6034
6098
 
6035
6099
  // src/commands/integration/index.ts
6036
- var integrationCommand = new Command52("integration").aliases(["integrations"]).description("integrations: accounts (GitHub, Claude Code) connected once in the web app and turned on per box with --integration").addCommand(lsCommand6);
6100
+ var integrationCommand = new Command53("integration").aliases(["integrations"]).description("integrations: accounts (GitHub, Claude Code) connected once in the web app and turned on per box with --integration").addCommand(lsCommand6);
6037
6101
 
6038
6102
  // src/commands/snapshots/index.ts
6039
- import { Command as Command56 } from "commander";
6103
+ import { Command as Command57 } from "commander";
6040
6104
 
6041
6105
  // src/commands/snapshots/ls.ts
6042
- import { Command as Command53 } from "commander";
6043
- var lsCommand7 = new Command53("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) => {
6106
+ import { Command as Command54 } from "commander";
6107
+ var lsCommand7 = new Command54("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) => {
6044
6108
  const client = await clientFor(cmd.optsWithGlobals());
6045
6109
  try {
6046
6110
  const cloud = client.target.kind === "cloud";
@@ -6071,8 +6135,8 @@ var lsCommand7 = new Command53("ls").description("list snapshots (yours and your
6071
6135
  });
6072
6136
 
6073
6137
  // src/commands/snapshots/new.ts
6074
- import { Command as Command54 } from "commander";
6075
- var newCommand2 = new Command54("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) => {
6138
+ import { Command as Command55 } from "commander";
6139
+ var newCommand2 = new Command55("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) => {
6076
6140
  const client = await clientFor(cmd.optsWithGlobals());
6077
6141
  try {
6078
6142
  const req = { box: box2, name, ...opts.replace ? { replace: true } : {} };
@@ -6085,8 +6149,8 @@ var newCommand2 = new Command54("new").description("freeze a running box (memory
6085
6149
  });
6086
6150
 
6087
6151
  // src/commands/snapshots/rm.ts
6088
- import { Command as Command55 } from "commander";
6089
- var rmCommand6 = new Command55("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) => {
6152
+ import { Command as Command56 } from "commander";
6153
+ var rmCommand6 = new Command56("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) => {
6090
6154
  if (!await confirm(`Delete snapshot ${name}?`, opts.yes ?? false)) {
6091
6155
  info("cancelled");
6092
6156
  process.exitCode = 1;
@@ -6102,14 +6166,14 @@ var rmCommand6 = new Command55("rm").description("delete a snapshot (boxes made
6102
6166
  });
6103
6167
 
6104
6168
  // src/commands/snapshots/index.ts
6105
- var snapshotsCommand = new Command56("snapshots").aliases(["snapshot", "snap"]).description("freeze running boxes into snapshots and manage them").addCommand(newCommand2).addCommand(lsCommand7).addCommand(rmCommand6);
6169
+ var snapshotsCommand = new Command57("snapshots").aliases(["snapshot", "snap"]).description("freeze running boxes into snapshots and manage them").addCommand(newCommand2).addCommand(lsCommand7).addCommand(rmCommand6);
6106
6170
  for (const cmd of snapshotsCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
6107
6171
 
6108
6172
  // src/commands/org/index.ts
6109
- import { Command as Command62 } from "commander";
6173
+ import { Command as Command63 } from "commander";
6110
6174
 
6111
6175
  // src/commands/org/ls.ts
6112
- import { Command as Command57 } from "commander";
6176
+ import { Command as Command58 } from "commander";
6113
6177
 
6114
6178
  // src/commands/org/context.ts
6115
6179
  var NOT_LOGGED_IN2 = "orgs live on the control plane: kvbox login first";
@@ -6129,7 +6193,7 @@ function orgFor(opts, target) {
6129
6193
  }
6130
6194
 
6131
6195
  // src/commands/org/ls.ts
6132
- var lsCommand8 = new Command57("ls").description("list the orgs you belong to and your role in each").option("--json", "print as JSON").action(async (opts, cmd) => {
6196
+ var lsCommand8 = new Command58("ls").description("list the orgs you belong to and your role in each").option("--json", "print as JSON").action(async (opts, cmd) => {
6133
6197
  const client = await cloudClientFor(cmd.optsWithGlobals());
6134
6198
  try {
6135
6199
  const orgs = await client.listOrgs();
@@ -6151,8 +6215,8 @@ function orgRows(orgs) {
6151
6215
  }
6152
6216
 
6153
6217
  // src/commands/org/members.ts
6154
- import { Command as Command58, Option as Option4 } from "commander";
6155
- var lsCommand9 = new Command58("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) => {
6218
+ import { Command as Command59, Option as Option4 } from "commander";
6219
+ var lsCommand9 = new Command59("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) => {
6156
6220
  const client = await cloudClientFor(cmd.optsWithGlobals());
6157
6221
  try {
6158
6222
  const org = await client.getOrg(orgFor(opts, client.target));
@@ -6166,7 +6230,7 @@ var lsCommand9 = new Command58("ls").description("list an org's members and thei
6166
6230
  await client.close();
6167
6231
  }
6168
6232
  });
6169
- var addCommand2 = new Command58("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) => {
6233
+ var addCommand2 = new Command59("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) => {
6170
6234
  const client = await cloudClientFor(cmd.optsWithGlobals());
6171
6235
  try {
6172
6236
  const slug = orgFor(opts, client.target);
@@ -6176,7 +6240,7 @@ var addCommand2 = new Command58("add").description("add a user to an org (admins
6176
6240
  await client.close();
6177
6241
  }
6178
6242
  });
6179
- var rmCommand7 = new Command58("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) => {
6243
+ var rmCommand7 = new Command59("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) => {
6180
6244
  const client = await cloudClientFor(cmd.optsWithGlobals());
6181
6245
  try {
6182
6246
  const slug = orgFor(opts, client.target);
@@ -6192,11 +6256,11 @@ var rmCommand7 = new Command58("rm").description("remove a member (or leave: rem
6192
6256
  await client.close();
6193
6257
  }
6194
6258
  });
6195
- var membersCommand = new Command58("members").description("who is in an org and what they may do").addCommand(lsCommand9).addCommand(addCommand2).addCommand(rmCommand7);
6259
+ var membersCommand = new Command59("members").description("who is in an org and what they may do").addCommand(lsCommand9).addCommand(addCommand2).addCommand(rmCommand7);
6196
6260
 
6197
6261
  // src/commands/org/new.ts
6198
- import { Command as Command59 } from "commander";
6199
- var newCommand3 = new Command59("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) => {
6262
+ import { Command as Command60 } from "commander";
6263
+ var newCommand3 = new Command60("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) => {
6200
6264
  const client = await cloudClientFor(cmd.optsWithGlobals());
6201
6265
  try {
6202
6266
  const org = await client.createOrg({ slug, name: opts.name ?? slug });
@@ -6212,8 +6276,8 @@ var newCommand3 = new Command59("new").description("create an org; you become it
6212
6276
  });
6213
6277
 
6214
6278
  // src/commands/org/rm.ts
6215
- import { Command as Command60 } from "commander";
6216
- var rmCommand8 = new Command60("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) => {
6279
+ import { Command as Command61 } from "commander";
6280
+ var rmCommand8 = new Command61("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) => {
6217
6281
  if (!await confirm(`Delete org ${slug}? Its members lose access; its slug stays taken.`, opts.yes ?? false)) {
6218
6282
  info("cancelled");
6219
6283
  process.exitCode = 1;
@@ -6229,8 +6293,8 @@ var rmCommand8 = new Command60("rm").description("delete an org (owners only; re
6229
6293
  });
6230
6294
 
6231
6295
  // src/commands/org/role.ts
6232
- import { Argument, Command as Command61 } from "commander";
6233
- var roleCommand = new Command61("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) => {
6296
+ import { Argument, Command as Command62 } from "commander";
6297
+ var roleCommand = new Command62("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) => {
6234
6298
  const client = await cloudClientFor(cmd.optsWithGlobals());
6235
6299
  try {
6236
6300
  const slug = orgFor(opts, client.target);
@@ -6242,11 +6306,11 @@ var roleCommand = new Command61("role").description("change a member's role (own
6242
6306
  });
6243
6307
 
6244
6308
  // src/commands/org/index.ts
6245
- var orgCommand = new Command62("org").description("orgs: shared slugs that own boxes, with owners, admins and members").addCommand(lsCommand8).addCommand(newCommand3).addCommand(membersCommand).addCommand(roleCommand).addCommand(rmCommand8);
6309
+ var orgCommand = new Command63("org").description("orgs: shared slugs that own boxes, with owners, admins and members").addCommand(lsCommand8).addCommand(newCommand3).addCommand(membersCommand).addCommand(roleCommand).addCommand(rmCommand8);
6246
6310
 
6247
6311
  // src/commands/usage.ts
6248
- import { Command as Command63 } from "commander";
6249
- var usageCommand2 = new Command63("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) => {
6312
+ import { Command as Command64 } from "commander";
6313
+ var usageCommand2 = new Command64("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) => {
6250
6314
  for (const [name, value] of [
6251
6315
  ["since", opts.since],
6252
6316
  ["until", opts.until]
@@ -6443,8 +6507,8 @@ function userRows(r) {
6443
6507
  }
6444
6508
 
6445
6509
  // src/commands/credit.ts
6446
- import { Command as Command64 } from "commander";
6447
- var creditCommand = new Command64("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) => {
6510
+ import { Command as Command65 } from "commander";
6511
+ var creditCommand = new Command65("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) => {
6448
6512
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
6449
6513
  try {
6450
6514
  if (client.target.kind === "local") throw new KvboxError("credit lives on the control plane: kvbox login first");
@@ -6465,16 +6529,25 @@ function creditRow(b, me2) {
6465
6529
  owner: b.slug === me2 ? "private" : boxName(b.slug),
6466
6530
  credit: b.balance > 0 ? left : color.red(left),
6467
6531
  promo: b.promo > 0 && b.promoExpiresAt ? `${money(b.promo, b.currency)} until ${b.promoExpiresAt.slice(0, 10)}` : "-",
6468
- "topped up": money(b.topUps, b.currency),
6532
+ added: money(addedOf(b), b.currency),
6533
+ transferred: transferredOf(b),
6469
6534
  spent: money(b.spent, b.currency),
6470
6535
  // Suspended (#76): the sweep hibernated the boxes at zero; a top-up brings them back.
6471
6536
  state: b.suspendedAt ? color.red("suspended") : b.since === null ? color.dim("no credit yet") : "ok"
6472
6537
  };
6473
6538
  }
6539
+ function addedOf(b) {
6540
+ const split = b.added + b.welcome + b.transferredIn - b.transferredOut;
6541
+ return split === 0 && b.topUps !== 0 ? b.topUps : b.added + b.welcome;
6542
+ }
6543
+ function transferredOf(b) {
6544
+ const parts = [b.transferredIn > 0 ? `+${money(b.transferredIn, b.currency)}` : "", b.transferredOut > 0 ? `-${money(b.transferredOut, b.currency)}` : ""];
6545
+ return parts.filter(Boolean).join(" ") || "-";
6546
+ }
6474
6547
 
6475
6548
  // src/commands/redeem.ts
6476
- import { Command as Command65 } from "commander";
6477
- var redeemCommand = new Command65("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) => {
6549
+ import { Command as Command66 } from "commander";
6550
+ var redeemCommand = new Command66("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) => {
6478
6551
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
6479
6552
  try {
6480
6553
  if (client.target.kind === "local") throw new KvboxError("codes are redeemed on the control plane: kvbox login first");
@@ -6494,7 +6567,7 @@ var redeemCommand = new Command65("redeem").description("redeem a promo code for
6494
6567
  // src/commands/deploy/index.ts
6495
6568
  import { access as access5, readFile as readFile7 } from "fs/promises";
6496
6569
  import { basename as basename2, resolve as resolve3 } from "path";
6497
- import { Command as Command66, InvalidArgumentError as InvalidArgumentError2, Option as Option5 } from "commander";
6570
+ import { Command as Command67, InvalidArgumentError as InvalidArgumentError2, Option as Option5 } from "commander";
6498
6571
 
6499
6572
  // src/commands/deploy/config.ts
6500
6573
  import { readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
@@ -7759,7 +7832,7 @@ async function readPackageJson(dir) {
7759
7832
  }
7760
7833
 
7761
7834
  // src/commands/deploy/index.ts
7762
- var deployCommand = new Command66("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) => {
7835
+ var deployCommand = new Command67("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) => {
7763
7836
  const dir = resolve3(dirArg ?? ".");
7764
7837
  const pkg = await readPackageJson2(dir);
7765
7838
  const facts = { indexHtml: await exists2(resolve3(dir, "index.html")), dockerfile: await exists2(resolve3(dir, "Dockerfile")) };
@@ -7916,15 +7989,15 @@ async function settle2(dir, pkg, facts, saved, opts, orgFlag, cloud) {
7916
7989
  }
7917
7990
 
7918
7991
  // src/commands/volume/index.ts
7919
- import { Command as Command79 } from "commander";
7992
+ import { Command as Command80 } from "commander";
7920
7993
 
7921
7994
  // src/commands/volume/attach.ts
7922
- import { Command as Command67 } from "commander";
7995
+ import { Command as Command68 } from "commander";
7923
7996
  function describeMount(machine, volume2, box2) {
7924
7997
  const path = machine.volumes?.find((v) => volume2 === v.name || volume2.endsWith(`/${v.name}`))?.mountPath ?? volumeMountPath(volume2.slice(volume2.lastIndexOf("/") + 1));
7925
7998
  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`;
7926
7999
  }
7927
- var attachCommand = new Command67("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) => {
8000
+ var attachCommand = new Command68("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) => {
7928
8001
  if (volumeArg === void 0 || boxArg === void 0) askOrUsage("give the volume and the box: kvbox volume attach <volume> <box>");
7929
8002
  const client = await clientFor(cmd.optsWithGlobals());
7930
8003
  try {
@@ -7943,11 +8016,11 @@ var attachCommand = new Command67("attach").description("attach a volume to a bo
7943
8016
  });
7944
8017
 
7945
8018
  // src/commands/volume/backup/index.ts
7946
- import { Command as Command73 } from "commander";
8019
+ import { Command as Command74 } from "commander";
7947
8020
 
7948
8021
  // src/commands/volume/backup/create.ts
7949
- import { Command as Command68 } from "commander";
7950
- var createCommand4 = new Command68("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) => {
8022
+ import { Command as Command69 } from "commander";
8023
+ var createCommand4 = new Command69("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) => {
7951
8024
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
7952
8025
  try {
7953
8026
  requireCloud3(client);
@@ -7974,8 +8047,8 @@ var createCommand4 = new Command68("create").description("back up a volume's dis
7974
8047
  });
7975
8048
 
7976
8049
  // src/commands/volume/backup/ls.ts
7977
- import { Command as Command69 } from "commander";
7978
- var lsCommand10 = new Command69("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) => {
8050
+ import { Command as Command70 } from "commander";
8051
+ var lsCommand10 = new Command70("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) => {
7979
8052
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
7980
8053
  try {
7981
8054
  requireCloud3(client);
@@ -8008,8 +8081,8 @@ var lsCommand10 = new Command69("ls").alias("list").description("list volume bac
8008
8081
  });
8009
8082
 
8010
8083
  // src/commands/volume/backup/restore.ts
8011
- import { Command as Command70 } from "commander";
8012
- var restoreCommand2 = new Command70("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) => {
8084
+ import { Command as Command71 } from "commander";
8085
+ var restoreCommand2 = new Command71("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) => {
8013
8086
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
8014
8087
  try {
8015
8088
  requireCloud3(client);
@@ -8032,8 +8105,8 @@ var restoreCommand2 = new Command70("restore").description("put a backup back: t
8032
8105
  });
8033
8106
 
8034
8107
  // src/commands/volume/backup/rm.ts
8035
- import { Command as Command71 } from "commander";
8036
- var rmCommand9 = new Command71("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) => {
8108
+ import { Command as Command72 } from "commander";
8109
+ var rmCommand9 = new Command72("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) => {
8037
8110
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
8038
8111
  try {
8039
8112
  requireCloud3(client);
@@ -8044,9 +8117,9 @@ var rmCommand9 = new Command71("rm").alias("remove").description("remove a backu
8044
8117
  });
8045
8118
 
8046
8119
  // src/commands/volume/backup/schedule.ts
8047
- import { Command as Command72 } from "commander";
8120
+ import { Command as Command73 } from "commander";
8048
8121
  var scheduleCommand2 = scheduleFlags(
8049
- new Command72("schedule").description("show or switch a volume's nightly backup (daily, UTC; off until you turn it on)").argument("<volume>", "volume name")
8122
+ new Command73("schedule").description("show or switch a volume's nightly backup (daily, UTC; off until you turn it on)").argument("<volume>", "volume name")
8050
8123
  ).action(async (volume2, flags, cmd) => {
8051
8124
  const change = changeOf(flags);
8052
8125
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
@@ -8062,11 +8135,11 @@ var scheduleCommand2 = scheduleFlags(
8062
8135
  });
8063
8136
 
8064
8137
  // src/commands/volume/backup/index.ts
8065
- var backupCommand2 = new Command73("backup").description("back up a volume's disk to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand4).addCommand(lsCommand10).addCommand(restoreCommand2).addCommand(rmCommand9).addCommand(scheduleCommand2);
8138
+ var backupCommand2 = new Command74("backup").description("back up a volume's disk to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand4).addCommand(lsCommand10).addCommand(restoreCommand2).addCommand(rmCommand9).addCommand(scheduleCommand2);
8066
8139
  for (const cmd of backupCommand2.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
8067
8140
 
8068
8141
  // src/commands/volume/create.ts
8069
- import { Command as Command74 } from "commander";
8142
+ import { Command as Command75 } from "commander";
8070
8143
  function parseGib2(text2, label = "--size") {
8071
8144
  const mib2 = parseMib(text2);
8072
8145
  if (mib2 === void 0 || mib2 % 1024 !== 0) throw new KvboxError(`${label} ${text2}: write whole GB, like 50 or 50GB`);
@@ -8082,7 +8155,7 @@ function sizeProblem(answer) {
8082
8155
  return err instanceof KvboxError ? err.message.replace(/^--size \S+: /, "") : String(err);
8083
8156
  }
8084
8157
  }
8085
- var createCommand5 = new Command74("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) => {
8158
+ var createCommand5 = new Command75("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) => {
8086
8159
  const ask = interactive();
8087
8160
  if (nameArg === void 0 || opts.size === void 0) askOrUsage("give the name and the size: kvbox volume create <name> --size <gb> --box <box>");
8088
8161
  const name = nameArg ?? await text("Volume name", { validate: (a) => VOLUME_NAME_RE.test(a) ? void 0 : VOLUME_NAME_RULE });
@@ -8115,8 +8188,8 @@ var createCommand5 = new Command74("create").alias("new").description("create a
8115
8188
  });
8116
8189
 
8117
8190
  // src/commands/volume/detach.ts
8118
- import { Command as Command75 } from "commander";
8119
- var detachCommand = new Command75("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) => {
8191
+ import { Command as Command76 } from "commander";
8192
+ var detachCommand = new Command76("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) => {
8120
8193
  if (volumeArg === void 0) askOrUsage("give the volume: kvbox volume detach <volume> [box]");
8121
8194
  const client = await clientFor(cmd.optsWithGlobals());
8122
8195
  try {
@@ -8141,8 +8214,8 @@ var detachCommand = new Command75("detach").description("detach a volume from a
8141
8214
  });
8142
8215
 
8143
8216
  // src/commands/volume/grow.ts
8144
- import { Command as Command76 } from "commander";
8145
- var growCommand = new Command76("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) => {
8217
+ import { Command as Command77 } from "commander";
8218
+ var growCommand = new Command77("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) => {
8146
8219
  const sizeGib = parseGib2(size, "size");
8147
8220
  const client = await clientFor(cmd.optsWithGlobals());
8148
8221
  try {
@@ -8155,8 +8228,8 @@ var growCommand = new Command76("grow").alias("resize").description("make a volu
8155
8228
  });
8156
8229
 
8157
8230
  // src/commands/volume/ls.ts
8158
- import { Command as Command77 } from "commander";
8159
- var lsCommand11 = new Command77("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) => {
8231
+ import { Command as Command78 } from "commander";
8232
+ var lsCommand11 = new Command78("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) => {
8160
8233
  const client = await clientFor(cmd.optsWithGlobals());
8161
8234
  try {
8162
8235
  const cloud = client.target.kind === "cloud";
@@ -8187,8 +8260,8 @@ var lsCommand11 = new Command77("ls").alias("list").description("list volumes: s
8187
8260
  });
8188
8261
 
8189
8262
  // src/commands/volume/rm.ts
8190
- import { Command as Command78 } from "commander";
8191
- var rmCommand10 = new Command78("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) => {
8263
+ import { Command as Command79 } from "commander";
8264
+ var rmCommand10 = new Command79("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) => {
8192
8265
  if (!await confirm(`Delete volume ${name} and everything on it?`, opts.yes ?? false)) {
8193
8266
  info("cancelled");
8194
8267
  process.exitCode = 1;
@@ -8204,18 +8277,18 @@ var rmCommand10 = new Command78("rm").alias("remove").description("delete a volu
8204
8277
  });
8205
8278
 
8206
8279
  // src/commands/volume/index.ts
8207
- var volumeCommand = new Command79("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(lsCommand11).addCommand(attachCommand).addCommand(detachCommand).addCommand(growCommand).addCommand(rmCommand10);
8280
+ var volumeCommand = new Command80("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(lsCommand11).addCommand(attachCommand).addCommand(detachCommand).addCommand(growCommand).addCommand(rmCommand10);
8208
8281
  for (const cmd of volumeCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal volumes)");
8209
8282
  volumeCommand.addCommand(backupCommand2);
8210
8283
 
8211
8284
  // src/commands/bucket/index.ts
8212
- import { Command as Command96 } from "commander";
8285
+ import { Command as Command97 } from "commander";
8213
8286
 
8214
8287
  // src/commands/bucket/backup/index.ts
8215
- import { Command as Command85 } from "commander";
8288
+ import { Command as Command86 } from "commander";
8216
8289
 
8217
8290
  // src/commands/bucket/backup/create.ts
8218
- import { Command as Command80 } from "commander";
8291
+ import { Command as Command81 } from "commander";
8219
8292
 
8220
8293
  // src/commands/bucket/shared.ts
8221
8294
  async function bucketClient(cmd) {
@@ -8241,7 +8314,7 @@ function printRows(rows2) {
8241
8314
  }
8242
8315
 
8243
8316
  // src/commands/bucket/backup/create.ts
8244
- var createCommand6 = new Command80("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) => {
8317
+ var createCommand6 = new Command81("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) => {
8245
8318
  const client = await bucketClient(cmd);
8246
8319
  const ls = "kvbox bucket backup ls";
8247
8320
  try {
@@ -8269,8 +8342,8 @@ var createCommand6 = new Command80("create").description("back up your object st
8269
8342
  });
8270
8343
 
8271
8344
  // src/commands/bucket/backup/ls.ts
8272
- import { Command as Command81 } from "commander";
8273
- var lsCommand12 = new Command81("ls").alias("list").description("list the backups of your object storage").option("--json", "print as JSON").action(async (opts, cmd) => {
8345
+ import { Command as Command82 } from "commander";
8346
+ var lsCommand12 = new Command82("ls").alias("list").description("list the backups of your object storage").option("--json", "print as JSON").action(async (opts, cmd) => {
8274
8347
  const client = await bucketClient(cmd);
8275
8348
  try {
8276
8349
  const list = await client.storageBackups();
@@ -8302,8 +8375,8 @@ var lsCommand12 = new Command81("ls").alias("list").description("list the backup
8302
8375
  });
8303
8376
 
8304
8377
  // src/commands/bucket/backup/restore.ts
8305
- import { Command as Command82 } from "commander";
8306
- var restoreCommand3 = new Command82("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) => {
8378
+ import { Command as Command83 } from "commander";
8379
+ var restoreCommand3 = new Command83("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) => {
8307
8380
  const client = await bucketClient(cmd);
8308
8381
  try {
8309
8382
  const backup = await client.storageBackup(id);
@@ -8333,8 +8406,8 @@ var restoreCommand3 = new Command82("restore").description("put a backup back: e
8333
8406
  });
8334
8407
 
8335
8408
  // src/commands/bucket/backup/rm.ts
8336
- import { Command as Command83 } from "commander";
8337
- var rmCommand11 = new Command83("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) => {
8409
+ import { Command as Command84 } from "commander";
8410
+ var rmCommand11 = new Command84("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) => {
8338
8411
  const client = await bucketClient(cmd);
8339
8412
  try {
8340
8413
  const backup = (await client.storageBackups()).find((b) => b.id === id);
@@ -8353,8 +8426,8 @@ var rmCommand11 = new Command83("rm").alias("remove").description("remove a back
8353
8426
  });
8354
8427
 
8355
8428
  // src/commands/bucket/backup/schedule.ts
8356
- import { Command as Command84 } from "commander";
8357
- var scheduleCommand3 = scheduleFlags(new Command84("schedule").description("show or switch the nightly backup of your object storage (daily, UTC; off until you turn it on)")).action(
8429
+ import { Command as Command85 } from "commander";
8430
+ var scheduleCommand3 = scheduleFlags(new Command85("schedule").description("show or switch the nightly backup of your object storage (daily, UTC; off until you turn it on)")).action(
8358
8431
  async (flags, cmd) => {
8359
8432
  const change = changeOf(flags);
8360
8433
  const client = await bucketClient(cmd);
@@ -8370,11 +8443,11 @@ var scheduleCommand3 = scheduleFlags(new Command84("schedule").description("show
8370
8443
  );
8371
8444
 
8372
8445
  // src/commands/bucket/backup/index.ts
8373
- var backupCommand3 = new Command85("backup").aliases(["backups"]).description("back up your object storage to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand6).addCommand(lsCommand12).addCommand(restoreCommand3).addCommand(rmCommand11).addCommand(scheduleCommand3);
8446
+ var backupCommand3 = new Command86("backup").aliases(["backups"]).description("back up your object storage to the kvbox cloud, list backups, restore or remove one").addCommand(createCommand6).addCommand(lsCommand12).addCommand(restoreCommand3).addCommand(rmCommand11).addCommand(scheduleCommand3);
8374
8447
 
8375
8448
  // src/commands/bucket/create.ts
8376
- import { Command as Command86 } from "commander";
8377
- var createCommand7 = new Command86("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) => {
8449
+ import { Command as Command87 } from "commander";
8450
+ var createCommand7 = new Command87("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) => {
8378
8451
  const sizeGib = opts.size === void 0 ? void 0 : parseGib2(opts.size);
8379
8452
  const client = await bucketClient(cmd);
8380
8453
  try {
@@ -8394,8 +8467,8 @@ var createCommand7 = new Command86("create").description("make a bucket (the fir
8394
8467
  });
8395
8468
 
8396
8469
  // src/commands/bucket/grow.ts
8397
- import { Command as Command87 } from "commander";
8398
- var growCommand2 = new Command87("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) => {
8470
+ import { Command as Command88 } from "commander";
8471
+ var growCommand2 = new Command88("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) => {
8399
8472
  const sizeGib = parseGib2(size, "size");
8400
8473
  const client = await bucketClient(cmd);
8401
8474
  try {
@@ -8408,8 +8481,8 @@ var growCommand2 = new Command87("grow").description("make your object storage l
8408
8481
  });
8409
8482
 
8410
8483
  // src/commands/bucket/info.ts
8411
- import { Command as Command88 } from "commander";
8412
- var infoCommand = new Command88("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) => {
8484
+ import { Command as Command89 } from "commander";
8485
+ var infoCommand = new Command89("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) => {
8413
8486
  const client = await bucketClient(cmd);
8414
8487
  try {
8415
8488
  const b = await client.getBucket(name);
@@ -8439,11 +8512,11 @@ with the AWS CLI: aws s3 ls s3://${b.name} --endpoint-url ${b.endpoint}`));
8439
8512
  });
8440
8513
 
8441
8514
  // src/commands/bucket/key/index.ts
8442
- import { Command as Command92 } from "commander";
8515
+ import { Command as Command93 } from "commander";
8443
8516
 
8444
8517
  // src/commands/bucket/key/create.ts
8445
- import { Command as Command89 } from "commander";
8446
- var createCommand8 = new Command89("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) => {
8518
+ import { Command as Command90 } from "commander";
8519
+ var createCommand8 = new Command90("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) => {
8447
8520
  const client = await bucketClient(cmd);
8448
8521
  try {
8449
8522
  const key = await client.createBucketKey(bucket, { ...opts.name !== void 0 ? { name: opts.name } : {}, ...opts.readOnly ? { readOnly: true } : {} });
@@ -8466,8 +8539,8 @@ var createCommand8 = new Command89("create").description("make an access key for
8466
8539
  });
8467
8540
 
8468
8541
  // src/commands/bucket/key/ls.ts
8469
- import { Command as Command90 } from "commander";
8470
- var lsCommand13 = new Command90("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) => {
8542
+ import { Command as Command91 } from "commander";
8543
+ var lsCommand13 = new Command91("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) => {
8471
8544
  const client = await bucketClient(cmd);
8472
8545
  try {
8473
8546
  const keys = await client.listBucketKeys(bucket);
@@ -8486,8 +8559,8 @@ var lsCommand13 = new Command90("ls").alias("list").description("list a bucket's
8486
8559
  });
8487
8560
 
8488
8561
  // src/commands/bucket/key/rm.ts
8489
- import { Command as Command91 } from "commander";
8490
- var rmCommand12 = new Command91("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) => {
8562
+ import { Command as Command92 } from "commander";
8563
+ var rmCommand12 = new Command92("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) => {
8491
8564
  const client = await bucketClient(cmd);
8492
8565
  try {
8493
8566
  if (!await confirm(`Delete key ${id} of bucket ${bucket}? Whatever uses it stops working.`, opts.yes ?? false)) {
@@ -8503,11 +8576,11 @@ var rmCommand12 = new Command91("rm").alias("remove").description("delete an acc
8503
8576
  });
8504
8577
 
8505
8578
  // src/commands/bucket/key/index.ts
8506
- var keyCommand2 = new Command92("key").aliases(["keys"]).description("access keys of a bucket: what your app signs in with").addCommand(createCommand8).addCommand(lsCommand13).addCommand(rmCommand12);
8579
+ var keyCommand2 = new Command93("key").aliases(["keys"]).description("access keys of a bucket: what your app signs in with").addCommand(createCommand8).addCommand(lsCommand13).addCommand(rmCommand12);
8507
8580
 
8508
8581
  // src/commands/bucket/ls.ts
8509
- import { Command as Command93 } from "commander";
8510
- var lsCommand14 = new Command93("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) => {
8582
+ import { Command as Command94 } from "commander";
8583
+ var lsCommand14 = new Command94("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) => {
8511
8584
  const client = await bucketClient(cmd);
8512
8585
  try {
8513
8586
  const buckets = await client.listBuckets({ all: opts.all });
@@ -8538,8 +8611,8 @@ var lsCommand14 = new Command93("ls").alias("list").description("list buckets, a
8538
8611
  });
8539
8612
 
8540
8613
  // src/commands/bucket/public.ts
8541
- import { Command as Command94 } from "commander";
8542
- var publicCommand = new Command94("public").description("let anyone read a bucket's files at its own HTTPS address (on), or make it private again (off)").argument("<name>", "bucket name").argument("<state>", "on (public) or off (private)").option("--sub <name>", "the address to use, <name>.kvbox.app (default: <bucket>-<account>)").option("--json", "print the bucket as JSON").action(async (name, state, opts, cmd) => {
8614
+ import { Command as Command95 } from "commander";
8615
+ var publicCommand = new Command95("public").description("let anyone read a bucket's files at its own HTTPS address (on), or make it private again (off)").argument("<name>", "bucket name").argument("<state>", "on (public) or off (private)").option("--sub <name>", "the address to use, <name>.kvbox.app (default: <bucket>-<account>)").option("--json", "print the bucket as JSON").action(async (name, state, opts, cmd) => {
8543
8616
  if (state !== "on" && state !== "off") throw new KvboxError(`"${state}": say on or off`);
8544
8617
  const on = state === "on";
8545
8618
  if (!on && opts.sub !== void 0) throw new KvboxError("--sub goes with on");
@@ -8567,8 +8640,8 @@ var publicCommand = new Command94("public").description("let anyone read a bucke
8567
8640
  });
8568
8641
 
8569
8642
  // src/commands/bucket/rm.ts
8570
- import { Command as Command95 } from "commander";
8571
- var rmCommand13 = new Command95("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) => {
8643
+ import { Command as Command96 } from "commander";
8644
+ var rmCommand13 = new Command96("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) => {
8572
8645
  const client = await bucketClient(cmd);
8573
8646
  try {
8574
8647
  const question = opts.force ? `Delete bucket ${name} with everything in it, and the object storage it is in?` : `Delete bucket ${name} and its keys?`;
@@ -8587,7 +8660,7 @@ var rmCommand13 = new Command95("rm").alias("remove").description("delete an emp
8587
8660
  });
8588
8661
 
8589
8662
  // src/commands/bucket/index.ts
8590
- var bucketCommand = new Command96("bucket").aliases(["buckets"]).description("object storage: S3 buckets for your files, and the access keys your apps use").addCommand(createCommand7).addCommand(lsCommand14).addCommand(infoCommand).addCommand(growCommand2).addCommand(publicCommand).addCommand(rmCommand13).addCommand(keyCommand2).addCommand(backupCommand3);
8663
+ var bucketCommand = new Command97("bucket").aliases(["buckets"]).description("object storage: S3 buckets for your files, and the access keys your apps use").addCommand(createCommand7).addCommand(lsCommand14).addCommand(infoCommand).addCommand(growCommand2).addCommand(publicCommand).addCommand(rmCommand13).addCommand(keyCommand2).addCommand(backupCommand3);
8591
8664
  var withOrg2 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal buckets)");
8592
8665
  for (const cmd of bucketCommand.commands) {
8593
8666
  if (cmd === keyCommand2 || cmd === backupCommand3) cmd.commands.forEach(withOrg2);
@@ -8595,10 +8668,10 @@ for (const cmd of bucketCommand.commands) {
8595
8668
  }
8596
8669
 
8597
8670
  // src/commands/cron/index.ts
8598
- import { Command as Command109 } from "commander";
8671
+ import { Command as Command110 } from "commander";
8599
8672
 
8600
8673
  // src/commands/cron/create.ts
8601
- import { Command as Command97 } from "commander";
8674
+ import { Command as Command98 } from "commander";
8602
8675
 
8603
8676
  // src/commands/cron/shared.ts
8604
8677
  async function cronClient(cmd) {
@@ -8659,7 +8732,7 @@ function printRows2(rows2) {
8659
8732
  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>")`);
8660
8733
 
8661
8734
  // src/commands/cron/create.ts
8662
- var createCommand9 = new Command97("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) => {
8735
+ var createCommand9 = new Command98("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) => {
8663
8736
  const client = await cronClient(cmd);
8664
8737
  try {
8665
8738
  const service = await client.createCronService(name);
@@ -8676,8 +8749,8 @@ var createCommand9 = new Command97("create").description("make a cron service: a
8676
8749
  });
8677
8750
 
8678
8751
  // src/commands/cron/info.ts
8679
- import { Command as Command98 } from "commander";
8680
- var infoCommand2 = new Command98("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) => {
8752
+ import { Command as Command99 } from "commander";
8753
+ var infoCommand2 = new Command99("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) => {
8681
8754
  const client = await cronClient(cmd);
8682
8755
  try {
8683
8756
  const service = await client.getCronService(name);
@@ -8701,8 +8774,8 @@ var infoCommand2 = new Command98("info").alias("get").description("show a cron s
8701
8774
  });
8702
8775
 
8703
8776
  // src/commands/cron/ls.ts
8704
- import { Command as Command99 } from "commander";
8705
- var lsCommand15 = new Command99("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) => {
8777
+ import { Command as Command100 } from "commander";
8778
+ var lsCommand15 = new Command100("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) => {
8706
8779
  const client = await cronClient(cmd);
8707
8780
  try {
8708
8781
  const services = await client.listCronServices({ all: opts.all });
@@ -8722,8 +8795,8 @@ var lsCommand15 = new Command99("ls").alias("list").description("list cron servi
8722
8795
  });
8723
8796
 
8724
8797
  // src/commands/cron/rm.ts
8725
- import { Command as Command100 } from "commander";
8726
- var rmCommand14 = new Command100("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) => {
8798
+ import { Command as Command101 } from "commander";
8799
+ var rmCommand14 = new Command101("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) => {
8727
8800
  const client = await cronClient(cmd);
8728
8801
  try {
8729
8802
  if (!await confirm(`Delete cron service ${name}? Its triggers stop firing and their run history is deleted.`, opts.yes ?? false)) {
@@ -8739,10 +8812,10 @@ var rmCommand14 = new Command100("rm").alias("remove").description("delete a cro
8739
8812
  });
8740
8813
 
8741
8814
  // src/commands/cron/trigger/index.ts
8742
- import { Command as Command108 } from "commander";
8815
+ import { Command as Command109 } from "commander";
8743
8816
 
8744
8817
  // src/commands/cron/trigger/add.ts
8745
- import { Command as Command101 } from "commander";
8818
+ import { Command as Command102 } from "commander";
8746
8819
  function portOf(value) {
8747
8820
  const n2 = Number(value);
8748
8821
  if (!Number.isInteger(n2) || n2 < 1 || n2 > 65535) throw new KvboxError(`--port ${value}: a port is a number from 1 to 65535`);
@@ -8762,7 +8835,7 @@ function timeoutOf(value) {
8762
8835
  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`);
8763
8836
  return sec;
8764
8837
  }
8765
- var addCommand3 = new Command101("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) => {
8838
+ var addCommand3 = new Command102("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) => {
8766
8839
  let action;
8767
8840
  if (opts.run !== void 0) {
8768
8841
  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");
@@ -8789,8 +8862,8 @@ var addCommand3 = new Command101("add").description("add a trigger: on a schedul
8789
8862
  });
8790
8863
 
8791
8864
  // src/commands/cron/trigger/ls.ts
8792
- import { Command as Command102 } from "commander";
8793
- var lsCommand16 = new Command102("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) => {
8865
+ import { Command as Command103 } from "commander";
8866
+ var lsCommand16 = new Command103("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) => {
8794
8867
  const client = await cronClient(cmd);
8795
8868
  try {
8796
8869
  const triggers = await client.listCronTriggers(service);
@@ -8806,8 +8879,8 @@ var lsCommand16 = new Command102("ls").alias("list").description("list a cron se
8806
8879
  });
8807
8880
 
8808
8881
  // src/commands/cron/trigger/pause.ts
8809
- import { Command as Command103 } from "commander";
8810
- var pauseCommand2 = new Command103("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) => {
8882
+ import { Command as Command104 } from "commander";
8883
+ var pauseCommand2 = new Command104("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) => {
8811
8884
  const client = await cronClient(cmd);
8812
8885
  try {
8813
8886
  const trigger = await client.setCronTriggerEnabled(service, id, false);
@@ -8822,8 +8895,8 @@ var pauseCommand2 = new Command103("pause").description("stop a trigger from fir
8822
8895
  });
8823
8896
 
8824
8897
  // src/commands/cron/trigger/resume.ts
8825
- import { Command as Command104 } from "commander";
8826
- var resumeCommand2 = new Command104("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) => {
8898
+ import { Command as Command105 } from "commander";
8899
+ var resumeCommand2 = new Command105("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) => {
8827
8900
  const client = await cronClient(cmd);
8828
8901
  try {
8829
8902
  const trigger = await client.setCronTriggerEnabled(service, id, true);
@@ -8838,8 +8911,8 @@ var resumeCommand2 = new Command104("resume").description("let a paused trigger
8838
8911
  });
8839
8912
 
8840
8913
  // src/commands/cron/trigger/rm.ts
8841
- import { Command as Command105 } from "commander";
8842
- var rmCommand15 = new Command105("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) => {
8914
+ import { Command as Command106 } from "commander";
8915
+ var rmCommand15 = new Command106("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) => {
8843
8916
  const client = await cronClient(cmd);
8844
8917
  try {
8845
8918
  if (!await confirm(`Delete trigger ${id} of cron service ${service}? Its run history is deleted too.`, opts.yes ?? false)) {
@@ -8855,8 +8928,8 @@ var rmCommand15 = new Command105("rm").alias("remove").description("delete a tri
8855
8928
  });
8856
8929
 
8857
8930
  // src/commands/cron/trigger/run.ts
8858
- import { Command as Command106 } from "commander";
8859
- var runCommand = new Command106("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) => {
8931
+ import { Command as Command107 } from "commander";
8932
+ var runCommand = new Command107("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) => {
8860
8933
  const client = await cronClient(cmd);
8861
8934
  try {
8862
8935
  const trigger = await client.runCronTrigger(service, id);
@@ -8872,13 +8945,13 @@ var runCommand = new Command106("run").description("fire a trigger now, once, be
8872
8945
  });
8873
8946
 
8874
8947
  // src/commands/cron/trigger/runs.ts
8875
- import { Command as Command107 } from "commander";
8948
+ import { Command as Command108 } from "commander";
8876
8949
  function limitOf(value) {
8877
8950
  const n2 = Number(value);
8878
8951
  if (!Number.isInteger(n2) || n2 < 1) throw new KvboxError(`-n ${value}: a number of runs, 1 or more`);
8879
8952
  return n2;
8880
8953
  }
8881
- var runsCommand = new Command107("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) => {
8954
+ var runsCommand = new Command108("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) => {
8882
8955
  const limit = limitOf(opts.limit);
8883
8956
  const client = await cronClient(cmd);
8884
8957
  try {
@@ -8908,10 +8981,10 @@ var runsCommand = new Command107("runs").aliases(["logs"]).description("show how
8908
8981
  });
8909
8982
 
8910
8983
  // src/commands/cron/trigger/index.ts
8911
- var triggerCommand = new Command108("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand3).addCommand(lsCommand16).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand15);
8984
+ var triggerCommand = new Command109("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand3).addCommand(lsCommand16).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand15);
8912
8985
 
8913
8986
  // src/commands/cron/index.ts
8914
- var cronCommand = new Command109("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand9).addCommand(lsCommand15).addCommand(infoCommand2).addCommand(rmCommand14).addCommand(triggerCommand);
8987
+ var cronCommand = new Command110("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand9).addCommand(lsCommand15).addCommand(infoCommand2).addCommand(rmCommand14).addCommand(triggerCommand);
8915
8988
  var withOrg3 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal cron services)");
8916
8989
  for (const cmd of cronCommand.commands) {
8917
8990
  if (cmd === triggerCommand) cmd.commands.forEach(withOrg3);
@@ -8919,13 +8992,13 @@ for (const cmd of cronCommand.commands) {
8919
8992
  }
8920
8993
 
8921
8994
  // src/commands/managed/kind.ts
8922
- import { Command as Command128 } from "commander";
8995
+ import { Command as Command129 } from "commander";
8923
8996
 
8924
8997
  // src/commands/managed/backup/index.ts
8925
- import { Command as Command116 } from "commander";
8998
+ import { Command as Command117 } from "commander";
8926
8999
 
8927
9000
  // src/commands/managed/backup/create.ts
8928
- import { Command as Command111 } from "commander";
9001
+ import { Command as Command112 } from "commander";
8929
9002
 
8930
9003
  // src/commands/managed/shared.ts
8931
9004
  import "commander";
@@ -9012,7 +9085,7 @@ function parseStorage(text2, flag) {
9012
9085
  }
9013
9086
 
9014
9087
  // src/commands/managed/backup/create.ts
9015
- var createCommand10 = (spec) => new Command111("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) => {
9088
+ var createCommand10 = (spec) => new Command112("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) => {
9016
9089
  const client = await managedClient(cmd);
9017
9090
  const ls = `kvbox ${spec.command} backup ls ${name}`;
9018
9091
  try {
@@ -9039,7 +9112,7 @@ var createCommand10 = (spec) => new Command111("create").description("back up a
9039
9112
  });
9040
9113
 
9041
9114
  // src/commands/managed/backup/ls.ts
9042
- import { Command as Command112 } from "commander";
9115
+ import { Command as Command113 } from "commander";
9043
9116
  var lsCommand17 = (spec) => {
9044
9117
  const removedOnes = async (err, name, client) => {
9045
9118
  if (!(err instanceof CallError && err.status === 404)) throw err;
@@ -9048,7 +9121,7 @@ var lsCommand17 = (spec) => {
9048
9121
  const own = name.includes("/") ? [] : gone.filter((b) => b.owner === me(client));
9049
9122
  return own.length > 0 ? own : gone;
9050
9123
  };
9051
- return new Command112("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) => {
9124
+ return new Command113("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) => {
9052
9125
  const client = await managedClient(cmd);
9053
9126
  try {
9054
9127
  const list = name === void 0 ? await client.listManagedBackups(spec.kind) : await client.managedBackups(spec.kind, name).catch((err) => removedOnes(err, name, client));
@@ -9091,8 +9164,8 @@ var lsCommand17 = (spec) => {
9091
9164
  };
9092
9165
 
9093
9166
  // src/commands/managed/backup/restore.ts
9094
- import { Command as Command113 } from "commander";
9095
- var restoreCommand4 = (spec) => new Command113("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) => {
9167
+ import { Command as Command114 } from "commander";
9168
+ var restoreCommand4 = (spec) => new Command114("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) => {
9096
9169
  const client = await managedClient(cmd);
9097
9170
  try {
9098
9171
  const backup = await client.managedBackup(spec.kind, name, id);
@@ -9114,8 +9187,8 @@ var restoreCommand4 = (spec) => new Command113("restore").description("put a bac
9114
9187
  });
9115
9188
 
9116
9189
  // src/commands/managed/backup/rm.ts
9117
- import { Command as Command114 } from "commander";
9118
- var rmCommand16 = (spec) => new Command114("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) => {
9190
+ import { Command as Command115 } from "commander";
9191
+ var rmCommand16 = (spec) => new Command115("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) => {
9119
9192
  const client = await managedClient(cmd);
9120
9193
  try {
9121
9194
  await removeListed(client, await client.listManagedBackups(spec.kind), (b) => b.name, name, id, `database ${name}`, opts.yes ?? false);
@@ -9125,8 +9198,8 @@ var rmCommand16 = (spec) => new Command114("rm").alias("remove").description("re
9125
9198
  });
9126
9199
 
9127
9200
  // src/commands/managed/backup/schedule.ts
9128
- import { Command as Command115 } from "commander";
9129
- var scheduleCommand4 = (spec) => scheduleFlags(new Command115("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
9201
+ import { Command as Command116 } from "commander";
9202
+ var scheduleCommand4 = (spec) => scheduleFlags(new Command116("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
9130
9203
  async (name, flags, cmd) => {
9131
9204
  const change = changeOf(flags);
9132
9205
  const client = await managedClient(cmd);
@@ -9142,18 +9215,18 @@ var scheduleCommand4 = (spec) => scheduleFlags(new Command115("schedule").descri
9142
9215
 
9143
9216
  // src/commands/managed/backup/index.ts
9144
9217
  var backupCommand4 = (spec) => {
9145
- const command = new Command116("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
9218
+ const command = new Command117("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
9146
9219
  for (const make of [createCommand10, lsCommand17, restoreCommand4, rmCommand16, scheduleCommand4]) command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
9147
9220
  return command;
9148
9221
  };
9149
9222
 
9150
9223
  // src/commands/managed/create.ts
9151
- import { Command as Command117 } from "commander";
9224
+ import { Command as Command118 } from "commander";
9152
9225
  import { setTimeout as sleep5 } from "timers/promises";
9153
9226
  var READY_WAIT_MS = 9e4;
9154
9227
  var READY_STEP_MS = 2e3;
9155
9228
  var createCommand11 = (spec) => {
9156
- const command = new Command117("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");
9229
+ const command = new Command118("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");
9157
9230
  for (const o of spec.options) command.option(`--${o.name} <${o.arg}>`, o.help);
9158
9231
  return command.option("--password <password>", "its password (default: generated)").option("--storage <gb>", `storage for the data in GB (default: ${spec.storageGib}; it can grow later)`).option("--near <box>", "run it on the host of this box, so a link between them stays on that host").option("--from-backup <id>", `start it on this backup's data, a removed database's too (kvbox ${spec.command} backup ls)`).option("--json", "print it as JSON, password included").action(async (name, opts, cmd) => {
9159
9232
  const options = Object.fromEntries(spec.options.flatMap((o) => typeof opts[o.name] === "string" ? [[o.name, opts[o.name]]] : []));
@@ -9202,8 +9275,8 @@ var createCommand11 = (spec) => {
9202
9275
  };
9203
9276
 
9204
9277
  // src/commands/managed/grow.ts
9205
- import { Command as Command118 } from "commander";
9206
- var growCommand3 = (spec) => new Command118("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) => {
9278
+ import { Command as Command119 } from "commander";
9279
+ var growCommand3 = (spec) => new Command119("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) => {
9207
9280
  const storageGib = parseStorage(size, "size");
9208
9281
  const client = await managedClient(cmd);
9209
9282
  try {
@@ -9216,8 +9289,8 @@ var growCommand3 = (spec) => new Command118("grow").description("give a database
9216
9289
  });
9217
9290
 
9218
9291
  // src/commands/managed/info.ts
9219
- import { Command as Command119 } from "commander";
9220
- var infoCommand3 = (spec) => new Command119("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) => {
9292
+ import { Command as Command120 } from "commander";
9293
+ var infoCommand3 = (spec) => new Command120("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) => {
9221
9294
  const client = await managedClient(cmd);
9222
9295
  try {
9223
9296
  const m = await client.getManaged(spec.kind, name);
@@ -9229,8 +9302,8 @@ var infoCommand3 = (spec) => new Command119("info").alias("get").description("sh
9229
9302
  });
9230
9303
 
9231
9304
  // src/commands/managed/link.ts
9232
- import { Command as Command120 } from "commander";
9233
- var linkCommand2 = (spec) => new Command120("link").description("let a box reach a database privately").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
9305
+ import { Command as Command121 } from "commander";
9306
+ var linkCommand2 = (spec) => new Command121("link").description("let a box reach a database privately").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
9234
9307
  const client = await managedClient(cmd);
9235
9308
  try {
9236
9309
  const m = await spin(`linking ${box2} to ${name}\u2026`, client.linkManaged(spec.kind, name, box2));
@@ -9246,7 +9319,7 @@ var linkCommand2 = (spec) => new Command120("link").description("let a box reach
9246
9319
  });
9247
9320
 
9248
9321
  // src/commands/managed/ls.ts
9249
- import { Command as Command121 } from "commander";
9322
+ import { Command as Command122 } from "commander";
9250
9323
  function listRows(items, user, kindColumn) {
9251
9324
  return items.map((m) => ({
9252
9325
  owner: m.owner === user ? "private" : m.owner,
@@ -9260,7 +9333,7 @@ function listRows(items, user, kindColumn) {
9260
9333
  created: age(m.createdAt)
9261
9334
  }));
9262
9335
  }
9263
- var lsCommand18 = (spec) => new Command121("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) => {
9336
+ var lsCommand18 = (spec) => new Command122("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) => {
9264
9337
  const client = await managedClient(cmd);
9265
9338
  try {
9266
9339
  const items = await client.listManaged(spec?.kind, { all: opts.all });
@@ -9280,8 +9353,8 @@ var lsCommand18 = (spec) => new Command121("ls").alias("list").description(spec
9280
9353
  });
9281
9354
 
9282
9355
  // src/commands/managed/password.ts
9283
- import { Command as Command122 } from "commander";
9284
- var passwordCommand = (spec) => new Command122("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) => {
9356
+ import { Command as Command123 } from "commander";
9357
+ var passwordCommand = (spec) => new Command123("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) => {
9285
9358
  const client = await managedClient(cmd);
9286
9359
  try {
9287
9360
  const secret = opts.reset ? await spin(`setting a new password on ${name}\u2026`, client.resetManagedPassword(spec.kind, name)) : await client.managedPassword(spec.kind, name);
@@ -9297,8 +9370,8 @@ var passwordCommand = (spec) => new Command122("password").description("show a d
9297
9370
  });
9298
9371
 
9299
9372
  // src/commands/managed/public.ts
9300
- import { Command as Command123 } from "commander";
9301
- var publicCommand2 = (spec) => new Command123("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) => {
9373
+ import { Command as Command124 } from "commander";
9374
+ var publicCommand2 = (spec) => new Command124("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) => {
9302
9375
  if (state !== "on" && state !== "off") throw new KvboxError(`write on or off: kvbox ${spec.command} public ${name} on`);
9303
9376
  const client = await managedClient(cmd);
9304
9377
  try {
@@ -9319,8 +9392,8 @@ var publicCommand2 = (spec) => new Command123("public").description("open a data
9319
9392
  });
9320
9393
 
9321
9394
  // src/commands/managed/rm.ts
9322
- import { Command as Command124 } from "commander";
9323
- var rmCommand17 = (spec) => new Command124("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) => {
9395
+ import { Command as Command125 } from "commander";
9396
+ var rmCommand17 = (spec) => new Command125("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) => {
9324
9397
  const client = await managedClient(cmd);
9325
9398
  try {
9326
9399
  if (!await confirm(`Delete database ${name} and all its data? There is no backup.`, opts.yes ?? false)) {
@@ -9336,8 +9409,8 @@ var rmCommand17 = (spec) => new Command124("rm").alias("remove").description("de
9336
9409
  });
9337
9410
 
9338
9411
  // src/commands/managed/start.ts
9339
- import { Command as Command125 } from "commander";
9340
- var startCommand2 = (spec) => new Command125("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9412
+ import { Command as Command126 } from "commander";
9413
+ var startCommand2 = (spec) => new Command126("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9341
9414
  const client = await managedClient(cmd);
9342
9415
  try {
9343
9416
  const m = await spin(`starting ${name}\u2026`, client.startManaged(spec.kind, name));
@@ -9349,8 +9422,8 @@ var startCommand2 = (spec) => new Command125("start").description("run a stopped
9349
9422
  });
9350
9423
 
9351
9424
  // src/commands/managed/stop.ts
9352
- import { Command as Command126 } from "commander";
9353
- var stopCommand2 = (spec) => new Command126("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) => {
9425
+ import { Command as Command127 } from "commander";
9426
+ var stopCommand2 = (spec) => new Command127("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) => {
9354
9427
  const client = await managedClient(cmd);
9355
9428
  try {
9356
9429
  const m = await spin(`stopping ${name}\u2026`, client.stopManaged(spec.kind, name));
@@ -9362,8 +9435,8 @@ var stopCommand2 = (spec) => new Command126("stop").description("shut a database
9362
9435
  });
9363
9436
 
9364
9437
  // src/commands/managed/unlink.ts
9365
- import { Command as Command127 } from "commander";
9366
- var unlinkCommand2 = (spec) => new Command127("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) => {
9438
+ import { Command as Command128 } from "commander";
9439
+ var unlinkCommand2 = (spec) => new Command128("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) => {
9367
9440
  const client = await managedClient(cmd);
9368
9441
  try {
9369
9442
  const m = await spin(`unlinking ${box2} from ${name}\u2026`, client.unlinkManaged(spec.kind, name, box2));
@@ -9376,7 +9449,7 @@ var unlinkCommand2 = (spec) => new Command127("unlink").description("stop a box
9376
9449
 
9377
9450
  // src/commands/managed/kind.ts
9378
9451
  function kindCommand(spec, description) {
9379
- const command = new Command128(spec.command).aliases(spec.aliases).description(description);
9452
+ const command = new Command129(spec.command).aliases(spec.aliases).description(description);
9380
9453
  for (const make of [createCommand11, lsCommand18, infoCommand3, passwordCommand, publicCommand2, linkCommand2, unlinkCommand2, growCommand3, stopCommand2, startCommand2, rmCommand17]) {
9381
9454
  command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
9382
9455
  }
@@ -9391,14 +9464,14 @@ var pgCommand = kindCommand(POSTGRES2, "managed PostgreSQL: a database kvbox run
9391
9464
  var redisCommand = kindCommand(REDIS, "managed Redis (Valkey): a Redis kvbox runs for you, private until you link a box or make it public");
9392
9465
 
9393
9466
  // src/commands/managed/index.ts
9394
- import { Command as Command129 } from "commander";
9395
- var managedCommand = new Command129("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand18().option("--org <slug>", "act in this org (- for your personal databases)"));
9467
+ import { Command as Command130 } from "commander";
9468
+ var managedCommand = new Command130("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand18().option("--org <slug>", "act in this org (- for your personal databases)"));
9396
9469
 
9397
9470
  // src/commands/env/index.ts
9398
- import { Command as Command133 } from "commander";
9471
+ import { Command as Command134 } from "commander";
9399
9472
 
9400
9473
  // src/commands/env/ls.ts
9401
- import { Command as Command130 } from "commander";
9474
+ import { Command as Command131 } from "commander";
9402
9475
 
9403
9476
  // src/commands/env/shared.ts
9404
9477
  function requireCloud4(client) {
@@ -9425,7 +9498,7 @@ function firstBootHint(box2, name) {
9425
9498
  }
9426
9499
 
9427
9500
  // src/commands/env/ls.ts
9428
- var lsCommand19 = new Command130("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) => {
9501
+ var lsCommand19 = new Command131("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) => {
9429
9502
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
9430
9503
  try {
9431
9504
  if (opts.box !== void 0) {
@@ -9464,8 +9537,8 @@ var lsCommand19 = new Command130("ls").alias("list").description("list the varia
9464
9537
  });
9465
9538
 
9466
9539
  // src/commands/env/rm.ts
9467
- import { Command as Command131 } from "commander";
9468
- var rmCommand18 = new Command131("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) => {
9540
+ import { Command as Command132 } from "commander";
9541
+ var rmCommand18 = new Command132("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) => {
9469
9542
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
9470
9543
  try {
9471
9544
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
@@ -9502,8 +9575,8 @@ var rmCommand18 = new Command131("rm").alias("remove").description("remove varia
9502
9575
  });
9503
9576
 
9504
9577
  // src/commands/env/set.ts
9505
- import { Command as Command132 } from "commander";
9506
- var setCommand2 = new Command132("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) => {
9578
+ import { Command as Command133 } from "commander";
9579
+ var setCommand2 = new Command133("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) => {
9507
9580
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
9508
9581
  try {
9509
9582
  const owner = opts.box === void 0 ? requireCloud4(client) : void 0;
@@ -9540,14 +9613,14 @@ var setCommand2 = new Command132("set").description("add or change a variable; b
9540
9613
  });
9541
9614
 
9542
9615
  // src/commands/env/index.ts
9543
- var envCommand = new Command133("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand19, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand18);
9616
+ var envCommand = new Command134("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand19, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand18);
9544
9617
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
9545
9618
 
9546
9619
  // src/commands/domain/index.ts
9547
- import { Command as Command137 } from "commander";
9620
+ import { Command as Command138 } from "commander";
9548
9621
 
9549
9622
  // src/commands/domain/add.ts
9550
- import { Command as Command134 } from "commander";
9623
+ import { Command as Command135 } from "commander";
9551
9624
 
9552
9625
  // src/commands/domain/shared.ts
9553
9626
  function requireCloud5(client) {
@@ -9567,7 +9640,7 @@ function hostIn(name, zone) {
9567
9640
  }
9568
9641
 
9569
9642
  // src/commands/domain/add.ts
9570
- var addCommand4 = new Command134("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) => {
9643
+ var addCommand4 = new Command135("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) => {
9571
9644
  const domain = assertDomain(domainArg.trim().toLowerCase());
9572
9645
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
9573
9646
  const client = await clientFor(cmd.optsWithGlobals());
@@ -9603,8 +9676,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
9603
9676
  });
9604
9677
 
9605
9678
  // src/commands/domain/ls.ts
9606
- import { Command as Command135 } from "commander";
9607
- var lsCommand20 = new Command135("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
9679
+ import { Command as Command136 } from "commander";
9680
+ var lsCommand20 = new Command136("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
9608
9681
  const client = await clientFor(cmd.optsWithGlobals());
9609
9682
  try {
9610
9683
  requireCloud5(client);
@@ -9633,8 +9706,8 @@ var lsCommand20 = new Command135("ls").alias("list").description("list your cust
9633
9706
  });
9634
9707
 
9635
9708
  // src/commands/domain/rm.ts
9636
- import { Command as Command136 } from "commander";
9637
- var rmCommand19 = new Command136("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) => {
9709
+ import { Command as Command137 } from "commander";
9710
+ var rmCommand19 = new Command137("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) => {
9638
9711
  const domain = domainArg.trim().toLowerCase();
9639
9712
  const client = await clientFor(cmd.optsWithGlobals());
9640
9713
  try {
@@ -9655,7 +9728,7 @@ var rmCommand19 = new Command136("rm").alias("remove").description("stop serving
9655
9728
  });
9656
9729
 
9657
9730
  // src/commands/domain/index.ts
9658
- var domainCommand = new Command137("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand4).addCommand(lsCommand20).addCommand(rmCommand19);
9731
+ var domainCommand = new Command138("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand4).addCommand(lsCommand20).addCommand(rmCommand19);
9659
9732
  for (const cmd of domainCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
9660
9733
 
9661
9734
  // src/commands/update.ts
@@ -9663,7 +9736,7 @@ import { spawn as spawn8 } from "child_process";
9663
9736
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
9664
9737
  import { tmpdir } from "os";
9665
9738
  import { join as join9 } from "path";
9666
- import { Command as Command138 } from "commander";
9739
+ import { Command as Command139 } from "commander";
9667
9740
 
9668
9741
  // src/update.ts
9669
9742
  import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
@@ -9782,7 +9855,7 @@ function run2(cmd, args) {
9782
9855
  child.on("exit", (code, signal) => resolve4(code ?? (signal ? 1 : 0)));
9783
9856
  });
9784
9857
  }
9785
- var selfUpdateCommand = new Command138("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
9858
+ var selfUpdateCommand = new Command139("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
9786
9859
  suppressUpdateNotice();
9787
9860
  const inst = installerFor(process.platform, process.env["KVBOX_INSTALL_URL"] || INSTALL_BASE);
9788
9861
  let code;
@@ -9806,7 +9879,7 @@ var selfUpdateCommand = new Command138("update").description("update kvbox to th
9806
9879
  import { chmod as chmod2, mkdir as mkdir4, readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
9807
9880
  import { homedir as homedir2 } from "os";
9808
9881
  import { dirname as dirname2, join as join11 } from "path";
9809
- import { Command as Command139 } from "commander";
9882
+ import { Command as Command140 } from "commander";
9810
9883
 
9811
9884
  // src/sshConfig.ts
9812
9885
  import { spawnSync as spawnSync4 } from "child_process";
@@ -9928,7 +10001,7 @@ async function forgetReplacedBox(alias, id, p) {
9928
10001
  }
9929
10002
 
9930
10003
  // src/commands/sshConfig.ts
9931
- var sshConfigCommand = new Command139("ssh-config").description("add your boxes to ~/.ssh/config, so ssh and VS Code Remote-SSH reach them as <box>.kvbox").argument("[box...]", "only these boxes, added to the ones listed already (default: every box)").option("--remove", "take these boxes off the list; with no box, take the whole kvbox block out").option("--file <path>", "the ssh config file to write (default: ~/.ssh/config)").option("--json", "print the result as JSON").action(async (boxes, opts, cmd) => {
10004
+ var sshConfigCommand = new Command140("ssh-config").description("add your boxes to ~/.ssh/config, so ssh and VS Code Remote-SSH reach them as <box>.kvbox").argument("[box...]", "only these boxes, added to the ones listed already (default: every box)").option("--remove", "take these boxes off the list; with no box, take the whole kvbox block out").option("--file <path>", "the ssh config file to write (default: ~/.ssh/config)").option("--json", "print the result as JSON").action(async (boxes, opts, cmd) => {
9932
10005
  const file = opts.file ?? join11(homedir2(), ".ssh", "config");
9933
10006
  const before = await readFile9(file, "utf8").catch((err) => {
9934
10007
  if (err.code === "ENOENT") return "";
@@ -9994,8 +10067,8 @@ async function aliasesOf(client, boxes, gone) {
9994
10067
 
9995
10068
  // src/commands/sshProxy.ts
9996
10069
  import { connect } from "net";
9997
- import { Command as Command140 } from "commander";
9998
- var sshProxyCommand = new Command140("ssh-proxy").description("connect ssh to a box (used by kvbox ssh-config)").argument("<host>", "the ssh name: <box>.kvbox or <box>.<org>.kvbox").option("--renew", "only renew the SSH certificate if it is about to expire").action(async (host, opts, cmd) => {
10070
+ import { Command as Command141 } from "commander";
10071
+ var sshProxyCommand = new Command141("ssh-proxy").description("connect ssh to a box (used by kvbox ssh-config)").argument("<host>", "the ssh name: <box>.kvbox or <box>.<org>.kvbox").option("--renew", "only renew the SSH certificate if it is about to expire").action(async (host, opts, cmd) => {
9999
10072
  const ref = parseAlias(host);
10000
10073
  if (ref === void 0) throw new KvboxError(`${host}: not a kvbox name (<box>.kvbox or <box>.<org>.kvbox)`);
10001
10074
  const client = await clientFor(cmd.optsWithGlobals());
@@ -10157,7 +10230,7 @@ function installRootHelp(program) {
10157
10230
 
10158
10231
  // src/program.ts
10159
10232
  function buildProgram() {
10160
- const program = new Command141("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();
10233
+ const program = new Command142("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();
10161
10234
  program.addCommand(vmCommand);
10162
10235
  program.addCommand(snapshotsCommand);
10163
10236
  program.addCommand(volumeCommand);