#!/usr/bin/env bash
# Generate the embeddable symbol + footprint viewers for a chip using the OFFICIAL
# adom-symbol / adom-footprint `embed` exports (self-contained interactive HTML,
# incl. the InstaPCB paste-dots layer on the footprint). Use the built binaries.
set -e
SYM="${ADOM_SYMBOL:-adom-symbol}"; FP="${ADOM_FOOTPRINT:-adom-footprint}"
CHIPDIR="$1"; OUTDIR="$2"; MPN="$(basename "$CHIPDIR")"
"$SYM" embed --file "$CHIPDIR/$MPN.kicad_sym" --out "$OUTDIR/symview.html"
"$FP"  embed --file "$CHIPDIR/$MPN.kicad_mod" --out "$OUTDIR/fpview.html"
echo "OK: symview.html + fpview.html (official adom-symbol/adom-footprint embed exports)"