Files
giza-kmp/docs/scripts/wallet-audit.sh
T
Kgothatso NgakoandClaude Opus 5.5 b27ed2a05f docs: retire the wallet notes, and guard against a wallet coming back (wallet removal, Phase 8)
The 23 wallet notes move to docs/retired/ with a banner; every link between
notes is rewritten for the move and checked. The index lists them as one
Retired paragraph, and seven kept notes carry a line on what changed. The
README and CLAUDE.md describe a Giza with no wallet.

brand-audit.sh loses its "bennu/ exception: every such tag was a wallet's,
so one now is a wallet coming back. wallet-audit.sh --check, in check and
in CI, fails on a retired kind in the app's code, a lightning-kmp import,
a file named for a wallet's pieces, or sats in a string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 16:15:13 +02:00

67 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# That the wallets stay removed: docs/giza-wallet-removal.md, Phase 8.
#
# docs/scripts/wallet-audit.sh lists the lines that break a rule
# docs/scripts/wallet-audit.sh --check and exits 1 if there are any
#
# Giza keeps no wallet, and Bennu, which it takes fixes from, keeps several. Four rules
# catch one coming back:
#
# 1. a retired kind's number (30331-30337, 30350-30366) in the app's own code. They
# are Bennu's and stay reserved -- RetiredKinds.kt says why. Allowed in that file,
# in the migrations (which have to keep meaning what they meant) and in tests, which
# assert that Giza declines them;
# 2. an import of lightning-kmp (`fr.acinq.lightning`). Nothing in the app needs it;
# 3. a source file named for one of the wallets' own pieces -- the group wallet, the
# Lightning wallet, Iceberg, guardians, member and guarded wallets, spends,
# transactions, Electrum. Named rather than every *Wallet*: the profile pickers under
# widgets/wallet/ and the SovereignWallet* startup kept Phoenix-era names, and the
# files that decline a wallet (WalletRefusal, RemoveWalletsMigration) are about one;
# 4. an amount in sats in a string a person reads.
#
# Needs only bash and git, like the other two audits, so the CI budgets job can run it.
set -uo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../.." || exit 1
CHECK=0
[[ "${1:-}" == "--check" ]] && CHECK=1
MAIN=(composeApp/src/commonMain composeApp/src/androidMain composeApp/src/jvmMain composeApp/src/iosMain)
kinds=$(
git grep -nE '\b303(3[1-7]|5[0-9]|6[0-6])\b' -- "${MAIN[@]}" \
':!*/nostr/RetiredKinds.kt' ':!*/database/migrations/*'
)
lightning=$(git grep -nE '^import fr\.acinq\.lightning' -- composeApp)
files=$(
git ls-files composeApp/src \
| grep -E '/(GroupWallet|GroupLightning|Iceberg|Guardian|GuardedWallet|MemberWallet|MemberSend|GroupSend|GroupSpend|GroupTransaction|GroupOnchain|GroupChainClients|StandaloneElectrum|IdentityElectrum|ProposedSpend)[A-Za-z]*\.kt$'
)
sats=$(git grep -niE '>[^<]*\b(sats?|satoshis?)\b' -- composeApp/src/commonMain/composeResources)
report() {
local title=$1 lines=$2 n=0
[[ -n "$lines" ]] && n=$(printf '%s\n' "$lines" | wc -l)
echo "$title: $n"
[[ -n "$lines" ]] && printf '%s\n' "$lines" | sed 's/^/ /'
total=$((total + n))
}
total=0
report "Retired wallet kinds in the app's code" "$kinds"
report "lightning-kmp imports" "$lightning"
report "Files named for a wallet's pieces" "$files"
report "Amounts in sats in the strings" "$sats"
if (( CHECK && total > 0 )); then
echo "Giza keeps no wallet. See docs/giza-wallet-removal.md before bringing one back." >&2
exit 1
fi
exit 0