---
description: Scan all branches for migrations with risk analysis
agent: efcore-scan
model: sonnet
---

# EF Core Scan

> **Ref:** [_shared.md](_shared.md)
> **MCP:** `mcp__smartstack__check_migrations` pour chaque branche
> **Type:** Read-only, aucune modification

---

## STEP 1: Détecter Worktrees Actifs

```bash
WORKTREES=$(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2)
```

---

## STEP 2: Invoquer MCP pour Chaque Branche

```
FOR each branch in [feature/*, hotfix/*, release/*]:
  CALL mcp__smartstack__check_migrations WITH:
    - branch: {branch}
    - compareBranch: "develop"
  STORE result in BRANCH_RESULTS[branch]
```

---

## STEP 3: Calculer Niveau Risque

| Condition | Risque |
|-----------|--------|
| Snapshot = develop | NONE |
| Tables différentes | LOW |
| FK vers même table | MEDIUM |
| Même tables/colonnes | HIGH |

---

## STEP 4: Recommander Ordre Merge

```
1. Branches RISK=NONE (merge immédiat)
2. Branches RISK=LOW (modifications mineures)
3. Branches RISK=MEDIUM (ordre important)
4. Branches RISK=HIGH (rebase requis)
```

---

## Résumé

```
SCAN CROSS-BRANCH
├── Worktrees: {count}
├── Branches avec migrations: {N}
├── Conflits: {none/low/medium/high}
│
├── ORDRE MERGE RECOMMANDÉ
│   1. {branch} - AUCUN risque - ✓ Merge OK
│   2. {branch} - FAIBLE risque - ✓ Merge OK
│   3. {branch} - MOYEN risque - ⚠ Après #{2}, puis rebase
│
└── Prochains: /gitflow:9-merge, /efcore:rebase-snapshot, /efcore:conflicts
```

---

## Options

| Option | Description |
|--------|-------------|
| `--json` | Output JSON pour CI/CD |
| `--branch <name>` | Scanner branche spécifique |
| `--verbose` | Détails MCP |
| `--no-recommend` | Sans recommandations |

---

## CI/CD Usage

```yaml
- name: Scan EF Core migrations
  run: |
    OUTPUT=$(claude-code "/efcore:scan --json")
    HIGH_RISK=$(echo $OUTPUT | jq '[.branches[] | select(.riskLevel == "HIGH")] | length')
    [ "$HIGH_RISK" -gt 0 ] && echo "::warning::$HIGH_RISK branches HIGH risk"
```
