feat(server): add cloudcli service and per-service prebuild flag

Add a CloudCLI (claude-code-ui) service on port 3020, and a prebuild
flag so services backed by a global npm binary skip the Docusaurus-style
`npm run build` step before serve.
This commit is contained in:
Zhengshou Lai
2026-06-27 21:44:11 +08:00
parent fe4c280f7c
commit c8081889b9
+10 -1
View File
@@ -23,6 +23,7 @@ class Service:
project_dir: Optional[Path] = None
serve_cmd: Optional[list[str]] = None
dev_cmd: Optional[list[str]] = None
prebuild: bool = True # run `npm run build` before serve (Docusaurus-style)
@property
def manageable(self) -> bool:
@@ -69,6 +70,14 @@ KNOWN_SERVICES: list[Service] = [
serve_cmd=["npm", "run", "serve"],
dev_cmd=["npm", "run", "dev"],
),
Service(
"cloudcli",
serve_port=3020,
description="CloudCLI (claude-code-ui) web server",
project_dir=Path.home() / ".cloudcli",
serve_cmd=["cloudcli", "start", "--port", "3020"],
prebuild=False, # global npm binary, no project build step
),
]
_BY_NAME: dict[str, Service] = {s.name: s for s in KNOWN_SERVICES}
@@ -268,7 +277,7 @@ def server_start(name, dev, rebuild):
env = no_color_env()
if not dev:
if not dev and svc.prebuild:
build_dir = svc.project_dir / "build"
if rebuild or not build_dir.exists():
reason = "forced rebuild" if rebuild else "build directory missing"