Replace scattered API_URL, MAIN_VITE_API_URL, and RENDERER_VITE_API_URL with a single MULTICA_API_URL across all apps and packages. - Desktop: use envPrefix to expose MULTICA_* to main process, rename RENDERER_VITE_API_URL → RENDERER_VITE_MULTICA_API_URL, remove MAIN_VITE_API_URL (now read directly via MULTICA_API_URL) - Web: add .env.development with MULTICA_API_URL, enforce required check in next.config.ts, update .gitignore to allow .env.development - Core: make MULTICA_API_URL required in api-client (no silent fallback) - Scripts: pass MULTICA_API_URL in dev-local.sh for web process - Turbo: update globalEnv from API_URL to MULTICA_API_URL - Docs: update references to the new env var name Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
2 KiB
Bash
Executable file
56 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# Local development: Gateway (with Telegram bot) + Desktop + Web (for login)
|
|
#
|
|
# Usage:
|
|
# pnpm dev:local
|
|
#
|
|
# Reads TELEGRAM_BOT_TOKEN from .env at the repo root.
|
|
# Gateway runs on port 4000 in long-polling mode (no TELEGRAM_WEBHOOK_URL needed).
|
|
# Web app runs on port 3000 (default) for OAuth login flow.
|
|
# Desktop connects to the local Gateway and uses local Web for login.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
ROOT_DIR="$SCRIPT_DIR/.."
|
|
ENV_FILE="$ROOT_DIR/.env"
|
|
|
|
# Load .env
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
echo "Error: .env file not found at $ENV_FILE"
|
|
echo "Copy .env.example to .env and fill in TELEGRAM_BOT_TOKEN"
|
|
exit 1
|
|
fi
|
|
|
|
set -a
|
|
source "$ENV_FILE"
|
|
set +a
|
|
|
|
if [ -z "${TELEGRAM_BOT_TOKEN:-}" ]; then
|
|
echo "Error: TELEGRAM_BOT_TOKEN not set in .env"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Starting local dev environment..."
|
|
echo " Gateway: http://localhost:4000 (Telegram long-polling mode)"
|
|
echo " Web: http://localhost:3000 (OAuth login)"
|
|
echo " Desktop: connecting to local Gateway + Web"
|
|
echo " Data dir: ~/.super-multica-dev (isolated from production)"
|
|
echo " Workspace: ~/Documents/Multica-dev (isolated from production)"
|
|
echo ""
|
|
|
|
# Build shared packages first
|
|
pnpm turbo build --filter=@multica/types --filter=@multica/utils --filter=@multica/core
|
|
|
|
# Start everything
|
|
# Gateway uses PORT=4000 to avoid conflict with Web app on port 3000
|
|
exec pnpm concurrently \
|
|
-n types,utils,core,gateway,web,desktop \
|
|
-c blue,green,yellow,magenta,red,cyan \
|
|
"pnpm --filter @multica/types dev" \
|
|
"pnpm --filter @multica/utils dev" \
|
|
"pnpm --filter @multica/core dev" \
|
|
"PORT=4000 SMC_DATA_DIR=~/.super-multica-dev MULTICA_WORKSPACE_DIR=~/Documents/Multica-dev MULTICA_RUN_LOG=1 pnpm --filter @multica/gateway dev" \
|
|
"MULTICA_API_URL=https://api-dev.copilothub.ai pnpm --filter @multica/web dev" \
|
|
"GATEWAY_URL=http://localhost:4000 MAIN_VITE_WEB_URL=http://localhost:3000 SMC_DATA_DIR=~/.super-multica-dev MULTICA_WORKSPACE_DIR=~/Documents/Multica-dev MULTICA_RUN_LOG=1 pnpm --filter @multica/desktop dev"
|