mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
7012a7e07b
Canonical template at showcase/starters/template/ with Sales Dashboard hero page, 5 GenUI rendering strategies, per-language Dockerfiles (non-root user, agent health checks), and self-contained agent backends. Generation script at showcase/scripts/generate-starters.ts: - Python sys.path.insert removal + relative import rewriting - TypeScript shared-tools import rewriting - Deterministic output (sorted devDependencies, stable file ordering) - --check mode for CI drift detection - Strict error handling (throws on missing required inputs) 537 tests: generation unit tests (transform functions, entrypoint blocks), cross-starter consistency checks (270), Playwright e2e interaction tests (renderer switching, deal creation, suggestion verification).
52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Template variables (substituted by generate-starters.ts):
|
|
# SLUG — framework slug (e.g. "langgraph-python")
|
|
# DEV_SCRIPT_BLOCK — language-specific agent startup block
|
|
set -e
|
|
|
|
cleanup() {
|
|
kill $AGENT_PID $NEXTJS_PID 2>/dev/null
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
echo "========================================="
|
|
echo "[entrypoint] Starting showcase: {{SLUG}}"
|
|
echo "[entrypoint] Time: $(date -u)"
|
|
echo "[entrypoint] PORT=${PORT:-not set}"
|
|
echo "[entrypoint] NODE_ENV=${NODE_ENV:-not set}"
|
|
echo "========================================="
|
|
|
|
# Check critical env vars
|
|
if [ -z "$OPENAI_API_KEY" ]; then
|
|
echo "[entrypoint] WARNING: OPENAI_API_KEY is not set! Agent will fail."
|
|
else
|
|
echo "[entrypoint] OPENAI_API_KEY: set (${#OPENAI_API_KEY} chars)"
|
|
fi
|
|
|
|
{{DEV_SCRIPT_BLOCK}}
|
|
|
|
echo "========================================="
|
|
echo "[entrypoint] Starting Next.js frontend on port ${PORT:-10000}..."
|
|
echo "========================================="
|
|
|
|
PORT=${PORT:-10000}
|
|
npx next start --port $PORT 2>&1 | sed 's/^/[nextjs] /' &
|
|
NEXTJS_PID=$!
|
|
|
|
echo "[entrypoint] Next.js started (PID: $NEXTJS_PID)"
|
|
echo "[entrypoint] Both processes running. Waiting..."
|
|
|
|
wait -n $AGENT_PID $NEXTJS_PID
|
|
EXIT_CODE=$?
|
|
if ! kill -0 $AGENT_PID 2>/dev/null; then
|
|
echo "[entrypoint] Agent process (PID: $AGENT_PID) exited with code $EXIT_CODE"
|
|
elif ! kill -0 $NEXTJS_PID 2>/dev/null; then
|
|
echo "[entrypoint] Next.js process (PID: $NEXTJS_PID) exited with code $EXIT_CODE"
|
|
else
|
|
echo "[entrypoint] A process exited with code $EXIT_CODE"
|
|
fi
|
|
|
|
# Clean up surviving process
|
|
kill $AGENT_PID $NEXTJS_PID 2>/dev/null
|
|
exit $EXIT_CODE
|