Files
CIAgent 2c2f68e00e fix(hotfix): single-port unattended deploy — static-export UI on :8420, dev daemon + stop/log, state out of the repo
The public site (nextcraft.coreci.dev) 404s because HAProxy forwards the
domain to the ai-service alone and the web app was never reachable (only
:8420 is open). This makes ONE port serve BOTH surfaces:

- Web: `output: 'export'` static build (apps/web/out) with generateStaticParams
  for all 7 dynamic routes; NEXT_PUBLIC_AI_SERVICE_URL=self bakes relative
  same-origin fetches (engine-base-url "" base; engine-client already
  concatenates). No CORS, no mixed content, no Node web server in prod.
- API: optional AI_WEB_STATIC_DIR StaticFiles(html=True) mount AFTER all
  routers (API wins; / serves index.html; unknown paths serve the export's
  404.html with status 404; set-but-missing dir fails startup loudly).
  Default unset — dev/tests unchanged.
- CLI: `dev -d/--detach` (daemon; ~/.nextcraft/run/<clone-hash>/dev.{pid,log},
  refuses double-start, auto-wires AI_WEB_STATIC_DIR when out/ exists),
  `stop` (SIGTERM→SIGKILL 5s), `log` (-n N lines, -f follow). stdlib only.

Founder directives (this hotfix):
- unattended/daemonized dev with a tail command — dev -d / log / stop
- only 8420 reachable — single-port same-origin topology
- runtime state must NOT live in the repo — db_path default moves to
  ~/.nextcraft/data/nextcraft.db, sandbox_dir to ~/.nextcraft/sandboxes/;
  expanduser validator (AI_DB_PATH=~/... works); .env.example stops pinning
  repo paths; daemon pid/log also under ~/.nextcraft.

Test hygiene: conftest settings fixture pins stores to tmp_path (was silently
using repo defaults); sandbox tests use a bind-mount-safe sandbox_dir fixture
(overlayfs /tmp breaks userns bind mounts with ENODEV — home ext4 works).

Gates: typecheck 8/8; pnpm build emits out/ (all 73 pages static); web tests
5/5; cli tests green incl. real daemon lifecycle; backend 413 passed
(+4 static-mount tests); ruff clean.

---ci---
phase: hotfix
milestone: v0.4
status: complete
type: hotfix
---/ci---
2026-09-13 16:52:58 +00:00
..