@kvbox/cli 0.6.25 → 0.6.26

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 Command174 } from "commander";
158
+ import { Command as Command180 } 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.25" : void 0);
173
+ var VERSION = versionOf(import.meta.url, true ? "0.6.26" : void 0);
174
174
 
175
175
  // src/commands/vm/index.ts
176
176
  import { Command as Command44 } from "commander";
@@ -1107,7 +1107,13 @@ var CapacitySchema = z2.object({
1107
1107
  /** True on a host whose network puts the boxes of one cluster in reach of each other (#215); the control plane places a cluster's box only on such a host. */
1108
1108
  clusters: z2.boolean().optional(),
1109
1109
  /** The integrations this kvbox-server knows (`hostKnowsIntegrations`). Absent with `integrations`: the first one's, `github` alone. */
1110
- integrationIds: z2.array(z2.string()).optional()
1110
+ integrationIds: z2.array(z2.string()).optional(),
1111
+ /** True on a host that can take a box range of its own (#240): its privileged network script widens a network that is up. */
1112
+ ranges: z2.boolean().optional(),
1113
+ /** The range the host gives its boxes now (`172.30.4.0/24`, config.json `boxRange`); absent while it has none. */
1114
+ boxRange: z2.string().optional(),
1115
+ /** Boxes of the host whose address is still outside `boxRange`: each moves at its next cold start. Absent without a range. */
1116
+ offRange: z2.number().int().optional()
1111
1117
  });
1112
1118
  var ImageSchema = z2.object({ name: z2.string(), version: z2.string().nullable() });
1113
1119
  var ImageIndexSchema = z2.object({
@@ -1299,6 +1305,8 @@ var UsageDaySchema = z2.object({
1299
1305
  volumes: z2.array(UsageDayItemSchema),
1300
1306
  /** Object storage that existed that day (#182); absent on a day without any. */
1301
1307
  storage: z2.array(UsageDayItemSchema).optional(),
1308
+ /** A container registry that existed that day (#234); absent on a day without any. */
1309
+ registry: z2.array(UsageDayItemSchema).optional(),
1302
1310
  /** Cron services that existed that day (#190); absent on a day without any. */
1303
1311
  cron: z2.array(UsageDayItemSchema).optional(),
1304
1312
  /** Kubernetes clusters that existed that day (#222), each with its master and nodes together; absent on a day without any. */
@@ -1317,6 +1325,11 @@ var UsageReportSchema = z2.object({
1317
1325
  * included ones, `sizeGib` its whole size. Absent when there is none.
1318
1326
  */
1319
1327
  storage: z2.array(VolumeUsageSchema).optional(),
1328
+ /**
1329
+ * Container registries (#234, control plane only): one row per registry a slug has or had, shaped and
1330
+ * priced like `storage` with the registry's prices. Absent when there is none.
1331
+ */
1332
+ registry: z2.array(VolumeUsageSchema).optional(),
1320
1333
  /** Cron services (#190, control plane only): one row per service a slug has or had. Absent when there is none. */
1321
1334
  cron: z2.array(CronUsageSchema).optional(),
1322
1335
  /**
@@ -1335,7 +1348,7 @@ var UsageReportSchema = z2.object({
1335
1348
  diskGibHours: z2.number(),
1336
1349
  volumeHours: z2.number().optional(),
1337
1350
  volumeGibHours: z2.number().optional(),
1338
- /** Boxes, volumes, object storage, cron services, Kubernetes clusters and paid backups together; the hours above are those of `boxes` and `volumes` alone. */
1351
+ /** Boxes, volumes, object storage, container registries, cron services, Kubernetes clusters and paid backups together; the hours above are those of `boxes` and `volumes` alone. */
1339
1352
  cost: z2.object({ amount: z2.number(), currency: z2.string() }).optional()
1340
1353
  })
1341
1354
  });
@@ -1607,6 +1620,9 @@ var SshCaResponseSchema = z2.object({
1607
1620
  var HostSshCaResponseSchema = z2.object({
1608
1621
  publicKey: z2.string()
1609
1622
  });
1623
+ var HostRangeResponseSchema = z2.object({
1624
+ range: z2.string().nullable()
1625
+ });
1610
1626
  var CloudCaSchema = z2.object({
1611
1627
  controlPlane: z2.string(),
1612
1628
  publicKey: z2.string(),
@@ -1636,7 +1652,12 @@ var HostJoinRequestSchema = z2.object({
1636
1652
  fingerprint: z2.string().regex(/^([0-9A-F]{2}:){31}[0-9A-F]{2}$/),
1637
1653
  publicAddress: z2.string().min(1),
1638
1654
  /** Where the host is (`kvbox-server join --country`): a code or an English name. */
1639
- country: z2.string().optional()
1655
+ country: z2.string().optional(),
1656
+ /**
1657
+ * The box range this host already has boxes on (config.json `boxRange`, kept across a leave), which it
1658
+ * never gives up: the join gives it back, or is refused while it is another host's (#240).
1659
+ */
1660
+ boxRange: z2.string().optional()
1640
1661
  });
1641
1662
  var HostJoinResponseSchema = z2.object({
1642
1663
  hostSecret: z2.string(),
@@ -1654,14 +1675,20 @@ var CloudHostSchema = z2.object({
1654
1675
  /** The S3 region a storage made on this host answers to (`ro-west-1`); null: it takes no storage. */
1655
1676
  region: z2.string().nullable(),
1656
1677
  /** kvbox-server's version as of the poller's last look (`capacity.version`); null before one, or for a server older than 0.5.45. */
1657
- version: z2.string().nullable()
1678
+ version: z2.string().nullable(),
1679
+ /**
1680
+ * The range of box addresses that is this host's alone (#240, `172.30.4.0/24`): the next free one at join,
1681
+ * or the admin's. Null: a host from before ranges that nobody gave one; its boxes are on `172.30.0.x` like
1682
+ * every such host's. What the host has taken of it is `capacity.boxRange`.
1683
+ */
1684
+ boxRange: z2.string().nullable()
1658
1685
  });
1659
1686
  var HostInfoSchema = z2.object({
1660
1687
  host: CloudHostSchema,
1661
1688
  health: HealthSchema.nullable(),
1662
1689
  error: z2.string().nullable()
1663
1690
  });
1664
- var HostPatchRequest = z2.object({ country: z2.string().nullable().optional(), region: z2.string().nullable().optional() }).refine((b) => b.country !== void 0 || b.region !== void 0, { message: "give country, region or both" });
1691
+ var HostPatchRequest = z2.object({ country: z2.string().nullable().optional(), region: z2.string().nullable().optional(), boxRange: z2.string().nullable().optional() }).refine((b) => b.country !== void 0 || b.region !== void 0 || b.boxRange !== void 0, { message: "give country, region or boxRange" });
1665
1692
  var CountrySchema = z2.object({ code: z2.string(), name: z2.string() });
1666
1693
 
1667
1694
  // src/session.ts
@@ -1867,6 +1894,14 @@ var PricingSchema = z4.object({
1867
1894
  storageHour: z4.number().nonnegative().default(0),
1868
1895
  storageGibHour: z4.number().nonnegative().default(0),
1869
1896
  storageIncludedGib: z4.number().int().nonnegative().default(0),
1897
+ /**
1898
+ * The container registry (#234): priced as object storage is. An hour of a slug's registry existing,
1899
+ * whatever it holds, covers its hidden box and the first `registryIncludedGib` of its size; each GiB
1900
+ * above that is `registryGibHour`. A price list from before the registry charges nothing for it.
1901
+ */
1902
+ registryHour: z4.number().nonnegative().default(0),
1903
+ registryGibHour: z4.number().nonnegative().default(0),
1904
+ registryIncludedGib: z4.number().int().nonnegative().default(0),
1870
1905
  /** The cron service (#190): an hour of one cron service existing, whatever it holds or fires. A price list from before it charges nothing. */
1871
1906
  cronHour: z4.number().nonnegative().default(0),
1872
1907
  /**
@@ -3019,7 +3054,7 @@ var Kvbox = class {
3019
3054
  };
3020
3055
 
3021
3056
  // src/client.ts
3022
- import { z as z17 } from "zod";
3057
+ import { z as z18 } from "zod";
3023
3058
 
3024
3059
  // ../shared/src/cron.ts
3025
3060
  import { z as z15 } from "zod";
@@ -3274,6 +3309,47 @@ var DeletedObjectsSchema = z16.object({
3274
3309
  var MoveObjectRequest = z16.object({ from: z16.string(), to: z16.string(), overwrite: z16.boolean().optional() });
3275
3310
  var CreateFolderRequest = z16.object({ prefix: z16.string() });
3276
3311
 
3312
+ // ../shared/src/registry.ts
3313
+ import { z as z17 } from "zod";
3314
+ var RegistrySchema = z17.object({
3315
+ owner: z17.string(),
3316
+ ownerKind: z17.enum(["user", "org"]),
3317
+ /** `cr-<slug>.<domain>`: what `docker login` and an image's name take (no scheme). Null while the address is not claimed. */
3318
+ address: z17.string().nullable(),
3319
+ /** The login's user name. */
3320
+ user: z17.string(),
3321
+ /** The most it may hold. */
3322
+ sizeGib: z17.number().int(),
3323
+ /** `running` when it answers; `unknown` while its host is not heard from. */
3324
+ status: BoxStatusSchema,
3325
+ /** With `?live=1` or on `GET /registry/info`, when the registry answered: what is on its disk, and the disk's real size. */
3326
+ usedBytes: z17.number().optional(),
3327
+ totalBytes: z17.number().optional(),
3328
+ /** The same, when it answered: every repository with how many tags it has. */
3329
+ repositories: z17.array(z17.object({ name: z17.string(), tags: z17.number().int() })).optional(),
3330
+ /** There are more repositories than `repositories` lists. */
3331
+ repositoriesTruncated: z17.boolean().optional(),
3332
+ /** zot's version, when it answered. */
3333
+ version: z17.string().optional(),
3334
+ host: z17.string(),
3335
+ country: z17.string().optional(),
3336
+ price: z17.object({ perMonth: z17.number(), currency: z17.string() }),
3337
+ createdBy: z17.string().nullable(),
3338
+ createdAt: z17.string()
3339
+ });
3340
+ var CreateRegistryRequest = z17.object({
3341
+ sizeGib: z17.number().int().optional(),
3342
+ near: z17.string().optional()
3343
+ });
3344
+ var RegistrySecretSchema = z17.object({
3345
+ address: z17.string().nullable(),
3346
+ user: z17.string(),
3347
+ password: z17.string()
3348
+ });
3349
+ var CreatedRegistrySchema = RegistrySchema.extend({ secret: RegistrySecretSchema, ready: z17.boolean() });
3350
+ var ResetRegistryPasswordRequest = z17.object({}).strict();
3351
+ var GrowRegistryRequest = z17.object({ sizeGib: z17.number().int() });
3352
+
3277
3353
  // src/kvm.ts
3278
3354
  import { accessSync, constants, readFileSync, statSync } from "fs";
3279
3355
  import { userInfo } from "os";
@@ -3442,7 +3518,7 @@ var ServerClient = class {
3442
3518
  * `all`: every box on the platform (platform admins only, #78).
3443
3519
  */
3444
3520
  listMachines(opts = {}) {
3445
- return this.call("GET", `/machines${allQuery(opts)}`, z17.array(MachineSchema), void 0, opts.org);
3521
+ return this.call("GET", `/machines${allQuery(opts)}`, z18.array(MachineSchema), void 0, opts.org);
3446
3522
  }
3447
3523
  createMachine(req) {
3448
3524
  return this.call("POST", "/machines", MachineSchema, req, void 0, req.fromBackup !== void 0 ? 2 * 36e5 : void 0);
@@ -3500,10 +3576,10 @@ var ServerClient = class {
3500
3576
  }
3501
3577
  /** Backups, the control plane's only: a box's disk in object storage. Newest first. */
3502
3578
  listBackups() {
3503
- return this.call("GET", "/backups", z17.array(BackupSchema));
3579
+ return this.call("GET", "/backups", z18.array(BackupSchema));
3504
3580
  }
3505
3581
  boxBackups(name) {
3506
- return this.call("GET", `/machines/${encodeURIComponent(name)}/backups`, z17.array(BackupSchema));
3582
+ return this.call("GET", `/machines/${encodeURIComponent(name)}/backups`, z18.array(BackupSchema));
3507
3583
  }
3508
3584
  boxBackup(name, id) {
3509
3585
  return this.call("GET", `/machines/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}`, BackupSchema);
@@ -3525,14 +3601,14 @@ var ServerClient = class {
3525
3601
  * later. Works for a backup whose box, volume or database is gone too.
3526
3602
  */
3527
3603
  removeBackup(id) {
3528
- return this.call("DELETE", `/backups/${encodeURIComponent(id)}`, z17.undefined());
3604
+ return this.call("DELETE", `/backups/${encodeURIComponent(id)}`, z18.undefined());
3529
3605
  }
3530
3606
  /** A volume's backups (#168): the same as a box's, of the volume's disk. Newest first. */
3531
3607
  listVolumeBackups() {
3532
- return this.call("GET", "/backups?kind=volume", z17.array(VolumeBackupSchema));
3608
+ return this.call("GET", "/backups?kind=volume", z18.array(VolumeBackupSchema));
3533
3609
  }
3534
3610
  volumeBackups(name) {
3535
- return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups`, z17.array(VolumeBackupSchema));
3611
+ return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups`, z18.array(VolumeBackupSchema));
3536
3612
  }
3537
3613
  volumeBackup(name, id) {
3538
3614
  return this.call("GET", `/volumes/${encodeURIComponent(name)}/backups/${encodeURIComponent(id)}`, VolumeBackupSchema);
@@ -3558,7 +3634,7 @@ var ServerClient = class {
3558
3634
  }
3559
3635
  /** Wake hooks (#101), the control plane's only: a URL and a secret that wake the box. */
3560
3636
  boxHooks(name) {
3561
- return this.call("GET", `/machines/${encodeURIComponent(name)}/hooks`, z17.array(WakeHookSchema));
3637
+ return this.call("GET", `/machines/${encodeURIComponent(name)}/hooks`, z18.array(WakeHookSchema));
3562
3638
  }
3563
3639
  createBoxHook(name) {
3564
3640
  return this.call("POST", `/machines/${encodeURIComponent(name)}/hooks`, CreatedWakeHookSchema);
@@ -3586,7 +3662,7 @@ var ServerClient = class {
3586
3662
  }
3587
3663
  /** Every readable box's subdomains, one entry each. */
3588
3664
  listSubdomains() {
3589
- return this.call("GET", "/subdomains", z17.array(SubdomainSchema));
3665
+ return this.call("GET", "/subdomains", z18.array(SubdomainSchema));
3590
3666
  }
3591
3667
  /** Custom domains (#89), the control plane's only: serve the box at the user's own name. */
3592
3668
  addDomain(name, req) {
@@ -3597,7 +3673,7 @@ var ServerClient = class {
3597
3673
  }
3598
3674
  /** Every readable box's custom domains. */
3599
3675
  listDomains() {
3600
- return this.call("GET", "/domains", z17.array(DomainSchema));
3676
+ return this.call("GET", "/domains", z18.array(DomainSchema));
3601
3677
  }
3602
3678
  /** A running box's own load, memory and disk, asked of its guest (#67). */
3603
3679
  machineStats(name) {
@@ -3638,22 +3714,22 @@ var ServerClient = class {
3638
3714
  return this.call("POST", "/billing/redeem", RedeemResponseSchema, { code });
3639
3715
  }
3640
3716
  deleteMachine(name) {
3641
- return this.call("DELETE", `/machines/${encodeURIComponent(name)}`, z17.undefined());
3717
+ return this.call("DELETE", `/machines/${encodeURIComponent(name)}`, z18.undefined());
3642
3718
  }
3643
3719
  /** Like `listMachines`, for snapshots. */
3644
3720
  listSnapshots(opts = {}) {
3645
- return this.call("GET", `/snapshots${allQuery(opts)}`, z17.array(SnapshotSchema), void 0, opts.org);
3721
+ return this.call("GET", `/snapshots${allQuery(opts)}`, z18.array(SnapshotSchema), void 0, opts.org);
3646
3722
  }
3647
3723
  createSnapshot(req) {
3648
3724
  return this.call("POST", "/snapshots", SnapshotSchema, req);
3649
3725
  }
3650
3726
  deleteSnapshot(name) {
3651
- return this.call("DELETE", `/snapshots/${encodeURIComponent(name)}`, z17.undefined());
3727
+ return this.call("DELETE", `/snapshots/${encodeURIComponent(name)}`, z18.undefined());
3652
3728
  }
3653
3729
  // ---- environment variables (#88), a control plane only: the caller's slug, or `--org`'s ----
3654
3730
  /** `org`: that org's list instead of `--org`'s (or the caller's own). */
3655
3731
  listEnv(org) {
3656
- return this.call("GET", "/vars", z17.array(EnvVarSchema), void 0, org);
3732
+ return this.call("GET", "/vars", z18.array(EnvVarSchema), void 0, org);
3657
3733
  }
3658
3734
  setEnv(name, req) {
3659
3735
  return this.call("PUT", `/vars/${encodeURIComponent(name)}`, EnvChangeSchema, req);
@@ -3673,13 +3749,13 @@ var ServerClient = class {
3673
3749
  }
3674
3750
  // ---- volumes (#52) ----
3675
3751
  listVolumes(opts = {}) {
3676
- return this.call("GET", `/volumes${allQuery(opts)}`, z17.array(VolumeSchema), void 0, opts.org);
3752
+ return this.call("GET", `/volumes${allQuery(opts)}`, z18.array(VolumeSchema), void 0, opts.org);
3677
3753
  }
3678
3754
  createVolume(req) {
3679
3755
  return this.call("POST", "/volumes", VolumeSchema, req);
3680
3756
  }
3681
3757
  deleteVolume(name) {
3682
- return this.call("DELETE", `/volumes/${encodeURIComponent(name)}`, z17.undefined());
3758
+ return this.call("DELETE", `/volumes/${encodeURIComponent(name)}`, z18.undefined());
3683
3759
  }
3684
3760
  /** Both answer with the box as it is afterwards (restarted when it was running). */
3685
3761
  attachVolume(name, req) {
@@ -3694,7 +3770,7 @@ var ServerClient = class {
3694
3770
  }
3695
3771
  // ---- cron service (#190): the control plane's alone ----
3696
3772
  listCronServices(opts = {}) {
3697
- return this.call("GET", `/cron${allQuery(opts)}`, z17.array(CronServiceSchema), void 0, opts.org);
3773
+ return this.call("GET", `/cron${allQuery(opts)}`, z18.array(CronServiceSchema), void 0, opts.org);
3698
3774
  }
3699
3775
  createCronService(name) {
3700
3776
  return this.call("POST", "/cron", CronServiceSchema, { name });
@@ -3703,10 +3779,10 @@ var ServerClient = class {
3703
3779
  return this.call("GET", `/cron/${encodeURIComponent(name)}`, CronServiceSchema);
3704
3780
  }
3705
3781
  deleteCronService(name) {
3706
- return this.call("DELETE", `/cron/${encodeURIComponent(name)}`, z17.undefined());
3782
+ return this.call("DELETE", `/cron/${encodeURIComponent(name)}`, z18.undefined());
3707
3783
  }
3708
3784
  listCronTriggers(service) {
3709
- return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers`, z17.array(CronTriggerSchema));
3785
+ return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers`, z18.array(CronTriggerSchema));
3710
3786
  }
3711
3787
  addCronTrigger(service, req) {
3712
3788
  return this.call("POST", `/cron/${encodeURIComponent(service)}/triggers`, CronTriggerSchema, req);
@@ -3716,18 +3792,18 @@ var ServerClient = class {
3716
3792
  return this.call("PATCH", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}`, CronTriggerSchema, { enabled: enabled2 });
3717
3793
  }
3718
3794
  deleteCronTrigger(service, id) {
3719
- return this.call("DELETE", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}`, z17.undefined());
3795
+ return this.call("DELETE", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}`, z18.undefined());
3720
3796
  }
3721
3797
  /** Marks it due: kvbox-cron fires it within a few seconds. */
3722
3798
  runCronTrigger(service, id) {
3723
3799
  return this.call("POST", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}/run`, CronTriggerSchema);
3724
3800
  }
3725
3801
  listCronRuns(service, id, limit) {
3726
- return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}/runs${limit === void 0 ? "" : `?limit=${limit}`}`, z17.array(CronRunSchema));
3802
+ return this.call("GET", `/cron/${encodeURIComponent(service)}/triggers/${encodeURIComponent(id)}/runs${limit === void 0 ? "" : `?limit=${limit}`}`, z18.array(CronRunSchema));
3727
3803
  }
3728
3804
  // ---- Kubernetes clusters (#216): the control plane's alone ----
3729
3805
  listClusters(opts = {}) {
3730
- return this.call("GET", `/k8s${allQuery(opts)}`, z17.array(ClusterSchema), void 0, opts.org);
3806
+ return this.call("GET", `/k8s${allQuery(opts)}`, z18.array(ClusterSchema), void 0, opts.org);
3731
3807
  }
3732
3808
  /** The master boots twice (its volume is attached after it is made), so this may take a minute. */
3733
3809
  createCluster(req) {
@@ -3768,7 +3844,7 @@ var ServerClient = class {
3768
3844
  }
3769
3845
  /** A cluster's HTTPS addresses (#219): `kvbox.app` names and custom domains, all to its Traefik. */
3770
3846
  listClusterSubdomains(cluster2) {
3771
- return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/subdomains`, z17.array(SubdomainSchema));
3847
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/subdomains`, z18.array(SubdomainSchema));
3772
3848
  }
3773
3849
  claimClusterSubdomain(cluster2, name) {
3774
3850
  return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/subdomains`, SubdomainSchema, { name });
@@ -3777,7 +3853,7 @@ var ServerClient = class {
3777
3853
  return this.call("DELETE", `/k8s/${encodeURIComponent(cluster2)}/subdomains/${encodeURIComponent(name)}`, SubdomainSchema);
3778
3854
  }
3779
3855
  listClusterDomains(cluster2) {
3780
- return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/domains`, z17.array(DomainSchema));
3856
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/domains`, z18.array(DomainSchema));
3781
3857
  }
3782
3858
  addClusterDomain(cluster2, domain) {
3783
3859
  return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/domains`, DomainSchema, { domain });
@@ -3787,7 +3863,7 @@ var ServerClient = class {
3787
3863
  }
3788
3864
  /** What a cluster reaches (#220): a database or a box, from every one of its boxes. */
3789
3865
  listClusterLinks(cluster2) {
3790
- return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/links`, z17.array(ClusterLinkSchema));
3866
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/links`, z18.array(ClusterLinkSchema));
3791
3867
  }
3792
3868
  linkCluster(cluster2, req) {
3793
3869
  return this.call("POST", `/k8s/${encodeURIComponent(cluster2)}/links`, ClusterLinkSchema, req);
@@ -3797,10 +3873,10 @@ var ServerClient = class {
3797
3873
  }
3798
3874
  /** A cluster's backups (#221): its master's state, by the engine a database's uses. Every cluster's, removed ones' too. */
3799
3875
  listClusterBackups() {
3800
- return this.call("GET", "/backups?managed=k8s", z17.array(ManagedBackupSchema));
3876
+ return this.call("GET", "/backups?managed=k8s", z18.array(ManagedBackupSchema));
3801
3877
  }
3802
3878
  clusterBackups(cluster2) {
3803
- return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/backups`, z17.array(ManagedBackupSchema));
3879
+ return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/backups`, z18.array(ManagedBackupSchema));
3804
3880
  }
3805
3881
  clusterBackup(cluster2, id) {
3806
3882
  return this.call("GET", `/k8s/${encodeURIComponent(cluster2)}/backups/${encodeURIComponent(id)}`, ManagedBackupSchema);
@@ -3824,11 +3900,11 @@ var ServerClient = class {
3824
3900
  return this.call("PUT", `/k8s/${encodeURIComponent(cluster2)}/backup-schedule`, BackupScheduleSchema, change);
3825
3901
  }
3826
3902
  deleteCluster(name) {
3827
- return this.call("DELETE", `/k8s/${encodeURIComponent(name)}`, z17.undefined());
3903
+ return this.call("DELETE", `/k8s/${encodeURIComponent(name)}`, z18.undefined());
3828
3904
  }
3829
3905
  // ---- object storage (#182): the control plane's alone ----
3830
3906
  listBuckets(opts = {}) {
3831
- return this.call("GET", `/buckets${allQuery(opts)}`, z17.array(BucketSchema), void 0, opts.org);
3907
+ return this.call("GET", `/buckets${allQuery(opts)}`, z18.array(BucketSchema), void 0, opts.org);
3832
3908
  }
3833
3909
  /** The first bucket of a slug also makes its storage: a box boots twice, so this may take a couple of minutes. */
3834
3910
  createBucket(req) {
@@ -3842,26 +3918,47 @@ var ServerClient = class {
3842
3918
  return this.call("PUT", `/buckets/${encodeURIComponent(name)}/public`, BucketSchema, req);
3843
3919
  }
3844
3920
  deleteBucket(name, force = false) {
3845
- return this.call("DELETE", `/buckets/${encodeURIComponent(name)}${force ? "?force=1" : ""}`, z17.undefined());
3921
+ return this.call("DELETE", `/buckets/${encodeURIComponent(name)}${force ? "?force=1" : ""}`, z18.undefined());
3846
3922
  }
3847
3923
  listBucketKeys(name) {
3848
- return this.call("GET", `/buckets/${encodeURIComponent(name)}/keys`, z17.array(BucketKeySchema));
3924
+ return this.call("GET", `/buckets/${encodeURIComponent(name)}/keys`, z18.array(BucketKeySchema));
3849
3925
  }
3850
3926
  createBucketKey(name, req) {
3851
3927
  return this.call("POST", `/buckets/${encodeURIComponent(name)}/keys`, CreatedBucketKeySchema, req);
3852
3928
  }
3853
3929
  deleteBucketKey(name, id) {
3854
- return this.call("DELETE", `/buckets/${encodeURIComponent(name)}/keys/${encodeURIComponent(id)}`, z17.undefined());
3930
+ return this.call("DELETE", `/buckets/${encodeURIComponent(name)}/keys/${encodeURIComponent(id)}`, z18.undefined());
3855
3931
  }
3856
3932
  listStorage(opts = {}) {
3857
- return this.call("GET", `/storage${allQuery(opts)}`, z17.array(ObjectStorageSchema), void 0, opts.org);
3933
+ return this.call("GET", `/storage${allQuery(opts)}`, z18.array(ObjectStorageSchema), void 0, opts.org);
3858
3934
  }
3859
3935
  growStorage(sizeGib) {
3860
3936
  return this.call("POST", "/storage/grow", ObjectStorageSchema, { sizeGib });
3861
3937
  }
3938
+ // ---- the container registry (#234): control plane only, one per slug ----
3939
+ /** A hidden box boots twice (the volume's attach restarts it), so this may take a couple of minutes. */
3940
+ createRegistry(req) {
3941
+ return this.call("POST", "/registry", CreatedRegistrySchema, req);
3942
+ }
3943
+ /** The caller's (or `--org`'s) registry, with how full it is and its repositories when it answers. */
3944
+ registryInfo() {
3945
+ return this.call("GET", "/registry/info", RegistrySchema);
3946
+ }
3947
+ registryPassword() {
3948
+ return this.call("GET", "/registry/password", RegistrySecretSchema);
3949
+ }
3950
+ resetRegistryPassword() {
3951
+ return this.call("POST", "/registry/password", RegistrySecretSchema, {});
3952
+ }
3953
+ growRegistry(sizeGib) {
3954
+ return this.call("POST", "/registry/grow", RegistrySchema, { sizeGib });
3955
+ }
3956
+ deleteRegistry() {
3957
+ return this.call("DELETE", "/registry", z18.undefined());
3958
+ }
3862
3959
  /** Backups of the slug's whole object storage (#186 slice 3), newest first. */
3863
3960
  storageBackups() {
3864
- return this.call("GET", "/storage/backups", z17.array(StorageBackupSchema));
3961
+ return this.call("GET", "/storage/backups", z18.array(StorageBackupSchema));
3865
3962
  }
3866
3963
  storageBackup(id) {
3867
3964
  return this.call("GET", `/storage/backups/${encodeURIComponent(id)}`, StorageBackupSchema);
@@ -3889,11 +3986,11 @@ var ServerClient = class {
3889
3986
  return `/managed/${encodeURIComponent(kind)}${name === void 0 ? "" : `/${encodeURIComponent(name)}`}${rest}`;
3890
3987
  }
3891
3988
  managedCatalog() {
3892
- return this.call("GET", "/managed/catalog", z17.array(ManagedCatalogEntrySchema));
3989
+ return this.call("GET", "/managed/catalog", z18.array(ManagedCatalogEntrySchema));
3893
3990
  }
3894
3991
  /** One kind's services, or every kind's when `kind` is left out. */
3895
3992
  listManaged(kind, opts = {}) {
3896
- return this.call("GET", `${kind === void 0 ? "/managed" : this.managedPath(kind)}${allQuery(opts)}`, z17.array(ManagedSchema), void 0, opts.org);
3993
+ return this.call("GET", `${kind === void 0 ? "/managed" : this.managedPath(kind)}${allQuery(opts)}`, z18.array(ManagedSchema), void 0, opts.org);
3897
3994
  }
3898
3995
  /** From a backup (`fromBackup`) it waits for the restore too: the control plane gives its host 2 h for the download. */
3899
3996
  createManaged(kind, req) {
@@ -3904,7 +4001,7 @@ var ServerClient = class {
3904
4001
  return this.call("GET", this.managedPath(kind, name), ManagedSchema);
3905
4002
  }
3906
4003
  deleteManaged(kind, name) {
3907
- return this.call("DELETE", this.managedPath(kind, name), z17.undefined());
4004
+ return this.call("DELETE", this.managedPath(kind, name), z18.undefined());
3908
4005
  }
3909
4006
  managedPassword(kind, name) {
3910
4007
  return this.call("GET", this.managedPath(kind, name, "/password"), ManagedSecretSchema);
@@ -3926,10 +4023,10 @@ var ServerClient = class {
3926
4023
  }
3927
4024
  /** A managed service's backups (#186): its storage's, by the volume backup engine. Every one of a kind, those of removed services too. */
3928
4025
  listManagedBackups(kind) {
3929
- return this.call("GET", `/backups?managed=${encodeURIComponent(kind)}`, z17.array(ManagedBackupSchema));
4026
+ return this.call("GET", `/backups?managed=${encodeURIComponent(kind)}`, z18.array(ManagedBackupSchema));
3930
4027
  }
3931
4028
  managedBackups(kind, name) {
3932
- return this.call("GET", this.managedPath(kind, name, "/backups"), z17.array(ManagedBackupSchema));
4029
+ return this.call("GET", this.managedPath(kind, name, "/backups"), z18.array(ManagedBackupSchema));
3933
4030
  }
3934
4031
  managedBackup(kind, name, id) {
3935
4032
  return this.call("GET", this.managedPath(kind, name, `/backups/${encodeURIComponent(id)}`), ManagedBackupSchema);
@@ -3971,7 +4068,7 @@ var ServerClient = class {
3971
4068
  return this.call("POST", "/login/device/token", DeviceLoginPollSchema, { deviceCode });
3972
4069
  }
3973
4070
  logout() {
3974
- return this.call("POST", "/logout", z17.unknown()).then(() => void 0);
4071
+ return this.call("POST", "/logout", z18.unknown()).then(() => void 0);
3975
4072
  }
3976
4073
  me() {
3977
4074
  return this.call("GET", "/me", MeResponseSchema);
@@ -3982,25 +4079,25 @@ var ServerClient = class {
3982
4079
  * credential. Null: each readable slug whatever `--org` says, which is how the caller's own slug is read.
3983
4080
  */
3984
4081
  listIntegrations(org) {
3985
- return this.call("GET", "/integrations", z17.array(IntegrationSchema), void 0, org);
4082
+ return this.call("GET", "/integrations", z18.array(IntegrationSchema), void 0, org);
3986
4083
  }
3987
4084
  /** What can be connected on this control plane, and by which kind of slug. */
3988
4085
  integrationCatalog() {
3989
- return this.call("GET", "/integrations/catalog", z17.array(IntegrationCatalogEntrySchema), void 0, null);
4086
+ return this.call("GET", "/integrations/catalog", z18.array(IntegrationCatalogEntrySchema), void 0, null);
3990
4087
  }
3991
4088
  // ---- API keys (`kvbox key …`, #189) ----
3992
4089
  listApiKeys() {
3993
- return this.call("GET", "/keys", z17.array(ApiKeySchema));
4090
+ return this.call("GET", "/keys", z18.array(ApiKeySchema));
3994
4091
  }
3995
4092
  createApiKey(req) {
3996
4093
  return this.call("POST", "/keys", CreatedApiKeySchema, req);
3997
4094
  }
3998
4095
  deleteApiKey(name) {
3999
- return this.call("DELETE", `/keys/${encodeURIComponent(name)}`, z17.unknown()).then(() => void 0);
4096
+ return this.call("DELETE", `/keys/${encodeURIComponent(name)}`, z18.unknown()).then(() => void 0);
4000
4097
  }
4001
4098
  // ---- orgs (`kvbox org …`) ----
4002
4099
  listOrgs() {
4003
- return this.call("GET", "/orgs", z17.array(OrgMembershipSchema));
4100
+ return this.call("GET", "/orgs", z18.array(OrgMembershipSchema));
4004
4101
  }
4005
4102
  createOrg(req) {
4006
4103
  return this.call("POST", "/orgs", CloudOrgSchema, req);
@@ -4009,16 +4106,16 @@ var ServerClient = class {
4009
4106
  return this.call("GET", `/orgs/${encodeURIComponent(slug)}`, OrgDetailSchema);
4010
4107
  }
4011
4108
  deleteOrg(slug) {
4012
- return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}`, z17.undefined());
4109
+ return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}`, z18.undefined());
4013
4110
  }
4014
4111
  addMember(slug, req) {
4015
- return this.call("POST", `/orgs/${encodeURIComponent(slug)}/members`, z17.undefined(), req);
4112
+ return this.call("POST", `/orgs/${encodeURIComponent(slug)}/members`, z18.undefined(), req);
4016
4113
  }
4017
4114
  setRole(slug, username, role) {
4018
- return this.call("PATCH", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z17.unknown(), { role }).then(() => void 0);
4115
+ return this.call("PATCH", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z18.unknown(), { role }).then(() => void 0);
4019
4116
  }
4020
4117
  removeMember(slug, username) {
4021
- return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z17.undefined());
4118
+ return this.call("DELETE", `/orgs/${encodeURIComponent(slug)}/members/${encodeURIComponent(username)}`, z18.undefined());
4022
4119
  }
4023
4120
  /** Sign this machine's key again (#51); the key must be one the user logged in with. */
4024
4121
  sshCert(req) {
@@ -5079,6 +5176,16 @@ import { Command as Command12 } from "commander";
5079
5176
  // ../shared/src/names.ts
5080
5177
  import { createHmac } from "crypto";
5081
5178
  var DEFAULT_PROXY_DOMAIN = "kvbox.app";
5179
+ var STORAGE_SUBDOMAIN_PREFIX = "s3-";
5180
+ var REGISTRY_SUBDOMAIN_PREFIX = "cr-";
5181
+ var KEPT_SUBDOMAIN_PREFIXES = [
5182
+ { prefix: STORAGE_SUBDOMAIN_PREFIX, for: "object storage" },
5183
+ { prefix: REGISTRY_SUBDOMAIN_PREFIX, for: "container registries" }
5184
+ ];
5185
+ function keptPrefixOf(name) {
5186
+ const lower = name.trim().toLowerCase();
5187
+ return KEPT_SUBDOMAIN_PREFIXES.find((k) => lower.startsWith(k.prefix));
5188
+ }
5082
5189
  var MAX_BOX_SUBDOMAINS = 5;
5083
5190
  var LABEL_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
5084
5191
  var RESERVED_SUBDOMAINS = /* @__PURE__ */ new Set([
@@ -6812,10 +6919,11 @@ var usageCommand2 = new Command64("usage").description("what your boxes and volu
6812
6919
  info(`${day2(report.window.from)} to ${day2(report.window.to)}`);
6813
6920
  const volumes = report.volumes ?? [];
6814
6921
  const storage = report.storage ?? [];
6922
+ const registry = report.registry ?? [];
6815
6923
  const cron = report.cron ?? [];
6816
6924
  const clusters = report.clusters ?? [];
6817
6925
  const backups = report.backups ?? [];
6818
- if (report.boxes.length === 0 && volumes.length === 0 && storage.length === 0 && cron.length === 0 && clusters.length === 0 && backups.length === 0) info("no usage in this window");
6926
+ if (report.boxes.length === 0 && volumes.length === 0 && storage.length === 0 && registry.length === 0 && cron.length === 0 && clusters.length === 0 && backups.length === 0) info("no usage in this window");
6819
6927
  else if (report.boxes.length > 0) table(perUser ? userRows(perUser) : usageRows(report, cloud));
6820
6928
  if (volumes.length > 0) {
6821
6929
  info(volumes.length === 1 ? "1 volume" : `${volumes.length} volumes`);
@@ -6825,6 +6933,10 @@ var usageCommand2 = new Command64("usage").description("what your boxes and volu
6825
6933
  info("object storage");
6826
6934
  table(storageRows(report, cloud));
6827
6935
  }
6936
+ if (registry.length > 0) {
6937
+ info("container registry");
6938
+ table(storageRows({ ...report, storage: registry }, cloud));
6939
+ }
6828
6940
  if (cron.length > 0) {
6829
6941
  info(cron.length === 1 ? "1 cron service" : `${cron.length} cron services`);
6830
6942
  table(cronRows(report, cloud));
@@ -6838,8 +6950,8 @@ var usageCommand2 = new Command64("usage").description("what your boxes and volu
6838
6950
  info(taken === 1 ? "1 paid backup" : `${taken} paid backups`);
6839
6951
  table(backupRows(report, cloud));
6840
6952
  }
6841
- if ((volumes.length > 0 || storage.length > 0 || cron.length > 0 || clusters.length > 0 || backups.length > 0) && report.totals.cost !== void 0) {
6842
- const what = ["boxes", ...volumes.length > 0 ? ["volumes"] : [], ...storage.length > 0 ? ["object storage"] : [], ...cron.length > 0 ? ["cron services"] : [], ...clusters.length > 0 ? ["Kubernetes clusters"] : [], ...backups.length > 0 ? ["backups"] : []];
6953
+ if ((volumes.length > 0 || storage.length > 0 || registry.length > 0 || cron.length > 0 || clusters.length > 0 || backups.length > 0) && report.totals.cost !== void 0) {
6954
+ const what = ["boxes", ...volumes.length > 0 ? ["volumes"] : [], ...storage.length > 0 ? ["object storage"] : [], ...registry.length > 0 ? ["the container registry"] : [], ...cron.length > 0 ? ["cron services"] : [], ...clusters.length > 0 ? ["Kubernetes clusters"] : [], ...backups.length > 0 ? ["backups"] : []];
6843
6955
  info(`total: ${money(report.totals.cost.amount, report.totals.cost.currency)} ${color.dim(`(${what.slice(0, -1).join(", ")} and ${what.at(-1)}, estimated)`)}`);
6844
6956
  }
6845
6957
  if (cloud) {
@@ -6999,7 +7111,7 @@ function byUser(report) {
6999
7111
  return u;
7000
7112
  });
7001
7113
  users.sort((a, b) => a.user === null ? 1 : b.user === null ? -1 : a.user.localeCompare(b.user));
7002
- return { window: report.window, users, ...report.volumes === void 0 ? {} : { volumes: report.volumes }, ...report.storage === void 0 ? {} : { storage: report.storage }, ...report.cron === void 0 ? {} : { cron: report.cron }, ...report.clusters === void 0 ? {} : { clusters: report.clusters }, ...report.backups === void 0 ? {} : { backups: report.backups }, totals: report.totals };
7114
+ return { window: report.window, users, ...report.volumes === void 0 ? {} : { volumes: report.volumes }, ...report.storage === void 0 ? {} : { storage: report.storage }, ...report.registry === void 0 ? {} : { registry: report.registry }, ...report.cron === void 0 ? {} : { cron: report.cron }, ...report.clusters === void 0 ? {} : { clusters: report.clusters }, ...report.backups === void 0 ? {} : { backups: report.backups }, totals: report.totals };
7003
7115
  }
7004
7116
  function userRows(r) {
7005
7117
  const priced = r.totals.cost !== void 0;
@@ -7090,7 +7202,7 @@ import { Command as Command67, InvalidArgumentError as InvalidArgumentError2, Op
7090
7202
  // src/commands/deploy/config.ts
7091
7203
  import { readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
7092
7204
  import { isAbsolute, join as join6, normalize, relative as relative2 } from "path";
7093
- import { z as z18 } from "zod";
7205
+ import { z as z19 } from "zod";
7094
7206
 
7095
7207
  // src/commands/deploy/templates/docker.ts
7096
7208
  import { readFile as readFile4 } from "fs/promises";
@@ -7514,21 +7626,21 @@ function detectTemplates(pkg, dir = NO_FACTS) {
7514
7626
  var DEPLOY_AUTO_HIBERNATE_SEC = 3600;
7515
7627
  var CONFIG_FILE = "kvbox.json";
7516
7628
  var BOX_NAME_RE = /^[a-z0-9][a-z0-9-]{0,11}$/;
7517
- var DeployConfigSchema = z18.object({
7518
- template: z18.enum(TEMPLATE_IDS),
7519
- name: z18.string().regex(BOX_NAME_RE, "1-12 chars, lowercase letters, digits and '-', starting with a letter or digit"),
7629
+ var DeployConfigSchema = z19.object({
7630
+ template: z19.enum(TEMPLATE_IDS),
7631
+ name: z19.string().regex(BOX_NAME_RE, "1-12 chars, lowercase letters, digits and '-', starting with a letter or digit"),
7520
7632
  /** The org whose box it is; absent for the user's own. */
7521
- org: z18.string().regex(ORG_SLUG_RE, "not an org slug").optional(),
7633
+ org: z19.string().regex(ORG_SLUG_RE, "not an org slug").optional(),
7522
7634
  /** The HTTPS name (`<subdomain>.kvbox.app`); absent when deploying to this machine's own host. */
7523
- subdomain: z18.string().check((ctx) => {
7635
+ subdomain: z19.string().check((ctx) => {
7524
7636
  const problem = subdomainProblem(ctx.value);
7525
7637
  if (problem) ctx.issues.push({ code: "custom", message: problem, input: ctx.value });
7526
7638
  }).optional(),
7527
- size: z18.enum(SIZE_NAMES).optional(),
7639
+ size: z19.enum(SIZE_NAMES).optional(),
7528
7640
  /** The build output directory, relative to the app; the template's default when absent. */
7529
- dist: z18.string().optional(),
7641
+ dist: z19.string().optional(),
7530
7642
  /** The port a Next.js app or Node server serves; the template's (3000) when absent. */
7531
- port: z18.number().int().min(1).max(65535).optional()
7643
+ port: z19.number().int().min(1).max(65535).optional()
7532
7644
  });
7533
7645
  var SERVICE_KEY_RE = /^[a-z][a-z0-9-]{0,19}$/;
7534
7646
  var RESERVED_SERVICE_KEYS = ["app", "agent", "init", "volumes"];
@@ -7540,38 +7652,38 @@ var POSTGRES_PORT = 5432;
7540
7652
  var POSTGRES_IMAGE = "postgres:17";
7541
7653
  var POSTGRES_ENV = "DATABASE_URL";
7542
7654
  var IMAGE_RE = /^[a-z0-9][a-z0-9._/:@-]*$/;
7543
- var ServiceSchema = z18.strictObject({
7544
- template: z18.enum([...TEMPLATE_IDS, POSTGRES]),
7655
+ var ServiceSchema = z19.strictObject({
7656
+ template: z19.enum([...TEMPLATE_IDS, POSTGRES]),
7545
7657
  /** The service's directory, relative to the one holding kvbox.json; every template but postgres has one. */
7546
- dir: z18.string().min(1).optional(),
7658
+ dir: z19.string().min(1).optional(),
7547
7659
  /** A postgres service's image, `postgres:17` when absent (`pgvector/pgvector:pg17` for vectors). */
7548
- image: z18.string().regex(IMAGE_RE, "an image name like postgres:17").optional(),
7660
+ image: z19.string().regex(IMAGE_RE, "an image name like postgres:17").optional(),
7549
7661
  /** The volume (a key of `volumes`) a postgres service keeps its data on. */
7550
- volume: z18.string().optional(),
7662
+ volume: z19.string().optional(),
7551
7663
  /** The box variable a postgres service's URL is written to, `DATABASE_URL` when absent. */
7552
- env: z18.string().optional(),
7664
+ env: z19.string().optional(),
7553
7665
  /** A docker service's build context, relative to kvbox.json, when it is not `dir` (a monorepo built from its root); the Dockerfile stays in `dir`. */
7554
- context: z18.string().min(1).optional(),
7555
- dist: z18.string().optional(),
7666
+ context: z19.string().min(1).optional(),
7667
+ dist: z19.string().optional(),
7556
7668
  /**
7557
7669
  * A command run once per deploy in the service's new version (a docker service: in a container of
7558
7670
  * the new image; node, nextjs: in the new source, installed and built), with the box's variables,
7559
7671
  * before it replaces the running one. Migrations, mostly. A failing one stops that service's deploy.
7560
7672
  */
7561
- release: z18.string().optional(),
7673
+ release: z19.string().optional(),
7562
7674
  /** The box port of a service with its own server; the template's (3000) when absent. */
7563
- port: z18.number().int().min(1).max(65535).optional(),
7675
+ port: z19.number().int().min(1).max(65535).optional(),
7564
7676
  /** The URL paths that go to this service, each with everything under it; the prefix is kept. */
7565
- paths: z18.array(z18.string().regex(ROUTE_RE, "a path like / or /api, no trailing slash")).min(1).optional()
7677
+ paths: z19.array(z19.string().regex(ROUTE_RE, "a path like / or /api, no trailing slash")).min(1).optional()
7566
7678
  });
7567
- var StackConfigSchema = z18.strictObject({
7679
+ var StackConfigSchema = z19.strictObject({
7568
7680
  name: DeployConfigSchema.shape.name.optional(),
7569
7681
  org: DeployConfigSchema.shape.org,
7570
7682
  subdomain: DeployConfigSchema.shape.subdomain,
7571
7683
  size: DeployConfigSchema.shape.size,
7572
7684
  /** The stack's volumes, name to size ("10GB"): made for its box and attached to it on the first deploy that needs one. */
7573
- volumes: z18.record(z18.string(), z18.string()).optional(),
7574
- services: z18.record(z18.string(), ServiceSchema)
7685
+ volumes: z19.record(z19.string(), z19.string()).optional(),
7686
+ services: z19.record(z19.string(), ServiceSchema)
7575
7687
  });
7576
7688
  function volumeGib(text2) {
7577
7689
  const mib2 = parseMib(text2);
@@ -7698,6 +7810,8 @@ function nameFromDir(dirName) {
7698
7810
  return slug === "" ? "app" : slug;
7699
7811
  }
7700
7812
  function subdomainFor(name) {
7813
+ const kept = keptPrefixOf(name);
7814
+ if (kept) return subdomainFor(name.slice(kept.prefix.length) || "app");
7701
7815
  return subdomainProblem(name) === null ? name : `${name}-site`;
7702
7816
  }
7703
7817
 
@@ -8478,7 +8592,9 @@ async function settle2(dir, pkg, facts, saved, opts, orgFlag, cloud) {
8478
8592
  default: subdomainFor(name),
8479
8593
  validate: (a) => {
8480
8594
  const problem = subdomainProblem(a);
8481
- return problem ? `that name ${problem}` : void 0;
8595
+ if (problem) return `that name ${problem}`;
8596
+ const kept = keptPrefixOf(a);
8597
+ return kept ? `names starting with ${kept.prefix} are kept for ${kept.for}` : void 0;
8482
8598
  }
8483
8599
  });
8484
8600
  info(` ${color.dim(`https://${subdomain}.kvbox.app`)}`);
@@ -9185,14 +9301,158 @@ for (const cmd of bucketCommand.commands) {
9185
9301
  else withOrg2(cmd);
9186
9302
  }
9187
9303
 
9304
+ // src/commands/registry/index.ts
9305
+ import { Command as Command103 } from "commander";
9306
+
9307
+ // src/commands/registry/create.ts
9308
+ import { Command as Command98 } from "commander";
9309
+
9310
+ // src/commands/registry/shared.ts
9311
+ async function registryClient(cmd) {
9312
+ const client = await clientFor(cmd.optsWithGlobals());
9313
+ if (client.target.kind !== "cloud") {
9314
+ await client.close();
9315
+ throw new KvboxError("the container registry runs on the kvbox cloud: kvbox login first (this host's own socket has none)");
9316
+ }
9317
+ return client;
9318
+ }
9319
+ var fullness2 = (r) => r.usedBytes !== void 0 ? `${gb(r.usedBytes)} of ${r.sizeGib} GB used` : `${r.sizeGib} GB`;
9320
+ var nearlyFull2 = (r) => r.usedBytes !== void 0 && r.totalBytes !== void 0 && r.totalBytes > 0 && r.usedBytes / r.totalBytes >= 0.9;
9321
+ var priceText2 = (r) => `${money(r.price.perMonth, r.price.currency)} a month ${color.dim("(estimated)")}`;
9322
+ var addressText = (address2) => address2 ?? color.yellow("no address yet (asked for again at the next kvbox registry info)");
9323
+ function loginLines(secret) {
9324
+ if (secret.address === null) return [];
9325
+ return [`docker login ${secret.address} -u ${secret.user}`, `docker tag myapp ${secret.address}/myapp:1.0`, `docker push ${secret.address}/myapp:1.0`];
9326
+ }
9327
+ function printRows2(rows2) {
9328
+ const width2 = Math.max(...rows2.map(([label]) => label.length));
9329
+ for (const [label, value] of rows2) process.stdout.write(`${color.dim(label.padEnd(width2))} ${value}
9330
+ `);
9331
+ }
9332
+
9333
+ // src/commands/registry/create.ts
9334
+ var createCommand9 = new Command98("create").description("make your container registry: a private place for your docker images (one per account)").option("--size <GB>", "how much it may hold (default 20)").option("--near <box>", "put it on the host of this box").option("--json", "print as JSON").action(async (opts, cmd) => {
9335
+ const sizeGib = opts.size === void 0 ? void 0 : parseGib2(opts.size);
9336
+ const client = await registryClient(cmd);
9337
+ try {
9338
+ const made = await spin("making your container registry (a minute or two)\u2026", client.createRegistry({ ...sizeGib !== void 0 ? { sizeGib } : {}, ...opts.near !== void 0 ? { near: opts.near } : {} }));
9339
+ if (opts.json) {
9340
+ json(made);
9341
+ return;
9342
+ }
9343
+ info(`${color.green("\u2713")} container registry made for ${color.bold(made.owner)}: ${made.sizeGib} GB, ${priceText2(made)}`);
9344
+ printRows2([
9345
+ ["address", addressText(made.secret.address)],
9346
+ ["user", made.secret.user],
9347
+ ["password", made.secret.password]
9348
+ ]);
9349
+ if (!made.ready) info(color.yellow(" it is still starting: give it a minute before the first docker login (kvbox registry info shows when it answers)"));
9350
+ const lines = loginLines(made.secret);
9351
+ if (lines.length > 0) info(color.dim(`
9352
+ ${lines.join("\n")}`));
9353
+ info(color.dim("the password is shown again by: kvbox registry password"));
9354
+ } finally {
9355
+ await client.close();
9356
+ }
9357
+ });
9358
+
9359
+ // src/commands/registry/grow.ts
9360
+ import { Command as Command99 } from "commander";
9361
+ var growCommand3 = new Command99("grow").description("make your container registry larger (it restarts once)").argument("<GB>", "the new size in GB, larger than what it has").option("--json", "print the registry as JSON").action(async (size, opts, cmd) => {
9362
+ const sizeGib = parseGib2(size, "size");
9363
+ const client = await registryClient(cmd);
9364
+ try {
9365
+ const r = await spin(`growing your container registry to ${sizeGib} GB\u2026`, client.growRegistry(sizeGib));
9366
+ if (opts.json) json(r);
9367
+ else info(`${color.green("\u2713")} the container registry of ${r.owner} is ${r.sizeGib} GB, ${priceText2(r)}`);
9368
+ } finally {
9369
+ await client.close();
9370
+ }
9371
+ });
9372
+
9373
+ // src/commands/registry/info.ts
9374
+ import { Command as Command100 } from "commander";
9375
+ var SHOWN_REPOSITORIES = 20;
9376
+ var infoCommand2 = new Command100("info").description("your container registry: its address, how full it is, what is in it").option("--json", "print as JSON").action(async (opts, cmd) => {
9377
+ const client = await registryClient(cmd);
9378
+ try {
9379
+ const r = await client.registryInfo();
9380
+ if (opts.json) {
9381
+ json(r);
9382
+ return;
9383
+ }
9384
+ const repos = r.repositories;
9385
+ const rows2 = [
9386
+ ["owner", color.bold(r.owner)],
9387
+ ["address", addressText(r.address)],
9388
+ ["user", `${r.user} ${color.dim("(password: kvbox registry password)")}`],
9389
+ ["status", r.status === "running" ? repos === void 0 ? color.dim("running, not answering yet") : "running" : r.status],
9390
+ ["size", `${fullness2(r)}${nearlyFull2(r) ? color.yellow(" almost full: kvbox registry grow <GB>") : ""}`],
9391
+ ["holds", repos === void 0 ? color.dim("unknown") : repos.length === 0 ? color.dim("nothing yet") : `${repos.length}${r.repositoriesTruncated ? "+" : ""} ${repos.length === 1 ? "repository" : "repositories"}`],
9392
+ ["cost", priceText2(r)],
9393
+ ["created", `${age(r.createdAt)}${r.createdBy ? ` by ${r.createdBy}` : ""}`]
9394
+ ];
9395
+ printRows2(rows2);
9396
+ for (const repo of (repos ?? []).slice(0, SHOWN_REPOSITORIES)) info(` ${repo.name} ${color.dim(`${repo.tags} ${repo.tags === 1 ? "tag" : "tags"}`)}`);
9397
+ if (repos !== void 0 && repos.length > SHOWN_REPOSITORIES) info(color.dim(` and ${repos.length - SHOWN_REPOSITORIES} more (--json lists them all)`));
9398
+ const lines = loginLines(r);
9399
+ if (lines.length > 0) info(color.dim(`
9400
+ ${lines.join("\n")}`));
9401
+ } finally {
9402
+ await client.close();
9403
+ }
9404
+ });
9405
+
9406
+ // src/commands/registry/password.ts
9407
+ import { Command as Command101 } from "commander";
9408
+ var passwordCommand = new Command101("password").description("show your container registry's login, or set a new password with --reset").option("--reset", "make a new password; the old one stops working").option("--json", "print as JSON").action(async (opts, cmd) => {
9409
+ const client = await registryClient(cmd);
9410
+ try {
9411
+ const secret = opts.reset ? await spin("setting a new password on your container registry\u2026", client.resetRegistryPassword()) : await client.registryPassword();
9412
+ if (opts.json) {
9413
+ json(secret);
9414
+ return;
9415
+ }
9416
+ if (opts.reset) info(`${color.green("\u2713")} your container registry has a new password; the old one no longer works`);
9417
+ printRows2([
9418
+ ["address", addressText(secret.address)],
9419
+ ["user", secret.user],
9420
+ ["password", secret.password]
9421
+ ]);
9422
+ } finally {
9423
+ await client.close();
9424
+ }
9425
+ });
9426
+
9427
+ // src/commands/registry/rm.ts
9428
+ import { Command as Command102 } from "commander";
9429
+ var rmCommand14 = new Command102("rm").alias("remove").description("delete your container registry with every image in it").option("-y, --yes", "do not ask for confirmation").action(async (opts, cmd) => {
9430
+ const client = await registryClient(cmd);
9431
+ try {
9432
+ if (!await confirm("Delete your container registry with every image in it?", opts.yes ?? false)) {
9433
+ info("cancelled");
9434
+ process.exitCode = 1;
9435
+ return;
9436
+ }
9437
+ await spin("deleting your container registry\u2026", client.deleteRegistry());
9438
+ info(`${color.green("\u2713")} container registry deleted ${color.dim("(no longer charged)")}`);
9439
+ } finally {
9440
+ await client.close();
9441
+ }
9442
+ });
9443
+
9444
+ // src/commands/registry/index.ts
9445
+ var registryCommand = new Command103("registry").description("container registry: a private place for your docker images (docker push and pull)").addCommand(createCommand9).addCommand(infoCommand2).addCommand(passwordCommand).addCommand(growCommand3).addCommand(rmCommand14);
9446
+ for (const cmd of registryCommand.commands) cmd.option("--org <slug>", "act in this org (- for your personal registry)");
9447
+
9188
9448
  // src/commands/k8s/index.ts
9189
- import { Command as Command129 } from "commander";
9449
+ import { Command as Command135 } from "commander";
9190
9450
 
9191
9451
  // src/commands/k8s/backup/index.ts
9192
- import { Command as Command103 } from "commander";
9452
+ import { Command as Command109 } from "commander";
9193
9453
 
9194
9454
  // src/commands/k8s/backup/create.ts
9195
- import { Command as Command98 } from "commander";
9455
+ import { Command as Command104 } from "commander";
9196
9456
 
9197
9457
  // src/commands/k8s/shared.ts
9198
9458
  async function k8sClient(cmd) {
@@ -9208,14 +9468,14 @@ function shownName2(c2, client) {
9208
9468
  return c2.owner === context ? c2.name : `${c2.owner}/${c2.name}`;
9209
9469
  }
9210
9470
  var apiText = (c2) => c2.api === null ? color.yellow("not reachable from outside (its port is closed)") : `https://${c2.api.host.includes(":") ? `[${c2.api.host}]` : c2.api.host}:${c2.api.port}`;
9211
- function priceText2(c2) {
9471
+ function priceText3(c2) {
9212
9472
  const { perMonth, nodesPerMonth, totalPerMonth, currency } = c2.price;
9213
9473
  if (nodesPerMonth === void 0 || totalPerMonth === void 0) return `${money(perMonth, currency)} a month for the cluster itself ${color.dim("(estimated)")}, plus its nodes, each at a box's price`;
9214
9474
  const nodes = c2.pools.reduce((n2, p) => n2 + p.boxes.length, 0);
9215
9475
  return `${money(totalPerMonth, currency)} a month ${color.dim(`(estimated: ${money(perMonth, currency)} the cluster itself, ${money(nodesPerMonth, currency)} its ${nodes === 1 ? "node" : `${nodes} nodes`})`)}`;
9216
9476
  }
9217
9477
  var poolsText = (c2) => c2.pools.length === 0 ? color.dim("none") : c2.pools.map((p) => `${p.boxes.length} \xD7 ${p.size}${p.boxes.length > 0 ? color.dim(` (${p.boxes.join(", ")})`) : ""}`).join(", ");
9218
- function printRows2(rows2) {
9478
+ function printRows3(rows2) {
9219
9479
  const width2 = Math.max(...rows2.map(([label]) => label.length));
9220
9480
  for (const [label, value] of rows2) process.stdout.write(`${color.dim(label.padEnd(width2))} ${value}
9221
9481
  `);
@@ -9244,7 +9504,7 @@ function nodeCount(text2) {
9244
9504
  var roomText = (room) => room.s === 0 ? color.yellow("its host is full: no node of any size fits") : `${NODE_SIZES.filter((size) => room[size] > 0).map((size) => `${room[size]} \xD7 ${size}`).join(", ").replace(/, ([^,]*)$/, " or $1")} more ${color.dim("(as its host has room now; nothing is reserved)")}`;
9245
9505
 
9246
9506
  // src/commands/k8s/backup/create.ts
9247
- var createCommand9 = new Command98("create").description("back up what a cluster knows to the kvbox cloud (encrypted)").argument("<cluster>", "cluster 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) => {
9507
+ var createCommand10 = new Command104("create").description("back up what a cluster knows to the kvbox cloud (encrypted)").argument("<cluster>", "cluster 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) => {
9248
9508
  const client = await k8sClient(cmd);
9249
9509
  const ls = `kvbox k8s backup ls ${name}`;
9250
9510
  try {
@@ -9271,8 +9531,8 @@ var createCommand9 = new Command98("create").description("back up what a cluster
9271
9531
  });
9272
9532
 
9273
9533
  // src/commands/k8s/backup/ls.ts
9274
- import { Command as Command99 } from "commander";
9275
- var lsCommand15 = new Command99("ls").alias("list").description("list backups: every cluster's, or one cluster's").argument("[cluster]", "cluster name (default: every cluster)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9534
+ import { Command as Command105 } from "commander";
9535
+ var lsCommand15 = new Command105("ls").alias("list").description("list backups: every cluster's, or one cluster's").argument("[cluster]", "cluster name (default: every cluster)").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9276
9536
  const client = await k8sClient(cmd);
9277
9537
  const removedOnes = async (err, name2) => {
9278
9538
  if (!(err instanceof CallError && err.status === 404)) throw err;
@@ -9318,8 +9578,8 @@ var lsCommand15 = new Command99("ls").alias("list").description("list backups: e
9318
9578
  });
9319
9579
 
9320
9580
  // src/commands/k8s/backup/restore.ts
9321
- import { Command as Command100 } from "commander";
9322
- var restoreCommand4 = new Command100("restore").description("put a backup back: what the cluster knows becomes the backup's (its master restarts)").argument("<cluster>", "cluster name").argument("<id>", "the backup's id (kvbox k8s backup ls <cluster>)").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the nodes to be Ready again").option("--json", "print what changed as JSON").action(async (name, id, opts, cmd) => {
9581
+ import { Command as Command106 } from "commander";
9582
+ var restoreCommand4 = new Command106("restore").description("put a backup back: what the cluster knows becomes the backup's (its master restarts)").argument("<cluster>", "cluster name").argument("<id>", "the backup's id (kvbox k8s backup ls <cluster>)").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the nodes to be Ready again").option("--json", "print what changed as JSON").action(async (name, id, opts, cmd) => {
9323
9583
  const client = await k8sClient(cmd);
9324
9584
  try {
9325
9585
  const backup = await client.clusterBackup(name, id);
@@ -9350,8 +9610,8 @@ var restoreCommand4 = new Command100("restore").description("put a backup back:
9350
9610
  });
9351
9611
 
9352
9612
  // src/commands/k8s/backup/rm.ts
9353
- import { Command as Command101 } from "commander";
9354
- var rmCommand14 = new Command101("rm").alias("remove").description("remove a backup for good (a cluster's that is gone too)").argument("<cluster>", "cluster name").argument("<id>", "the backup's id (kvbox k8s backup ls <cluster>)").option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
9613
+ import { Command as Command107 } from "commander";
9614
+ var rmCommand15 = new Command107("rm").alias("remove").description("remove a backup for good (a cluster's that is gone too)").argument("<cluster>", "cluster name").argument("<id>", "the backup's id (kvbox k8s backup ls <cluster>)").option("-y, --yes", "do not ask for confirmation").action(async (name, id, opts, cmd) => {
9355
9615
  const client = await k8sClient(cmd);
9356
9616
  try {
9357
9617
  await removeListed(client, await client.listClusterBackups(), (b) => b.name, name, id, `cluster ${name}`, opts.yes ?? false);
@@ -9361,8 +9621,8 @@ var rmCommand14 = new Command101("rm").alias("remove").description("remove a bac
9361
9621
  });
9362
9622
 
9363
9623
  // src/commands/k8s/backup/schedule.ts
9364
- import { Command as Command102 } from "commander";
9365
- var scheduleCommand4 = scheduleFlags(new Command102("schedule").description("show or change when a cluster is backed up on its own (daily, UTC)").argument("<cluster>", "cluster name")).action(
9624
+ import { Command as Command108 } from "commander";
9625
+ var scheduleCommand4 = scheduleFlags(new Command108("schedule").description("show or change when a cluster is backed up on its own (daily, UTC)").argument("<cluster>", "cluster name")).action(
9366
9626
  async (name, flags, cmd) => {
9367
9627
  const change = changeOf(flags);
9368
9628
  const client = await k8sClient(cmd);
@@ -9377,11 +9637,11 @@ var scheduleCommand4 = scheduleFlags(new Command102("schedule").description("sho
9377
9637
  );
9378
9638
 
9379
9639
  // src/commands/k8s/backup/index.ts
9380
- var backupCommand4 = new Command103("backup").description("back up what a cluster knows, list backups, restore or remove one, or change its nightly schedule").addCommand(createCommand9).addCommand(lsCommand15).addCommand(restoreCommand4).addCommand(rmCommand14).addCommand(scheduleCommand4);
9640
+ var backupCommand4 = new Command109("backup").description("back up what a cluster knows, list backups, restore or remove one, or change its nightly schedule").addCommand(createCommand10).addCommand(lsCommand15).addCommand(restoreCommand4).addCommand(rmCommand15).addCommand(scheduleCommand4);
9381
9641
 
9382
9642
  // src/commands/k8s/create.ts
9383
- import { Command as Command104 } from "commander";
9384
- var createCommand10 = new Command104("create").description("make a Kubernetes cluster with its first nodes (a few minutes)").argument("<name>", "cluster name: 1-8 lowercase letters, digits and '-' (not at either end)").requiredOption("--size <size>", `what each node is sized at: ${NODE_SIZES.join(", ")}`).option("--nodes <n>", `how many nodes (1-${MAX_POOL_NODES})`, String(DEFAULT_POOL_NODES)).option("--near <box>", "put it on the host of this box").option("--no-wait", "do not wait for the cluster to be ready").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9643
+ import { Command as Command110 } from "commander";
9644
+ var createCommand11 = new Command110("create").description("make a Kubernetes cluster with its first nodes (a few minutes)").argument("<name>", "cluster name: 1-8 lowercase letters, digits and '-' (not at either end)").requiredOption("--size <size>", `what each node is sized at: ${NODE_SIZES.join(", ")}`).option("--nodes <n>", `how many nodes (1-${MAX_POOL_NODES})`, String(DEFAULT_POOL_NODES)).option("--near <box>", "put it on the host of this box").option("--no-wait", "do not wait for the cluster to be ready").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9385
9645
  if (!NODE_SIZES.includes(opts.size)) throw new KvboxError(`--size ${opts.size}: a node is one of ${NODE_SIZES.join(", ")}`);
9386
9646
  const nodes = nodeCount(opts.nodes);
9387
9647
  const client = await k8sClient(cmd);
@@ -9393,7 +9653,7 @@ var createCommand10 = new Command104("create").description("make a Kubernetes cl
9393
9653
  return;
9394
9654
  }
9395
9655
  const shown = shownName2(cluster2, client);
9396
- info(`${color.green("\u2713")} cluster ${color.bold(shown)} made on ${cluster2.host}: Kubernetes ${cluster2.version}, ${priceText2(cluster2)}`);
9656
+ info(`${color.green("\u2713")} cluster ${color.bold(shown)} made on ${cluster2.host}: Kubernetes ${cluster2.version}, ${priceText3(cluster2)}`);
9397
9657
  info(` API: ${apiText(cluster2)}`);
9398
9658
  info(` nodes: ${poolsText(cluster2)}`);
9399
9659
  if (opts.wait && !allReady(cluster2)) warn(`it is not all ready yet; look again with: kvbox k8s info ${shown}`);
@@ -9404,10 +9664,10 @@ var createCommand10 = new Command104("create").description("make a Kubernetes cl
9404
9664
  });
9405
9665
 
9406
9666
  // src/commands/k8s/domain/index.ts
9407
- import { Command as Command108 } from "commander";
9667
+ import { Command as Command114 } from "commander";
9408
9668
 
9409
9669
  // src/commands/k8s/domain/add.ts
9410
- import { Command as Command105 } from "commander";
9670
+ import { Command as Command111 } from "commander";
9411
9671
 
9412
9672
  // src/commands/domain/shared.ts
9413
9673
  function requireCloud4(client) {
@@ -9428,7 +9688,7 @@ function hostIn(name, zone) {
9428
9688
 
9429
9689
  // src/commands/k8s/domain/add.ts
9430
9690
  var clusterDomainJson = (d, cluster2) => ({ domain: d.domain, cluster: cluster2, status: d.status, www: d.www, url: d.url, error: d.error, records: d.records, createdAt: d.createdAt });
9431
- var addCommand3 = new Command105("add").description("serve a cluster at a domain of your own, https://<domain>, with its certificate made for you; an Ingress for that host picks the app").argument("<cluster>", "cluster name").argument("<domain>", "a domain you control, like example.com or app.example.com").option("--json", "print the domain as JSON").action(async (cluster2, domainArg, opts, cmd) => {
9691
+ var addCommand3 = new Command111("add").description("serve a cluster at a domain of your own, https://<domain>, with its certificate made for you; an Ingress for that host picks the app").argument("<cluster>", "cluster name").argument("<domain>", "a domain you control, like example.com or app.example.com").option("--json", "print the domain as JSON").action(async (cluster2, domainArg, opts, cmd) => {
9432
9692
  const domain = assertDomain(domainArg.trim().toLowerCase());
9433
9693
  const client = await k8sClient(cmd);
9434
9694
  try {
@@ -9465,8 +9725,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
9465
9725
  });
9466
9726
 
9467
9727
  // src/commands/k8s/domain/ls.ts
9468
- import { Command as Command106 } from "commander";
9469
- var lsCommand16 = new Command106("ls").alias("list").description("list a cluster's custom domains and whether they are live").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9728
+ import { Command as Command112 } from "commander";
9729
+ var lsCommand16 = new Command112("ls").alias("list").description("list a cluster's custom domains and whether they are live").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9470
9730
  const client = await k8sClient(cmd);
9471
9731
  try {
9472
9732
  const domains = await client.listClusterDomains(cluster2);
@@ -9485,8 +9745,8 @@ var lsCommand16 = new Command106("ls").alias("list").description("list a cluster
9485
9745
  });
9486
9746
 
9487
9747
  // src/commands/k8s/domain/rm.ts
9488
- import { Command as Command107 } from "commander";
9489
- var rmCommand15 = new Command107("rm").alias("remove").description("stop serving a cluster at a custom domain").argument("<cluster>", "cluster name").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (cluster2, domainArg, opts, cmd) => {
9748
+ import { Command as Command113 } from "commander";
9749
+ var rmCommand16 = new Command113("rm").alias("remove").description("stop serving a cluster at a custom domain").argument("<cluster>", "cluster name").argument("<domain>", "the domain").option("-y, --yes", "do not ask for confirmation").action(async (cluster2, domainArg, opts, cmd) => {
9490
9750
  const domain = domainArg.trim().toLowerCase();
9491
9751
  const client = await k8sClient(cmd);
9492
9752
  try {
@@ -9503,11 +9763,11 @@ var rmCommand15 = new Command107("rm").alias("remove").description("stop serving
9503
9763
  });
9504
9764
 
9505
9765
  // src/commands/k8s/domain/index.ts
9506
- var domainCommand = new Command108("domain").description("serve a cluster at domains of your own: add one, list them, remove one").addCommand(addCommand3).addCommand(lsCommand16).addCommand(rmCommand15);
9766
+ var domainCommand = new Command114("domain").description("serve a cluster at domains of your own: add one, list them, remove one").addCommand(addCommand3).addCommand(lsCommand16).addCommand(rmCommand16);
9507
9767
 
9508
9768
  // src/commands/k8s/info.ts
9509
- import { Command as Command109 } from "commander";
9510
- var infoCommand2 = new Command109("info").description("one cluster: its API address, whether it is ready, its nodes").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9769
+ import { Command as Command115 } from "commander";
9770
+ var infoCommand3 = new Command115("info").description("one cluster: its API address, whether it is ready, its nodes").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9511
9771
  const client = await k8sClient(cmd);
9512
9772
  try {
9513
9773
  const c2 = await client.getCluster(name);
@@ -9538,18 +9798,18 @@ var infoCommand2 = new Command109("info").description("one cluster: its API addr
9538
9798
  ...c2.backupSchedule ? [["backups", scheduleLine(`kvbox k8s backup schedule ${shown}`, c2.backupSchedule)]] : [],
9539
9799
  ["host", `${c2.host}${c2.country ? ` (${c2.country})` : ""}`],
9540
9800
  ...c2.room ? [["room", roomText(c2.room)]] : [],
9541
- ["cost", priceText2(c2)],
9801
+ ["cost", priceText3(c2)],
9542
9802
  ["created", `${age(c2.createdAt)}${c2.createdBy ? ` by ${c2.createdBy}` : ""}`]
9543
9803
  ];
9544
- printRows2(rows2);
9804
+ printRows3(rows2);
9545
9805
  } finally {
9546
9806
  await client.close();
9547
9807
  }
9548
9808
  });
9549
9809
 
9550
9810
  // src/commands/k8s/kubeconfig.ts
9551
- import { Command as Command110 } from "commander";
9552
- var kubeconfigCommand = new Command110("kubeconfig").description("print the cluster's kubeconfig (it is the cluster's admin: keep it like a password)").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9811
+ import { Command as Command116 } from "commander";
9812
+ var kubeconfigCommand = new Command116("kubeconfig").description("print the cluster's kubeconfig (it is the cluster's admin: keep it like a password)").argument("<name>", "cluster name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
9553
9813
  const client = await k8sClient(cmd);
9554
9814
  try {
9555
9815
  const made = await client.getKubeconfig(name);
@@ -9562,10 +9822,10 @@ var kubeconfigCommand = new Command110("kubeconfig").description("print the clus
9562
9822
  });
9563
9823
 
9564
9824
  // src/commands/k8s/link.ts
9565
- import { Command as Command111 } from "commander";
9825
+ import { Command as Command117 } from "commander";
9566
9826
  var reachedText = (l) => `${l.kind} ${l.to}`;
9567
9827
  var linkJson = (l, cluster2) => ({ cluster: cluster2, to: l.to, owner: l.owner, kind: l.kind, port: l.port, host: l.host, ...l.boxes ? { boxes: l.boxes } : {} });
9568
- var linkCommand2 = new Command111("link").description("let every pod of a cluster reach a database or a box's port (private; never public)").argument("<cluster>", "cluster name").argument("<target>", "a database (kvbox pg, kvbox redis) or a box; <slug>/<name> for another account's").option("-p, --port <port>", "the port, for a box (a database has its own)").option("--json", "print the link as JSON").action(async (cluster2, target, opts, cmd) => {
9828
+ var linkCommand2 = new Command117("link").description("let every pod of a cluster reach a database or a box's port (private; never public)").argument("<cluster>", "cluster name").argument("<target>", "a database (kvbox pg, kvbox redis) or a box; <slug>/<name> for another account's").option("-p, --port <port>", "the port, for a box (a database has its own)").option("--json", "print the link as JSON").action(async (cluster2, target, opts, cmd) => {
9569
9829
  const port = opts.port === void 0 ? void 0 : parseLinkPort(opts.port);
9570
9830
  const client = await k8sClient(cmd);
9571
9831
  try {
@@ -9583,8 +9843,8 @@ var linkCommand2 = new Command111("link").description("let every pod of a cluste
9583
9843
  });
9584
9844
 
9585
9845
  // src/commands/k8s/links.ts
9586
- import { Command as Command112 } from "commander";
9587
- var linksCommand2 = new Command112("links").description("list what a cluster reaches (kvbox k8s link)").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9846
+ import { Command as Command118 } from "commander";
9847
+ var linksCommand2 = new Command118("links").description("list what a cluster reaches (kvbox k8s link)").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9588
9848
  const client = await k8sClient(cmd);
9589
9849
  try {
9590
9850
  const links = await client.listClusterLinks(cluster2);
@@ -9600,8 +9860,8 @@ var linksCommand2 = new Command112("links").description("list what a cluster rea
9600
9860
  });
9601
9861
 
9602
9862
  // src/commands/k8s/ls.ts
9603
- import { Command as Command113 } from "commander";
9604
- var lsCommand17 = new Command113("ls").alias("list").description("list Kubernetes clusters").option("-a, --all", "every cluster on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
9863
+ import { Command as Command119 } from "commander";
9864
+ var lsCommand17 = new Command119("ls").alias("list").description("list Kubernetes clusters").option("-a, --all", "every cluster on the platform (platform admins only)").option("--json", "print as JSON").action(async (opts, cmd) => {
9605
9865
  const client = await k8sClient(cmd);
9606
9866
  try {
9607
9867
  const clusters = await client.listClusters({ all: opts.all });
@@ -9632,11 +9892,11 @@ var lsCommand17 = new Command113("ls").alias("list").description("list Kubernete
9632
9892
  });
9633
9893
 
9634
9894
  // src/commands/k8s/node/index.ts
9635
- import { Command as Command115 } from "commander";
9895
+ import { Command as Command121 } from "commander";
9636
9896
 
9637
9897
  // src/commands/k8s/node/restart.ts
9638
- import { Command as Command114 } from "commander";
9639
- var restartCommand2 = new Command114("restart").description("stop and boot one node of a cluster again (the cluster's own name restarts its master)").argument("<cluster>", "cluster name").argument("<node>", "the node's name, as kvbox k8s info lists it; the cluster's name for its master").option("--json", "print as JSON").action(async (name, node, opts, cmd) => {
9898
+ import { Command as Command120 } from "commander";
9899
+ var restartCommand2 = new Command120("restart").description("stop and boot one node of a cluster again (the cluster's own name restarts its master)").argument("<cluster>", "cluster name").argument("<node>", "the node's name, as kvbox k8s info lists it; the cluster's name for its master").option("--json", "print as JSON").action(async (name, node, opts, cmd) => {
9640
9900
  const client = await k8sClient(cmd);
9641
9901
  try {
9642
9902
  const c2 = await spin(`restarting ${node}\u2026`, client.restartClusterNode(name, node));
@@ -9648,13 +9908,13 @@ var restartCommand2 = new Command114("restart").description("stop and boot one n
9648
9908
  });
9649
9909
 
9650
9910
  // src/commands/k8s/node/index.ts
9651
- var nodeCommand = new Command115("node").description("one node of a cluster: restart it").addCommand(restartCommand2);
9911
+ var nodeCommand = new Command121("node").description("one node of a cluster: restart it").addCommand(restartCommand2);
9652
9912
 
9653
9913
  // src/commands/k8s/pool/index.ts
9654
- import { Command as Command120 } from "commander";
9914
+ import { Command as Command126 } from "commander";
9655
9915
 
9656
9916
  // src/commands/k8s/pool/add.ts
9657
- import { Command as Command116 } from "commander";
9917
+ import { Command as Command122 } from "commander";
9658
9918
 
9659
9919
  // src/commands/k8s/pool/shared.ts
9660
9920
  function poolReady(c2, pool) {
@@ -9706,7 +9966,7 @@ function printPool(client, c2, pool, done, waited) {
9706
9966
  }
9707
9967
 
9708
9968
  // src/commands/k8s/pool/add.ts
9709
- var addCommand4 = new Command116("add").description("add a pool of nodes to a cluster").argument("<cluster>", "cluster name").requiredOption("--size <size>", `what each node is sized at: ${NODE_SIZES.join(", ")}`).option("--nodes <n>", `how many nodes (1-${MAX_POOL_NODES})`, String(DEFAULT_POOL_NODES)).option("--name <pool>", "the pool's name (default: its size)").option("--no-wait", "do not wait for the nodes to join").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9969
+ var addCommand4 = new Command122("add").description("add a pool of nodes to a cluster").argument("<cluster>", "cluster name").requiredOption("--size <size>", `what each node is sized at: ${NODE_SIZES.join(", ")}`).option("--nodes <n>", `how many nodes (1-${MAX_POOL_NODES})`, String(DEFAULT_POOL_NODES)).option("--name <pool>", "the pool's name (default: its size)").option("--no-wait", "do not wait for the nodes to join").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9710
9970
  if (!NODE_SIZES.includes(opts.size)) throw new KvboxError(`--size ${opts.size}: a node is one of ${NODE_SIZES.join(", ")}`);
9711
9971
  const nodes = nodeCount(opts.nodes);
9712
9972
  const pool = opts.name ?? opts.size;
@@ -9723,8 +9983,8 @@ var addCommand4 = new Command116("add").description("add a pool of nodes to a cl
9723
9983
  });
9724
9984
 
9725
9985
  // src/commands/k8s/pool/ls.ts
9726
- import { Command as Command117 } from "commander";
9727
- var lsCommand18 = new Command117("ls").alias("list").description("list a cluster's pools").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9986
+ import { Command as Command123 } from "commander";
9987
+ var lsCommand18 = new Command123("ls").alias("list").description("list a cluster's pools").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9728
9988
  const client = await k8sClient(cmd);
9729
9989
  try {
9730
9990
  const c2 = await client.getCluster(cluster2);
@@ -9743,8 +10003,8 @@ var lsCommand18 = new Command117("ls").alias("list").description("list a cluster
9743
10003
  });
9744
10004
 
9745
10005
  // src/commands/k8s/pool/resize.ts
9746
- import { Command as Command118 } from "commander";
9747
- var resizeCommand = new Command118("resize").description("change how many nodes a pool has").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").requiredOption("--nodes <n>", "how many nodes the pool should have").option("--force", "fewer nodes: remove them at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation (fewer nodes)").option("--no-wait", "do not wait for new nodes to join, or for removed ones to drain").option("--json", "print as JSON").action(async (cluster2, pool, opts, cmd) => {
10006
+ import { Command as Command124 } from "commander";
10007
+ var resizeCommand = new Command124("resize").description("change how many nodes a pool has").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").requiredOption("--nodes <n>", "how many nodes the pool should have").option("--force", "fewer nodes: remove them at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation (fewer nodes)").option("--no-wait", "do not wait for new nodes to join, or for removed ones to drain").option("--json", "print as JSON").action(async (cluster2, pool, opts, cmd) => {
9748
10008
  const nodes = nodeCount(opts.nodes);
9749
10009
  const client = await k8sClient(cmd);
9750
10010
  try {
@@ -9771,8 +10031,8 @@ var resizeCommand = new Command118("resize").description("change how many nodes
9771
10031
  });
9772
10032
 
9773
10033
  // src/commands/k8s/pool/rm.ts
9774
- import { Command as Command119 } from "commander";
9775
- var rmCommand16 = new Command119("rm").alias("remove").description("remove a pool and its nodes from a cluster").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").option("--force", "remove the nodes at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the nodes to drain").option("--json", "print as JSON").action(async (cluster2, pool, opts, cmd) => {
10034
+ import { Command as Command125 } from "commander";
10035
+ var rmCommand17 = new Command125("rm").alias("remove").description("remove a pool and its nodes from a cluster").argument("<cluster>", "cluster name").argument("<pool>", "pool name (kvbox k8s pool ls <cluster>)").option("--force", "remove the nodes at once, undrained, with what they keep on their disks").option("-y, --yes", "do not ask for confirmation").option("--no-wait", "do not wait for the nodes to drain").option("--json", "print as JSON").action(async (cluster2, pool, opts, cmd) => {
9776
10036
  const client = await k8sClient(cmd);
9777
10037
  try {
9778
10038
  if (!await confirm(`Remove pool ${pool} of cluster ${cluster2} and its nodes${opts.force ? " without draining them, with whatever they keep on their disks" : ""}?`, opts.yes ?? false)) {
@@ -9795,14 +10055,14 @@ var rmCommand16 = new Command119("rm").alias("remove").description("remove a poo
9795
10055
  });
9796
10056
 
9797
10057
  // src/commands/k8s/pool/index.ts
9798
- var poolCommand = new Command120("pool").description("a cluster's node pools: add one, list them, change how many nodes one has, remove one").addCommand(addCommand4).addCommand(lsCommand18).addCommand(resizeCommand).addCommand(rmCommand16);
10058
+ var poolCommand = new Command126("pool").description("a cluster's node pools: add one, list them, change how many nodes one has, remove one").addCommand(addCommand4).addCommand(lsCommand18).addCommand(resizeCommand).addCommand(rmCommand17);
9799
10059
 
9800
10060
  // src/commands/k8s/proxy/index.ts
9801
- import { Command as Command124 } from "commander";
10061
+ import { Command as Command130 } from "commander";
9802
10062
 
9803
10063
  // src/commands/k8s/proxy/claim.ts
9804
- import { Command as Command121 } from "commander";
9805
- var claimCommand2 = new Command121("claim").description(`give a cluster an HTTPS address, https://<subdomain>.kvbox.app (up to ${MAX_BOX_SUBDOMAINS} per cluster); an Ingress for that host picks the app`).argument("<cluster>", "cluster name").argument("<subdomain>", "3-63 lowercase letters, digits and '-'; must be free").option("--json", "print the address as JSON").action(async (cluster2, subArg, opts, cmd) => {
10064
+ import { Command as Command127 } from "commander";
10065
+ var claimCommand2 = new Command127("claim").description(`give a cluster an HTTPS address, https://<subdomain>.kvbox.app (up to ${MAX_BOX_SUBDOMAINS} per cluster); an Ingress for that host picks the app`).argument("<cluster>", "cluster name").argument("<subdomain>", "3-63 lowercase letters, digits and '-'; must be free").option("--json", "print the address as JSON").action(async (cluster2, subArg, opts, cmd) => {
9806
10066
  const subdomain = assertSubdomain(subArg);
9807
10067
  const client = await k8sClient(cmd);
9808
10068
  try {
@@ -9820,8 +10080,8 @@ var claimCommand2 = new Command121("claim").description(`give a cluster an HTTPS
9820
10080
  });
9821
10081
 
9822
10082
  // src/commands/k8s/proxy/ls.ts
9823
- import { Command as Command122 } from "commander";
9824
- var lsCommand19 = new Command122("ls").alias("list").description("list a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
10083
+ import { Command as Command128 } from "commander";
10084
+ var lsCommand19 = new Command128("ls").alias("list").description("list a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").option("--json", "print as JSON").action(async (cluster2, opts, cmd) => {
9825
10085
  const client = await k8sClient(cmd);
9826
10086
  try {
9827
10087
  const subs = await client.listClusterSubdomains(cluster2);
@@ -9837,8 +10097,8 @@ var lsCommand19 = new Command122("ls").alias("list").description("list a cluster
9837
10097
  });
9838
10098
 
9839
10099
  // src/commands/k8s/proxy/release.ts
9840
- import { Command as Command123 } from "commander";
9841
- var releaseCommand2 = new Command123("release").description("give up one of a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").argument("<subdomain>", "the subdomain (kvbox k8s proxy ls <cluster>)").option("-y, --yes", "do not ask for confirmation").action(async (cluster2, subdomain, opts, cmd) => {
10100
+ import { Command as Command129 } from "commander";
10101
+ var releaseCommand2 = new Command129("release").description("give up one of a cluster's kvbox.app addresses").argument("<cluster>", "cluster name").argument("<subdomain>", "the subdomain (kvbox k8s proxy ls <cluster>)").option("-y, --yes", "do not ask for confirmation").action(async (cluster2, subdomain, opts, cmd) => {
9842
10102
  const client = await k8sClient(cmd);
9843
10103
  try {
9844
10104
  if (!await confirm(`Give up ${subdomain}, one of cluster ${cluster2}'s HTTPS addresses? Anyone may claim it after.`, opts.yes ?? false)) {
@@ -9854,11 +10114,11 @@ var releaseCommand2 = new Command123("release").description("give up one of a cl
9854
10114
  });
9855
10115
 
9856
10116
  // src/commands/k8s/proxy/index.ts
9857
- var proxyCommand2 = new Command124("proxy").description("a cluster's HTTPS addresses, https://<name>.kvbox.app: claim one, list them, give one up").addCommand(claimCommand2).addCommand(lsCommand19).addCommand(releaseCommand2);
10117
+ var proxyCommand2 = new Command130("proxy").description("a cluster's HTTPS addresses, https://<name>.kvbox.app: claim one, list them, give one up").addCommand(claimCommand2).addCommand(lsCommand19).addCommand(releaseCommand2);
9858
10118
 
9859
10119
  // src/commands/k8s/rm.ts
9860
- import { Command as Command125 } from "commander";
9861
- var rmCommand17 = new Command125("rm").alias("remove").description("delete a cluster with everything running in it").argument("<name>", "cluster name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
10120
+ import { Command as Command131 } from "commander";
10121
+ var rmCommand18 = new Command131("rm").alias("remove").description("delete a cluster with everything running in it").argument("<name>", "cluster name").option("-y, --yes", "do not ask for confirmation").action(async (name, opts, cmd) => {
9862
10122
  const client = await k8sClient(cmd);
9863
10123
  try {
9864
10124
  if (!await confirm(`Delete cluster ${name} with everything running in it?`, opts.yes ?? false)) {
@@ -9874,9 +10134,9 @@ var rmCommand17 = new Command125("rm").alias("remove").description("delete a clu
9874
10134
  });
9875
10135
 
9876
10136
  // src/commands/k8s/rotate.ts
9877
- import { Command as Command126 } from "commander";
10137
+ import { Command as Command132 } from "commander";
9878
10138
  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) => {
10139
+ var rotateCommand = new Command132("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
10140
  const client = await k8sClient(cmd);
9881
10141
  try {
9882
10142
  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)) {
@@ -9902,8 +10162,8 @@ var rotateCommand = new Command126("rotate").description("give a cluster new cre
9902
10162
  });
9903
10163
 
9904
10164
  // 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) => {
10165
+ import { Command as Command133 } from "commander";
10166
+ var startCommand2 = new Command133("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) => {
9907
10167
  const client = await k8sClient(cmd);
9908
10168
  try {
9909
10169
  const c2 = await spin(`starting cluster ${name}\u2026`, client.startCluster(name));
@@ -9915,8 +10175,8 @@ var startCommand2 = new Command127("start").description("run a cluster's master
9915
10175
  });
9916
10176
 
9917
10177
  // src/commands/k8s/unlink.ts
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) => {
10178
+ import { Command as Command134 } from "commander";
10179
+ var unlinkCommand2 = new Command134("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) => {
9920
10180
  const port = opts.port === void 0 ? void 0 : parseLinkPort(opts.port);
9921
10181
  if (!await confirm(`Cut cluster ${cluster2} off from ${target}${port !== void 0 ? ` port ${port}` : ""}? Its pods' open connections close too.`, opts.yes ?? false)) {
9922
10182
  info("cancelled");
@@ -9937,7 +10197,7 @@ var unlinkCommand2 = new Command128("unlink").description("take a cluster's link
9937
10197
  });
9938
10198
 
9939
10199
  // src/commands/k8s/index.ts
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);
10200
+ var k8sCommand = new Command135("k8s").description("Kubernetes clusters kvbox runs for you").addCommand(createCommand11).addCommand(lsCommand17).addCommand(infoCommand3).addCommand(kubeconfigCommand).addCommand(poolCommand).addCommand(nodeCommand).addCommand(proxyCommand2).addCommand(domainCommand).addCommand(linkCommand2).addCommand(unlinkCommand2).addCommand(linksCommand2).addCommand(backupCommand4).addCommand(startCommand2).addCommand(rotateCommand).addCommand(rmCommand18);
9941
10201
  var withOrg3 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal clusters)");
9942
10202
  for (const cmd of k8sCommand.commands) {
9943
10203
  if (cmd.commands.length > 0) cmd.commands.forEach(withOrg3);
@@ -9945,10 +10205,10 @@ for (const cmd of k8sCommand.commands) {
9945
10205
  }
9946
10206
 
9947
10207
  // src/commands/cron/index.ts
9948
- import { Command as Command142 } from "commander";
10208
+ import { Command as Command148 } from "commander";
9949
10209
 
9950
10210
  // src/commands/cron/create.ts
9951
- import { Command as Command130 } from "commander";
10211
+ import { Command as Command136 } from "commander";
9952
10212
 
9953
10213
  // src/commands/cron/shared.ts
9954
10214
  async function cronClient(cmd) {
@@ -10001,7 +10261,7 @@ function printTriggers(triggers) {
10001
10261
  }))
10002
10262
  );
10003
10263
  }
10004
- function printRows3(rows2) {
10264
+ function printRows4(rows2) {
10005
10265
  const width2 = Math.max(...rows2.map(([label]) => label.length));
10006
10266
  for (const [label, value] of rows2) process.stdout.write(`${color.dim(label.padEnd(width2))} ${value}
10007
10267
  `);
@@ -10009,7 +10269,7 @@ function printRows3(rows2) {
10009
10269
  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>")`);
10010
10270
 
10011
10271
  // src/commands/cron/create.ts
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) => {
10272
+ var createCommand12 = new Command136("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) => {
10013
10273
  const client = await cronClient(cmd);
10014
10274
  try {
10015
10275
  const service = await client.createCronService(name);
@@ -10026,8 +10286,8 @@ var createCommand11 = new Command130("create").description("make a cron service:
10026
10286
  });
10027
10287
 
10028
10288
  // src/commands/cron/info.ts
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) => {
10289
+ import { Command as Command137 } from "commander";
10290
+ var infoCommand4 = new Command137("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) => {
10031
10291
  const client = await cronClient(cmd);
10032
10292
  try {
10033
10293
  const service = await client.getCronService(name);
@@ -10036,7 +10296,7 @@ var infoCommand3 = new Command131("info").alias("get").description("show a cron
10036
10296
  json({ ...service, triggerList: triggers });
10037
10297
  return;
10038
10298
  }
10039
- printRows3([
10299
+ printRows4([
10040
10300
  ["name", shownName3(service, client)],
10041
10301
  ["triggers", String(service.triggers)],
10042
10302
  ["runs kept", `the last ${service.keepRuns} of each trigger`],
@@ -10051,8 +10311,8 @@ var infoCommand3 = new Command131("info").alias("get").description("show a cron
10051
10311
  });
10052
10312
 
10053
10313
  // src/commands/cron/ls.ts
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) => {
10314
+ import { Command as Command138 } from "commander";
10315
+ var lsCommand20 = new Command138("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) => {
10056
10316
  const client = await cronClient(cmd);
10057
10317
  try {
10058
10318
  const services = await client.listCronServices({ all: opts.all });
@@ -10072,8 +10332,8 @@ var lsCommand20 = new Command132("ls").alias("list").description("list cron serv
10072
10332
  });
10073
10333
 
10074
10334
  // src/commands/cron/rm.ts
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) => {
10335
+ import { Command as Command139 } from "commander";
10336
+ var rmCommand19 = new Command139("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) => {
10077
10337
  const client = await cronClient(cmd);
10078
10338
  try {
10079
10339
  if (!await confirm(`Delete cron service ${name}? Its triggers stop firing and their run history is deleted.`, opts.yes ?? false)) {
@@ -10089,10 +10349,10 @@ var rmCommand18 = new Command133("rm").alias("remove").description("delete a cro
10089
10349
  });
10090
10350
 
10091
10351
  // src/commands/cron/trigger/index.ts
10092
- import { Command as Command141 } from "commander";
10352
+ import { Command as Command147 } from "commander";
10093
10353
 
10094
10354
  // src/commands/cron/trigger/add.ts
10095
- import { Command as Command134 } from "commander";
10355
+ import { Command as Command140 } from "commander";
10096
10356
  function portOf(value) {
10097
10357
  const n2 = Number(value);
10098
10358
  if (!Number.isInteger(n2) || n2 < 1 || n2 > 65535) throw new KvboxError(`--port ${value}: a port is a number from 1 to 65535`);
@@ -10112,7 +10372,7 @@ function timeoutOf(value) {
10112
10372
  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`);
10113
10373
  return sec;
10114
10374
  }
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) => {
10375
+ var addCommand5 = new Command140("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) => {
10116
10376
  let action;
10117
10377
  if (opts.run !== void 0) {
10118
10378
  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");
@@ -10139,8 +10399,8 @@ var addCommand5 = new Command134("add").description("add a trigger: on a schedul
10139
10399
  });
10140
10400
 
10141
10401
  // src/commands/cron/trigger/ls.ts
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) => {
10402
+ import { Command as Command141 } from "commander";
10403
+ var lsCommand21 = new Command141("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) => {
10144
10404
  const client = await cronClient(cmd);
10145
10405
  try {
10146
10406
  const triggers = await client.listCronTriggers(service);
@@ -10156,8 +10416,8 @@ var lsCommand21 = new Command135("ls").alias("list").description("list a cron se
10156
10416
  });
10157
10417
 
10158
10418
  // src/commands/cron/trigger/pause.ts
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) => {
10419
+ import { Command as Command142 } from "commander";
10420
+ var pauseCommand2 = new Command142("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) => {
10161
10421
  const client = await cronClient(cmd);
10162
10422
  try {
10163
10423
  const trigger = await client.setCronTriggerEnabled(service, id, false);
@@ -10172,8 +10432,8 @@ var pauseCommand2 = new Command136("pause").description("stop a trigger from fir
10172
10432
  });
10173
10433
 
10174
10434
  // src/commands/cron/trigger/resume.ts
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) => {
10435
+ import { Command as Command143 } from "commander";
10436
+ var resumeCommand2 = new Command143("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) => {
10177
10437
  const client = await cronClient(cmd);
10178
10438
  try {
10179
10439
  const trigger = await client.setCronTriggerEnabled(service, id, true);
@@ -10188,8 +10448,8 @@ var resumeCommand2 = new Command137("resume").description("let a paused trigger
10188
10448
  });
10189
10449
 
10190
10450
  // src/commands/cron/trigger/rm.ts
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) => {
10451
+ import { Command as Command144 } from "commander";
10452
+ var rmCommand20 = new Command144("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) => {
10193
10453
  const client = await cronClient(cmd);
10194
10454
  try {
10195
10455
  if (!await confirm(`Delete trigger ${id} of cron service ${service}? Its run history is deleted too.`, opts.yes ?? false)) {
@@ -10205,8 +10465,8 @@ var rmCommand19 = new Command138("rm").alias("remove").description("delete a tri
10205
10465
  });
10206
10466
 
10207
10467
  // src/commands/cron/trigger/run.ts
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) => {
10468
+ import { Command as Command145 } from "commander";
10469
+ var runCommand = new Command145("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) => {
10210
10470
  const client = await cronClient(cmd);
10211
10471
  try {
10212
10472
  const trigger = await client.runCronTrigger(service, id);
@@ -10222,13 +10482,13 @@ var runCommand = new Command139("run").description("fire a trigger now, once, be
10222
10482
  });
10223
10483
 
10224
10484
  // src/commands/cron/trigger/runs.ts
10225
- import { Command as Command140 } from "commander";
10485
+ import { Command as Command146 } from "commander";
10226
10486
  function limitOf(value) {
10227
10487
  const n2 = Number(value);
10228
10488
  if (!Number.isInteger(n2) || n2 < 1) throw new KvboxError(`-n ${value}: a number of runs, 1 or more`);
10229
10489
  return n2;
10230
10490
  }
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) => {
10491
+ var runsCommand = new Command146("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) => {
10232
10492
  const limit = limitOf(opts.limit);
10233
10493
  const client = await cronClient(cmd);
10234
10494
  try {
@@ -10258,10 +10518,10 @@ var runsCommand = new Command140("runs").aliases(["logs"]).description("show how
10258
10518
  });
10259
10519
 
10260
10520
  // src/commands/cron/trigger/index.ts
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);
10521
+ var triggerCommand = new Command147("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(rmCommand20);
10262
10522
 
10263
10523
  // src/commands/cron/index.ts
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);
10524
+ var cronCommand = new Command148("cron").description("cron: call a box on a schedule, waking it first if it sleeps").addCommand(createCommand12).addCommand(lsCommand20).addCommand(infoCommand4).addCommand(rmCommand19).addCommand(triggerCommand);
10265
10525
  var withOrg4 = (cmd) => cmd.option("--org <slug>", "act in this org (- for your personal cron services)");
10266
10526
  for (const cmd of cronCommand.commands) {
10267
10527
  if (cmd === triggerCommand) cmd.commands.forEach(withOrg4);
@@ -10269,13 +10529,13 @@ for (const cmd of cronCommand.commands) {
10269
10529
  }
10270
10530
 
10271
10531
  // src/commands/managed/kind.ts
10272
- import { Command as Command161 } from "commander";
10532
+ import { Command as Command167 } from "commander";
10273
10533
 
10274
10534
  // src/commands/managed/backup/index.ts
10275
- import { Command as Command149 } from "commander";
10535
+ import { Command as Command155 } from "commander";
10276
10536
 
10277
10537
  // src/commands/managed/backup/create.ts
10278
- import { Command as Command144 } from "commander";
10538
+ import { Command as Command150 } from "commander";
10279
10539
 
10280
10540
  // src/commands/managed/shared.ts
10281
10541
  import "commander";
@@ -10309,7 +10569,7 @@ async function managedClient(cmd) {
10309
10569
  }
10310
10570
  var shownName4 = (m, user) => m.owner === user ? m.name : `${m.owner}/${m.name}`;
10311
10571
  var storageText = (m) => m.health?.storageUsedBytes !== void 0 ? `${gb(m.health.storageUsedBytes)} of ${m.storageGib} GB used` : `${m.storageGib} GB`;
10312
- var nearlyFull2 = (m) => m.health?.storageUsedBytes !== void 0 && m.health.storageTotalBytes !== void 0 && m.health.storageTotalBytes > 0 && m.health.storageUsedBytes / m.health.storageTotalBytes >= 0.9;
10572
+ var nearlyFull3 = (m) => m.health?.storageUsedBytes !== void 0 && m.health.storageTotalBytes !== void 0 && m.health.storageTotalBytes > 0 && m.health.storageUsedBytes / m.health.storageTotalBytes >= 0.9;
10313
10573
  function stateText(m) {
10314
10574
  if (m.status === "stopped") return `${status(m.status)} ${color.dim("(only its storage is charged)")}`;
10315
10575
  if (m.status !== "running" || m.health === void 0) return status(m.status);
@@ -10326,7 +10586,7 @@ function infoRows(spec, m, user) {
10326
10586
  ];
10327
10587
  if (user !== void 0 && m.owner !== user) rows2.push(["owner", m.owner]);
10328
10588
  for (const fact of m.health?.facts ?? []) rows2.push([fact.title.toLowerCase(), fact.value]);
10329
- rows2.push(["storage", `${storageText(m)}${nearlyFull2(m) ? color.yellow(` almost full: kvbox ${spec.command} grow ${name} <GB>`) : ""}`]);
10589
+ rows2.push(["storage", `${storageText(m)}${nearlyFull3(m) ? color.yellow(` almost full: kvbox ${spec.command} grow ${name} <GB>`) : ""}`]);
10330
10590
  rows2.push(...settingRows(spec, m.settings), ["password", color.dim(`kvbox ${spec.command} password ${name}`)]);
10331
10591
  rows2.push(["private", `${m.urls.private} ${color.dim(m.links.length > 0 ? `(from ${m.links.join(", ")})` : `(no box is linked: kvbox ${spec.command} link ${name} <box>)`)}`]);
10332
10592
  rows2.push(["public", m.urls.public ?? color.dim(`off (kvbox ${spec.command} public ${name} on)`)]);
@@ -10338,7 +10598,7 @@ function infoRows(spec, m, user) {
10338
10598
  function scheduleText2(spec, name, s, now = Date.now()) {
10339
10599
  return scheduleLine(`kvbox ${spec.command} backup schedule ${name}`, s, now);
10340
10600
  }
10341
- function printRows4(rows2) {
10601
+ function printRows5(rows2) {
10342
10602
  const width2 = Math.max(...rows2.map(([label]) => label.length));
10343
10603
  for (const [label, value] of rows2) process.stdout.write(`${color.dim(label.padEnd(width2))} ${value}
10344
10604
  `);
@@ -10362,7 +10622,7 @@ function parseStorage(text2, flag) {
10362
10622
  }
10363
10623
 
10364
10624
  // src/commands/managed/backup/create.ts
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) => {
10625
+ var createCommand13 = (spec) => new Command150("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) => {
10366
10626
  const client = await managedClient(cmd);
10367
10627
  const ls = `kvbox ${spec.command} backup ls ${name}`;
10368
10628
  try {
@@ -10389,7 +10649,7 @@ var createCommand12 = (spec) => new Command144("create").description("back up a
10389
10649
  });
10390
10650
 
10391
10651
  // src/commands/managed/backup/ls.ts
10392
- import { Command as Command145 } from "commander";
10652
+ import { Command as Command151 } from "commander";
10393
10653
  var lsCommand22 = (spec) => {
10394
10654
  const removedOnes = async (err, name, client) => {
10395
10655
  if (!(err instanceof CallError && err.status === 404)) throw err;
@@ -10398,7 +10658,7 @@ var lsCommand22 = (spec) => {
10398
10658
  const own = name.includes("/") ? [] : gone.filter((b) => b.owner === me(client));
10399
10659
  return own.length > 0 ? own : gone;
10400
10660
  };
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) => {
10661
+ return new Command151("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) => {
10402
10662
  const client = await managedClient(cmd);
10403
10663
  try {
10404
10664
  const list = name === void 0 ? await client.listManagedBackups(spec.kind) : await client.managedBackups(spec.kind, name).catch((err) => removedOnes(err, name, client));
@@ -10441,8 +10701,8 @@ var lsCommand22 = (spec) => {
10441
10701
  };
10442
10702
 
10443
10703
  // src/commands/managed/backup/restore.ts
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) => {
10704
+ import { Command as Command152 } from "commander";
10705
+ var restoreCommand5 = (spec) => new Command152("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) => {
10446
10706
  const client = await managedClient(cmd);
10447
10707
  try {
10448
10708
  const backup = await client.managedBackup(spec.kind, name, id);
@@ -10464,8 +10724,8 @@ var restoreCommand5 = (spec) => new Command146("restore").description("put a bac
10464
10724
  });
10465
10725
 
10466
10726
  // src/commands/managed/backup/rm.ts
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) => {
10727
+ import { Command as Command153 } from "commander";
10728
+ var rmCommand21 = (spec) => new Command153("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) => {
10469
10729
  const client = await managedClient(cmd);
10470
10730
  try {
10471
10731
  await removeListed(client, await client.listManagedBackups(spec.kind), (b) => b.name, name, id, `database ${name}`, opts.yes ?? false);
@@ -10475,8 +10735,8 @@ var rmCommand20 = (spec) => new Command147("rm").alias("remove").description("re
10475
10735
  });
10476
10736
 
10477
10737
  // src/commands/managed/backup/schedule.ts
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(
10738
+ import { Command as Command154 } from "commander";
10739
+ var scheduleCommand5 = (spec) => scheduleFlags(new Command154("schedule").description("show or change when a database is backed up on its own (daily, UTC)").argument("<db>", "its name")).action(
10480
10740
  async (name, flags, cmd) => {
10481
10741
  const change = changeOf(flags);
10482
10742
  const client = await managedClient(cmd);
@@ -10492,18 +10752,18 @@ var scheduleCommand5 = (spec) => scheduleFlags(new Command148("schedule").descri
10492
10752
 
10493
10753
  // src/commands/managed/backup/index.ts
10494
10754
  var backupCommand5 = (spec) => {
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");
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)"));
10755
+ const command = new Command155("backup").description("back up a database to the kvbox cloud, list backups, restore or remove one, or change its nightly schedule");
10756
+ for (const make of [createCommand13, lsCommand22, restoreCommand5, rmCommand21, scheduleCommand5]) command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
10497
10757
  return command;
10498
10758
  };
10499
10759
 
10500
10760
  // src/commands/managed/create.ts
10501
- import { Command as Command150 } from "commander";
10761
+ import { Command as Command156 } from "commander";
10502
10762
  import { setTimeout as sleep5 } from "timers/promises";
10503
10763
  var READY_WAIT_MS2 = 9e4;
10504
10764
  var READY_STEP_MS = 2e3;
10505
- var createCommand13 = (spec) => {
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");
10765
+ var createCommand14 = (spec) => {
10766
+ const command = new Command156("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");
10507
10767
  for (const o of spec.options) command.option(`--${o.name} <${o.arg}>`, o.help);
10508
10768
  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) => {
10509
10769
  const options = Object.fromEntries(spec.options.flatMap((o) => typeof opts[o.name] === "string" ? [[o.name, opts[o.name]]] : []));
@@ -10538,7 +10798,7 @@ var createCommand13 = (spec) => {
10538
10798
  }
10539
10799
  const restored = made.fromBackup === void 0 ? "" : `, the data of backup ${made.fromBackup}`;
10540
10800
  info(`${color.green("\u2713")} database ${color.bold(shown)} ${ready ? "is ready" : "is created and still starting"} ${color.dim(`(${spec.title} ${made.version}, ${made.storageGib} GB of storage${restored})`)}`);
10541
- printRows4([...settingRows(spec, made.settings), ...secretRows(made.secret)].map(([label, value]) => [` ${label}`, value]));
10801
+ printRows5([...settingRows(spec, made.settings), ...secretRows(made.secret)].map(([label, value]) => [` ${label}`, value]));
10542
10802
  info("");
10543
10803
  info("Nobody can reach it yet. To let something in:");
10544
10804
  info(` a box of yours kvbox ${spec.command} link ${shown} <box> ${color.dim(`(a new one right next to it: kvbox new <box> --near ${shown})`)}`);
@@ -10552,8 +10812,8 @@ var createCommand13 = (spec) => {
10552
10812
  };
10553
10813
 
10554
10814
  // src/commands/managed/grow.ts
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) => {
10815
+ import { Command as Command157 } from "commander";
10816
+ var growCommand4 = (spec) => new Command157("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) => {
10557
10817
  const storageGib = parseStorage(size, "size");
10558
10818
  const client = await managedClient(cmd);
10559
10819
  try {
@@ -10566,21 +10826,21 @@ var growCommand3 = (spec) => new Command151("grow").description("give a database
10566
10826
  });
10567
10827
 
10568
10828
  // src/commands/managed/info.ts
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) => {
10829
+ import { Command as Command158 } from "commander";
10830
+ var infoCommand5 = (spec) => new Command158("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) => {
10571
10831
  const client = await managedClient(cmd);
10572
10832
  try {
10573
10833
  const m = await client.getManaged(spec.kind, name);
10574
10834
  if (opts.json) json(m);
10575
- else printRows4(infoRows(spec, m, me(client)));
10835
+ else printRows5(infoRows(spec, m, me(client)));
10576
10836
  } finally {
10577
10837
  await client.close();
10578
10838
  }
10579
10839
  });
10580
10840
 
10581
10841
  // src/commands/managed/link.ts
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) => {
10842
+ import { Command as Command159 } from "commander";
10843
+ var linkCommand3 = (spec) => new Command159("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) => {
10584
10844
  const client = await managedClient(cmd);
10585
10845
  try {
10586
10846
  const m = await spin(`linking ${box2} to ${name}\u2026`, client.linkManaged(spec.kind, name, box2));
@@ -10596,7 +10856,7 @@ var linkCommand3 = (spec) => new Command153("link").description("let a box reach
10596
10856
  });
10597
10857
 
10598
10858
  // src/commands/managed/ls.ts
10599
- import { Command as Command154 } from "commander";
10859
+ import { Command as Command160 } from "commander";
10600
10860
  function listRows(items, user, kindColumn) {
10601
10861
  return items.map((m) => ({
10602
10862
  owner: m.owner === user ? "private" : m.owner,
@@ -10610,7 +10870,7 @@ function listRows(items, user, kindColumn) {
10610
10870
  created: age(m.createdAt)
10611
10871
  }));
10612
10872
  }
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) => {
10873
+ var lsCommand23 = (spec) => new Command160("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) => {
10614
10874
  const client = await managedClient(cmd);
10615
10875
  try {
10616
10876
  const items = await client.listManaged(spec?.kind, { all: opts.all });
@@ -10630,8 +10890,8 @@ var lsCommand23 = (spec) => new Command154("ls").alias("list").description(spec
10630
10890
  });
10631
10891
 
10632
10892
  // src/commands/managed/password.ts
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) => {
10893
+ import { Command as Command161 } from "commander";
10894
+ var passwordCommand2 = (spec) => new Command161("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) => {
10635
10895
  const client = await managedClient(cmd);
10636
10896
  try {
10637
10897
  const secret = opts.reset ? await spin(`setting a new password on ${name}\u2026`, client.resetManagedPassword(spec.kind, name)) : await client.managedPassword(spec.kind, name);
@@ -10640,15 +10900,15 @@ var passwordCommand = (spec) => new Command155("password").description("show a d
10640
10900
  return;
10641
10901
  }
10642
10902
  if (opts.reset) info(`${color.green("\u2713")} database ${name} has a new password; the old one no longer works`);
10643
- printRows4(secretRows(secret));
10903
+ printRows5(secretRows(secret));
10644
10904
  } finally {
10645
10905
  await client.close();
10646
10906
  }
10647
10907
  });
10648
10908
 
10649
10909
  // src/commands/managed/public.ts
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) => {
10910
+ import { Command as Command162 } from "commander";
10911
+ var publicCommand2 = (spec) => new Command162("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) => {
10652
10912
  if (state !== "on" && state !== "off") throw new KvboxError(`write on or off: kvbox ${spec.command} public ${name} on`);
10653
10913
  const client = await managedClient(cmd);
10654
10914
  try {
@@ -10669,8 +10929,8 @@ var publicCommand2 = (spec) => new Command156("public").description("open a data
10669
10929
  });
10670
10930
 
10671
10931
  // src/commands/managed/rm.ts
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) => {
10932
+ import { Command as Command163 } from "commander";
10933
+ var rmCommand22 = (spec) => new Command163("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) => {
10674
10934
  const client = await managedClient(cmd);
10675
10935
  try {
10676
10936
  if (!await confirm(`Delete database ${name} and all its data? There is no backup.`, opts.yes ?? false)) {
@@ -10686,8 +10946,8 @@ var rmCommand21 = (spec) => new Command157("rm").alias("remove").description("de
10686
10946
  });
10687
10947
 
10688
10948
  // src/commands/managed/start.ts
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) => {
10949
+ import { Command as Command164 } from "commander";
10950
+ var startCommand3 = (spec) => new Command164("start").description("run a stopped database again").argument("<db>", "its name").option("--json", "print as JSON").action(async (name, opts, cmd) => {
10691
10951
  const client = await managedClient(cmd);
10692
10952
  try {
10693
10953
  const m = await spin(`starting ${name}\u2026`, client.startManaged(spec.kind, name));
@@ -10699,8 +10959,8 @@ var startCommand3 = (spec) => new Command158("start").description("run a stopped
10699
10959
  });
10700
10960
 
10701
10961
  // src/commands/managed/stop.ts
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) => {
10962
+ import { Command as Command165 } from "commander";
10963
+ var stopCommand2 = (spec) => new Command165("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) => {
10704
10964
  const client = await managedClient(cmd);
10705
10965
  try {
10706
10966
  const m = await spin(`stopping ${name}\u2026`, client.stopManaged(spec.kind, name));
@@ -10712,8 +10972,8 @@ var stopCommand2 = (spec) => new Command159("stop").description("shut a database
10712
10972
  });
10713
10973
 
10714
10974
  // src/commands/managed/unlink.ts
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) => {
10975
+ import { Command as Command166 } from "commander";
10976
+ var unlinkCommand3 = (spec) => new Command166("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) => {
10717
10977
  const client = await managedClient(cmd);
10718
10978
  try {
10719
10979
  const m = await spin(`unlinking ${box2} from ${name}\u2026`, client.unlinkManaged(spec.kind, name, box2));
@@ -10726,8 +10986,8 @@ var unlinkCommand3 = (spec) => new Command160("unlink").description("stop a box
10726
10986
 
10727
10987
  // src/commands/managed/kind.ts
10728
10988
  function kindCommand(spec, description) {
10729
- const command = new Command161(spec.command).aliases(spec.aliases).description(description);
10730
- for (const make of [createCommand13, lsCommand23, infoCommand4, passwordCommand, publicCommand2, linkCommand3, unlinkCommand3, growCommand3, stopCommand2, startCommand3, rmCommand21]) {
10989
+ const command = new Command167(spec.command).aliases(spec.aliases).description(description);
10990
+ for (const make of [createCommand14, lsCommand23, infoCommand5, passwordCommand2, publicCommand2, linkCommand3, unlinkCommand3, growCommand4, stopCommand2, startCommand3, rmCommand22]) {
10731
10991
  command.addCommand(make(spec).option("--org <slug>", "act in this org (- for your personal databases)"));
10732
10992
  }
10733
10993
  command.addCommand(backupCommand5(spec));
@@ -10741,14 +11001,14 @@ var pgCommand = kindCommand(POSTGRES2, "managed PostgreSQL: a database kvbox run
10741
11001
  var redisCommand = kindCommand(REDIS, "managed Redis (Valkey): a Redis kvbox runs for you, private until you link a box or make it public");
10742
11002
 
10743
11003
  // src/commands/managed/index.ts
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)"));
11004
+ import { Command as Command168 } from "commander";
11005
+ var managedCommand = new Command168("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)"));
10746
11006
 
10747
11007
  // src/commands/env/index.ts
10748
- import { Command as Command166 } from "commander";
11008
+ import { Command as Command172 } from "commander";
10749
11009
 
10750
11010
  // src/commands/env/ls.ts
10751
- import { Command as Command163 } from "commander";
11011
+ import { Command as Command169 } from "commander";
10752
11012
 
10753
11013
  // src/commands/env/shared.ts
10754
11014
  function requireCloud5(client) {
@@ -10775,7 +11035,7 @@ function firstBootHint(box2, name) {
10775
11035
  }
10776
11036
 
10777
11037
  // src/commands/env/ls.ts
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) => {
11038
+ var lsCommand24 = new Command169("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) => {
10779
11039
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10780
11040
  try {
10781
11041
  if (opts.box !== void 0) {
@@ -10814,8 +11074,8 @@ var lsCommand24 = new Command163("ls").alias("list").description("list the varia
10814
11074
  });
10815
11075
 
10816
11076
  // src/commands/env/rm.ts
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) => {
11077
+ import { Command as Command170 } from "commander";
11078
+ var rmCommand23 = new Command170("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) => {
10819
11079
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10820
11080
  try {
10821
11081
  const target = opts.box === void 0 ? void 0 : await findBox2(client, opts.box);
@@ -10852,8 +11112,8 @@ var rmCommand22 = new Command164("rm").alias("remove").description("remove varia
10852
11112
  });
10853
11113
 
10854
11114
  // src/commands/env/set.ts
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) => {
11115
+ import { Command as Command171 } from "commander";
11116
+ var setCommand2 = new Command171("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) => {
10857
11117
  const client = await clientFor(cmd.optsWithGlobals(), { autoStart: false });
10858
11118
  try {
10859
11119
  const owner = opts.box === void 0 ? requireCloud5(client) : void 0;
@@ -10890,15 +11150,15 @@ var setCommand2 = new Command165("set").description("add or change a variable; b
10890
11150
  });
10891
11151
 
10892
11152
  // src/commands/env/index.ts
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);
11153
+ var envCommand = new Command172("env").description("environment variables every box of yours gets when it starts (secrets too)").addCommand(lsCommand24, { isDefault: true }).addCommand(setCommand2).addCommand(rmCommand23);
10894
11154
  for (const cmd of envCommand.commands) cmd.option("--org <slug>", "the org's variables instead of yours");
10895
11155
 
10896
11156
  // src/commands/domain/index.ts
10897
- import { Command as Command170 } from "commander";
11157
+ import { Command as Command176 } from "commander";
10898
11158
 
10899
11159
  // src/commands/domain/add.ts
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) => {
11160
+ import { Command as Command173 } from "commander";
11161
+ var addCommand6 = new Command173("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) => {
10902
11162
  const domain = assertDomain(domainArg.trim().toLowerCase());
10903
11163
  const port = opts.port === void 0 ? void 0 : parsePorts([opts.port])[0];
10904
11164
  const client = await clientFor(cmd.optsWithGlobals());
@@ -10934,8 +11194,8 @@ kvbox checks every minute; ${domain} is served at ${d.url} once its records are
10934
11194
  });
10935
11195
 
10936
11196
  // src/commands/domain/ls.ts
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) => {
11197
+ import { Command as Command174 } from "commander";
11198
+ var lsCommand25 = new Command174("ls").alias("list").description("list your custom domains and whether they are live").option("--json", "print as JSON").action(async (opts, cmd) => {
10939
11199
  const client = await clientFor(cmd.optsWithGlobals());
10940
11200
  try {
10941
11201
  requireCloud4(client);
@@ -10964,8 +11224,8 @@ var lsCommand25 = new Command168("ls").alias("list").description("list your cust
10964
11224
  });
10965
11225
 
10966
11226
  // src/commands/domain/rm.ts
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) => {
11227
+ import { Command as Command175 } from "commander";
11228
+ var rmCommand24 = new Command175("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) => {
10969
11229
  const domain = domainArg.trim().toLowerCase();
10970
11230
  const client = await clientFor(cmd.optsWithGlobals());
10971
11231
  try {
@@ -10986,7 +11246,7 @@ var rmCommand23 = new Command169("rm").alias("remove").description("stop serving
10986
11246
  });
10987
11247
 
10988
11248
  // src/commands/domain/index.ts
10989
- var domainCommand2 = new Command170("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand6).addCommand(lsCommand25).addCommand(rmCommand23);
11249
+ var domainCommand2 = new Command176("domain").alias("domains").description("serve a box at a domain of your own").addCommand(addCommand6).addCommand(lsCommand25).addCommand(rmCommand24);
10990
11250
  for (const cmd of domainCommand2.commands) cmd.option("--org <slug>", "act in this org (- for your personal boxes)");
10991
11251
 
10992
11252
  // src/commands/update.ts
@@ -10994,7 +11254,7 @@ import { spawn as spawn8 } from "child_process";
10994
11254
  import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
10995
11255
  import { tmpdir } from "os";
10996
11256
  import { join as join9 } from "path";
10997
- import { Command as Command171 } from "commander";
11257
+ import { Command as Command177 } from "commander";
10998
11258
 
10999
11259
  // src/update.ts
11000
11260
  import { mkdirSync, readFileSync as readFileSync3, writeFileSync } from "fs";
@@ -11113,7 +11373,7 @@ function run2(cmd, args) {
11113
11373
  child.on("exit", (code, signal) => resolve4(code ?? (signal ? 1 : 0)));
11114
11374
  });
11115
11375
  }
11116
- var selfUpdateCommand = new Command171("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
11376
+ var selfUpdateCommand = new Command177("update").description("update kvbox to the latest version (reruns the installer from kvbox.sh, agent skill included)").action(async () => {
11117
11377
  suppressUpdateNotice();
11118
11378
  const inst = installerFor(process.platform, process.env["KVBOX_INSTALL_URL"] || INSTALL_BASE);
11119
11379
  let code;
@@ -11137,7 +11397,7 @@ var selfUpdateCommand = new Command171("update").description("update kvbox to th
11137
11397
  import { chmod as chmod2, mkdir as mkdir4, readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
11138
11398
  import { homedir as homedir2 } from "os";
11139
11399
  import { dirname as dirname2, join as join11 } from "path";
11140
- import { Command as Command172 } from "commander";
11400
+ import { Command as Command178 } from "commander";
11141
11401
 
11142
11402
  // src/sshConfig.ts
11143
11403
  import { spawnSync as spawnSync4 } from "child_process";
@@ -11259,7 +11519,7 @@ async function forgetReplacedBox(alias, id, p) {
11259
11519
  }
11260
11520
 
11261
11521
  // src/commands/sshConfig.ts
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) => {
11522
+ var sshConfigCommand = new Command178("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) => {
11263
11523
  const file = opts.file ?? join11(homedir2(), ".ssh", "config");
11264
11524
  const before = await readFile9(file, "utf8").catch((err) => {
11265
11525
  if (err.code === "ENOENT") return "";
@@ -11325,8 +11585,8 @@ async function aliasesOf(client, boxes, gone) {
11325
11585
 
11326
11586
  // src/commands/sshProxy.ts
11327
11587
  import { connect } from "net";
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) => {
11588
+ import { Command as Command179 } from "commander";
11589
+ var sshProxyCommand = new Command179("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) => {
11330
11590
  const ref = parseAlias(host);
11331
11591
  if (ref === void 0) throw new KvboxError(`${host}: not a kvbox name (<box>.kvbox or <box>.<org>.kvbox)`);
11332
11592
  const client = await clientFor(cmd.optsWithGlobals());
@@ -11424,6 +11684,7 @@ var HELP_GROUPS = [
11424
11684
  ["snapshots", "freeze a running box into a snapshot, start new boxes from it"],
11425
11685
  ["volume", "disks of their own that move between boxes"],
11426
11686
  ["bucket", "object storage: S3 buckets for your files"],
11687
+ ["registry", "container registry: a private place for your docker images"],
11427
11688
  ["pg", "managed PostgreSQL: a database kvbox runs for you"],
11428
11689
  ["redis", "managed Redis (Valkey): a Redis kvbox runs for you"],
11429
11690
  ["k8s", "managed Kubernetes: a cluster kvbox runs for you, its nodes your boxes"],
@@ -11489,11 +11750,12 @@ function installRootHelp(program) {
11489
11750
 
11490
11751
  // src/program.ts
11491
11752
  function buildProgram() {
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();
11753
+ const program = new Command180("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();
11493
11754
  program.addCommand(vmCommand);
11494
11755
  program.addCommand(snapshotsCommand);
11495
11756
  program.addCommand(volumeCommand);
11496
11757
  program.addCommand(bucketCommand);
11758
+ program.addCommand(registryCommand);
11497
11759
  program.addCommand(pgCommand);
11498
11760
  program.addCommand(redisCommand);
11499
11761
  program.addCommand(managedCommand);