@kvbox/cli 0.5.14 → 0.5.16

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
@@ -162,7 +162,7 @@ function versionOf(srcFileUrl, injected) {
162
162
  }
163
163
 
164
164
  // src/version.ts
165
- var VERSION = versionOf(import.meta.url, true ? "0.5.14" : void 0);
165
+ var VERSION = versionOf(import.meta.url, true ? "0.5.16" : void 0);
166
166
 
167
167
  // src/commands/vm/index.ts
168
168
  import { Command as Command24 } from "commander";
@@ -1413,7 +1413,7 @@ function addressOf(b) {
1413
1413
  var lsCommand = new Command5("ls").description("list boxes with status and address (yours and your orgs'; --org <slug> for one org)").option("-a, --all", "every box on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
1414
1414
  const client = await clientFor(cmd.optsWithGlobals());
1415
1415
  try {
1416
- const boxes = await client.listMachines({ all: opts.all });
1416
+ const boxes = await spin("listing boxes\u2026", client.listMachines({ all: opts.all }));
1417
1417
  if (opts.json) {
1418
1418
  json(boxes);
1419
1419
  return;
@@ -1453,10 +1453,7 @@ var pauseCommand = new Command6("pause").description("freeze a box in place (mem
1453
1453
  }
1454
1454
  });
1455
1455
 
1456
- // src/commands/vm/proxy/index.ts
1457
- import { Command as Command13 } from "commander";
1458
-
1459
- // src/commands/vm/proxy/add.ts
1456
+ // src/commands/vm/proxy/claim.ts
1460
1457
  import { Command as Command7 } from "commander";
1461
1458
 
1462
1459
  // ../shared/src/names.ts
@@ -1542,8 +1539,35 @@ async function findBox(client, text) {
1542
1539
  return found;
1543
1540
  }
1544
1541
 
1542
+ // src/commands/vm/proxy/claim.ts
1543
+ var claimCommand = new Command7("claim").description("give a box its HTTPS address, https://<subdomain>.kvbox.app, serving one of its ports").argument("<box>", "box name").argument("<subdomain>", "3-63 lowercase letters, digits and '-'; must be free").requiredOption("--port <port>", "the box port the address serves").option("--json", "print the subdomain as JSON").action(async (name, subdomain, opts, cmd) => {
1544
+ assertSubdomain(subdomain);
1545
+ const [port] = parsePorts([opts.port]);
1546
+ const client = await clientFor(cmd.optsWithGlobals());
1547
+ try {
1548
+ requireCloud(client);
1549
+ const user = me(client);
1550
+ const found = await findBox(client, name);
1551
+ const box = displayName(found, user);
1552
+ const sub = await spin(`claiming ${subdomain}\u2026`, client.claimSubdomain(box, { name: subdomain, port }));
1553
+ if (opts.json) {
1554
+ json(subdomainJson(sub, me(client)));
1555
+ return;
1556
+ }
1557
+ info(`${color.green("\u2713")} ${color.bold(sub.url)} \u2192 box ${color.bold(box)} port ${sub.port}`);
1558
+ info(` more ports under it: kvbox vm proxy add ${box} <port> --name <name> \u2192 https://<name>.${sub.url.replace(/^https:\/\//, "")}`);
1559
+ if (found.status !== "running") info(` box ${box} is ${found.status}: the address answers once it runs`);
1560
+ } finally {
1561
+ await client.close();
1562
+ }
1563
+ });
1564
+
1565
+ // src/commands/vm/proxy/index.ts
1566
+ import { Command as Command13 } from "commander";
1567
+
1545
1568
  // src/commands/vm/proxy/add.ts
1546
- var addCommand = new Command7("add").description("publish box ports on the internet; each gets a random public port, or an HTTPS name with --name").argument("<box>", "box name").argument("<port...>", "ports inside the box, e.g. 3000 8080").option("--udp", "UDP instead of TCP").option("--name <name>", "serve the port at https://<name>.<subdomain>.kvbox.app (one port; needs kvbox vm proxy claim first)").option("--json", "print the new forwards as JSON").action(async (name, portTexts, opts, cmd) => {
1569
+ import { Command as Command8 } from "commander";
1570
+ var addCommand = new Command8("add").description("publish box ports on the internet; each gets a random public port, or an HTTPS name with --name").argument("<box>", "box name").argument("<port...>", "ports inside the box, e.g. 3000 8080").option("--udp", "UDP instead of TCP").option("--name <name>", "serve the port at https://<name>.<subdomain>.kvbox.app (one port; needs kvbox vm proxy claim first)").option("--json", "print the new forwards as JSON").action(async (name, portTexts, opts, cmd) => {
1547
1571
  const guestPorts = parsePorts(portTexts);
1548
1572
  if (opts.name !== void 0) {
1549
1573
  assertRouteName(opts.name);
@@ -1583,30 +1607,6 @@ var addCommand = new Command7("add").description("publish box ports on the inter
1583
1607
  }
1584
1608
  });
1585
1609
 
1586
- // src/commands/vm/proxy/claim.ts
1587
- import { Command as Command8 } from "commander";
1588
- var claimCommand = new Command8("claim").description("give a box its HTTPS address, https://<subdomain>.kvbox.app, serving one of its ports").argument("<box>", "box name").argument("<subdomain>", "3-63 lowercase letters, digits and '-'; must be free").requiredOption("--port <port>", "the box port the address serves").option("--json", "print the subdomain as JSON").action(async (name, subdomain, opts, cmd) => {
1589
- assertSubdomain(subdomain);
1590
- const [port] = parsePorts([opts.port]);
1591
- const client = await clientFor(cmd.optsWithGlobals());
1592
- try {
1593
- requireCloud(client);
1594
- const user = me(client);
1595
- const found = await findBox(client, name);
1596
- const box = displayName(found, user);
1597
- const sub = await spin(`claiming ${subdomain}\u2026`, client.claimSubdomain(box, { name: subdomain, port }));
1598
- if (opts.json) {
1599
- json(subdomainJson(sub, me(client)));
1600
- return;
1601
- }
1602
- info(`${color.green("\u2713")} ${color.bold(sub.url)} \u2192 box ${color.bold(box)} port ${sub.port}`);
1603
- info(` more ports under it: kvbox vm proxy add ${box} <port> --name <name> \u2192 https://<name>.${sub.url.replace(/^https:\/\//, "")}`);
1604
- if (found.status !== "running") info(` box ${box} is ${found.status}: the address answers once it runs`);
1605
- } finally {
1606
- await client.close();
1607
- }
1608
- });
1609
-
1610
1610
  // src/commands/vm/proxy/ls.ts
1611
1611
  import { Command as Command9 } from "commander";
1612
1612
  async function subdomainsOf(client) {
@@ -1991,7 +1991,7 @@ var wakeCommand = new Command23("wake").description("continue a hibernated box w
1991
1991
  // src/commands/vm/index.ts
1992
1992
  var vmCommand = new Command24("vm").enablePositionalOptions().description("manage boxes (each one is a Firecracker microVM)").addCommand(newCommand).addCommand(lsCommand).addCommand(connectCommand).addCommand(execCommand).addCommand(stopCommand).addCommand(startCommand).addCommand(pauseCommand).addCommand(resumeCommand).addCommand(hibernateCommand).addCommand(wakeCommand).addCommand(updateCommand).addCommand(rescaleCommand).addCommand(setCommand).addCommand(usageCommand).addCommand(topCommand).addCommand(proxyCommand).addCommand(rmCommand2);
1993
1993
  for (const cmd of vmCommand.commands) if (cmd !== proxyCommand) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
1994
- var vmAliases = [newCommand, lsCommand, connectCommand, execCommand, stopCommand, startCommand, pauseCommand, resumeCommand, hibernateCommand, wakeCommand, rmCommand2];
1994
+ var vmAliases = [newCommand, lsCommand, connectCommand, execCommand, stopCommand, startCommand, pauseCommand, resumeCommand, hibernateCommand, wakeCommand, rmCommand2, claimCommand];
1995
1995
 
1996
1996
  // src/commands/server/index.ts
1997
1997
  import { Command as Command32 } from "commander";