# Urbicon UI design gate — fail the build when generated/edited markup drifts
# from the design rules. Copy into .github/workflows/, or merge the `design` job
# into an existing workflow. Requires @urbicon-ui/design in devDependencies.
#
# Using npm/pnpm + Node instead of Bun? Swap the setup-bun step for setup-node +
# your install, and `bunx` for `npx` — the `urbicon` bin is plain Node-runnable.
name: Design Gate

on:
  pull_request:
  push:
    branches: [main]

jobs:
  design:
    name: Design gate
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v2
      - run: bun install --frozen-lockfile
      # Correctness is the blocking gate — deterministic, false-positive free.
      # Add --craft-floor 40 to also gate the craft axis (a generic-looking page
      # fails below the floor); add --record to append a drift point to the
      # design.manifest.history.ndjson sidecar.
      - run: bunx urbicon validate src/ --json
      # i18n audit — gates on translation-parity errors + keys used in code but
      # missing from the bundles. Unused keys and hardcoded UI strings are
      # advisory (add --strict to gate them too). Loads .ts locale bundles, so it
      # needs Bun; point --translations at your bundle dir(s). Drop this step if
      # the project does not use @urbicon-ui/i18n.
      - run: bunx urbicon i18n audit src/ --translations src/lib/translations
