From 54049a1e1efee5720fef0c3cce6dc1268030d148 Mon Sep 17 00:00:00 2001 From: zyl Date: Sun, 29 Mar 2026 21:36:55 +0800 Subject: [PATCH] tools: add sgclaw browser runtime entry wrapper --- tools/browser_runtime/sgclaw_browser_entry.sh | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tools/browser_runtime/sgclaw_browser_entry.sh diff --git a/tools/browser_runtime/sgclaw_browser_entry.sh b/tools/browser_runtime/sgclaw_browser_entry.sh new file mode 100755 index 0000000..cf0d585 --- /dev/null +++ b/tools/browser_runtime/sgclaw_browser_entry.sh @@ -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}" "$@"