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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
store: the KiCad tile ships KiCad — nothing left for the person to install but the engine
31803smith03787d9d94aa
diff --git a/store/agents/kicad/README.md b/store/agents/kicad/README.mdindex 61e128829..1fa62f8a8 100644--- a/store/agents/kicad/README.md+++ b/store/agents/kicad/README.md@@ -19,12 +19,21 @@ template; the doctor, workspace init and viewer are that package's own scripts,- `harness.json` — name, category, engine, and paths into `upstream/harness/kicad/`.- `VERSIONS` — the repository, the pinned commit (on its `feat/v2-kicad-native` branch), the sparse patterns.- `toolchain/runtimes.sh` — the store's copy: a Node and a venv Python of the package's own.-- `toolchain/fetch-upstream.sh` — the read-only, sparse, blob-less fetch; `setup.sh`, `doctor.sh`,- `init-workspace.sh`, `viewer.sh`, `python` hand off to the package's scripts of the same names.--What the machine must have: **KiCad** (`brew install --cask kicad` — kicad-cli and its bundled Python with-`pcbnew`; the doctor fails without them), the engine CLI, git. Node and Python come with the package;-Freerouting and the viewer are vendored by setup.+- `toolchain/kicad.sh` — KiCad vendored at the pin (macOS: the official DMG, copied without 3D models+ and help); `VERSIONS` carries its version, URL, checksum and size.+- `toolchain/fetch-upstream.sh` — the read-only, sparse, blob-less fetch (a tarball when there is no+ git); `setup.sh`, `doctor.sh`, `init-workspace.sh`, `viewer.sh`, `python` hand off to the package's+ scripts of the same names.++What the machine must have: **the engine's CLI, signed in.** Everything else comes with the package,+installed into its own folder and never onto the machine: a Node and a venv Python (`runtimes.sh`),+**KiCad itself** (`toolchain/kicad.sh` — on macOS the official unified DMG at the version and checksum+`VERSIONS` pins, mounted and copied into `kicad/KiCad.app` without the 3D models and the offline help:+a 1.4 GB download, 1.3 GB on disk; the manifest points the pipeline at it with `KICADPY_CLI`,+`KICADPY_PYTHON`, `CIRCUIT_KICAD_CLI` and `KICAD_HARNESS_SHARE`), Freerouting with its JRE, and the built+viewer. git is optional: without it the pinned commit arrives as GitHub's tarball. On Linux there is+no relocatable KiCad artifact, so KiCad stays a system install (apt/dnf/flatpak) named by+`KICADPY_CLI` / `KICADPY_PYTHON`, and the doctor says so.## Credit and stewardshipdiff --git a/store/agents/kicad/VERSIONS b/store/agents/kicad/VERSIONSindex 050771a4c..1b7afe4cf 100644--- a/store/agents/kicad/VERSIONS+++ b/store/agents/kicad/VERSIONS@@ -4,7 +4,13 @@# commit on that branch. The fetch is by commit, so an unmerged branch is fine.UPSTREAM_NAME="autonomous-circuit"UPSTREAM_REPO="https://github.com/autonomous-ai/autonomous-circuit.git"-UPSTREAM_COMMIT="9293ee1d9064146d2d2303a7d3653d1f046ac985"+UPSTREAM_COMMIT="9f85566c85e912ddf28b265f45f592c36e37de3c"# Everything but its product library and examples (118 MB a board build never reads).UPSTREAM_SPARSE_MODE="no-cone"UPSTREAM_SPARSE="/* !/products/ !/examples/"+# KiCad itself, vendored by toolchain/kicad.sh on macOS: the official unified DMG (the artifact+# Homebrew's cask installs), copied into <install>/kicad/KiCad.app without 3D models and help.+KICAD_VERSION="10.0.6"+KICAD_DMG_URL="https://github.com/KiCad/kicad-source-mirror/releases/download/10.0.6/kicad-unified-universal-10.0.6.dmg"+KICAD_DMG_SHA256="ef4dcd4278c46d3efcd28c8db273d5957d68efda028f6bf79b4811fc5302dc68"+KICAD_DMG_BYTES="1404303659"diff --git a/store/agents/kicad/harness.json b/store/agents/kicad/harness.jsonindex 6c72dcb84..0b37b94cd 100644--- a/store/agents/kicad/harness.json+++ b/store/agents/kicad/harness.json@@ -25,6 +25,10 @@"KICAD_HARNESS_ROOT": "${dsh}/upstream","KICAD_HARNESS_BLOCKS": "${dsh}/upstream/packages/golden-blocks/blocks","CIRCUIT_TOOLCHAIN": "${dsh}/upstream/toolchain",+ "KICADPY_CLI": "${dsh}/kicad/KiCad.app/Contents/MacOS/kicad-cli",+ "KICADPY_PYTHON": "${dsh}/kicad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python3",+ "CIRCUIT_KICAD_CLI": "${dsh}/kicad/KiCad.app/Contents/MacOS/kicad-cli",+ "KICAD_HARNESS_SHARE": "${dsh}/kicad/KiCad.app/Contents/SharedSupport","CIRCUIT_SKILLS_DIR": "${workspace}/.claude/skills","DISABLE_AUTOUPDATER": "1"}diff --git a/store/agents/kicad/toolchain/doctor.sh b/store/agents/kicad/toolchain/doctor.shindex 15872462e..a4c1006f1 100755--- a/store/agents/kicad/toolchain/doctor.sh+++ b/store/agents/kicad/toolchain/doctor.sh@@ -1,11 +1,12 @@#!/usr/bin/env bash# The package's own doctor, run against the fetched copy. cwd = the install dir.-# The copy at the pin, the venv, then the KiCad package's doctor: engine CLI, node, kicadpy on the venv,-# kicad-cli and pcbnew (required), Freerouting vendored, the viewer built.+# The copy at the pin, the venv, the vendored KiCad, then the KiCad package's doctor: engine CLI,+# node, kicadpy on the venv, kicad-cli and pcbnew (the vendored ones), Freerouting, the viewer.set -uo pipefailcd "$(dirname "$0")/..". ./VERSIONS. toolchain/runtimes.sh+. toolchain/kicad.shif [ ! -f upstream/.harness-commit ]; thenecho "miss autonomous-circuit is not fetched — run toolchain/setup.sh"; exit 1fi@@ -16,8 +17,16 @@ harness_node 22.12 >/dev/null || truevenv=0.venv/bin/python -c 'import sys; sys.exit(0 if sys.version_info >= (3, 10) else 1)' >/dev/null 2>&1 \|| { echo "miss .venv (the pipeline's Python >= 3.10) — run toolchain/setup.sh"; venv=1; }+kicad=0+have="$(harness_kicad_version || true)"+if [ "$have" = "$KICAD_VERSION" ]; then+ echo "ok KiCad $have vendored at kicad/KiCad.app"+else+ echo "miss KiCad $KICAD_VERSION is not vendored (have '${have:-none}') — run toolchain/setup.sh"; kicad=1+fi[ -x upstream/harness/kicad/toolchain/doctor.sh ] || { echo "miss upstream/harness/kicad/toolchain/doctor.sh"; exit 1; }CIRCUIT_TOOLCHAIN="${CIRCUIT_TOOLCHAIN:-$PWD/upstream/toolchain}" CIRCUIT_PYTHON="${CIRCUIT_PYTHON:-$PWD/toolchain/python}" \+ KICADPY_CLI="${KICADPY_CLI:-$KICAD_CLI}" KICADPY_PYTHON="${KICADPY_PYTHON:-$KICAD_PYTHON}" CIRCUIT_KICAD_CLI="${CIRCUIT_KICAD_CLI:-$KICAD_CLI}" \upstream/harness/kicad/toolchain/doctor.shcode=$?-exit $((code ? code : venv))+exit $((code ? code : venv ? venv : kicad))diff --git a/store/agents/kicad/toolchain/fetch-upstream.sh b/store/agents/kicad/toolchain/fetch-upstream.shindex 05dd88c28..bddebcfab 100755--- a/store/agents/kicad/toolchain/fetch-upstream.sh+++ b/store/agents/kicad/toolchain/fetch-upstream.sh@@ -8,7 +8,20 @@ if [ -f upstream/.harness-commit ] && [ "$(cat upstream/.harness-commit)" = "${Uecho "ok ${UPSTREAM_NAME} @ ${UPSTREAM_COMMIT:0:12} already fetched"exit 0fi-command -v git >/dev/null 2>&1 || { echo "miss git on PATH"; exit 1; }+if ! command -v git >/dev/null 2>&1; then+ # A new Mac has no git until Xcode's command line tools are installed (a dialog, not a script).+ # GitHub serves the pinned commit as a tarball; the sparse patterns become tar excludes.+ echo " no git on PATH — fetching ${UPSTREAM_NAME} @ ${UPSTREAM_COMMIT:0:12} as a tarball"+ archive="${UPSTREAM_REPO%.git}/archive/${UPSTREAM_COMMIT}.tar.gz"+ rm -rf upstream.partial && mkdir upstream.partial+ curl -fsSL --retry 3 "$archive" | tar -xzf - -C upstream.partial --strip-components 1 \+ --exclude '*/products/*' --exclude '*/examples/*' \+ || { rm -rf upstream.partial; echo "miss could not fetch $archive"; exit 1; }+ echo "${UPSTREAM_COMMIT}" > upstream.partial/.harness-commit+ rm -rf upstream && mv upstream.partial upstream+ echo "ok ${UPSTREAM_NAME} @ ${UPSTREAM_COMMIT:0:12} fetched as a tarball ($(du -sh upstream | cut -f1))"+ exit 0+fiecho " fetching ${UPSTREAM_REPO} @ ${UPSTREAM_COMMIT:0:12} (${UPSTREAM_SPARSE_MODE} sparse: ${UPSTREAM_SPARSE})"# The copy in upstream/ stays until the new one is complete: a fetch that fails (offline, a bad pin)# leaves the install that worked.diff --git a/store/agents/kicad/toolchain/kicad.sh b/store/agents/kicad/toolchain/kicad.shnew file mode 100755index 000000000..4bd350ac5--- /dev/null+++ b/store/agents/kicad/toolchain/kicad.sh@@ -0,0 +1,72 @@+#!/usr/bin/env bash+# KiCad itself, vendored into this package — the one thing a KiCad harness cannot run without.+#+# The store's rule is "pin versions and vendor them there, never into the user's machine", and+# KiCad is not on PyPI or conda-forge, so on macOS this fetches the official unified DMG at the+# version and checksum VERSIONS pins (the same artifact Homebrew's cask installs), mounts it, and+# copies `KiCad.app` into `<install>/kicad/` — without the 3D models (3.1 GB, nothing in the+# pipeline reads them) and the offline help (376 MB). What stays is what a board needs: kicad-cli,+# KiCad's own Python with `pcbnew`, the symbol and footprint libraries, the templates — about+# 1.3 GB on disk after a 1.4 GB download. A KiCad already at that version under `<install>/kicad`+# is kept. The machine's own /Applications/KiCad is never touched or required.+#+# Linux has no relocatable KiCad artifact to pin (distributions and flatpak install system-wide),+# so there this reports a miss and names the package; the doctor then says the same.+#+# Sourced by setup.sh and doctor.sh; cwd = the install dir; needs runtimes.sh loaded (for+# `_harness_fetch`) and VERSIONS (for KICAD_*).+set -u++KICAD_APP="$PWD/kicad/KiCad.app"+KICAD_CLI="$KICAD_APP/Contents/MacOS/kicad-cli"+KICAD_PYTHON="$KICAD_APP/Contents/Frameworks/Python.framework/Versions/Current/bin/python3"+KICAD_SHARE="$KICAD_APP/Contents/SharedSupport"++# The version string kicad-cli prints, e.g. "10.0.6", or nothing.+harness_kicad_version() {+ [ -x "$KICAD_CLI" ] || return 1+ "$KICAD_CLI" version 2>/dev/null | head -1 | tr -d '[:space:]'+}++# harness_kicad — make <install>/kicad/KiCad.app exist at the pinned version. Prints ok/miss lines.+harness_kicad() {+ local have url dmg mount+ have="$(harness_kicad_version || true)"+ if [ "$have" = "$KICAD_VERSION" ] && "$KICAD_PYTHON" -c 'import pcbnew' >/dev/null 2>&1; then+ echo "ok KiCad $have vendored (kicad-cli + pcbnew)"+ return 0+ fi+ case "$(uname -s)" in+ Darwin) ;;+ *) echo "miss KiCad $KICAD_VERSION is not vendored on $(uname -s): install it system-wide (apt/dnf/flatpak org.kicad.KiCad) and set KICADPY_CLI / KICADPY_PYTHON"; return 1 ;;+ esac+ url="$KICAD_DMG_URL"+ dmg="${HARNESS_RUNTIME:-$HOME/.harness/runtime}/downloads/$(basename "$url")"+ mkdir -p "$(dirname "$dmg")" || { echo "miss cannot write $(dirname "$dmg")"; return 1; }+ if [ ! -f "$dmg" ]; then+ echo " fetching KiCad $KICAD_VERSION ($(( KICAD_DMG_BYTES / 1000000 )) MB) — the official macOS build, checksum pinned"+ _harness_fetch "$url" "$dmg" "$KICAD_DMG_SHA256" || return 1+ fi+ mount="$(mktemp -d "${TMPDIR:-/tmp}/harness-kicad.XXXXXX")"+ if ! hdiutil attach -nobrowse -readonly -quiet -mountpoint "$mount" "$dmg"; then+ echo "miss could not mount $dmg"; rmdir "$mount" 2>/dev/null; return 1+ fi+ rm -rf "$PWD/kicad.partial"+ mkdir -p "$PWD/kicad.partial"+ echo " copying KiCad.app without 3dmodels and help (about 1.3 GB)"+ if rsync -a --exclude 'Contents/SharedSupport/3dmodels' --exclude 'Contents/SharedSupport/help' \+ "$mount/KiCad/KiCad.app" "$PWD/kicad.partial/"; then+ hdiutil detach -quiet "$mount"; rmdir "$mount" 2>/dev/null+ rm -rf "$PWD/kicad"+ mv "$PWD/kicad.partial" "$PWD/kicad"+ else+ hdiutil detach -quiet "$mount"; rmdir "$mount" 2>/dev/null+ rm -rf "$PWD/kicad.partial"+ echo "miss copying KiCad.app failed"; return 1+ fi+ rm -f "$dmg" # 1.4 GB the cache does not need once the app is in place+ have="$(harness_kicad_version || true)"+ if [ "$have" != "$KICAD_VERSION" ]; then echo "miss vendored kicad-cli reports '$have', expected $KICAD_VERSION"; return 1; fi+ "$KICAD_PYTHON" -c 'import pcbnew' >/dev/null 2>&1 || { echo "miss vendored KiCad Python cannot import pcbnew"; return 1; }+ echo "ok KiCad $have vendored (kicad-cli + pcbnew)"+}diff --git a/store/agents/kicad/toolchain/setup.sh b/store/agents/kicad/toolchain/setup.shindex 3c8f1bb4a..2ac501128 100755--- a/store/agents/kicad/toolchain/setup.sh+++ b/store/agents/kicad/toolchain/setup.sh@@ -1,13 +1,18 @@#!/usr/bin/env bash-# Runs once at install, cwd = the install dir: a Node and a Python of the package's own, then fetch+# Runs once at install, cwd = the install dir: a Node and a Python of the package's own, KiCad+# itself (toolchain/kicad.sh — the official build, vendored here, never the machine's), then fetch# Autonomous Circuit at the pinned commit and run the KiCad package's OWN setup in it (Freerouting-# jar + JRE, the board viewer). KiCad is the machine's — doctor.sh reports it afterwards.+# jar + JRE, the board viewer). Nothing is installed onto the machine.set -euo pipefailcd "$(dirname "$0")/.."+. ./VERSIONS. toolchain/runtimes.sh+. toolchain/kicad.shharness_node 22.12 || exit 1harness_venv .venv 3.12 3.10 || exit 1+harness_kicad || exit 1toolchain/fetch-upstream.sh[ -x upstream/harness/kicad/toolchain/setup.sh ] || { echo "miss upstream/harness/kicad/toolchain/setup.sh"; exit 1; }HARNESS_DSH_DIR="$PWD/upstream/harness/kicad" CIRCUIT_PYTHON="$PWD/toolchain/python" \+ KICADPY_CLI="$KICAD_CLI" KICADPY_PYTHON="$KICAD_PYTHON" CIRCUIT_KICAD_CLI="$KICAD_CLI" \upstream/harness/kicad/toolchain/setup.shdiff --git a/store/agents/kicad/toolchain/test_toolchain.py b/store/agents/kicad/toolchain/test_toolchain.pyindex bb0005497..08cdd2258 100644--- a/store/agents/kicad/toolchain/test_toolchain.py+++ b/store/agents/kicad/toolchain/test_toolchain.py@@ -107,11 +107,24 @@ class HandoffTest(unittest.TestCase):venv.mkdir(parents=True)(venv / "python").write_text('#!/bin/sh\nexit 0\n')(venv / "python").chmod(0o755)+ shutil.copy(TOOLCHAIN / "kicad.sh", self.install / "toolchain" / "kicad.sh")+ self.fake_kicad(versions_value("KICAD_VERSION"))self.env = {k: v for k, v in os.environ.items() if not k.startswith(("HARNESS_", "CIRCUIT_"))}def tearDown(self):shutil.rmtree(self.tmp, ignore_errors=True)+ def fake_kicad(self, version):+ """A vendored KiCad stand-in: kicad-cli prints `version`, KiCad's python imports pcbnew."""+ app = self.install / "kicad" / "KiCad.app" / "Contents"+ (app / "MacOS").mkdir(parents=True, exist_ok=True)+ py = app / "Frameworks" / "Python.framework" / "Versions" / "Current" / "bin"+ py.mkdir(parents=True, exist_ok=True)+ (app / "MacOS" / "kicad-cli").write_text(f'#!/bin/sh\n[ "$1" = version ] && echo {version}\nexit 0\n')+ (app / "MacOS" / "kicad-cli").chmod(0o755)+ (py / "python3").write_text('#!/bin/sh\nexit 0\n')+ (py / "python3").chmod(0o755)+def run_script(self, name, cwd=None, **extra):return subprocess.run([str(self.install / "toolchain" / name)], cwd=cwd or self.install,env={**self.env, **extra}, capture_output=True, text=True, timeout=60)@@ -160,3 +173,88 @@ class HandoffTest(unittest.TestCase):if __name__ == "__main__":unittest.main()+++class VendoredKiCadTest(unittest.TestCase):++ def test_versions_pins_kicad_by_version_url_checksum_and_size(self):+ self.assertRegex(versions_value("KICAD_VERSION"), r"^\d+\.\d+\.\d+$")+ self.assertTrue(versions_value("KICAD_DMG_URL").startswith("https://github.com/KiCad/kicad-source-mirror/releases/download/"))+ self.assertIn(versions_value("KICAD_VERSION"), versions_value("KICAD_DMG_URL"))+ self.assertRegex(versions_value("KICAD_DMG_SHA256"), r"^[0-9a-f]{64}$")+ self.assertGreater(int(versions_value("KICAD_DMG_BYTES")), 1_000_000_000)++ def test_manifest_points_the_pipeline_at_the_vendored_kicad(self):+ env = manifest()["agent"]["env"]+ self.assertEqual(env["KICADPY_CLI"], "${dsh}/kicad/KiCad.app/Contents/MacOS/kicad-cli")+ self.assertEqual(env["CIRCUIT_KICAD_CLI"], env["KICADPY_CLI"])+ self.assertTrue(env["KICADPY_PYTHON"].startswith("${dsh}/kicad/KiCad.app/Contents/Frameworks/Python.framework/"))+ self.assertEqual(env["KICAD_HARNESS_SHARE"], "${dsh}/kicad/KiCad.app/Contents/SharedSupport")++ def test_setup_and_doctor_source_the_kicad_script(self):+ for name in ("setup.sh", "doctor.sh"):+ self.assertIn(". toolchain/kicad.sh", (TOOLCHAIN / name).read_text(), name)+ self.assertIn("harness_kicad || exit 1", (TOOLCHAIN / "setup.sh").read_text())+ self.assertTrue(os.access(TOOLCHAIN / "kicad.sh", os.X_OK))+++class HandoffKiCadTest(HandoffTest):+ """The doctor reads the vendored KiCad and hands its paths to the package's doctor."""++ def test_doctor_hands_the_vendored_kicad_to_the_package(self):+ out = self.run_script("doctor.sh")+ self.assertEqual(out.returncode, 0, out.stdout + out.stderr)+ self.assertIn("ok KiCad " + versions_value("KICAD_VERSION") + " vendored", out.stdout)++ def test_doctor_without_the_vendored_kicad_is_a_miss_and_still_asks_the_package(self):+ shutil.rmtree(self.install / "kicad")+ out = self.run_script("doctor.sh")+ self.assertEqual(out.returncode, 1)+ self.assertIn("miss KiCad " + versions_value("KICAD_VERSION") + " is not vendored", out.stdout)+ self.assertIn("doctor.sh dsh=", out.stdout)++ def test_doctor_with_a_kicad_at_the_wrong_version_is_a_miss(self):+ self.fake_kicad("9.0.4")+ out = self.run_script("doctor.sh")+ self.assertEqual(out.returncode, 1)+ self.assertIn("(have '9.0.4')", out.stdout)+++class TarballFetchTest(unittest.TestCase):+ """Without git, fetch-upstream.sh takes GitHub's tarball of the pinned commit, sparse by excludes."""++ def test_fetch_without_git_unpacks_the_tarball_and_leaves_products_and_examples_behind(self):+ tmp = Path(tempfile.mkdtemp())+ try:+ # A tarball shaped like GitHub's: one top-level folder named after the repo and commit.+ src = tmp / "src" / "autonomous-circuit-abc"+ for rel in ("harness/kicad/harness.json", "packages/kicadpy/x.py", "products/big.bin", "examples/e.txt"):+ (src / rel).parent.mkdir(parents=True, exist_ok=True)+ (src / rel).write_text("x")+ tar = tmp / "archive.tar.gz"+ subprocess.run(["tar", "-czf", str(tar), "-C", str(tmp / "src"), "autonomous-circuit-abc"], check=True)+ # A PATH with no git and a curl that serves that tarball.+ bin_dir = tmp / "bin"+ bin_dir.mkdir()+ for tool in ("tar", "rm", "mkdir", "mv", "du", "cut", "cat", "dirname", "basename", "sh", "bash"):+ real = shutil.which(tool)+ if real:+ os.symlink(real, bin_dir / tool)+ (bin_dir / "curl").write_text(f'#!/bin/sh\nprintf "%s\\n" "$@" > "{tmp}/curl.args"\ncat "{tar}"\n')+ (bin_dir / "curl").chmod(0o755)+ install = tmp / "install"+ install.mkdir()+ shutil.copy(PACKAGE / "VERSIONS", install / "VERSIONS")+ env = {k: v for k, v in os.environ.items() if not k.startswith(("HARNESS_", "CIRCUIT_"))}+ env["PATH"] = str(bin_dir)+ out = subprocess.run([str(TOOLCHAIN / "fetch-upstream.sh")], cwd=install, env=env, capture_output=True, text=True, timeout=60)+ self.assertEqual(out.returncode, 0, out.stdout + out.stderr)+ self.assertIn("as a tarball", out.stdout)+ self.assertIn(versions_value("UPSTREAM_COMMIT"), (tmp / "curl.args").read_text())+ self.assertTrue((install / "upstream" / "harness" / "kicad" / "harness.json").is_file())+ self.assertTrue((install / "upstream" / "packages" / "kicadpy" / "x.py").is_file())+ self.assertFalse((install / "upstream" / "products").exists())+ self.assertFalse((install / "upstream" / "examples").exists())+ self.assertEqual((install / "upstream" / ".harness-commit").read_text().strip(), versions_value("UPSTREAM_COMMIT"))+ finally:+ shutil.rmtree(tmp, ignore_errors=True)