---
description: Run E2E runtime verification against a project (M7)
argument-hint: "[project-path: defaults to .]"
allowed-tools: Bash, Read, Write, Glob, Grep
---

Run runtime verification to ensure the app actually works, not just compiles.

## Steps

1. **Validate project path**
   - Default to `.` if no argument provided
   - Confirm the path exists and contains a recognizable framework

2. **Detect framework**
   - Use `runtime_detect` MCP tool if available
   - Otherwise: check for Next.js, Vite, Express, FastAPI, Flask, Django, Rails
   - Display detected framework and confidence

3. **Discover golden path flows**
   - Look for `.vaspera/flows/*.yaml`
   - If no flows exist, offer to generate sample flow

4. **Launch the application**
   - Use `runtime_launch` MCP tool if available
   - Otherwise: run `npm run dev` or detected dev command
   - Wait for health check to pass
   - Display startup time and URL

5. **Run golden path flows**
   - Execute each flow in priority order (critical → high → medium → low)
   - For each flow, report:
     - Flow name and priority
     - Steps passed/failed
     - Duration
   - Stop on critical flow failure

6. **Calculate runtime score**
   - Score formula: weighted average of flow results
     - Critical flows: weight 3
     - High flows: weight 2
     - Medium flows: weight 1.5
     - Low flows: weight 1

7. **Stop the application**
   - Gracefully terminate the dev server
   - Confirm cleanup

8. **Present results**
   ```
   Runtime Verification Results
   ============================
   Framework: Next.js (confidence: 95%)
   Startup Time: 2.3s
   App URL: http://localhost:3000

   Golden Path Flows:
   ┌────────────────────┬──────────┬──────────┬──────────┐
   │ Flow               │ Priority │ Status   │ Duration │
   ├────────────────────┼──────────┼──────────┼──────────┤
   │ checkout           │ critical │ ✅ PASS  │ 1.2s     │
   │ user-registration  │ high     │ ✅ PASS  │ 0.8s     │
   │ profile-update     │ medium   │ ❌ FAIL  │ 0.5s     │
   └────────────────────┴──────────┴──────────┴──────────┘

   Runtime Score: 75/100

   Certification Level: APPROVED (70-89)
   → Ship with monitoring
   ```

9. **Write verification report**
   - Create `.vaspera/runtime/` directory if needed
   - Write to `.vaspera/runtime/{ISO-timestamp}.json`

## Golden Path Flow Format

Flows are defined in `.vaspera/flows/*.yaml`:

```yaml
name: "checkout"
description: "Verify checkout flow works"
priority: critical
tags:
  - smoke
  - e2e

steps:
  - action: navigate
    url: "/"
  - action: click
    selector: "[data-testid='add-to-cart']"
  - action: fill
    selector: "#email"
    value: "test@example.com"
  - action: api
    url: "/api/checkout"
    method: POST
  - action: assert
    url: "/confirmation"
```

## Certification Levels

| Score | Level | Recommendation |
|-------|-------|----------------|
| 90-100 | CERTIFIED | Ship to production |
| 70-89 | APPROVED | Ship with monitoring |
| 40-69 | REVIEW_REQUIRED | Fix before shipping |
| 0-39 | BLOCKED | Critical issues |

## Important

- This skill launches the dev server — ensure port is available
- Playwright integration for DOM actions is planned but not yet available
- HTTP-based actions (navigate, api) work immediately
- Click/fill/select actions require Playwright (marked as skipped)
