INNER CODE UNIT · Python
pick_dashboard_dist
CronusL-1141/AI-company · src/aiteam/api/app.py:42
def pick_dashboard_dist(project_root: Path, plugin_root: str = "", cache_base: Path | None = None) -> Path | None:
"""The Dashboard build to serve, or None.
1. ``$CLAUDE_PLUGIN_ROOT/dashboard-dist``: a marketplace install serves its own build.
2. A source checkout has two builds: ``dashboard/dist`` (a local build, never
tracked) and ``plugin/dashboard-dist`` (tracked, updated by every pull).
Of the complete ones the newer ``index.html`` wins. Fixed order let a local
build from days ago shadow the tracked one after an update, so the API
kept serving the old interface (task e873e445).
3. The marketplace cache.
"""
if plugin_root:
candidate = Path(plugin_root) / "dashboard-dist"
if candidate.is_dir() and (candidate / "index.html").exists():
return candidate
builds = [
candidate for candidate in (project_root / "dashboard" / "dist", project_root / "plugin" / "dashboard-dist")
if _complete_build(candidate)