@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
@@ -1,867 +0,0 @@
1
- ---
2
- description: Rescue modifications from develop to a feature branch
3
- agent: gitflow-commit
4
- model: sonnet
5
- ---
6
-
7
- # GITFLOW RESCUE - Sauvetage des modifications develop vers feature
8
-
9
- Tu es un **Expert Git** et **Expert GitFlow**. Cette commande sauve les modifications faites par erreur sur `develop` vers une branche feature propre.
10
-
11
- > **CLAUDE INSTRUCTION:** Les blocs `AskUserQuestion({...})` ci-dessous sont des instructions pour utiliser le tool `AskUserQuestion` de maniere **interactive**. Tu DOIS executer le tool avec ces parametres pour obtenir la reponse de l'utilisateur AVANT de continuer. NE PAS afficher ce code - ATTENDRE la reponse.
12
-
13
- ---
14
-
15
- ## ETAPE 1: ANALYSE COMPLETE DE L'ETAT
16
-
17
- ### 1.1 Fetch et detection
18
-
19
- ```bash
20
- # Fetch pour avoir les infos a jour
21
- git fetch origin --quiet 2>/dev/null
22
-
23
- # Etat du working directory
24
- STAGED=$(git diff --cached --name-only | wc -l)
25
- MODIFIED=$(git diff --name-only | wc -l)
26
- UNTRACKED=$(git ls-files --others --exclude-standard | wc -l)
27
-
28
- # Determiner si dirty
29
- if [ "$STAGED" -gt 0 ] || [ "$MODIFIED" -gt 0 ] || [ "$UNTRACKED" -gt 0 ]; then
30
- HAS_CHANGES="true"
31
- else
32
- HAS_CHANGES="false"
33
- fi
34
-
35
- # Commits locaux non pushes
36
- LOCAL_COMMITS=$(git rev-list --count origin/develop..HEAD 2>/dev/null || echo "0")
37
-
38
- # Commits distants non recuperes
39
- REMOTE_COMMITS=$(git rev-list --count HEAD..origin/develop 2>/dev/null || echo "0")
40
-
41
- # Determiner l'etat de synchronisation
42
- if [ "$LOCAL_COMMITS" -eq 0 ] && [ "$REMOTE_COMMITS" -eq 0 ]; then
43
- SYNC_STATE="SYNCED"
44
- elif [ "$LOCAL_COMMITS" -gt 0 ] && [ "$REMOTE_COMMITS" -eq 0 ]; then
45
- SYNC_STATE="AHEAD"
46
- elif [ "$LOCAL_COMMITS" -eq 0 ] && [ "$REMOTE_COMMITS" -gt 0 ]; then
47
- SYNC_STATE="BEHIND"
48
- else
49
- SYNC_STATE="DIVERGED"
50
- fi
51
-
52
- echo "=== ANALYSE DEVELOP ==="
53
- echo "Working directory: HAS_CHANGES=$HAS_CHANGES (staged=$STAGED, modified=$MODIFIED, untracked=$UNTRACKED)"
54
- echo "Commits: LOCAL=$LOCAL_COMMITS, REMOTE=$REMOTE_COMMITS"
55
- echo "Sync state: $SYNC_STATE"
56
- ```
57
-
58
- ### 1.2 Classification du cas
59
-
60
- | # | HAS_CHANGES | LOCAL_COMMITS | SYNC_STATE | CAS |
61
- |---|-------------|---------------|------------|-----|
62
- | 1 | false | 0 | SYNCED | CLEAN - Rien a faire |
63
- | 2 | true | 0 | SYNCED | DIRTY_ONLY - Modifications non committees |
64
- | 3 | false | >0 | AHEAD/SYNCED | COMMITS_ONLY - Commits locaux |
65
- | 4 | true | >0 | AHEAD/SYNCED | COMMITS_AND_DIRTY - Commits + modifications |
66
- | 5 | false | 0 | BEHIND | BEHIND_CLEAN - Develop en retard |
67
- | 6 | true | 0 | BEHIND | BEHIND_DIRTY - Retard + modifications |
68
- | 7 | false | >0 | BEHIND | REBASE_NEEDED - Commits + retard |
69
- | 8 | true | >0 | BEHIND | REBASE_COMPLEX - Tout combine |
70
- | 9 | * | * | DIVERGED | DIVERGED - Analyse manuelle |
71
-
72
- ---
73
-
74
- ## ETAPE 2: TRAITEMENT PAR CAS
75
-
76
- ### CAS 1: CLEAN - Rien a sauver
77
-
78
- **Condition:** `HAS_CHANGES=false && LOCAL_COMMITS=0 && SYNC_STATE=SYNCED`
79
-
80
- ```
81
- ==============================================================================
82
- DEVELOP EST PROPRE
83
- ==============================================================================
84
-
85
- Aucune modification detectee sur develop.
86
- Vous pouvez creer une feature directement.
87
-
88
- PROCHAINE ETAPE:
89
- /gitflow:10-start feature <nom>
90
-
91
- ==============================================================================
92
- ```
93
-
94
- **Action:** Terminer avec message informatif. Pas de rescue necessaire.
95
-
96
- ---
97
-
98
- ### CAS 2: DIRTY_ONLY - Modifications non committees uniquement
99
-
100
- **Condition:** `HAS_CHANGES=true && LOCAL_COMMITS=0 && (SYNC_STATE=SYNCED || SYNC_STATE=BEHIND)`
101
-
102
- **Affichage:**
103
-
104
- ```
105
- ==============================================================================
106
- MODIFICATIONS NON COMMITTEES DETECTEES
107
- ==============================================================================
108
-
109
- Working directory:
110
- * {STAGED} fichiers stages
111
- * {MODIFIED} fichiers modifies
112
- * {UNTRACKED} fichiers non suivis
113
-
114
- PLAN D'ACTION:
115
- 1. Sauvegarder les modifications (stash)
116
- 2. Creer la branche feature depuis develop
117
- 3. Restaurer les modifications sur la feature
118
-
119
- Develop restera INTACT et synchronise avec origin.
120
-
121
- ==============================================================================
122
- ```
123
-
124
- **Question:**
125
-
126
- ```javascript
127
- AskUserQuestion({
128
- questions: [{
129
- question: "Quel nom pour la feature branch ?",
130
- header: "Feature",
131
- options: [
132
- { label: "add-", description: "Ajouter une nouvelle fonctionnalite" },
133
- { label: "update-", description: "Ameliorer une fonctionnalite existante" },
134
- { label: "fix-", description: "Correction de bug" }
135
- ],
136
- multiSelect: false
137
- }]
138
- })
139
- // L'utilisateur doit pouvoir saisir le nom complet via "Other"
140
- ```
141
-
142
- **Execution:**
143
-
144
- ```bash
145
- FEATURE_NAME="$USER_INPUT"
146
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
147
-
148
- echo ""
149
- echo "=== RESCUE EN COURS ==="
150
- echo ""
151
-
152
- # Point de restauration
153
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
154
- git tag "${RESCUE_TAG}" HEAD
155
- echo "[1/5] Point de restauration cree: ${RESCUE_TAG}"
156
-
157
- # 1. Stash avec message descriptif
158
- git stash push -m "gitflow-rescue: modifications pour ${FEATURE_BRANCH}" --include-untracked
159
- echo "[2/5] Modifications sauvegardees (stash)"
160
-
161
- # 2. Si BEHIND, pull d'abord
162
- if [ "$SYNC_STATE" = "BEHIND" ]; then
163
- git pull origin develop --ff-only
164
- echo "[3/5] Develop synchronise avec origin"
165
- else
166
- echo "[3/5] Develop deja synchronise"
167
- fi
168
-
169
- # 3. Creer la feature depuis develop (qui est synced)
170
- git checkout -b "${FEATURE_BRANCH}" origin/develop
171
- echo "[4/5] Branche ${FEATURE_BRANCH} creee"
172
-
173
- # 4. Restaurer les modifications
174
- git stash pop
175
- echo "[5/5] Modifications restaurees"
176
-
177
- echo ""
178
- echo "=============================================================================="
179
- echo " RESCUE REUSSI"
180
- echo "=============================================================================="
181
- echo ""
182
- echo "Feature creee: ${FEATURE_BRANCH}"
183
- echo "Fichiers restaures: $(git status --short | wc -l)"
184
- echo ""
185
- echo "develop: Propre et synchronise avec origin"
186
- echo "feature: Contient vos modifications"
187
- echo ""
188
- echo "PROCHAINES ETAPES:"
189
- echo " /gitflow:3-commit -> Committer vos modifications"
190
- echo " /gitflow:7-pull-request -> Creer une PR quand pret"
191
- echo ""
192
- echo "Point de restauration: ${RESCUE_TAG}"
193
- echo " En cas de probleme: git checkout develop && git reset --hard ${RESCUE_TAG}"
194
- echo ""
195
- echo "=============================================================================="
196
- ```
197
-
198
- ---
199
-
200
- ### CAS 3: COMMITS_ONLY - Commits locaux non pushes (clean)
201
-
202
- **Condition:** `HAS_CHANGES=false && LOCAL_COMMITS>0 && (SYNC_STATE=AHEAD || SYNC_STATE=SYNCED)`
203
-
204
- **Affichage:**
205
-
206
- ```
207
- ==============================================================================
208
- COMMITS LOCAUX DETECTES SUR DEVELOP
209
- ==============================================================================
210
-
211
- {LOCAL_COMMITS} commit(s) sur develop NON pushes:
212
- ------------------------------------------------------------------------------
213
- {git log origin/develop..HEAD --oneline}
214
- ------------------------------------------------------------------------------
215
-
216
- PLAN D'ACTION:
217
- 1. Creer la branche feature avec ces commits
218
- 2. Remettre develop a l'etat de origin/develop
219
-
220
- ATTENTION: Ces commits seront DEPLACES (pas copies) vers la feature.
221
- Develop local sera RESET a origin/develop.
222
-
223
- ==============================================================================
224
- ```
225
-
226
- **Generation nom suggere:**
227
-
228
- ```bash
229
- # Extraire le scope ou type du premier commit
230
- FIRST_COMMIT_MSG=$(git log -1 --format='%s' origin/develop..HEAD)
231
- # Exemple: "fix(auth): correct login flow" -> "fix-auth"
232
- # Ou: "add user authentication" -> "add-user-authentication"
233
- SUGGESTED_NAME=$(echo "$FIRST_COMMIT_MSG" | \
234
- sed 's/[(:].*//g' | \
235
- tr '[:upper:]' '[:lower:]' | \
236
- sed 's/[^a-z0-9 ]//g' | \
237
- tr ' ' '-' | \
238
- sed 's/--*/-/g' | \
239
- sed 's/^-//;s/-$//' | \
240
- cut -c1-40)
241
- ```
242
-
243
- **Question:**
244
-
245
- ```javascript
246
- AskUserQuestion({
247
- questions: [{
248
- question: "Confirmer le deplacement des commits vers une feature ?",
249
- header: "Confirm",
250
- options: [
251
- { label: "Oui, deplacer (Recommande)", description: `${LOCAL_COMMITS} commits -> feature branch` },
252
- { label: "Non, annuler", description: "Garder les commits sur develop" }
253
- ],
254
- multiSelect: false
255
- }]
256
- })
257
-
258
- // Si "Oui", demander le nom
259
- if (response === "Oui, deplacer (Recommande)") {
260
- AskUserQuestion({
261
- questions: [{
262
- question: `Nom de la feature (suggestion: ${SUGGESTED_NAME}) ?`,
263
- header: "Feature",
264
- options: [
265
- { label: SUGGESTED_NAME, description: "Genere depuis le premier commit (Recommande)" },
266
- { label: "Autre nom", description: "Saisir un nom personnalise" }
267
- ],
268
- multiSelect: false
269
- }]
270
- })
271
- }
272
- ```
273
-
274
- **Execution:**
275
-
276
- ```bash
277
- FEATURE_NAME="$USER_INPUT"
278
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
279
-
280
- echo ""
281
- echo "=== RESCUE EN COURS ==="
282
- echo ""
283
-
284
- # Point de restauration
285
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
286
- git tag "${RESCUE_TAG}" HEAD
287
- echo "[1/4] Point de restauration cree: ${RESCUE_TAG}"
288
-
289
- # 1. Creer la feature branch a partir de HEAD actuel (avec les commits)
290
- git branch "${FEATURE_BRANCH}"
291
- echo "[2/4] Branche ${FEATURE_BRANCH} creee avec les commits"
292
-
293
- # 2. Reset develop a origin/develop
294
- git reset --hard origin/develop
295
- echo "[3/4] develop reset a origin/develop"
296
-
297
- # 3. Checkout la feature
298
- git checkout "${FEATURE_BRANCH}"
299
- echo "[4/4] Bascule sur ${FEATURE_BRANCH}"
300
-
301
- echo ""
302
- echo "=============================================================================="
303
- echo " RESCUE REUSSI"
304
- echo "=============================================================================="
305
- echo ""
306
- echo "Feature creee: ${FEATURE_BRANCH}"
307
- echo "Commits deplaces: ${LOCAL_COMMITS}"
308
- echo ""
309
- echo "develop: RESET a origin/develop (propre)"
310
- echo "feature: Contient vos ${LOCAL_COMMITS} commits"
311
- echo ""
312
- echo "PROCHAINES ETAPES:"
313
- echo " /gitflow:3-commit -> Continuer a developper"
314
- echo " /gitflow:7-pull-request -> Creer une PR quand pret"
315
- echo ""
316
- echo "Point de restauration: ${RESCUE_TAG}"
317
- echo " En cas de probleme: git checkout develop && git reset --hard ${RESCUE_TAG}"
318
- echo ""
319
- echo "=============================================================================="
320
- ```
321
-
322
- ---
323
-
324
- ### CAS 4: COMMITS_AND_DIRTY - Commits locaux + Modifications non committees
325
-
326
- **Condition:** `HAS_CHANGES=true && LOCAL_COMMITS>0 && (SYNC_STATE=AHEAD || SYNC_STATE=SYNCED)`
327
-
328
- **Affichage:**
329
-
330
- ```
331
- ==============================================================================
332
- COMMITS + MODIFICATIONS DETECTES
333
- ==============================================================================
334
-
335
- COMMITS ({LOCAL_COMMITS} non pushes):
336
- ------------------------------------------------------------------------------
337
- {git log origin/develop..HEAD --oneline}
338
- ------------------------------------------------------------------------------
339
-
340
- MODIFICATIONS EN COURS:
341
- * {STAGED} fichiers stages
342
- * {MODIFIED} fichiers modifies
343
- * {UNTRACKED} fichiers non suivis
344
-
345
- PLAN D'ACTION:
346
- 1. Sauvegarder les modifications (stash)
347
- 2. Creer feature avec les commits existants
348
- 3. Reset develop a origin/develop
349
- 4. Restaurer les modifications sur la feature
350
-
351
- ==============================================================================
352
- ```
353
-
354
- **Execution:**
355
-
356
- ```bash
357
- FEATURE_NAME="$USER_INPUT"
358
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
359
-
360
- echo ""
361
- echo "=== RESCUE EN COURS ==="
362
- echo ""
363
-
364
- # Point de restauration
365
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
366
- git tag "${RESCUE_TAG}" HEAD
367
- echo "[1/6] Point de restauration cree: ${RESCUE_TAG}"
368
-
369
- # 1. Stash les modifications en cours
370
- git stash push -m "gitflow-rescue: WIP pour ${FEATURE_BRANCH}" --include-untracked
371
- echo "[2/6] Modifications sauvegardees (stash)"
372
-
373
- # 2. Creer la feature branch a partir de HEAD (avec les commits)
374
- git branch "${FEATURE_BRANCH}"
375
- echo "[3/6] Branche ${FEATURE_BRANCH} creee avec les commits"
376
-
377
- # 3. Reset develop
378
- git reset --hard origin/develop
379
- echo "[4/6] develop reset a origin/develop"
380
-
381
- # 4. Checkout feature
382
- git checkout "${FEATURE_BRANCH}"
383
- echo "[5/6] Bascule sur ${FEATURE_BRANCH}"
384
-
385
- # 5. Restaurer le stash
386
- git stash pop
387
- echo "[6/6] Modifications restaurees"
388
-
389
- echo ""
390
- echo "=============================================================================="
391
- echo " RESCUE REUSSI"
392
- echo "=============================================================================="
393
- echo ""
394
- echo "Feature creee: ${FEATURE_BRANCH}"
395
- echo "Commits deplaces: ${LOCAL_COMMITS}"
396
- echo "Modifications restaurees: $(git status --short | wc -l) fichiers"
397
- echo ""
398
- echo "develop: RESET a origin/develop (propre)"
399
- echo "feature: Contient vos commits ET vos modifications"
400
- echo ""
401
- echo "PROCHAINES ETAPES:"
402
- echo " /gitflow:3-commit -> Committer vos modifications"
403
- echo " /gitflow:7-pull-request -> Creer une PR quand pret"
404
- echo ""
405
- echo "Point de restauration: ${RESCUE_TAG}"
406
- echo ""
407
- echo "=============================================================================="
408
- ```
409
-
410
- ---
411
-
412
- ### CAS 5: BEHIND_CLEAN - Develop en retard (clean)
413
-
414
- **Condition:** `HAS_CHANGES=false && LOCAL_COMMITS=0 && SYNC_STATE=BEHIND`
415
-
416
- **Affichage:**
417
-
418
- ```
419
- ==============================================================================
420
- DEVELOP EN RETARD
421
- ==============================================================================
422
-
423
- Votre develop local est {REMOTE_COMMITS} commits EN RETARD.
424
-
425
- Commits a recuperer depuis origin/develop:
426
- ------------------------------------------------------------------------------
427
- {git log HEAD..origin/develop --oneline}
428
- ------------------------------------------------------------------------------
429
-
430
- PLAN D'ACTION:
431
- 1. Mettre a jour develop (pull)
432
- 2. Creer la feature depuis develop a jour
433
-
434
- ==============================================================================
435
- ```
436
-
437
- **Execution:**
438
-
439
- ```bash
440
- FEATURE_NAME="$USER_INPUT"
441
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
442
-
443
- echo ""
444
- echo "=== RESCUE EN COURS ==="
445
- echo ""
446
-
447
- # 1. Pull develop
448
- git pull origin develop --ff-only
449
- echo "[1/2] develop synchronise avec origin"
450
-
451
- # 2. Creer la feature
452
- git checkout -b "${FEATURE_BRANCH}"
453
- echo "[2/2] Branche ${FEATURE_BRANCH} creee"
454
-
455
- echo ""
456
- echo "=============================================================================="
457
- echo " FEATURE CREEE
458
- echo "=============================================================================="
459
- echo ""
460
- echo "Feature creee: ${FEATURE_BRANCH}"
461
- echo "Base: develop a jour (${REMOTE_COMMITS} commits recuperes)"
462
- echo ""
463
- echo "PROCHAINES ETAPES:"
464
- echo " /gitflow:3-commit -> Committer vos modifications"
465
- echo " /gitflow:7-pull-request -> Creer une PR quand pret"
466
- echo ""
467
- echo "=============================================================================="
468
- ```
469
-
470
- ---
471
-
472
- ### CAS 6: BEHIND_DIRTY - Develop en retard + modifications
473
-
474
- **Condition:** `HAS_CHANGES=true && LOCAL_COMMITS=0 && SYNC_STATE=BEHIND`
475
-
476
- **Execution:** Meme logique que CAS 2, mais avec pull avant le checkout de la feature.
477
-
478
- ```bash
479
- FEATURE_NAME="$USER_INPUT"
480
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
481
-
482
- echo ""
483
- echo "=== RESCUE EN COURS ==="
484
- echo ""
485
-
486
- # Point de restauration
487
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
488
- git tag "${RESCUE_TAG}" HEAD
489
- echo "[1/5] Point de restauration cree: ${RESCUE_TAG}"
490
-
491
- # 1. Stash
492
- git stash push -m "gitflow-rescue: WIP pour ${FEATURE_BRANCH}" --include-untracked
493
- echo "[2/5] Modifications sauvegardees (stash)"
494
-
495
- # 2. Pull develop
496
- git pull origin develop --ff-only
497
- echo "[3/5] develop synchronise avec origin"
498
-
499
- # 3. Creer la feature
500
- git checkout -b "${FEATURE_BRANCH}"
501
- echo "[4/5] Branche ${FEATURE_BRANCH} creee"
502
-
503
- # 4. Restaurer stash
504
- git stash pop
505
- echo "[5/5] Modifications restaurees"
506
-
507
- echo ""
508
- echo "=============================================================================="
509
- echo " RESCUE REUSSI"
510
- echo "=============================================================================="
511
- echo ""
512
- echo "Feature creee: ${FEATURE_BRANCH}"
513
- echo "develop: Synchronise avec origin"
514
- echo "feature: Contient vos modifications"
515
- echo ""
516
- echo "PROCHAINES ETAPES:"
517
- echo " /gitflow:3-commit -> Committer vos modifications"
518
- echo ""
519
- echo "=============================================================================="
520
- ```
521
-
522
- ---
523
-
524
- ### CAS 7: REBASE_NEEDED - Commits locaux + Remote en avance
525
-
526
- **Condition:** `HAS_CHANGES=false && LOCAL_COMMITS>0 && REMOTE_COMMITS>0`
527
-
528
- **Affichage:**
529
-
530
- ```
531
- ==============================================================================
532
- SITUATION COMPLEXE - COMMITS LOCAUX + REMOTE EN AVANCE
533
- ==============================================================================
534
-
535
- VOS COMMITS LOCAUX ({LOCAL_COMMITS}):
536
- ------------------------------------------------------------------------------
537
- {git log origin/develop..HEAD --oneline}
538
- ------------------------------------------------------------------------------
539
-
540
- COMMITS SUR ORIGIN ({REMOTE_COMMITS}):
541
- ------------------------------------------------------------------------------
542
- {git log HEAD..origin/develop --oneline}
543
- ------------------------------------------------------------------------------
544
-
545
- PLAN D'ACTION (rebase):
546
- 1. Creer la feature avec vos commits
547
- 2. Reset develop a origin/develop
548
- 3. Rebaser la feature sur develop a jour
549
-
550
- INFO: Vos commits seront rejoues SUR les commits distants.
551
-
552
- ==============================================================================
553
- ```
554
-
555
- **Question:**
556
-
557
- ```javascript
558
- AskUserQuestion({
559
- questions: [{
560
- question: "Comment proceder avec vos commits locaux ?",
561
- header: "Strategy",
562
- options: [
563
- { label: "Rebase (Recommande)", description: "Rejouer vos commits sur origin/develop a jour" },
564
- { label: "Merge", description: "Creer un commit de merge (historique moins propre)" },
565
- { label: "Annuler", description: "Ne rien faire, je gere manuellement" }
566
- ],
567
- multiSelect: false
568
- }]
569
- })
570
- ```
571
-
572
- **Execution (Rebase):**
573
-
574
- ```bash
575
- FEATURE_NAME="$USER_INPUT"
576
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
577
-
578
- echo ""
579
- echo "=== RESCUE EN COURS (REBASE) ==="
580
- echo ""
581
-
582
- # Point de restauration
583
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
584
- git tag "${RESCUE_TAG}" HEAD
585
- echo "[1/5] Point de restauration cree: ${RESCUE_TAG}"
586
-
587
- # 1. Creer la feature a partir de HEAD actuel
588
- git branch "${FEATURE_BRANCH}"
589
- echo "[2/5] Branche ${FEATURE_BRANCH} creee"
590
-
591
- # 2. Reset develop a origin
592
- git reset --hard origin/develop
593
- echo "[3/5] develop reset a origin/develop"
594
-
595
- # 3. Checkout feature
596
- git checkout "${FEATURE_BRANCH}"
597
- echo "[4/5] Bascule sur ${FEATURE_BRANCH}"
598
-
599
- # 4. Rebase sur develop a jour
600
- echo "[5/5] Rebase en cours..."
601
- if git rebase develop; then
602
- echo ""
603
- echo "=============================================================================="
604
- echo " RESCUE REUSSI"
605
- echo "=============================================================================="
606
- echo ""
607
- echo "Feature creee: ${FEATURE_BRANCH}"
608
- echo "Commits deplaces et rebases: ${LOCAL_COMMITS}"
609
- echo ""
610
- echo "develop: RESET a origin/develop (propre)"
611
- echo "feature: Contient vos commits rebases sur develop a jour"
612
- echo ""
613
- echo "PROCHAINES ETAPES:"
614
- echo " /gitflow:3-commit -> Continuer a developper"
615
- echo " /gitflow:7-pull-request -> Creer une PR quand pret"
616
- echo ""
617
- echo "Point de restauration: ${RESCUE_TAG}"
618
- echo ""
619
- echo "=============================================================================="
620
- else
621
- echo ""
622
- echo "=============================================================================="
623
- echo " CONFLITS DE REBASE DETECTES"
624
- echo "=============================================================================="
625
- echo ""
626
- echo "Des conflits ont ete detectes lors du rebase."
627
- echo ""
628
- echo "RESOLUTION:"
629
- echo " 1. Resolvez les conflits dans les fichiers marques"
630
- echo " 2. git add <fichiers resolus>"
631
- echo " 3. git rebase --continue"
632
- echo ""
633
- echo "OU pour annuler:"
634
- echo " git rebase --abort"
635
- echo " git checkout develop && git reset --hard ${RESCUE_TAG}"
636
- echo ""
637
- echo "=============================================================================="
638
- fi
639
- ```
640
-
641
- ---
642
-
643
- ### CAS 8: REBASE_COMPLEX - Commits + modifications + retard
644
-
645
- **Condition:** `HAS_CHANGES=true && LOCAL_COMMITS>0 && REMOTE_COMMITS>0`
646
-
647
- **Execution:** Combinaison de CAS 7 avec stash/unstash.
648
-
649
- ```bash
650
- FEATURE_NAME="$USER_INPUT"
651
- FEATURE_BRANCH="feature/${FEATURE_NAME}"
652
-
653
- echo ""
654
- echo "=== RESCUE EN COURS (COMPLEXE) ==="
655
- echo ""
656
-
657
- # Point de restauration
658
- RESCUE_TAG="rescue/develop-$(date +%Y%m%d-%H%M%S)"
659
- git tag "${RESCUE_TAG}" HEAD
660
- echo "[1/7] Point de restauration cree: ${RESCUE_TAG}"
661
-
662
- # 1. Stash les modifications
663
- git stash push -m "gitflow-rescue: WIP pour ${FEATURE_BRANCH}" --include-untracked
664
- STASHED="true"
665
- echo "[2/7] Modifications sauvegardees (stash)"
666
-
667
- # 2. Creer la feature a partir de HEAD actuel
668
- git branch "${FEATURE_BRANCH}"
669
- echo "[3/7] Branche ${FEATURE_BRANCH} creee"
670
-
671
- # 3. Reset develop a origin
672
- git reset --hard origin/develop
673
- echo "[4/7] develop reset a origin/develop"
674
-
675
- # 4. Checkout feature
676
- git checkout "${FEATURE_BRANCH}"
677
- echo "[5/7] Bascule sur ${FEATURE_BRANCH}"
678
-
679
- # 5. Rebase sur develop a jour
680
- echo "[6/7] Rebase en cours..."
681
- if git rebase develop; then
682
- # 6. Restaurer stash
683
- git stash pop
684
- echo "[7/7] Modifications restaurees"
685
-
686
- echo ""
687
- echo "=============================================================================="
688
- echo " RESCUE REUSSI"
689
- echo "=============================================================================="
690
- echo ""
691
- echo "Feature creee: ${FEATURE_BRANCH}"
692
- echo "Commits deplaces et rebases: ${LOCAL_COMMITS}"
693
- echo "Modifications restaurees: $(git status --short | wc -l) fichiers"
694
- echo ""
695
- echo "PROCHAINES ETAPES:"
696
- echo " /gitflow:3-commit -> Committer vos modifications"
697
- echo ""
698
- echo "=============================================================================="
699
- else
700
- echo ""
701
- echo "=============================================================================="
702
- echo " CONFLITS DE REBASE DETECTES"
703
- echo "=============================================================================="
704
- echo ""
705
- echo "Des conflits ont ete detectes lors du rebase."
706
- echo "Vos modifications non committees sont toujours dans le stash."
707
- echo ""
708
- echo "RESOLUTION:"
709
- echo " 1. Resolvez les conflits"
710
- echo " 2. git rebase --continue"
711
- echo " 3. git stash pop (pour recuperer vos modifications)"
712
- echo ""
713
- echo "Point de restauration: ${RESCUE_TAG}"
714
- echo ""
715
- echo "=============================================================================="
716
- fi
717
- ```
718
-
719
- ---
720
-
721
- ### CAS 9: DIVERGED - Divergence critique
722
-
723
- **Condition:** `SYNC_STATE=DIVERGED`
724
-
725
- **Affichage:**
726
-
727
- ```
728
- ==============================================================================
729
- DIVERGENCE CRITIQUE DETECTEE
730
- ==============================================================================
731
-
732
- Votre develop local a DIVERGE de origin/develop.
733
-
734
- COMMITS LOCAUX UNIQUEMENT ({LOCAL_COMMITS}):
735
- ------------------------------------------------------------------------------
736
- {git log origin/develop..HEAD --oneline}
737
- ------------------------------------------------------------------------------
738
-
739
- COMMITS DISTANTS UNIQUEMENT ({REMOTE_COMMITS}):
740
- ------------------------------------------------------------------------------
741
- {git log HEAD..origin/develop --oneline}
742
- ------------------------------------------------------------------------------
743
-
744
- BASE COMMUNE:
745
- {git merge-base HEAD origin/develop}
746
-
747
- ==============================================================================
748
- ```
749
-
750
- **Question:**
751
-
752
- ```javascript
753
- AskUserQuestion({
754
- questions: [{
755
- question: "Situation de divergence. Comment resoudre ?",
756
- header: "Diverge",
757
- options: [
758
- { label: "Sauvegarder mes commits -> feature (Recommande)", description: "Creer une feature avec vos commits, reset develop" },
759
- { label: "Forcer rebase", description: "Rebase agressif - peut causer des conflits" },
760
- { label: "Annuler", description: "Je vais analyser manuellement" }
761
- ],
762
- multiSelect: false
763
- }]
764
- })
765
- ```
766
-
767
- **Execution (Sauvegarder -> feature):**
768
-
769
- Meme logique que CAS 7 ou CAS 8 selon HAS_CHANGES.
770
-
771
- ---
772
-
773
- ## RESUME DU FLUX
774
-
775
- ```
776
- +-----------------------------------------------------------------------------+
777
- | GITFLOW RESCUE FLOW |
778
- +-----------------------------------------------------------------------------+
779
- | |
780
- | DETECTION |
781
- | --------- |
782
- | +-------------+ |
783
- | | git status |---> HAS_CHANGES (dirty/clean) |
784
- | | git rev-list|---> LOCAL_COMMITS (ahead count) |
785
- | | git fetch |---> REMOTE_COMMITS (behind count) |
786
- | +-------------+---> SYNC_STATE (synced/ahead/behind/diverged) |
787
- | |
788
- | DECISION |
789
- | -------- |
790
- | SYNC_STATE = ? |
791
- | | |
792
- | +-- SYNCED ---> Cas simple (1-4) |
793
- | | +-- HAS_CHANGES + LOCAL_COMMITS -> Stash/Branch |
794
- | | |
795
- | +-- BEHIND ---> Pull d'abord, puis cas simple (5-6) |
796
- | | |
797
- | +-- AHEAD + BEHIND ---> Rebase necessaire (7-8) |
798
- | | |
799
- | +-- DIVERGED ---> Analyse manuelle requise (9) |
800
- | |
801
- | EXECUTION |
802
- | --------- |
803
- | 1. [Optionnel] git stash (si dirty) |
804
- | 2. [Optionnel] git pull (si behind) |
805
- | 3. git branch feature/xxx (preserver commits) |
806
- | 4. git reset --hard origin/develop (nettoyer develop) |
807
- | 5. git checkout feature/xxx |
808
- | 6. [Optionnel] git rebase develop (si etait behind) |
809
- | 7. [Optionnel] git stash pop (restaurer WIP) |
810
- | |
811
- | RESULTAT |
812
- | -------- |
813
- | OK develop = origin/develop (propre) |
814
- | OK feature/xxx = vos commits + modifications |
815
- | OK Point de restauration cree |
816
- | |
817
- +-----------------------------------------------------------------------------+
818
- ```
819
-
820
- ---
821
-
822
- ## INTEGRATION WORKTREE (OPTIONNEL)
823
-
824
- Si la configuration GitFlow utilise les worktrees (mode "organized" ou "adjacent"), la feature peut etre creee dans un worktree separe au lieu d'un simple checkout.
825
-
826
- **Detection du mode worktree:**
827
-
828
- ```bash
829
- # Detecter la structure existante
830
- if [ -d "../features" ] && [ -d "../releases" ]; then
831
- WORKTREE_MODE="organized"
832
- WORKTREE_PATH="../features/${FEATURE_NAME}"
833
- elif [ -d "../worktrees" ]; then
834
- WORKTREE_MODE="adjacent"
835
- WORKTREE_PATH="../worktrees/features/${FEATURE_NAME}"
836
- else
837
- WORKTREE_MODE="none"
838
- fi
839
- ```
840
-
841
- **Si worktree disponible, proposer:**
842
-
843
- ```javascript
844
- AskUserQuestion({
845
- questions: [{
846
- question: "Creer la feature dans un worktree separe ?",
847
- header: "Worktree",
848
- options: [
849
- { label: "Oui (Recommande)", description: `Creer dans ${WORKTREE_PATH}` },
850
- { label: "Non", description: "Simple checkout sur la branche" }
851
- ],
852
- multiSelect: false
853
- }]
854
- })
855
- ```
856
-
857
- **Execution avec worktree:**
858
-
859
- ```bash
860
- # Au lieu de git checkout -b, utiliser:
861
- mkdir -p "$(dirname ${WORKTREE_PATH})"
862
- git worktree add "${WORKTREE_PATH}" "${FEATURE_BRANCH}"
863
-
864
- echo ""
865
- echo "Worktree cree: ${WORKTREE_PATH}"
866
- echo "Pour y acceder: cd ${WORKTREE_PATH}"
867
- ```