Skip to content

Latest commit

 

History

History
78 lines (54 loc) · 3.95 KB

File metadata and controls

78 lines (54 loc) · 3.95 KB

askclaw.dev

AskClaw 官网源码(Astro)。首页 = AMBER(琥珀式封存的历史回放评测)主站;/amber/ 重定向回首页。

The askclaw.dev site source (Astro). The homepage IS the AMBER site (sealed-replay evaluation); /amber/ redirects to /.

结构

  • src/ — Astro 页面与布局(首页、/method/、/rank/、/en/)
  • public/assets/ — 图(WebP,1400px 宽)
  • 运行时边界:内容页零 JS,/rank/ 有 3.5KB 内联交互脚本。
  • Runtime boundary: content pages ship zero JS; /rank/ has a 3.5KB inline interaction script.

老站(纯静态 index.html / en.html / assets/)不再放在本仓,真源在相邻 checkout(用 LEGACY_SITE_ROOT 指定);图的原图在 getaskclaw/amber 的 docs/images/。

榜单数据(/rank/)只从 amber.db 生成

  • src/data/axes.json 由 amber-run 的 tools/amberdb/sync_site.py --site <本仓> --write 从 amber.db 生成,同时写 src/data/axes.provenance.json(axes_sha256、生成它的 amber_run_commit)。不要手改 axes.json。
  • 每次 npm run build 都会核对 axes.json 的 sha256 和凭据一致,不一致就构建失败。
  • 发布前在 amber-run 侧跑 sync_site.py --site <本仓>(不带 --write),核对官网数据和 amber.db 当前生成结果逐字节相同。

The /rank/ data is generated from amber.db by amber-run tools/amberdb/sync_site.py; never edit src/data/axes.json by hand. The build fails if its sha256 differs from src/data/axes.provenance.json.

构建与两种 base

site 固定为 https://askclaw.dev;base 由 SITE_BASE 环境变量决定,默认 /(生产根)。两种 base 都要跑机检:

# 预览底(部署目标见运维手册(内部文档)):不索引,不生成 sitemap
# In the exact `&&` form below, each command is a new process, so the gate scripts also infer the
# already-built base from dist/index.html when SITE_BASE is not exported to the second command.
SITE_BASE=/astro-preview/ npm run build && npm run acceptance
SITE_BASE=/astro-preview/ npm run build && python3 scripts/verify-dist.py

# 生产底(默认,合并后真站产物):
npm run build && npm run acceptance
npm run build && python3 scripts/verify-dist.py
  • 机检脚本从 SITE_BASE / astro.config.mjs 推导 base 与期望 URL,不写死 /astro-preview/。
  • base != / 时:每页输出 <meta name="robots" content="noindex,nofollow">,robots.txt 为 Disallow: /,且不生成 sitemap。
  • base == / 时:不输出 robots meta,robots.txt 含 Sitemap:,sitemap 列出生产 URL。

机检依赖

两个脚本都要读图的原图(对比 WebP 与源 PNG)与手写英文页(对比 /en/ 镜像):

变量 默认值 用途
MIRROR_EN_SOURCE 本仓 public/en.html 手写英文页;/en/ 镜像对比的真源
LEGACY_SITE_ROOT ../askclaw.dev(相对本仓) 老站根;只用于四张未改动的图(trust-chain / effort / score-vs-tokens / wallclock)的原图
AXES_SOURCE 本仓 src/data/axes.json 轴数据真源
SITE_BASE / 构建 base,同时决定机检期望的 URL 前缀

在标准机器上无需设置(老站仓为相邻 checkout)。换机器或路径不同时显式指定:

MIRROR_EN_SOURCE=/path/to/checkout/public/en.html npm run acceptance
LEGACY_SITE_ROOT=/path/to/legacy-site npm run acceptance
LEGACY_SITE_ROOT=/path/to/legacy-site python3 scripts/verify-dist.py

部署(DEPLOY)

托管与 Caddy 配置:预览部署目标见运维手册(内部文档)。改配置前必备份,改后执行配置校验并 reload。

预览只动 astro-preview/ 子目录,线上根路径与老站不动:

cd <astro-site-checkout>
SITE_BASE=/astro-preview/ npm run build
rsync -a --delete dist/ <preview-deployment-target>/

联系 / Contact