From a1b3fef1aca81377d6705550403159260dcad5ab Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 11 Nov 2026 01:10:48 +0100 Subject: [PATCH] fix(web): byt ut platshallarsidan mot en riktig C0PY-konsol c0py.siax.io och c0py-web.siax.io renderade bokstavligen
c0py
(4 tecken synlig text) - rotsidan var en platshallare i repot, inte ett driftfel. Headless-matning 2026-11-11 fran server11: HTTP 200, tom title, textLen=4, 0 lankar, 0 knappar. Rotsidan renderar nu riktigt innehall grundat i repots egna fakta: * produktidentitet och syfte ur README.md, * LIVE API-status last server-side ur API:ets egen publika /health (status, CL0UD-bindning, API-tid, lastid) - och en uttrycklig "kunde inte lasas"-text nar API:et inte svarar, aldrig en pahittad status, * den faktiska API-ytan (/health publik, /v1/c0py/registries|scans bearer) enligt apps/api/src, * den kanoniska pipelinen ur README/MASTERPLAN. Dessutom: * /api/health for c0py-web (status, commit, apiBaseUrl) - samma monster som ovriga SIAX-produkter; Dockerfile.web skriver commit till /app/.c0py-commit och HEALTHCHECK pekar nu pa /api/health i stallet for /, * app/icon.svg - c0py-surfacen gav 404 pa /favicon.ico vid varje sidladdning, * 7 enhetstester for statuslasningen (inkl. att fel och timeout INTE rapporteras som ok) ersatter noop-testet. SIAX-design: Inter, blacksvart rubrik #15151B, violett sidkant #5326CC, morkt identitetsfalt. Inga nya beroenden (lockfilen oforandrad), inga lokala DES1GN-primitivnamn exporteras. Verifierat lokalt: validate:architecture OK, typecheck OK, 7/7 webbtester, next build OK, next start ger 1475 tecken synlig text och /api/health 200 med live API-status (HTTP 200, status ok, cl0ud disabled). Co-Authored-By: Claude Opus 5 --- Dockerfile.web | 5 +- apps/web/src/app/api/health/route.ts | 29 ++++++ apps/web/src/app/icon.svg | 5 + apps/web/src/app/layout.tsx | 43 ++++++++- apps/web/src/app/page.tsx | 136 ++++++++++++++++++++++++++- apps/web/src/lib/api-status.ts | 86 +++++++++++++++++ apps/web/tests/api-status.test.ts | 70 ++++++++++++++ apps/web/tests/noop.test.ts | 7 -- 8 files changed, 368 insertions(+), 13 deletions(-) create mode 100644 apps/web/src/app/api/health/route.ts create mode 100644 apps/web/src/app/icon.svg create mode 100644 apps/web/src/lib/api-status.ts create mode 100644 apps/web/tests/api-status.test.ts delete mode 100644 apps/web/tests/noop.test.ts diff --git a/Dockerfile.web b/Dockerfile.web index d574ea9..e26dfa5 100644 --- a/Dockerfile.web +++ b/Dockerfile.web @@ -13,7 +13,8 @@ RUN apk add --no-cache git wget \ && corepack enable \ && corepack prepare pnpm@9.15.9 --activate -RUN git clone --depth 1 --branch "${C0PY_REF}" "${C0PY_REPO}" /app +RUN git clone --depth 1 --branch "${C0PY_REF}" "${C0PY_REPO}" /app \ + && git -C /app rev-parse HEAD > /app/.c0py-commit WORKDIR /app @@ -28,6 +29,6 @@ ENV NEXT_TELEMETRY_DISABLED=1 EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ - CMD wget -qO- http://127.0.0.1:3000/ >/dev/null 2>&1 || exit 1 + CMD wget -qO- http://127.0.0.1:3000/api/health >/dev/null 2>&1 || exit 1 CMD ["pnpm", "--filter", "@siax/c0py-web", "start"] diff --git a/apps/web/src/app/api/health/route.ts b/apps/web/src/app/api/health/route.ts new file mode 100644 index 0000000..b3a6f3c --- /dev/null +++ b/apps/web/src/app/api/health/route.ts @@ -0,0 +1,29 @@ +import { readFileSync } from "node:fs"; +import { apiBaseUrl } from "../../../lib/api-status"; + +/** Build commit, written by Dockerfile.web into .c0py-commit at image build time. */ +function commit(): string { + const fromEnv = process.env.C0PY_WEB_COMMIT?.trim(); + if (fromEnv) return fromEnv; + for (const path of [".c0py-commit", "/app/.c0py-commit"]) { + try { + const value = readFileSync(path, "utf8").trim(); + if (value) return value; + } catch { + /* not present in this environment */ + } + } + return "unknown"; +} + +export const dynamic = "force-dynamic"; + +export function GET() { + return Response.json({ + status: "ok", + service: "c0py-web", + commit: commit(), + apiBaseUrl: apiBaseUrl(), + time: new Date().toISOString(), + }); +} diff --git a/apps/web/src/app/icon.svg b/apps/web/src/app/icon.svg new file mode 100644 index 0000000..871dd47 --- /dev/null +++ b/apps/web/src/app/icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 167de53..9f14b75 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -1,3 +1,44 @@ +import type { Metadata } from "next"; + +export const metadata: Metadata = { + title: "C0PY — evidence-driven capture console", + description: + "C0PY is the canonical SIAX engine for evidence-driven web product capture, digital-twin specification, reconstruction and verification.", +}; + +const globalCss = ` + :root { + --c0py-ink: #15151b; + --c0py-accent: #5326cc; + --c0py-paper: #ffffff; + --c0py-muted: #5b5b66; + --c0py-line: #e4e4ec; + --c0py-band: #15151b; + --c0py-ok: #1b7f4f; + --c0py-warn: #96591a; + } + * { box-sizing: border-box; } + html, body { margin: 0; padding: 0; } + body { + background: var(--c0py-paper); + color: var(--c0py-ink); + font-family: Inter, "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; + font-size: 16px; + line-height: 1.55; + -webkit-font-smoothing: antialiased; + } + h1, h2, h3 { color: var(--c0py-ink); margin: 0; font-weight: 650; letter-spacing: -0.01em; } + a { color: var(--c0py-accent); } + code, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875em; } +`; + export default function RootLayout({ children }: { children: React.ReactNode }) { - return {children}; + return ( + + +