---
name: pre-release-validation
description: 'Run comprehensive pre-release checks across one or more ByteLyst repos: build, typecheck, test, lint, security audit, and bundle analysis.'
argument-hint: 'Repos and depth, e.g. "learning_ai_efforise full", "all backends quick", "common_plat + flowmonk"'
agent: agent
---

# Pre-Release Validation Prompt

Execute a comprehensive pre-release validation workflow across ByteLyst repos with incremental fixes and commits.

## Context — ByteLyst Release Conventions

- **Build order:** common_plat packages → common_plat services → product backends → web/mobile
- **Commit after each fix:** Keep history clean, push after each phase
- **Commit format:** `fix(scope): <issue>`, `test(scope): fix failing tests`, `style(scope): format fixes`

## Validation Phases

### Phase 1: Common Platform (always first)

```bash
cd learning_ai_common_plat

# 1. Install & build
pnpm install && pnpm build

# 2. Type-check all packages and services
pnpm typecheck
# Fix → git add . && git commit -m "fix(common): type-check fixes" && git push

# 3. Run all tests
pnpm test
# Fix → git add . && git commit -m "test(common): fix failing tests" && git push

# 4. Security audit
pnpm audit
# Fix → git add . && git commit -m "fix(common): security updates" && git push
```

### Phase 2: Product Backend

```bash
cd <product>/backend

# 1. Install & build
pnpm install && pnpm build

# 2. Type-check
pnpm typecheck
# Fix → git commit -m "fix(backend): type-check fixes"

# 3. Tests
pnpm test
# Fix → git commit -m "test(backend): fix failing tests"

# 4. Verify health endpoint
# Start in background, test, stop:
pnpm dev &
sleep 3
curl -s http://localhost:<port>/health | jq .
kill %1
```

### Phase 3: Web Client

```bash
cd <product>/web  # or client/

# 1. Type-check
pnpm typecheck
# Fix → git commit -m "fix(web): type-check fixes"

# 2. Lint
pnpm lint
# Fix → git commit -m "fix(web): lint fixes"

# 3. Build (catches runtime issues)
pnpm build
# Fix → git commit -m "fix(web): build fixes"

# 4. Tests (if any)
pnpm test
# Fix → git commit -m "test(web): fix failing tests"
```

### Phase 4: Mobile (if applicable)

```bash
cd <product>/mobile

# 1. Type-check
pnpm typecheck
# Fix → git commit -m "fix(mobile): type-check fixes"

# 2. Tests (if any)
pnpm test
# Fix → git commit -m "test(mobile): fix failing tests"
```

### Phase 5: Integration Smoke Test

```bash
# Start all services
cd <product> && docker compose up -d
sleep 10

# Health checks
curl -s http://localhost:4003/health | jq .
curl -s http://localhost:<product-port>/health | jq .

# Basic auth flow
TOKEN=$(curl -s -X POST http://localhost:4003/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"test@test.com","password":"password"}' | jq -r '.token')

curl -s http://localhost:<product-port>/api/<endpoint> \
  -H "Authorization: Bearer $TOKEN" | jq .

# Cleanup
docker compose down
```

## Validation Matrix

Check all that apply:

| Check | Backend | Web | Mobile | Platform |
|-------|---------|-----|--------|----------|
| `pnpm install` | ☐ | ☐ | ☐ | ☐ |
| `pnpm build` | ☐ | ☐ | ☐ | ☐ |
| `pnpm typecheck` | ☐ | ☐ | ☐ | ☐ |
| `pnpm test` | ☐ | ☐ | ☐ | ☐ |
| `pnpm lint` | ☐ | ☐ | ☐ | ☐ |
| `pnpm audit` | ☐ | ☐ | ☐ | ☐ |
| Health endpoint | ☐ | — | — | ☐ |
| Auth flow | ☐ | ☐ | ☐ | ☐ |

## Report Format

```markdown
## Pre-Release Validation: <Product>

### Results
| Phase | Status | Issues Found | Issues Fixed | Commits |
|-------|--------|-------------|-------------|---------|
| Common Platform | ✅/❌ | N | N | hash1, hash2 |
| Backend | ✅/❌ | N | N | hash3 |
| Web | ✅/❌ | N | N | hash4 |
| Mobile | ✅/❌ | N | N | — |
| Integration | ✅/❌ | N | N | — |

### Blockers
- <any issues that couldn't be fixed>

### Ready for Release: ✅ YES / ❌ NO
```
