2026-01-11 10:23:52 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
cd /repo
|
|
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
export OPENCLAW_STATE_DIR="/tmp/openclaw-test"
|
|
|
|
|
export OPENCLAW_CONFIG_PATH="${OPENCLAW_STATE_DIR}/openclaw.json"
|
2026-01-11 10:23:52 +00:00
|
|
|
|
2026-02-02 13:08:52 +00:00
|
|
|
echo "==> Build"
|
|
|
|
|
pnpm build
|
|
|
|
|
|
2026-01-11 10:23:52 +00:00
|
|
|
echo "==> Seed state"
|
2026-01-30 03:15:10 +01:00
|
|
|
mkdir -p "${OPENCLAW_STATE_DIR}/credentials"
|
|
|
|
|
mkdir -p "${OPENCLAW_STATE_DIR}/agents/main/sessions"
|
|
|
|
|
echo '{}' >"${OPENCLAW_CONFIG_PATH}"
|
|
|
|
|
echo 'creds' >"${OPENCLAW_STATE_DIR}/credentials/marker.txt"
|
|
|
|
|
echo 'session' >"${OPENCLAW_STATE_DIR}/agents/main/sessions/sessions.json"
|
2026-01-11 10:23:52 +00:00
|
|
|
|
|
|
|
|
echo "==> Reset (config+creds+sessions)"
|
2026-01-30 03:15:10 +01:00
|
|
|
pnpm openclaw reset --scope config+creds+sessions --yes --non-interactive
|
2026-01-11 10:23:52 +00:00
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
test ! -f "${OPENCLAW_CONFIG_PATH}"
|
|
|
|
|
test ! -d "${OPENCLAW_STATE_DIR}/credentials"
|
|
|
|
|
test ! -d "${OPENCLAW_STATE_DIR}/agents/main/sessions"
|
2026-01-11 10:23:52 +00:00
|
|
|
|
|
|
|
|
echo "==> Recreate minimal config"
|
2026-01-30 03:15:10 +01:00
|
|
|
mkdir -p "${OPENCLAW_STATE_DIR}/credentials"
|
|
|
|
|
echo '{}' >"${OPENCLAW_CONFIG_PATH}"
|
2026-01-11 10:23:52 +00:00
|
|
|
|
|
|
|
|
echo "==> Uninstall (state only)"
|
2026-01-30 03:15:10 +01:00
|
|
|
pnpm openclaw uninstall --state --yes --non-interactive
|
2026-01-11 10:23:52 +00:00
|
|
|
|
2026-01-30 03:15:10 +01:00
|
|
|
test ! -d "${OPENCLAW_STATE_DIR}"
|
2026-01-11 10:23:52 +00:00
|
|
|
|
|
|
|
|
echo "OK"
|