guardrail/scripts/serve_cockpit.sh
caelum0x 2d2b15c7fe feat: full guardrail-alpha system + CLI modularization + Vercel deploy config
- Rust engine: real bootstrap/wiring preflight (guardrail-agent), execution layer (retry/router/pre-trade/post-trade/reconciliation), guardrail-doctor diagnostics with allowlist-drift guard.

- guardrail-cli: extracted pure helpers into util.rs (split in progress).

- 6 Track-2 skills + ensemble; python-lab analytics (regime/drawdown/montecarlo/dossier/ensemble/journal/seed); clients (ts/py/go/mcp/langchain/web-lite/proof-verifier); alert relay; scenarios; helm/k8s/compose; docs.

- dashboard/vercel.json + docs/VERCEL_DEPLOY.md for Vercel deployment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:02:22 +03:00

44 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Serve the Guardrail web-lite cockpit (clients/web-lite) over a static HTTP
# server so it can be opened in a browser. Pure-static, no build step, offline.
#
# scripts/serve_cockpit.sh # serve on :8090, API http://localhost:8080
# scripts/serve_cockpit.sh 8095 # serve on :8095
# GUARDRAIL_API=http://localhost:8081 scripts/serve_cockpit.sh
#
# The cockpit (clients/web-lite/index.html) reads the API base from a `?api=`
# query param, so the printed URL wires it to GUARDRAIL_API automatically.
set -euo pipefail
cd "$(dirname "$0")/.."
PORT="${1:-${COCKPIT_PORT:-8090}}"
API_BASE="${GUARDRAIL_API:-http://localhost:8080}"
WEB_LITE_DIR="clients/web-lite"
if [ ! -f "$WEB_LITE_DIR/index.html" ]; then
echo "error: $WEB_LITE_DIR/index.html not found (run from the repo root)" >&2
exit 1
fi
if ! command -v python3 >/dev/null 2>&1; then
echo "error: python3 is required to serve the cockpit" >&2
exit 1
fi
COCKPIT_URL="http://localhost:${PORT}/index.html?api=${API_BASE}"
echo "============================================================"
echo "» Guardrail web-lite cockpit"
echo "============================================================"
echo " serving: $WEB_LITE_DIR on http://localhost:${PORT}"
echo " API base: $API_BASE"
echo
echo " Open the cockpit:"
echo " $COCKPIT_URL"
echo
echo " (Ctrl-C to stop)"
echo "============================================================"
exec python3 -m http.server "$PORT" --directory "$WEB_LITE_DIR"