#!/bin/sh # Fetch npm-global CLIs as .tgz tarballs for offline install on the ISO target. # # These three packages are agent runtimes the firstboot installer will # `npm install -g` from local tarballs (no network needed): # # @anthropic-ai/claude-code — Claude Code CLI (agent harness) # @google/gemini-cli — Gemini CLI (alt agent) # @mariozechner/pi-coding-agent — pi CLI (used by clawdie-ai + paperclip adapters) # # Notes: # - Codex is shipped via the FreeBSD `codex` pkg (see pkg-list-host.txt), # not via npm — kept out of this bundle on purpose. # - opencode + cursor have no working FreeBSD distribution (upstream gap). # - Output is dual-purpose: bundled into the ISO and used by firstboot. # # Usage: # ./scripts/fetch-npm-globals.sh # fetch into tmp/npm-globals/ # OUT_DIR=/some/path ./scripts/fetch-npm-globals.sh set -eu SCRIPT_DIR="$(dirname "$(realpath "$0")")" ROOT_DIR="$(dirname "$SCRIPT_DIR")" OUT_DIR="${OUT_DIR:-${ROOT_DIR}/tmp/npm-globals}" PACKAGES="@anthropic-ai/claude-code @google/gemini-cli @mariozechner/pi-coding-agent" if ! command -v npm >/dev/null 2>&1; then echo "ERROR: npm not found in PATH (install www/npm-node24)" >&2 exit 1 fi mkdir -p "$OUT_DIR" cd "$OUT_DIR" echo "==> Fetching npm-global tarballs into ${OUT_DIR}" for pkg in $PACKAGES; do echo " npm pack ${pkg}" # `npm pack ` downloads the latest published tarball without # installing it. Output is `-.tgz` (scoped names get # their slash flattened to a dash). npm pack "$pkg" >/dev/null done echo "" echo "==> Bundle contents:" ls -lh "$OUT_DIR"/*.tgz TOTAL=$(du -sh "$OUT_DIR" | cut -f1) echo "" echo "==> Total size: ${TOTAL}"