Phase 2b: serve static frontends in place from repo dist

The Caddyfile generator now emits static-frontend routes that root directly at
<source>/<build.outputs[0]> (e.g. /data/repos/castle/app/dist) instead of a copy
under ~/.castle/artifacts/content. Removes _copy_app_static and the central
content-dir staging entirely; rebuilds are live without a copy step.

- caddyfile.py: manifest-driven static routes (castle-app at /, others at /<name>)
- ReactViteHandler.install just builds in place (no copy); uninstall is a no-op
- is_active(static frontend) = repo dist exists
- test isolation updated for the generator's config use

Dashboard + power-graph-app verified serving from repo dist; 168 tests pass.
This commit is contained in:
2026-06-13 18:16:09 -07:00
parent 2953aea548
commit 482524bfe5
6 changed files with 86 additions and 84 deletions

View File

@@ -15,7 +15,7 @@ import shutil
import subprocess
from pathlib import Path
from castle_core.config import CONTENT_DIR, CastleConfig
from castle_core.config import CastleConfig
from castle_core.generators.systemd import (
SYSTEMD_USER_DIR,
generate_timer,
@@ -68,7 +68,10 @@ def is_active(name: str, config: CastleConfig) -> bool:
if name in config.jobs:
return _systemctl_active(timer_name(name))
if _is_static_frontend(name, config):
return (CONTENT_DIR / name).is_dir()
comp = config.programs[name]
if comp.source and comp.build and comp.build.outputs:
return (Path(comp.source) / comp.build.outputs[0]).is_dir()
return False
comp = config.programs.get(name)
if comp is not None and comp.source:
return _on_path(name)