@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
@@ -6,559 +6,370 @@ model: sonnet
6
6
 
7
7
  # Phase 11: FINISH - Finaliser une branche GitFlow
8
8
 
9
- Tu es expert GitFlow. Finalise une branche apres merge de la PR.
9
+ **Argument:** `$ARGUMENTS` = branche (optionnel, SCAN si absent)
10
10
 
11
- **Argument:** `$ARGUMENTS` = branche a finaliser (optionnel, **SCAN AUTOMATIQUE** si absent)
11
+ > **IMPORTANT:** Cette commande EXECUTE les opérations automatiquement. Ne PAS afficher les commandes bash à l'utilisateur - les EXECUTER directement via l'outil Bash.
12
+
13
+ > **Ref:** Fonctions dans [_shared.md](_shared.md)
14
+ > **Ref:** Fonction `determine_base_branch()` dans [efcore/_shared.md](../efcore/_shared.md)
12
15
 
13
16
  ---
14
17
 
15
- ## Quand utiliser
18
+ ## MODE D'EXÉCUTION
19
+
20
+ **CRITIQUE:** Tu dois EXECUTER chaque commande avec l'outil Bash, pas les afficher.
16
21
 
17
- | Situation | Action |
18
- |-----------|--------|
19
- | PR feature mergee | Cleanup uniquement |
20
- | PR release mergee | Tag + merge back to develop |
21
- | PR hotfix mergee | Tag + merge back to develop |
22
+ Workflow:
23
+ 1. Détecter le contexte (worktree, branche, PR)
24
+ 2. Exécuter les opérations silencieusement
25
+ 3. Afficher uniquement le RÉSUMÉ final
22
26
 
23
27
  ---
24
28
 
25
- ## ETAPE 0: SYNCHRONISATION AVEC REMOTE
29
+ ## Étape 0: Détection du contexte
26
30
 
27
- > **CRITIQUE:** Toujours synchroniser avec le remote avant toute opération de finish.
31
+ **EXECUTER:**
28
32
 
29
33
  ```bash
30
- echo "Synchronisation avec remote..."
34
+ # Aller au repo principal si dans un worktree
35
+ MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
36
+ cd "$MAIN_WORKTREE"
37
+
38
+ # Synchroniser
31
39
  git fetch --all --quiet
40
+ ```
32
41
 
33
- # Vérifier l'état de synchronisation des branches principales
34
- echo ""
35
- echo "État des branches principales:"
42
+ ---
36
43
 
37
- # Vérifier develop
38
- DEVELOP_BEHIND=$(git rev-list --count develop..origin/develop 2>/dev/null || echo "?")
39
- DEVELOP_AHEAD=$(git rev-list --count origin/develop..develop 2>/dev/null || echo "?")
40
- echo " develop: AHEAD=$DEVELOP_AHEAD, BEHIND=$DEVELOP_BEHIND"
44
+ ## Étape 1: Scan Proactif (si pas d'argument)
41
45
 
42
- # Vérifier main
43
- MAIN_BEHIND=$(git rev-list --count main..origin/main 2>/dev/null || echo "?")
44
- MAIN_AHEAD=$(git rev-list --count origin/main..main 2>/dev/null || echo "?")
45
- echo " main: AHEAD=$MAIN_AHEAD, BEHIND=$MAIN_BEHIND"
46
+ Si `$ARGUMENTS` est vide, scanner les branches avec PR mergées:
46
47
 
47
- # Avertissement si branches principales non synchronisées
48
- if [ "$DEVELOP_BEHIND" != "0" ] && [ "$DEVELOP_BEHIND" != "?" ]; then
49
- echo "⚠️ develop est en retard de $DEVELOP_BEHIND commit(s) - sera mis à jour automatiquement"
50
- fi
51
- if [ "$MAIN_BEHIND" != "0" ] && [ "$MAIN_BEHIND" != "?" ]; then
52
- echo "⚠️ main est en retard de $MAIN_BEHIND commit(s) - sera mis à jour automatiquement"
53
- fi
48
+ **EXECUTER:**
49
+
50
+ ```bash
51
+ # Lister branches avec PR mergée (prêtes à finaliser)
52
+ for BRANCH in $(git branch -r | grep -E 'origin/(feature|release|hotfix)/' | sed 's/origin\///'); do
53
+ PR_MERGED=$(gh pr list --head "$BRANCH" --state merged --json number --jq '.[0].number' 2>/dev/null)
54
+ [ -n "$PR_MERGED" ] && echo "✅ $BRANCH (PR #$PR_MERGED mergée)"
55
+ done
54
56
  ```
55
57
 
56
- ---
58
+ Puis demander à l'utilisateur quelle branche finaliser.
57
59
 
58
- ## ETAPE 1: SCAN PROACTIF (si pas d'argument)
60
+ ---
59
61
 
60
- > **COMPORTEMENT PROACTIF:** Si aucun argument fourni, scanner TOUTES les branches pour proposer celles qui sont pretes a finaliser.
62
+ ## Étape 2: Vérifier état de la PR
61
63
 
62
- ### 1.1 Scanner toutes les branches GitFlow
64
+ **EXECUTER:**
63
65
 
64
66
  ```bash
65
- # Note: git fetch déjà effectué dans ETAPE 0
66
-
67
- # Lister toutes les branches feature/release/hotfix
68
- FEATURES=$(git branch -r | grep 'origin/feature/' | sed 's|origin/||' | tr -d ' ')
69
- RELEASES=$(git branch -r | grep 'origin/release/' | sed 's|origin/||' | tr -d ' ')
70
- HOTFIXES=$(git branch -r | grep 'origin/hotfix/' | sed 's|origin/||' | tr -d ' ')
67
+ BRANCH="$1" # Argument fourni ou sélectionné
71
68
 
72
- ALL_BRANCHES="$FEATURES $RELEASES $HOTFIXES"
73
- ```
69
+ # Vérifier si PR mergée
70
+ PR_INFO=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt --jq '.[0]')
74
71
 
75
- ### 1.2 Verifier le statut PR de chaque branche
72
+ if [ -z "$PR_INFO" ]; then
73
+ # PR pas trouvée comme mergée - vérifier si main a les commits
74
+ git checkout main --quiet && git pull origin main --quiet
76
75
 
77
- ```bash
78
- # Pour chaque branche, verifier:
79
- for BRANCH in $ALL_BRANCHES; do
80
- # 1. PR mergee?
81
- PR_MERGED=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt --jq '.[0]')
82
-
83
- # 2. PR ouverte?
84
- PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
85
-
86
- # 3. Pas de PR?
87
- # Si pas de PR → suggerer /gitflow:7-pull-request
88
-
89
- # Categoriser
90
- if [ -n "$PR_MERGED" ]; then
91
- READY_TO_FINISH+=("$BRANCH")
92
- elif [ -n "$PR_OPEN" ]; then
93
- WAITING_FOR_MERGE+=("$BRANCH")
76
+ # Vérifier si la branche existe encore
77
+ if ! git show-ref --verify --quiet "refs/remotes/origin/$BRANCH"; then
78
+ echo "✓ Branche déjà supprimée sur remote - PR probablement mergée via GitHub"
94
79
  else
95
- NEEDS_PR+=("$BRANCH")
80
+ echo "⚠️ PR non trouvée comme mergée"
81
+ exit 1
96
82
  fi
97
- done
83
+ fi
98
84
  ```
99
85
 
100
- ### 1.3 Afficher le tableau de synthese
86
+ ---
101
87
 
102
- ```
103
- ================================================================================
104
- GITFLOW FINISH - SCAN DES BRANCHES
105
- ================================================================================
106
-
107
- ✅ PRETES A FINALISER (PR mergee):
108
- ┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
109
- │ Branche │ Type │ PR # │ Mergee le │
110
- ├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
111
- │ feature/add-user-auth │ feature │ #42 │ 2024-01-15 14:30 │
112
- │ release/v1.5.0 │ release │ #45 │ 2024-01-15 16:00 │
113
- └─────────────────────────────┴───────────┴────────────┴─────────────────────┘
114
-
115
- ⏳ EN ATTENTE DE MERGE (PR ouverte):
116
- ┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
117
- │ Branche │ Type │ PR # │ Statut │
118
- ├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
119
- │ feature/add-orders │ feature │ #43 │ Review en cours │
120
- │ hotfix/fix-login │ hotfix │ #44 │ CI en cours │
121
- └─────────────────────────────┴───────────┴────────────┴─────────────────────┘
122
-
123
- ❌ SANS PR (action requise):
124
- ┌─────────────────────────────┬───────────┬────────────────────────────────────┐
125
- │ Branche │ Type │ Action suggeree │
126
- ├─────────────────────────────┼───────────┼────────────────────────────────────┤
127
- │ feature/wip-refactor │ feature │ /gitflow:7-pull-request │
128
- │ feature/old-abandoned │ feature │ /gitflow:6-abort --branch │
129
- └─────────────────────────────┴───────────┴────────────────────────────────────┘
130
-
131
- ================================================================================
132
- ```
88
+ ## Étape 2.5: Vérification EF Core Post-Merge Manuel (CRITIQUE)
133
89
 
134
- ### 1.4 Proposition interactive
135
-
136
- ```javascript
137
- // Si plusieurs branches pretes a finaliser
138
- if (READY_TO_FINISH.length > 0) {
139
- AskUserQuestion({
140
- questions: [{
141
- question: "Quelle branche voulez-vous finaliser ?",
142
- header: "Finish",
143
- options: READY_TO_FINISH.map(branch => ({
144
- label: branch,
145
- description: `PR #${getPRNumber(branch)} mergee - ${getType(branch)}`
146
- })).concat([{
147
- label: "Toutes",
148
- description: "Finaliser toutes les branches pretes (dans l'ordre recommande)"
149
- }]),
150
- multiSelect: false
151
- }]
152
- })
153
- } else if (WAITING_FOR_MERGE.length > 0) {
154
- // Afficher message d'aide
155
- console.log("Aucune branche prete a finaliser.")
156
- console.log("→ Attendez le merge des PRs en cours ou utilisez /gitflow:9-merge")
157
- } else if (NEEDS_PR.length > 0) {
158
- // Afficher message d'aide
159
- console.log("Aucune branche prete. Creez d'abord une PR:")
160
- console.log("→ /gitflow:7-pull-request")
161
- }
162
- ```
90
+ **Contexte:** Si la PR a été mergée manuellement (via GitHub/Azure DevOps UI), les checks EF Core de `/gitflow:9-merge` n'ont pas été exécutés. Cette étape rattrape cette vérification.
163
91
 
164
- ### 1.5 Ordre recommande pour "Toutes"
92
+ **EXECUTER:**
165
93
 
166
- ```
167
- ORDRE DE FINALISATION RECOMMANDE:
168
- 1. Hotfixes (urgents, vers main puis develop)
169
- 2. Releases (vers main puis develop)
170
- 3. Features (vers develop, par date de merge)
171
- ```
94
+ ```bash
95
+ # Déterminer la branche cible selon le type
96
+ case "$BRANCH" in
97
+ feature/*|bugfix/*) TARGET_BRANCH="develop" ;;
98
+ release/*|hotfix/*) TARGET_BRANCH="main" ;;
99
+ esac
172
100
 
173
- ---
101
+ # Vérifier si le projet a des migrations EF Core
102
+ MIGRATIONS_DIR=$(find . -type d -name "Migrations" 2>/dev/null | head -1)
174
103
 
175
- ## ETAPE 2: Detecter le contexte (si argument fourni)
104
+ if [ -n "$MIGRATIONS_DIR" ] && [ -d "$MIGRATIONS_DIR" ]; then
105
+ echo "Vérification EF Core post-merge..."
176
106
 
177
- ```bash
178
- # Branche specifiee ou selectionnee
179
- BRANCH=${ARGUMENTS:-$SELECTED_BRANCH}
180
-
181
- # Determiner le type
182
- if [[ $BRANCH == feature/* ]]; then TYPE="feature"
183
- elif [[ $BRANCH == release/* ]]; then TYPE="release"
184
- elif [[ $BRANCH == hotfix/* ]]; then TYPE="hotfix"
185
- else
186
- echo "⚠️ '$BRANCH' n'est pas une branche GitFlow (feature/release/hotfix)"
187
- echo "→ Utilisez /gitflow:11-finish sans argument pour scanner les branches"
188
- exit 1
189
- fi
190
- ```
107
+ git checkout "$TARGET_BRANCH" --quiet && git pull origin "$TARGET_BRANCH" --quiet
191
108
 
192
- ## ETAPE 3: Verifier que PR est mergee
109
+ EF_CHECK_FAILED=""
193
110
 
194
- ```bash
195
- # Chercher PR associee
196
- PR_INFO=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt,title --jq '.[0]')
111
+ # 1. Vérifier que le build passe
112
+ if ! dotnet build --no-restore --verbosity quiet 2>/dev/null; then
113
+ echo "❌ ERREUR: Build échoue sur $TARGET_BRANCH après merge"
114
+ echo "→ Possible conflit de migrations non résolu"
115
+ EF_CHECK_FAILED=true
116
+ fi
197
117
 
198
- # Si pas mergee
199
- if [ -z "$PR_INFO" ]; then
200
- # Verifier si PR ouverte
201
- PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
118
+ # 2. Vérifier que les migrations sont listables
119
+ if ! dotnet ef migrations list --no-build 2>/dev/null | tail -1 | grep -q "Done\|applied"; then
120
+ echo "⚠️ WARNING: Problème avec les migrations EF Core"
121
+ EF_CHECK_FAILED=true
122
+ fi
123
+
124
+ # 3. Vérifier pas de markers de conflit Git dans les fichiers
125
+ if grep -rq "<<<<<<\|>>>>>>\|======" "$MIGRATIONS_DIR" 2>/dev/null; then
126
+ echo "❌ ERREUR: Conflits Git non résolus dans $MIGRATIONS_DIR"
127
+ EF_CHECK_FAILED=true
128
+ fi
202
129
 
203
- if [ -n "$PR_OPEN" ]; then
204
- PR_NUM=$(echo "$PR_OPEN" | jq -r '.number')
205
- echo "⚠️ PR #$PR_NUM existe mais n'est pas encore mergee"
130
+ # 4. Pour release/hotfix: info sur divergence develop
131
+ if [[ "$BRANCH" =~ ^(release|hotfix)/ ]]; then
132
+ MAIN_COUNT=$(git ls-tree -r --name-only origin/main -- "$MIGRATIONS_DIR" 2>/dev/null | grep -c "\.cs$" || echo "0")
133
+ DEV_COUNT=$(git ls-tree -r --name-only origin/develop -- "$MIGRATIONS_DIR" 2>/dev/null | grep -c "\.cs$" || echo "0")
134
+
135
+ [ "$DEV_COUNT" -gt "$MAIN_COUNT" ] && \
136
+ echo "ℹ️ develop a $((DEV_COUNT - MAIN_COUNT)) migration(s) de plus que main (normal si features en cours)"
137
+ fi
138
+
139
+ if [ -n "$EF_CHECK_FAILED" ]; then
206
140
  echo ""
207
- echo "Options:"
208
- echo " 1. Merger la PR: /gitflow:9-merge $PR_NUM"
209
- echo " 2. Voir la PR: gh pr view $PR_NUM --web"
210
- echo " 3. Abandonner: /gitflow:6-abort --branch"
141
+ echo "┌─────────────────────────────────────────────────────────────┐"
142
+ echo " PROBLÈME EF CORE DÉTECTÉ APRÈS MERGE MANUEL │"
143
+ echo "│ │"
144
+ echo " Commandes de diagnostic:"
145
+ echo "│ /efcore:db-status - État des migrations │"
146
+ echo "│ /efcore:conflicts - Analyser les conflits │"
147
+ echo "│ /efcore:rebase-snapshot - Resync si snapshot diverge │"
148
+ echo "└─────────────────────────────────────────────────────────────┘"
149
+ # Ne pas bloquer, continuer avec le finish mais alerter
211
150
  else
212
- echo "⚠️ Aucune PR trouvee pour '$BRANCH'"
213
- echo ""
214
- echo "Options:"
215
- echo " 1. Creer une PR: /gitflow:7-pull-request"
216
- echo " 2. Abandonner: /gitflow:6-abort --branch"
151
+ echo " EF Core: Migrations OK sur $TARGET_BRANCH"
217
152
  fi
218
- exit 1
219
153
  fi
220
154
  ```
221
155
 
222
156
  ---
223
157
 
224
- ## Actions selon type
225
-
226
- ### Feature (simple cleanup)
227
-
228
- ```bash
229
- # Detecter si on est dans un worktree et trouver le repo principal
230
- CURRENT_DIR=$(pwd)
231
- MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
232
-
233
- # Revenir au repo principal AVANT de supprimer le worktree
234
- cd "$MAIN_WORKTREE"
158
+ ## Actions par type
235
159
 
236
- # Supprimer worktree si existe
237
- WORKTREE_PATH="../worktrees/features/{name}"
238
- if [ -d "$WORKTREE_PATH" ]; then
239
- git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
240
- fi
160
+ ### Feature
241
161
 
242
- # Supprimer branche locale
243
- git checkout develop
244
- git pull origin develop
245
- git branch -d feature/{name}
162
+ **EXECUTER ces commandes dans l'ordre:**
246
163
 
247
- # Supprimer branche remote (si pas fait par merge)
248
- git push origin --delete feature/{name} 2>/dev/null || true
164
+ 1. Checkout develop et pull:
165
+ ```bash
166
+ git checkout develop && git pull origin develop
249
167
  ```
250
168
 
251
- **Resume:**
169
+ 2. Supprimer branche locale:
170
+ ```bash
171
+ git branch -d "$BRANCH" 2>/dev/null || git branch -D "$BRANCH" 2>/dev/null
172
+ ```
252
173
 
174
+ 3. Supprimer branche remote (si existe):
175
+ ```bash
176
+ git push origin --delete "$BRANCH" 2>/dev/null || true
253
177
  ```
254
- ═══════════════════════════════════════════════════════════════════════════════
255
- FEATURE FINALISÉE
256
- ═══════════════════════════════════════════════════════════════════════════════
257
-
258
- FINISH DETAILS
259
- ───────────────────────────────────────────────────────────────────────────────
260
- • Type: feature
261
- Branche: feature/{name}
262
- Mergée: develop
263
- • PR: #{number}
264
-
265
- WORKFLOW STATUT
266
- ───────────────────────────────────────────────────────────────────────────────
267
- PR #{number} mergée avec succès
268
- ✓ Branche feature/{name} supprimée (local)
269
- ✓ Branche feature/{name} supprimée (remote)
270
- ✓ Worktree nettoyé
271
-
272
- ═══════════════════════════════════════════════════════════════════════════════
273
- PROCHAINES ÉTAPES
274
- ═══════════════════════════════════════════════════════════════════════════════
275
-
276
- 1. Créer une nouvelle feature:
277
- /gitflow:10-start feature {name}
278
-
279
- 2. Créer une release (si prêt pour production):
280
- /gitflow:10-start release
281
-
282
- 3. Voir le statut du repo:
283
- /gitflow:2-status
284
-
285
- ═══════════════════════════════════════════════════════════════════════════════
178
+
179
+ 4. Cleanup worktree:
180
+ ```bash
181
+ # Détecter et nettoyer le worktree
182
+ WORKTREE_PATH=""
183
+ case "$BRANCH" in
184
+ feature/*)
185
+ [ -d "../features/${BRANCH#feature/}" ] && WORKTREE_PATH="../features/${BRANCH#feature/}"
186
+ [ -d "../worktrees/features/${BRANCH#feature/}" ] && WORKTREE_PATH="../worktrees/features/${BRANCH#feature/}"
187
+ ;;
188
+ esac
189
+ [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ] && {
190
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || rm -rf "$WORKTREE_PATH"
191
+ git worktree prune
192
+ }
286
193
  ```
287
194
 
288
195
  ---
289
196
 
290
- ### Release (tag + merge back)
197
+ ### Release
291
198
 
292
- ```bash
293
- # 0. Detecter si on est dans un worktree et trouver le repo principal
294
- CURRENT_DIR=$(pwd)
295
- MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
199
+ **EXECUTER ces commandes dans l'ordre:**
296
200
 
297
- # Revenir au repo principal AVANT toute operation
298
- cd "$MAIN_WORKTREE"
201
+ 1. Checkout main et pull (récupérer le merge de la PR):
202
+ ```bash
203
+ git checkout main && git pull origin main
204
+ ```
299
205
 
300
- # 1. Checkout main et pull
301
- git checkout main
302
- git pull origin main
206
+ 2. Extraire la version:
207
+ ```bash
208
+ VERSION=$(echo "$BRANCH" | sed 's/release\/v\?//')
209
+ ```
303
210
 
304
- # 2. Creer tag
305
- VERSION=$(echo $BRANCH | sed 's/release\/v//')
306
- git tag -a "v$VERSION" -m "Release v$VERSION"
307
- git push origin "v$VERSION"
211
+ 3. Créer le tag (si pas déjà existant):
212
+ ```bash
213
+ if ! git tag -l "v$VERSION" | grep -q "v$VERSION"; then
214
+ git tag -a "v$VERSION" -m "Release v$VERSION"
215
+ git push origin "v$VERSION"
216
+ fi
217
+ ```
308
218
 
309
- # 3. Merge back to develop
310
- git checkout develop
311
- git pull origin develop
219
+ 4. Merge back vers develop:
220
+ ```bash
221
+ git checkout develop && git pull origin develop
312
222
  git merge main --no-ff -m "chore: merge release v$VERSION back to develop"
223
+ ```
313
224
 
314
- # 4. AUTO-INCREMENT MINOR VERSION sur develop (prepare next release)
315
- # Ceci evite que les futures features utilisent la meme version que la release
316
- CURRENT_VERSION=$(cat package.json | jq -r '.version')
317
-
318
- # Calculer la prochaine version MINOR (ex: 1.2.0 -> 1.3.0)
319
- NEXT_VERSION=$(node -e "
320
- const [major, minor, patch] = '$CURRENT_VERSION'.split('.').map(Number);
321
- console.log([major, minor + 1, 0].join('.'));
322
- ")
323
-
324
- # Mettre a jour package.json avec la nouvelle version
325
- npm version $NEXT_VERSION --no-git-tag-version
326
-
327
- # Committer le bump de version
328
- git add package.json package-lock.json
329
- git commit -m "chore: bump develop to v$NEXT_VERSION for next release"
225
+ 4.5. **Vérifier propagation migrations (CRITIQUE):**
226
+ ```bash
227
+ # Comparer migrations main vs develop après merge
228
+ MAIN_MIGRATIONS=$(git ls-tree -r --name-only origin/main -- Migrations/ | grep "\.cs$" | grep -v "Designer\|Snapshot" | wc -l)
229
+ DEV_MIGRATIONS=$(find Migrations -name "*.cs" | grep -v "Designer\|Snapshot" | wc -l)
330
230
 
331
- git push origin develop
231
+ if [ "$DEV_MIGRATIONS" -lt "$MAIN_MIGRATIONS" ]; then
232
+ echo "⚠️ ATTENTION: develop a moins de migrations que main"
233
+ echo "→ Vérifier le merge des migrations"
234
+ fi
332
235
 
333
- echo "OK Version develop incrementee: $CURRENT_VERSION -> $NEXT_VERSION"
236
+ # Vérifier que le snapshot develop inclut tout de main
237
+ git diff origin/main -- Migrations/*ModelSnapshot.cs
238
+ # Si diff significatif → conflit de migrations à résoudre
239
+ ```
334
240
 
335
- # 5. Cleanup worktree + branche
336
- WORKTREE_PATH="../worktrees/releases/v$VERSION"
337
- if [ -d "$WORKTREE_PATH" ]; then
338
- git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
241
+ 5. Auto-incrémenter MINOR pour develop:
242
+ ```bash
243
+ # Trouver package.json (web ou racine)
244
+ PKG_PATH=$(find . -name "package.json" -not -path "*/node_modules/*" | head -1)
245
+ if [ -n "$PKG_PATH" ]; then
246
+ CURRENT=$(cat "$PKG_PATH" | grep -oP '"version":\s*"\K[^"]+')
247
+ NEXT=$(echo "$CURRENT" | awk -F. '{print $1"."$2+1".0"}')
248
+ cd "$(dirname "$PKG_PATH")"
249
+ npm version "$NEXT" --no-git-tag-version
250
+ cd -
251
+ git add "$PKG_PATH"
252
+ [ -f "${PKG_PATH%.json}-lock.json" ] && git add "${PKG_PATH%.json}-lock.json"
253
+ git commit -m "chore: bump develop to v$NEXT for next release"
339
254
  fi
340
- git branch -d release/v$VERSION
341
- git push origin --delete release/v$VERSION 2>/dev/null || true
255
+ git push origin develop
342
256
  ```
343
257
 
344
- **Resume:**
345
-
346
- ```
347
- ═══════════════════════════════════════════════════════════════════════════════
348
- RELEASE FINALISÉE
349
- ═══════════════════════════════════════════════════════════════════════════════
350
-
351
- RELEASE DETAILS
352
- ───────────────────────────────────────────────────────────────────────────────
353
- Type: release
354
- Branche: release/v{version}
355
- Version: v{version}
356
- • Tag: v{version}
357
-
358
- VERSIONING
359
- ───────────────────────────────────────────────────────────────────────────────
360
- • Release: v{version} → Déployée sur main
361
- • Develop: {version} → {NEXT_VERSION} (auto-incrémenté)
362
-
363
- WORKFLOW STATUT
364
- ───────────────────────────────────────────────────────────────────────────────
365
- ✓ PR mergée sur main
366
- ✓ Tag v{version} créé et poussé
367
- ✓ Main mis à jour
368
- ✓ Merge back vers develop effectué
369
- ✓ Version develop incrémentée ({version} → {NEXT_VERSION})
370
- ✓ Branche release/{version} supprimée
371
- ✓ Worktree nettoyé
372
-
373
- ═══════════════════════════════════════════════════════════════════════════════
374
- PROCHAINES ÉTAPES
375
- ═══════════════════════════════════════════════════════════════════════════════
376
-
377
- ✅ Release v{version} déployée avec succès!
378
-
379
- 1. Créer une nouvelle feature:
380
- /gitflow:10-start feature {name}
381
-
382
- 2. Créer un hotfix (si besoin):
383
- /gitflow:10-start hotfix {name}
384
-
385
- 3. Voir le statut du repo:
386
- /gitflow:2-status
387
-
388
- ═══════════════════════════════════════════════════════════════════════════════
258
+ 6. Cleanup:
259
+ ```bash
260
+ git branch -d "$BRANCH" 2>/dev/null || git branch -D "$BRANCH" 2>/dev/null
261
+ git push origin --delete "$BRANCH" 2>/dev/null || true
262
+
263
+ WORKTREE_PATH=""
264
+ [ -d "../releases/${BRANCH#release/}" ] && WORKTREE_PATH="../releases/${BRANCH#release/}"
265
+ [ -d "../releases/v${VERSION}" ] && WORKTREE_PATH="../releases/v${VERSION}"
266
+ [ -d "../worktrees/releases/${VERSION}" ] && WORKTREE_PATH="../worktrees/releases/${VERSION}"
267
+ [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ] && {
268
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || rm -rf "$WORKTREE_PATH"
269
+ git worktree prune
270
+ }
389
271
  ```
390
272
 
391
273
  ---
392
274
 
393
- ### Hotfix (auto-increment PATCH + tag + merge back)
275
+ ### Hotfix
394
276
 
395
- ```bash
396
- # 0. Detecter si on est dans un worktree et trouver le repo principal
397
- CURRENT_DIR=$(pwd)
398
- MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
277
+ **EXECUTER ces commandes dans l'ordre:**
399
278
 
400
- # Revenir au repo principal AVANT toute operation
401
- cd "$MAIN_WORKTREE"
402
-
403
- # 1. Checkout main et pull
404
- git checkout main
405
- git pull origin main
406
-
407
- # 2. AUTO-INCREMENT PATCH VERSION
408
- # Lire la version actuelle
409
- CURRENT_VERSION=$(cat package.json | jq -r '.version')
410
-
411
- # Calculer la nouvelle version (PATCH increment)
412
- # Ex: 1.7.1 → 1.7.2
413
- NEW_VERSION=$(node -e "
414
- const [major, minor, patch] = '$CURRENT_VERSION'.split('.').map(Number);
415
- console.log([major, minor, patch + 1].join('.'));
416
- ")
417
-
418
- # Mettre a jour package.json avec la nouvelle version
419
- npm version $NEW_VERSION --no-git-tag-version
279
+ 1. Checkout main et pull:
280
+ ```bash
281
+ git checkout main && git pull origin main
282
+ ```
420
283
 
421
- # Committer le bump de version
422
- git add package.json package-lock.json
284
+ 2. Auto-incrémenter PATCH:
285
+ ```bash
286
+ PKG_PATH=$(find . -name "package.json" -not -path "*/node_modules/*" | head -1)
287
+ CURRENT=$(cat "$PKG_PATH" | grep -oP '"version":\s*"\K[^"]+')
288
+ NEW_VERSION=$(echo "$CURRENT" | awk -F. '{print $1"."$2"."$3+1}')
289
+ cd "$(dirname "$PKG_PATH")"
290
+ npm version "$NEW_VERSION" --no-git-tag-version
291
+ cd -
292
+ git add "$PKG_PATH"
293
+ [ -f "${PKG_PATH%.json}-lock.json" ] && git add "${PKG_PATH%.json}-lock.json"
423
294
  git commit -m "chore: bump version to $NEW_VERSION"
295
+ ```
424
296
 
425
- # 3. Creer tag avec la nouvelle version
297
+ 3. Créer tag et push:
298
+ ```bash
426
299
  git tag -a "v$NEW_VERSION" -m "Hotfix v$NEW_VERSION"
427
- git push origin main
428
- git push origin "v$NEW_VERSION"
300
+ git push origin main "v$NEW_VERSION"
301
+ ```
429
302
 
430
- # 4. Merge back to develop
431
- git checkout develop
432
- git pull origin develop
303
+ 4. Merge back vers develop:
304
+ ```bash
305
+ git checkout develop && git pull origin develop
433
306
  git merge main --no-ff -m "chore: merge hotfix v$NEW_VERSION back to develop"
434
- git push origin develop
435
-
436
- # 6. Cleanup worktree + branche
437
- WORKTREE_PATH="../worktrees/hotfixes/{name}"
438
- if [ -d "$WORKTREE_PATH" ]; then
439
- git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
440
- fi
441
- git branch -d hotfix/{name}
442
- git push origin --delete hotfix/{name} 2>/dev/null || true
443
307
  ```
444
308
 
445
- **⚠️ IMPORTANT:** Le bump de version PATCH est automatique. Pas besoin de le faire manuellement avant le finish.
309
+ 4.5. **Vérifier propagation migrations (CRITIQUE):**
310
+ ```bash
311
+ # Vérifier que le snapshot develop inclut les changements du hotfix
312
+ git diff origin/main -- Migrations/*ModelSnapshot.cs
313
+ # Si diff significatif → conflit de migrations à résoudre manuellement
446
314
 
447
- **Resume:**
315
+ # En cas de conflit:
316
+ # 1. Récupérer snapshot main (état production)
317
+ # 2. Régénérer migration develop si nécessaire
318
+ ```
448
319
 
320
+ ```bash
321
+ git push origin develop
449
322
  ```
450
- ═══════════════════════════════════════════════════════════════════════════════
451
- HOTFIX FINALISÉ
452
- ═══════════════════════════════════════════════════════════════════════════════
453
-
454
- HOTFIX DETAILS
455
- ───────────────────────────────────────────────────────────────────────────────
456
- • Type: hotfix
457
- Branche: hotfix/{name}
458
- Correction: {description}
459
-
460
- VERSIONING
461
- ───────────────────────────────────────────────────────────────────────────────
462
- • Avant: v{CURRENT_VERSION}
463
- • Après: v{NEW_VERSION} (PATCH auto-incrémenté)
464
- • Tag: v{NEW_VERSION} ✓
465
-
466
- WORKFLOW STATUT
467
- ───────────────────────────────────────────────────────────────────────────────
468
- ✓ Version incrémentée (PATCH): {CURRENT_VERSION} → {NEW_VERSION}
469
- ✓ package.json mis à jour
470
- ✓ Tag v{NEW_VERSION} créé et poussé
471
- ✓ Main mis à jour
472
- ✓ Merge back vers develop effectué
473
- ✓ Branche hotfix/{name} supprimée
474
- ✓ Worktree nettoyé
475
-
476
- ═══════════════════════════════════════════════════════════════════════════════
477
- PROCHAINES ÉTAPES
478
- ═══════════════════════════════════════════════════════════════════════════════
479
-
480
- ✅ Hotfix v{NEW_VERSION} déployé avec succès!
481
-
482
- 1. Créer une nouvelle feature:
483
- /gitflow:10-start feature {name}
484
-
485
- 2. Créer une release:
486
- /gitflow:10-start release
487
-
488
- 3. Voir le statut du repo:
489
- /gitflow:2-status
490
-
491
- ═══════════════════════════════════════════════════════════════════════════════
323
+
324
+ 5. Cleanup:
325
+ ```bash
326
+ git branch -d "$BRANCH" 2>/dev/null || git branch -D "$BRANCH" 2>/dev/null
327
+ git push origin --delete "$BRANCH" 2>/dev/null || true
328
+
329
+ WORKTREE_PATH=""
330
+ [ -d "../hotfixes/${BRANCH#hotfix/}" ] && WORKTREE_PATH="../hotfixes/${BRANCH#hotfix/}"
331
+ [ -d "../worktrees/hotfixes/${BRANCH#hotfix/}" ] && WORKTREE_PATH="../worktrees/hotfixes/${BRANCH#hotfix/}"
332
+ [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ] && {
333
+ git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || rm -rf "$WORKTREE_PATH"
334
+ git worktree prune
335
+ }
492
336
  ```
493
337
 
494
338
  ---
495
339
 
496
- ## Gestion des conflits (merge back)
497
-
498
- Si conflit lors du merge back to develop :
340
+ ## Résumé (AFFICHER à la fin)
499
341
 
500
342
  ```
501
- ⚠️ CONFLIT DETECTE - MERGE BACK
502
- ────────────────────────────────
503
- Le merge de main vers develop a des conflits.
504
-
505
- Fichiers en conflit:
506
- {liste fichiers}
507
-
508
- Options:
509
- 1. Resoudre manuellement puis: git merge --continue
510
- 2. Annuler: git merge --abort
511
-
512
- Commande recommandee:
513
- Resoudre conflits dans IDE
514
- git add .
515
- git merge --continue
516
- git push origin develop
517
- ────────────────────────────────
343
+ {TYPE} FINALISÉ
344
+ - Branche: {branch}
345
+ - PR: #{number} (mergée)
346
+ - Tag: {v1.2.3|N/A}
347
+ - Merge back develop: {done|N/A}
348
+ - Version develop: {NEXT_VERSION|unchanged}
349
+ - Worktree: nettoyé
518
350
  ```
519
351
 
520
- ---
521
-
522
- ## Cleanup automatique des worktrees
523
-
524
- Apres chaque finish, un cleanup cible est effectue pour le worktree de la branche finalisee:
525
-
526
- ```bash
527
- # Fonction de cleanup cible (appelee automatiquement)
528
- cleanup_worktree_for_branch() {
529
- BRANCH=$1
530
- WORKTREE_BASE="../worktrees"
531
-
532
- # Determiner le chemin selon le type
533
- if [[ $BRANCH == feature/* ]]; then
534
- NAME=${BRANCH#feature/}
535
- WORKTREE_PATH="$WORKTREE_BASE/features/$NAME"
536
- elif [[ $BRANCH == release/* ]]; then
537
- VERSION=${BRANCH#release/}
538
- WORKTREE_PATH="$WORKTREE_BASE/releases/$VERSION"
539
- elif [[ $BRANCH == hotfix/* ]]; then
540
- NAME=${BRANCH#hotfix/}
541
- WORKTREE_PATH="$WORKTREE_BASE/hotfixes/$NAME"
542
- fi
352
+ **PROCHAINE ÉTAPE**
543
353
 
544
- # Supprimer si existe
545
- if [ -d "$WORKTREE_PATH" ]; then
546
- git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
547
- rm -rf "$WORKTREE_PATH" 2>/dev/null || true
548
- git worktree prune
549
- echo "✓ Worktree nettoye: $WORKTREE_PATH"
550
- fi
551
- }
354
+ Démarrer une nouvelle feature:
552
355
 
553
- # Appel automatique
554
- cleanup_worktree_for_branch "$BRANCH"
356
+ ```
357
+ /gitflow:10-start feature {name}
555
358
  ```
556
359
 
557
- **Note:** Pour un audit complet de tous les worktrees, utilisez:
360
+ ---
558
361
 
559
- ```
560
- /gitflow:12-cleanup
561
- ```
362
+ ## Gestion des erreurs
363
+
364
+ | Erreur | Action |
365
+ |--------|--------|
366
+ | PR non mergée | `⚠️ Merger la PR d'abord: /gitflow:9-merge` |
367
+ | Conflit merge back | Résoudre puis: `git add . && git merge --continue && git push` |
368
+ | Tag existe déjà | Skip création tag, continuer |
369
+ | Branche déjà supprimée | Continuer avec cleanup worktree |
370
+ | Build échoue post-merge | `/efcore:db-status` puis `/efcore:conflicts` |
371
+ | Conflits Git dans migrations | Résoudre manuellement puis `/efcore:rebase-snapshot` |
372
+ | Snapshot désynchronisé | `/efcore:rebase-snapshot` sur la branche cible |
562
373
 
563
374
  ---
564
375
 
@@ -566,7 +377,6 @@ cleanup_worktree_for_branch "$BRANCH"
566
377
 
567
378
  | Commande | Action |
568
379
  |----------|--------|
569
- | `/gitflow:11-finish` | Finaliser branche courante |
570
- | `/gitflow:11-finish feature/xxx` | Finaliser branche specifiee |
571
- | `/gitflow:11-finish --dry-run` | Simulation |
572
- | `/gitflow:11-finish --skip-tag` | Sans creation de tag |
380
+ | `/gitflow:11-finish` | Scan et proposer branches prêtes |
381
+ | `/gitflow:11-finish feature/xxx` | Finaliser branche spécifique |
382
+ | `/gitflow:11-finish --skip-tag` | Sans créer de tag |