#!/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=9 # phase 3 drives to 0 outside theme/ BUDGET_SPACING_LITERALS=0 # phase 2: reached 2026-09-08 BUDGET_BARE_CLICKABLE=33 # phase 3 drives to 0 BUDGET_NULL_DESCRIPTION=18 # phase 3 triages each one BUDGET_STRING_LITERALS=-1 # phase 4 drives to <10 BUDGET_TITLE_CASE=-1 # phase 4 drives to 0 BUDGET_UNSET_COLOR_ROLES=0 # phase 1: reached 2026-09-07 fail_count=0 hdr() { printf '\n\033[1m== %s\033[0m\n' "$1"; } note() { printf ' %s\n' "$1"; } # report