open-standards/.githooks/pre-commit
Transaction Science 60eab96364 ci: no-vanity-metrics scanner + pre-commit hook + CHARTER policy
Wires the no-vanity-metrics policy from prose-only into structural
enforcement. Without this, the next time a count creeps into a
README it stays there until I notice; with this, the PR fails.

What lands:

  - scripts/check-no-vanity-metrics.sh — bash scanner, dep-free,
    targets marketing/spec/governance Markdown only (per-phase
    progress docs, CHANGELOGs, conformance/notes/research dirs
    exempt by design). Regex is tuned to the patterns we've actually
    had to fix and rejects false positives on RFC / codec / version
    references. Lines that legitimately need a number opt out with
    `<!-- allow-vanity: <reason> -->`.
  - .github/workflows/no-vanity-metrics.yml — CI workflow runs the
    scanner on every PR and `main` push that touches Markdown.
  - .githooks/pre-commit — same scanner, local guard so the failure
    happens before push. Activated per-clone via
    `scripts/install-hooks.sh`.
  - CHARTER.md — adds a "Messaging — no vanity metrics" section
    documenting the policy and pointing to the scanner.

Also strips the four remaining drift sites the scanner found on
first run: a ~5 LOC stub note, a "98 crates" + "≤ 120 LOC" mention
in jouleclaw-stack/examples/AGENTS.md, and "26 crates" in the PCI
scope-map doc. The CAMT.054 ISO 20022 message-name reference is
preserved via an allow-vanity marker.
2026-06-02 10:39:43 -04:00

9 lines
291 B
Shell
Executable file

#!/usr/bin/env bash
# Local pre-commit guard. Activate by running:
# git config core.hooksPath .githooks
# from the repo root, or by running scripts/install-hooks.sh.
#
# CI runs the same scanner; this hook just catches issues earlier.
set -e
exec bash scripts/check-no-vanity-metrics.sh