nix-openclaw/nix/scripts/check-package-contents.sh
joshp123 0b25e889a5 fix: keep dogfood public surface hardlink-safe
Dogfood now points at an OpenClaw commit with the broader plugin hardlink work merged, but the bundled public-surface loader still needs nix-openclaw's package-root hardlink compatibility patch. Keep that patch active for dogfood and add a package-content check that fails if the compiled loader rejects hardlinked package files again.

Tests: nix fmt --accept-flake-config; git diff --check; remote mac-mini nix build .#checks.aarch64-darwin.package-contents-dogfood --no-link; remote mac-mini nix build .#checks.aarch64-darwin.package-contents --no-link; remote mac-mini nix build .#checks.aarch64-darwin.default-instance --no-link

Co-authored-by: Codex <noreply@openai.com>
2026-05-09 01:30:55 +08:00

71 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
set -eu
if [ -z "${OPENCLAW_GATEWAY:-}" ]; then
echo "OPENCLAW_GATEWAY is not set" >&2
exit 1
fi
root="${OPENCLAW_GATEWAY}/lib/openclaw"
require_path() {
if [ ! -e "$1" ]; then
echo "Missing: $1" >&2
exit 1
fi
}
require_path "${root}/extensions"
require_path "${root}/extensions/memory-core"
require_path "${root}/extensions/memory-core/openclaw.plugin.json"
require_path "${root}/dist/extensions/memory-core/openclaw.plugin.json"
require_path "${root}/dist-runtime/extensions"
require_path "${root}/dist-runtime/extensions/memory-core/openclaw.plugin.json"
require_path "${root}/dist-runtime/extensions/acpx/openclaw.plugin.json"
require_path "${root}/dist-runtime/extensions/acpx/package.json"
require_path "${root}/dist-runtime/extensions/acpx/index.js"
require_path "${root}/dist-runtime/extensions/acpx/error-format.mjs"
require_path "${root}/dist-runtime/extensions/acpx/mcp-command-line.mjs"
require_path "${root}/dist-runtime/extensions/acpx/mcp-proxy.mjs"
require_path "${root}/docs/reference/templates"
require_path "${root}/docs/reference/templates/AGENTS.md"
require_path "${root}/docs/reference/templates/SOUL.md"
require_path "${root}/docs/reference/templates/TOOLS.md"
require_path "${root}/skills"
require_path "${root}/node_modules/hasown"
require_path "${root}/node_modules/combined-stream"
public_surface_loader="$(
grep -Rsl "function loadBundledPluginPublicArtifactModuleSync" "${root}/dist" | head -1
)"
if [ -z "$public_surface_loader" ]; then
echo "Missing bundled plugin public surface loader" >&2
exit 1
fi
if grep -q "rejectHardlinks: true" "$public_surface_loader"; then
echo "Bundled plugin public surface loader still rejects hardlinked package files" >&2
exit 1
fi
require_js_alias_target() {
alias="$1"
alias_path="${root}/dist/${alias}"
require_path "$alias_path"
target="$(sed -n 's/^export \* from "\.\/\(.*\)";$/\1/p' "$alias_path" | head -1)"
if [ -z "$target" ]; then
echo "Alias has no export target: $alias_path" >&2
exit 1
fi
require_path "${root}/dist/${target}"
}
require_js_alias_target "runtime-model-auth.runtime.js"
if ! find "${root}/skills" -name SKILL.md -type f | grep -q .; then
echo "Missing bundled SKILL.md files under ${root}/skills" >&2
exit 1
fi
echo "openclaw package contents: ok"