CLI Reference
The comp-hub CLI provides a set of commands to manage your local dev server. Multiple projects can run simultaneously, each with its own port.
The CLI is published with three binary names — comphub, ch and comp-hub — all pointing to the same program. Every command below works with any of them, e.g. ch status, comp-hub -p 8080.
Command Overview
| Command | Description |
|---|---|
comphub | Start dev server for the current project |
comphub status | View master status and all running projects |
comphub stop <hash> | Stop a specific project |
comphub stop --all | Stop all projects |
comphub kill | Shut down master process |
comphub fix | Fix common issues (stale runtime file, etc.) |
comphub — Start Server
Run in the project directory to start the dev server and preview components in the browser.
comphubOptions:
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--port | -p | number | 5478 | Service port |
--dir | -d | path | "./" | Resource directory relative path |
--log-level | -l | string | "error" | Log level: debug, info, warn, error |
| --version | -v | - | - | Show version | | --help | -h | - | - | Show help |
--portonly applies when no master process is running yet. If a master is already up, the CLI reuses it and prints a warning that-pis ignored; runcomphub killfirst if you really need a different port.
Examples:
# Start with default port
comphub
# Use a custom port
comphub -p 8080
# Specify directory
comphub -d ./srcAfter a successful start, you'll see the project info and access URL:
✓ comp-hub v0.44.11
██████╗ ██████╗ ███╗ ███╗ ██████╗ ██╗ ██╗ ██╗ ██╗ ██████╗
██╔════╝ ██╔═══██╗ ████╗ ████║ ██╔══██╗ ██║ ██║ ██║ ██║ ██╔══██╗
██║ ██║ ██║ ██╔████╔██║ ██████╔╝ ███████║ ██║ ██║ ██████╔╝
██║ ██║ ██║ ██║╚██╔╝██║ ██╔═══╝ ██╔══██║ ██║ ██║ ██╔══██╗
╚██████╗ ╚██████╔╝ ██║ ╚═╝ ██║ ██║ ██║ ██║ ╚██████╔╝ ██████╔╝
╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝
Version 0.44.11
Project D:\project\housing\vue2
Hash 94525912
Port 5478
URL http://localhost:5478/94525912/main/
─────────────────────────────────────────────
comphub status View all projects
comphub stop 94525912 Stop current project
comphub stop --all Stop all projects
comphub kill Shutdown masterOpen the URL in your browser to enter the platform.
Startup Behaviour
- Version check: before starting, the CLI asks the remote service whether the installed version is still allowed. If the current version is blocked, startup aborts with
comp-hub must be upgraded before it can start; runnpm install comp-hub@latest -gand start again. If a newer version is merely available, a notice is printed and startup continues. - Log streaming: after the banner, the CLI streams the MidwayJS logs of this project (SSE). Press
Ctrl+Cto stop — the project is deregistered from master automatically.
comphub status — View Status
See which projects are currently running.
comphub statusExample output:
● Master Status
Status ● running
Version 0.44.11
Uptime 2m
Projects 2
▸ Registered Projects (2):
────────────────────────────────────────────────────────
hash 94525912
path D:\project\housing\vue2
url http://localhost:5478/94525912/main/
────────────────────────────────────────────────────────
hash a3f82109
path D:\project\housing\vue3
url http://localhost:5478/a3f82109/main/
────────────────────────────────────────────────────────If no service is running:
✗ Master service is not runningcomphub stop — Stop Projects
Stop one or all running projects without affecting others.
# Stop a specific project (use status to find the hash)
comphub stop <hash>
# Stop all projects
comphub stop --allExamples:
# Stop project with hash 94525912
comphub stop 94525912
# Stop all projects at once
comphub stop --allcomphub kill — Shut Down All Services
Shut down all projects and services.
comphub killThis terminates the master process and all registered projects. Run comphub again to restart.
comphub fix — Fix Common Issues
Clean up stale runtime files and fix other common problems:
comphub fixThis is useful when:
- A previous shutdown left a stale process file that prevents a new startup
- You need to reset the local runtime state
Running Multiple Projects
You can run different projects at the same time:
# Terminal 1: Start project A
cd /path/to/project-a
comphub
# Terminal 2: Start project B
cd /path/to/project-b
comphub
# Check all running projects
comphub statusEach project gets its own port and is accessed via a different URL.