Minimal CLI to manage exposed ports on your prepare.sh sandbox VM — from inside the VM's terminal.
envctl ls list exposed ports on the current VM
envctl add <port> [--public] expose a port (optionally public)
envctl rm <port> remove an exposed port
envctl public <port> make a port public (no auth)
envctl private <port> make a port owner-only
[--vm <name>] [--alloc <id>] target a specific VM (auto-detected otherwise)
Uses the token already injected into the VM — no login needed:
PREPARESH_TOKENif set,- otherwise
ANTHROPIC_API_KEY(the samepsh.*token).
It's sent to api2 as the Session header and resolves to your account.
One account can have several VMs, so envctl auto-detects the current one by
matching the machine hostname against your allocations. If it can't tell
(multiple matches), it lists them — pass --vm <name> or --alloc <id>.
| Env var | Default | Meaning |
|---|---|---|
PREPARESH_TOKEN |
— | token (falls back to ANTHROPIC_API_KEY) |
PREPARESH_API |
https://prepare.sh/apiv2 |
api2 base (set to https://dev.prepare.sh/apiv2 on dev) |
curl -fsSL https://github.com/prepare-sh/environment-ctl/releases/latest/download/envctl-linux-amd64 \
-o /usr/local/bin/envctl && chmod +x /usr/local/bin/envctlOr build: go build -o envctl .
envctl add 3000 --public # expose your dev server publicly
envctl ls # see its URL
envctl private 3000 # lock it back to owner-only
envctl rm 3000