fix(build): resolve shared npm snippet via COLIBRI_REPO + preflight it

PR #92 wired the ISO to the shared clawdie-npm-profile.sh but hardcoded
${SCRIPT_DIR}/../colibri and had no existence guard. Every other colibri
consumer in build.sh resolves through resolve_colibri_paths (default
/home/clawdie/ai/colibri, honoring COLIBRI_REPO), so the hardcoded path
diverged from the real build-host layout and ignored the override; a
missing file let cat fail silently into a half-written snippet.

Now: resolve via resolve_colibri_paths and preflight the file with a
clear error pointing at COLIBRI_REPO, matching preflight_colibri_artifacts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Sam & Claude 2026-06-21 16:39:25 +02:00
parent 4a43e6d0d6
commit eec69caa5f

View file

@ -1467,9 +1467,18 @@ EOF
mkdir -p "${MOUNT_POINT}/home/clawdie" "${MOUNT_POINT}/etc/profile.d" "${MOUNT_POINT}/etc/skel"
# Install the canonical npm-global profile snippet (shared with agent-jail-bootstrap.sh).
# The snippet lives in colibri; resolve its repo the same way every other
# colibri consumer here does so COLIBRI_REPO overrides are honored.
resolve_colibri_paths
_npm_profile_src="${_resolved_colibri_repo}/packaging/freebsd/clawdie-npm-profile.sh"
if [ ! -f "${_npm_profile_src}" ]; then
echo "ERROR: shared npm profile snippet missing: ${_npm_profile_src}"
echo " It ships in colibri packaging/freebsd/. Set COLIBRI_REPO=/path/to/colibri."
exit 1
fi
{
printf 'NPM_PREFIX="/opt/clawdie/npm-global"\n'
cat "${SCRIPT_DIR}/../colibri/packaging/freebsd/clawdie-npm-profile.sh"
cat "${_npm_profile_src}"
} > "${MOUNT_POINT}/etc/profile.d/clawdie-npm.sh"
chmod 0644 "${MOUNT_POINT}/etc/profile.d/clawdie-npm.sh"