Files
multica/scripts/dev.sh
d0bd6683f1 MUL-5733: keep Go security patches current (#6409)
* fix(release): keep Go security patches current

Co-authored-by: multica-agent <github@multica.ai>

* fix(release): address vulnerability review

Co-authored-by: multica-agent <github@multica.ai>

* fix(release): restrict vulnerability bypass

Co-authored-by: multica-agent <github@multica.ai>

* fix(release): require Go 1.26.6

Co-authored-by: multica-agent <github@multica.ai>

* docs: align Go prerequisite with security floor

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: Eve <eve@multica-ai.local>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: Sol-Boy <sol-boy@multica-ai.local>
2026-08-17 16:18:53 +08:00

69 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"
# ---------- Check prerequisites ----------
missing=()
command -v node >/dev/null 2>&1 || missing+=("node")
command -v pnpm >/dev/null 2>&1 || missing+=("pnpm")
command -v go >/dev/null 2>&1 || missing+=("go")
command -v docker >/dev/null 2>&1 || missing+=("docker")
if [ ${#missing[@]} -gt 0 ]; then
echo "✗ Missing prerequisites: ${missing[*]}"
echo " Please install: Node.js 22, pnpm 10.28.2, Go 1.26.6, Docker"
exit 1
fi
# ---------- Environment file ----------
if [ -f .git ]; then
# Inside a git worktree (.git is a file, not a directory)
ENV_FILE=".env.worktree"
if [ ! -f "$ENV_FILE" ]; then
echo "==> Worktree detected. Generating $ENV_FILE..."
bash scripts/init-worktree-env.sh "$ENV_FILE"
fi
else
ENV_FILE=".env"
if [ ! -f "$ENV_FILE" ]; then
echo "==> Creating $ENV_FILE from .env.example..."
cp .env.example "$ENV_FILE"
fi
fi
echo "==> Using $ENV_FILE"
set -a
# shellcheck disable=SC1090
. "$ENV_FILE"
set +a
# shellcheck disable=SC1091
. scripts/local-env.sh
# ---------- Install dependencies ----------
if [ ! -d node_modules ]; then
echo "==> Installing dependencies..."
pnpm install
fi
# ---------- Database ----------
bash scripts/ensure-postgres.sh "$ENV_FILE"
echo "==> Running migrations..."
(cd server && go run ./cmd/migrate up)
# ---------- Start services ----------
echo ""
echo "✓ Ready. Starting services..."
echo " Backend: http://localhost:${PORT:-8080}"
echo " Frontend: http://localhost:${FRONTEND_PORT:-3000}"
echo ""
trap 'kill 0' EXIT
(cd server && go run ./cmd/server) &
pnpm dev:web &
wait