From 00037993af84566663e519190d93065375f7e8c7 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Thu, 12 Nov 2026 19:38:08 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20carry=20dev.sh=20over=20=E2=80=94=20th?= =?UTF-8?q?e=20claw+UI=20debug=20loop=20from=20the=20old=20tree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unchanged: the paths are root-relative, so the script works as-is in the standalone workspace. --- scripts/dev.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 scripts/dev.sh diff --git a/scripts/dev.sh b/scripts/dev.sh new file mode 100755 index 0000000..a721519 --- /dev/null +++ b/scripts/dev.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +# Run the claw and the web UI together against scratch state — the quick +# debug loop. Nothing here touches your real rhema config or sessions: +# the daemon gets a throwaway config under $RHEMA_DEV_DIR (default +# /tmp/rhema-dev), persisted across runs so sessions survive a restart +# of the script; wipe the directory for a clean slate. +# +# Usage: +# scripts/dev.sh # real provider (CLAW_DEV_PROVIDER, key from +# # the provider's env var; default google) +# scripts/dev.sh --mock # zero credentials: canned streamed replies +# +# The UI proxies /v1 to the claw, so one URL matters: +# http://localhost:3000 +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +SCRATCH="${RHEMA_DEV_DIR:-/tmp/rhema-dev}" +PROVIDER="${CLAW_DEV_PROVIDER:-google}" + +MOCK=0 +for arg in "$@"; do + case "$arg" in + --mock) MOCK=1 ;; + *) echo "unknown argument: $arg (supported: --mock)" >&2; exit 2 ;; + esac +done + +mkdir -p "$SCRATCH/workspaces" + +CONFIG="$SCRATCH/claw.yaml" +if [ "$MOCK" = 1 ]; then + cat > "$CONFIG" <&2; exit 2 ;; + esac + if [ -n "$KEY_VAR" ] && [ -z "${!KEY_VAR:-}" ]; then + echo "set $KEY_VAR first (or run scripts/dev.sh --mock for zero credentials)" >&2 + exit 1 + fi + cat > "$CONFIG" </dev/null || true +} +trap cleanup EXIT + +echo "[dev] claw: http://127.0.0.1:7799 (config: $CONFIG)" +echo "[dev] ui: http://localhost:3000 (ctrl-c stops both)" +wait "$CLAW_PID"