An open-source, faster Devin alternative
TypeScript
Sync plan and stubs: cross-links, CLI restructure, reference/cli.mdx
Igor Zalutski4cb54fea09d5
diff --git a/.agents_wip/docs-plan.md b/.agents_wip/docs-plan.mdindex aa4c1f2f..dd80a74b 100644--- a/.agents_wip/docs-plan.md+++ b/.agents_wip/docs-plan.md@@ -67,16 +67,17 @@ docs/├── reference/ ← NEW directory│ ├── api.mdx ← NEW (HTTP API — every endpoint)│ ├── typescript-sdk.mdx ← NEW (every class, method, type)-│ └── python-sdk.mdx ← NEW (every class, method, type)+│ ├── python-sdk.mdx ← NEW (every class, method, type)+│ └── cli.mdx ← NEW (every CLI command, flag, subcommand)│-├── cli/ ← KEEP (trimmed)-│ ├── overview.mdx-│ ├── sandbox.mdx-│ ├── exec.mdx-│ ├── shell.mdx-│ ├── checkpoint.mdx-│ ├── patch.mdx-│ └── preview.mdx+├── cli/ ← KEEP (guide-like pages in CLI nav group)+│ ├── overview.mdx ← REWRITE (install, config, key workflows)+│ ├── sandbox.mdx ← REWRITE (guide: sandbox management patterns)+│ ├── exec.mdx ← REWRITE from commands.mdx (guide: running commands)+│ ├── shell.mdx ← REWRITE (guide: interactive terminal tips)+│ ├── checkpoint.mdx ← REWRITE from checkpoints.mdx (guide: checkpoint workflows)+│ ├── patch.mdx ← REWRITE from patches.mdx (guide: patch patterns)+│ └── preview.mdx ← REWRITE from previews.mdx (guide: preview URL workflows)│├── guides/ ← KEEP│ ├── build-a-lovable-clone.mdx@@ -125,14 +126,6 @@ docs/"sandboxes/preview-urls"]},- {- "group": "Reference",- "pages": [- "reference/api",- "reference/typescript-sdk",- "reference/python-sdk"- ]- },{"group": "CLI","pages": [@@ -152,6 +145,15 @@ docs/"guides/agent-skill"]},+ {+ "group": "Reference",+ "pages": [+ "reference/api",+ "reference/typescript-sdk",+ "reference/python-sdk",+ "reference/cli"+ ]+ },{"group": "Resources","pages": [@@ -167,6 +169,8 @@ docs/- **Agents first.** This is the headline feature — most users land here to run Claude inside sandboxes. Putting Agents right after Getting Started matches the reader's intent.- **Agents get depth.** Four pages mirror the Sandboxes pattern: an overview page explaining what agents are, then dedicated pages for events (the output you consume), tools (configuring what agents can do), and multi-turn (conversations that span sessions). Each page earns its place by covering a distinct concern.- **Sandboxes group** contains the sandbox entity page plus everything you do with a sandbox (run commands, work with files, open terminals, create checkpoints, build templates, expose URLs).+- **CLI group** has guide-like pages (install, config, key workflows per topic). Each CLI page teaches patterns and concepts; the exhaustive flag-by-flag reference lives in `reference/cli.mdx`.+- **Reference is second-to-last.** It's lookup-oriented (every endpoint, every flag, every command) — most users read the entity/CLI pages first and only reach for Reference when they need exact signatures.- **Directory = group.** `agents/`, `sandboxes/`, `cli/`, `guides/` — folder structure mirrors navigation. No orphan files at the root (except Getting Started and Resources).- **No "Concepts" section.** Each entity page opens with what it is and why it exists, then shows the API.- **No "Features" section.** The sidebar groups tell you what things *are*.@@ -236,7 +240,9 @@ Each entity page follows this template:2. **Primary code example** in tabs (TypeScript / Python / HTTP API where applicable)3. **API reference** with `<ParamField>` for each method4. **Additional examples** (also tabbed where applicable)-5. **Related** — links to CLI equivalent, reference pages, and related entity pages+5. **Cross-links** — `<Tip>` at the bottom with: CLI equivalent (if one exists), links to Reference pages (TS SDK, Python SDK, HTTP API)++**Cross-linking pattern:** Entity pages link down to CLI guide + Reference. CLI guide pages link to the SDK entity page + `reference/cli.mdx`. This creates a navigable triangle: entity page ↔ CLI guide ↔ reference. A reader never hits a dead end.### Agents (`agents/`)@@ -469,7 +475,7 @@ Each entity page follows this template:### Reference (`reference/`)-These are exhaustive, lookup-oriented pages. No tutorials, no "why" — just every endpoint/method/type with parameters, return types, and a minimal example. The entity pages (Agents, Sandboxes) teach; these pages are the source of truth.+These are exhaustive, lookup-oriented pages. No tutorials, no "why" — just every endpoint/method/type/flag with parameters, return types, and a minimal example. The entity pages (Agents, Sandboxes) and CLI guide pages teach; these pages are the source of truth. Four pages: HTTP API, TypeScript SDK, Python SDK, CLI.#### `reference/api.mdx` — NEW@@ -610,31 +616,83 @@ Each method: full async signature, params with types and defaults, return type,**Source:** `sdks/python/opencomputer/` — all source files.+#### `reference/cli.mdx` — NEW++**Goal:** Exhaustive CLI reference. Every command, every subcommand, every flag. The lookup page for exact syntax when the CLI guide pages aren't enough.++**Structure:**+1. **Global flags** — `--api-key`, `--api-url`, `--json`+2. **`oc sandbox`** — create (flags: --template, --timeout, --cpu, --memory, --env, --metadata), list, get, kill, hibernate, wake, set-timeout+3. **`oc exec`** — exec (flags: --cwd, --timeout, --env), list, attach, kill+4. **`oc shell`** — shell (flags: --shell)+5. **`oc checkpoint`** — create (--name), list, restore, spawn (--timeout), delete. Alias: `oc cp`+6. **`oc patch`** — create (--script, --description), list, delete+7. **`oc preview`** — create (--port, --domain), list, delete+8. **`oc config`** — set, show++Each command: full syntax, flags table, output example.++**Source:** `cmd/oc/internal/commands/` — all command files.+----### CLI Reference (KEEP, streamline)+### CLI (guide-like pages)++The CLI has two tiers:++1. **CLI nav group** — 7 guide-like pages covering install, config, and key workflows per topic. Each page teaches patterns, concepts, and when to use what — not exhaustive flag reference.+2. **Reference nav group** — one `reference/cli.mdx` page with every command, every subcommand, every flag. The exhaustive lookup page.-CLI pages stay as a separate nav group. These are reference-only (no conceptual content — that lives in feature pages). Each page: flags table, output examples, practical one-liners.+Each CLI guide page ends with a `<Tip>` linking to both:+- The SDK entity page for the same topic (e.g., cli/checkpoint → sandboxes/checkpoints)+- The relevant section in `reference/cli.mdx` for the full flag spec#### `cli/overview.mdx` — REWRITE- Installation (4 platforms)- Configuration (`oc config set`)- Resolution order (flags > env > config > defaults)- Global flags-- JSON output mode--#### `cli/sandbox.mdx` — KEEP (minor edits)-- Includes: create, list, get, kill, hibernate, wake, set-timeout-#### `cli/exec.mdx` — RENAME from commands.mdx, update to match `oc exec` naming-- Includes: exec (default), list, attach, kill subcommands-#### `cli/shell.mdx` — KEEP (minor edits)-- Supports `--shell` flag (default `/bin/bash`)-#### `cli/checkpoint.mdx` — KEEP (minor edits)-- Includes: create, list, restore, spawn, delete-#### `cli/patch.mdx` — RENAME from patches.mdx (singular)-- `oc patch` is a separate command group from `oc checkpoint`-- Includes: create (--script file/stdin), list, delete-#### `cli/preview.mdx` — RENAME from previews.mdx (singular)+- JSON output mode & scripting with jq+- Key workflows (create-and-shell, piping patterns)+- Command index table linking to per-topic pages++#### `cli/sandbox.mdx` — REWRITE (guide)+- Creating, listing, inspecting sandboxes+- Hibernation & wake patterns+- Adjusting timeouts+- Killing a sandbox+- Common patterns: create-and-shell, filter running sandboxes++#### `cli/exec.mdx` — REWRITE from commands.mdx (guide)+- Running commands, working directory, env vars+- Timeouts+- JSON output capture for scripting+- Managing exec sessions (list, attach, kill)+- When to use exec vs shell++#### `cli/shell.mdx` — REWRITE (guide)+- Opening a shell, choosing shell binary+- What works (full-screen apps, colors, resizing)+- Shell vs exec decision table+- Tips and one-liners++#### `cli/checkpoint.mdx` — REWRITE (guide)+- Creating checkpoints+- Forking pattern (parallel exploration)+- Restoring+- Checkpoint vs hibernate decision table++#### `cli/patch.mdx` — REWRITE from patches.mdx (guide)+- What patches do+- Creating from file or stdin+- Layering setup steps pattern+- Inspecting before spawning++#### `cli/preview.mdx` — REWRITE from previews.mdx (guide)+- Exposing ports+- Sharing a dev server workflow+- Multiple ports+- Custom domains---@@ -696,13 +754,14 @@ agents.mdx → agents/overview.mdxrunning-commands.mdx → sandboxes/running-commands.mdxworking-with-files.mdx → sandboxes/working-with-files.mdx-# CLI renames (3)+# CLI renames (4)cli/commands.mdx → cli/exec.mdx+cli/checkpoints.mdx → cli/checkpoint.mdxcli/patches.mdx → cli/patch.mdxcli/previews.mdx → cli/preview.mdx```-Total: 16 SDK pages deleted, 3 root pages moved, 3 CLI pages renamed.+Total: 16 SDK pages deleted, 3 root pages moved, 4 CLI pages renamed.---@@ -771,23 +830,25 @@ The Python SDK is **not feature-equivalent** to TypeScript. Every page spec abov16. Create `reference/api.mdx` (HTTP API — derived from router.go)17. Create `reference/typescript-sdk.mdx` (derived from sdks/typescript/src/)18. Create `reference/python-sdk.mdx` (derived from sdks/python/opencomputer/)--### Phase 5: CLI + Support Pages-19. Rewrite `cli/overview.mdx`-20. Update `cli/sandbox.mdx`-21. Create `cli/exec.mdx` (rename from commands)-22. Update `cli/shell.mdx`-23. Update `cli/checkpoint.mdx`-24. Create `cli/patch.mdx` (rename from patches)-25. Create `cli/preview.mdx` (rename from previews)-26. Create `troubleshooting.mdx`+19. Create `reference/cli.mdx` (exhaustive CLI reference — derived from cmd/oc/)++### Phase 5: CLI Guide Pages + Support+20. Rewrite `cli/overview.mdx` (install, config, workflows)+21. Rewrite `cli/sandbox.mdx` (guide: sandbox management patterns)+22. Rewrite `cli/exec.mdx` (guide: running commands — rename from commands)+23. Rewrite `cli/shell.mdx` (guide: interactive terminal tips)+24. Rewrite `cli/checkpoint.mdx` (guide: checkpoint workflows)+25. Rewrite `cli/patch.mdx` (guide: patch patterns — rename from patches)+26. Rewrite `cli/preview.mdx` (guide: preview URL workflows — rename from previews)+27. Create `troubleshooting.mdx`### Phase 6: Cleanup-27. Update `guides/build-a-lovable-clone.mdx` (minor fixes)-28. Delete all `sdks/` pages-29. Delete old root-level feature pages (agents.mdx, running-commands.mdx, working-with-files.mdx)-30. Delete obsolete CLI pages-31. Update `mint.json` with new navigation+28. Update `guides/build-a-lovable-clone.mdx` (minor fixes)+29. Delete all `sdks/` pages+30. Delete old root-level feature pages (agents.mdx, running-commands.mdx, working-with-files.mdx)+31. Delete obsolete CLI pages (commands.mdx, checkpoints.mdx [plural], patches.mdx, previews.mdx)++Note: `mint.json` navigation already updated during stub scaffolding pass.---@@ -798,16 +859,18 @@ The Python SDK is **not feature-equivalent** to TypeScript. Every page spec abov| Getting Started | 2 | 3 | +1 || Agents | 1* | 4 | +3 || Sandboxes | 2* | 8 | +6 |-| Reference | 0 | 3 | +3 || CLI | 7 | 7 | 0 || Guides | 2 | 2 | 0 |+| Reference | 0 | 4 | +4 || Resources | 0 | 1 | +1 || SDK (tabs) | 16 | 0 | -16 |-| **Total** | **30** | **28** | **-2** |+| **Total** | **30** | **29** | **-1** |*Current agents.mdx + running-commands.mdx + working-with-files.mdx exist at root level without clear grouping.-Net result: 2 fewer pages, but every page earns its place. Entity pages teach with curated examples; Reference pages are exhaustive lookup. Zero duplication between SDK tabs.+CLI nav group = 7 guide-like pages (overview + per-topic). Reference group = HTTP API + TS SDK + Python SDK + CLI Reference (exhaustive). CLI pages teach workflows; Reference/CLI has every flag.++Net result: 1 fewer page, but every page earns its place. Entity pages teach with curated examples; Reference pages are exhaustive lookup. Zero duplication between SDK tabs.---@@ -824,5 +887,5 @@ Each page must pass these checks before shipping:- [ ] Python-unique features (context manager, collect_events, recv) documented where relevant- [ ] No "coming soon" for features that now exist- [ ] No filler sentences ("In this section we will..." — just do it)-- [ ] Cross-links to reference pages for full method signatures-- [ ] CLI equivalent noted where applicable+- [ ] Entity pages: `<Tip>` at bottom linking to CLI guide (if applicable) + Reference pages (TS SDK, Python SDK, HTTP API)+- [ ] CLI guide pages: `<Tip>` at bottom linking to SDK entity page + reference/cli.mdx sectiondiff --git a/docs/agents/overview.mdx b/docs/agents/overview.mdxindex 7652e177..db9a0fb7 100644--- a/docs/agents/overview.mdx+++ b/docs/agents/overview.mdx@@ -51,6 +51,10 @@ description: "Run Claude inside sandboxes"{/* Quick links to sub-pages: Events, Tools, Multi-turn */}+<Tip>+ Full reference: [TypeScript SDK](/reference/typescript-sdk#agent) · [Python SDK](/reference/python-sdk#agent) · [HTTP API](/reference/api#agent-sessions).+</Tip>+<CardGroup cols={3}><Card title="Events" icon="stream" href="/agents/events">Understanding the event streamdiff --git a/docs/cli/checkpoint.mdx b/docs/cli/checkpoint.mdxindex 4ddc82f6..b586417d 100644--- a/docs/cli/checkpoint.mdx+++ b/docs/cli/checkpoint.mdx@@ -1,50 +1,50 @@----title: "checkpoint"-description: "Snapshot, fork, and restore sandboxes"+title: "Checkpoints"+description: "Snapshot, fork, and restore from the CLI"----{/* STUB — Renamed from checkpoints.mdx. Content will be migrated with minor updates. */}+{/* STUB — Guide-like CLI page. Key workflows and patterns.+ Exhaustive reference lives at /reference/cli. */}-{/* Sections:- - oc checkpoint create <sandbox-id> --name <name>- - oc checkpoint list <sandbox-id>- - oc checkpoint restore <sandbox-id> <checkpoint-id>- - oc checkpoint spawn <checkpoint-id> [--timeout]- - oc checkpoint delete <sandbox-id> <checkpoint-id>- - Alias: oc cp- - Examples: save before risky op, fork for parallel testing, checkpoint vs hibernate table-*/}+## Creating a Checkpoint-## Create a Checkpoint+{/* oc checkpoint create. What gets captured (memory, disk, processes). */}```bash-oc checkpoint create sb-abc123 --name my-checkpoint+oc checkpoint create sb-abc123 --name before-migration```-## List Checkpoints+## Forking from a Checkpoint-```bash-oc checkpoint list sb-abc123-```--## Restore+{/* oc checkpoint spawn. Creates a new sandbox from saved state. Parallel exploration pattern. */}```bash-oc checkpoint restore sb-abc123 cp-7f3a1b2c+# Spawn two independent sandboxes from the same checkpoint+ID1=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.id')+ID2=$(oc checkpoint spawn cp-7f3a1b2c --json | jq -r '.id')++# Run different experiments+oc exec $ID1 -- ./experiment-a.sh+oc exec $ID2 -- ./experiment-b.sh```-## Spawn (Fork)+## Restoring-```bash-oc checkpoint spawn cp-7f3a1b2c-```+{/* oc checkpoint restore. Reverts in-place — all changes since checkpoint are lost. */}-## Delete+## Checkpoint vs Hibernate-```bash-oc checkpoint delete sb-abc123 cp-7f3a1b2c-```+{/* When to use which:+ - Checkpoint: branching, forking, testing multiple approaches+ - Hibernate: pause and resume the same sandbox, cost savings+*/}-## Examples+| | Checkpoint | Hibernate |+| --- | --- | --- |+| Original sandbox | Keeps running | Stopped |+| Can fork / clone | Yes | No |+| Use case | Branching, testing | Pause and resume |-{/* Save before risky op, fork for parallel testing, checkpoint vs hibernate comparison */}+<Tip>+ SDK usage: [Checkpoints](/sandboxes/checkpoints). Full flags: [CLI Reference](/reference/cli#oc-checkpoint).+</Tip>diff --git a/docs/cli/exec.mdx b/docs/cli/exec.mdxindex f1ec37e4..940bbfc8 100644--- a/docs/cli/exec.mdx+++ b/docs/cli/exec.mdx@@ -1,48 +1,48 @@----title: "exec"-description: "Execute shell commands inside a sandbox"+title: "Running Commands"+description: "Execute shell commands from the CLI"----{/* STUB — Renamed from commands.mdx. Content will be migrated with minor updates (oc exec naming). */}--{/* Sections:- - oc exec <id> -- <command...> (run and wait)- - Flags: --cwd, --timeout, --env- - oc exec list <id> — list running exec sessions- - oc exec attach <id> <session-id> — attach to running session- - oc exec kill <id> <session-id> — kill session- - ProcessResult (JSON output)- - Examples: cwd, env, timeout, chaining, capture JSON output-*/}+{/* STUB — Guide-like CLI page. Key concepts and patterns, not exhaustive flag reference.+ Exhaustive reference lives at /reference/cli. */}## Running a Command+{/* oc exec <id> -- <command>. How it works: command runs inside sandbox, stdout/stderr stream to terminal, CLI exits with same exit code. */}+```bashoc exec sb-abc123 -- echo "Hello, World!"```-### `oc exec <id> -- <command...>`--{/* Flags table: --cwd, --timeout, --env. JSON output mode. */}+## Working Directory & Environment-## List Exec Sessions+{/* --cwd and --env flags. When to use them. */}```bash-oc exec list sb-abc123+oc exec sb-abc123 --cwd /app --env NODE_ENV=production -- npm run build```-## Attach to a Session+## Timeouts-```bash-oc exec attach sb-abc123 sess-xyz-```+{/* --timeout flag. Default 60s. What happens when exceeded. */}-## Kill a Session+## Capturing Output as JSON++{/* --json flag gives ProcessResult object. Pipe to jq for scripting. */}```bash-oc exec kill sb-abc123 sess-xyz+RESULT=$(oc exec sb-abc123 --json -- node -e 'console.log("hello")')+echo $RESULT | jq '.stdout'```-## Examples+## Managing Exec Sessions++{/* oc exec list, attach, kill — for long-running processes started via SDK. */}++## Shell vs Exec++{/* When to use oc exec (single command, scripting, automation) vs oc shell (interactive, debugging). */}-{/* Working directory, env vars, timeout, chaining, JSON capture */}+<Tip>+ SDK usage: [Running Commands](/sandboxes/running-commands). Full flags: [CLI Reference](/reference/cli#oc-exec).+</Tip>diff --git a/docs/cli/overview.mdx b/docs/cli/overview.mdxindex 9abe2635..912b0126 100644--- a/docs/cli/overview.mdx+++ b/docs/cli/overview.mdx@@ -1,13 +1,16 @@----title: "CLI Reference"-description: "Full reference for the oc command-line interface"+title: "CLI"+description: "Manage sandboxes from your terminal"---+{/* STUB — Progressive JPEG pass 1. Conceptual CLI page: install, config, key workflows.+ Per-command reference (flags, subcommands) lives in Reference section. */}+The `oc` CLI lets you manage OpenComputer sandboxes directly from your terminal — create sandboxes, run commands, open interactive shells, manage checkpoints, and more.## Installation-Download the latest binary for your platform from [GitHub Releases](https://github.com/diggerhq/opencomputer/releases):+{/* 4 platforms: macOS Apple Silicon, macOS Intel, Linux x86_64, Linux ARM64. CodeGroup with curl commands. */}<CodeGroup>@@ -33,35 +36,13 @@ chmod +x /usr/local/bin/oc</CodeGroup>-Verify the installation:--```bash-oc --version-```-## Configuration-Set your API key (stored in `~/.oc/config.json`):--```bash-oc config set api-key YOUR_API_KEY-```--Optionally set a custom API URL:--```bash-oc config set api-url https://app.opencomputer.dev-```--View current configuration:--```bash-oc config show-```+{/* oc config set api-key / api-url. Config file: ~/.oc/config.json. oc config show. */}### Resolution Order-Configuration values are resolved in this order (highest priority first):+{/* Table: flags > env > config > defaults */}| Priority | Source | Example || --- | --- | --- |@@ -72,15 +53,23 @@ Configuration values are resolved in this order (highest priority first):## Global Flags-Every command supports these flags:-| Flag | Environment Variable | Description || --- | --- | --- || `--api-key` | `OPENCOMPUTER_API_KEY` | API key for authentication || `--api-url` | `OPENCOMPUTER_API_URL` | Control plane URL || `--json` | — | Output as JSON instead of tables |-## Quick Example+## Key Workflows++{/* Practical patterns — how to actually use the CLI effectively.+ - Create and shell in one line: oc shell $(oc create --json | jq -r '.sandboxID')+ - Scripting with --json and jq+ - Hibernate/wake for cost savings+ - Checkpoint -> fork -> parallel testing pattern+ - Top-level shortcuts: oc create = oc sandbox create, oc ls = oc sandbox list+*/}++### Quick Start```bash# Create a sandbox@@ -96,20 +85,9 @@ oc shell sb-abc123oc sandbox kill sb-abc123```-## Modules--| Module | Description |-| --- | --- |-| [Sandbox](/cli/sandbox) | Create, list, and manage sandbox lifecycles |-| [Commands](/cli/commands) | Execute shell commands in a sandbox |-| [Shell](/cli/shell) | Interactive PTY terminal sessions |-| [Checkpoints](/cli/checkpoints) | Snapshot, fork, and restore sandboxes |-| [Patches](/cli/patches) | Apply scripted modifications to checkpoints |-| [Preview URLs](/cli/previews) | Expose sandbox ports to the internet |--## JSON Output+### JSON Output & Scripting-Every command supports `--json` for machine-readable output, making it easy to script with `jq`:+{/* --json flag + jq patterns. Capture IDs, filter by status. */}```bash# Get a sandbox ID programmatically@@ -118,3 +96,20 @@ ID=$(oc create --json | jq -r '.sandboxID')# List all running sandbox IDsoc ls --json | jq -r '.[].sandboxID'```++### Top-level Shortcuts++{/* oc create = oc sandbox create, oc ls = oc sandbox list */}++## Command Reference++{/* Links to per-command reference pages (in Reference section) */}++| Command | Description |+| --- | --- |+| [sandbox](/cli/sandbox) | Create, list, kill, hibernate, wake |+| [exec](/cli/exec) | Run commands, manage exec sessions |+| [shell](/cli/shell) | Interactive PTY terminal |+| [checkpoint](/cli/checkpoint) | Snapshot, fork, restore |+| [patch](/cli/patch) | Checkpoint-attached scripts |+| [preview](/cli/preview) | Expose ports to the internet |diff --git a/docs/cli/patch.mdx b/docs/cli/patch.mdxindex 70b31057..447a54c5 100644--- a/docs/cli/patch.mdx+++ b/docs/cli/patch.mdx@@ -1,41 +1,43 @@----title: "patch"-description: "Apply scripted modifications to checkpoints"+title: "Patches"+description: "Attach scripts to checkpoints from the CLI"----{/* STUB — Renamed from patches.mdx. Content will be migrated with minor updates. */}+{/* STUB — Guide-like CLI page. Key concepts and workflows.+ Exhaustive reference lives at /reference/cli. */}-{/* Sections:- - oc patch create <checkpoint-id> --script <file|-> [--description]- - oc patch list <checkpoint-id>- - oc patch delete <checkpoint-id> <patch-id>- - Examples: layer setup, stdin one-liners, inspect before spawning-*/}+## What Patches Do-## Create a Patch+{/* Shell scripts attached to a checkpoint. Run in order every time a sandbox is forked from that checkpoint. Layer setup without re-creating the checkpoint. */}-```bash-oc patch create cp-7f3a1b2c --script ./setup.sh --description "Install dependencies"-```+## Creating a Patch-From stdin:+{/* From file or stdin. */}```bash-echo "apt install -y curl jq" | oc patch create cp-7f3a1b2c --script=--```--## List Patches+# From a file+oc patch create cp-7f3a1b2c --script ./setup.sh --description "Install deps"-```bash-oc patch list cp-7f3a1b2c+# One-liner from stdin+echo "npm install -g typescript" | oc patch create cp-7f3a1b2c --script=-```-## Delete a Patch+## Layering Setup++{/* Pattern: base checkpoint + multiple patches for each layer of configuration. */}```bash-oc patch delete cp-7f3a1b2c patch-3c8d2e1a+oc patch create cp-7f3a1b2c --script ./install-node.sh --description "Node.js 20"+oc patch create cp-7f3a1b2c --script ./app-config.sh --description "App config"++# Each spawned sandbox gets both patches applied in order+oc checkpoint spawn cp-7f3a1b2c```-## Examples+## Inspecting Patches++{/* oc patch list before spawning to review what will run. */}-{/* Layer setup steps, stdin one-liners, inspect before spawning */}+<Tip>+ SDK usage: [Patches](/sandboxes/patches). Full flags: [CLI Reference](/reference/cli#oc-patch).+</Tip>diff --git a/docs/cli/preview.mdx b/docs/cli/preview.mdxindex b29a3c7d..558cf397 100644--- a/docs/cli/preview.mdx+++ b/docs/cli/preview.mdx@@ -1,41 +1,39 @@----title: "preview"-description: "Expose sandbox ports to the internet"+title: "Preview URLs"+description: "Expose sandbox ports from the CLI"----{/* STUB — Renamed from previews.mdx. Content will be migrated with minor updates. */}+{/* STUB — Guide-like CLI page. Key concepts and workflows.+ Exhaustive reference lives at /reference/cli. */}-{/* Sections:- - oc preview create <sandbox-id> --port <port> [--domain]- - oc preview list <sandbox-id>- - oc preview delete <sandbox-id> <port>- - Examples: share dev server, multiple ports, custom domain, scripted URL capture-*/}+## Exposing a Port-## Create a Preview URL+{/* oc preview create. Public HTTPS URL that proxies to a sandbox port. */}```bashoc preview create sb-abc123 --port 3000```-With custom domain:+## Sharing a Dev Server-```bash-oc preview create sb-abc123 --port 8080 --domain preview.example.com-```--## List Preview URLs+{/* Start a server inside sandbox, expose it, share the URL. */}```bash-oc preview list sb-abc123+oc exec sb-abc123 -- bash -c 'cd /app && npm run dev &'+oc preview create sb-abc123 --port 3000++# Get the URL+oc preview list sb-abc123 --json | jq -r '.[0].hostname'```-## Delete a Preview URL+## Multiple Ports-```bash-oc preview delete sb-abc123 3000-```+{/* Frontend on 3000, API on 4000. */}++## Custom Domains-## Examples+{/* --domain flag. DNS must point to OpenComputer ingress. SSL automatic. */}-{/* Share dev server, multiple ports, custom domain, scripted URL capture */}+<Tip>+ SDK usage: [Preview URLs](/sandboxes/preview-urls). Full flags: [CLI Reference](/reference/cli#oc-preview).+</Tip>diff --git a/docs/cli/sandbox.mdx b/docs/cli/sandbox.mdxindex 0774d341..b81277fe 100644--- a/docs/cli/sandbox.mdx+++ b/docs/cli/sandbox.mdx@@ -1,137 +1,63 @@----title: "Sandbox"-description: "Create, list, and manage sandbox lifecycles"+title: "Sandbox Management"+description: "Create, manage, and control sandbox lifecycles from the CLI"----The `sandbox` command group manages the full lifecycle of OpenComputer sandboxes. The most common operations — `create` and `ls` — are also available as top-level shortcuts.+{/* STUB — Guide-like CLI page. Key workflows and patterns.+ Exhaustive reference lives at /reference/cli. */}-## Create a Sandbox+## Creating a Sandbox-```bash-oc create-```--Or with options:+{/* oc create (shortcut for oc sandbox create). Template, resources, env vars. */}```bash+oc createoc create --timeout 600 --cpu 2 --memory 2048 --env NODE_ENV=production```-### `oc create`--Alias for `oc sandbox create`. Creates a new sandbox and prints its ID.--| Flag | Type | Default | Description |-| --- | --- | --- | --- |-| `--template` | string | `default` | Template to use |-| `--timeout` | int | `300` | Sandbox TTL in seconds |-| `--cpu` | int | `1` | Number of vCPUs |-| `--memory` | int | `1024` | Memory in MB |-| `--env` | string | — | Environment variable (`KEY=VALUE`, repeatable) |-| `--metadata` | string | — | Metadata (`KEY=VALUE`, repeatable) |+## Listing & Inspecting-## List Sandboxes+{/* oc ls (shortcut). Table output. oc sandbox get for details. */}```bashoc ls-```--Output:--```-ID TEMPLATE STATUS CPU MEM AGE-sb-e148d1b0 running 1 1024MB 2m30s-sb-a3f91c27 running 2 2048MB 15m0s-```--### `oc ls`--Alias for `oc sandbox list`. Lists all sandboxes for your organization.--## Get Sandbox Details--```bashoc sandbox get sb-abc123```-### `oc sandbox get <id>`--Displays detailed information about a sandbox including status, resources, and timestamps.--## Kill a Sandbox--```bash-oc sandbox kill sb-abc123-```--### `oc sandbox kill <id>`--Immediately terminates a sandbox. All data is lost unless a [checkpoint](/cli/checkpoints) was created.+## Hibernation & Wake-## Hibernate+{/* Save state and stop paying. Resume exactly where you left off. */}```bashoc sandbox hibernate sb-abc123-```-### `oc sandbox hibernate <id>`--Saves the sandbox's full state (memory + disk) to S3 and stops the VM. The sandbox can be resumed later with `wake`.--## Wake--```bash+# ... hours later ...oc sandbox wake sb-abc123+oc shell sb-abc123 # picks up where you left off```-Or with a new timeout:--```bash-oc sandbox wake sb-abc123 --timeout 600-```--### `oc sandbox wake <id>`--Resumes a hibernated sandbox. All processes and state are restored exactly as they were.--| Flag | Type | Default | Description |-| --- | --- | --- | --- |-| `--timeout` | int | `300` | New TTL in seconds after waking |--## Set Timeout--```bash-oc sandbox set-timeout sb-abc123 600-```--### `oc sandbox set-timeout <id> <seconds>`+## Adjusting Timeout-Updates the sandbox's idle timeout and resets the TTL countdown.+{/* oc sandbox set-timeout. Rolling idle timeout resets on every operation. */}-## Examples+## Killing a Sandbox-### Create and Immediately Shell In+{/* oc sandbox kill. Data lost unless checkpointed. */}-```bash-ID=$(oc create --json | jq -r '.sandboxID')-oc shell $ID-```+## Common Patterns-### Hibernate and Resume Later+### Create and Shell In```bash-# Save state and stop-oc sandbox hibernate sb-abc123--# ... hours later ...--# Resume exactly where you left off-oc sandbox wake sb-abc123-oc shell sb-abc123+oc shell $(oc create --json | jq -r '.sandboxID')```-### List Running Sandboxes as JSON+### Filter Running Sandboxes```bashoc ls --json | jq '.[] | select(.status == "running") | .sandboxID'```++<Tip>+ SDK usage: [Sandboxes](/sandboxes/overview). Full flags: [CLI Reference](/reference/cli#oc-sandbox).+</Tip>diff --git a/docs/cli/shell.mdx b/docs/cli/shell.mdxindex 68330137..e24c4984 100644--- a/docs/cli/shell.mdx+++ b/docs/cli/shell.mdx@@ -1,71 +1,55 @@---title: "Shell"-description: "Open an interactive terminal session in a sandbox"+description: "Interactive terminal sessions from the CLI"----The `shell` command opens a full interactive terminal inside a running sandbox. It connects via WebSocket and supports everything you'd expect from a local terminal — colors, tab completion, `vim`, `top`, and terminal resizing.+{/* STUB — Guide-like CLI page. Key concepts and tips.+ Exhaustive reference lives at /reference/cli. */}## Opening a Shell+{/* oc shell <id>. Full interactive terminal over WebSocket. Ctrl+D or exit to disconnect. */}+```bashoc shell sb-abc123```-You'll be dropped into a bash shell inside the sandbox. Press `Ctrl+D` or type `exit` to disconnect.--### `oc shell <id>`--Creates a PTY session and opens a bidirectional WebSocket connection to the sandbox.+## Choosing a Shell-| Flag | Type | Default | Description |-| --- | --- | --- | --- |-| `--shell` | string | `/bin/bash` | Shell binary to use |--## Using a Different Shell+{/* --shell flag. Default /bin/bash. */}```bashoc shell sb-abc123 --shell /bin/zsh-oc shell sb-abc123 --shell /bin/sh```-## How It Works+## What Works-1. **Get sandbox info** — Fetches the sandbox's direct worker URL and auth token from the control plane-2. **Create PTY** — Sends your terminal dimensions to the worker to create a PTY session-3. **WebSocket connect** — Opens a persistent WebSocket to the worker for bidirectional I/O-4. **Raw terminal mode** — Puts your local terminal into raw mode so keystrokes are forwarded directly-5. **Resize handling** — Listens for `SIGWINCH` and sends resize events when you resize your terminal window-6. **Cleanup** — On exit, restores your terminal, closes the WebSocket, and destroys the remote PTY session+{/* Full-screen apps, colors, tab completion, terminal resizing — everything you'd expect. */}-## Tips+- `vim`, `nano` — text editors+- `top`, `htop` — process monitors+- Tab completion, command history+- Terminal resizing (automatic)-### Create and Shell In One Line+## Shell vs Exec-```bash-oc shell $(oc create --json | jq -r '.sandboxID')-```+{/* When to use which. */}++| Use Case | Command |+| --- | --- |+| Run a single command, capture output | `oc exec` |+| Scripting and automation | `oc exec` |+| Interactive development | `oc shell` |+| Debugging | `oc shell` |-### Interactive Tools Work+## Tips-Full-screen terminal applications work as expected:+### Create and Shell in One Line```bash-# Inside the shell:-top # Process monitor-vim file.txt # Text editor-htop # Interactive process viewer+oc shell $(oc create --json | jq -r '.sandboxID')```-### Terminal Resizing--Resize your terminal window at any time — the remote PTY automatically adjusts to match your new dimensions.--### When to Use Shell vs Exec--| Use Case | Command |-| --- | --- |-| Run a single command and capture output | `oc exec` |-| Script or automation | `oc exec` |-| Interactive development | `oc shell` |-| Debugging | `oc shell` |-| Long-running interactive sessions | `oc shell` |+<Tip>+ SDK usage: [Interactive Terminals](/sandboxes/interactive-terminals). Full flags: [CLI Reference](/reference/cli#oc-shell).+</Tip>diff --git a/docs/mint.json b/docs/mint.jsonindex 6fe672a1..eb4ee784 100644--- a/docs/mint.json+++ b/docs/mint.json@@ -57,6 +57,18 @@"sandboxes/preview-urls"]},+ {+ "group": "CLI",+ "pages": [+ "cli/overview",+ "cli/sandbox",+ "cli/exec",+ "cli/shell",+ "cli/checkpoint",+ "cli/patch",+ "cli/preview"+ ]+ },{"group": "Guides","pages": [@@ -70,13 +82,7 @@"reference/api","reference/typescript-sdk","reference/python-sdk",- "cli/overview",- "cli/sandbox",- "cli/exec",- "cli/shell",- "cli/checkpoint",- "cli/patch",- "cli/preview"+ "reference/cli"]},{diff --git a/docs/reference/api.mdx b/docs/reference/api.mdxindex 3ef61368..6c1826aa 100644--- a/docs/reference/api.mdx+++ b/docs/reference/api.mdx@@ -12,6 +12,7 @@ description: "Complete REST API reference"- Worker direct auth: Authorization: Bearer <JWT> (or token query param for WS)- SDK users only need API key — SDK handles JWT transparently- All JSON except file read (plain text)+ - Token refresh: POST /sandboxes/:id/token/refresh — returns new JWT (worker auth)*/}## Sandbox Lifecycle@@ -184,7 +185,7 @@ description: "Complete REST API reference"### `POST /api/sandboxes/:id/pty` — Create-{/* Body: { cols?, rows? }. Response: { sessionId }. */}+{/* Body: { cols?, rows?, shell? }. Response: { sessionId }. */}### `GET /api/sandboxes/:id/pty/:sessionID` — WebSocketdiff --git a/docs/reference/cli.mdx b/docs/reference/cli.mdxnew file mode 100644index 00000000..7e0d75a8--- /dev/null+++ b/docs/reference/cli.mdx@@ -0,0 +1,102 @@+---+title: "CLI Reference"+description: "Every command, subcommand, and flag"+---++{/* STUB — Progressive JPEG pass 1. Exhaustive CLI reference: every command, every flag, every output format. */}++## Global Flags++| Flag | Environment Variable | Description |+| --- | --- | --- |+| `--api-key` | `OPENCOMPUTER_API_KEY` | API key for authentication |+| `--api-url` | `OPENCOMPUTER_API_URL` | Control plane URL |+| `--json` | — | Output as JSON instead of tables |++## `oc sandbox`++{/* Aliases: oc create = oc sandbox create, oc ls = oc sandbox list */}++### `oc sandbox create` / `oc create`++{/* Flags: --template, --timeout, --cpu, --memory, --env, --metadata. Output: sandbox ID. */}++### `oc sandbox list` / `oc ls`++{/* Output: table with ID, TEMPLATE, STATUS, CPU, MEM, AGE. */}++### `oc sandbox get <id>`++{/* Output: detailed sandbox info. */}++### `oc sandbox kill <id>`++### `oc sandbox hibernate <id>`++### `oc sandbox wake <id>`++{/* Flags: --timeout */}++### `oc sandbox set-timeout <id> <seconds>`++## `oc exec`++### `oc exec <id> -- <command...>`++{/* Flags: --cwd, --timeout, --env. Exit code passthrough. JSON output: ProcessResult. */}++### `oc exec list <id>`++### `oc exec attach <id> <session-id>`++### `oc exec kill <id> <session-id>`++## `oc shell`++### `oc shell <id>`++{/* Flags: --shell (default /bin/bash). WebSocket PTY session. */}++## `oc checkpoint`++{/* Alias: oc cp */}++### `oc checkpoint create <sandbox-id> --name <name>`++### `oc checkpoint list <sandbox-id>`++### `oc checkpoint restore <sandbox-id> <checkpoint-id>`++### `oc checkpoint spawn <checkpoint-id>`++{/* Flags: --timeout */}++### `oc checkpoint delete <sandbox-id> <checkpoint-id>`++## `oc patch`++### `oc patch create <checkpoint-id>`++{/* Flags: --script (file or - for stdin), --description */}++### `oc patch list <checkpoint-id>`++### `oc patch delete <checkpoint-id> <patch-id>`++## `oc preview`++### `oc preview create <sandbox-id>`++{/* Flags: --port (required), --domain */}++### `oc preview list <sandbox-id>`++### `oc preview delete <sandbox-id> <port>`++## `oc config`++### `oc config set <key> <value>`++{/* Keys: api-key, api-url */}++### `oc config show`diff --git a/docs/sandboxes/checkpoints.mdx b/docs/sandboxes/checkpoints.mdxindex 009e747c..61a6f4e7 100644--- a/docs/sandboxes/checkpoints.mdx+++ b/docs/sandboxes/checkpoints.mdx@@ -67,3 +67,7 @@ description: "Snapshot and fork sandbox state"## Examples{/* Checkpoint before risky operation. Fork for parallel exploration (try 5 approaches from same state). */}++<Tip>+ CLI equivalent: [`oc checkpoint`](/cli/checkpoint). Full reference: [TypeScript SDK](/reference/typescript-sdk#sandbox) · [Python SDK](/reference/python-sdk#sandbox) · [HTTP API](/reference/api#checkpoints).+</Tip>diff --git a/docs/sandboxes/interactive-terminals.mdx b/docs/sandboxes/interactive-terminals.mdxindex 41ccbf0e..e36082b4 100644--- a/docs/sandboxes/interactive-terminals.mdx+++ b/docs/sandboxes/interactive-terminals.mdx@@ -49,3 +49,7 @@ description: "Full PTY sessions inside sandboxes"## CLI{/* oc shell <sandbox-id> — opens interactive terminal. Supports --shell flag (default /bin/bash). */}++<Tip>+ CLI equivalent: [`oc shell`](/cli/shell). Full reference: [TypeScript SDK](/reference/typescript-sdk#pty) · [Python SDK](/reference/python-sdk#pty) · [HTTP API](/reference/api#pty).+</Tip>diff --git a/docs/sandboxes/overview.mdx b/docs/sandboxes/overview.mdxindex 190ebe5f..f8d210e6 100644--- a/docs/sandboxes/overview.mdx+++ b/docs/sandboxes/overview.mdx@@ -82,4 +82,8 @@ description: "The compute primitive — full Linux VMs in the cloud"## Related-{/* Links to: Agents overview (agents run inside sandboxes), Running Commands, Files, Terminals, Checkpoints, Templates */}+{/* Links to: Running Commands, Files, Terminals, Checkpoints, Templates, Agents overview (agents run inside sandboxes) */}++<Tip>+ CLI: [`oc sandbox`](/cli/sandbox) for lifecycle management. Full reference: [TypeScript SDK](/reference/typescript-sdk#sandbox) · [Python SDK](/reference/python-sdk#sandbox) · [HTTP API](/reference/api#sandbox-lifecycle).+</Tip>diff --git a/docs/sandboxes/patches.mdx b/docs/sandboxes/patches.mdxindex 20f30c14..7a292535 100644--- a/docs/sandboxes/patches.mdx+++ b/docs/sandboxes/patches.mdx@@ -54,3 +54,7 @@ description: "Scripts that run when forking from a checkpoint"## Example{/* Inject API keys at fork time. Update packages without rebuilding checkpoint. */}++<Tip>+ CLI equivalent: [`oc patch`](/cli/patch). Full reference: [TypeScript SDK](/reference/typescript-sdk#sandbox) · [Python SDK](/reference/python-sdk#sandbox) · [HTTP API](/reference/api#checkpoint-patches).+</Tip>diff --git a/docs/sandboxes/preview-urls.mdx b/docs/sandboxes/preview-urls.mdxindex dbc9023f..b0162791 100644--- a/docs/sandboxes/preview-urls.mdx+++ b/docs/sandboxes/preview-urls.mdx@@ -54,3 +54,7 @@ description: "Expose sandbox ports to the internet"## Examples{/* Share a dev server. Multiple ports. Custom domain. */}++<Tip>+ CLI equivalent: [`oc preview`](/cli/preview). Full reference: [TypeScript SDK](/reference/typescript-sdk#sandbox) · [Python SDK](/reference/python-sdk#sandbox) · [HTTP API](/reference/api#preview-urls).+</Tip>diff --git a/docs/sandboxes/running-commands.mdx b/docs/sandboxes/running-commands.mdxindex 489d7c7e..2e2cb6b0 100644--- a/docs/sandboxes/running-commands.mdx+++ b/docs/sandboxes/running-commands.mdx@@ -71,3 +71,7 @@ description: "Execute shell commands inside a sandbox"## Examples{/* Dev server (TS streaming), long-running process, reconnect pattern (TS only) */}++<Tip>+ CLI equivalent: [`oc exec`](/cli/exec). Full reference: [TypeScript SDK](/reference/typescript-sdk#exec) · [Python SDK](/reference/python-sdk#exec) · [HTTP API](/reference/api#commands-exec).+</Tip>diff --git a/docs/sandboxes/templates.mdx b/docs/sandboxes/templates.mdxindex 398bc33b..1567f613 100644--- a/docs/sandboxes/templates.mdx+++ b/docs/sandboxes/templates.mdx@@ -64,3 +64,7 @@ description: "Pre-built base images for sandboxes"## Example{/* Template with specific language/framework pre-installed (e.g., Node 20 + pnpm). */}++<Tip>+ Full reference: [TypeScript SDK](/reference/typescript-sdk#templates) · [Python SDK](/reference/python-sdk#template) · [HTTP API](/reference/api#templates).+</Tip>diff --git a/docs/sandboxes/working-with-files.mdx b/docs/sandboxes/working-with-files.mdxindex 421689ba..ff42c9b3 100644--- a/docs/sandboxes/working-with-files.mdx+++ b/docs/sandboxes/working-with-files.mdx@@ -44,3 +44,7 @@ description: "Read, write, and manage files inside a sandbox"## Examples{/* Upload & run a script. Copy files between paths. */}++<Tip>+ Full reference: [TypeScript SDK](/reference/typescript-sdk#filesystem) · [Python SDK](/reference/python-sdk#filesystem) · [HTTP API](/reference/api#filesystem).+</Tip>