CLI & configuration reference

Subcommands, options, and --json output shapes for the dsh-zen-remote CLI. The CLI communicates with the running plugin over a local 0600 IPC socket (~/.dsh/zen-remote-cli.sock).

Command table

Every command accepts --json (structured output) and --lang zh|en; -h/--help and -v/--version work everywhere. When running setup interactively without --lang or ZEN_REMOTE_LANG, a language picker runs first and switches all subsequent prompts immediately; TTY sessions support ↑/↓, Space, ←/→, and Enter keyboard controls, while scripts fail immediately on missing flags (pass all flags + --yes in CI). Positional arguments and named flags are interchangeable (peer join <uri> = --invite <uri>; client pair <url> = --host-url <url>).

CommandWhat it doesKey options
setupThree-step wizard: language → preflight → role → ingress / OAuth peer join--role host|client|peer, --profile p1,p2, --oauth|--oauth-browser|--oauth-device, --network <id>, --relay <id|auto>, --invite <uri>, --host-url <url>, --yes, --no-wait
statusFull local state: identity + per-role sections--json, --debug [outPath]
host device pairMint one device pairing code--device-role web|desktop-client, --json
host device listGateway device table--json
host device revokeRevoke one or all device pairings<id> or --all, --yes, --json
host ingress startStart an ingress path (four modes)--mode caddy|cloudflared|external|lan (--ingress synonym) plus per-mode flags (--domain, --cf-token, --email, --https-port, --public-url, --tunnel-id, --proxy)
host ingress stopStop managed ingress processes--yes, --json
host ingress verifyConnectivity self-check (three lights)--json
host ingress snippetPrint a reverse-proxy config snippet--proxy nginx|caddy|lucky
client pairPair with one Host[hostUrl], --code <8-digit>, --name <this machine>, --json
client unpairRemove a pairing<hostUrl|entryId> or --all, --yes, --json
client listPaired-host table--json
peer joinJoin via official OAuth (browser / SSH device code + edge probe) or invite link--oauth | --oauth-browser | --oauth-device, --network <id>, --relay <id|auto>, [inviteUri] or --invite <uri>, --name <this machine>, --yes, --no-wait, --json
peer statusPeers and connection paths at a glance--json
peer trustPin or update a peer’s identity fingerprint[nodeId], --json (TOFU confirmation)
peer leaveLeave the current network--yes, --json
Official OAuth session reuse & edge probing: completed OAuth tokens persist across runs so reopening setup/join jumps straight to network selection, creation, or sign-out; the CLI concurrently probes /edge/v1/ping on available relays and highlights the lowest-latency node (--relay <id|auto> skips the prompt).

Global options

OptionDescription
--jsonStructured output (schema below)
--lang zh|enOutput language
--yes / -ySkip confirmations (role switches, revocations)
--no-waitSubmit without waiting; commands wait for completion by default, so --no-wait reports submission rather than faking success
--socket <path>Select a specific IPC socket (multi-instance setups)
--wait <seconds>Maximum wait budget
--debug [outPath]Attach a sanitized diagnostic report (default file zen-remote-debug-<role>-<timestamp>.json)

status --json shape

With --debug an extra { ok, path, report } object is returned containing the full sanitized diagnostic. For other commands, --json echoes the operation result and affected entity (e.g. client pair returns the pairing entry; peer join returns admission state), or ok:false with a reason code on failure.

status --json
{
  "experimental": true,
  "role": "host | client | peer",
  "pluginVersion": "3.0.1",
  "pid": 12345,
  "serverName": "my-machine",
  // capability-gated sections appear as applicable:
  "host": { /* local gateway / wizard / shared sessions (present when ping.serves is true, in both role=host and role=peer) */ },
  "client": { "maxServers": 8, "servers": [ /* paired host rows */ ] },
  "peer":  { /* admission, discovery, connection paths (role=peer) */ }
}

Configuration precedence & common fields

Environment > DSH plugin row > ~/.dsh/lan-gate.config.json > defaults; fields that require a gateway or push restart reload automatically on the plugin row. General env vars use the LAN_GATE_ prefix (e.g. LAN_GATE_MAX_SERVERS), while push notification env vars use DSH_PUSH_ (e.g. DSH_PUSH_ENABLED, DSH_PUSH_SUMMARY, DSH_PUSH_TURN_END, DSH_PUSH_TOOL, DSH_PUSH_EVENTS, DSH_PUSH_DEBOUNCE_MS, DSH_PUSH_SESSION_NAME).

FieldDefaultPurpose
rolehostOperating mode: host, client, or peer
serverNameHostnameDisplay name (≤ 40 chars) for sidebar groups and pairing
port / host3088 / 127.0.0.1Gateway bind port and host (set 0.0.0.0 for LAN direct)
idleHours48Hours of inactivity before remote sharing auto-hibernates
autoShareNewSessionsfalseAutomatically share newly created host sessions
maxServers8Maximum paired hosts on Desktop Client (1–64, live reload)
pushEnabled / pushSummarytrue / falseMaster push switch and 120-char reply summary toggle