sandcovery 0.3.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 { N as TaggedError } from "./Schema-DiSfJzMf.mjs";
2
- import { C as CARD_FEE_TERMS, D as MICRO_USD_PER_DOLLAR, T as CREDIT_PURCHASE_MIN_MICRO_USD, _ as SandboxStatus, b as ProviderSort, c as SpendLimit, o as KeyKind, w as CREDIT_PURCHASE_MAX_MICRO_USD } from "./origin-CIA-1Jia.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
@@ -46,6 +50,8 @@ const reasons = {
46
50
  login_required: "authentication",
47
51
  market_information_locked: "conflict",
48
52
  missing_command: "usage",
53
+ missing_installation: "missing_input",
54
+ missing_job: "missing_input",
49
55
  missing_key: "missing_input",
50
56
  missing_path: "missing_input",
51
57
  missing_port: "missing_input",
@@ -549,11 +555,30 @@ const parseFailure = ({ bin, issues, path }) => {
549
555
  reason: first?.reason ?? "invalid_arguments"
550
556
  });
551
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
+ };
552
576
  // package.json
553
- var version = "0.3.0";
577
+ var version = "0.4.0";
554
578
  // src/cli/spec.ts
555
579
  const BIN = "sandcovery";
556
580
  const NULLABLE_TEXT = "string | null";
581
+ const NULLABLE_NUMBER = "number | null";
557
582
  const SANDBOX = "<SANDBOX>";
558
583
  const SPEND_LIMIT = "spend-limit";
559
584
  const NEEDS_MANAGEMENT = "Needs a management key.";
@@ -581,6 +606,12 @@ const baseUrl = {
581
606
  name: "base-url",
582
607
  summary: "Sandcovery origin to send requests to"
583
608
  };
609
+ const usageKey = {
610
+ hint: "<KEY>",
611
+ kind: "value",
612
+ name: "key",
613
+ summary: "Show only this API key, by its ID"
614
+ };
584
615
  const yes = flag({
585
616
  name: "yes",
586
617
  short: "y",
@@ -771,18 +802,20 @@ const sandboxSpecOptions = [
771
802
  summary: "Region to run in, such as us, eu, or asia"
772
803
  },
773
804
  {
774
- defaultText: "2x4",
775
- hint: "<SIZE>",
805
+ defaultText: DEFAULT_SLUG,
806
+ hint: "<SLUG>",
776
807
  kind: "value",
777
- name: "size",
808
+ name: "slug",
809
+ repeat: "append",
778
810
  short: "s",
779
- 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"
780
812
  },
781
813
  {
814
+ defaultText: "price",
782
815
  hint: "<SORT>",
783
816
  kind: "value",
784
817
  name: "sort",
785
- 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",
786
819
  values: ProviderSort.literals
787
820
  },
788
821
  {
@@ -850,20 +883,31 @@ const sandboxesCreate = {
850
883
  examples: [
851
884
  {
852
885
  argv: ["sandboxes", "create"],
853
- summary: "Create a 2x4 sandbox on the best provider"
886
+ summary: `Create a ${DEFAULT_SLUG} sandbox on the best provider`
854
887
  },
855
888
  {
856
889
  argv: [
857
890
  "sandboxes",
858
891
  "create",
859
- "--size",
860
- "4x8:cheapest",
892
+ "--slug",
893
+ "sandcovery/4x8:cheapest",
861
894
  "--ttl",
862
895
  "600",
863
896
  "--json"
864
897
  ],
865
898
  summary: "Create the cheapest 4x8 sandbox for 10 minutes in a script"
866
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
+ },
867
911
  {
868
912
  argv: [
869
913
  "sandboxes",
@@ -879,7 +923,7 @@ const sandboxesCreate = {
879
923
  kind: "leaf",
880
924
  name: "create",
881
925
  notes: [
882
- "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.",
883
927
  "Each create sends an idempotency key, so the CLI retries a create that got no answer without making a second sandbox.",
884
928
  "When stdout is not a terminal, the command prints the sandbox ID there."
885
929
  ],
@@ -1174,10 +1218,61 @@ const filesWrite = {
1174
1218
  type: "string"
1175
1219
  }, {
1176
1220
  name: "file.size_bytes",
1177
- type: "number | null"
1221
+ type: NULLABLE_NUMBER
1178
1222
  }],
1179
1223
  summary: "Write a file into a sandbox"
1180
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
+ };
1181
1276
  const sandboxes = {
1182
1277
  children: [
1183
1278
  sandboxesList,
@@ -1437,6 +1532,34 @@ const keys = {
1437
1532
  shortcuts: ["key"],
1438
1533
  summary: "Manage API keys and management keys"
1439
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
+ ];
1440
1563
  const credentials = {
1441
1564
  children: [
1442
1565
  {
@@ -1447,13 +1570,17 @@ const credentials = {
1447
1570
  }],
1448
1571
  kind: "leaf",
1449
1572
  name: "list",
1450
- 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."],
1451
1574
  options: [baseUrl, json],
1452
1575
  result: [
1453
1576
  {
1454
1577
  name: "credentials",
1455
1578
  type: "array"
1456
1579
  },
1580
+ {
1581
+ name: "credentials[].id",
1582
+ type: "string"
1583
+ },
1457
1584
  {
1458
1585
  name: "credentials[].provider",
1459
1586
  type: "string"
@@ -1489,33 +1616,52 @@ const credentials = {
1489
1616
  }],
1490
1617
  kind: "leaf",
1491
1618
  name: "set",
1492
- 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
+ ],
1493
1624
  options: [
1494
1625
  baseUrl,
1495
- {
1496
- hint: "<NAME=VALUE>",
1497
- kind: "value",
1498
- name: "field",
1499
- repeat: "append",
1500
- summary: "Credential field to set; repeat for each one"
1501
- },
1502
- {
1503
- hint: "<FILE|->",
1504
- kind: "value",
1505
- name: "from",
1506
- stdin: true,
1507
- summary: "JSON object of the fields, from a file or - for stdin"
1508
- },
1626
+ credentialField,
1627
+ credentialSource,
1509
1628
  json
1510
1629
  ],
1511
- result: [{
1512
- name: "credential.provider",
1513
- 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"
1514
1644
  }, {
1515
- name: "credential.hint",
1516
- type: "string"
1645
+ argv: [
1646
+ "credentials",
1647
+ "add",
1648
+ "e2b",
1649
+ "--field",
1650
+ "api_key=<KEY>"
1651
+ ],
1652
+ summary: "Add it from an option"
1517
1653
  }],
1518
- 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"
1519
1665
  },
1520
1666
  {
1521
1667
  arguments: [providerArgument("delete a credential")],
@@ -1525,13 +1671,28 @@ const credentials = {
1525
1671
  "delete",
1526
1672
  "e2b"
1527
1673
  ],
1528
- 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"
1529
1684
  }],
1530
1685
  kind: "leaf",
1531
1686
  name: "delete",
1532
- 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."],
1533
1688
  options: [
1534
1689
  baseUrl,
1690
+ {
1691
+ hint: "<CREDENTIAL>",
1692
+ kind: "value",
1693
+ name: "id",
1694
+ summary: "Delete only the credential with this ID"
1695
+ },
1535
1696
  json,
1536
1697
  yes
1537
1698
  ],
@@ -1543,7 +1704,7 @@ const credentials = {
1543
1704
  type: "\"deleted\""
1544
1705
  }],
1545
1706
  shortcuts: ["rm"],
1546
- summary: "Delete a provider credential"
1707
+ summary: "Delete provider credentials"
1547
1708
  },
1548
1709
  {
1549
1710
  arguments: [],
@@ -1596,8 +1757,8 @@ const providers = {
1596
1757
  name: "list",
1597
1758
  notes: [
1598
1759
  "Lists each provider with its status, 2x4 price per hour, and median create latency.",
1599
- "A provider Sandcovery does not route to yet shows as coming soon.",
1600
- "Not shared marks a figure the provider's terms ask Sandcovery not to publish, and --json adds every fact with the page it was read from.",
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.",
1601
1762
  "With --routed, it lists only the providers on the provider board, and --json prints their board entries."
1602
1763
  ],
1603
1764
  options: [
@@ -1665,106 +1826,215 @@ const providers = {
1665
1826
  summary: "Compare the sandbox providers"
1666
1827
  };
1667
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 = {
1668
2001
  children: [{
1669
2002
  arguments: [],
1670
2003
  examples: [{
1671
- argv: ["usage", "inspect"],
1672
- summary: "Show this month's usage"
2004
+ argv: ["stats", "inspect"],
2005
+ summary: "Show your organization's level, streak, and badges"
1673
2006
  }, {
1674
2007
  argv: [
1675
- "usage",
2008
+ "stats",
1676
2009
  "inspect",
1677
- "--from",
1678
- "2026-10-01",
1679
- "--to",
1680
- "2026-10-31",
1681
2010
  "--json"
1682
2011
  ],
1683
- summary: "Read October's usage in a script"
2012
+ summary: "Read the badges in a script"
1684
2013
  }],
1685
2014
  kind: "leaf",
1686
2015
  name: "inspect",
1687
- notes: ["Shows sandboxes, sandbox time, and estimated cost per UTC day, key, and provider, at most 92 days at once. Needs a management key."],
1688
- options: [
1689
- baseUrl,
1690
- {
1691
- defaultText: "the first day of this UTC month",
1692
- hint: "<DAY>",
1693
- kind: "value",
1694
- name: "from",
1695
- summary: "First UTC day, such as 2026-11-01"
1696
- },
1697
- json,
1698
- {
1699
- hint: "<KEY>",
1700
- kind: "value",
1701
- name: "key",
1702
- summary: "Show only this API key, by its ID"
1703
- },
1704
- {
1705
- defaultText: "today, in UTC",
1706
- hint: "<DAY>",
1707
- kind: "value",
1708
- name: "to",
1709
- summary: "Last UTC day, such as 2026-11-30"
1710
- }
1711
- ],
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],
1712
2018
  result: [
1713
2019
  {
1714
- name: "usage",
1715
- type: "array"
1716
- },
1717
- {
1718
- name: "usage[].date",
1719
- type: "string"
2020
+ name: "stats",
2021
+ type: "object"
1720
2022
  },
1721
2023
  {
1722
- name: "usage[].estimated_micro_usd",
2024
+ name: "stats.level",
1723
2025
  type: "number"
1724
- }
1725
- ],
1726
- summary: "Show usage and cost per day"
1727
- }, {
1728
- arguments: [],
1729
- examples: [{
1730
- argv: [
1731
- "usage",
1732
- "estimate",
1733
- "--size",
1734
- "4x8",
1735
- "--ttl",
1736
- "3600"
1737
- ],
1738
- summary: "Price a 4x8 sandbox for an hour"
1739
- }],
1740
- kind: "leaf",
1741
- name: "estimate",
1742
- notes: ["Prices the spec on each provider that can run it, in routing order, without creating anything."],
1743
- options: [
1744
- baseUrl,
1745
- json,
1746
- ...sandboxSpecOptions
1747
- ],
1748
- result: [
1749
- {
1750
- name: "estimates",
1751
- type: "array"
1752
- },
1753
- {
1754
- name: "estimates[].provider",
1755
- type: "string"
1756
2026
  },
1757
2027
  {
1758
- name: "estimates[].ttl_micro_usd",
1759
- type: "number"
2028
+ name: "stats.badges",
2029
+ type: "array"
1760
2030
  }
1761
2031
  ],
1762
- summary: "Price a sandbox before creating it"
2032
+ summary: "Show level, streak, records, and badges"
1763
2033
  }],
1764
2034
  defaultChild: "inspect",
1765
2035
  kind: "group",
1766
- name: "usage",
1767
- summary: "Show usage and price sandboxes"
2036
+ name: "stats",
2037
+ summary: "Show your organization's level, streak, and badges"
1768
2038
  };
1769
2039
  const activity = {
1770
2040
  children: [{
@@ -1866,6 +2136,201 @@ const billing = {
1866
2136
  name: "billing",
1867
2137
  summary: "Show the plan and buy credits"
1868
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
+ };
1869
2334
  const telemetryLeaf = ({ name, summary }) => ({
1870
2335
  arguments: [],
1871
2336
  examples: [{
@@ -1975,12 +2440,16 @@ const CLI = {
1975
2440
  root: {
1976
2441
  children: [
1977
2442
  sandboxes,
2443
+ docker,
1978
2444
  keys,
1979
2445
  credentials,
1980
2446
  providers,
1981
2447
  usage,
2448
+ stats,
1982
2449
  activity,
1983
2450
  billing,
2451
+ pricing,
2452
+ ci,
1984
2453
  help,
1985
2454
  {
1986
2455
  children: [{
@@ -2023,15 +2492,20 @@ const CLI = {
2023
2492
  ["sandboxes", "exec"],
2024
2493
  ["sandboxes", "list"],
2025
2494
  ["sandboxes", "destroy"],
2026
- ["sandboxes", "files"]
2495
+ ["sandboxes", "files"],
2496
+ ["docker"]
2027
2497
  ],
2028
2498
  title: "Sandboxes"
2029
2499
  },
2030
2500
  {
2031
2501
  paths: [
2032
2502
  ["providers", "list"],
2503
+ ["pricing", "inspect"],
2033
2504
  ["usage", "estimate"],
2034
- ["usage", "inspect"]
2505
+ ["usage", "inspect"],
2506
+ ["usage", "live"],
2507
+ ["usage", "totals"],
2508
+ ["stats", "inspect"]
2035
2509
  ],
2036
2510
  title: "Providers and Cost"
2037
2511
  },
@@ -2054,4 +2528,4 @@ const CLI = {
2054
2528
  }
2055
2529
  ]
2056
2530
  };
2057
- export { CliFailure as A, remoteLine as C, isDigits as D, isDigit as E, statusOf as M, usageFailure as N, isUpper as O, Canceled as P, remoteCell as S, consistsOf as T, glyph as _, closest as a, theme as b, isOptionValue as c, parseLeaf as d, readOptionToken as f, ellipsis as g, clearLine as h, version as i, exitCodeOf as j, isWordCharacter as k, lastValue as l, valuesOf as m, CLEARABLE as n, flagOf as o, rerunArgv as p, CLI as r, isOptionToken as s, BIN as t, parseFailure as u, plainPrefix as v, remoteText as w, escapeUnprintable as x, spinnerFrame 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 };