tools: add sgclaw browser runtime entry wrapper

This commit is contained in:
zyl
2026-03-29 21:36:55 +08:00
parent 3844f2c34c
commit 54049a1e1e

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
CRATE_DIR="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
BIN_PATH="${CRATE_DIR}/target/debug/sgclaw"
MANIFEST_PATH="${CRATE_DIR}/Cargo.toml"
needs_build=0
if [[ ! -x "${BIN_PATH}" ]]; then
needs_build=1
elif [[ "${MANIFEST_PATH}" -nt "${BIN_PATH}" ]]; then
needs_build=1
elif [[ "${CRATE_DIR}/Cargo.lock" -nt "${BIN_PATH}" ]]; then
needs_build=1
elif find \
"${CRATE_DIR}/src" \
"${CRATE_DIR}/third_party/zeroclaw/src" \
"${CRATE_DIR}/../skill_lib" \
-type f -newer "${BIN_PATH}" -print -quit | grep -q .; then
needs_build=1
fi
if [[ "${needs_build}" -eq 1 ]]; then
cargo build --manifest-path "${MANIFEST_PATH}" --bin sgclaw
fi
exec "${BIN_PATH}" "$@"