diff --git a/coder/cloudflare-worker/main.tf b/coder/cloudflare-worker/main.tf index 9e1a90b..cceb92f 100644 --- a/coder/cloudflare-worker/main.tf +++ b/coder/cloudflare-worker/main.tf @@ -460,25 +460,31 @@ resource "coder_agent" "main" { # Switch to develop branch if it exists git fetch origin develop 2>/dev/null && git checkout develop 2>/dev/null || true - # Install deps if package.json exists - if [ -f package.json ]; then - npm ci --legacy-peer-deps || npm ci - fi + # Lightweight stages only need the code, not a full build + LIGHT_STAGES="analyse architect release maintenance" + if echo "$LIGHT_STAGES" | grep -qw "$TASK_TYPE"; then + echo "Lightweight stage ($TASK_TYPE) — skipping build" + else + # Install deps if package.json exists + if [ -f package.json ]; then + npm ci --legacy-peer-deps || npm ci + fi - # Install frontend deps if present - if [ -f frontend/package.json ]; then - cd frontend && npm ci && cd .. - npm run build:frontend 2>/dev/null || true - fi + # Install frontend deps if present + if [ -f frontend/package.json ]; then + cd frontend && npm ci && cd .. + npm run build:frontend 2>/dev/null || true + fi - # Install Playwright if needed - if grep -q "playwright" package.json 2>/dev/null; then - npx playwright install chromium - fi + # Install Playwright if needed + if grep -q "playwright" package.json 2>/dev/null; then + npx playwright install chromium + fi - # Apply local migrations if script exists - if npm run --silent db:migrate:local 2>/dev/null; then - echo "Local migrations applied" + # Apply local migrations if script exists + if npm run --silent db:migrate:local 2>/dev/null; then + echo "Local migrations applied" + fi fi fi