From d3182fded7f00e7b86203c763effe6b81f1eea4d Mon Sep 17 00:00:00 2001 From: Seungpyo1007 Date: Wed, 24 Jun 2026 03:12:38 +0900 Subject: [PATCH] feat(site): add a Verification section to the homepage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Surfaces the verification layer the dataset now ships with. A new "05 — Verification" section shows a live snapshot — the verified ratio (currently ~9.8%) and the green/yellow/red band distribution — alongside a short T0–T3 explainer (offline trust score → source liveness → Wikidata cross-reference → reality-based promotion). The snapshot is exposed at build time: build-verification.mjs copies a trimmed view of data/_verify/status.json into site/public/v1/verification.json (build-only, gitignored). The page reads that one static file. Adds a "verified" nav link and a backward-compatible decimals/suffix option to countUp. Refs #1 --- .gitignore | 3 +- site/package.json | 3 +- site/scripts/build-verification.mjs | 41 +++++++++++++++++++++ site/src/pages/index.astro | 42 +++++++++++++++++++++ site/src/scripts/techapi.js | 57 ++++++++++++++++++++++++++++- site/src/styles/techapi.css | 36 ++++++++++++++++++ 6 files changed, 178 insertions(+), 4 deletions(-) create mode 100644 site/scripts/build-verification.mjs diff --git a/.gitignore b/.gitignore index 63b0dd0c73c..ec909d7c94d 100644 --- a/.gitignore +++ b/.gitignore @@ -31,8 +31,9 @@ env/ # Note: data/_staging/ (raw collected candidate pool) is intentionally tracked — # comprehensive data collection is a purpose of this repo. -# Build-only: regenerated from full git history on every Pages deploy (site/scripts/build-history.mjs) +# Build-only: regenerated on every Pages deploy (site/scripts/build-*.mjs) site/public/v1/history.json +site/public/v1/verification.json # Testing / coverage .pytest_cache/ diff --git a/site/package.json b/site/package.json index 45c7e9e020b..317c5216ba1 100644 --- a/site/package.json +++ b/site/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "astro dev", "build:history": "node scripts/build-history.mjs", - "prebuild": "node scripts/build-history.mjs", + "build:verification": "node scripts/build-verification.mjs", + "prebuild": "node scripts/build-history.mjs && node scripts/build-verification.mjs", "build": "astro build", "preview": "astro preview" }, diff --git a/site/scripts/build-verification.mjs b/site/scripts/build-verification.mjs new file mode 100644 index 00000000000..1a49e327620 --- /dev/null +++ b/site/scripts/build-verification.mjs @@ -0,0 +1,41 @@ +// Expose the verification snapshot to the homepage at build time. +// +// The verification aggregate lives at data/_verify/status.json (kept in sync by +// TechEngine's verify-status workflow). The site only serves site/public/v1/**, +// so we copy a trimmed, render-ready view into site/public/v1/verification.json +// during the Pages build. Build-only + gitignored: always reflects the committed +// status.json, never hand-edited, no extra churn in data PRs. + +import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const SITE_DIR = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const REPO_ROOT = resolve(SITE_DIR, ".."); +const SRC = resolve(REPO_ROOT, "data/_verify/status.json"); +const OUT = resolve(SITE_DIR, "public/v1/verification.json"); + +function main() { + let status = null; + try { + status = JSON.parse(readFileSync(SRC, "utf8")); + } catch (err) { + console.warn(`[build-verification] status.json unavailable: ${err.message}`); + } + + const out = status + ? { + generated_at: status.generated_at || null, + schema: 1, + totals: status.totals || {}, + by_category: status.by_category || {}, + } + : { generated_at: null, schema: 1, totals: {}, by_category: {} }; + + mkdirSync(dirname(OUT), { recursive: true }); + writeFileSync(OUT, JSON.stringify(out, null, 2)); + const v = out.totals.verified_pct; + console.log(`[build-verification] wrote ${OUT}${v != null ? ` (verified ${v}%)` : " (empty)"}`); +} + +main(); diff --git a/site/src/pages/index.astro b/site/src/pages/index.astro index e926020086f..d8499d8b878 100644 --- a/site/src/pages/index.astro +++ b/site/src/pages/index.astro @@ -54,6 +54,7 @@ const endpoints = [ History Playground devices + verified endpoints docs