#!/bin/sh # apply_batch.sh — the ONE writer: validate, write and freeze a batch of drafted guides, and file their evidence. # tools/apply_batch.sh [ ...] (an app given as name:hidden is hidden) # Run from the catalog root. Stops at the first app that does not validate; nothing is committed here. set -eu S=$1; SUB=$2; shift 2 T=$(cd "$(dirname "$0")" && pwd) EV=$(dirname "$T")/$SUB CH=$(git -C ../felhom-controller rev-parse --short HEAD) for spec in "$@"; do app=${spec%%:*}; mode=${spec#*:}; [ "$mode" = "$spec" ] && mode=shown python3 "$T/validate_draft.py" . "$S/drafts/$app.json" if [ "$mode" = hidden ]; then python3 "$T/apply_guide.py" . "$S/drafts/$app.json" --hidden reason="user guide added HIDDEN (checked_version empty) - app guides 2026-10-15; see the evidence file for why" else python3 "$T/apply_guide.py" . "$S/drafts/$app.json" reason="user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag" fi python3 scripts/check-copy-i18n.py --add-app "$app" --reason "$reason" | tail -1 repo=$(python3 -I -c 'import json,sys; print(json.load(open(sys.argv[1]))["corpus_note"].split(" (")[0].split(":")[0])' "$S/drafts/$app.json") { echo "corpus_note: $(python3 -I -c 'import json,sys; print(json.load(open(sys.argv[1])).get("corpus_note",""))' "$S/drafts/$app.json")" echo "guide on the box: $mode" sed -e "s#\./$app/repo/#$repo:#g; s#\./$app/#$repo:#g; s#/mnt/5_hdd/felhom.eu/git/felhom-controller/#felhom-controller@$CH:#g" "$S/$app-labels.raw" } > "$EV/$app-labels.txt" cp "$S/drafts/$app.json" "$EV/$app-draft.json" done