AnvilWiki template update log (v2.37.0): the CLI now speaks Chinese — apply-template asks your interface language on interactive runs (or pass --lang zh), while scripted/non-interactive runs stay byte-identical. The fifth full-project code review landed in the same release: 10 confirmed findings fixed — consent event/storage literals now pinned by a contract test (a one-sided rename silently killed ad loading), a silent shell-$ expansion in cover frontmatter splicing eliminated, dead code and duplicate truth-sources (order field, t(), llms.txt enum) removed. 24 suites / 390 tests. Forks: merge upstream and pnpm install as usual. This bar tracks template releases — details & full changelog on GitHub Releases.
AnvilWiki
Powered by Pagefind
中文
Lesson 4 Updated Sep 2, 2026

Verify Your Changes: The Checklist and the Gates

The post-change, pre-commit checklist: seven local commands, the eight CI gates, the six pipelines, and the safety and performance baselines.

Where you are, and what this lesson solves

Changing code is easy; proving you didn’t break anything is the craft. This lesson is the fixed post-change, pre-commit motion. A lookup lesson: read the section matching what you changed. With the previous lesson’s switches, the customization safety net is complete.

The local verification checklist (after every change, before every commit)

pnpm typecheck       # 0 errors (astro check)
pnpm lint            # 0 errors, 0 warnings
pnpm test            # vitest all green (pure functions live in lib/, testable)
pnpm build           # Zod schema validation + full site build
pnpm check-content   # content lint (when MDX changed)
pnpm check-links     # internal link audit (after build, always run)
pnpm check-i18n      # after adding locale JSON keys, check coverage

Two special cases: changed an .astro route file → build is mandatory (getStaticPaths errors only surface at build); changed a workflow YAML → verify it parses (python3 -c "import yaml; yaml.safe_load(open('<file>'))" — this template once broke on YAML indentation).

The eight CI gates (every push, on your behalf)

CI runs the full gate set on every push: lint → typecheck → test → check-config → build → check-content → check-links → check-i18n — one red blocks the merge. The cheapest local reproduction is running the checklist above.

Locating a red CI: open the failed job, read the last log line — the failing gate is named at the top of the log; reproduce locally with the same command, fix, push, CI reruns itself.

Six automatic pipelines (.github/workflows/)

Pipeline When What it guards
CI every push / PR The eight gates; one red blocks everything
Content freshness audit weekly (cron) Freshness audit, auto-opens issues for stale pages. Official repo only by default (forks stay silent by default, sparing you the noise); to enable: have AI delete the if: github.repository == line. It only reminds, never edits content
Initialize AnvilWiki manual Post-fork cleanup: resets wrangler.toml vars, removes the project page, optional demo clear. Does not swap game name / color / languages — those need local pnpm apply-template
Auto content PR manual The content pipeline: paste a CSV or codes list, deterministic generators draft the articles, all eight gates run before a draft PR opens — content always lands via PR, never direct to main
IndexNow after CI succeeds Submits the production sitemap’s URLs to search engines (IndexNow protocol, faster indexing); unconfigured forks exit with zero requests
Release anvilwiki-ops ops-v* tag push Publishes the tools/anvil-ops npm package (maintainer-facing), gated by a GitHub Environment approval

Safety baselines (built in — don’t dismantle)

  • Structured-data escaping: data cards for Google go through JsonLd.astro for character escaping — new data components reuse it, never hand-roll.
  • Sponsored links: the affiliate component auto-adds sponsored nofollow; outbound links get noopener.
  • No tracking before consent: until the cookie consent click, GA and AdSense genuinely never load.
  • Secrets stay out of the repo: everything sensitive is a variable; .env is gitignored.

Performance baselines (hold these when touching code)

  • Zero JS frameworks: no React/Vue runtimes; interactions use native browser capability plus minimal vanilla script.
  • Images go through the pipeline (auto WebP, mobile variants).
  • Score check: pnpm build && npx wrangler pages dev dist, then Lighthouse in the browser — four 100s is the out-of-box contract; don’t be the one who breaks it.

Stuck?

  • “Green locally, red on CI”: compare Node/pnpm versions (CI runs 22 LTS) and confirm the same commands ran.
  • “A test broke and I didn’t touch tests”: a pure function’s behavior changed; the test is the contract — fix the implementation, not the test.

✅ Acceptance (all must hold)

  • ☐ CI is green on your fork’s Actions page
  • ☐ You’ve run the seven local commands and know what each guards
  • ☐ New components reuse JsonLd.astro — no hand-rolled data

Next lesson

Self-verified changes merge safely. The template keeps shipping — next lesson: bringing official updates in safely. Sync Upstream