Command Structure
--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
portis set tonullin configuration - Instance
webPidis set tonullin configuration
stop
Stop a running OpenPortal instance.Selection Logic
- If
--nameis provided, stops the instance with that name - If
--directoryor-dis provided, stops the instance in that directory - Otherwise, stops the instance in the current directory
Examples
Output (Process Mode)
Output (Docker Mode)
Behavior
- Sends
SIGTERMto 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.ls
Example Output
Status Values
running- Both OpenCode and Web UI are runningopencode- Only OpenCode server is running (fromruncommand)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 (
processordocker) - 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.jsonif 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.jsonwith cleaned configuration