magicciv/tools/capture-proof.sh
autocommit d6c84e4b4f refactor(ui): tokenize HUD notification colors off raw Color() literals
p2-74 cluster 2 (HUD panels + notifications), notifications sub-cluster.
Route turn_notification.gd / comms_toast.gd / capital_blackout_overlay.gd
inline Color() literals onto ThemeAssets.color() design tokens.

- turn_notification: const CATEGORY_COLORS dict (a const trap — token lookups
  can't sit in a const initializer) converted to var _category_colors populated
  in _ready(); category palette → semantic.negative/positive, accent.science,
  accent.goldResource, player.purple, semantic.diplomacy, text.primary. Panel
  bg/border → background.panel/border.panel; title/header → text.title; scrim
  dims → background.hud/overlay; muted hints → text.muted.
- comms_toast: panel bg/border → background.panel/border.panel; accent strip →
  accent.gold; title → text.title; body → text.primary. The configure() accent
  default Color literal (param defaults can't call the autoload) becomes a null
  sentinel resolved to accent.gold in the body.
- capital_blackout_overlay: dim/glitch scrims sourced from background.deepest /
  semantic.negative with explicit .a; title → semantic.negative; subtitle →
  text.title.

Adds tools/capture-proof.sh: reusable single-proof-scene capture under a private
headless weston on the RUN host, pulling the PNG back. Visual-only; no logic
change (Rail 3). 0 Color() remain in the three scripts.

Proof: hud_proof.tscn captured on apricot (headless weston) shows the themed
purple Turn Summary panel, gold border/title, copper filter checkboxes, and
semantic per-category entry coloring (red combat, green founding, blue tech,
gold economy, violet magic).
.project/screenshots/p2-74-cluster2-hud-notifications.png

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 20:57:41 -07:00

57 lines
1.9 KiB
Bash
Executable file

#!/usr/bin/env bash
# Capture a single proof scene under a private headless weston on the RUN host,
# then pull the resulting PNG back to the EDIT host.
#
# Reusable across UI proof work (p2-74 de-hardcode clusters etc). The proof
# scene must self-capture via get_viewport().get_image().save_png() and print a
# line "SCREENSHOT_PATH:<abs>" (the convention used by scenes/tests/*_proof.gd).
#
# Usage: tools/capture-proof.sh <scene_res_path> <local_out_png> [timeout_s]
# scene_res_path: e.g. res://engine/scenes/tests/hud_proof.tscn
# local_out_png : destination on the EDIT host
#
# Env: AUTOPLAY_HOST (default lilith@apricot.lan), PROJECT_ROOT_REMOTE.
set -uo pipefail
SCENE="${1:?scene res:// path required}"
OUT="${2:?local output png path required}"
TIMEOUT="${3:-180}"
RH="${AUTOPLAY_HOST:-lilith@apricot.lan}"
RROOT="${PROJECT_ROOT_REMOTE:-/var/home/lilith/Code/@projects/@magic-civilization}"
remote_cmd=$(cat <<REMOTE
set -uo pipefail
cd "$RROOT/src/game" || exit 3
WSOCK="proof-\$\$"
weston --backend=headless --no-config --socket="\$WSOCK" --width=1280 --height=720 \
>/tmp/weston-\$WSOCK.log 2>&1 &
WPID=\$!
sleep 1.5
XDG_RUNTIME_DIR="\${XDG_RUNTIME_DIR:-/run/user/\$(id -u)}" \
timeout "$TIMEOUT" flatpak run --user \
--filesystem=home \
--socket=wayland \
--unset-env=DISPLAY \
--env=WAYLAND_DISPLAY="\$WSOCK" \
--filesystem=xdg-run/"\$WSOCK" \
org.godotengine.Godot \
--path . \
--display-driver wayland --rendering-driver opengl3 --rendering-method gl_compatibility \
"$SCENE" 2>&1 | tee /tmp/proof-\$WSOCK.log
kill "\$WPID" 2>/dev/null || true
grep -m1 '^SCREENSHOT_PATH:' /tmp/proof-\$WSOCK.log | sed 's/^SCREENSHOT_PATH://'
REMOTE
)
echo "=== capture-proof: $SCENE on $RH ==="
REMOTE_PNG="$(ssh "$RH" "$remote_cmd" | tail -n1)"
if [ -z "$REMOTE_PNG" ]; then
echo "ERROR: no SCREENSHOT_PATH emitted by proof scene" >&2
exit 1
fi
echo "Remote PNG: $REMOTE_PNG"
mkdir -p "$(dirname "$OUT")"
scp "$RH:$REMOTE_PNG" "$OUT"
echo "Saved: $OUT"