sandcovery 0.4.0 → 0.5.1

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/README.md CHANGED
@@ -51,6 +51,7 @@ The package also installs the `sandcovery` command, which calls the API through
51
51
 
52
52
  ```sh
53
53
  npm install --global sandcovery
54
+ sandcovery setup
54
55
  export SANDCOVERY_API_KEY=sand_...
55
56
 
56
57
  id=$(sandcovery sandboxes create --slug sandcovery/2x4:cheapest --ttl 600)
@@ -58,11 +59,18 @@ sandcovery sandboxes exec "$id" -- npm test
58
59
  sandcovery sandboxes destroy "$id" --yes
59
60
  ```
60
61
 
62
+ - `sandcovery setup` writes a shim for each drop-in the package installs, such as `docker` for `sandcovery-docker` and `kubectl` for `sandcovery-kubectl`, into `~/.config/sandcovery/bin`, and adds one line that puts that folder first on `PATH` to the bash, zsh, and fish startup files, so those commands run on sandboxes in each new terminal. It lists every change and asks first, and needs `--yes` without a terminal. Each line it adds ends in `# added by sandcovery setup`, `sandcovery setup --undo` removes those lines and the shims and nothing else, and your own `docker` or `kubectl` still runs by its full path.
63
+ - `sandcovery login` shows a URL and a code to approve in a browser signed in to Sandcovery, then saves a login, readable only by you, that commands send when neither `--token` nor `SANDCOVERY_API_KEY` is set. `sandcovery logout` revokes it and deletes it.
61
64
  - `sandcovery sandboxes exec` streams the command's output and exits with the command's exit code.
62
- - `sandcovery docker <args>` runs `docker <args>` in a sandbox on a provider that runs Docker, streams its output, and exits with its exit code, so a computer with no Docker can build and run containers. Later `sandcovery docker` commands reuse that sandbox until its TTL ends, and `build`, `buildx`, `builder`, `compose`, and `image build` first copy the working directory into it, up to 100 MiB packed. It reads no stdin and gets no terminal, so `docker run -it` does not work.
65
+ - `sandcovery docker <args>` runs `docker <args>` in a sandbox on a provider that runs Docker, streams its output, and exits with its exit code, so a computer with no Docker can build and run containers. Later `sandcovery docker` commands reuse that sandbox until its TTL ends. Before Docker runs, it copies the local files the command reads into the sandbox at the same absolute paths, up to 100 MiB packed, and runs Docker in the same working directory there: build contexts without what `.dockerignore` leaves out, bind mount sources, env files, the files `cp`, `load -i`, and `import` read, and a Compose project's files, build contexts, and bind mounts. It copies only paths under your home folder or the working directory. When stdin is not a terminal and Docker reads it, as with `login --password-stdin` or `load`, it hands stdin to Docker, and when stdout is not a terminal and Docker writes an archive there, as with `save`, the archive arrives byte for byte. Docker gets a terminal wherever yours is one, so `docker run -it`, `docker exec -it`, and `docker attach` work, and a command runs until it exits.
66
+ - `sandcovery-docker <args>` does the same in the same sandbox, takes Docker's arguments alone, and adds nothing to Docker's stdout or stderr, so `alias docker=sandcovery-docker` runs `docker` in the sandbox. It reads the key from `SANDCOVERY_API_KEY` or the saved login. Docker's environment variables are read in the sandbox, and a port a container publishes is reachable only inside the sandbox.
67
+ - `sandcovery kubectl <args>` runs your own `kubectl <args>` against a one-node Kubernetes cluster in a sandbox on Freestyle, or on boxd when Freestyle cannot create it, and exits with its exit code. The first command that reaches the cluster starts it, which takes a few minutes, and later commands reuse it. It stops 15 minutes after the last command that reached it ends, or at its TTL, whichever comes first, and a command that keeps running, such as `port-forward` or `logs -f`, keeps it running. `kubectl` must be on `PATH` and runs on your computer, so local files, `port-forward`, `exec -it`, and `logs -f` work as they do with a local cluster. `completion`, `config`, `version --client`, and `--help` start no cluster.
68
+ - `sandcovery-kubectl <args>` does the same on the same cluster, takes `kubectl`'s arguments alone, and adds nothing to `kubectl`'s stdout or stderr, so `alias kubectl=sandcovery-kubectl` runs `kubectl` on the sandbox's cluster. It reads the key from `SANDCOVERY_API_KEY` or the saved login.
63
69
  - `--json` prints one JSON document on stdout, and every failure prints a JSON error with a stable `reason` on stderr.
64
- - `sandboxes destroy`, `keys revoke`, and `credentials delete` ask first, and need `--yes` without a terminal.
65
- - `sandcovery providers list --routed` lists only the providers Sandcovery routes to, `sandcovery credentials offer` shows the free vCPU-hours your keys have earned, `sandcovery pricing inspect` shows the Pro price and the credit terms with no key, and `sandcovery billing inspect` and `sandcovery billing buy-credits --amount <USD>` show the plan and start a credit payment.
70
+ - `sandboxes destroy`, `keys revoke`, `credentials delete`, and `x-account unlink` ask first, and need `--yes` without a terminal.
71
+ - `sandcovery providers list --routed` lists only the providers Sandcovery routes to, `sandcovery credentials offer` shows the free vCPU-hours your keys have earned, `sandcovery credentials count-x-post <URL>` counts your post on X that tags @Sandcovery as one key, `sandcovery pricing inspect` shows the Pro price and the credit terms with no key, `sandcovery pricing monthly --size 2x4 --hours-per-day 8` prices a size for a month on each provider Sandcovery routes to with no key, and `sandcovery billing inspect` and `sandcovery billing buy-credits --amount <USD>` show the plan and start a credit payment.
72
+ - `sandcovery x-account inspect` shows the X account linked to you, `sandcovery x-account link` prints the dashboard page where you link one, since X confirms the link in the browser, and `sandcovery x-account unlink` unlinks it.
73
+ - `sandcovery problems report <text> --page <path>` tells the Sandcovery team about a problem with no key, as `sandcovery.problems.report({ message, path })` does from code.
66
74
  - `sandcovery help search <words>` finds a command, and `--help` works on every command.
67
75
  - The CLI sends anonymous usage data: command paths, option names, failure reasons, and exit codes, never values or remote data. `sandcovery cli telemetry disable` or `SANDCOVERY_TELEMETRY_DISABLED=1` turns it off.
68
76
 
@@ -84,9 +92,13 @@ const admin = new Sandcovery({ apiKey: process.env.SANDCOVERY_MANAGEMENT_KEY })
84
92
  await admin.credentials.set('e2b', { api_key: process.env.E2B_API_KEY })
85
93
  ```
86
94
 
87
- An organization on Pro can hold more than one credential for a provider: `credentials.add(provider, fields)` adds another, a create tries them in the order they were added, and `credentials.deleteOne(provider, id)` deletes one.
95
+ An organization holds as many credentials as it needs: `credentials.add(provider, fields)` adds another, a create tries a provider's credentials in the order they were added, and `credentials.deleteOne(provider, id)` deletes one. A Free organization routes only its oldest credential, and `paused` is `true` on each other one until it has Pro.
88
96
 
89
- The fields each provider takes are its `credential_fields` on `sandcovery.providers.get(provider)`. `sandcovery.providers.catalog()` lists every provider on the [provider board](https://www.sandcovery.com/providers), where `routed` is `false` for a provider that is coming soon. `credentials.offer()` reads the free vCPU-hours your keys have earned, `billing.get()` reads the plan and the credit balance, and `billing.buyCredits({ amount_micro_usd })` answers the Stripe Checkout page that takes a credit payment.
97
+ The fields each provider takes are its `credential_fields` on `sandcovery.providers.get(provider)`. `sandcovery.providers.catalog()` lists every provider on the [provider board](https://www.sandcovery.com/providers), where `routed` is `false` for a provider that is coming soon. `credentials.offer()` reads the free vCPU-hours your keys have earned, `credentials.countXPost({ url })` counts your post on X that tags @Sandcovery as one key, `billing.get()` reads the plan and the credit balance, and `billing.buyCredits({ amount_micro_usd })` answers the Stripe Checkout page that takes a credit payment.
98
+
99
+ ## X account
100
+
101
+ `xAccount.get()` reads the X account linked to you and whether Sandcovery links X accounts now, `xAccount.link()` answers the dashboard page where you link one, since X confirms the link in the browser, and `xAccount.unlink()` unlinks it and deletes its ID, handle, and X token. An X account belongs to a person, so these need a management key, which acts for the owner who minted it, and the CLI also takes its login. An API key receives 403 there.
90
102
 
91
103
  ## Interfaces
92
104