sandcovery 0.2.0 → 0.4.0

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.
@@ -1,5 +1,9 @@
1
- import { M as TaggedError } from "./Schema-C4ay0Aif.mjs";
2
- import { _ as SandboxStatus, b as ProviderSort, c as SpendLimit, o as KeyKind } from "./origin-Dj-n4EQa.mjs";
1
+ import { I as TaggedError, L as millis, R as seconds, z as toMillis } from "./Schema-CFI3ZMu8.mjs";
2
+ import { D as CARD_FEE_TERMS, O as CREDIT_PURCHASE_MAX_MICRO_USD, _ as SandboxStatus, c as SpendLimit, j as MICRO_USD_PER_DOLLAR, k as CREDIT_PURCHASE_MIN_MICRO_USD, o as KeyKind, x as ProviderSort, y as DEFAULT_SLUG } from "./origin-BTx2gX8x.mjs";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import crypto from "node:crypto";
6
+ import os from "node:os";
3
7
  // ../cli-core/src/canceled.ts
4
8
  var Canceled = class extends TaggedError("Canceled") {};
5
9
  // ../cli-core/src/failure.ts
@@ -26,6 +30,8 @@ const blockedClasses = /* @__PURE__ */ new Set([
26
30
  "usage"
27
31
  ]);
28
32
  const reasons = {
33
+ agreement_accepted: "conflict",
34
+ agreement_changed: "conflict",
29
35
  agreement_not_accepted: "conflict",
30
36
  api_error: "platform",
31
37
  campaign_funding_active: "conflict",
@@ -36,6 +42,7 @@ const reasons = {
36
42
  confirmation_required: "missing_input",
37
43
  conflict: "conflict",
38
44
  contract_locked: "conflict",
45
+ domain_taken: "conflict",
39
46
  internal_error: "bug",
40
47
  invalid_arguments: "usage",
41
48
  invalid_config: "config",
@@ -43,6 +50,8 @@ const reasons = {
43
50
  login_required: "authentication",
44
51
  market_information_locked: "conflict",
45
52
  missing_command: "usage",
53
+ missing_installation: "missing_input",
54
+ missing_job: "missing_input",
46
55
  missing_key: "missing_input",
47
56
  missing_path: "missing_input",
48
57
  missing_port: "missing_input",
@@ -59,14 +68,18 @@ const reasons = {
59
68
  not_found: "not_found",
60
69
  out_of_credits: "limit",
61
70
  permission_denied: "permission",
71
+ proof_not_found: "conflict",
62
72
  provider_error: "platform",
63
73
  rate_limited: "rate_limit",
64
74
  redirected: "network",
75
+ site_exists: "conflict",
76
+ site_taken: "conflict",
65
77
  site_unverified: "conflict",
66
78
  spawn_failed: "platform",
67
79
  spend_limit_reached: "limit",
68
80
  stale_login: "conflict",
69
81
  subscription_required: "limit",
82
+ team_has_site: "conflict",
70
83
  token_expired: "authentication",
71
84
  token_scope_required: "permission",
72
85
  tool_refused: "conflict",
@@ -357,6 +370,7 @@ const readOptionToken = ({ options, token }) => {
357
370
  };
358
371
  const booleanText = /* @__PURE__ */ new Map([["false", false], ["true", true]]);
359
372
  const isOptionToken = (token) => token.startsWith("-") && token !== "-";
373
+ const isOptionValue = (token) => !isOptionToken(token) || Number.isFinite(Number(token));
360
374
  const flagOf = (options, name) => {
361
375
  const value = options[name];
362
376
  return value?.kind === "flag" ? value.value : void 0;
@@ -439,7 +453,7 @@ const takeValue = (state, read, option) => {
439
453
  return;
440
454
  }
441
455
  const next = state.tokens[state.index];
442
- if (next === void 0 || isOptionToken(next)) {
456
+ if (next === void 0 || !isOptionValue(next)) {
443
457
  const example = option.hint === void 0 ? "" : `, such as ${option.hint}`;
444
458
  state.issues.push({
445
459
  field: `--${option.name}`,
@@ -541,11 +555,30 @@ const parseFailure = ({ bin, issues, path }) => {
541
555
  reason: first?.reason ?? "invalid_arguments"
542
556
  });
543
557
  };
558
+ millis(50);
559
+ toMillis(seconds(90));
560
+ seconds(20);
561
+ TaggedError("LockHeld");
562
+ const configDirectory = ({ bin, cwd, override }) => override === void 0 ? path.join(os.homedir(), ".config", bin) : path.resolve(cwd ?? process.cwd(), override);
563
+ const writePrivateFile = ({ file, text }) => {
564
+ const directory = path.dirname(file);
565
+ fs.mkdirSync(directory, {
566
+ mode: 448,
567
+ recursive: true
568
+ });
569
+ const pending = path.join(directory, `.${path.basename(file)}.${crypto.randomBytes(8).toString("hex")}.tmp`);
570
+ fs.writeFileSync(pending, text, {
571
+ flag: "wx",
572
+ mode: 384
573
+ });
574
+ fs.renameSync(pending, file);
575
+ };
544
576
  // package.json
545
- var version = "0.2.0";
577
+ var version = "0.4.0";
546
578
  // src/cli/spec.ts
547
579
  const BIN = "sandcovery";
548
580
  const NULLABLE_TEXT = "string | null";
581
+ const NULLABLE_NUMBER = "number | null";
549
582
  const SANDBOX = "<SANDBOX>";
550
583
  const SPEND_LIMIT = "spend-limit";
551
584
  const NEEDS_MANAGEMENT = "Needs a management key.";
@@ -573,6 +606,12 @@ const baseUrl = {
573
606
  name: "base-url",
574
607
  summary: "Sandcovery origin to send requests to"
575
608
  };
609
+ const usageKey = {
610
+ hint: "<KEY>",
611
+ kind: "value",
612
+ name: "key",
613
+ summary: "Show only this API key, by its ID"
614
+ };
576
615
  const yes = flag({
577
616
  name: "yes",
578
617
  short: "y",
@@ -763,18 +802,20 @@ const sandboxSpecOptions = [
763
802
  summary: "Region to run in, such as us, eu, or asia"
764
803
  },
765
804
  {
766
- defaultText: "2x4",
767
- hint: "<SIZE>",
805
+ defaultText: DEFAULT_SLUG,
806
+ hint: "<SLUG>",
768
807
  kind: "value",
769
- name: "size",
808
+ name: "slug",
809
+ repeat: "append",
770
810
  short: "s",
771
- summary: "Size as <vcpu>x<memory_gib>, such as 2x4 or 4x8, with an optional routing suffix such as :cheapest"
811
+ summary: "Provider and size as <provider>/<vcpu>x<memory_gib>, such as sandcovery/2x4, boat/2x4, or sandcovery/nx16:fastest, routed as :cheapest unless it ends in :fastest or :most-reliable; repeat to try each slug in order"
772
812
  },
773
813
  {
814
+ defaultText: "price",
774
815
  hint: "<SORT>",
775
816
  kind: "value",
776
817
  name: "sort",
777
- summary: "How to rank providers when no --provider is given",
818
+ summary: "How to rank each slug's candidates; a slug's routing suffix must agree with it",
778
819
  values: ProviderSort.literals
779
820
  },
780
821
  {
@@ -842,20 +883,31 @@ const sandboxesCreate = {
842
883
  examples: [
843
884
  {
844
885
  argv: ["sandboxes", "create"],
845
- summary: "Create a 2x4 sandbox on the best provider"
886
+ summary: `Create a ${DEFAULT_SLUG} sandbox on the best provider`
846
887
  },
847
888
  {
848
889
  argv: [
849
890
  "sandboxes",
850
891
  "create",
851
- "--size",
852
- "4x8:cheapest",
892
+ "--slug",
893
+ "sandcovery/4x8:cheapest",
853
894
  "--ttl",
854
895
  "600",
855
896
  "--json"
856
897
  ],
857
898
  summary: "Create the cheapest 4x8 sandbox for 10 minutes in a script"
858
899
  },
900
+ {
901
+ argv: [
902
+ "sandboxes",
903
+ "create",
904
+ "--slug",
905
+ "boat/2x4",
906
+ "--slug",
907
+ "sandcovery/nx4:cheapest"
908
+ ],
909
+ summary: "Try boat at 2x4 first, then the cheapest provider with 4 GiB at any vCPU count"
910
+ },
859
911
  {
860
912
  argv: [
861
913
  "sandboxes",
@@ -871,7 +923,7 @@ const sandboxesCreate = {
871
923
  kind: "leaf",
872
924
  name: "create",
873
925
  notes: [
874
- "Sandcovery tries each candidate provider in order and falls back on capacity, quota, timeout, and server errors, unless --no-fallbacks is given.",
926
+ "A slug pins a provider, or routes across every candidate provider when it starts with sandcovery/. Each slug falls back across its candidates on capacity, quota, timeout, and server errors, unless --no-fallbacks is given, and then the create moves to the next --slug.",
875
927
  "Each create sends an idempotency key, so the CLI retries a create that got no answer without making a second sandbox.",
876
928
  "When stdout is not a terminal, the command prints the sandbox ID there."
877
929
  ],
@@ -906,33 +958,51 @@ const sandboxesExec = {
906
958
  summary: "Command to run, after --; like ssh, its words join with spaces and run in the sandbox's shell",
907
959
  variadic: true
908
960
  }],
909
- examples: [{
910
- argv: [
911
- "sandboxes",
912
- "exec",
913
- SANDBOX,
914
- "--",
915
- "ls",
916
- "-la"
917
- ],
918
- summary: "List the working directory"
919
- }, {
920
- argv: [
921
- "sandboxes",
922
- "exec",
923
- SANDBOX,
924
- "--json",
925
- "--",
926
- "npm",
927
- "test"
928
- ],
929
- summary: "Run the tests and read their output and exit code in a script"
930
- }],
961
+ examples: [
962
+ {
963
+ argv: [
964
+ "sandboxes",
965
+ "exec",
966
+ SANDBOX,
967
+ "--",
968
+ "ls",
969
+ "-la"
970
+ ],
971
+ summary: "List the working directory"
972
+ },
973
+ {
974
+ argv: [
975
+ "sandboxes",
976
+ "exec",
977
+ SANDBOX,
978
+ "--json",
979
+ "--",
980
+ "npm",
981
+ "test"
982
+ ],
983
+ summary: "Run the tests and read their output and exit code in a script"
984
+ },
985
+ {
986
+ argv: [
987
+ "sandboxes",
988
+ "exec",
989
+ SANDBOX,
990
+ "--detach",
991
+ "--",
992
+ "node",
993
+ "server.js",
994
+ ">server.log",
995
+ "2>&1"
996
+ ],
997
+ summary: "Start a server that keeps running after the CLI exits"
998
+ }
999
+ ],
931
1000
  kind: "leaf",
932
1001
  name: "exec",
933
1002
  notes: [
934
1003
  "The command's stdout and stderr stream to this terminal's, and the CLI exits with the command's exit code.",
935
1004
  "With --json, the CLI waits for the command and prints its stdout, stderr, exit code, and duration as one document.",
1005
+ "With --detach, the CLI returns once the provider starts the command, which keeps running until it exits or the sandbox ends, and its output is not kept, so redirect it to a file to read it later. A provider with no detached commands answers unsupported.",
936
1006
  "The CLI never retries a command, since running it twice may change the sandbox twice."
937
1007
  ],
938
1008
  options: [
@@ -943,6 +1013,10 @@ const sandboxesExec = {
943
1013
  name: "cwd",
944
1014
  summary: "Directory in the sandbox to run the command in"
945
1015
  },
1016
+ flag({
1017
+ name: "detach",
1018
+ summary: "Start the command and return at once, leaving it running in the sandbox"
1019
+ }),
946
1020
  env,
947
1021
  json,
948
1022
  {
@@ -968,6 +1042,10 @@ const sandboxesExec = {
968
1042
  {
969
1043
  name: "exec.duration_ms",
970
1044
  type: "number"
1045
+ },
1046
+ {
1047
+ name: "exec.started_at",
1048
+ type: "string"
971
1049
  }
972
1050
  ],
973
1051
  summary: "Run a command in a sandbox"
@@ -1140,10 +1218,61 @@ const filesWrite = {
1140
1218
  type: "string"
1141
1219
  }, {
1142
1220
  name: "file.size_bytes",
1143
- type: "number | null"
1221
+ type: NULLABLE_NUMBER
1144
1222
  }],
1145
1223
  summary: "Write a file into a sandbox"
1146
1224
  };
1225
+ const docker = {
1226
+ arguments: [{
1227
+ name: "args",
1228
+ optional: true,
1229
+ summary: "Arguments for docker, every word passed on unchanged, so sandcovery options such as --base-url go before docker",
1230
+ variadic: true
1231
+ }],
1232
+ examples: [
1233
+ {
1234
+ argv: [
1235
+ "docker",
1236
+ "build",
1237
+ "--tag",
1238
+ "app",
1239
+ "."
1240
+ ],
1241
+ summary: "Build an image from the working directory in a sandbox"
1242
+ },
1243
+ {
1244
+ argv: [
1245
+ "docker",
1246
+ "run",
1247
+ "--rm",
1248
+ "app"
1249
+ ],
1250
+ summary: "Run a container from it in the same sandbox"
1251
+ },
1252
+ {
1253
+ argv: [
1254
+ "docker",
1255
+ "compose",
1256
+ "up",
1257
+ "--build",
1258
+ "--detach"
1259
+ ],
1260
+ summary: "Start the Compose project in the working directory"
1261
+ }
1262
+ ],
1263
+ kind: "leaf",
1264
+ name: "docker",
1265
+ notes: [
1266
+ "Runs the Docker CLI in a sandbox with every word after docker, streams its stdout and stderr to this terminal's, and exits with its exit code.",
1267
+ "The first command starts a sandbox on a provider that runs Docker, as Sandcovery CI runners do, and later commands reuse it until it ends at its TTL, so images, containers, and volumes carry over between commands. sandcovery sandboxes destroy ends it sooner.",
1268
+ "build, buildx, builder, compose, and image build first copy the working directory into the sandbox, up to 100 MiB packed, so their relative paths resolve as they do here. Every other path names a file in the sandbox, as with a remote Docker daemon.",
1269
+ "The command reads no stdin and gets no terminal, its output arrives as text, and it stops after an hour, so docker run -it, docker login --password-stdin, and docker save to stdout do not work."
1270
+ ],
1271
+ options: [baseUrl],
1272
+ passthrough: true,
1273
+ result: [],
1274
+ summary: "Run a docker command in a sandbox"
1275
+ };
1147
1276
  const sandboxes = {
1148
1277
  children: [
1149
1278
  sandboxesList,
@@ -1403,6 +1532,34 @@ const keys = {
1403
1532
  shortcuts: ["key"],
1404
1533
  summary: "Manage API keys and management keys"
1405
1534
  };
1535
+ const credentialField = {
1536
+ hint: "<NAME=VALUE>",
1537
+ kind: "value",
1538
+ name: "field",
1539
+ repeat: "append",
1540
+ summary: "Credential field to set; repeat for each one"
1541
+ };
1542
+ const credentialSource = {
1543
+ hint: "<FILE|->",
1544
+ kind: "value",
1545
+ name: "from",
1546
+ stdin: true,
1547
+ summary: "JSON object of the fields, from a file or - for stdin"
1548
+ };
1549
+ const storedCredential = [
1550
+ {
1551
+ name: "credential.id",
1552
+ type: "string"
1553
+ },
1554
+ {
1555
+ name: "credential.provider",
1556
+ type: "string"
1557
+ },
1558
+ {
1559
+ name: "credential.hint",
1560
+ type: "string"
1561
+ }
1562
+ ];
1406
1563
  const credentials = {
1407
1564
  children: [
1408
1565
  {
@@ -1413,13 +1570,17 @@ const credentials = {
1413
1570
  }],
1414
1571
  kind: "leaf",
1415
1572
  name: "list",
1416
- notes: ["Shows a hint of each credential, never the credential. Needs a management key."],
1573
+ notes: ["Shows a hint of each credential, never the credential. Needs a management key.", "A provider's credentials are listed in the order a create tries them. Without Pro, a create uses only each provider's first credential."],
1417
1574
  options: [baseUrl, json],
1418
1575
  result: [
1419
1576
  {
1420
1577
  name: "credentials",
1421
1578
  type: "array"
1422
1579
  },
1580
+ {
1581
+ name: "credentials[].id",
1582
+ type: "string"
1583
+ },
1423
1584
  {
1424
1585
  name: "credentials[].provider",
1425
1586
  type: "string"
@@ -1455,33 +1616,52 @@ const credentials = {
1455
1616
  }],
1456
1617
  kind: "leaf",
1457
1618
  name: "set",
1458
- notes: ["Each provider names its fields in sandcovery providers inspect. Sandboxes on that provider then run on your account.", "Prefer --from -, since options show in process lists. Sandcovery seals the values and never returns them. Needs a management key."],
1619
+ notes: [
1620
+ "Each provider names its fields in sandcovery providers inspect. Sandboxes on that provider then run on your account.",
1621
+ "It replaces the credential when you hold exactly one for the provider, and fails when you hold more; then add the new one and delete the old one.",
1622
+ "Prefer --from -, since options show in process lists. Sandcovery seals the values and never returns them. Needs a management key."
1623
+ ],
1459
1624
  options: [
1460
1625
  baseUrl,
1461
- {
1462
- hint: "<NAME=VALUE>",
1463
- kind: "value",
1464
- name: "field",
1465
- repeat: "append",
1466
- summary: "Credential field to set; repeat for each one"
1467
- },
1468
- {
1469
- hint: "<FILE|->",
1470
- kind: "value",
1471
- name: "from",
1472
- stdin: true,
1473
- summary: "JSON object of the fields, from a file or - for stdin"
1474
- },
1626
+ credentialField,
1627
+ credentialSource,
1475
1628
  json
1476
1629
  ],
1477
- result: [{
1478
- name: "credential.provider",
1479
- type: "string"
1630
+ result: storedCredential,
1631
+ summary: "Set or replace a provider credential"
1632
+ },
1633
+ {
1634
+ arguments: [providerArgument("add a credential")],
1635
+ examples: [{
1636
+ argv: [
1637
+ "credentials",
1638
+ "add",
1639
+ "e2b",
1640
+ "--from",
1641
+ "-"
1642
+ ],
1643
+ summary: "Add another E2B credential from a JSON object on stdin"
1480
1644
  }, {
1481
- name: "credential.hint",
1482
- type: "string"
1645
+ argv: [
1646
+ "credentials",
1647
+ "add",
1648
+ "e2b",
1649
+ "--field",
1650
+ "api_key=<KEY>"
1651
+ ],
1652
+ summary: "Add it from an option"
1483
1653
  }],
1484
- summary: "Set or replace a provider credential"
1654
+ kind: "leaf",
1655
+ name: "add",
1656
+ notes: ["A create tries your credentials for a provider in the order you added them, and falls back to the next one on capacity, quota, a provider error, or a timeout.", "More than one credential for a provider needs Pro. Prefer --from -, since options show in process lists. Needs a management key."],
1657
+ options: [
1658
+ baseUrl,
1659
+ credentialField,
1660
+ credentialSource,
1661
+ json
1662
+ ],
1663
+ result: storedCredential,
1664
+ summary: "Add another provider credential"
1485
1665
  },
1486
1666
  {
1487
1667
  arguments: [providerArgument("delete a credential")],
@@ -1491,13 +1671,28 @@ const credentials = {
1491
1671
  "delete",
1492
1672
  "e2b"
1493
1673
  ],
1494
- summary: "Delete the E2B credential after a prompt"
1674
+ summary: "Delete every E2B credential after a prompt"
1675
+ }, {
1676
+ argv: [
1677
+ "credentials",
1678
+ "delete",
1679
+ "e2b",
1680
+ "--id",
1681
+ "<CREDENTIAL>"
1682
+ ],
1683
+ summary: "Delete one E2B credential by its ID"
1495
1684
  }],
1496
1685
  kind: "leaf",
1497
1686
  name: "delete",
1498
- notes: ["New sandboxes on that provider then run on Sandcovery's account. A credential that live sandboxes use cannot be deleted.", "It asks first, and needs --yes without a terminal. Needs a management key."],
1687
+ notes: ["Without --id, it deletes every credential of the provider, and new sandboxes on that provider then run on Sandcovery's account. A credential that live sandboxes use cannot be deleted.", "It asks first, and needs --yes without a terminal. Needs a management key."],
1499
1688
  options: [
1500
1689
  baseUrl,
1690
+ {
1691
+ hint: "<CREDENTIAL>",
1692
+ kind: "value",
1693
+ name: "id",
1694
+ summary: "Delete only the credential with this ID"
1695
+ },
1501
1696
  json,
1502
1697
  yes
1503
1698
  ],
@@ -1509,7 +1704,33 @@ const credentials = {
1509
1704
  type: "\"deleted\""
1510
1705
  }],
1511
1706
  shortcuts: ["rm"],
1512
- summary: "Delete a provider credential"
1707
+ summary: "Delete provider credentials"
1708
+ },
1709
+ {
1710
+ arguments: [],
1711
+ examples: [{
1712
+ argv: ["credentials", "offer"],
1713
+ summary: "Show the free vCPU-hours your keys have earned"
1714
+ }],
1715
+ kind: "leaf",
1716
+ name: "offer",
1717
+ notes: ["Shows the provider Sandcovery pays for, the keys counted toward the free vCPU-hours, and the vCPU-hours left. It fails as not found while no offer runs. Needs a management key."],
1718
+ options: [baseUrl, json],
1719
+ result: [
1720
+ {
1721
+ name: "offer.provider",
1722
+ type: "string"
1723
+ },
1724
+ {
1725
+ name: "offer.keys_counted",
1726
+ type: "number"
1727
+ },
1728
+ {
1729
+ name: "offer.remaining_vcpu_seconds",
1730
+ type: "number"
1731
+ }
1732
+ ],
1733
+ summary: "Show the free vCPU-hours offer"
1513
1734
  }
1514
1735
  ],
1515
1736
  defaultChild: "list",
@@ -1524,11 +1745,30 @@ const providers = {
1524
1745
  examples: [{
1525
1746
  argv: ["providers", "list"],
1526
1747
  summary: "Compare the providers' prices and status"
1748
+ }, {
1749
+ argv: [
1750
+ "providers",
1751
+ "list",
1752
+ "--routed"
1753
+ ],
1754
+ summary: "List only the providers Sandcovery routes sandboxes to"
1527
1755
  }],
1528
1756
  kind: "leaf",
1529
1757
  name: "list",
1530
- notes: ["Lists each provider with its status, 2x4 price per hour, and median create latency."],
1531
- options: [baseUrl, json],
1758
+ notes: [
1759
+ "Lists each provider with its status, 2x4 price per hour, and median create latency.",
1760
+ "A provider Sandcovery does not route to yet shows as Coming Soon.",
1761
+ "Coming Soon also marks each figure or fact Sandcovery does not publish, and --json adds every fact with the page it was read from.",
1762
+ "With --routed, it lists only the providers on the provider board, and --json prints their board entries."
1763
+ ],
1764
+ options: [
1765
+ baseUrl,
1766
+ json,
1767
+ flag({
1768
+ name: "routed",
1769
+ summary: "List only the providers Sandcovery routes to"
1770
+ })
1771
+ ],
1532
1772
  result: [
1533
1773
  {
1534
1774
  name: "providers",
@@ -1538,6 +1778,10 @@ const providers = {
1538
1778
  name: "providers[].provider",
1539
1779
  type: "string"
1540
1780
  },
1781
+ {
1782
+ name: "providers[].routed",
1783
+ type: "boolean"
1784
+ },
1541
1785
  {
1542
1786
  name: "providers[].status",
1543
1787
  type: "string"
@@ -1582,106 +1826,215 @@ const providers = {
1582
1826
  summary: "Compare the sandbox providers"
1583
1827
  };
1584
1828
  const usage = {
1829
+ children: [
1830
+ {
1831
+ arguments: [],
1832
+ examples: [{
1833
+ argv: ["usage", "inspect"],
1834
+ summary: "Show this month's usage"
1835
+ }, {
1836
+ argv: [
1837
+ "usage",
1838
+ "inspect",
1839
+ "--from",
1840
+ "2026-10-01",
1841
+ "--to",
1842
+ "2026-10-31",
1843
+ "--json"
1844
+ ],
1845
+ summary: "Read October's usage in a script"
1846
+ }],
1847
+ kind: "leaf",
1848
+ name: "inspect",
1849
+ notes: ["Shows sandboxes, sandbox time, vCPU and memory time, and estimated cost per UTC day, key, and provider, at most 92 days at once, plus GPU time once any sandbox ran a GPU. Needs a management key."],
1850
+ options: [
1851
+ baseUrl,
1852
+ {
1853
+ defaultText: "the first day of this UTC month",
1854
+ hint: "<DAY>",
1855
+ kind: "value",
1856
+ name: "from",
1857
+ summary: "First UTC day, such as 2026-11-01"
1858
+ },
1859
+ json,
1860
+ usageKey,
1861
+ {
1862
+ defaultText: "today, in UTC",
1863
+ hint: "<DAY>",
1864
+ kind: "value",
1865
+ name: "to",
1866
+ summary: "Last UTC day, such as 2026-11-30"
1867
+ }
1868
+ ],
1869
+ result: [
1870
+ {
1871
+ name: "usage",
1872
+ type: "array"
1873
+ },
1874
+ {
1875
+ name: "usage[].date",
1876
+ type: "string"
1877
+ },
1878
+ {
1879
+ name: "usage[].estimated_micro_usd",
1880
+ type: "number"
1881
+ }
1882
+ ],
1883
+ summary: "Show usage and cost per day"
1884
+ },
1885
+ {
1886
+ arguments: [],
1887
+ examples: [{
1888
+ argv: ["usage", "live"],
1889
+ summary: "Show the sandboxes live now and their cost per hour"
1890
+ }],
1891
+ kind: "leaf",
1892
+ name: "live",
1893
+ notes: ["Shows the sandboxes live at this moment per key, provider, and status, with their vCPUs, memory, GPUs, cost per hour, and cost so far. Needs a management key."],
1894
+ options: [
1895
+ baseUrl,
1896
+ json,
1897
+ usageKey
1898
+ ],
1899
+ result: [
1900
+ {
1901
+ name: "at",
1902
+ type: "string"
1903
+ },
1904
+ {
1905
+ name: "live",
1906
+ type: "array"
1907
+ },
1908
+ {
1909
+ name: "live[].hourly_micro_usd",
1910
+ type: "number"
1911
+ },
1912
+ {
1913
+ name: "live[].sandbox_count",
1914
+ type: "number"
1915
+ }
1916
+ ],
1917
+ summary: "Show the sandboxes live now"
1918
+ },
1919
+ {
1920
+ arguments: [],
1921
+ examples: [{
1922
+ argv: ["usage", "totals"],
1923
+ summary: "Show today's, this week's, this month's, and all usage"
1924
+ }],
1925
+ kind: "leaf",
1926
+ name: "totals",
1927
+ notes: ["Shows sandboxes, sandbox time, vCPU and memory time, and estimated cost from the start of the UTC day, ISO week, and UTC month to now, and in total, plus GPU time once any sandbox ran a GPU. Needs a management key."],
1928
+ options: [
1929
+ baseUrl,
1930
+ json,
1931
+ usageKey
1932
+ ],
1933
+ result: [
1934
+ {
1935
+ name: "at",
1936
+ type: "string"
1937
+ },
1938
+ {
1939
+ name: "totals",
1940
+ type: "array"
1941
+ },
1942
+ {
1943
+ name: "totals[].period",
1944
+ type: "string"
1945
+ },
1946
+ {
1947
+ name: "totals[].estimated_micro_usd",
1948
+ type: "number"
1949
+ }
1950
+ ],
1951
+ summary: "Show usage totals by day, week, month, and in total"
1952
+ },
1953
+ {
1954
+ arguments: [],
1955
+ examples: [{
1956
+ argv: [
1957
+ "usage",
1958
+ "estimate",
1959
+ "--slug",
1960
+ "sandcovery/4x8",
1961
+ "--ttl",
1962
+ "3600"
1963
+ ],
1964
+ summary: "Price a 4x8 sandbox for an hour"
1965
+ }],
1966
+ kind: "leaf",
1967
+ name: "estimate",
1968
+ notes: ["Prices the spec on each provider that can run it, in routing order, at the size each slug runs there, without creating anything."],
1969
+ options: [
1970
+ baseUrl,
1971
+ json,
1972
+ ...sandboxSpecOptions
1973
+ ],
1974
+ result: [
1975
+ {
1976
+ name: "estimates",
1977
+ type: "array"
1978
+ },
1979
+ {
1980
+ name: "estimates[].provider",
1981
+ type: "string"
1982
+ },
1983
+ {
1984
+ name: "estimates[].slug",
1985
+ type: "string"
1986
+ },
1987
+ {
1988
+ name: "estimates[].ttl_micro_usd",
1989
+ type: "number"
1990
+ }
1991
+ ],
1992
+ summary: "Price a sandbox before creating it"
1993
+ }
1994
+ ],
1995
+ defaultChild: "inspect",
1996
+ kind: "group",
1997
+ name: "usage",
1998
+ summary: "Show usage and price sandboxes"
1999
+ };
2000
+ const stats = {
1585
2001
  children: [{
1586
2002
  arguments: [],
1587
2003
  examples: [{
1588
- argv: ["usage", "inspect"],
1589
- summary: "Show this month's usage"
2004
+ argv: ["stats", "inspect"],
2005
+ summary: "Show your organization's level, streak, and badges"
1590
2006
  }, {
1591
2007
  argv: [
1592
- "usage",
2008
+ "stats",
1593
2009
  "inspect",
1594
- "--from",
1595
- "2026-10-01",
1596
- "--to",
1597
- "2026-10-31",
1598
2010
  "--json"
1599
2011
  ],
1600
- summary: "Read October's usage in a script"
2012
+ summary: "Read the badges in a script"
1601
2013
  }],
1602
2014
  kind: "leaf",
1603
2015
  name: "inspect",
1604
- notes: ["Shows sandboxes, sandbox time, and estimated cost per UTC day, key, and provider, at most 92 days at once. Needs a management key."],
1605
- options: [
1606
- baseUrl,
1607
- {
1608
- defaultText: "the first day of this UTC month",
1609
- hint: "<DAY>",
1610
- kind: "value",
1611
- name: "from",
1612
- summary: "First UTC day, such as 2026-11-01"
1613
- },
1614
- json,
1615
- {
1616
- hint: "<KEY>",
1617
- kind: "value",
1618
- name: "key",
1619
- summary: "Show only this API key, by its ID"
1620
- },
1621
- {
1622
- defaultText: "today, in UTC",
1623
- hint: "<DAY>",
1624
- kind: "value",
1625
- name: "to",
1626
- summary: "Last UTC day, such as 2026-11-30"
1627
- }
1628
- ],
2016
+ notes: ["Reads every sandbox the organization started. Level 1 starts at 1 vCPU-hour, and each level after it takes ten times as many. Takes an API key or a management key."],
2017
+ options: [baseUrl, json],
1629
2018
  result: [
1630
2019
  {
1631
- name: "usage",
1632
- type: "array"
1633
- },
1634
- {
1635
- name: "usage[].date",
1636
- type: "string"
2020
+ name: "stats",
2021
+ type: "object"
1637
2022
  },
1638
2023
  {
1639
- name: "usage[].estimated_micro_usd",
2024
+ name: "stats.level",
1640
2025
  type: "number"
1641
- }
1642
- ],
1643
- summary: "Show usage and cost per day"
1644
- }, {
1645
- arguments: [],
1646
- examples: [{
1647
- argv: [
1648
- "usage",
1649
- "estimate",
1650
- "--size",
1651
- "4x8",
1652
- "--ttl",
1653
- "3600"
1654
- ],
1655
- summary: "Price a 4x8 sandbox for an hour"
1656
- }],
1657
- kind: "leaf",
1658
- name: "estimate",
1659
- notes: ["Prices the spec on each provider that can run it, in routing order, without creating anything."],
1660
- options: [
1661
- baseUrl,
1662
- json,
1663
- ...sandboxSpecOptions
1664
- ],
1665
- result: [
1666
- {
1667
- name: "estimates",
1668
- type: "array"
1669
- },
1670
- {
1671
- name: "estimates[].provider",
1672
- type: "string"
1673
2026
  },
1674
2027
  {
1675
- name: "estimates[].ttl_micro_usd",
1676
- type: "number"
2028
+ name: "stats.badges",
2029
+ type: "array"
1677
2030
  }
1678
2031
  ],
1679
- summary: "Price a sandbox before creating it"
2032
+ summary: "Show level, streak, records, and badges"
1680
2033
  }],
1681
2034
  defaultChild: "inspect",
1682
2035
  kind: "group",
1683
- name: "usage",
1684
- summary: "Show usage and price sandboxes"
2036
+ name: "stats",
2037
+ summary: "Show your organization's level, streak, and badges"
1685
2038
  };
1686
2039
  const activity = {
1687
2040
  children: [{
@@ -1721,6 +2074,263 @@ const activity = {
1721
2074
  name: "activity",
1722
2075
  summary: "Read what happened to your sandboxes"
1723
2076
  };
2077
+ const billing = {
2078
+ children: [{
2079
+ arguments: [],
2080
+ examples: [{
2081
+ argv: ["billing", "inspect"],
2082
+ summary: "Show the plan and the credit balance"
2083
+ }],
2084
+ kind: "leaf",
2085
+ name: "inspect",
2086
+ notes: [`Shows the plan, the credit balance, and the Pro price. It fails as not found while billing is not open. ${NEEDS_MANAGEMENT}`],
2087
+ options: [baseUrl, json],
2088
+ result: [
2089
+ {
2090
+ name: "billing.plan",
2091
+ type: "\"free\" | \"pro\""
2092
+ },
2093
+ {
2094
+ name: "billing.credit_balance_micro_usd",
2095
+ type: "number"
2096
+ },
2097
+ {
2098
+ name: "billing.pro_price",
2099
+ type: "object | null"
2100
+ }
2101
+ ],
2102
+ summary: "Show the plan and credits"
2103
+ }, {
2104
+ arguments: [],
2105
+ examples: [{
2106
+ argv: [
2107
+ "billing",
2108
+ "buy-credits",
2109
+ "--amount",
2110
+ "100"
2111
+ ],
2112
+ summary: "Start a 100 USD credit purchase"
2113
+ }],
2114
+ kind: "leaf",
2115
+ name: "buy-credits",
2116
+ notes: [`Prints the Stripe Checkout page that takes the payment. The credits are the amount less the processing fee of ${CARD_FEE_TERMS}, and arrive once Stripe confirms the payment. ${NEEDS_MANAGEMENT}`],
2117
+ options: [
2118
+ {
2119
+ hint: "<USD>",
2120
+ kind: "value",
2121
+ name: "amount",
2122
+ required: true,
2123
+ summary: `Whole US dollars to pay, from ${String(CREDIT_PURCHASE_MIN_MICRO_USD / MICRO_USD_PER_DOLLAR)} to ${String(CREDIT_PURCHASE_MAX_MICRO_USD / MICRO_USD_PER_DOLLAR)}`
2124
+ },
2125
+ baseUrl,
2126
+ json
2127
+ ],
2128
+ result: [{
2129
+ name: "checkout.url",
2130
+ type: "string"
2131
+ }],
2132
+ summary: "Buy credits through Stripe Checkout"
2133
+ }],
2134
+ defaultChild: "inspect",
2135
+ kind: "group",
2136
+ name: "billing",
2137
+ summary: "Show the plan and buy credits"
2138
+ };
2139
+ const pricing = {
2140
+ children: [{
2141
+ arguments: [],
2142
+ examples: [{
2143
+ argv: ["pricing", "inspect"],
2144
+ summary: "Show the Pro price and the credit terms"
2145
+ }],
2146
+ kind: "leaf",
2147
+ name: "inspect",
2148
+ notes: ["Shows the Pro price, the smallest and largest credit purchase, and the processing fee that comes out of each purchase. It needs no key, and the Pro price reads Not on sale while Pro is not on sale."],
2149
+ options: [baseUrl, json],
2150
+ result: [{
2151
+ name: "pricing.pro_price",
2152
+ type: "object | null"
2153
+ }, {
2154
+ name: "pricing.credits",
2155
+ type: "object"
2156
+ }],
2157
+ summary: "Show the Pro price and credit terms"
2158
+ }],
2159
+ defaultChild: "inspect",
2160
+ kind: "group",
2161
+ name: "pricing",
2162
+ summary: "Show the Pro price and the credit terms"
2163
+ };
2164
+ const ci = {
2165
+ children: [{
2166
+ children: [{
2167
+ arguments: [],
2168
+ examples: [{
2169
+ argv: [
2170
+ "ci",
2171
+ "jobs",
2172
+ "list"
2173
+ ],
2174
+ summary: "List the newest CI jobs"
2175
+ }],
2176
+ kind: "leaf",
2177
+ name: "list",
2178
+ notes: ["Lists each GitHub Actions job that asked for a Sandcovery runner label, newest first, one page per run."],
2179
+ options: [
2180
+ baseUrl,
2181
+ json,
2182
+ limit("jobs"),
2183
+ next
2184
+ ],
2185
+ result: [
2186
+ {
2187
+ name: "jobs",
2188
+ type: "array"
2189
+ },
2190
+ {
2191
+ name: "jobs[].id",
2192
+ type: "string"
2193
+ },
2194
+ {
2195
+ name: "jobs[].status",
2196
+ type: "\"queued\" | \"in_progress\" | \"completed\""
2197
+ },
2198
+ {
2199
+ name: "jobs[].cost_micro_usd",
2200
+ type: NULLABLE_NUMBER
2201
+ },
2202
+ {
2203
+ name: "next_cursor",
2204
+ type: NULLABLE_TEXT
2205
+ }
2206
+ ],
2207
+ shortcuts: ["ls"],
2208
+ summary: "List CI jobs, newest first"
2209
+ }, {
2210
+ arguments: [required({
2211
+ message: "Can't show a CI job without its ID.",
2212
+ name: "job",
2213
+ reason: "missing_job",
2214
+ summary: "CI job ID, such as cij_ and a UUID, as sandcovery ci jobs list prints it"
2215
+ })],
2216
+ examples: [{
2217
+ argv: [
2218
+ "ci",
2219
+ "jobs",
2220
+ "inspect",
2221
+ "<JOB>"
2222
+ ],
2223
+ summary: "Show a job's provider, wait, and cost"
2224
+ }],
2225
+ kind: "leaf",
2226
+ name: "inspect",
2227
+ notes: ["Shows the provider, wait, duration, and list-price cost of a job, beside what it costs on a GitHub-hosted runner."],
2228
+ options: [baseUrl, json],
2229
+ result: [
2230
+ {
2231
+ name: "job.id",
2232
+ type: "string"
2233
+ },
2234
+ {
2235
+ name: "job.provider",
2236
+ type: NULLABLE_TEXT
2237
+ },
2238
+ {
2239
+ name: "job.github_hosted_cost_micro_usd",
2240
+ type: NULLABLE_NUMBER
2241
+ }
2242
+ ],
2243
+ summary: "Show one CI job"
2244
+ }],
2245
+ defaultChild: "list",
2246
+ kind: "group",
2247
+ name: "jobs",
2248
+ shortcuts: ["job"],
2249
+ summary: "Read GitHub Actions jobs that ran on Sandcovery CI"
2250
+ }, {
2251
+ children: [{
2252
+ arguments: [],
2253
+ examples: [{
2254
+ argv: [
2255
+ "ci",
2256
+ "installations",
2257
+ "list"
2258
+ ],
2259
+ summary: "List the linked GitHub installations"
2260
+ }],
2261
+ kind: "leaf",
2262
+ name: "list",
2263
+ notes: [`Lists each linked installation with the API key that creates its runners. An organization owner or admin links one from the dashboard. ${NEEDS_MANAGEMENT}`],
2264
+ options: [baseUrl, json],
2265
+ result: [
2266
+ {
2267
+ name: "installations",
2268
+ type: "array"
2269
+ },
2270
+ {
2271
+ name: "installations[].installation_id",
2272
+ type: "number"
2273
+ },
2274
+ {
2275
+ name: "installations[].api_key_id",
2276
+ type: "string"
2277
+ }
2278
+ ],
2279
+ shortcuts: ["ls"],
2280
+ summary: "List linked GitHub installations"
2281
+ }, {
2282
+ arguments: [required({
2283
+ message: "Can't unlink an installation without its ID.",
2284
+ name: "installation",
2285
+ reason: "missing_installation",
2286
+ summary: "GitHub installation ID, as sandcovery ci installations list prints it"
2287
+ })],
2288
+ examples: [{
2289
+ argv: [
2290
+ "ci",
2291
+ "installations",
2292
+ "unlink",
2293
+ "<INSTALLATION>"
2294
+ ],
2295
+ summary: "Unlink an installation after a prompt"
2296
+ }, {
2297
+ argv: [
2298
+ "ci",
2299
+ "installations",
2300
+ "unlink",
2301
+ "<INSTALLATION>",
2302
+ "--yes"
2303
+ ],
2304
+ summary: "Unlink it in a script, after a person approved"
2305
+ }],
2306
+ kind: "leaf",
2307
+ name: "unlink",
2308
+ notes: ["Its jobs start no more runners, and a runner already started ends when its job completes or at its TTL. The GitHub App stays installed until you uninstall it on GitHub.", `It asks first, and needs --yes without a terminal. ${NEEDS_MANAGEMENT}`],
2309
+ options: [
2310
+ baseUrl,
2311
+ json,
2312
+ yes
2313
+ ],
2314
+ result: [{
2315
+ name: "installation.installation_id",
2316
+ type: "number"
2317
+ }, {
2318
+ name: "outcome",
2319
+ type: "\"unlinked\""
2320
+ }],
2321
+ shortcuts: ["delete", "rm"],
2322
+ summary: "Unlink a GitHub installation"
2323
+ }],
2324
+ defaultChild: "list",
2325
+ kind: "group",
2326
+ name: "installations",
2327
+ shortcuts: ["installation"],
2328
+ summary: "Manage GitHub installations linked to Sandcovery CI"
2329
+ }],
2330
+ kind: "group",
2331
+ name: "ci",
2332
+ summary: "Run GitHub Actions jobs on sandboxes"
2333
+ };
1724
2334
  const telemetryLeaf = ({ name, summary }) => ({
1725
2335
  arguments: [],
1726
2336
  examples: [{
@@ -1830,11 +2440,16 @@ const CLI = {
1830
2440
  root: {
1831
2441
  children: [
1832
2442
  sandboxes,
2443
+ docker,
1833
2444
  keys,
1834
2445
  credentials,
1835
2446
  providers,
1836
2447
  usage,
2448
+ stats,
1837
2449
  activity,
2450
+ billing,
2451
+ pricing,
2452
+ ci,
1838
2453
  help,
1839
2454
  {
1840
2455
  children: [{
@@ -1877,15 +2492,20 @@ const CLI = {
1877
2492
  ["sandboxes", "exec"],
1878
2493
  ["sandboxes", "list"],
1879
2494
  ["sandboxes", "destroy"],
1880
- ["sandboxes", "files"]
2495
+ ["sandboxes", "files"],
2496
+ ["docker"]
1881
2497
  ],
1882
2498
  title: "Sandboxes"
1883
2499
  },
1884
2500
  {
1885
2501
  paths: [
1886
2502
  ["providers", "list"],
2503
+ ["pricing", "inspect"],
1887
2504
  ["usage", "estimate"],
1888
- ["usage", "inspect"]
2505
+ ["usage", "inspect"],
2506
+ ["usage", "live"],
2507
+ ["usage", "totals"],
2508
+ ["stats", "inspect"]
1889
2509
  ],
1890
2510
  title: "Providers and Cost"
1891
2511
  },
@@ -1893,7 +2513,8 @@ const CLI = {
1893
2513
  paths: [
1894
2514
  ["keys"],
1895
2515
  ["credentials"],
1896
- ["activity", "list"]
2516
+ ["activity", "list"],
2517
+ ["billing"]
1897
2518
  ],
1898
2519
  title: "Account"
1899
2520
  },
@@ -1907,4 +2528,4 @@ const CLI = {
1907
2528
  }
1908
2529
  ]
1909
2530
  };
1910
- export { exitCodeOf as A, remoteText as C, isUpper as D, isDigits as E, usageFailure as M, Canceled as N, isWordCharacter as O, remoteLine as S, isDigit as T, plainPrefix as _, closest as a, escapeUnprintable as b, lastValue as c, readOptionToken as d, rerunArgv as f, glyph as g, ellipsis as h, version as i, statusOf as j, CliFailure as k, parseFailure as l, clearLine as m, CLEARABLE as n, flagOf as o, valuesOf as p, CLI as r, isOptionToken as s, BIN as t, parseLeaf as u, spinnerFrame as v, consistsOf as w, remoteCell as x, theme as y };
2531
+ export { isUpper as A, escapeUnprintable as C, consistsOf as D, remoteText as E, usageFailure as F, Canceled as I, CliFailure as M, exitCodeOf as N, isDigit as O, statusOf as P, theme as S, remoteLine as T, clearLine as _, configDirectory as a, plainPrefix as b, flagOf as c, lastValue as d, parseFailure as f, valuesOf as g, rerunArgv as h, version as i, isWordCharacter as j, isDigits as k, isOptionToken as l, readOptionToken as m, CLEARABLE as n, writePrivateFile as o, parseLeaf as p, CLI as r, closest as s, BIN as t, isOptionValue as u, ellipsis as v, remoteCell as w, spinnerFrame as x, glyph as y };