Sandbox record and pipe-safe operations.
The Sandbox record is the central type of the SDK. Obtain one from pocketenv-io.pocketenv/create-sandbox or get-sandbox, then pipe operations with Clojure's -> threading macro:
(-> (pocketenv/create-sandbox "my-box") (sandbox/start) (sandbox/wait-until-running) (sandbox/exec "clojure" ["-M:test"]))
Every operation accepts either a bare Sandbox record or an {:ok sandbox} result map, enabling seamless threading. Passing {:error reason} raises an exception, keeping error handling explicit.
Sandbox record and pipe-safe operations.
The Sandbox record is the central type of the SDK. Obtain one from
pocketenv-io.pocketenv/create-sandbox or get-sandbox, then pipe
operations with Clojure's -> threading macro:
(-> (pocketenv/create-sandbox "my-box")
(sandbox/start)
(sandbox/wait-until-running)
(sandbox/exec "clojure" ["-M:test"]))
Every operation accepts either a bare Sandbox record or an {:ok sandbox}
result map, enabling seamless threading. Passing {:error reason} raises
an exception, keeping error handling explicit.(copy-to sandbox-or-result dest-sandbox-id src-path dest-path)(copy-to sandbox-or-result dest-sandbox-id src-path dest-path opts)Copies src-path from this sandbox into dest-path inside dest-sandbox-id.
No local I/O is involved — the transfer goes directly through storage.
Options: :token
Copies `src-path` from this sandbox into `dest-path` inside `dest-sandbox-id`. No local I/O is involved — the transfer goes directly through storage. Options: :token
(delete sandbox-or-result)(delete sandbox-or-result opts)Deletes the sandbox permanently. Returns {:ok sandbox} with last known state.
Options: :token
Deletes the sandbox permanently. Returns {:ok sandbox} with last known state.
Options: :token(delete-secret sandbox-or-result id)(delete-secret sandbox-or-result id opts)Deletes a secret by its id.
Options: :token
Deletes a secret by its id. Options: :token
(download sandbox-or-result sandbox-path local-path)(download sandbox-or-result sandbox-path local-path opts)Downloads sandbox-path from the sandbox and extracts it to local-path.
The sandbox compresses the path into a tar.gz archive which is then downloaded and extracted locally.
Options: :token
Downloads `sandbox-path` from the sandbox and extracts it to `local-path`. The sandbox compresses the path into a tar.gz archive which is then downloaded and extracted locally. Options: :token
(exec sandbox-or-result cmd)(exec sandbox-or-result cmd args)(exec sandbox-or-result cmd args opts)Executes a shell command inside the sandbox.
Returns {:ok ExecResult} with :stdout, :stderr, :exit-code.
Options: :token
Executes a shell command inside the sandbox.
Returns {:ok ExecResult} with :stdout, :stderr, :exit-code.
Options: :token(expose sandbox-or-result port)(expose sandbox-or-result port opts)Exposes a port on the sandbox. Returns {:ok preview-url-or-nil}.
Options: :description, :token
Exposes a port on the sandbox. Returns {:ok preview-url-or-nil}.
Options: :description, :token(get-ssh-keys sandbox-or-result)(get-ssh-keys sandbox-or-result opts)Fetches the SSH key pair for the sandbox.
Options: :token
Fetches the SSH key pair for the sandbox. Options: :token
(get-tailscale-auth-key sandbox-or-result)(get-tailscale-auth-key sandbox-or-result opts)Fetches the Tailscale auth key for the sandbox.
Options: :token
Fetches the Tailscale auth key for the sandbox. Options: :token
(list-ports sandbox-or-result)(list-ports sandbox-or-result opts)Lists all exposed ports on the sandbox.
Returns {:ok [Port]}
Lists all exposed ports on the sandbox.
Returns {:ok [Port]}(list-secrets sandbox-or-result)(list-secrets sandbox-or-result opts)Lists all secrets for the sandbox.
Options: :limit (default 100), :offset (default 0), :token
Lists all secrets for the sandbox. Options: :limit (default 100), :offset (default 0), :token
(set-secret sandbox-or-result name value)(set-secret sandbox-or-result name value opts)Adds an encrypted secret to the sandbox.
Options: :token
Adds an encrypted secret to the sandbox. Options: :token
(set-ssh-keys sandbox-or-result private-key public-key)(set-ssh-keys sandbox-or-result private-key public-key opts)Stores an SSH key pair. The private key is encrypted client-side.
Options: :token
Stores an SSH key pair. The private key is encrypted client-side. Options: :token
(set-tailscale-auth-key sandbox-or-result auth-key)(set-tailscale-auth-key sandbox-or-result auth-key opts)Stores a Tailscale auth key. Must start with "tskey-auth-". Encrypted client-side before transmission.
Options: :token
Stores a Tailscale auth key. Must start with "tskey-auth-". Encrypted client-side before transmission. Options: :token
(start sandbox-or-result)(start sandbox-or-result opts)Starts the sandbox. Re-fetches state after the call.
Options: :repo, :keep-alive, :token
Starts the sandbox. Re-fetches state after the call. Options: :repo, :keep-alive, :token
(stop sandbox-or-result)(stop sandbox-or-result opts)Stops the sandbox. Re-fetches state after the call.
Options: :token
Stops the sandbox. Re-fetches state after the call. Options: :token
(unexpose sandbox-or-result port)(unexpose sandbox-or-result port opts)Removes an exposed port. Returns {:ok sandbox}.
Options: :token
Removes an exposed port. Returns {:ok sandbox}.
Options: :token(upload sandbox-or-result local-path sandbox-path)(upload sandbox-or-result local-path sandbox-path opts)Uploads a local file or directory to sandbox-path inside the sandbox.
The local path is compressed into a tar.gz archive, uploaded to storage,
and then extracted by the sandbox at sandbox-path.
Options: :token
Uploads a local file or directory to `sandbox-path` inside the sandbox. The local path is compressed into a tar.gz archive, uploaded to storage, and then extracted by the sandbox at `sandbox-path`. Options: :token
(vscode sandbox-or-result)(vscode sandbox-or-result opts)Exposes VS Code Server and returns its URL.
Returns {:ok preview-url-or-nil}
Options: :token
Exposes VS Code Server and returns its URL.
Returns {:ok preview-url-or-nil}
Options: :token(wait-until-running sandbox-or-result)(wait-until-running sandbox-or-result opts)Polls until the sandbox status becomes :running.
Options: :timeout-ms (default 60000), :interval-ms (default 2000), :token
Polls until the sandbox status becomes :running. Options: :timeout-ms (default 60000), :interval-ms (default 2000), :token
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |