Files
loki/scripts/check-brand.sh
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00

38 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Brand SSOT guard — finds DISPLAY-name strings that bypass APP_NAME.
#
# The display brand name lives in ONE place: src/config/brand.ts (APP_NAME),
# mirrored for shell in scripts/_brand.sh. A rename should be those edits only.
# This script lists any hardcoded "Loki" in rendered code so a rename is
# one-place-verifiable and new hardcodes get caught.
#
# Scope: src/ TS/TSX, excluding the SSOT itself and comment lines. It deliberately
# does NOT flag:
# - the lowercase `loki` SLUG (DB / systemd unit / repo / domain) — that's
# infra identity that intentionally survives a display rebrand (see _brand.sh).
# - editorial prose in content/ (dated Thoughts essays, docs) — not auto-renamed.
#
# Usage: bash scripts/check-brand.sh # list escapes (exit 0, informational)
# bash scripts/check-brand.sh --strict # exit 1 if any escape exists (CI gate)
set -u
cd "$(dirname "$0")/.." || exit 2
# Rendered "Loki": in JSX text or string/template literals, NOT in comments.
hits=$(grep -rnE "Loki" src/ --include="*.ts" --include="*.tsx" 2>/dev/null \
| grep -v "src/config/brand.ts" \
| grep -vE ":[[:space:]]*(//|\*|/\*)" \
| grep -E ">[^<]*Loki|\"[^\"]*Loki|\`[^\`]*Loki|'[^']*Loki")
count=$(printf "%s" "$hits" | grep -c . )
if [ "$count" -eq 0 ]; then
echo "✓ brand SSOT clean — no display-name strings bypass APP_NAME"
exit 0
fi
echo "⚠ $count display-name string(s) bypass APP_NAME (should use {APP_NAME} / \${APP_NAME}):"
echo "$hits"
echo
echo "Fix: import { APP_NAME } from \"@/config/brand\" and interpolate. Comments + the"
echo "lowercase 'loki' slug (DB/unit/repo/domain) are intentionally exempt."
[ "${1:-}" = "--strict" ] && exit 1 || exit 0