Files
openclaw/scripts/materialize-clawhub-cli.sh
T
Peter Steinberger 2abecd703d chore(deps): refresh dependencies with a seven-day cutoff (#157238)
* chore(deps): refresh dependencies with a seven-day cutoff

* fix(deps): preserve Teams and jsdom integration contracts

Use the Teams SDK public token and processing APIs while keeping SSO sender
checks ahead of native token operations. Remove obsolete ambient declarations
and route workarounds, and cover the SDK routing with real processing tests.

Adapt the test environment to jsdom private-field bindings, preserve file bytes
and registry cleanup, and preload it through native Node and Bun workers.

* fix(test): preserve jsdom window and fixture contracts

* fix(ci): keep typecheck cache reuse within matching inputs
2026-09-25 02:38:45 +00:00

72 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
source_root="${1:?trusted ClawHub CLI source root is required}"
destination="${2:?ClawHub CLI destination is required}"
github_output="${3:-}"
package_json="${source_root}/package.json"
package_lock="${source_root}/package-lock.json"
expected_lock_sha256="51697f066d0e063798930355232294bad2b8f68100601432474a7fac43aeef51"
expected_clawhub_integrity="sha512-VwM6FQrZVarFRDiEqG42npUeyCu/iLhPnpO+b7kKIGRXv+TA6Lb8pboHnIgT6cmjFEnW3j/pTbshWeDQMQ7QWQ=="
test -f "${package_json}"
test -f "${package_lock}"
if [[ -e "${destination}" || -L "${destination}" ]]; then
echo "ClawHub CLI destination must not already exist: ${destination}" >&2
exit 1
fi
install -d -m 0700 "${destination}"
install -m 0600 "${package_json}" "${destination}/package.json"
install -m 0600 "${package_lock}" "${destination}/package-lock.json"
lock_sha256="$(
CLAWHUB_CLI_LOCK="${package_lock}" \
node -e "const { createHash } = require('node:crypto'); const { readFileSync } = require('node:fs'); process.stdout.write(createHash('sha256').update(readFileSync(process.env.CLAWHUB_CLI_LOCK)).digest('hex'));"
)"
[[ "${lock_sha256}" == "${expected_lock_sha256}" ]] || {
echo "Pinned ClawHub CLI lock SHA-256 mismatch." >&2
exit 1
}
clawhub_integrity="$(
CLAWHUB_CLI_LOCK="${package_lock}" \
node -p "require(require('node:path').resolve(process.env.CLAWHUB_CLI_LOCK)).packages['node_modules/clawhub'].integrity"
)"
[[ "${clawhub_integrity}" == "${expected_clawhub_integrity}" ]] || {
echo "Pinned ClawHub CLI integrity mismatch." >&2
exit 1
}
# npm 12 misvalidates the lockfile root when this project is selected with --prefix.
# Running inside the copied project keeps its committed root metadata authoritative.
(
cd "${destination}"
npm ci \
--ignore-scripts \
--no-audit \
--no-fund \
--omit=dev
)
clawhub_version="$(
CLAWHUB_CLI_ROOT="${destination}" \
node -p "require(require('node:path').join(process.env.CLAWHUB_CLI_ROOT, 'node_modules/clawhub/package.json')).version"
)"
[[ "${clawhub_version}" == "0.23.3" ]] || {
echo "Pinned ClawHub CLI version mismatch: ${clawhub_version}" >&2
exit 1
}
test -x "${destination}/node_modules/.bin/clawhub"
clawhub_cli="${destination}/node_modules/.bin/clawhub"
echo "Materialized clawhub@${clawhub_version} from lock ${lock_sha256}."
if [[ -n "${github_output}" ]]; then
{
echo "cli=${clawhub_cli}"
echo "integrity=${clawhub_integrity}"
echo "lock_sha256=${lock_sha256}"
echo "version=${clawhub_version}"
} >> "${github_output}"
fi