#!/usr/bin/env bash # # Material Design 3 conformance audit. # # Regenerates every count quoted in docs/material-design-conformance.md. The plan # in that document has acceptance criteria per phase; this is what checks them. # # Usage: # docs/scripts/m3-audit.sh report, always exit 0 # docs/scripts/m3-audit.sh --check report, exit 1 if any budget is exceeded # # The budgets at the top are the state of the tree at the phase named beside each # one. They ratchet down as phases land: lower the number in the same commit that # earns it, never raise one. Phase 8 wires --check into CI, at which point raising # a budget is what a reviewer looks for. set -uo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1 UI=composeApp/src/commonMain/kotlin/press/mantra/compose/ui THEME="$UI/theme" # --------------------------------------------------------------------------- # Budgets. "-1" means not yet budgeted -- reported, but never fails --check. # --------------------------------------------------------------------------- BUDGET_HARDCODED_COLOR=0 # phase 3: reached 2026-09-08 BUDGET_SPACING_LITERALS=0 # phase 2: reached 2026-09-08 BUDGET_BARE_CLICKABLE=0 # phase 3: reached 2026-09-08 BUDGET_NULL_DESCRIPTION=0 # phase 3: reached 2026-09-08 BUDGET_STRING_LITERALS=-1 # phase 4 drives to <10 BUDGET_TITLE_CASE=0 # phase 4: reached 2026-09-08 BUDGET_UNSET_COLOR_ROLES=0 # phase 1: reached 2026-09-07 # A floor rather than a ceiling: --check fails when the count drops *below* it. The # adaptive work is the one thing in this document that a later edit removes rather # than adds -- a screen that stops reading the breakpoint still compiles and still # renders -- so the budget that protects it has to point the other way. FLOOR_ADAPTIVE_APIS=12 # phase 6: reached 2026-09-08 FLOOR_NAVIGATION_COMPONENTS=2 # phase 6: reached 2026-09-08 fail_count=0 hdr() { printf '\n\033[1m== %s\033[0m\n' "$1"; } note() { printf ' %s\n' "$1"; } # floor