#!/usr/bin/env bash
# Regenerate every app icon file from assets/app-icon/effectcraft.svg (the canonical vector).
#
# Needs: resvg (brew install resvg / cargo install resvg). On macOS, iconutil also writes the
# .icns. The outputs are committed, so builds and packaging never need these tools.
#
# packaging/icons.sh
#
# effectcraft.svg and effectcraft-small.svg (the lighter 1024 px trace) come from craftrules
# (assets/app-icons/effectcraft/, which also keeps the source drawing) and are copied in by hand.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DIR="$ROOT/assets/app-icon"
SVG="$DIR/effectcraft.svg"
ID="ai.storyteller.effectcraft"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
command -v resvg >/dev/null || { echo "error: resvg not found (brew install resvg)" >&2; exit 1; }
render() { resvg -w "$2" -h "$2" "$1" "$3" |[[:space:]]*$||' "$SVG" >"$MAC"
grep -q 'viewBox="0 0 1024 1024"' "$MAC" || { echo "error: unexpected