65 lines
2.5 KiB
Bash
65 lines
2.5 KiB
Bash
#!/usr/bin/env bash
|
|||
|
|
#
|
||
|
|
# Where the name Bennu may still appear in Giza: docs/giza-rebrand.md, Phase 6.
|
||
|
|
#
|
||
|
|
# docs/scripts/brand-audit.sh lists the lines that break the rule
|
||
|
|
# docs/scripts/brand-audit.sh --check and exits 1 if there are any
|
||
|
|
#
|
||
|
|
# The rule, in the parts that build or ship (composeApp, iosApp, testing and the gradle
|
||
|
|
# scripts): Bennu may be named in a comment, and in a `bennu/` derivation tag,
|
||
|
|
# and nowhere else. The tags are hash inputs Giza shares with Bennu, so they stay spelled
|
||
|
|
# as they are (giza-rebrand.md, "What does not carry the name"). A comment can explain the
|
||
|
|
# fork. Anything else -- a string a person reads, a client tag, an identifier, a package --
|
||
|
|
# is a leftover.
|
||
|
|
#
|
||
|
|
# Prose (README.md, CLAUDE.md, docs/ and the Markdown under testing/) is not checked: it
|
||
|
|
# explains the fork, and docs/ records decisions taken while the app was Bennu.
|
||
|
|
#
|
||
|
|
# Why it exists: a merge from Bennu (Phase 9) brings Bennu's new strings with it, and
|
||
|
|
# docs/scripts/giza-rename.sh renames code, not words. This is what fails the build when
|
||
|
|
# one of them would otherwise ship.
|
||
|
|
#
|
||
|
|
# Needs only bash and git, like m3-audit.sh, so the CI budgets job can run it.
|
||
|
|
|
||
|
|
set -uo pipefail
|
||
|
|
|
||
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1
|
||
|
|
|
||
|
|
CHECK=0
|
||
|
|
[[ "${1:-}" == "--check" ]] && CHECK=1
|
||
|
|
|
||
|
|
violations=$(
|
||
|
|
git grep -niI 'bennu' -- \
|
||
|
|
composeApp iosApp testing settings.gradle.kts build.gradle.kts \
|
||
|
|
| awk '
|
||
|
|
{
|
||
|
|
# path:line:text -- the text may itself contain colons.
|
||
|
|
path = $0; sub(/:.*/, "", path)
|
||
|
|
text = $0; sub(/^[^:]*:[^:]*:/, "", text)
|
||
|
|
code = text; sub(/^[ \t]+/, "", code)
|
||
|
|
}
|
||
|
|
# A derivation tag: the one place the name is protocol.
|
||
|
|
text ~ /"bennu\// { next }
|
||
|
|
# Comments in Kotlin and Gradle scripts: //, /* and KDoc continuation lines.
|
||
|
|
path ~ /\.(kt|kts)$/ && (code ~ /^\/\// || code ~ /^\/\*/ || code ~ /^\*/) { next }
|
||
|
|
# Comments in YAML, shell and HOCON (the regtest stack).
|
||
|
|
path ~ /\.(yml|yaml|sh|conf)$/ && code ~ /^#/ { next }
|
||
|
|
# Markdown under testing/ -- the regtest README -- is prose, like docs/.
|
||
|
|
path ~ /\.md$/ { next }
|
||
|
|
{ print }
|
||
|
|
'
|
||
|
|
)
|
||
|
|
|
||
|
|
count=0
|
||
|
|
[[ -n "$violations" ]] && count=$(printf '%s\n' "$violations" | wc -l)
|
||
|
|
|
||
|
|
echo "Bennu outside comments and derivation tags: $count"
|
||
|
|
if (( count > 0 )); then
|
||
|
|
printf '%s\n' "$violations" | sed 's/^/ /'
|
||
|
|
fi
|
||
|
|
|
||
|
|
if (( CHECK && count > 0 )); then
|
||
|
|
echo "Name it Giza, or, if it is protocol shared with Bennu, say so in a comment." >&2
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
exit 0
|