Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

1.5 KB
Raw Blame
#!/usr/bin/env bash
# Refresh src/cable/vectors/cable_frame.txt from the repository that generates it.
#
#   scripts/sync-cable-vectors.sh            # copy in, report whether anything changed
#   scripts/sync-cable-vectors.sh --check    # fail if the copy is stale (for CI, when the source is there)
#
# The vectors are generated by devices/harness-device/firmware/scripts/gen_cable_vectors.py — a third implementation
# written from the format description, so neither the firmware's decoder nor this repository's blesses its
# own misreading. That only holds while the copy here is current: a stale copy lets both suites pass while
# the real cable disagrees.
#
# Its absence is NOT an error — the copy is checked in and works on its own, and the CLI is published
# without the firmware tree beside it; this script exists for whoever changes the format.
set -euo pipefail

here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
dest="$here/../src/cable/vectors/cable_frame.txt"
src="$here/../../devices/harness-device/firmware/test/vectors/cable_frame.txt"

if [ ! -f "$src" ]; then
  echo "source vectors not found: $src"
  echo "(no firmware tree beside this CLI; skipping)"
  exit 0
fi

if diff -q "$src" "$dest" >/dev/null 2>&1; then
  echo "up to date: $dest"
  exit 0
fi

if [ "${1:-}" = "--check" ]; then
  echo "STALE: $dest differs from $src" >&2
  diff "$dest" "$src" | head -20 >&2
  exit 1
fi

cp "$src" "$dest"
echo "updated: $dest"
echo "now run: npx vitest run src/cable/cableFrame.spec.ts"