---
name: deploy-checker
description: Pre-deploy validation. Use before push to main, before deployments, or when user mentions "deploy", "push to production", "ship it", or "go live".
---

## When Invoked

Run all checks in sequence. Stop at first critical failure.

## Check Pipeline

### 1. Build Check
```bash
npm run build 2>&1
```
- Zero errors required
- Warnings acceptable but note them

### 2. Type Check
```bash
npx tsc --noEmit 2>&1
```
- Zero type errors required
- Strict mode must pass

### 3. Lint Check
```bash
npm run lint 2>&1
```
- Zero errors required
- Warnings acceptable in non-critical paths

### 4. Test Check
```bash
npm run test -- --run 2>&1
```
- All tests must pass
- Note any skipped tests

### 5. Security Scan
```bash
# Check for secrets in staged files
git diff --cached --name-only | while read f; do
  grep -l "sk_live\|SUPABASE_SERVICE\|password.*=\|token.*=" "$f" 2>/dev/null
done

# Check for exposed env vars
grep -r "process.env\." --include="*.tsx" --include="*.ts" -l | grep -v "server\|action\|api\|config"
```

### 6. Dependency Check
```bash
npm audit --production 2>&1 | tail -5
```
- No critical vulnerabilities

### 7. Database Check (if migrations exist)
```bash
# Check for unapplied migrations
ls -la supabase/migrations/ | tail -5
# Verify RLS on all tables (Supabase MCP)
```

### 8. Git Hygiene
```bash
git status
git log --oneline -5
```
- No uncommitted changes
- Commit messages follow conventional format
- No merge conflicts

## Output Format

```
## Deploy Check Results

| Check | Status | Details |
|-------|--------|---------|
| Build | PASS/FAIL | |
| Types | PASS/FAIL | |
| Lint | PASS/FAIL | X warnings |
| Tests | PASS/FAIL | X passed, Y skipped |
| Security | PASS/FAIL | |
| Dependencies | PASS/FAIL | |
| Database | PASS/FAIL | |
| Git | PASS/FAIL | |

## Verdict: READY TO SHIP / BLOCKED

### Blockers (if any)
1. [Critical issue that must be fixed]

### Warnings (non-blocking)
1. [Issue to be aware of]
```

If all checks pass: "All clear. Ship it."
If any critical failure: "BLOCKED. Fix [issue] before deploying."
