Skip to content

Custom Scripts

This project uses a collection of custom scripts to automate common tasks, enforce quality standards, and enhance the build process. Every script in package.json is listed here.

package.json groups its scripts into an Everyday section (what a cloner runs) and a Maintainer & advanced section (template upkeep), separated by inert "//1" / "//2" keys — see ADR-052. The everyday section is reproduced verbatim in the package scripts snippet. Most maintainer scripts are thin tsx wrappers around scripts/src/*.ts.

CommandDescription
predevRuns tokens:build automatically before dev (pnpm lifecycle hook)
devStart development server
dev:hostStart development server with network access
dev:debugStart development server with verbose logging
dev:agentStart the dev server in the background (astro dev --background) for coding agents — ADR-063
dev:agent:stopStop the background dev server (astro dev stop)
previewServe the already-built dist/ locally (run build first)
preview:buildBuild, then serve dist/ locally (convenience alias)
cleanRemove build artifacts (dist, .astro, tokens/dist)
clean:allclean plus node_modules/.cache
CommandDescription
buildenv:validate → tokens:build → astro build
build:ciSame chain as build, with astro build --verbose
tokens:buildCompile design tokens to tokens/dist/tokens.css and tokens/dist/tailwind-tokens.json
env:validateReject placeholder values in SITE_URL before a production build (ADR-050)
CommandDescription
formatFormat code with Biome
format:checkCheck code formatting without changes
lintLint code with Biome (biome check .)
lint:mdLint Markdown files (pure check)
lint:md:fixLint Markdown files and apply fixes
checkRun Astro type checking (astro check, with a local SITE_URL default)
check:typesRun TypeScript type checking only (tsc --noEmit)
qualityLocal quality pass: format + lint + lint:md + check
quality:ciThe full CI quality gate: format:check + lint + lint:md + check + test:unit + agents:check + version:check + og:check + adr:check + docs:count + docs:snippets + enforce
CommandDescription
testRun unit tests with Vitest in watch mode
test:unitRun unit tests once (also runs in the pre-push hook)
test:coverageRun unit tests once with coverage (thresholds in vitest.config.ts)
test:mutateRun Stryker mutation testing against the unit suite
test:e2eRun Playwright end-to-end tests
test:e2e:uiRun E2E tests with the Playwright UI
test:a11yRun the @a11y-tagged Playwright tests

See Testing Conventions for how to write tests in this repo.

CommandDescription
agents:buildRegenerate AGENTS.md from the layered constitution files in .claude/
agents:checkFail if AGENTS.md differs from the regenerated output (CI gate)
enforceRun the ADR enforcement suite from checks/enforcement.config.json and report BLOCKER / WARNING / PASS / DELEGATED (ADR-064)
CommandDescription
adr:indexRegenerate the ADR index table in docs/adr/README.md from the records and the enforcement registry (ADR-066)
adr:checkFail if that index is stale (CI gate)
docs:countVerify exact counts the docs render (the ADR index’s record count) match the filesystem (CI gate)
docs:snippetsVerify docs/snippets/*.md still match the files they reproduce (CI gate)
version:checkVerify the README footer version and versions.json pins match package.json (CI gate)
version:fixRewrite the drifted values that version:check reports
roadmap:updateSync the roadmap checklist in docs/README.md from the implementation guides

Documentation syncing to the docs site is pulled from that site’s repository (its update:adrs and update:versions scripts), not pushed from this project — see ADR-059.

CommandDescription
og:buildRegenerate the raster brand assets (OG images, apple-touch-icon, favicon.ico) from their source SVGs
og:checkFail if the committed rasters differ from a fresh regeneration (CI gate)
CommandDescription
images:analyzeAnalyze image sizes and optimization opportunities
images:gateEnforce the per-image size budget (CI gate)
images:optimizeInteractive image optimization tool
fonts:gateEnforce the per-page font-preload cap (CI gate)
bundle:analyzeBuild, then analyze bundle size and composition
perf:budgetsCheck the built output against the defined performance budgets
perf:baselineRecord a Lighthouse baseline for regression comparison
perf:lighthouseRun a Lighthouse audit against the local server (HTML report)
perf:lighthouse:ciRun Lighthouse headless for CI (JSON report)
perf:lhciRun Lighthouse CI (lhci autorun)

Budgets and their enforcement are described in Budgets & Guardrails.

CommandDescription
design:validateValidate color contrast compliance (WCAG AA) for the semantic token pairs
budgets:validateFail if any entry in budget-overrides.json has expired
CommandDescription
auditRun pnpm audit on production dependencies
audit:ciRun the audit with the allowlist filter for CI
CommandDescription
release:changelogGenerate CHANGELOG.md from conventional commits (changelogen)
release:changelog:dryPreview the changelog without writing it
CommandDescription
prepareInstall Husky git hooks (runs automatically on pnpm install)

The hook files themselves are in the git hooks snippet.