Skip to main content

Command Structure

All commands support the standard options like --directory, --port, and --hostname. See Options for the complete list.

Default Command

When run without a command, OpenPortal starts both the OpenCode server and Web UI.

Examples

Output

Behavior

  • Checks if an instance is already running for the directory
  • If already running, displays instance information and URLs
  • Auto-selects available ports if defaults are taken
  • Stores instance configuration in ~/.portal.json
  • Starts both OpenCode server and Web UI

run

Start only the OpenCode server without the Web UI.

Use Cases

  • Running OpenCode as a backend API service
  • Connecting custom clients to OpenCode
  • Running in headless environments
  • Development and testing of OpenCode integrations

Examples

Output

Docker Mode Output

Behavior

  • Only starts the OpenCode server process or container
  • Does not start the Web UI
  • Instance port is set to null in configuration
  • Instance webPid is set to null in configuration

stop

Stop a running OpenPortal instance.

Selection Logic

  1. If --name is provided, stops the instance with that name
  2. If --directory or -d is provided, stops the instance in that directory
  3. Otherwise, stops the instance in the current directory

Examples

Output (Process Mode)

Output (Docker Mode)

Behavior

  • Sends SIGTERM to processes for graceful shutdown
  • For Docker containers, stops and removes the container (timeout: 10s)
  • Removes instance entry from ~/.portal.json
  • If process/container is already stopped, displays informational message
  • Exits with code 1 if no matching instance is found

list

List all running OpenPortal instances.
Alias: ls

Example Output

Status Values

  • running - Both OpenCode and Web UI are running
  • opencode - Only OpenCode server is running (from run command)
  • web only - Only Web UI is running (OpenCode stopped)
  • stopped - Neither component is running

Column Descriptions

  • ID - Unique instance identifier
  • NAME - Instance name (directory basename or custom name)
  • TYPE - Deployment mode (process or docker)
  • PORT - Web UI port (- if not applicable)
  • OPENCODE - OpenCode server port
  • STATUS - Current running status
  • DIRECTORY - Working directory path

Behavior

  • Checks actual process/container status for each instance
  • Automatically removes stale entries from configuration
  • Updates ~/.portal.json if stale entries are found
  • Shows “No OpenPortal instances running.” if no instances exist

clean

Remove stale instance entries from the configuration.

Use Cases

  • Clean up after processes crashed or were killed externally
  • Remove orphaned Docker containers
  • Reset configuration after manual process termination

Example Output

Behavior

  • Checks each instance in ~/.portal.json
  • Verifies if processes are running (process mode) or containers exist (docker mode)
  • For stale Docker instances, attempts to stop and remove containers
  • Removes entries for instances that are not running
  • Keeps entries for instances that are still active
  • Updates ~/.portal.json with cleaned configuration

Help

Display help information.
Short form:

Output


Common Command Patterns

Starting Multiple Instances

Docker Workflow

API Server Setup

Production-like Environment


Error Handling

Instance Already Running

No Instance Found (stop)

Unknown Command

Sensitive Directory Mount (Docker)