@atlashub/smartstack-cli 1.11.0 → 1.12.0

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
@@ -7,896 +7,203 @@ args: [message]
7
7
 
8
8
  # Phase 3: COMMIT - Migration-aware commits
9
9
 
10
- You are an expert in GitFlow and EF Core. Manage commits with validation of .NET migrations.
10
+ **Argument:** `$ARGUMENTS` = message (optionnel, auto-généré si absent)
11
11
 
12
- > **CLAUDE INSTRUCTION:** The `AskUserQuestion({...})` blocks below are instructions for using the `AskUserQuestion` tool **interactively**. You MUST execute the tool with these parameters to get the user's response BEFORE continuing. DO NOT display this code - WAIT for the response.
13
-
14
- **Argument:** `$ARGUMENTS` = commit message (optional, generated if absent)
12
+ > **Ref:** Fonction `normalize_branch_name()` dans [_shared.md](_shared.md)
15
13
 
16
14
  ---
17
15
 
18
- ## ETAPE 0: GARDE-FOUS PRE-COMMIT
19
-
20
- > **PROTECTION:** Verifications de securite AVANT toute operation de commit.
16
+ ## Étape 0: Garde-fous Pré-commit
21
17
 
22
18
  ### 0.1 Protection des branches
23
19
 
24
20
  ```bash
25
21
  CURRENT=$(git rev-parse --abbrev-ref HEAD)
26
22
 
27
- # ═══════════════════════════════════════════════════════════════
28
- # BLOCAGE: Commit direct sur main
29
- # ═══════════════════════════════════════════════════════════════
30
- if [[ "$CURRENT" == "main" ]]; then
31
- echo ""
32
- echo "╔══════════════════════════════════════════════════════════════════════════════╗"
33
- echo "║ ⛔ COMMIT BLOQUE - BRANCHE PROTEGEE ║"
34
- echo "╠══════════════════════════════════════════════════════════════════════════════╣"
35
- echo "║ Vous etes sur 'main' - les commits directs ne sont pas autorises. ║"
36
- echo "║ ║"
37
- echo "║ GitFlow interdit les commits directs sur main car: ║"
38
- echo "║ - main represente le code en production ║"
39
- echo "║ - Les changements doivent passer par release ou hotfix ║"
40
- echo "║ ║"
41
- echo "║ ALTERNATIVES: ║"
42
- echo "║ → Correction urgente? /gitflow:10-start hotfix <nom> ║"
43
- echo "║ → Nouvelle release? /gitflow:10-start release ║"
44
- echo "╚══════════════════════════════════════════════════════════════════════════════╝"
45
- echo ""
23
+ # BLOCAGE: main
24
+ [[ "$CURRENT" == "main" ]] && {
25
+ echo "⛔ COMMIT BLOQUÉ - main est protégé"
26
+ echo " /gitflow:10-start hotfix <nom> ou /gitflow:10-start release"
46
27
  exit 1
47
- fi
48
-
49
- # ═══════════════════════════════════════════════════════════════
50
- # AVERTISSEMENT: Commit direct sur develop
51
- # ═══════════════════════════════════════════════════════════════
52
- if [[ "$CURRENT" == "develop" ]]; then
53
- echo ""
54
- echo "╔══════════════════════════════════════════════════════════════════════════════╗"
55
- echo "║ ⚠️ ATTENTION - COMMIT SUR DEVELOP ║"
56
- echo "╠══════════════════════════════════════════════════════════════════════════════╣"
57
- echo "║ Vous etes sur 'develop' - les commits directs sont deconseilles. ║"
58
- echo "║ ║"
59
- echo "║ GitFlow recommande de passer par des branches feature car: ║"
60
- echo "║ - Permet la review avant integration ║"
61
- echo "║ - Isole les changements en cours ║"
62
- echo "║ - Facilite le rollback si necessaire ║"
63
- echo "║ ║"
64
- echo "║ ALTERNATIVE RECOMMANDEE: ║"
65
- echo "║ → /gitflow:10-start feature <nom> ║"
66
- echo "╚══════════════════════════════════════════════════════════════════════════════╝"
67
- echo ""
68
- fi
69
- ```
70
-
71
- **Si sur develop, demander confirmation:**
72
- ```javascript
73
- if (CURRENT === "develop") {
74
- AskUserQuestion({
75
- questions: [{
76
- question: "Voulez-vous vraiment committer directement sur develop ?",
77
- header: "Confirm",
78
- options: [
79
- { label: "Non, creer une feature", description: "Recommande - /gitflow:10-start feature" },
80
- { label: "Oui, commit direct", description: "Non recommande - bypass GitFlow" }
81
- ],
82
- multiSelect: false
83
- }]
84
- })
85
-
86
- if (response === "Non, creer une feature") {
87
- // Executer le processus RESCUE TO FEATURE
88
- // Voir section 0.1.1 ci-dessous pour les details
89
- executeRescueToFeature()
90
- }
91
28
  }
29
+
30
+ # AVERTISSEMENT: develop
31
+ [[ "$CURRENT" == "develop" ]] && echo "⚠️ Commit sur develop déconseillé → /gitflow:10-start feature"
92
32
  ```
93
33
 
94
- ### 0.1.1 RESCUE TO FEATURE - Sauvetage des modifications develop vers feature
34
+ **Si sur develop:** Proposer `RESCUE TO FEATURE` (voir section suivante)
95
35
 
96
- > **CLAUDE INSTRUCTION:** Cette section est executee quand l'utilisateur choisit "Non, creer une feature".
97
- > Elle analyse l'etat de develop et sauve TOUT le travail vers une feature branch.
36
+ ### 0.2 RESCUE TO FEATURE (si sur develop)
98
37
 
99
- **ETAPE R1: Analyser l'etat complet de develop**
38
+ Analyse l'état et sauve tout vers une feature:
100
39
 
101
40
  ```bash
102
- # Fetch pour avoir les infos a jour
103
- git fetch origin --quiet 2>/dev/null
104
-
105
- # Etat du working directory
41
+ git fetch origin --quiet
106
42
  STAGED=$(git diff --cached --name-only | wc -l)
107
43
  MODIFIED=$(git diff --name-only | wc -l)
108
44
  UNTRACKED=$(git ls-files --others --exclude-standard | wc -l)
109
-
110
- # Determiner si dirty
111
- if [ "$STAGED" -gt 0 ] || [ "$MODIFIED" -gt 0 ] || [ "$UNTRACKED" -gt 0 ]; then
112
- HAS_CHANGES="true"
113
- else
114
- HAS_CHANGES="false"
115
- fi
116
-
117
- # Commits locaux non pushes
118
45
  LOCAL_COMMITS=$(git rev-list --count origin/develop..HEAD 2>/dev/null || echo "0")
119
-
120
- # Commits distants non recuperes
121
46
  REMOTE_COMMITS=$(git rev-list --count HEAD..origin/develop 2>/dev/null || echo "0")
122
-
123
- # Determiner l'etat de synchronisation
124
- if [ "$LOCAL_COMMITS" -eq 0 ] && [ "$REMOTE_COMMITS" -eq 0 ]; then
125
- SYNC_STATE="SYNCED"
126
- elif [ "$LOCAL_COMMITS" -gt 0 ] && [ "$REMOTE_COMMITS" -eq 0 ]; then
127
- SYNC_STATE="AHEAD"
128
- elif [ "$LOCAL_COMMITS" -eq 0 ] && [ "$REMOTE_COMMITS" -gt 0 ]; then
129
- SYNC_STATE="BEHIND"
130
- else
131
- SYNC_STATE="DIVERGED"
132
- fi
133
-
134
- echo ""
135
- echo "=============================================================================="
136
- echo " ANALYSE DE DEVELOP"
137
- echo "=============================================================================="
138
- echo ""
139
- echo "Working directory: $HAS_CHANGES"
140
- echo " - Fichiers stages: $STAGED"
141
- echo " - Fichiers modifies: $MODIFIED"
142
- echo " - Fichiers non suivis: $UNTRACKED"
143
- echo ""
144
- echo "Commits locaux (non pushes): $LOCAL_COMMITS"
145
- echo "Commits distants (a recuperer): $REMOTE_COMMITS"
146
- echo "Etat de synchronisation: $SYNC_STATE"
147
- echo ""
148
-
149
- # Afficher les commits locaux si present
150
- if [ "$LOCAL_COMMITS" -gt 0 ]; then
151
- echo "COMMITS LOCAUX:"
152
- echo "------------------------------------------------------------------------------"
153
- git log origin/develop..HEAD --oneline
154
- echo "------------------------------------------------------------------------------"
155
- fi
156
-
157
- # Afficher les commits distants si present
158
- if [ "$REMOTE_COMMITS" -gt 0 ]; then
159
- echo ""
160
- echo "COMMITS DISTANTS A RECUPERER:"
161
- echo "------------------------------------------------------------------------------"
162
- git log HEAD..origin/develop --oneline
163
- echo "------------------------------------------------------------------------------"
164
- fi
165
-
166
- echo "=============================================================================="
167
- ```
168
-
169
- **ETAPE R2: Traitement selon le cas detecte**
170
-
171
- ```javascript
172
- // CAS 1: CLEAN - Rien a sauver
173
- if (HAS_CHANGES === "false" && LOCAL_COMMITS === 0 && SYNC_STATE === "SYNCED") {
174
- console.log("")
175
- console.log("==============================================================================")
176
- console.log(" DEVELOP EST PROPRE")
177
- console.log("==============================================================================")
178
- console.log("")
179
- console.log("Aucune modification detectee sur develop.")
180
- console.log("Vous pouvez creer une feature directement.")
181
- console.log("")
182
- console.log("PROCHAINE ETAPE:")
183
- console.log(" /gitflow:10-start feature <nom>")
184
- console.log("")
185
- console.log("==============================================================================")
186
- exit(0)
187
- }
188
-
189
- // CAS 2-9: Il y a quelque chose a sauver - Demander le nom de la feature
190
- ```
191
-
192
- **Generer un nom suggere depuis les commits (si applicable):**
193
-
194
- ```bash
195
- # ═══════════════════════════════════════════════════════════════
196
- # FONCTION DE NORMALISATION DES NOMS
197
- # ═══════════════════════════════════════════════════════════════
198
- normalize_name() {
199
- local input="$1"
200
- local max_length="${2:-50}"
201
-
202
- # 1. Convertir en minuscules
203
- local result=$(echo "$input" | tr '[:upper:]' '[:lower:]')
204
-
205
- # 2. Supprimer les accents (francais)
206
- result=$(echo "$result" | sed 'y/àâäéèêëïîôùûüçÀÂÄÉÈÊËÏÎÔÙÛÜÇ/aaaeeeeiioouucaaaeeeeiioouuc/')
207
-
208
- # 3. Remplacer les espaces, underscores et caracteres speciaux par des tirets
209
- result=$(echo "$result" | sed 's/[ _:()]/-/g')
210
-
211
- # 4. Supprimer les caracteres non autorises (garder uniquement a-z, 0-9, -)
212
- result=$(echo "$result" | sed 's/[^a-z0-9-]//g')
213
-
214
- # 5. Supprimer les tirets multiples
215
- result=$(echo "$result" | sed 's/--*/-/g')
216
-
217
- # 6. Supprimer les tirets en debut/fin
218
- result=$(echo "$result" | sed 's/^-//;s/-$//')
219
-
220
- # 7. Tronquer a la longueur max
221
- result=$(echo "$result" | cut -c1-$max_length)
222
-
223
- # 8. Supprimer le tiret final apres troncature
224
- result=$(echo "$result" | sed 's/-$//')
225
-
226
- echo "$result"
227
- }
228
-
229
- # Si des commits locaux existent, extraire un nom suggere du premier commit
230
- if [ "$LOCAL_COMMITS" -gt 0 ]; then
231
- FIRST_COMMIT_MSG=$(git log -1 --format='%s' origin/develop..HEAD)
232
- # Normaliser avec la fonction
233
- SUGGESTED_NAME=$(normalize_name "$FIRST_COMMIT_MSG" 40)
234
- echo "Nom suggere: $SUGGESTED_NAME"
235
- fi
236
47
  ```
237
48
 
238
- **Demander la description de la feature:**
239
-
240
- > **NOTE:** Le prefix `feature/` reste TOUJOURS en anglais.
241
- > Seule la partie descriptive utilise la langue configuree.
242
-
243
- ```javascript
244
- // Lire la config de langue depuis .claude/gitflow/config.json
245
- const langConfig = readConfig()?.language || { code: "en" }
246
- const isEnglish = langConfig.code === "en"
247
-
248
- // Construire les options selon qu'on a un nom suggere ou non
249
- const options = []
250
-
251
- if (SUGGESTED_NAME && SUGGESTED_NAME.length > 0) {
252
- options.push({ label: SUGGESTED_NAME, description: "Genere depuis vos commits (Recommande)" })
253
- }
254
-
255
- // Suggestions de verbes d'action selon la langue
256
- // Le prefix de branche "feature/" ne change PAS
257
- if (isEnglish) {
258
- options.push({ label: "add-", description: "Add a new feature → feature/add-..." })
259
- options.push({ label: "update-", description: "Update existing → feature/update-..." })
260
- options.push({ label: "fix-", description: "Fix a bug → feature/fix-..." })
261
- options.push({ label: "refactor-", description: "Refactor code → feature/refactor-..." })
262
- } else {
263
- options.push({ label: "ajouter-", description: "Nouvelle fonctionnalite → feature/ajouter-..." })
264
- options.push({ label: "modifier-", description: "Modifier existant → feature/modifier-..." })
265
- options.push({ label: "corriger-", description: "Corriger un bug → feature/corriger-..." })
266
- options.push({ label: "refactorer-", description: "Refactorer du code → feature/refactorer-..." })
267
- }
49
+ **Classification:**
268
50
 
269
- AskUserQuestion({
270
- questions: [{
271
- question: isEnglish
272
- ? "Describe the feature (branch will be feature/your-description)"
273
- : "Decrivez la feature (branche sera feature/votre-description)",
274
- header: "Feature",
275
- options: options,
276
- multiSelect: false
277
- }]
278
- })
279
-
280
- // Le nom fourni par l'utilisateur (via option ou "Other")
281
- RAW_FEATURE_NAME = response
282
- ```
51
+ | Cas | Condition | Action |
52
+ |-----|-----------|--------|
53
+ | CLEAN | Rien à sauver | → /gitflow:10-start feature |
54
+ | DIRTY_ONLY | Modifications, 0 commits | Stash → Créer feature → Unstash |
55
+ | COMMITS_ONLY | Commits locaux, clean | Branch → Reset develop → Checkout |
56
+ | COMMITS_AND_DIRTY | Les deux | Stash → Branch → Reset → Checkout → Unstash |
57
+ | BEHIND | Remote en avance | Pull d'abord |
58
+ | DIVERGED | Complexe | Rebase ou sauvegarder |
283
59
 
284
- **Normaliser le nom saisi par l'utilisateur:**
60
+ **Exécution rescue:**
285
61
 
286
62
  ```bash
287
- # ═══════════════════════════════════════════════════════════════
288
- # NORMALISATION OBLIGATOIRE DU NOM DE FEATURE
289
- # ═══════════════════════════════════════════════════════════════
290
- # Le nom saisi par l'utilisateur peut contenir:
291
- # - Des accents (e, a, etc.)
292
- # - Des espaces
293
- # - Des majuscules
294
- # - Des caracteres speciaux
295
- #
296
- # Exemples de normalisation:
297
- # "Ajouter l'authentification" → "ajouter-lauthentification"
298
- # "Fix bug dans le Login !!" → "fix-bug-dans-le-login"
299
- # "Améliorer performance API" → "ameliorer-performance-api"
300
- # ═══════════════════════════════════════════════════════════════
301
-
302
- FEATURE_NAME=$(normalize_name "$RAW_FEATURE_NAME" 50)
303
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
304
-
305
- # Afficher la normalisation si differente
306
- if [ "$RAW_FEATURE_NAME" != "$FEATURE_NAME" ]; then
307
- echo ""
308
- echo "Nom normalise: '$RAW_FEATURE_NAME' → '$FEATURE_NAME'"
309
- fi
310
- ```
63
+ RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
64
+ git tag "$RESCUE_TAG" HEAD # Backup
311
65
 
312
- **ETAPE R3: Confirmer si cas complexe (divergence ou rebase necessaire)**
313
-
314
- ```javascript
315
- // Si divergence ou rebase necessaire, demander confirmation
316
- if (SYNC_STATE === "DIVERGED" || (LOCAL_COMMITS > 0 && REMOTE_COMMITS > 0)) {
317
- AskUserQuestion({
318
- questions: [{
319
- question: "Situation complexe detectee. Comment proceder ?",
320
- header: "Strategy",
321
- options: [
322
- { label: "Rebase (Recommande)", description: "Rejouer vos commits sur origin/develop a jour" },
323
- { label: "Sauvegarder uniquement", description: "Creer la feature sans rebase (vous devrez rebase plus tard)" },
324
- { label: "Annuler", description: "Ne rien faire, je gere manuellement" }
325
- ],
326
- multiSelect: false
327
- }]
328
- })
329
-
330
- if (response === "Annuler") {
331
- console.log("Operation annulee.")
332
- exit(0)
333
- }
334
-
335
- STRATEGY = response
66
+ [ "$HAS_CHANGES" = "true" ] && git stash push -m "rescue" --include-untracked
67
+ [ "$LOCAL_COMMITS" -gt 0 ] && {
68
+ git branch "$FEATURE_BRANCH"
69
+ git reset --hard origin/develop
336
70
  }
337
- ```
338
-
339
- **ETAPE R4: Executer le rescue**
71
+ git checkout -b "$FEATURE_BRANCH" 2>/dev/null || git checkout "$FEATURE_BRANCH"
72
+ [ "$STASHED" = "true" ] && git stash pop
340
73
 
341
- ```bash
342
- echo ""
343
- echo "=== RESCUE EN COURS ==="
344
- echo ""
345
-
346
- # Point de restauration (toujours creer un backup)
347
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
348
- git tag "${RESCUE_TAG}" HEAD
349
- echo "[1/N] Point de restauration cree: ${RESCUE_TAG}"
350
-
351
- # ═══════════════════════════════════════════════════════════════
352
- # EXECUTION SELON LE CAS
353
- # ═══════════════════════════════════════════════════════════════
354
-
355
- STEP=2
356
-
357
- # Si modifications non committees: stash
358
- if [ "$HAS_CHANGES" = "true" ]; then
359
- git stash push -m "gitflow-rescue: WIP pour ${FEATURE_BRANCH}" --include-untracked
360
- echo "[$STEP/N] Modifications sauvegardees (stash)"
361
- STASHED="true"
362
- STEP=$((STEP + 1))
363
- fi
364
-
365
- # Si commits locaux: creer branche puis reset develop
366
- if [ "$LOCAL_COMMITS" -gt 0 ]; then
367
- # Creer la feature branch a partir de HEAD actuel (avec les commits)
368
- git branch "${FEATURE_BRANCH}"
369
- echo "[$STEP/N] Branche ${FEATURE_BRANCH} creee avec ${LOCAL_COMMITS} commits"
370
- STEP=$((STEP + 1))
371
-
372
- # Reset develop a origin/develop
373
- git reset --hard origin/develop
374
- echo "[$STEP/N] develop reset a origin/develop"
375
- STEP=$((STEP + 1))
376
-
377
- # Checkout la feature
378
- git checkout "${FEATURE_BRANCH}"
379
- echo "[$STEP/N] Bascule sur ${FEATURE_BRANCH}"
380
- STEP=$((STEP + 1))
381
-
382
- # Si behind ET strategie rebase: rebaser sur develop a jour
383
- if [ "$REMOTE_COMMITS" -gt 0 ] && [ "$STRATEGY" = "Rebase (Recommande)" ]; then
384
- echo "[$STEP/N] Rebase en cours..."
385
- if git rebase origin/develop; then
386
- echo " Rebase reussi"
387
- else
388
- echo ""
389
- echo "=============================================================================="
390
- echo " CONFLITS DE REBASE DETECTES"
391
- echo "=============================================================================="
392
- echo ""
393
- echo "Des conflits ont ete detectes lors du rebase."
394
- echo ""
395
- echo "RESOLUTION:"
396
- echo " 1. Resolvez les conflits dans les fichiers marques"
397
- echo " 2. git add <fichiers resolus>"
398
- echo " 3. git rebase --continue"
399
- echo ""
400
- echo "OU pour annuler:"
401
- echo " git rebase --abort"
402
- echo ""
403
- echo "Point de restauration: ${RESCUE_TAG}"
404
- echo " Restaurer: git checkout develop && git reset --hard ${RESCUE_TAG}"
405
- echo ""
406
- echo "=============================================================================="
407
- exit 1
408
- fi
409
- STEP=$((STEP + 1))
410
- fi
411
-
412
- else
413
- # Pas de commits locaux: simple checkout -b
414
- # Si behind: pull d'abord
415
- if [ "$REMOTE_COMMITS" -gt 0 ]; then
416
- git pull origin develop --ff-only
417
- echo "[$STEP/N] develop synchronise avec origin"
418
- STEP=$((STEP + 1))
419
- fi
420
-
421
- git checkout -b "${FEATURE_BRANCH}"
422
- echo "[$STEP/N] Branche ${FEATURE_BRANCH} creee"
423
- STEP=$((STEP + 1))
424
- fi
425
-
426
- # Restaurer le stash si applicable
427
- if [ "$STASHED" = "true" ]; then
428
- git stash pop
429
- echo "[$STEP/N] Modifications restaurees"
430
- fi
431
-
432
- # ═══════════════════════════════════════════════════════════════
433
- # AFFICHER LE RESULTAT
434
- # ═══════════════════════════════════════════════════════════════
435
-
436
- echo ""
437
- echo "=============================================================================="
438
- echo " RESCUE REUSSI"
439
- echo "=============================================================================="
440
- echo ""
441
- echo "Feature creee: ${FEATURE_BRANCH}"
442
- if [ "$LOCAL_COMMITS" -gt 0 ]; then
443
- echo "Commits deplaces: ${LOCAL_COMMITS}"
444
- fi
445
- if [ "$STASHED" = "true" ]; then
446
- echo "Modifications restaurees: $(git status --short | wc -l) fichiers"
447
- fi
448
- echo ""
449
- echo "develop: Propre et synchronise avec origin"
450
- echo "${FEATURE_BRANCH}: Contient tout votre travail"
451
- echo ""
452
- echo "PROCHAINES ETAPES:"
453
- echo " /gitflow:3-commit -> Committer vos modifications"
454
- echo " /gitflow:7-pull-request -> Creer une PR quand pret"
455
- echo ""
456
- echo "Point de restauration: ${RESCUE_TAG}"
457
- echo " En cas de probleme: git checkout develop && git reset --hard ${RESCUE_TAG}"
458
- echo ""
459
- echo "=============================================================================="
74
+ echo "✓ Rescue: $FEATURE_BRANCH créée | develop propre | Backup: $RESCUE_TAG"
460
75
  ```
461
76
 
462
- ---
463
-
464
- ### 0.2 Verification synchronisation
77
+ ### 0.3 Vérification synchronisation
465
78
 
466
79
  ```bash
467
- # Verifier si la branche est a jour avec le remote
468
- git fetch origin --quiet 2>/dev/null
469
-
470
80
  BEHIND=$(git rev-list --count HEAD..origin/$CURRENT 2>/dev/null || echo "0")
471
-
472
- if [ "$BEHIND" -gt 0 ]; then
473
- echo ""
474
- echo "┌──────────────────────────────────────────────────────────────────────────────┐"
475
- echo "│ ⚠️ BRANCHE EN RETARD │"
476
- echo "├──────────────────────────────────────────────────────────────────────────────┤"
477
- echo "│ Votre branche est $BEHIND commits en retard par rapport au remote. │"
478
- echo "│ │"
479
- echo "│ RECOMMANDATION: │"
480
- echo "│ → Synchronisez d'abord: git pull --rebase origin $CURRENT │"
481
- echo "│ → Ou utilisez: /gitflow:13-sync │"
482
- echo "└──────────────────────────────────────────────────────────────────────────────┘"
483
- echo ""
484
- fi
485
- ```
486
-
487
- **Si en retard, demander synchronisation:**
488
- ```javascript
489
- if (BEHIND > 0) {
490
- AskUserQuestion({
491
- questions: [{
492
- question: `Votre branche est ${BEHIND} commits en retard. Synchroniser ?`,
493
- header: "Sync",
494
- options: [
495
- { label: "Oui, synchroniser", description: "git pull --rebase (Recommande)" },
496
- { label: "Non, continuer", description: "Commit sans sync (risque de conflit au push)" }
497
- ],
498
- multiSelect: false
499
- }]
500
- })
501
-
502
- if (response === "Oui, synchroniser") {
503
- // Executer git pull --rebase
504
- result = exec("git pull --rebase origin " + CURRENT)
505
- if (result.exitCode !== 0) {
506
- console.log("Conflits detectes. Resolvez-les puis relancez /gitflow:3-commit")
507
- exit(1)
508
- }
509
- }
510
- }
81
+ [ "$BEHIND" -gt 0 ] && echo "⚠️ Branche $BEHIND commits en retard → /gitflow:13-sync"
511
82
  ```
512
83
 
513
- ### 0.3 Verification working directory
84
+ ### 0.4 Vérification working directory
514
85
 
515
86
  ```bash
516
- # Verifier s'il y a des fichiers a committer
517
87
  STAGED=$(git diff --cached --name-only | wc -l)
518
88
  MODIFIED=$(git diff --name-only | wc -l)
519
89
  UNTRACKED=$(git ls-files --others --exclude-standard | wc -l)
520
90
 
521
- if [ "$STAGED" -eq 0 ] && [ "$MODIFIED" -eq 0 ] && [ "$UNTRACKED" -eq 0 ]; then
522
- echo ""
523
- echo "✅ Rien a committer - working directory propre"
524
- echo ""
91
+ [ "$STAGED" -eq 0 ] && [ "$MODIFIED" -eq 0 ] && [ "$UNTRACKED" -eq 0 ] && {
92
+ echo "✓ Rien à committer"
525
93
  exit 0
526
- fi
527
-
528
- # Afficher resume
529
- echo ""
530
- echo "FICHIERS DETECTES:"
531
- echo " Staged: $STAGED"
532
- echo " Modified: $MODIFIED"
533
- echo " Untracked: $UNTRACKED"
534
- echo ""
94
+ }
535
95
  ```
536
96
 
537
97
  ---
538
98
 
539
- ## Workflow
540
-
541
- ### 1. Analyze files
542
-
543
- - Staged files
544
- - Modified files not staged
545
- - Untracked files
546
- - Detect migration files in each category
99
+ ## Workflow Principal
547
100
 
548
- ### 2. Validate migrations
101
+ ### 1. Analyser fichiers
549
102
 
550
- A valid EF Core migration = **3 files** :
551
- - `{Timestamp}_{Name}.cs` - Main migration
552
- - `{Timestamp}_{Name}.Designer.cs` - Metadata
553
- - `{Context}ModelSnapshot.cs` - Model state
103
+ Détecter: staged, modified, untracked, fichiers migration
554
104
 
555
- **Checks:**
556
- - All 3 files are present
557
- - Build compiles (`dotnet build`)
558
- - No ModelSnapshot conflicts with develop
105
+ ### 2. Valider migrations EF Core
559
106
 
560
- ### 3. ⚠️ SAFETY CHECK - Destructive operations
107
+ Migration valide = **3 fichiers**:
108
+ - `{Timestamp}_{Name}.cs`
109
+ - `{Timestamp}_{Name}.Designer.cs`
110
+ - `{Context}ModelSnapshot.cs`
561
111
 
562
- **BLOCKING** - Scan migrations for dangerous operations :
112
+ ### 3. Check opérations destructives (BLOQUANT)
563
113
 
564
114
  ```bash
565
- # Patterns to detect in migration .cs files
566
- grep -n "DropTable\|DropColumn\|DropIndex\|DropForeignKey\|DeleteData" {migration}.cs
567
- grep -n "migrationBuilder.Sql" {migration}.cs | grep -i "DELETE\|DROP\|TRUNCATE"
115
+ grep -n "DropTable\|DropColumn\|DeleteData" {migration}.cs
568
116
  ```
569
117
 
570
- **If detected :**
571
-
572
- ```
573
- ╔══════════════════════════════════════════════════════════╗
574
- ║ ⛔ DESTRUCTIVE OPERATIONS DETECTED ║
575
- ╠══════════════════════════════════════════════════════════╣
576
- ║ File: {migration}.cs ║
577
- ║ Line {X}: DropTable("Users") ║
578
- ║ Line {Y}: DropColumn("Email", "Customers") ║
579
- ╠══════════════════════════════════════════════════════════╣
580
- ║ RISKS: ║
581
- ║ - Irreversible data loss ║
582
- ║ - Verify that you have a BACKUP ║
583
- ╚══════════════════════════════════════════════════════════╝
584
- ```
585
-
586
- **Actions:**
587
- 1. Display detailed alert (file, line, operation)
588
- 2. Request explicit confirmation: "Do you confirm? (yes/no)"
589
- 3. If "no" → Cancel commit
590
- 4. If "yes" → Log in [.claude/gitflow/logs/](.claude/gitflow/logs/)`dangerous-migrations.json`
591
- 5. Continue commit
592
-
593
- **Dangerous patterns:**
594
-
595
- | Pattern | Risk | Level |
596
- |---------|------|-------|
597
- | `DropTable` | Delete entire table | CRITICAL |
598
- | `DropColumn` | Data loss in column | CRITICAL |
599
- | `DeleteData` | Delete rows | CRITICAL |
600
- | `DropForeignKey` | Break integrity | HIGH |
601
- | `DropIndex` | Performance impact | MEDIUM |
602
- | `Sql("DELETE...")` | Raw destructive SQL | CRITICAL |
603
- | `Sql("DROP...")` | Raw destructive SQL | CRITICAL |
604
- | `Sql("TRUNCATE...")` | Empty table | CRITICAL |
605
-
606
- ### 4. Classify commit
607
-
608
- | Files | Type | Prefix |
609
- |-------|------|--------|
610
- | Migrations only | migration | `db(migrations):` |
611
- | Migrations + code | mixed | `feat:` or `fix:` |
612
- | Code without migration | code | Based on branch type |
613
- | Config/docs | chore | `chore:` |
614
-
615
- ### 5. Generate message (if absent)
616
-
617
- > **CLAUDE INSTRUCTION - REDACTION EXPERTE DES COMMITS**
618
- >
619
- > Chaque message de commit doit etre **auto-explicatif** et repondre a 3 questions:
620
- > 1. **Quel probleme existait?** (justifie le changement)
621
- > 2. **Quelle solution?** (explique l'approche technique)
622
- > 3. **Quel gain?** (motive l'adoption)
623
-
624
- #### 5.1 Format standard - Commit simple
118
+ | Pattern | Risque |
119
+ |---------|--------|
120
+ | `DropTable` | CRITICAL - Perte table |
121
+ | `DropColumn` | CRITICAL - Perte données |
122
+ | `DeleteData` | CRITICAL - Perte lignes |
123
+ | `DropForeignKey` | HIGH - Intégrité |
625
124
 
626
- ```
627
- {type}({scope}): {resume impact en 50 chars max}
125
+ **Si détecté:** Confirmation explicite requise, log dans `.claude/gitflow/logs/`
628
126
 
629
- {Pour chaque modification significative, UN PARAGRAPHE structure:}
127
+ ### 4. Classifier commit
630
128
 
631
- **{NOM_CHANGEMENT}**
632
- Resout le probleme ou {description situation problematique}.
633
- Implemente {solution technique} qui permet desormais de {capacite gagnee}.
634
- ```
129
+ | Fichiers | Prefix |
130
+ |----------|--------|
131
+ | Migrations seules | `db(migrations):` |
132
+ | Migrations + code | `feat:` ou `fix:` |
133
+ | Code sans migration | Selon type branche |
134
+ | Config/docs | `chore:` |
635
135
 
636
- #### 5.2 Format expert - Commit multi-changements
136
+ ### 5. Générer message (si absent)
637
137
 
138
+ **Format:**
638
139
  ```
639
- {type}({scope}): {verbe d'impact} {objet} pour {objectif}
140
+ {type}({scope}): {résumé 50 chars}
640
141
 
641
- **{CHANGEMENT_1}**
642
- PROBLEME: {Quel dysfonctionnement/manque existait?}
643
- SOLUTION: {Quelle approche technique adoptee?}
644
- IMPACT: {Qu'est-ce que l'utilisateur/developpeur gagne?}
645
-
646
- **{CHANGEMENT_2}**
647
- Avant: {etat problematique}.
648
- Apres: {nouvel etat ameliore}.
649
- Technique: {approche utilisee}.
650
-
651
- Fichiers: {liste fichiers principaux avec leur role}
142
+ **{CHANGEMENT}**
143
+ PROBLEME: {situation problématique}
144
+ SOLUTION: {approche technique}
145
+ IMPACT: {bénéfice}
652
146
 
653
147
  Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
654
148
  ```
655
149
 
656
- #### 5.3 Regles de redaction
657
-
658
- | Principe | Application |
659
- |----------|-------------|
660
- | **Atomicite** | 1 commit = 1 intention logique |
661
- | **Contexte** | Le "pourquoi" AVANT le "quoi" |
662
- | **Impact** | Toujours mentionner le benefice utilisateur |
663
- | **Autonomie** | Chaque paragraphe comprehensible seul |
664
- | **Concision** | Maximum d'info, minimum de mots |
665
-
666
- #### 5.4 Verbes d'impact (preferer)
667
-
668
- | Eviter | Utiliser |
669
- |--------|----------|
670
- | "Ajout de..." | "Implemente X pour Y" |
671
- | "Modification de..." | "Optimise X qui permet Y" |
672
- | "Correction de..." | "Resout X cause par Y" |
673
- | "Mise a jour..." | "Ameliore X en Y" |
674
-
675
- #### 5.5 Templates par type
676
-
677
- **Migration:**
678
- ```
679
- db(migrations): {action} {description}
680
-
681
- **MIGRATION: {MigrationName}**
682
- PROBLEME: {Pourquoi cette migration est necessaire}
683
- SOLUTION: {Tables/colonnes ajoutees/modifiees}
684
- IMPACT: {Nouvelles capacites pour l'application}
685
-
686
- Tables: {CREATE|ALTER|DROP} {tables}
687
- Context: {DbContext}
688
- ```
689
-
690
- **Feature:**
691
- ```
692
- feat({scope}): {description impact}
693
-
694
- **{NOM_FEATURE}**
695
- PROBLEME: {Manque ou limitation actuelle}
696
- SOLUTION: {Implementation technique choisie}
697
- IMPACT: {Benefice utilisateur concret}
698
-
699
- Fichiers cles:
700
- - {path/file1.ext}: {role en 5 mots}
701
- - {path/file2.ext}: {role en 5 mots}
702
- ```
150
+ **Verbes d'impact:**
151
+ - `Implemente X pour Y` (pas "Ajout de...")
152
+ - `Optimise X qui permet Y` (pas "Modification...")
153
+ - `Resout X cause par Y` (pas "Correction...")
703
154
 
704
- **Fix:**
705
- ```
706
- fix({scope}): resout {symptome} dans {contexte}
155
+ ### 6. Exécuter commit
707
156
 
708
- **{NOM_BUG}**
709
- SYMPTOME: {Ce que l'utilisateur observait}
710
- CAUSE: {Origine technique du probleme}
711
- CORRECTION: {Comment le fix resout le probleme}
712
- VERIFICATION: {Comment confirmer que c'est corrige}
713
- ```
714
-
715
- **Mixed (code + migrations):**
716
- ```
717
- feat({scope}): {description}
718
-
719
- **{FEATURE}**
720
- {Paragraphe explicatif}
721
-
722
- **MIGRATIONS INCLUSES**
723
- - {MigrationName}: {ce qu'elle apporte}
724
-
725
- Fichiers: {liste}
157
+ ```bash
158
+ git add -A
159
+ git commit -m "$MESSAGE"
726
160
  ```
727
161
 
728
- ### 6. Execute commit
729
-
730
- - Add missing migration files if necessary
731
- - Verify one last time
732
- - Commit with message
733
-
734
- ### 7. Post-commit
735
-
736
- - Verify no migration files are left uncommitted
737
- - Display summary
162
+ ### 7. Push automatique
738
163
 
739
- ### 8. Automatic push (based on config)
164
+ Config: `.claude/gitflow/config.json` `workflow.push.afterCommit`
740
165
 
741
- Read config: `.claude/gitflow/config.json` `workflow.push.afterCommit`
166
+ | Config | Worktree | Action |
167
+ |--------|----------|--------|
168
+ | `worktree` | Oui | Push auto |
169
+ | `worktree` | Non | Demander |
170
+ | `always` | - | Push auto |
171
+ | `ask` | - | Demander |
172
+ | `never` | - | Pas de push |
742
173
 
743
- **Worktree detection:**
744
- ```bash
745
- # If git-common-dir != .git → it's a worktree
746
- COMMON_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
747
- if [[ "$COMMON_DIR" != ".git" && "$COMMON_DIR" != "." ]]; then
748
- IS_WORKTREE=true
749
- fi
750
- ```
751
-
752
- **Push logic:**
174
+ ---
753
175
 
754
- | Config `afterCommit` | Worktree | Action |
755
- |---------------------|----------|--------|
756
- | `worktree` | Yes | Automatic push |
757
- | `worktree` | No | Ask user |
758
- | `always` | - | Automatic push |
759
- | `ask` | - | Ask user |
760
- | `never` | - | Do not push |
176
+ ## Résumé
761
177
 
762
- **If user is asked:**
763
- ```
764
- AskUserQuestion({
765
- questions: [{
766
- question: "Do you want to push this commit?",
767
- header: "Push",
768
- options: [
769
- { label: "Yes, push now", description: "git push origin <branch>" },
770
- { label: "No, later", description: "Local commit only" }
771
- ],
772
- multiSelect: false
773
- }]
774
- })
775
178
  ```
179
+ COMMIT CRÉÉ
180
+ - Branche: {branch} | Hash: {hash}
181
+ - Message: {message}
182
+ - Fichiers: {N} modifiés
183
+ - EF Core: {OK|N/A}
184
+ - Push: {done|pending}
776
185
 
777
- **Execute push:**
778
- ```bash
779
- git push origin $(git branch --show-current)
186
+ Prochain: /gitflow:7-pull-request
780
187
  ```
781
188
 
782
- **Push error handling:**
783
- - If remote not configured → Skip with message
784
- - If rebase necessary → Warn and suggest:
785
- ```
786
- /gitflow:4-plan rebase
787
- ```
788
- - If branch protected → Warn (PR required)
789
-
790
189
  ---
791
190
 
792
- ## Common errors
191
+ ## Erreurs courantes
793
192
 
794
- | Error | Solution |
795
- |-------|----------|
796
- | ModelSnapshot missing | Add the file |
797
- | Designer missing | Add the file |
798
- | Build fails | `dotnet ef migrations remove` + fix |
799
- | Conflict detected | Rebase first |
800
- | **Destructive operation** | Confirm or modify migration |
801
-
802
- ---
803
-
804
- ## Resume
805
-
806
- **Afficher un resume apres le commit:**
807
-
808
- ```
809
- ═══════════════════════════════════════════════════════════════════════════════
810
- COMMIT CRÉÉ
811
- ═══════════════════════════════════════════════════════════════════════════════
812
-
813
- COMMIT DETAILS
814
- ───────────────────────────────────────────────────────────────────────────────
815
- • Branche: {branch_name}
816
- • Hash: {commit_hash_short}
817
- • Message: {commit_message}
818
- • Fichiers: {N} fichiers modifiés
819
-
820
- FICHIERS INCLUS
821
- ───────────────────────────────────────────────────────────────────────────────
822
- {type_icon} {file_1}
823
- {type_icon} {file_2}
824
- {type_icon} {file_3}
825
- ... ({N} fichiers au total)
826
-
827
- WORKFLOW STATUT
828
- ───────────────────────────────────────────────────────────────────────────────
829
- ✓ Fichiers stagés
830
- ✓ Validations EF Core passées (si applicable)
831
- ✓ Commit créé localement
832
- ✓ Push vers origin/{branch} (si auto-push activé)
833
-
834
- ═══════════════════════════════════════════════════════════════════════════════
835
- PROCHAINES ÉTAPES
836
- ═══════════════════════════════════════════════════════════════════════════════
837
-
838
- 1. Continuer à développer et committer:
839
- /gitflow:3-commit
840
-
841
- 2. Quand prêt, créer une Pull Request:
842
- /gitflow:7-pull-request {branch_name}
843
-
844
- ═══════════════════════════════════════════════════════════════════════════════
845
- ```
846
-
847
- **Si des migrations EF Core sont incluses:**
848
-
849
- ```
850
- ═══════════════════════════════════════════════════════════════════════════════
851
- COMMIT AVEC MIGRATIONS
852
- ═══════════════════════════════════════════════════════════════════════════════
853
-
854
- COMMIT DETAILS
855
- ───────────────────────────────────────────────────────────────────────────────
856
- • Branche: {branch_name}
857
- • Hash: {commit_hash_short}
858
- • Message: {commit_message}
859
- • Fichiers: {N} fichiers modifiés
860
-
861
- MIGRATIONS EF CORE INCLUSES
862
- ───────────────────────────────────────────────────────────────────────────────
863
- ✓ {timestamp}_{MigrationName}.cs
864
- ✓ {timestamp}_{MigrationName}.Designer.cs
865
- ✓ {Context}ModelSnapshot.cs (updated)
866
-
867
- VALIDATIONS
868
- ───────────────────────────────────────────────────────────────────────────────
869
- ✓ Les 3 fichiers de migration sont présents
870
- ✓ Build vérifié
871
- ✓ Pas d'opérations destructives détectées
872
-
873
- WORKFLOW STATUT
874
- ───────────────────────────────────────────────────────────────────────────────
875
- ✓ Fichiers stagés
876
- ✓ Validations EF Core passées
877
- ✓ Commit créé localement
878
- ✓ Push vers origin/{branch}
879
-
880
- ═══════════════════════════════════════════════════════════════════════════════
881
- PROCHAINES ÉTAPES
882
- ═══════════════════════════════════════════════════════════════════════════════
883
-
884
- 1. Appliquer la migration en local:
885
- /efcore:db-deploy
886
-
887
- 2. Continuer à développer ou créer une PR:
888
- /gitflow:7-pull-request {branch_name}
889
-
890
- ═══════════════════════════════════════════════════════════════════════════════
891
- ```
193
+ | Erreur | Solution |
194
+ |--------|----------|
195
+ | ModelSnapshot manquant | Ajouter le fichier |
196
+ | Build échoue | `dotnet ef migrations remove` + fix |
197
+ | Conflit détecté | Rebase d'abord |
198
+ | Opération destructive | Confirmer ou modifier |
892
199
 
893
200
  ---
894
201
 
895
202
  ## Modes
896
203
 
897
- | Command | Action |
898
- |---------|--------|
899
- | `/gitflow:3-commit {msg}` | Commit with message |
900
- | `/gitflow:3-commit` | Auto generate message |
901
- | `/gitflow:3-commit --validate` | Validate without commit |
204
+ | Commande | Action |
205
+ |----------|--------|
206
+ | `/gitflow:3-commit {msg}` | Commit avec message |
207
+ | `/gitflow:3-commit` | Auto-génère message |
208
+ | `/gitflow:3-commit --validate` | Valider sans commit |
902
209
  | `/gitflow:3-commit --dry-run` | Simulation |