From 33cb33af6804c30d8ad8ee6b34764552fbf790bf Mon Sep 17 00:00:00 2001 From: Michael Heller <21163552+mdheller@users.noreply.github.com> Date: Mon, 20 Jul 2026 07:45:11 -0400 Subject: [PATCH] =?UTF-8?q?packaging(cockpit):=20fix=20clean-box=20assembl?= =?UTF-8?q?e=20=E2=80=94=20bun=20build=20+=20writable=20work=20dirs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs the brew-install path exposed (the local dev test masked them): 1. build-cockpit.sh ran 'npm ci' — but client-vue is a pnpm project (pnpm-lock.yaml, no package-lock.json), so npm ci can't run on a fresh clone. Build with bun instead (already required for the sidecar; installs straight from package.json regardless of lockfile). Local test passed only because a stray package-lock.json existed. 2. Both build scripts defaulted their clone/WORK dir to $REPO_ROOT/build — which is a read-only Cellar libexec on a package install. Default to TMPDIR (writable). Verified: full FRESH-CLONE assemble (no local src overrides — exactly what the brew CLI does) now completes end-to-end: clone socioprophet → bun-build client-vue (43 files); clone noetica → bun-compile the 68M sidecar (smoke 200); stage. build-cockpit also now errors cleanly if bun is absent. --- scripts/build-agent-machine-sidecar.sh | 3 ++- scripts/build-cockpit.sh | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/build-agent-machine-sidecar.sh b/scripts/build-agent-machine-sidecar.sh index ba8e67f..f5bf835 100755 --- a/scripts/build-agent-machine-sidecar.sh +++ b/scripts/build-agent-machine-sidecar.sh @@ -22,7 +22,8 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" AM_REF="${AM_REF:-main}" OUT="${OUT:-$REPO_ROOT/build/sidecars}" -WORK="$REPO_ROOT/build/.agent-machine-src" +# WORK must be WRITABLE — a package install runs this from a read-only Cellar libexec. +WORK="${AGENT_MACHINE_WORK:-${TMPDIR:-/tmp}/bearbrowser-agent-machine-src}" BIN_NAME="bearbrowser-agent-machine-bin" AM_SUBDIR="agent-machine" diff --git a/scripts/build-cockpit.sh b/scripts/build-cockpit.sh index dda7198..739484e 100755 --- a/scripts/build-cockpit.sh +++ b/scripts/build-cockpit.sh @@ -21,7 +21,9 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" COCKPIT_REF="${COCKPIT_REF:-master}" OUT="${OUT:-$REPO_ROOT/build/cockpit}" -WORK="$REPO_ROOT/build/.cockpit-src" +# WORK must be WRITABLE — a package install runs this from a read-only Cellar libexec, +# so default the clone dir to TMPDIR, not $REPO_ROOT/build. +WORK="${COCKPIT_WORK:-${TMPDIR:-/tmp}/bearbrowser-cockpit-src}" CLIENT_VUE_SUBDIR="socioprophet-web/client-vue" log() { printf '[build-cockpit] %s\n' "$*"; } @@ -42,8 +44,12 @@ grep -q "resolveBase" "$SRC/src/config/cockpitRuntime.ts" 2>/dev/null \ || { log "ERROR: cockpit source lacks the runtime resolver (needs socioprophet #468 landed)"; exit 1; } # 2. Build the static bundle --------------------------------------------------- -log "npm ci + build in $SRC" -( cd "$SRC" && npm ci --no-audit --no-fund && npm run build ) +# client-vue is a pnpm project (pnpm-lock.yaml, no package-lock.json) so `npm ci` can't +# run. Build with bun instead — already required for the sidecar, fast, and it installs +# straight from package.json regardless of which lockfile is committed. +command -v bun >/dev/null 2>&1 || { log "ERROR: bun is required to build the cockpit. Install: brew install bun"; exit 1; } +log "bun install + build in $SRC" +( cd "$SRC" && bun install && bun run build ) [ -f "$SRC/dist/index.html" ] || { log "ERROR: build produced no dist/index.html"; exit 1; } # 3. Stage into the cockpit resource dir --------------------------------------