Files
penguin-harness/packages/web/e2e/run.sh
T
Yaowei Zheng 45bfae6e94 Initialize repository with harness code and assets
Initial import of all source code, config, and README assets: the
packages workspace (cli, core, server, web, docs, landing, skills),
build scripts, tooling config, and CI workflows.

Includes the data-layout revision made on this branch: the local data
root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the
installer keeps its binaries in ~/.penguin), and every Agent lives
under <project>/agents/<agent>/ — path helpers, the three
agent-enumeration scans, the system prompt, built-in Skills, tests
and docs all follow the new layout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
2026-07-19 14:06:53 +08:00

47 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# End-to-end verification (Playwright + mock LLM): build skills/core/server/web -> start mock Anthropic SSE ->
# start server (temp data root) -> run chat.spec.mjs. SKIP_BUILD=1 skips the build.
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd "$HERE/../../.." && pwd)"
DATA="$(mktemp -d)"
MOCK_PORT="${MOCK_PORT:-8931}"
SRV_PORT="${SRV_PORT:-8930}"
export BASE_URL="http://127.0.0.1:$SRV_PORT"
export MOCK_URL="http://127.0.0.1:$MOCK_PORT"
cleanup() {
[ -n "${MOCK_PID:-}" ] && kill "$MOCK_PID" 2>/dev/null
[ -n "${SRV_PID:-}" ] && kill "$SRV_PID" 2>/dev/null
rm -rf "$DATA"
}
trap cleanup EXIT
if [ "${SKIP_BUILD:-0}" != "1" ]; then
echo "== build skills/core/server/web =="
(cd "$ROOT" && pnpm --filter @prismshadow/penguin-skills build \
&& pnpm --filter @prismshadow/penguin-core build \
&& pnpm --filter @prismshadow/penguin-server build \
&& pnpm --filter @prismshadow/penguin-web build) || { echo "BUILD FAILED"; exit 1; }
fi
echo "== start mock LLM =="
MOCK_PORT=$MOCK_PORT node "$HERE/mock-llm.mjs" &
MOCK_PID=$!
echo "== start server =="
PENGUIN_HOME="$DATA" PORT=$SRV_PORT HOST=127.0.0.1 PENGUIN_WEB_DB="$DATA/web.db" \
PENGUIN_WEB_DIST="$ROOT/packages/web/dist" \
node "$ROOT/packages/server/dist/index.js" &
SRV_PID=$!
echo "== wait for server =="
for _ in $(seq 1 40); do
curl -sf "$BASE_URL/" >/dev/null 2>&1 && break
sleep 0.5
done
echo "== run playwright =="
cd "$ROOT/packages/web"
npx playwright test -c "$HERE/playwright.config.mjs"