Pre-launch live mode: PEPPA_WEB_MODE=dev runs next dev (HMR) from the working copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Асель 2026-11-13 22:56:02 +05:00
parent 52d861bbc7
commit c4952b2011
2 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,8 @@ const version = (JSON.parse(readFileSync(new URL("../../package.json", import.me
const config: NextConfig = {
// Workspace packages ship TypeScript sources.
// `next dev` behind Traefik (pre-launch live mode): let the public host load dev assets and HMR.
allowedDevOrigins: ["peppa.telecom.quest"],
transpilePackages: ["@peppa/db", "@peppa/shared", "@peppa/core", "@peppa/runner", "@peppa/mcp"],
env: {
NEXT_PUBLIC_PEPPA_VERSION: version,

View File

@ -1,17 +1,23 @@
#!/usr/bin/env bash
# Installs Peppa's launchd agents (start at login, restart on crash):
# quest.telecom.peppa.watchdog — session watchdog under caffeinate -i (no idle sleep)
# quest.telecom.peppa.web — Next.js platform on :3100 (needs `pnpm --filter @peppa/web build`)
# quest.telecom.peppa.web — Next.js platform on :3100 (needs `pnpm --filter @peppa/web build`);
# PEPPA_WEB_MODE=dev runs `next dev` instead (HMR: edits in this
# checkout go live without build or release — the pre-launch setup)
# quest.telecom.peppa.bot — Telegram bot (TELEGRAM_BOT_TOKEN in .env)
# quest.telecom.peppa.release — Peppa's own prod releases (PEP-18): started by launchd while
# ~/.peppa/release-queue has requests (the PM's button)
# Prod runs from the release directory: ~/peppa/current/scripts/install-launchd.sh, so every
# path below (and PEPPA_ROOT for hooks and git config) is ~/peppa/current, not a release.
# Pre-launch (everything is dev): PEPPA_WEB_MODE=dev scripts/install-launchd.sh watchdog web bot
# from the working copy — no release agent, so nothing replaces what this checkout serves.
# Usage: scripts/install-launchd.sh [watchdog] [web] [bot] [release] (default: all)
# Remove: launchctl bootout gui/$(id -u)/<label> && rm ~/Library/LaunchAgents/<label>.plist
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PEPPA_HOME="${PEPPA_HOME:-$HOME/.peppa}"
WEB_MODE="${PEPPA_WEB_MODE:-start}"
case "$WEB_MODE" in start|dev) ;; *) echo "PEPPA_WEB_MODE must be start or dev" >&2; exit 1 ;; esac
mkdir -p "$HOME/Library/LaunchAgents" "$PEPPA_HOME"
PATH_ENV="$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
# Bot and watchdog run TypeScript straight from source with Node's type stripping (PEP-36):
@ -76,7 +82,7 @@ for s in "${SERVICES[@]}"; do
/usr/bin/caffeinate -i "$ROOT/packages/cli/bin/peppa" watchdog ;;
web)
install_agent quest.telecom.peppa.web web.log "$ROOT/apps/web" \
/bin/bash -c "set -a; . '$ROOT/.env'; set +a; exec '$ROOT/apps/web/node_modules/.bin/next' start -p 3100" ;;
/bin/bash -c "set -a; . '$ROOT/.env'; set +a; exec '$ROOT/apps/web/node_modules/.bin/next' $WEB_MODE -p 3100" ;;
bot)
install_agent quest.telecom.peppa.bot bot.log "$ROOT" "$ROOT/apps/bot/bin/peppa-bot" ;;
release)