@atlashub/smartstack-cli 1.11.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/.documentation/agents.html +7 -2
  2. package/.documentation/apex.html +7 -2
  3. package/.documentation/business-analyse.html +7 -2
  4. package/.documentation/cli-commands.html +871 -0
  5. package/.documentation/commands.html +7 -2
  6. package/.documentation/efcore.html +7 -2
  7. package/.documentation/gitflow.html +7 -2
  8. package/.documentation/hooks.html +7 -2
  9. package/.documentation/index.html +7 -2
  10. package/.documentation/init.html +7 -2
  11. package/.documentation/installation.html +7 -2
  12. package/.documentation/ralph-loop.html +7 -2
  13. package/.documentation/test-web.html +7 -2
  14. package/dist/index.js +1932 -336
  15. package/dist/index.js.map +1 -1
  16. package/package.json +8 -2
  17. package/templates/agents/efcore/squash.md +67 -31
  18. package/templates/agents/gitflow/finish.md +68 -56
  19. package/templates/commands/business-analyse/0-orchestrate.md +72 -556
  20. package/templates/commands/business-analyse/1-init.md +23 -193
  21. package/templates/commands/business-analyse/2-discover.md +85 -462
  22. package/templates/commands/business-analyse/3-analyse.md +40 -342
  23. package/templates/commands/business-analyse/4-specify.md +72 -537
  24. package/templates/commands/business-analyse/5-validate.md +43 -237
  25. package/templates/commands/business-analyse/6-handoff.md +93 -682
  26. package/templates/commands/business-analyse/7-doc-html.md +45 -544
  27. package/templates/commands/business-analyse/_shared.md +176 -0
  28. package/templates/commands/business-analyse/bug.md +50 -257
  29. package/templates/commands/business-analyse/change-request.md +59 -283
  30. package/templates/commands/business-analyse/hotfix.md +36 -120
  31. package/templates/commands/business-analyse.md +55 -574
  32. package/templates/commands/efcore/_shared.md +206 -0
  33. package/templates/commands/efcore/conflicts.md +39 -201
  34. package/templates/commands/efcore/db-deploy.md +28 -237
  35. package/templates/commands/efcore/db-reset.md +41 -390
  36. package/templates/commands/efcore/db-seed.md +44 -323
  37. package/templates/commands/efcore/db-status.md +31 -210
  38. package/templates/commands/efcore/migration.md +45 -368
  39. package/templates/commands/efcore/rebase-snapshot.md +38 -241
  40. package/templates/commands/efcore/scan.md +35 -204
  41. package/templates/commands/efcore/squash.md +158 -251
  42. package/templates/commands/efcore.md +49 -177
  43. package/templates/commands/gitflow/1-init.md +94 -1318
  44. package/templates/commands/gitflow/10-start.md +86 -990
  45. package/templates/commands/gitflow/11-finish.md +264 -454
  46. package/templates/commands/gitflow/12-cleanup.md +40 -213
  47. package/templates/commands/gitflow/2-status.md +51 -386
  48. package/templates/commands/gitflow/3-commit.md +108 -801
  49. package/templates/commands/gitflow/4-plan.md +42 -13
  50. package/templates/commands/gitflow/5-exec.md +60 -5
  51. package/templates/commands/gitflow/6-abort.md +54 -277
  52. package/templates/commands/gitflow/7-pull-request.md +74 -717
  53. package/templates/commands/gitflow/8-review.md +51 -178
  54. package/templates/commands/gitflow/9-merge.md +74 -404
  55. package/templates/commands/gitflow/_shared.md +196 -0
  56. package/templates/commands/quickstart.md +154 -0
  57. package/templates/commands/ralph-loop/ralph-loop.md +104 -2
  58. package/templates/hooks/hooks.json +13 -0
  59. package/templates/hooks/ralph-mcp-logger.sh +46 -0
  60. package/templates/hooks/ralph-session-end.sh +69 -0
  61. package/templates/ralph/README.md +91 -0
  62. package/templates/ralph/ralph.config.yaml +113 -0
  63. package/templates/scripts/setup-ralph-loop.sh +173 -0
  64. package/templates/skills/_shared.md +117 -0
  65. package/templates/skills/ai-prompt/SKILL.md +87 -654
  66. package/templates/skills/application/SKILL.md +76 -499
  67. package/templates/skills/controller/SKILL.md +38 -165
  68. package/templates/skills/documentation/SKILL.md +2 -1
  69. package/templates/skills/feature-full/SKILL.md +107 -732
  70. package/templates/skills/notification/SKILL.md +85 -474
  71. package/templates/skills/ui-components/SKILL.md +62 -762
  72. package/templates/skills/workflow/SKILL.md +85 -489
  73. package/templates/commands/gitflow/rescue.md +0 -867
  74. package/templates/skills/business-analyse/SKILL.md +0 -191
@@ -4,76 +4,86 @@ agent: efcore-squash
4
4
  model: sonnet
5
5
  ---
6
6
 
7
- # EF Core Squash - Consolidate Migrations
7
+ # EF Core Squash
8
8
 
9
- Merges multiple migrations into a single consolidated migration using EF Core CLI only.
10
-
11
- **USAGE:** Before creating a release branch to clean up migration history.
12
-
13
- **WARNING:** This operation is **DESTRUCTIVE**. Migration history will be lost.
9
+ > **Ref:** [_shared.md](_shared.md) - `determine_base_branch()`, `detect_efcore_project()`
10
+ > **Usage:** Consolider migrations avant merge ou release
11
+ > **WARNING:** DESTRUCTIF - historique migrations perdu
14
12
 
15
13
  ---
16
14
 
17
- ## RÈGLES DE CONFORMITÉ (OBLIGATOIRE)
15
+ ## Conformité
18
16
 
19
- > **INTERDIT - Violations CLAUDE.md:**
20
- > - ❌ Génération de scripts SQL dans le repository (`./scripts/migrations/*.sql`)
21
- > - ❌ Fichiers .sql versionnés dans Git
22
- > - ❌ `migrationBuilder.Sql()` avec SQL brut
23
- >
24
- > **OBLIGATOIRE - Méthodes autorisées:**
25
- > - ✅ `dotnet ef migrations add` pour créer la migration consolidée
26
- > - ✅ `dotnet ef migrations remove` pour supprimer les anciennes
27
- > - ✅ Backup des fichiers .cs dans `.claude/gitflow/backup/` (non versionné)
28
- >
29
- > **Contact support:** support@atlshub.ch
17
+ | INTERDIT | OBLIGATOIRE |
18
+ |----------|-------------|
19
+ | Scripts .sql dans repo | `dotnet ef migrations add` |
20
+ | `migrationBuilder.Sql()` brut | `dotnet ef migrations remove` |
21
+ | Squash sans récupérer snapshot parent | Backup dans `.claude/` (gitignored) |
30
22
 
31
23
  ---
32
24
 
33
- ## STEP 1: Check prerequisites
25
+ ## STEP 0: Déterminer Branche Parente (CRITIQUE)
34
26
 
35
27
  ```bash
36
- # Check branch
37
- CURRENT_BRANCH=$(git branch --show-current)
38
- echo "Current branch: $CURRENT_BRANCH"
28
+ determine_base_branch # Voir _shared.md
39
29
 
40
- # Check clean state
41
- if [ -n "$(git status --porcelain)" ]; then
42
- echo "ERROR: Working directory not clean"
43
- exit 1
44
- fi
30
+ # Résultat:
31
+ # - BASE_BRANCH = branche parente (develop, main, etc.)
32
+ # - BRANCH_TYPE = type de branche courante
33
+ # - Exit si main/master (BLOQUÉ)
34
+ ```
45
35
 
46
- # Find EF Core projects
47
- STARTUP_PROJECT=$(find . -name "*.Api.csproj" -o -name "*Web.csproj" | head -1)
48
- INFRA_PROJECT=$(find . -name "*Infrastructure.csproj" | head -1)
36
+ | Branche courante | BASE_BRANCH | Action |
37
+ |------------------|-------------|--------|
38
+ | `feature/*` | `develop` | Récupère snapshot develop |
39
+ | `develop` | `main` | Récupère snapshot main |
40
+ | `release/*` | `main` | Récupère snapshot main |
41
+ | `hotfix/*` | `main` | Récupère snapshot main |
42
+ | `main/master` | **BLOQUÉ** | Exit code 1 |
49
43
 
50
- if [ -z "$INFRA_PROJECT" ]; then
51
- INFRA_PROJECT=$(find . -name "*.csproj" -exec grep -l "Microsoft.EntityFrameworkCore" {} \; | head -1)
52
- fi
44
+ ---
53
45
 
54
- PROJECT_DIR=$(dirname "$INFRA_PROJECT")
55
- MIGRATIONS_DIR="$PROJECT_DIR/Migrations"
46
+ ## STEP 1: Vérifier Prérequis
56
47
 
57
- # List migrations
58
- ALL_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer" | grep -v "Snapshot" | sort)
59
- MIGRATION_COUNT=$(echo "$ALL_MIGRATIONS" | grep -c "." || echo "0")
48
+ ```bash
49
+ CURRENT_BRANCH=$(git branch --show-current)
50
+ [ -n "$(git status --porcelain)" ] && { echo "Working directory non propre"; exit 1; }
51
+ detect_efcore_project
52
+
53
+ # Compter migrations LOCALES uniquement (pas celles héritées)
54
+ git fetch origin "$BASE_BRANCH" --quiet
55
+ BASE_MIGRATIONS=$(git ls-tree -r --name-only "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR" | grep "\.cs$" | grep -v "Designer\|Snapshot")
56
+ LOCAL_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" | grep -v "Designer\|Snapshot" | xargs -I{} basename {})
57
+
58
+ # Migrations propres à cette branche
59
+ BRANCH_ONLY_MIGRATIONS=()
60
+ for mig in $LOCAL_MIGRATIONS; do
61
+ echo "$BASE_MIGRATIONS" | grep -q "$mig" || BRANCH_ONLY_MIGRATIONS+=("$mig")
62
+ done
60
63
 
61
- echo "Migrations found: $MIGRATION_COUNT"
62
- echo "Project directory: $PROJECT_DIR"
64
+ MIGRATION_COUNT=${#BRANCH_ONLY_MIGRATIONS[@]}
65
+ echo "Migrations à consolider: $MIGRATION_COUNT (propres à $CURRENT_BRANCH)"
66
+ echo "Branche parente: $BASE_BRANCH"
63
67
  ```
64
68
 
65
69
  ---
66
70
 
67
- ## STEP 2: Request confirmation
71
+ ## STEP 2: Confirmation Utilisateur
68
72
 
69
73
  ```javascript
70
74
  AskUserQuestion({
71
75
  questions: [{
72
- question: "You are about to merge " + MIGRATION_COUNT + " migrations into one. This operation is DESTRUCTIVE. Continue?",
76
+ question: `Squash ${MIGRATION_COUNT} migrations de ${CURRENT_BRANCH}?
77
+
78
+ Le ModelSnapshot de ${BASE_BRANCH} sera récupéré comme base.
79
+ Vos migrations seront consolidées en UNE seule.
80
+
81
+ Cette opération est DESTRUCTIVE et IRRÉVERSIBLE (sauf backup).`,
73
82
  header: "Squash",
74
83
  options: [
75
- { label: "Yes, squash all", description: "Merge all migrations into one" },
76
- { label: "Cancel", description: "Do nothing" }
84
+ { label: "Oui, squash", description: `Consolider sur base de ${BASE_BRANCH}` },
85
+ { label: "Voir détails", description: "Afficher migrations concernées" },
86
+ { label: "Annuler", description: "Ne rien faire" }
77
87
  ],
78
88
  multiSelect: false
79
89
  }]
@@ -82,221 +92,115 @@ AskUserQuestion({
82
92
 
83
93
  ---
84
94
 
85
- ## STEP 3: Full backup (local only - NOT in repository)
95
+ ## STEP 3: Backup Local
86
96
 
87
97
  ```bash
88
- # Create backup in .claude directory (gitignored)
89
98
  BACKUP_DIR=".claude/gitflow/backup/migrations/squash_$(date +%Y%m%d_%H%M%S)"
90
99
  mkdir -p "$BACKUP_DIR"
91
-
92
- echo "Backup to $BACKUP_DIR (local only, not in Git)"
93
- cp "$MIGRATIONS_DIR"/*.cs "$BACKUP_DIR/" 2>/dev/null
94
- echo " $(ls -1 "$BACKUP_DIR" | wc -l) files backed up"
95
-
96
- # Keep ModelSnapshot for reference
97
- cp "$MIGRATIONS_DIR"/*ModelSnapshot.cs "$BACKUP_DIR/ModelSnapshot_backup.cs" 2>/dev/null
100
+ cp "$MIGRATIONS_DIR"/*.cs "$BACKUP_DIR/"
101
+ echo "Backup: $BACKUP_DIR"
98
102
  ```
99
103
 
100
104
  ---
101
105
 
102
- ## STEP 4: Delete all migrations
106
+ ## STEP 4: Récupérer ModelSnapshot de la Branche Parente (CRUCIAL)
103
107
 
104
108
  ```bash
105
- echo "Deleting migrations..."
109
+ # Sauvegarder snapshot actuel
110
+ cp "$MIGRATIONS_DIR"/*ModelSnapshot.cs "$BACKUP_DIR/"
106
111
 
107
- # Delete all migration files (except ModelSnapshot)
108
- for file in $(find "$MIGRATIONS_DIR" -name "*.cs" -not -name "*ModelSnapshot.cs" 2>/dev/null); do
109
- rm -f "$file"
110
- echo " - $(basename "$file")"
111
- done
112
+ # Récupérer le snapshot de la branche parente
113
+ git fetch origin "$BASE_BRANCH" --quiet
114
+ git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR"/*ModelSnapshot.cs
112
115
 
113
- # Also delete Designer files
114
- for file in $(find "$MIGRATIONS_DIR" -name "*.Designer.cs" 2>/dev/null); do
115
- rm -f "$file"
116
- echo " - $(basename "$file")"
117
- done
116
+ echo "ModelSnapshot récupéré depuis: origin/$BASE_BRANCH"
118
117
  ```
119
118
 
119
+ **Pourquoi c'est crucial:**
120
+ - Le snapshot de `$BASE_BRANCH` contient l'état VALIDÉ et COMPLET
121
+ - Les migrations parallèles sur d'autres branches sont incluses
122
+ - Évite la perte d'information de schéma (cf. [Bokio best practices](https://www.bokio.se/engineering-blog/how-to-squash-ef-core-migrations/))
123
+
120
124
  ---
121
125
 
122
- ## STEP 5: Create consolidated migration
126
+ ## STEP 5: Supprimer Migrations de la Branche (pas celles héritées)
123
127
 
124
128
  ```bash
125
- # Version
126
- VERSION=$(grep -oP '(?<=<Version>).*(?=</Version>)' "$INFRA_PROJECT" 2>/dev/null | head -1 || echo "1.0.0")
127
- VERSION_CLEAN=$(echo "$VERSION" | sed 's/\./_/g')
129
+ # Supprimer UNIQUEMENT les migrations propres à cette branche
130
+ for mig in "${BRANCH_ONLY_MIGRATIONS[@]}"; do
131
+ rm -f "$MIGRATIONS_DIR"/${mig%.cs}.cs
132
+ rm -f "$MIGRATIONS_DIR"/${mig%.cs}.Designer.cs
133
+ done
134
+
135
+ echo "Supprimé: ${#BRANCH_ONLY_MIGRATIONS[@]} migrations"
136
+ ```
137
+
138
+ ---
128
139
 
129
- # Migration name
130
- if [[ "$CURRENT_BRANCH" == release/* ]]; then
131
- MIGRATION_NAME="Release_${VERSION_CLEAN}_Initial"
132
- else
133
- MIGRATION_NAME="Consolidated_${VERSION_CLEAN}_AllMigrations"
134
- fi
140
+ ## STEP 6: Créer Migration Consolidée
135
141
 
136
- echo ""
137
- echo "Creating consolidated migration: $MIGRATION_NAME"
142
+ ```bash
143
+ # Nommage selon contexte
144
+ case "$BRANCH_TYPE" in
145
+ feature)
146
+ BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's|feature/||')
147
+ MIGRATION_NAME="Feature_${BRANCH_NAME}_Consolidated"
148
+ ;;
149
+ release)
150
+ VERSION=$(echo "$CURRENT_BRANCH" | sed 's|release/||' | tr '.' '_')
151
+ MIGRATION_NAME="Release_${VERSION}_Initial"
152
+ ;;
153
+ hotfix)
154
+ VERSION=$(echo "$CURRENT_BRANCH" | sed 's|hotfix/||' | tr '.' '_')
155
+ MIGRATION_NAME="Hotfix_${VERSION}_Fix"
156
+ ;;
157
+ develop)
158
+ MIGRATION_NAME="Develop_Consolidated_$(date +%Y%m%d)"
159
+ ;;
160
+ *)
161
+ MIGRATION_NAME="Consolidated_$(date +%Y%m%d_%H%M%S)"
162
+ ;;
163
+ esac
138
164
 
139
165
  dotnet ef migrations add "$MIGRATION_NAME" \
140
166
  --project "$INFRA_PROJECT" \
141
167
  --startup-project "$STARTUP_PROJECT" \
142
168
  --verbose
143
-
144
- if [ $? -eq 0 ]; then
145
- echo " Migration created successfully"
146
- else
147
- echo " ERROR - restoring backup"
148
- cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
149
- exit 1
150
- fi
151
169
  ```
152
170
 
153
171
  ---
154
172
 
155
- ## STEP 6: Validation (NO SQL script generation)
173
+ ## STEP 7: Validation
156
174
 
157
175
  ```bash
158
- echo ""
159
- echo "Validation..."
160
-
161
176
  # Build
162
177
  dotnet build --no-restore
163
- if [ $? -ne 0 ]; then
164
- echo " ERROR: Build failed"
165
- echo " Restoring backup..."
166
- cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
167
- exit 1
168
- fi
169
- echo " Build OK"
170
-
171
- # Verify migration can be listed
172
- dotnet ef migrations list \
173
- --project "$INFRA_PROJECT" \
174
- --startup-project "$STARTUP_PROJECT" \
175
- --no-build 2>/dev/null
176
-
177
- if [ $? -ne 0 ]; then
178
- echo " ERROR: Migration list failed"
179
- exit 1
180
- fi
181
- echo " Migration list OK"
182
- ```
183
-
184
- ---
185
-
186
- ## STEP 7: Resume
178
+ [ $? -ne 0 ] && { echo "Build FAILED - restauration backup"; cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"; exit 1; }
187
179
 
188
- **Afficher un resume apres le squash:**
180
+ # Liste migrations
181
+ dotnet ef migrations list --no-build
189
182
 
183
+ # Générer script (validation)
184
+ dotnet ef migrations script --no-build --idempotent > /dev/null
185
+ [ $? -ne 0 ] && { echo "Script generation FAILED"; exit 1; }
190
186
  ```
191
- ===============================================================================
192
- MIGRATIONS CONSOLIDÉES
193
- ===============================================================================
194
187
 
195
- DÉTAILS
196
- -------------------------------------------------------------------------------
197
- • Branche: {current_branch}
198
- • Backup: {backup_dir} (local uniquement)
199
-
200
- AVANT LE SQUASH
201
- -------------------------------------------------------------------------------
202
- • Migrations: {old_count} fichiers
203
-
204
- APRÈS LE SQUASH
205
- -------------------------------------------------------------------------------
206
- • Migration: {migration_name}
207
-
208
- VALIDATIONS
209
- -------------------------------------------------------------------------------
210
- ✓ Migrations fusionnées avec succès
211
- ✓ Build vérifié
212
- ✓ Liste des migrations valide
213
-
214
- CONFORMITÉ
215
- -------------------------------------------------------------------------------
216
- ✓ EF Core CLI uniquement
217
- ✓ Pas de scripts SQL dans le repository
218
-
219
- ===============================================================================
220
- DÉPLOIEMENT EN PRODUCTION
221
- ===============================================================================
222
-
223
- OPTION 1 - EF Core CLI (Recommandé):
224
- -------------------------------------------------------------------------------
225
- dotnet ef database update {migration_name} \
226
- --project "{INFRA_PROJECT}" \
227
- --startup-project "{STARTUP_PROJECT}" \
228
- --connection "Server=...;Database=...;..."
229
-
230
- OPTION 2 - Si les migrations sont déjà appliquées:
231
- -------------------------------------------------------------------------------
232
- Insérer manuellement dans __EFMigrationsHistory via SSMS/Azure:
233
-
234
- INSERT INTO __EFMigrationsHistory (MigrationId, ProductVersion)
235
- VALUES ('{migration_name}', '10.0.0')
236
-
237
- ⚠️ NE PAS générer de scripts SQL dans le repository!
238
-
239
- ===============================================================================
240
- PROCHAINES ÉTAPES
241
- ===============================================================================
242
-
243
- 1. Vérifier le contenu de la migration consolidée:
244
- Ouvrir Migrations/{migration_name}.cs
245
-
246
- 2. Tester sur la base de développement:
247
- /efcore:db-reset
248
- /efcore:db-deploy
249
-
250
- 3. Committer les changements:
251
- /gitflow:3-commit
252
-
253
- ===============================================================================
254
- RESTAURATION (si nécessaire)
255
- ===============================================================================
256
-
257
- Si le squash a causé des problèmes, restaurez le backup:
188
+ ---
258
189
 
259
- cp {backup_dir}/*.cs {migrations_dir}/
190
+ ## Résumé
260
191
 
261
- ===============================================================================
262
192
  ```
263
-
264
- **Si le squash échoue:**
265
-
193
+ SQUASH - {CURRENT_BRANCH}
194
+ Base: {BASE_BRANCH} (snapshot récupéré)
195
+ Backup: {BACKUP_DIR}
196
+ Avant: {MIGRATION_COUNT} migrations
197
+ Apres: 1 migration ({MIGRATION_NAME})
198
+ Conformite: EF Core CLI, Pas de .sql, Snapshot parent
199
+
200
+ Prochains: /efcore:db-reset, /efcore:db-deploy, /gitflow:3-commit
266
201
  ```
267
- ===============================================================================
268
- ÉCHEC DU SQUASH
269
- ===============================================================================
270
-
271
- ERREUR
272
- -------------------------------------------------------------------------------
273
- ✗ {error_message}
274
-
275
- DÉTAILS
276
- -------------------------------------------------------------------------------
277
- • Branche: {current_branch}
278
- • Backup: {backup_dir}
279
-
280
- RESTAURATION AUTOMATIQUE
281
- -------------------------------------------------------------------------------
282
- ✓ Backup restauré automatiquement
283
- ✓ Migrations originales récupérées
284
-
285
- ===============================================================================
286
- ACTIONS SUGGÉRÉES
287
- ===============================================================================
288
-
289
- 1. Vérifier les erreurs de build:
290
- dotnet build
291
202
 
292
- 2. Vérifier le ModelSnapshot:
293
- /efcore:conflicts
294
-
295
- 3. Si problème persistant:
296
- support@atlshub.ch
297
-
298
- ===============================================================================
299
- ```
203
+ **Si échec:** Restaurer avec `cp $BACKUP_DIR/*.cs $MIGRATIONS_DIR/`
300
204
 
301
205
  ---
302
206
 
@@ -304,51 +208,54 @@ RESTAURATION AUTOMATIQUE
304
208
 
305
209
  | Option | Description |
306
210
  |--------|-------------|
307
- | `--no-backup` | Don't create backup (dangerous) |
308
- | `--name <name>` | Force a migration name |
309
- | `--keep-snapshot` | Keep current ModelSnapshot |
310
- | `--dry-run` | Show without executing |
211
+ | `--no-backup` | Sans backup (dangereux) |
212
+ | `--name <name>` | Forcer nom migration |
213
+ | `--dry-run` | Afficher sans exécuter |
214
+ | `--include-inherited` | Inclure migrations héritées (rare) |
311
215
 
312
216
  ---
313
217
 
314
- ## When to use Squash
218
+ ## Matrice d'Utilisation
315
219
 
316
- | Situation | Use Squash? |
317
- |-----------|-------------|
318
- | Before release | YES - clean up history |
319
- | After merging multiple features | YES - consolidate |
320
- | In production | NO - use EF Core CLI directly |
321
- | Feature branch in progress | CAUTION - prefer rebase-snapshot |
220
+ | Situation | Utiliser squash? | Alternative |
221
+ |-----------|------------------|-------------|
222
+ | Feature avec plusieurs migrations | OUI | `/efcore:rebase-snapshot` |
223
+ | Avant merge feature vers develop | OUI (recommandé) | - |
224
+ | Sur develop avant release | Créer release d'abord | `/gitflow:10-start release` |
225
+ | Sur release avant tag | OUI (idéal) | - |
226
+ | Hotfix urgent | OUI | - |
227
+ | Sur main/master | **JAMAIS** | BLOQUÉ automatiquement |
322
228
 
323
229
  ---
324
230
 
325
- ## Forbidden Patterns
231
+ ## Workflow Complet Recommandé
326
232
 
327
233
  ```
328
- INTERDIT - Ne jamais faire:
329
- ────────────────────────────────────────────────────────────────────────────────
330
- # Génération de script SQL dans le repo
331
- dotnet ef migrations script -o ./scripts/migrations/*.sql
332
-
333
- # Stockage de fichiers .sql versionnés
334
- ./scripts/migrations/Release_1_0_0.sql
335
- ./scripts/seed.sql
336
- ────────────────────────────────────────────────────────────────────────────────
337
-
338
- ✅ CORRECT - Toujours utiliser:
339
- ────────────────────────────────────────────────────────────────────────────────
340
- # EF Core CLI pour déploiement
341
- dotnet ef database update
342
-
343
- # Backup local uniquement (gitignored)
344
- .claude/gitflow/backup/migrations/
345
- ────────────────────────────────────────────────────────────────────────────────
234
+ 1. feature/* : développement avec N migrations
235
+
236
+ 2. Avant merge sur develop:
237
+ /efcore:squash
238
+ → Récupère snapshot develop
239
+ Consolide en 1 migration
240
+
241
+ 3. Merge sur develop:
242
+ /gitflow:7-pull-request
243
+ /gitflow:9-merge
244
+
245
+ 4. Avant release:
246
+ /gitflow:10-start release vX.Y.Z
247
+ /efcore:squash (sur release/*)
248
+ → Récupère snapshot main
249
+ Consolide TOUT en Release_X_Y_Z_Initial
250
+
251
+ 5. Finaliser:
252
+ /gitflow:11-finish
346
253
  ```
347
254
 
348
255
  ---
349
256
 
350
- ## Support
257
+ ## Sources Best Practices
351
258
 
352
- > **Questions ou problèmes avec le squash EF Core?**
353
- >
354
- > 📧 **support@atlshub.ch**
259
+ - [Microsoft - Managing Migrations](https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/managing)
260
+ - [Bokio - How to squash EF Core migrations](https://www.bokio.se/engineering-blog/how-to-squash-ef-core-migrations/)
261
+ - [Mitchel Sellers - Squashing EF Core Migrations Safely](https://www.mitchelsellers.com/blog/article/squashing-ef-core-migrations-safely)