# OpenShell CLI Reference Quick-reference for the `openshell` command-line interface. For workflow guidance, see [SKILL.md](SKILL.md). > **Self-teaching**: If a command or flag is not listed here, use `openshell --help` to discover it. The CLI has comprehensive built-in help at every level. ## Global Options | Flag | Description | |------|-------------| | `-v`, `--verbose` | Increase verbosity (`-v` = info, `-vv` = debug, `-vvv` = trace) | | `-g`, `--gateway ` | Gateway to operate on. Also settable via `OPENSHELL_GATEWAY` env var. Falls back to active gateway in `~/.config/openshell/active_gateway`. | ## Environment Variables | Variable | Description | |----------|-------------| | `OPENSHELL_GATEWAY` | Override active gateway name (same as `--gateway`) | | `OPENSHELL_SANDBOX_POLICY` | Path to default sandbox policy YAML (fallback when `--policy` is not provided) | --- ## Complete Command Tree ``` openshell ├── gateway │ ├── start [opts] │ ├── stop [opts] │ ├── destroy [opts] │ ├── info [--name] │ └── select [name] ├── status ├── inference │ ├── set --provider --model │ ├── update [--provider] [--model] │ └── get ├── sandbox │ ├── create [opts] [-- CMD...] │ ├── get │ ├── list [opts] │ ├── delete ... │ ├── connect │ ├── upload [dest] │ ├── download [dest] │ ├── ssh-config │ └── image │ └── push [opts] ├── forward │ ├── start [-d] │ ├── stop │ └── list ├── logs [opts] ├── policy │ ├── set --policy [--wait] │ ├── get [--full] │ └── list ├── provider │ ├── create --name --type [opts] │ ├── get │ ├── list [opts] │ ├── update --type [opts] │ └── delete ... ├── doctor │ ├── logs [--name] [-n] [--tail] [--remote] [--ssh-key] │ └── exec [--name] [--remote] [--ssh-key] -- ├── term ├── completions └── ssh-proxy [opts] ``` --- ## Gateway Commands ### `openshell gateway start` Provision or start a cluster (local or remote). | Flag | Default | Description | |------|---------|-------------| | `--name ` | `openshell` | Cluster name | | `--remote ` | none | SSH destination for remote deployment | | `--ssh-key ` | none | SSH private key for remote deployment | | `--port ` | 8080 | Host port mapped to gateway | | `--gateway-host ` | none | Override gateway host in metadata | | `--recreate` | false | Destroy and recreate from scratch if a gateway already exists (skips interactive prompt) | ### `openshell gateway stop` Stop a cluster (preserves state for later restart). | Flag | Description | |------|-------------| | `--name ` | Cluster name (defaults to active) | | `--remote ` | SSH destination | | `--ssh-key ` | SSH private key | ### `openshell gateway destroy` Destroy a cluster and all its state. Same flags as `stop`. ### `openshell gateway info` Show deployment details: endpoint and remote host. | Flag | Description | |------|-------------| | `--name ` | Cluster name (defaults to active) | ### `openshell gateway select [name]` Set the active gateway. Writes to `~/.config/openshell/active_gateway`. When called without arguments, lists all provisioned gateways with the active one marked with `*`. --- ## Doctor Commands ### `openshell doctor logs` Fetch logs from the gateway Docker container. | Flag | Default | Description | |------|---------|-------------| | `--name ` | active gateway | Gateway name | | `-n, --lines ` | all | Number of log lines to return | | `--tail` | false | Stream live logs (follow mode) | | `--remote ` | auto-resolved | SSH destination for remote gateways | | `--ssh-key ` | none | SSH private key for remote gateways | ### `openshell doctor exec -- ` Run a command inside the gateway container with KUBECONFIG pre-configured. Launches an interactive `docker exec` session (tunnelled over SSH for remote gateways). | Flag | Default | Description | |------|---------|-------------| | `--name ` | active gateway | Gateway name | | `--remote ` | auto-resolved | SSH destination for remote gateways | | `--ssh-key ` | none | SSH private key for remote gateways | Examples: - `openshell doctor exec -- kubectl get pods -A` - `openshell doctor exec -- k9s` - `openshell doctor exec -- sh` (interactive shell) --- ## Status Command ### `openshell status` Show server connectivity and version for the active gateway. --- ## Sandbox Commands ### `openshell sandbox create [OPTIONS] [-- COMMAND...]` Create a sandbox, wait for readiness, then connect or execute the trailing command. Auto-bootstraps a cluster if none exists. | Flag | Description | |------|-------------| | `--name ` | Sandbox name (auto-generated if omitted) | | `--from ` | Sandbox source: community name, Dockerfile path, directory, or image reference (BYOC) | | `--upload [:]` | Upload local files into sandbox (default dest: `/sandbox`) | | `--no-keep` | Delete sandbox after the initial command or shell exits | | `--provider ` | Provider to attach (repeatable) | | `--policy ` | Path to custom policy YAML | | `--forward ` | Forward local port to sandbox (keeps the sandbox alive) | | `--remote ` | SSH destination for auto-bootstrap | | `--ssh-key ` | SSH private key for auto-bootstrap | | `--tty` | Force pseudo-terminal allocation | | `--no-tty` | Disable pseudo-terminal allocation | | `--bootstrap` | Auto-bootstrap a gateway if none is available (skips interactive prompt) | | `--no-bootstrap` | Never auto-bootstrap; error immediately if no gateway is available | | `--auto-providers` | Auto-create missing providers from local credentials (skips interactive prompt) | | `--no-auto-providers` | Never auto-create providers; skip missing providers silently | | `[-- COMMAND...]` | Command to execute (defaults to interactive shell) | ### `openshell sandbox get ` Show sandbox details (id, name, namespace, phase, policy). ### `openshell sandbox list` List sandboxes in a table. | Flag | Default | Description | |------|---------|-------------| | `--limit ` | 100 | Max sandboxes to return | | `--offset ` | 0 | Pagination offset | | `--ids` | false | Print only sandbox IDs | | `--names` | false | Print only sandbox names | ### `openshell sandbox delete ...` Delete one or more sandboxes by name. Stops any background port forwards. ### `openshell sandbox connect ` Open an interactive SSH shell to a sandbox. ### `openshell sandbox upload [dest]` Upload local files to a sandbox using tar-over-SSH. | Argument | Default | Description | |----------|---------|-------------| | `` | -- | Sandbox name (required) | | `` | -- | Local path to upload (required) | | `[dest]` | `/sandbox` | Destination path in sandbox | ### `openshell sandbox download [dest]` Download files from a sandbox using tar-over-SSH. | Argument | Default | Description | |----------|---------|-------------| | `` | -- | Sandbox name (required) | | `` | -- | Sandbox path to download (required) | | `[dest]` | `.` | Local destination path | ### `openshell sandbox ssh-config ` Print an SSH config `Host` block for a sandbox. Useful for VS Code Remote-SSH. --- ## Port Forwarding Commands ### `openshell forward start ` Start forwarding a local port to a sandbox. | Flag | Description | |------|-------------| | `` | Port number (used as both local and remote) | | `` | Sandbox name | | `-d`, `--background` | Run in background | ### `openshell forward stop ` Stop a background port forward. ### `openshell forward list` List all active port forwards (sandbox, port, PID, status). --- ## Logs Command ### `openshell logs ` View sandbox logs. Supports one-shot and streaming. | Flag | Default | Description | |------|---------|-------------| | `-n ` | 200 | Number of log lines | | `--tail` | false | Stream live logs | | `--since ` | none | Only show logs from this duration ago (e.g., `5m`, `1h`) | | `--source ` | `all` | Filter: `gateway`, `sandbox`, or `all` (repeatable) | | `--level ` | none | Minimum level: `error`, `warn`, `info`, `debug`, `trace` | --- ## Policy Commands ### `openshell policy set --policy ` Update the policy on a live sandbox. Only dynamic fields (`network_policies`, `inference`) can be changed at runtime. | Flag | Default | Description | |------|---------|-------------| | `--policy ` | -- | Path to policy YAML (required) | | `--wait` | false | Wait for sandbox to confirm policy is loaded | | `--timeout ` | 60 | Timeout for `--wait` | Exit codes with `--wait`: 0 = loaded, 1 = failed, 124 = timeout. ### `openshell policy get ` Show current active policy for a sandbox. | Flag | Default | Description | |------|---------|-------------| | `--rev ` | 0 (latest) | Show a specific revision | | `--full` | false | Print the full policy as YAML (round-trips with `--policy` input) | ### `openshell policy list ` List policy revision history (version, hash, status, created, error). | Flag | Default | Description | |------|---------|-------------| | `--limit ` | 20 | Max revisions to return | --- ## Provider Commands Supported provider types: `claude`, `opencode`, `codex`, `generic`, `nvidia`, `gitlab`, `github`, `outlook`. ### `openshell provider create --name --type ` Create a provider configuration. | Flag | Description | |------|-------------| | `--name ` | Provider name (required) | | `--type ` | Provider type (required) | | `--from-existing` | Load credentials from local state (mutually exclusive with `--credential`) | | `--credential KEY[=VALUE]` | Credential pair. Bare `KEY` reads from env var. Repeatable. | | `--config KEY=VALUE` | Config key/value pair. Repeatable. | ### `openshell provider get ` Show provider details (id, name, type, credential keys, config keys). ### `openshell provider list` List providers in a table. | Flag | Default | Description | |------|---------|-------------| | `--limit ` | 100 | Max providers | | `--offset ` | 0 | Pagination offset | | `--names` | false | Print only names | ### `openshell provider update --type ` Update an existing provider. Same flags as `create`. ### `openshell provider delete ...` Delete one or more providers by name. --- ## Inference Commands ### `openshell inference set` Configure the managed gateway inference route used by `inference.local`. Both flags are required. | Flag | Default | Description | |------|---------|-------------| | `--provider ` | -- | Provider record name (required) | | `--model ` | -- | Model identifier to use for generation requests (required) | ### `openshell inference update` Partially update the gateway inference configuration. Fetches the current config and applies only the provided overrides. At least one flag is required. | Flag | Default | Description | |------|---------|-------------| | `--provider ` | unchanged | Provider record name | | `--model ` | unchanged | Model identifier | ### `openshell inference get` Show the current gateway inference configuration. --- ## Other Commands ### `openshell term` Launch the OpenShell interactive TUI. ### `openshell completions ` Generate shell completion scripts. Supported shells: `bash`, `fish`, `zsh`, `powershell`. ### `openshell ssh-proxy` SSH proxy used as a `ProxyCommand`. Not typically invoked directly.