mirror of
https://github.com/okxlin/release-factory.git
synced 2026-10-06 08:01:57 +00:00
Replace platform-specific npm package resolution with the meta-package oh-my-opencode and OH_MY_OPENCODE_FORCE_BASELINE=1 env export. The meta-package's JS wrapper handles baseline binary selection, avoiding npm exec binary-not-found errors with platform-specific packages while still supporting non-AVX2 hosts. Also works around the OMO_PACKAGE env var leakage issue by making resolver always output the meta-package name. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
57 lines
1.7 KiB
Bash
Executable File
57 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
mapfile -t _omo_lines < <(bash "${SCRIPT_DIR}/resolve-omo-package.sh")
|
|
omo_package="${_omo_lines[0]}"
|
|
_needs_baseline="${_omo_lines[1]:-0}"
|
|
unset _omo_lines
|
|
if [[ "${_needs_baseline}" == "1" ]]; then
|
|
export OH_MY_OPENCODE_FORCE_BASELINE=1
|
|
fi
|
|
|
|
status=0
|
|
|
|
printf '[smoke] checking required commands\n'
|
|
for cmd in node npm bun python3 git sqlite3 rg fd gh jq gcc g++ make; do
|
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
printf '[smoke] missing command: %s\n' "$cmd" >&2
|
|
status=1
|
|
fi
|
|
done
|
|
|
|
printf '[smoke] checking OpenCode\n'
|
|
if command -v opencode >/dev/null 2>&1; then
|
|
opencode --version
|
|
else
|
|
printf '[smoke] opencode not installed yet; run bootstrap script\n' >&2
|
|
status=1
|
|
fi
|
|
|
|
printf '[smoke] checking runtime mode\n'
|
|
case "${OPENCODE_RUNTIME_MODE:-acp}" in
|
|
acp)
|
|
printf '[smoke] runtime=acp target=%s:%s\n' "${ACP_HOST:-0.0.0.0}" "${ACP_PORT:-8765}"
|
|
;;
|
|
serve)
|
|
printf '[smoke] runtime=serve target=%s:%s\n' "${SERVE_HOST:-0.0.0.0}" "${SERVE_PORT:-4096}"
|
|
;;
|
|
*)
|
|
printf '[smoke] unsupported OPENCODE_RUNTIME_MODE: %s\n' "${OPENCODE_RUNTIME_MODE}" >&2
|
|
status=1
|
|
;;
|
|
esac
|
|
|
|
printf '[smoke] checking oh-my-opencode resolver\n'
|
|
printf '[smoke] selected oh-my-opencode package: %s\n' "${omo_package}"
|
|
if ! npm exec --yes --package="${omo_package}" -- oh-my-opencode --help >/dev/null; then
|
|
status=1
|
|
fi
|
|
|
|
printf '[smoke] checking runtime scripts\n'
|
|
for script in /app/scripts/entrypoint.sh /app/scripts/bootstrap-opencode-userland.sh /app/scripts/install-oh-my-opencode.sh /app/scripts/doctor.sh /app/scripts/start-opencode-runtime.sh; do
|
|
[[ -f "$script" ]] || { printf '[smoke] missing %s\n' "$script" >&2; status=1; }
|
|
done
|
|
|
|
exit "${status}"
|