feat: expand wizard setup flow

This commit is contained in:
Peter Steinberger
2026-01-01 19:14:14 +01:00
parent 850cbfe369
commit a72fdf7c26
15 changed files with 1201 additions and 30 deletions

View File

@@ -10,23 +10,115 @@ docker build -t "$IMAGE_NAME" -f "$ROOT_DIR/scripts/e2e/Dockerfile" "$ROOT_DIR"
echo "Running onboarding E2E..."
docker run --rm -t "$IMAGE_NAME" bash -lc '
set -euo pipefail
export TERM=xterm-256color
node dist/index.js onboard \
--non-interactive \
--mode local \
--workspace /root/clawd \
--auth-choice skip \
--gateway-port 18789 \
--gateway-bind loopback \
--gateway-auth off \
--tailscale off \
--skip-skills \
--skip-health \
--json
input_fifo="$(mktemp -u /tmp/clawdis-onboard-input.XXXXXX)"
mkfifo "$input_fifo"
script -q -c "node dist/index.js onboard" /dev/null < "$input_fifo" &
wizard_pid=$!
exec 3> "$input_fifo"
send() {
local payload="$1"
local delay="${2:-0.4}"
sleep "$delay"
printf "%b" "$payload" >&3
}
send $'"'"'\r'"'"' 0.8
send $'"'"'\r'"'"' 0.6
send $'"'"'\e[B\e[B\e[B\r'"'"' 0.6
send $'"'"'\r'"'"' 0.4
send $'"'"'\r'"'"' 0.4
send $'"'"'\r'"'"' 0.4
send $'"'"'\r'"'"' 0.4
send $'"'"'n\r'"'"' 0.4
send $'"'"'n\r'"'"' 0.4
send $'"'"'n\r'"'"' 0.4
exec 3>&-
wait "$wizard_pid"
rm -f "$input_fifo"
workspace_dir="$HOME/clawd"
config_path="$HOME/.clawdis/clawdis.json"
sessions_dir="$HOME/.clawdis/sessions"
if [ ! -f "$config_path" ]; then
echo "Missing config: $config_path"
exit 1
fi
for file in AGENTS.md BOOTSTRAP.md IDENTITY.md SOUL.md TOOLS.md USER.md; do
if [ ! -f "$workspace_dir/$file" ]; then
echo "Missing workspace file: $workspace_dir/$file"
exit 1
fi
done
if [ ! -d "$sessions_dir" ]; then
echo "Missing sessions dir: $sessions_dir"
exit 1
fi
CONFIG_PATH="$config_path" WORKSPACE_DIR="$workspace_dir" node --input-type=module - <<'"'"'NODE'"'"'
import fs from "node:fs";
import JSON5 from "json5";
const cfg = JSON5.parse(fs.readFileSync(process.env.CONFIG_PATH, "utf-8"));
const expectedWorkspace = process.env.WORKSPACE_DIR;
const errors = [];
if (cfg?.agent?.workspace !== expectedWorkspace) {
errors.push(`agent.workspace mismatch (got ${cfg?.agent?.workspace ?? "unset"})`);
}
if (cfg?.gateway?.mode !== "local") {
errors.push(`gateway.mode mismatch (got ${cfg?.gateway?.mode ?? "unset"})`);
}
if (cfg?.gateway?.bind !== "loopback") {
errors.push(`gateway.bind mismatch (got ${cfg?.gateway?.bind ?? "unset"})`);
}
if ((cfg?.gateway?.tailscale?.mode ?? "off") !== "off") {
errors.push(
`gateway.tailscale.mode mismatch (got ${cfg?.gateway?.tailscale?.mode ?? "unset"})`,
);
}
if (!cfg?.wizard?.lastRunAt) {
errors.push("wizard.lastRunAt missing");
}
if (!cfg?.wizard?.lastRunVersion) {
errors.push("wizard.lastRunVersion missing");
}
if (cfg?.wizard?.lastRunCommand !== "onboard") {
errors.push(
`wizard.lastRunCommand mismatch (got ${cfg?.wizard?.lastRunCommand ?? "unset"})`,
);
}
if (cfg?.wizard?.lastRunMode !== "local") {
errors.push(
`wizard.lastRunMode mismatch (got ${cfg?.wizard?.lastRunMode ?? "unset"})`,
);
}
if (errors.length > 0) {
console.error(errors.join("\n"));
process.exit(1);
}
NODE
node dist/index.js gateway-daemon --port 18789 --bind loopback > /tmp/gateway.log 2>&1 &
GW_PID=$!
sleep 2
for _ in $(seq 1 10); do
if grep -q "listening on ws://127.0.0.1:18789" /tmp/gateway.log; then
break
fi
sleep 1
done
if ! grep -q "listening on ws://127.0.0.1:18789" /tmp/gateway.log; then
cat /tmp/gateway.log
exit 1
fi
node dist/index.js health --timeout 2000 || (cat /tmp/gateway.log && exit 1)