@kvbox/cli 0.6.24 → 0.6.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/kvbox.js CHANGED
@@ -155,7 +155,7 @@ async function spin(message, work, opts = {}) {
155
155
  }
156
156
 
157
157
  // src/program.ts
158
- import { Command as Command173 } from "commander";
158
+ import { Command as Command174 } from "commander";
159
159
 
160
160
  // ../shared/src/version.ts
161
161
  import { createRequire } from "module";
@@ -170,7 +170,7 @@ function versionOf(srcFileUrl, injected) {
170
170
  }
171
171
 
172
172
  // src/version.ts
173
- var VERSION = versionOf(import.meta.url, true ? "0.6.24" : void 0);
173
+ var VERSION = versionOf(import.meta.url, true ? "0.6.25" : void 0);
174
174
 
175
175
  // src/commands/vm/index.ts
176
176
  import { Command as Command44 } from "commander";
@@ -2104,6 +2104,8 @@ var ClusterNodeSchema = z6.object({
2104
2104
  roles: z6.array(z6.string()),
2105
2105
  version: z6.string().nullable().optional(),
2106
2106
  address: z6.string().optional(),
2107
+ /** The node's boot id, new at every boot of its box (k3s image v0.1.5): a Ready under an older one is from before a restart. */
2108
+ bootId: z6.string().optional(),
2107
2109
  /** Bound persistent volumes kept on this node's own disk: what removing the node would lose. */
2108
2110
  volumes: z6.number().int(),
2109
2111
  /** Those volumes by their claim, `namespace/name` (k3s image v0.1.2 and later). */
@@ -2116,6 +2118,11 @@ var ClusterHealthSchema = z6.object({
2116
2118
  ingress: z6.boolean(),
2117
2119
  /** k3s's own version: `v1.37.2+k3s1`. */
2118
2120
  version: z6.string().optional(),
2121
+ /**
2122
+ * When the first of the master's own certificates ends (k3s image v0.1.5; #230). They last a year and
2123
+ * are renewed only when k3s starts within 120 days of that: a master that never restarts runs out.
2124
+ */
2125
+ certificatesEndAt: z6.string().optional(),
2119
2126
  nodes: z6.array(ClusterNodeSchema)
2120
2127
  });
2121
2128
  var CLUSTER_STATES = ["ready", "starting", "degraded", "down", "unknown"];
@@ -2167,8 +2174,8 @@ var ClusterSchema = z6.object({
2167
2174
  */
2168
2175
  room: z6.object({ s: z6.number().int(), m: z6.number().int(), l: z6.number().int() }).nullable().optional(),
2169
2176
  /**
2170
- * What is changing it right now (one thing at a time); absent when nothing is. `since` is the lease's last
2171
- * stamp, renewed while the change goes on: when it was last seen alive, not when it began.
2177
+ * What is changing it right now (one thing at a time); absent when nothing is. `since` is when the
2178
+ * change began, the same for as long as it goes on: a client tells its own change from the next by it.
2172
2179
  */
2173
2180
  operation: z6.object({ what: z6.string(), since: z6.string() }).optional(),
2174
2181
  /**
@@ -2865,6 +2872,17 @@ var Clusters = class {
2865
2872
  restartNode(name, node, opts = {}) {
2866
2873
  return this.transport.request("POST", cluster(name, `/nodes/${encodeURIComponent(node)}/restart`), ClusterSchema, { org: opts.org });
2867
2874
  }
2875
+ /**
2876
+ * New credentials for the cluster, for when somebody who had them should no longer: every kubeconfig
2877
+ * handed out so far stops working (`kubeconfig` gives the new one), and so do the tokens its boxes join
2878
+ * with. Answered once the master has stored them; the master then restarts and every node after it,
2879
+ * together, so apps on the cluster are down for a few minutes (`waitUntilSettled` resolves when that is over, or throws what could not be done; the same
2880
+ * call starts over). Every box of the cluster must be running. What was made inside the cluster (a
2881
+ * service account's token) is not ended.
2882
+ */
2883
+ rotate(name, opts = {}) {
2884
+ return this.transport.request("POST", cluster(name, "/rotate"), ClusterSchema, { org: opts.org });
2885
+ }
2868
2886
  /** Remove the cluster: its nodes (undrained), its master and everything in it. Its backups stay listed. */
2869
2887
  async remove(name, opts = {}) {
2870
2888
  await this.transport.request("DELETE", cluster(name), z13.undefined(), { org: opts.org });
@@ -3729,6 +3747,10 @@ var ServerClient = class {
3729
3747
  restartClusterNode(cluster2, node) {
3730
3748
  return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/nodes/${encodeURIComponent(node)}/restart`, ClusterSchema);
3731
3749
  }
3750
+ /** New credentials for a cluster (#230): answered once its master has stored them, its boxes restart after. */
3751
+ rotateCluster(name) {
3752
+ return this.call("POST", `/k8s/${encodeURIComponent(name)}/rotate`, ClusterSchema);
3753
+ }
3732
3754
  /** One more pool with its nodes (#217): each node is a box the host makes, so a few seconds a node. */
3733
3755
  addPool(cluster2, req) {
3734
3756
  return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/pools`, ClusterSchema, req);
@@ -9164,7 +9186,7 @@ for (const cmd of bucketCommand.commands) {
9164
9186
  }
9165
9187
 
9166
9188
  // src/commands/k8s/index.ts
9167
- import { Command as Command128 } from "commander";
9189
+ import { Command as Command129 } from "commander";
9168
9190
 
9169
9191
  // src/commands/k8s/backup/index.ts
9170
9192
  import { Command as Command103 } from "commander";
@@ -9851,9 +9873,37 @@ var rmCommand17 = new Command125("rm").alias("remove").description("delete a clu
9851
9873
  }
9852
9874
  });
9853
9875
 
9854
- // src/commands/k8s/start.ts
9876
+ // src/commands/k8s/rotate.ts
9855
9877
  import { Command as Command126 } from "commander";
9856
- var startCommand2 = new Command126("start").description("run a cluster's master and nodes again after they stopped").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9878
+ var ROTATE_WAIT_MS = 30 * 6e4;
9879
+ var rotateCommand = new Command126("rotate").description("give a cluster new credentials: every kubeconfig handed out so far stops working").argument("<cluster>", "cluster name").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the master and the nodes to restart").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9880
+ const client = await k8sClient(cmd);
9881
+ try {
9882
+ if (!await confirm(`Give cluster ${name} new credentials? Every kubeconfig handed out so far stops working, and its master, then its nodes, restart: apps on it are down for a few minutes.`, opts.yes ?? false)) {
9883
+ info("cancelled");
9884
+ process.exitCode = 1;
9885
+ return;
9886
+ }
9887
+ const changed = await spin(`storing new credentials in ${name}\u2026`, client.rotateCluster(name));
9888
+ const ours = changed.operation?.since;
9889
+ const waitMs = process.env["KVBOX_K8S_WAIT_MS"] !== void 0 ? readyWait() : ROTATE_WAIT_MS;
9890
+ const refused2 = (err) => !(err instanceof CallError) || err.status >= 400 && err.status < 500;
9891
+ const now = opts.wait && ours !== void 0 ? await spin("restarting its master, then its nodes\u2026", untilReady(client, name, changed, waitMs, void 0, (c2) => c2.operation === void 0 || c2.operation.since !== ours, refused2)) : changed;
9892
+ if (opts.json) json(now);
9893
+ failIfNot(now, void 0, opts.wait ? changed.operation : void 0);
9894
+ if (opts.json) return;
9895
+ const shown = shownName2(now, client);
9896
+ if (now.operation !== void 0) info(`cluster ${shown} is taking its new credentials: its master and nodes are still restarting; look again with: kvbox k8s info ${shown}`);
9897
+ else info(`${color.green("\u2713")} cluster ${shown} has new credentials; every kubeconfig from before is refused`);
9898
+ info(color.dim(` next: kvbox k8s kubeconfig ${shown} > ${now.name}.yaml`));
9899
+ } finally {
9900
+ await client.close();
9901
+ }
9902
+ });
9903
+
9904
+ // src/commands/k8s/start.ts
9905
+ import { Command as Command127 } from "commander";
9906
+ var startCommand2 = new Command127("start").description("run a cluster's master and nodes again after they stopped").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9857
9907
  const client = await k8sClient(cmd);
9858
9908
  try {
9859
9909
  const c2 = await spin(`starting cluster ${name}\u2026`, client.startCluster(name));
@@ -9865,8 +9915,8 @@ var startCommand2 = new Command126("start").description("run a cluster's master
9865
9915
  });
9866
9916
 
9867
9917
  // src/commands/k8s/unlink.ts
9868
- import { Command as Command127 } from "commander";
9869
- var unlinkCommand2 = new Command127("unlink").description("take a cluster's link away (kvbox k8s link)").argument("<cluster>", "cluster name").argument("<target>", "the database or box it reaches").option("-p, --port <port>", "the port, when the cluster reaches several of that box's").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed link as JSON").action(async (cluster2, target, opts, cmd) => {
9918
+ import { Command as Command128 } from "commander";
9919
+ var unlinkCommand2 = new Command128("unlink").description("take a cluster's link away (kvbox k8s link)").argument("<cluster>", "cluster name").argument("<target>", "the database or box it reaches").option("-p, --port <port>", "the port, when the cluster reaches several of that box's").option("-y, --yes", "do not ask for confirmation").option("--json", "print the removed link as JSON").action(async (cluster2, target, opts, cmd) => {
9870
9920
  const port = opts.port === void 0 ? void 0 : parseLinkPort(opts.port);
9871
9921
  if (!await confirm(`Cut cluster ${cluster2} off from ${target}${port !== void 0 ? ` port ${port}` : ""}? Its pods' open connections close too.`, opts.yes ?? false)) {
9872
9922
  info("cancelled");
@@ -9887,7 +9937,7 @@ var unlinkCommand2 = new Command127("unlink").description("take a cluster's link
9887
9937
  });
9888
9938
 
9889
9939
  // src/commands/k8s/index.ts
9890
- var k8sCommand = new Command128("k8s").description("Kubernetes clusters kvbox runs for you").addCommand(createCommand10).addCommand(lsCommand17).addCommand(infoCommand2).addCommand(kubeconfigCommand).addCommand(poolCommand).addCommand(nodeCommand).addCommand(proxyCommand2).addCommand(domainCommand).addCommand(linkCommand2).addCommand(unlinkCommand2).addCommand(linksCommand2).addCommand(backupCommand4).addCommand(startCommand2).addCommand(rmCommand17);
9940
+ var k8sCommand = new Command129("k8s").description("Kubernetes clusters kvbox runs for you").addCommand(createCommand10).addCommand(lsCommand17).addCommand(infoCommand2).addCommand(kubeconfigCommand).addCommand(poolCommand).addCommand(nodeCommand).addCommand(proxyCommand2).addCommand(domainCommand).addCommand(linkCommand2).addCommand(unlinkCommand2).addCommand(linksCommand2).addCommand(backupCommand4).addCommand(startCommand2).addCommand(rotateCommand).addCommand(rmCommand17);
9891
9941
  var withOrg3 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal clusters)");
9892
9942
  for (const cmd of k8sCommand.commands) {
9893
9943
  if (cmd.commands.length > 0) cmd.commands.forEach(withOrg3);
@@ -9895,10 +9945,10 @@ for (const cmd of k8sCommand.commands) {
9895
9945
  }
9896
9946
 
9897
9947
  // src/commands/cron/index.ts
9898
- import { Command as Command141 } from "commander";
9948
+ import { Command as Command142 } from "commander";
9899
9949
 
9900
9950
  // src/commands/cron/create.ts
9901
- import { Command as Command129 } from "commander";
9951
+ import { Command as Command130 } from "commander";
9902
9952
 
9903
9953
  // src/commands/cron/shared.ts
9904
9954
  async function cronClient(cmd) {
@@ -9959,7 +10009,7 @@ function printRows3(rows2) {
9959
10009
  var noTriggers = (service) => info(`cron service ${service} has no triggers yet; add one with: kvbox cron trigger add ${service} <box> "0 6 * * *" --port 3000 (or --run "<command>")`);
9960
10010
 
9961
10011
  // src/commands/cron/create.ts
9962
- var createCommand11 = new Command129("create").description("make a cron service: a named set of triggers").argument("<name>", "what to call it (lowercase letters, digits and '-')").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10012
+ var createCommand11 = new Command130("create").description("make a cron service: a named set of triggers").argument("<name>", "what to call it (lowercase letters, digits and '-')").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9963
10013
  const client = await cronClient(cmd);
9964
10014
  try {
9965
10015
  const service = await client.createCronService(name);
@@ -9976,8 +10026,8 @@ var createCommand11 = new Command129("create").description("make a cron service:
9976
10026
  });
9977
10027
 
9978
10028
  // src/commands/cron/info.ts
9979
- import { Command as Command130 } from "commander";
9980
- var infoCommand3 = new Command130("info").alias("get").description("show a cron service and its triggers").argument("<name>", "cron service name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10029
+ import { Command as Command131 } from "commander";
10030
+ var infoCommand3 = new Command131("info").alias("get").description("show a cron service and its triggers").argument("<name>", "cron service name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9981
10031
  const client = await cronClient(cmd);
9982
10032
  try {
9983
10033
  const service = await client.getCronService(name);
@@ -10001,8 +10051,8 @@ var infoCommand3 = new Command130("info").alias("get").description("show a cron
10001
10051
  });
10002
10052
 
10003
10053
  // src/commands/cron/ls.ts
10004
- import { Command as Command131 } from "commander";
10005
- var lsCommand20 = new Command131("ls").alias("list").description("list cron services").option("-a, --all", "every cron service on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10054
+ import { Command as Command132 } from "commander";
10055
+ var lsCommand20 = new Command132("ls").alias("list").description("list cron services").option("-a, --all", "every cron service on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10006
10056
  const client = await cronClient(cmd);
10007
10057
  try {
10008
10058
  const services = await client.listCronServices({ all: opts.all });
@@ -10022,8 +10072,8 @@ var lsCommand20 = new Command131("ls").alias("list").description("list cron serv
10022
10072
  });
10023
10073
 
10024
10074
  // src/commands/cron/rm.ts
10025
- import { Command as Command132 } from "commander";
10026
- var rmCommand18 = new Command132("rm").alias("remove").description("delete a cron service, its triggers and their run history").argument("<name>", "cron service name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10075
+ import { Command as Command133 } from "commander";
10076
+ var rmCommand18 = new Command133("rm").alias("remove").description("delete a cron service, its triggers and their run history").argument("<name>", "cron service name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10027
10077
  const client = await cronClient(cmd);
10028
10078
  try {
10029
10079
  if (!await confirm(`Delete cron service ${name}? Its triggers stop firing and their run history is deleted.`, opts.yes ?? false)) {
@@ -10039,10 +10089,10 @@ var rmCommand18 = new Command132("rm").alias("remove").description("delete a cro
10039
10089
  });
10040
10090
 
10041
10091
  // src/commands/cron/trigger/index.ts
10042
- import { Command as Command140 } from "commander";
10092
+ import { Command as Command141 } from "commander";
10043
10093
 
10044
10094
  // src/commands/cron/trigger/add.ts
10045
- import { Command as Command133 } from "commander";
10095
+ import { Command as Command134 } from "commander";
10046
10096
  function portOf(value) {
10047
10097
  const n2 = Number(value);
10048
10098
  if (!Number.isInteger(n2) || n2 < 1 || n2 > 65535) throw new KvboxError(`--port ${value}: a port is a number from 1 to 65535`);
@@ -10062,7 +10112,7 @@ function timeoutOf(value) {
10062
10112
  if (sec > MAX_CRON_COMMAND_TIMEOUT_SEC) throw new KvboxError(`--timeout ${value}: a command may run for ${MAX_CRON_COMMAND_TIMEOUT_SEC / 60} minutes at most`);
10063
10113
  return sec;
10064
10114
  }
10065
- var addCommand5 = new Command133("add").description("add a trigger: on a schedule, call a port of a box or run a command in it").argument("<service>", "cron service name").argument("<box>", "the box it acts on").argument("<expr>", 'cron expression in quotes, five fields: "0 6 * * *" is every day at 06:00').option("--port <n>", "call this port, the one your app listens on in the box").option("--path <path>", "with --port: path and query to request (default: /)").option("--method <method>", `with --port: HTTP method, ${CRON_METHODS.join(" or ")} (default: POST)`).option("--run <command>", 'or run this command in the box, in quotes: "node ~/app/embed.js"').option("--timeout <duration>", `with --run: stop the command after this long (90s, 10m, 1h; default: ${DEFAULT_CRON_COMMAND_TIMEOUT_SEC / 60}m)`).option("--tz <zone>", "time zone the schedule is read in, like Europe/Bucharest", "UTC").option("--json", "print as JSON").action(async (service, box2, expr, opts, cmd) => {
10115
+ var addCommand5 = new Command134("add").description("add a trigger: on a schedule, call a port of a box or run a command in it").argument("<service>", "cron service name").argument("<box>", "the box it acts on").argument("<expr>", 'cron expression in quotes, five fields: "0 6 * * *" is every day at 06:00').option("--port <n>", "call this port, the one your app listens on in the box").option("--path <path>", "with --port: path and query to request (default: /)").option("--method <method>", `with --port: HTTP method, ${CRON_METHODS.join(" or ")} (default: POST)`).option("--run <command>", 'or run this command in the box, in quotes: "node ~/app/embed.js"').option("--timeout <duration>", `with --run: stop the command after this long (90s, 10m, 1h; default: ${DEFAULT_CRON_COMMAND_TIMEOUT_SEC / 60}m)`).option("--tz <zone>", "time zone the schedule is read in, like Europe/Bucharest", "UTC").option("--json", "print as JSON").action(async (service, box2, expr, opts, cmd) => {
10066
10116
  let action;
10067
10117
  if (opts.run !== void 0) {
10068
10118
  if (opts.port !== void 0 || opts.path !== void 0 || opts.method !== void 0) throw new KvboxError("a trigger runs a command or calls a port: use --run, or --port with --path and --method, not both");
@@ -10089,8 +10139,8 @@ var addCommand5 = new Command133("add").description("add a trigger: on a schedul
10089
10139
  });
10090
10140
 
10091
10141
  // src/commands/cron/trigger/ls.ts
10092
- import { Command as Command134 } from "commander";
10093
- var lsCommand21 = new Command134("ls").alias("list").description("list a cron service's triggers").argument("<service>", "cron service name").option("--json", "print as JSON").action(async (service, opts, cmd) => {
10142
+ import { Command as Command135 } from "commander";
10143
+ var lsCommand21 = new Command135("ls").alias("list").description("list a cron service's triggers").argument("<service>", "cron service name").option("--json", "print as JSON").action(async (service, opts, cmd) => {
10094
10144
  const client = await cronClient(cmd);
10095
10145
  try {
10096
10146
  const triggers = await client.listCronTriggers(service);
@@ -10106,8 +10156,8 @@ var lsCommand21 = new Command134("ls").alias("list").description("list a cron se
10106
10156
  });
10107
10157
 
10108
10158
  // src/commands/cron/trigger/pause.ts
10109
- import { Command as Command135 } from "commander";
10110
- var pauseCommand2 = new Command135("pause").description("stop a trigger from firing until it is resumed").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10159
+ import { Command as Command136 } from "commander";
10160
+ var pauseCommand2 = new Command136("pause").description("stop a trigger from firing until it is resumed").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10111
10161
  const client = await cronClient(cmd);
10112
10162
  try {
10113
10163
  const trigger = await client.setCronTriggerEnabled(service, id, false);
@@ -10122,8 +10172,8 @@ var pauseCommand2 = new Command135("pause").description("stop a trigger from fir
10122
10172
  });
10123
10173
 
10124
10174
  // src/commands/cron/trigger/resume.ts
10125
- import { Command as Command136 } from "commander";
10126
- var resumeCommand2 = new Command136("resume").description("let a paused trigger fire again").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10175
+ import { Command as Command137 } from "commander";
10176
+ var resumeCommand2 = new Command137("resume").description("let a paused trigger fire again").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10127
10177
  const client = await cronClient(cmd);
10128
10178
  try {
10129
10179
  const trigger = await client.setCronTriggerEnabled(service, id, true);
@@ -10138,8 +10188,8 @@ var resumeCommand2 = new Command136("resume").description("let a paused trigger
10138
10188
  });
10139
10189
 
10140
10190
  // src/commands/cron/trigger/rm.ts
10141
- import { Command as Command137 } from "commander";
10142
- var rmCommand19 = new Command137("rm").alias("remove").description("delete a trigger and its run history").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-y, --yes", "do not ask for confirmation").action(async (service, id, opts, cmd) => {
10191
+ import { Command as Command138 } from "commander";
10192
+ var rmCommand19 = new Command138("rm").alias("remove").description("delete a trigger and its run history").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-y, --yes", "do not ask for confirmation").action(async (service, id, opts, cmd) => {
10143
10193
  const client = await cronClient(cmd);
10144
10194
  try {
10145
10195
  if (!await confirm(`Delete trigger ${id} of cron service ${service}? Its run history is deleted too.`, opts.yes ?? false)) {
@@ -10155,8 +10205,8 @@ var rmCommand19 = new Command137("rm").alias("remove").description("delete a tri
10155
10205
  });
10156
10206
 
10157
10207
  // src/commands/cron/trigger/run.ts
10158
- import { Command as Command138 } from "commander";
10159
- var runCommand = new Command138("run").description("fire a trigger now, once, besides its schedule").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10208
+ import { Command as Command139 } from "commander";
10209
+ var runCommand = new Command139("run").description("fire a trigger now, once, besides its schedule").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10160
10210
  const client = await cronClient(cmd);
10161
10211
  try {
10162
10212
  const trigger = await client.runCronTrigger(service, id);
@@ -10172,13 +10222,13 @@ var runCommand = new Command138("run").description("fire a trigger now, once, be
10172
10222
  });
10173
10223
 
10174
10224
  // src/commands/cron/trigger/runs.ts
10175
- import { Command as Command139 } from "commander";
10225
+ import { Command as Command140 } from "commander";
10176
10226
  function limitOf(value) {
10177
10227
  const n2 = Number(value);
10178
10228
  if (!Number.isInteger(n2) || n2 < 1) throw new KvboxError(`-n ${value}: a number of runs, 1 or more`);
10179
10229
  return n2;
10180
10230
  }
10181
- var runsCommand = new Command139("runs").aliases(["logs"]).description("show how a trigger's last runs ended").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-n, --limit <count>", "how many runs to show", "20").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10231
+ var runsCommand = new Command140("runs").aliases(["logs"]).description("show how a trigger's last runs ended").argument("<service>", "cron service name").argument("<id>", "trigger id (kvbox cron trigger ls)").option("-n, --limit <count>", "how many runs to show", "20").option("--json", "print as JSON").action(async (service, id, opts, cmd) => {
10182
10232
  const limit = limitOf(opts.limit);
10183
10233
  const client = await cronClient(cmd);
10184
10234
  try {
@@ -10208,10 +10258,10 @@ var runsCommand = new Command139("runs").aliases(["logs"]).description("show how
10208
10258
  });
10209
10259
 
10210
10260
  // src/commands/cron/trigger/index.ts
10211
- var triggerCommand = new Command140("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand5).addCommand(lsCommand21).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand19);
10261
+ var triggerCommand = new Command141("trigger").aliases(["triggers"]).description("a cron service's triggers: a schedule and the request it sends to a box").addCommand(addCommand5).addCommand(lsCommand21).addCommand(runsCommand).addCommand(runCommand).addCommand(pauseCommand2).addCommand(resumeCommand2).addCommand(rmCommand19);
10212
10262
 
10213
10263
  // src/commands/cron/index.ts
10214
- var cronCommand = new Command141("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand11).addCommand(lsCommand20).addCommand(infoCommand3).addCommand(rmCommand18).addCommand(triggerCommand);
10264
+ var cronCommand = new Command142("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand11).addCommand(lsCommand20).addCommand(infoCommand3).addCommand(rmCommand18).addCommand(triggerCommand);
10215
10265
  var withOrg4 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal cron services)");
10216
10266
  for (const cmd of cronCommand.commands) {
10217
10267
  if (cmd === triggerCommand) cmd.commands.forEach(withOrg4);
@@ -10219,13 +10269,13 @@ for (const cmd of cronCommand.commands) {
10219
10269
  }
10220
10270
 
10221
10271
  // src/commands/managed/kind.ts
10222
- import { Command as Command160 } from "commander";
10272
+ import { Command as Command161 } from "commander";
10223
10273
 
10224
10274
  // src/commands/managed/backup/index.ts
10225
- import { Command as Command148 } from "commander";
10275
+ import { Command as Command149 } from "commander";
10226
10276
 
10227
10277
  // src/commands/managed/backup/create.ts
10228
- import { Command as Command143 } from "commander";
10278
+ import { Command as Command144 } from "commander";
10229
10279
 
10230
10280
  // src/commands/managed/shared.ts
10231
10281
  import "commander";
@@ -10312,7 +10362,7 @@ function parseStorage(text2, flag) {
10312
10362
  }
10313
10363
 
10314
10364
  // src/commands/managed/backup/create.ts
10315
- var createCommand12 = (spec) => new Command143("create").description("back up a database to the kvbox cloud (encrypted)").argument("<db>", "its name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
10365
+ var createCommand12 = (spec) => new Command144("create").description("back up a database to the kvbox cloud (encrypted)").argument("<db>", "its name").option("--wait", "stay until the backup is ready (by default it runs in the background)").option("--json", "print the backup as JSON").action(async (name, opts, cmd) => {
10316
10366
  const client = await managedClient(cmd);
10317
10367
  const ls = `kvbox ${spec.command} backup ls ${name}`;
10318
10368
  try {
@@ -10339,7 +10389,7 @@ var createCommand12 = (spec) => new Command143("create").description("back up a
10339
10389
  });
10340
10390
 
10341
10391
  // src/commands/managed/backup/ls.ts
10342
- import { Command as Command144 } from "commander";
10392
+ import { Command as Command145 } from "commander";
10343
10393
  var lsCommand22 = (spec) => {
10344
10394
  const removedOnes = async (err, name, client) => {
10345
10395
  if (!(err instanceof CallError && err.status === 404)) throw err;
@@ -10348,7 +10398,7 @@ var lsCommand22 = (spec) => {
10348
10398
  const own = name.includes("/") ? [] : gone.filter((b) => b.owner === me(client));
10349
10399
  return own.length > 0 ? own : gone;
10350
10400
  };
10351
- return new Command144("ls").alias("list").description("list backups: every database's, or one database's").argument("[db]", "its name (default: every database)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10401
+ return new Command145("ls").alias("list").description("list backups: every database's, or one database's").argument("[db]", "its name (default: every database)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10352
10402
  const client = await managedClient(cmd);
10353
10403
  try {
10354
10404
  const list = name === void 0 ? await client.listManagedBackups(spec.kind) : await client.managedBackups(spec.kind, name).catch((err) => removedOnes(err, name, client));
@@ -10391,8 +10441,8 @@ var lsCommand22 = (spec) => {
10391
10441
  };
10392
10442
 
10393
10443
  // src/commands/managed/backup/restore.ts
10394
- import { Command as Command145 } from "commander";
10395
- var restoreCommand5 = (spec) => new Command145("restore").description("put a backup back: the database's data becomes the backup's (it restarts)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").option("--json", "print the database as JSON").action(async (name, id, opts, cmd) => {
10444
+ import { Command as Command146 } from "commander";
10445
+ var restoreCommand5 = (spec) => new Command146("restore").description("put a backup back: the database's data becomes the backup's (it restarts)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").option("--json", "print the database as JSON").action(async (name, id, opts, cmd) => {
10396
10446
  const client = await managedClient(cmd);
10397
10447
  try {
10398
10448
  const backup = await client.managedBackup(spec.kind, name, id);
@@ -10414,8 +10464,8 @@ var restoreCommand5 = (spec) => new Command145("restore").description("put a bac
10414
10464
  });
10415
10465
 
10416
10466
  // src/commands/managed/backup/rm.ts
10417
- import { Command as Command146 } from "commander";
10418
- var rmCommand20 = (spec) => new Command146("rm").alias("remove").description("remove a backup for good (a database's that is gone too)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
10467
+ import { Command as Command147 } from "commander";
10468
+ var rmCommand20 = (spec) => new Command147("rm").alias("remove").description("remove a backup for good (a database's that is gone too)").argument("<db>", "its name").argument("<id>", `the backup's id (kvbox ${spec.command} backup ls <db>)`).option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
10419
10469
  const client = await managedClient(cmd);
10420
10470
  try {
10421
10471
  await removeListed(client, await client.listManagedBackups(spec.kind), (b) => b.name, name, id, `database ${name}`, opts.yes ?? false);
@@ -10425,8 +10475,8 @@ var rmCommand20 = (spec) => new Command146("rm").alias("remove").description("re
10425
10475
  });
10426
10476
 
10427
10477
  // src/commands/managed/backup/schedule.ts
10428
- import { Command as Command147 } from "commander";
10429
- var scheduleCommand5 = (spec) => scheduleFlags(new Command147("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
10478
+ import { Command as Command148 } from "commander";
10479
+ var scheduleCommand5 = (spec) => scheduleFlags(new Command148("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
10430
10480
  async (name, flags, cmd) => {
10431
10481
  const change = changeOf(flags);
10432
10482
  const client = await managedClient(cmd);
@@ -10442,18 +10492,18 @@ var scheduleCommand5 = (spec) => scheduleFlags(new Command147("schedule").descri
10442
10492
 
10443
10493
  // src/commands/managed/backup/index.ts
10444
10494
  var backupCommand5 = (spec) => {
10445
- const command = new Command148("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
10495
+ const command = new Command149("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
10446
10496
  for (const make of [createCommand12, lsCommand22, restoreCommand5, rmCommand20, scheduleCommand5]) command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
10447
10497
  return command;
10448
10498
  };
10449
10499
 
10450
10500
  // src/commands/managed/create.ts
10451
- import { Command as Command149 } from "commander";
10501
+ import { Command as Command150 } from "commander";
10452
10502
  import { setTimeout as sleep5 } from "timers/promises";
10453
10503
  var READY_WAIT_MS2 = 9e4;
10454
10504
  var READY_STEP_MS = 2e3;
10455
10505
  var createCommand13 = (spec) => {
10456
- const command = new Command149("create").alias("new").description(`create a ${spec.title} database: a name is all it needs`).argument("<name>", "its name (1-12 chars, lowercase letters, digits and '-'); a linked box reaches it at <name>.<account>.kvbox");
10506
+ const command = new Command150("create").alias("new").description(`create a ${spec.title} database: a name is all it needs`).argument("<name>", "its name (1-12 chars, lowercase letters, digits and '-'); a linked box reaches it at <name>.<account>.kvbox");
10457
10507
  for (const o of spec.options) command.option(`--${o.name} <${o.arg}>`, o.help);
10458
10508
  return command.option("--password <password>", "its password (default: generated)").option("--storage <gb>", `storage for the data in GB (default: ${spec.storageGib}; it can grow later)`).option("--near <box>", "run it on the host of this box, so a link between them stays on that host").option("--from-backup <id>", `start it on this backup's data, a removed database's too (kvbox ${spec.command} backup ls)`).option("--json", "print it as JSON, password included").action(async (name, opts, cmd) => {
10459
10509
  const options = Object.fromEntries(spec.options.flatMap((o) => typeof opts[o.name] === "string" ? [[o.name, opts[o.name]]] : []));
@@ -10502,8 +10552,8 @@ var createCommand13 = (spec) => {
10502
10552
  };
10503
10553
 
10504
10554
  // src/commands/managed/grow.ts
10505
- import { Command as Command150 } from "commander";
10506
- var growCommand3 = (spec) => new Command150("grow").description("give a database more storage (it restarts once)").argument("<db>", "its name").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print as JSON").action(async (name, size, opts, cmd) => {
10555
+ import { Command as Command151 } from "commander";
10556
+ var growCommand3 = (spec) => new Command151("grow").description("give a database more storage (it restarts once)").argument("<db>", "its name").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print as JSON").action(async (name, size, opts, cmd) => {
10507
10557
  const storageGib = parseStorage(size, "size");
10508
10558
  const client = await managedClient(cmd);
10509
10559
  try {
@@ -10516,8 +10566,8 @@ var growCommand3 = (spec) => new Command150("grow").description("give a database
10516
10566
  });
10517
10567
 
10518
10568
  // src/commands/managed/info.ts
10519
- import { Command as Command151 } from "commander";
10520
- var infoCommand4 = (spec) => new Command151("info").alias("get").description("show one database: status, storage used, how to connect").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10569
+ import { Command as Command152 } from "commander";
10570
+ var infoCommand4 = (spec) => new Command152("info").alias("get").description("show one database: status, storage used, how to connect").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10521
10571
  const client = await managedClient(cmd);
10522
10572
  try {
10523
10573
  const m = await client.getManaged(spec.kind, name);
@@ -10529,8 +10579,8 @@ var infoCommand4 = (spec) => new Command151("info").alias("get").description("sh
10529
10579
  });
10530
10580
 
10531
10581
  // src/commands/managed/link.ts
10532
- import { Command as Command152 } from "commander";
10533
- var linkCommand3 = (spec) => new Command152("link").description("let a box reach a database privately").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10582
+ import { Command as Command153 } from "commander";
10583
+ var linkCommand3 = (spec) => new Command153("link").description("let a box reach a database privately").argument("<db>", "the database").argument("<box>", "the box that connects to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10534
10584
  const client = await managedClient(cmd);
10535
10585
  try {
10536
10586
  const m = await spin(`linking ${box2} to ${name}\u2026`, client.linkManaged(spec.kind, name, box2));
@@ -10546,7 +10596,7 @@ var linkCommand3 = (spec) => new Command152("link").description("let a box reach
10546
10596
  });
10547
10597
 
10548
10598
  // src/commands/managed/ls.ts
10549
- import { Command as Command153 } from "commander";
10599
+ import { Command as Command154 } from "commander";
10550
10600
  function listRows(items, user, kindColumn) {
10551
10601
  return items.map((m) => ({
10552
10602
  owner: m.owner === user ? "private" : m.owner,
@@ -10560,7 +10610,7 @@ function listRows(items, user, kindColumn) {
10560
10610
  created: age(m.createdAt)
10561
10611
  }));
10562
10612
  }
10563
- var lsCommand23 = (spec) => new Command153("ls").alias("list").description(spec ? `list your ${spec.title} databases` : "list every managed database, whatever its kind").option("-a, --all", "every one on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10613
+ var lsCommand23 = (spec) => new Command154("ls").alias("list").description(spec ? `list your ${spec.title} databases` : "list every managed database, whatever its kind").option("-a, --all", "every one on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
10564
10614
  const client = await managedClient(cmd);
10565
10615
  try {
10566
10616
  const items = await client.listManaged(spec?.kind, { all: opts.all });
@@ -10580,8 +10630,8 @@ var lsCommand23 = (spec) => new Command153("ls").alias("list").description(spec
10580
10630
  });
10581
10631
 
10582
10632
  // src/commands/managed/password.ts
10583
- import { Command as Command154 } from "commander";
10584
- var passwordCommand = (spec) => new Command154("password").description("show a database's password, or set a new one with --reset").argument("<db>", "its name").option("--reset", "make a new password; the old one stops working").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10633
+ import { Command as Command155 } from "commander";
10634
+ var passwordCommand = (spec) => new Command155("password").description("show a database's password, or set a new one with --reset").argument("<db>", "its name").option("--reset", "make a new password; the old one stops working").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10585
10635
  const client = await managedClient(cmd);
10586
10636
  try {
10587
10637
  const secret = opts.reset ? await spin(`setting a new password on ${name}\u2026`, client.resetManagedPassword(spec.kind, name)) : await client.managedPassword(spec.kind, name);
@@ -10597,8 +10647,8 @@ var passwordCommand = (spec) => new Command154("password").description("show a d
10597
10647
  });
10598
10648
 
10599
10649
  // src/commands/managed/public.ts
10600
- import { Command as Command155 } from "commander";
10601
- var publicCommand2 = (spec) => new Command155("public").description("open a database to the internet, or close it again").argument("<db>", "its name").argument("<state>", "on: reachable from anywhere with the password; off: only linked boxes").option("--json", "print as JSON").action(async (name, state, opts, cmd) => {
10650
+ import { Command as Command156 } from "commander";
10651
+ var publicCommand2 = (spec) => new Command156("public").description("open a database to the internet, or close it again").argument("<db>", "its name").argument("<state>", "on: reachable from anywhere with the password; off: only linked boxes").option("--json", "print as JSON").action(async (name, state, opts, cmd) => {
10602
10652
  if (state !== "on" && state !== "off") throw new KvboxError(`write on or off: kvbox ${spec.command} public ${name} on`);
10603
10653
  const client = await managedClient(cmd);
10604
10654
  try {
@@ -10619,8 +10669,8 @@ var publicCommand2 = (spec) => new Command155("public").description("open a data
10619
10669
  });
10620
10670
 
10621
10671
  // src/commands/managed/rm.ts
10622
- import { Command as Command156 } from "commander";
10623
- var rmCommand21 = (spec) => new Command156("rm").alias("remove").description("delete a database and all its data").argument("<db>", "its name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10672
+ import { Command as Command157 } from "commander";
10673
+ var rmCommand21 = (spec) => new Command157("rm").alias("remove").description("delete a database and all its data").argument("<db>", "its name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10624
10674
  const client = await managedClient(cmd);
10625
10675
  try {
10626
10676
  if (!await confirm(`Delete database ${name} and all its data? There is no backup.`, opts.yes ?? false)) {
@@ -10636,8 +10686,8 @@ var rmCommand21 = (spec) => new Command156("rm").alias("remove").description("de
10636
10686
  });
10637
10687
 
10638
10688
  // src/commands/managed/start.ts
10639
- import { Command as Command157 } from "commander";
10640
- var startCommand3 = (spec) => new Command157("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10689
+ import { Command as Command158 } from "commander";
10690
+ var startCommand3 = (spec) => new Command158("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10641
10691
  const client = await managedClient(cmd);
10642
10692
  try {
10643
10693
  const m = await spin(`starting ${name}\u2026`, client.startManaged(spec.kind, name));
@@ -10649,8 +10699,8 @@ var startCommand3 = (spec) => new Command157("start").description("run a stopped
10649
10699
  });
10650
10700
 
10651
10701
  // src/commands/managed/stop.ts
10652
- import { Command as Command158 } from "commander";
10653
- var stopCommand2 = (spec) => new Command158("stop").description("shut a database down, keeping its data (only its storage is charged)").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10702
+ import { Command as Command159 } from "commander";
10703
+ var stopCommand2 = (spec) => new Command159("stop").description("shut a database down, keeping its data (only its storage is charged)").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10654
10704
  const client = await managedClient(cmd);
10655
10705
  try {
10656
10706
  const m = await spin(`stopping ${name}\u2026`, client.stopManaged(spec.kind, name));
@@ -10662,8 +10712,8 @@ var stopCommand2 = (spec) => new Command158("stop").description("shut a database
10662
10712
  });
10663
10713
 
10664
10714
  // src/commands/managed/unlink.ts
10665
- import { Command as Command159 } from "commander";
10666
- var unlinkCommand3 = (spec) => new Command159("unlink").description("stop a box from reaching a database").argument("<db>", "the database").argument("<box>", "the box that was linked to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10715
+ import { Command as Command160 } from "commander";
10716
+ var unlinkCommand3 = (spec) => new Command160("unlink").description("stop a box from reaching a database").argument("<db>", "the database").argument("<box>", "the box that was linked to it").option("--json", "print as JSON").action(async (name, box2, opts, cmd) => {
10667
10717
  const client = await managedClient(cmd);
10668
10718
  try {
10669
10719
  const m = await spin(`unlinking ${box2} from ${name}\u2026`, client.unlinkManaged(spec.kind, name, box2));
@@ -10676,7 +10726,7 @@ var unlinkCommand3 = (spec) => new Command159("unlink").description("stop a box
10676
10726
 
10677
10727
  // src/commands/managed/kind.ts
10678
10728
  function kindCommand(spec, description) {
10679
- const command = new Command160(spec.command).aliases(spec.aliases).description(description);
10729
+ const command = new Command161(spec.command).aliases(spec.aliases).description(description);
10680
10730
  for (const make of [createCommand13, lsCommand23, infoCommand4, passwordCommand, publicCommand2, linkCommand3, unlinkCommand3, growCommand3, stopCommand2, startCommand3, rmCommand21]) {
10681
10731
  command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
10682
10732
  }
@@ -10691,14 +10741,14 @@ var pgCommand = kindCommand(POSTGRES2, "managed PostgreSQL: a database kvbox run
10691
10741
  var redisCommand = kindCommand(REDIS, "managed Redis (Valkey): a Redis kvbox runs for you, private until you link a box or make it public");
10692
10742
 
10693
10743
  // src/commands/managed/index.ts
10694
- import { Command as Command161 } from "commander";
10695
- var managedCommand = new Command161("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand23().option("--org <slug>", "act in this org (- for your personal databases)"));
10744
+ import { Command as Command162 } from "commander";
10745
+ var managedCommand = new Command162("managed").description(`databases kvbox runs for you, every kind together (${KINDS.map((k) => `${k.title}: kvbox ${k.command}`).join(", ")})`).addCommand(lsCommand23().option("--org <slug>", "act in this org (- for your personal databases)"));
10696
10746
 
10697
10747
  // src/commands/env/index.ts
10698
- import { Command as Command165 } from "commander";
10748
+ import { Command as Command166 } from "commander";
10699
10749
 
10700
10750
  // src/commands/env/ls.ts
10701
- import { Command as Command162 } from "commander";
10751
+ import { Command as Command163 } from "commander";
10702
10752
 
10703
10753
  // src/commands/env/shared.ts
10704
10754
  function requireCloud5(client) {
@@ -10725,7 +10775,7 @@ function firstBootHint(box2, name) {
10725
10775
  }
10726
10776
 
10727
10777
  // src/commands/env/ls.ts
10728
- var lsCommand24 = new Command162("ls").alias("list").description("list the variables (a secret shows as (sealed))").option("--box <box>", "what this box gets: its own variables and the ones it inherits").option("--json", "print as JSON").action(async (opts, cmd) => {
10778
+ var lsCommand24 = new Command163("ls").alias("list").description("list the variables (a secret shows as (sealed))").option("--box <box>", "what this box gets: its own variables and the ones it inherits").option("--json", "print as JSON").action(async (opts, cmd) => {
10729
10779
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10730
10780
  try {
10731
10781
  if (opts.box !== void 0) {
@@ -10764,8 +10814,8 @@ var lsCommand24 = new Command162("ls").alias("list").description("list the varia
10764
10814
  });
10765
10815
 
10766
10816
  // src/commands/env/rm.ts
10767
- import { Command as Command163 } from "commander";
10768
- var rmCommand22 = new Command163("rm").alias("remove").description("remove variables; boxes lose them when they next start").argument("<names...>", "variable names").option("-y, --yes", "do not ask for confirmation").option("--box <box>", "remove this box's own variables (yours, or the org's, of the same name come back)").option("--json", "print as JSON").action(async (names2, opts, cmd) => {
10817
+ import { Command as Command164 } from "commander";
10818
+ var rmCommand22 = new Command164("rm").alias("remove").description("remove variables; boxes lose them when they next start").argument("<names...>", "variable names").option("-y, --yes", "do not ask for confirmation").option("--box <box>", "remove this box's own variables (yours, or the org's, of the same name come back)").option("--json", "print as JSON").action(async (names2, opts, cmd) => {
10769
10819
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10770
10820
  try {
10771
10821
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
@@ -10802,8 +10852,8 @@ var rmCommand22 = new Command163("rm").alias("remove").description("remove varia
10802
10852
  });
10803
10853
 
10804
10854
  // src/commands/env/set.ts
10805
- import { Command as Command164 } from "commander";
10806
- var setCommand2 = new Command164("set").description("add or change a variable; boxes get it when they next start").argument("[name]", "variable name, e.g. DATABASE_URL (asked for when left out)").argument("[value]", "its value (asked for when left out; hidden with --secret)").option("--secret", "write-only: the value is never shown again, by any command").option("--box <box>", "this box's own variable, over yours (or the org's) of the same name").option("--json", "print as JSON").action(async (nameArg, valueArg, opts, cmd) => {
10855
+ import { Command as Command165 } from "commander";
10856
+ var setCommand2 = new Command165("set").description("add or change a variable; boxes get it when they next start").argument("[name]", "variable name, e.g. DATABASE_URL (asked for when left out)").argument("[value]", "its value (asked for when left out; hidden with --secret)").option("--secret", "write-only: the value is never shown again, by any command").option("--box <box>", "this box's own variable, over yours (or the org's) of the same name").option("--json", "print as JSON").action(async (nameArg, valueArg, opts, cmd) => {
10807
10857
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10808
10858
  try {
10809
10859
  const owner = opts.box === void 0 ? requireCloud5(client) : void 0;
@@ -10840,15 +10890,15 @@ var setCommand2 = new Command164("set").description("add or change a variable; b
10840
10890
  });
10841
10891
 
10842
10892
  // src/commands/env/index.ts
10843
- var envCommand = new Command165("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand24, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand22);
10893
+ var envCommand = new Command166("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand24, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand22);
10844
10894
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
10845
10895
 
10846
10896
  // src/commands/domain/index.ts
10847
- import { Command as Command169 } from "commander";
10897
+ import { Command as Command170 } from "commander";
10848
10898
 
10849
10899
  // src/commands/domain/add.ts
10850
- import { Command as Command166 } from "commander";
10851
- var addCommand6 = new Command166("add").description("serve a box at a domain of your own, https://<domain>, with its certificate made for you").argument("<domain>", "a domain you control, like example.com or app.example.com").argument("<box>", "box name").option("--port <port>", "the box port the domain serves (default: the port of its kvbox.app address)").option("--json", "print the domain as JSON").action(async (domainArg, name, opts, cmd) => {
10900
+ import { Command as Command167 } from "commander";
10901
+ var addCommand6 = new Command167("add").description("serve a box at a domain of your own, https://<domain>, with its certificate made for you").argument("<domain>", "a domain you control, like example.com or app.example.com").argument("<box>", "box name").option("--port <port>", "the box port the domain serves (default: the port of its kvbox.app address)").option("--json", "print the domain as JSON").action(async (domainArg, name, opts, cmd) => {
10852
10902
  const domain = assertDomain(domainArg.trim().toLowerCase());
10853
10903
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
10854
10904
  const client = await clientFor(cmd.optsWithGlobals());
@@ -10884,8 +10934,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
10884
10934
  });
10885
10935
 
10886
10936
  // src/commands/domain/ls.ts
10887
- import { Command as Command167 } from "commander";
10888
- var lsCommand25 = new Command167("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
10937
+ import { Command as Command168 } from "commander";
10938
+ var lsCommand25 = new Command168("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
10889
10939
  const client = await clientFor(cmd.optsWithGlobals());
10890
10940
  try {
10891
10941
  requireCloud4(client);
@@ -10914,8 +10964,8 @@ var lsCommand25 = new Command167("ls").alias("list").description("list your cust
10914
10964
  });
10915
10965
 
10916
10966
  // src/commands/domain/rm.ts
10917
- import { Command as Command168 } from "commander";
10918
- var rmCommand23 = new Command168("rm").alias("remove").description("stop serving a box at a custom domain").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (domainArg, opts, cmd) => {
10967
+ import { Command as Command169 } from "commander";
10968
+ var rmCommand23 = new Command169("rm").alias("remove").description("stop serving a box at a custom domain").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (domainArg, opts, cmd) => {
10919
10969
  const domain = domainArg.trim().toLowerCase();
10920
10970
  const client = await clientFor(cmd.optsWithGlobals());
10921
10971
  try {
@@ -10936,7 +10986,7 @@ var rmCommand23 = new Command168("rm").alias("remove").description("stop serving
10936
10986
  });
10937
10987
 
10938
10988
  // src/commands/domain/index.ts
10939
- var domainCommand2 = new Command169("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand6).addCommand(lsCommand25).addCommand(rmCommand23);
10989
+ var domainCommand2 = new Command170("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand6).addCommand(lsCommand25).addCommand(rmCommand23);
10940
10990
  for (const cmd of domainCommand2.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
10941
10991
 
10942
10992
  // src/commands/update.ts
@@ -10944,7 +10994,7 @@ import { spawn as spawn8 } from "child_process";
10944
10994
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
10945
10995
  import { tmpdir } from "os";
10946
10996
  import { join as join9 } from "path";
10947
- import { Command as Command170 } from "commander";
10997
+ import { Command as Command171 } from "commander";
10948
10998
 
10949
10999
  // src/update.ts
10950
11000
  import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
@@ -11063,7 +11113,7 @@ function run2(cmd, args) {
11063
11113
  child.on("exit", (code, signal) => resolve4(code ?? (signal ? 1 : 0)));
11064
11114
  });
11065
11115
  }
11066
- var selfUpdateCommand = new Command170("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
11116
+ var selfUpdateCommand = new Command171("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
11067
11117
  suppressUpdateNotice();
11068
11118
  const inst = installerFor(process.platform, process.env["KVBOX_INSTALL_URL"] || INSTALL_BASE);
11069
11119
  let code;
@@ -11087,7 +11137,7 @@ var selfUpdateCommand = new Command170("update").description("update kvbox to th
11087
11137
  import { chmod as chmod2, mkdir as mkdir4, readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
11088
11138
  import { homedir as homedir2 } from "os";
11089
11139
  import { dirname as dirname2, join as join11 } from "path";
11090
- import { Command as Command171 } from "commander";
11140
+ import { Command as Command172 } from "commander";
11091
11141
 
11092
11142
  // src/sshConfig.ts
11093
11143
  import { spawnSync as spawnSync4 } from "child_process";
@@ -11209,7 +11259,7 @@ async function forgetReplacedBox(alias, id, p) {
11209
11259
  }
11210
11260
 
11211
11261
  // src/commands/sshConfig.ts
11212
- var sshConfigCommand = new Command171("ssh-config").description("add your boxes to ~/.ssh/config, so ssh and VS Code Remote-SSH reach them as <box>.kvbox").argument("[box...]", "only these boxes, added to the ones listed already (default: every box)").option("--remove", "take these boxes off the list; with no box, take the whole kvbox block out").option("--file <path>", "the ssh config file to write (default: ~/.ssh/config)").option("--json", "print the result as JSON").action(async (boxes, opts, cmd) => {
11262
+ var sshConfigCommand = new Command172("ssh-config").description("add your boxes to ~/.ssh/config, so ssh and VS Code Remote-SSH reach them as <box>.kvbox").argument("[box...]", "only these boxes, added to the ones listed already (default: every box)").option("--remove", "take these boxes off the list; with no box, take the whole kvbox block out").option("--file <path>", "the ssh config file to write (default: ~/.ssh/config)").option("--json", "print the result as JSON").action(async (boxes, opts, cmd) => {
11213
11263
  const file = opts.file ?? join11(homedir2(), ".ssh", "config");
11214
11264
  const before = await readFile9(file, "utf8").catch((err) => {
11215
11265
  if (err.code === "ENOENT") return "";
@@ -11275,8 +11325,8 @@ async function aliasesOf(client, boxes, gone) {
11275
11325
 
11276
11326
  // src/commands/sshProxy.ts
11277
11327
  import { connect } from "net";
11278
- import { Command as Command172 } from "commander";
11279
- var sshProxyCommand = new Command172("ssh-proxy").description("connect ssh to a box (used by kvbox ssh-config)").argument("<host>", "the ssh name: <box>.kvbox or <box>.<org>.kvbox").option("--renew", "only renew the SSH certificate if it is about to expire").action(async (host, opts, cmd) => {
11328
+ import { Command as Command173 } from "commander";
11329
+ var sshProxyCommand = new Command173("ssh-proxy").description("connect ssh to a box (used by kvbox ssh-config)").argument("<host>", "the ssh name: <box>.kvbox or <box>.<org>.kvbox").option("--renew", "only renew the SSH certificate if it is about to expire").action(async (host, opts, cmd) => {
11280
11330
  const ref = parseAlias(host);
11281
11331
  if (ref === void 0) throw new KvboxError(`${host}: not a kvbox name (<box>.kvbox or <box>.<org>.kvbox)`);
11282
11332
  const client = await clientFor(cmd.optsWithGlobals());
@@ -11439,7 +11489,7 @@ function installRootHelp(program) {
11439
11489
 
11440
11490
  // src/program.ts
11441
11491
  function buildProgram() {
11442
- const program = new Command173("kvbox").description("self-hosted Firecracker microVMs with Docker-like ergonomics").version(VERSION, "-v, --version").option("--local", "use this machine's kvbox-server over its socket, ignoring kvbox login and KVBOX_TOKEN").option("--org <slug>", "the org: where kvbox new creates, and which box a name means when it is not one of yours; before the command here, or after it").showHelpAfterError().enablePositionalOptions();
11492
+ const program = new Command174("kvbox").description("self-hosted Firecracker microVMs with Docker-like ergonomics").version(VERSION, "-v, --version").option("--local", "use this machine's kvbox-server over its socket, ignoring kvbox login and KVBOX_TOKEN").option("--org <slug>", "the org: where kvbox new creates, and which box a name means when it is not one of yours; before the command here, or after it").showHelpAfterError().enablePositionalOptions();
11443
11493
  program.addCommand(vmCommand);
11444
11494
  program.addCommand(snapshotsCommand);
11445
11495
  program.addCommand(volumeCommand);