Skip to content

Commit 4787ec5

Browse files
committed
web: commit built frontend assets so cold-start from a clone works
The built SPA (src/pyclawd/web/static/) was gitignored and shipped only as a build-time hatch artifact — present on a release machine after npm run build, but absent from any fresh git clone. Installing '.[web]' from a checkout thus produced a wheel with no UI and 'pyclawd web serve' served a blank dashboard. Commit the built assets (rebuilt fresh), drop the now-redundant artifact globs, and warn in 'web serve' if the static dir is ever missing again. No Node needed downstream; rebuild + commit web/static after changing the frontend source.
1 parent abdf029 commit 4787ec5

6 files changed

Lines changed: 168 additions & 11 deletions

File tree

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,11 @@ __marimo__/
223223
# Claude Code agent worktrees (transient — never commit)
224224
.claude/worktrees/
225225

226-
# pyclawd web — built frontend assets (produced by `npm run build` in
227-
# src/pyclawd/web_frontend; shipped into the wheel via hatch artifacts, not git).
228-
src/pyclawd/web/static/
226+
# pyclawd web — the built frontend assets in src/pyclawd/web/static/ are
227+
# COMMITTED (not ignored) so a fresh `git clone` + `pip install '.[web]'` ships a
228+
# working dashboard with no Node toolchain required. Regenerate them with
229+
# `npm run build` in src/pyclawd/web_frontend after changing the frontend source.
230+
# Only the Node install dir is ignored.
229231
src/pyclawd/web_frontend/node_modules/
230232

231233
# Repo-root convenience symlink → src/pyclawd/skills (real tree is the package

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,24 @@ path = "src/pyclawd/__init__.py"
7272
# the default VCS file-walk: in this repo the walk silently dropped the
7373
# skills/pyclawd and skills/pyclawd-doctor subtrees, so we exclude skills from the
7474
# walk and force-include the whole tree deterministically. The BUILT web/static
75-
# frontend (gitignored) rides along as an artifact. (The repo-root `skills` symlink is
76-
# untracked — see .gitignore — so it cannot shadow the real package tree.)
75+
# frontend is now COMMITTED (see .gitignore), so the VCS walk picks it up on any
76+
# clone — no Node needed to build a complete wheel from a fresh checkout. (The
77+
# repo-root `skills` symlink is untracked — see .gitignore — so it cannot shadow the
78+
# real package tree.)
7779
[tool.hatch.build.targets.sdist]
7880
exclude = ["src/pyclawd/skills"]
79-
artifacts = ["src/pyclawd/web/static/**"]
8081

8182
[tool.hatch.build.targets.sdist.force-include]
8283
"src/pyclawd/skills" = "src/pyclawd/skills"
8384

8485
[tool.hatch.build.targets.wheel]
8586
packages = ["src/pyclawd"]
8687
include = ["src/pyclawd/py.typed"] # PEP 561 — ship the typed marker (we're a typed lib)
87-
# Ship the BUILT web frontend (gitignored, so listed as an artifact to override VCS
88-
# exclusion) and keep its SOURCE (the Vite/React project) OUT of the wheel — only
89-
# `pyclawd[web]` users need the static bundle, nobody needs the TS sources or Node.
88+
# The BUILT web frontend (src/pyclawd/web/static/) is committed, so the package walk
89+
# ships it automatically. Keep its SOURCE (the Vite/React project) OUT of the wheel —
90+
# only `pyclawd[web]` users need the static bundle, nobody needs the TS sources or Node.
9091
# Exclude skills from the package walk; it is force-included below (same reason as the
9192
# sdist — the VCS walk drops subtrees of it).
92-
artifacts = ["src/pyclawd/web/static/**"]
9393
exclude = ["src/pyclawd/web_frontend", "src/pyclawd/skills"]
9494

9595
# force-include ships, by literal filesystem copy (no VCS heuristics):

src/pyclawd/commands/web.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,17 @@ def serve(
7474
_require_web_stack()
7575
import uvicorn
7676

77-
from pyclawd.web.app import create_app
77+
from pyclawd.web.app import _STATIC_DIR, create_app
78+
79+
if not _STATIC_DIR.is_dir():
80+
typer.secho(
81+
"warning: the built frontend is missing — only the JSON API will be served, "
82+
"the dashboard UI will not load.\n"
83+
"In a source checkout, build it with: "
84+
"cd src/pyclawd/web_frontend && npm install && npm run build",
85+
fg="yellow",
86+
err=True,
87+
)
7888

7989
reg = _registry()
8090
default = None

src/pyclawd/web/static/assets/index-C9ezW9Ye.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pyclawd/web/static/assets/index-CQrkiI_I.js

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pyclawd/web/static/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>pyclawd web</title>
7+
<script type="module" crossorigin src="/assets/index-CQrkiI_I.js"></script>
8+
<link rel="stylesheet" crossorigin href="/assets/index-C9ezW9Ye.css">
9+
</head>
10+
<body>
11+
<div id="root"></div>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)