main
Caleb Publish 0.2.0 cbe04a0 9h ago
#!/bin/bash
# Package install hook: the binary to ~/.local/bin (also under its older name adom-route), the skill to
# ~/.claude/skills and ~/.codex/skills. Builds from source when the shipped binary does not run here.
set -e
HERE="$(cd "$(dirname "$0")" && pwd)"
NAME=adom-aiflow-routing
if ! "$HERE/bin/$NAME" --version >/dev/null 2>&1; then
  command -v cargo >/dev/null || { echo "ERROR: no binary for this machine and no cargo to build one"; echo "Hint: install Rust from https://rustup.rs, then run ./install.sh again"; exit 1; }
  (cd "$HERE" && cargo build --release && mkdir -p bin && cp "target/release/$NAME" "bin/$NAME")
fi
mkdir -p "$HOME/.local/bin"
install -m 755 "$HERE/bin/$NAME" "$HOME/.local/bin/.$NAME-new" && mv -f "$HOME/.local/bin/.$NAME-new" "$HOME/.local/bin/$NAME"
ln -sf "$NAME" "$HOME/.local/bin/adom-route"
for skill in "$HERE"/skills/*; do
  [ -f "$skill/SKILL.md" ] || continue
  for consumer in .claude .codex; do mkdir -p "$HOME/$consumer/skills/$(basename "$skill")"; cp "$skill/SKILL.md" "$HOME/$consumer/skills/$(basename "$skill")/SKILL.md"; done
done
echo "OK: $NAME installed (also as adom-route). Run '$NAME --help'."
echo "Hint: KiCad's own DRC is the judge of a routed board; have kicad-cli (KiCad 9 or 10) reachable for the check step."