@atlashub/smartstack-cli 1.5.1 → 1.5.3
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.
- package/.documentation/css/styles.css +2168 -2168
- package/.documentation/js/app.js +794 -794
- package/config/default-config.json +86 -86
- package/config/settings.json +53 -53
- package/config/settings.local.example.json +16 -16
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -1
- package/package.json +88 -88
- package/templates/agents/action.md +36 -36
- package/templates/agents/efcore/conflicts.md +84 -84
- package/templates/agents/efcore/db-deploy.md +51 -51
- package/templates/agents/efcore/db-reset.md +59 -59
- package/templates/agents/efcore/db-seed.md +56 -56
- package/templates/agents/efcore/db-status.md +64 -64
- package/templates/agents/efcore/migration.md +85 -85
- package/templates/agents/efcore/rebase-snapshot.md +62 -62
- package/templates/agents/efcore/scan.md +90 -90
- package/templates/agents/efcore/squash.md +67 -67
- package/templates/agents/explore-codebase.md +65 -65
- package/templates/agents/explore-docs.md +97 -97
- package/templates/agents/fix-grammar.md +49 -49
- package/templates/agents/gitflow/abort.md +45 -45
- package/templates/agents/gitflow/cleanup.md +85 -85
- package/templates/agents/gitflow/commit.md +40 -40
- package/templates/agents/gitflow/exec.md +48 -48
- package/templates/agents/gitflow/finish.md +92 -92
- package/templates/agents/gitflow/init.md +139 -139
- package/templates/agents/gitflow/merge.md +62 -62
- package/templates/agents/gitflow/plan.md +42 -42
- package/templates/agents/gitflow/pr.md +78 -78
- package/templates/agents/gitflow/review.md +49 -49
- package/templates/agents/gitflow/start.md +61 -61
- package/templates/agents/gitflow/status.md +32 -32
- package/templates/agents/snipper.md +36 -36
- package/templates/agents/websearch.md +46 -46
- package/templates/commands/_resources/formatting-guide.md +124 -124
- package/templates/commands/ai-prompt.md +315 -315
- package/templates/commands/apex/1-analyze.md +100 -100
- package/templates/commands/apex/2-plan.md +145 -145
- package/templates/commands/apex/3-execute.md +171 -171
- package/templates/commands/apex/4-examine.md +116 -116
- package/templates/commands/apex/5-tasks.md +209 -209
- package/templates/commands/apex.md +76 -76
- package/templates/commands/application/create.md +362 -362
- package/templates/commands/application/templates-backend.md +463 -463
- package/templates/commands/application/templates-frontend.md +517 -517
- package/templates/commands/application/templates-i18n.md +478 -478
- package/templates/commands/application/templates-seed.md +362 -362
- package/templates/commands/application.md +303 -303
- package/templates/commands/business-analyse/0-orchestrate.md +640 -640
- package/templates/commands/business-analyse/1-init.md +269 -269
- package/templates/commands/business-analyse/2-discover.md +520 -520
- package/templates/commands/business-analyse/3-analyse.md +408 -408
- package/templates/commands/business-analyse/4-specify.md +598 -598
- package/templates/commands/business-analyse/5-validate.md +326 -326
- package/templates/commands/business-analyse/6-handoff.md +746 -746
- package/templates/commands/business-analyse/7-doc-html.md +602 -602
- package/templates/commands/business-analyse/bug.md +325 -325
- package/templates/commands/business-analyse/change-request.md +368 -368
- package/templates/commands/business-analyse/hotfix.md +200 -200
- package/templates/commands/business-analyse.md +640 -640
- package/templates/commands/controller/create.md +216 -216
- package/templates/commands/controller/postman-templates.md +528 -528
- package/templates/commands/controller/templates.md +600 -600
- package/templates/commands/controller.md +337 -337
- package/templates/commands/create/agent.md +138 -138
- package/templates/commands/create/command.md +166 -166
- package/templates/commands/create/hook.md +234 -234
- package/templates/commands/create/plugin.md +329 -329
- package/templates/commands/create/project.md +507 -507
- package/templates/commands/create/skill.md +199 -199
- package/templates/commands/create.md +220 -220
- package/templates/commands/debug.md +95 -95
- package/templates/commands/documentation/module.md +202 -202
- package/templates/commands/documentation/templates.md +432 -432
- package/templates/commands/documentation.md +190 -190
- package/templates/commands/efcore/_env-check.md +153 -153
- package/templates/commands/efcore/conflicts.md +186 -186
- package/templates/commands/efcore/db-deploy.md +193 -193
- package/templates/commands/efcore/db-reset.md +426 -426
- package/templates/commands/efcore/db-seed.md +326 -326
- package/templates/commands/efcore/db-status.md +226 -226
- package/templates/commands/efcore/migration.md +400 -400
- package/templates/commands/efcore/rebase-snapshot.md +264 -264
- package/templates/commands/efcore/scan.md +198 -198
- package/templates/commands/efcore/squash.md +298 -298
- package/templates/commands/efcore.md +224 -224
- package/templates/commands/epct.md +69 -69
- package/templates/commands/explain.md +186 -186
- package/templates/commands/explore.md +45 -45
- package/templates/commands/feature-full.md +267 -267
- package/templates/commands/gitflow/1-init.md +1038 -1038
- package/templates/commands/gitflow/10-start.md +768 -768
- package/templates/commands/gitflow/11-finish.md +457 -457
- package/templates/commands/gitflow/12-cleanup.md +276 -276
- package/templates/commands/gitflow/13-sync.md +216 -216
- package/templates/commands/gitflow/14-rebase.md +251 -251
- package/templates/commands/gitflow/2-status.md +277 -277
- package/templates/commands/gitflow/3-commit.md +344 -344
- package/templates/commands/gitflow/4-plan.md +145 -145
- package/templates/commands/gitflow/5-exec.md +147 -147
- package/templates/commands/gitflow/6-abort.md +344 -344
- package/templates/commands/gitflow/7-pull-request.md +453 -355
- package/templates/commands/gitflow/8-review.md +240 -176
- package/templates/commands/gitflow/9-merge.md +451 -365
- package/templates/commands/gitflow.md +128 -128
- package/templates/commands/implement.md +663 -663
- package/templates/commands/init.md +567 -567
- package/templates/commands/mcp-integration.md +330 -330
- package/templates/commands/notification.md +129 -129
- package/templates/commands/oneshot.md +57 -57
- package/templates/commands/quick-search.md +72 -72
- package/templates/commands/ralph-loop/cancel-ralph.md +18 -18
- package/templates/commands/ralph-loop/help.md +126 -126
- package/templates/commands/ralph-loop/ralph-loop.md +18 -18
- package/templates/commands/review.md +106 -106
- package/templates/commands/utils/test-web-config.md +160 -160
- package/templates/commands/utils/test-web.md +151 -151
- package/templates/commands/validate.md +233 -233
- package/templates/commands/workflow.md +193 -193
- package/templates/gitflow/config.json +138 -138
- package/templates/hooks/ef-migration-check.md +139 -139
- package/templates/hooks/hooks.json +25 -25
- package/templates/hooks/stop-hook.sh +177 -177
- package/templates/skills/ai-prompt/SKILL.md +778 -778
- package/templates/skills/application/SKILL.md +563 -563
- package/templates/skills/application/templates-backend.md +450 -450
- package/templates/skills/application/templates-frontend.md +531 -531
- package/templates/skills/application/templates-i18n.md +520 -520
- package/templates/skills/application/templates-seed.md +647 -647
- package/templates/skills/business-analyse/SKILL.md +191 -191
- package/templates/skills/business-analyse/questionnaire.md +283 -283
- package/templates/skills/business-analyse/templates-frd.md +477 -477
- package/templates/skills/business-analyse/templates-react.md +580 -580
- package/templates/skills/controller/SKILL.md +240 -240
- package/templates/skills/controller/postman-templates.md +614 -614
- package/templates/skills/controller/templates.md +1468 -1468
- package/templates/skills/documentation/SKILL.md +133 -133
- package/templates/skills/documentation/templates.md +476 -476
- package/templates/skills/feature-full/SKILL.md +838 -838
- package/templates/skills/notification/SKILL.md +555 -555
- package/templates/skills/ui-components/SKILL.md +870 -870
- package/templates/skills/workflow/SKILL.md +582 -582
- package/templates/test-web/api-health.json +38 -38
- package/templates/test-web/minimal.json +19 -19
- package/templates/test-web/npm-package.json +46 -46
- package/templates/test-web/seo-check.json +54 -54
|
@@ -1,457 +1,457 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Phase 11 - Finish and finalize a GitFlow branch (tag + merge back)
|
|
3
|
-
agent: gitflow-finish
|
|
4
|
-
model: sonnet
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Phase 11: FINISH - Finaliser une branche GitFlow
|
|
8
|
-
|
|
9
|
-
Tu es expert GitFlow. Finalise une branche apres merge de la PR.
|
|
10
|
-
|
|
11
|
-
**Argument:** `$ARGUMENTS` = branche a finaliser (optionnel, **SCAN AUTOMATIQUE** si absent)
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Quand utiliser
|
|
16
|
-
|
|
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
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## ETAPE 1: SCAN PROACTIF (si pas d'argument)
|
|
26
|
-
|
|
27
|
-
> **COMPORTEMENT PROACTIF:** Si aucun argument fourni, scanner TOUTES les branches pour proposer celles qui sont pretes a finaliser.
|
|
28
|
-
|
|
29
|
-
### 1.1 Scanner toutes les branches GitFlow
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
git fetch --all --quiet
|
|
33
|
-
|
|
34
|
-
# Lister toutes les branches feature/release/hotfix
|
|
35
|
-
FEATURES=$(git branch -r | grep 'origin/feature/' | sed 's|origin/||' | tr -d ' ')
|
|
36
|
-
RELEASES=$(git branch -r | grep 'origin/release/' | sed 's|origin/||' | tr -d ' ')
|
|
37
|
-
HOTFIXES=$(git branch -r | grep 'origin/hotfix/' | sed 's|origin/||' | tr -d ' ')
|
|
38
|
-
|
|
39
|
-
ALL_BRANCHES="$FEATURES $RELEASES $HOTFIXES"
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 1.2 Verifier le statut PR de chaque branche
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Pour chaque branche, verifier:
|
|
46
|
-
for BRANCH in $ALL_BRANCHES; do
|
|
47
|
-
# 1. PR mergee?
|
|
48
|
-
PR_MERGED=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt --jq '.[0]')
|
|
49
|
-
|
|
50
|
-
# 2. PR ouverte?
|
|
51
|
-
PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
|
|
52
|
-
|
|
53
|
-
# 3. Pas de PR?
|
|
54
|
-
# Si pas de PR → suggerer /gitflow:7-pull-request
|
|
55
|
-
|
|
56
|
-
# Categoriser
|
|
57
|
-
if [ -n "$PR_MERGED" ]; then
|
|
58
|
-
READY_TO_FINISH+=("$BRANCH")
|
|
59
|
-
elif [ -n "$PR_OPEN" ]; then
|
|
60
|
-
WAITING_FOR_MERGE+=("$BRANCH")
|
|
61
|
-
else
|
|
62
|
-
NEEDS_PR+=("$BRANCH")
|
|
63
|
-
fi
|
|
64
|
-
done
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### 1.3 Afficher le tableau de synthese
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
================================================================================
|
|
71
|
-
GITFLOW FINISH - SCAN DES BRANCHES
|
|
72
|
-
================================================================================
|
|
73
|
-
|
|
74
|
-
✅ PRETES A FINALISER (PR mergee):
|
|
75
|
-
┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
|
|
76
|
-
│ Branche │ Type │ PR # │ Mergee le │
|
|
77
|
-
├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
|
|
78
|
-
│ feature/add-user-auth │ feature │ #42 │ 2024-01-15 14:30 │
|
|
79
|
-
│ release/v1.5.0 │ release │ #45 │ 2024-01-15 16:00 │
|
|
80
|
-
└─────────────────────────────┴───────────┴────────────┴─────────────────────┘
|
|
81
|
-
|
|
82
|
-
⏳ EN ATTENTE DE MERGE (PR ouverte):
|
|
83
|
-
┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
|
|
84
|
-
│ Branche │ Type │ PR # │ Statut │
|
|
85
|
-
├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
|
|
86
|
-
│ feature/add-orders │ feature │ #43 │ Review en cours │
|
|
87
|
-
│ hotfix/fix-login │ hotfix │ #44 │ CI en cours │
|
|
88
|
-
└─────────────────────────────┴───────────┴────────────┴─────────────────────┘
|
|
89
|
-
|
|
90
|
-
❌ SANS PR (action requise):
|
|
91
|
-
┌─────────────────────────────┬───────────┬────────────────────────────────────┐
|
|
92
|
-
│ Branche │ Type │ Action suggeree │
|
|
93
|
-
├─────────────────────────────┼───────────┼────────────────────────────────────┤
|
|
94
|
-
│ feature/wip-refactor │ feature │ /gitflow:7-pull-request │
|
|
95
|
-
│ feature/old-abandoned │ feature │ /gitflow:6-abort --branch │
|
|
96
|
-
└─────────────────────────────┴───────────┴────────────────────────────────────┘
|
|
97
|
-
|
|
98
|
-
================================================================================
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 1.4 Proposition interactive
|
|
102
|
-
|
|
103
|
-
```javascript
|
|
104
|
-
// Si plusieurs branches pretes a finaliser
|
|
105
|
-
if (READY_TO_FINISH.length > 0) {
|
|
106
|
-
AskUserQuestion({
|
|
107
|
-
questions: [{
|
|
108
|
-
question: "Quelle branche voulez-vous finaliser ?",
|
|
109
|
-
header: "Finish",
|
|
110
|
-
options: READY_TO_FINISH.map(branch => ({
|
|
111
|
-
label: branch,
|
|
112
|
-
description: `PR #${getPRNumber(branch)} mergee - ${getType(branch)}`
|
|
113
|
-
})).concat([{
|
|
114
|
-
label: "Toutes",
|
|
115
|
-
description: "Finaliser toutes les branches pretes (dans l'ordre recommande)"
|
|
116
|
-
}]),
|
|
117
|
-
multiSelect: false
|
|
118
|
-
}]
|
|
119
|
-
})
|
|
120
|
-
} else if (WAITING_FOR_MERGE.length > 0) {
|
|
121
|
-
// Afficher message d'aide
|
|
122
|
-
console.log("Aucune branche prete a finaliser.")
|
|
123
|
-
console.log("→ Attendez le merge des PRs en cours ou utilisez /gitflow:9-merge")
|
|
124
|
-
} else if (NEEDS_PR.length > 0) {
|
|
125
|
-
// Afficher message d'aide
|
|
126
|
-
console.log("Aucune branche prete. Creez d'abord une PR:")
|
|
127
|
-
console.log("→ /gitflow:7-pull-request")
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### 1.5 Ordre recommande pour "Toutes"
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
ORDRE DE FINALISATION RECOMMANDE:
|
|
135
|
-
1. Hotfixes (urgents, vers main puis develop)
|
|
136
|
-
2. Releases (vers main puis develop)
|
|
137
|
-
3. Features (vers develop, par date de merge)
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## ETAPE 2: Detecter le contexte (si argument fourni)
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
# Branche specifiee ou selectionnee
|
|
146
|
-
BRANCH=${ARGUMENTS:-$SELECTED_BRANCH}
|
|
147
|
-
|
|
148
|
-
# Determiner le type
|
|
149
|
-
if [[ $BRANCH == feature/* ]]; then TYPE="feature"
|
|
150
|
-
elif [[ $BRANCH == release/* ]]; then TYPE="release"
|
|
151
|
-
elif [[ $BRANCH == hotfix/* ]]; then TYPE="hotfix"
|
|
152
|
-
else
|
|
153
|
-
echo "⚠️ '$BRANCH' n'est pas une branche GitFlow (feature/release/hotfix)"
|
|
154
|
-
echo "→ Utilisez /gitflow:11-finish sans argument pour scanner les branches"
|
|
155
|
-
exit 1
|
|
156
|
-
fi
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## ETAPE 3: Verifier que PR est mergee
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
# Chercher PR associee
|
|
163
|
-
PR_INFO=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt,title --jq '.[0]')
|
|
164
|
-
|
|
165
|
-
# Si pas mergee
|
|
166
|
-
if [ -z "$PR_INFO" ]; then
|
|
167
|
-
# Verifier si PR ouverte
|
|
168
|
-
PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
|
|
169
|
-
|
|
170
|
-
if [ -n "$PR_OPEN" ]; then
|
|
171
|
-
PR_NUM=$(echo "$PR_OPEN" | jq -r '.number')
|
|
172
|
-
echo "⚠️ PR #$PR_NUM existe mais n'est pas encore mergee"
|
|
173
|
-
echo ""
|
|
174
|
-
echo "Options:"
|
|
175
|
-
echo " 1. Merger la PR: /gitflow:9-merge $PR_NUM"
|
|
176
|
-
echo " 2. Voir la PR: gh pr view $PR_NUM --web"
|
|
177
|
-
echo " 3. Abandonner: /gitflow:6-abort --branch"
|
|
178
|
-
else
|
|
179
|
-
echo "⚠️ Aucune PR trouvee pour '$BRANCH'"
|
|
180
|
-
echo ""
|
|
181
|
-
echo "Options:"
|
|
182
|
-
echo " 1. Creer une PR: /gitflow:7-pull-request"
|
|
183
|
-
echo " 2. Abandonner: /gitflow:6-abort --branch"
|
|
184
|
-
fi
|
|
185
|
-
exit 1
|
|
186
|
-
fi
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Actions selon type
|
|
192
|
-
|
|
193
|
-
### Feature (simple cleanup)
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
# Detecter si on est dans un worktree et trouver le repo principal
|
|
197
|
-
CURRENT_DIR=$(pwd)
|
|
198
|
-
MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
|
|
199
|
-
|
|
200
|
-
# Revenir au repo principal AVANT de supprimer le worktree
|
|
201
|
-
cd "$MAIN_WORKTREE"
|
|
202
|
-
|
|
203
|
-
# Supprimer worktree si existe
|
|
204
|
-
WORKTREE_PATH="../worktrees/features/{name}"
|
|
205
|
-
if [ -d "$WORKTREE_PATH" ]; then
|
|
206
|
-
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
207
|
-
fi
|
|
208
|
-
|
|
209
|
-
# Supprimer branche locale
|
|
210
|
-
git checkout develop
|
|
211
|
-
git pull origin develop
|
|
212
|
-
git branch -d feature/{name}
|
|
213
|
-
|
|
214
|
-
# Supprimer branche remote (si pas fait par merge)
|
|
215
|
-
git push origin --delete feature/{name} 2>/dev/null || true
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
**Resume:**
|
|
219
|
-
```
|
|
220
|
-
FEATURE FINALISEE
|
|
221
|
-
────────────────────────────────
|
|
222
|
-
Branche: feature/{name}
|
|
223
|
-
Mergee: develop
|
|
224
|
-
PR: #{number}
|
|
225
|
-
Cleanup: ✓ Branche supprimee
|
|
226
|
-
────────────────────────────────
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
---
|
|
230
|
-
|
|
231
|
-
### Release (tag + merge back)
|
|
232
|
-
|
|
233
|
-
```bash
|
|
234
|
-
# 0. Detecter si on est dans un worktree et trouver le repo principal
|
|
235
|
-
CURRENT_DIR=$(pwd)
|
|
236
|
-
MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
|
|
237
|
-
|
|
238
|
-
# Revenir au repo principal AVANT toute operation
|
|
239
|
-
cd "$MAIN_WORKTREE"
|
|
240
|
-
|
|
241
|
-
# 1. Checkout main et pull
|
|
242
|
-
git checkout main
|
|
243
|
-
git pull origin main
|
|
244
|
-
|
|
245
|
-
# 2. Creer tag
|
|
246
|
-
VERSION=$(echo $BRANCH | sed 's/release\/v//')
|
|
247
|
-
git tag -a "v$VERSION" -m "Release v$VERSION"
|
|
248
|
-
git push origin "v$VERSION"
|
|
249
|
-
|
|
250
|
-
# 3. Merge back to develop
|
|
251
|
-
git checkout develop
|
|
252
|
-
git pull origin develop
|
|
253
|
-
git merge main --no-ff -m "chore: merge release v$VERSION back to develop"
|
|
254
|
-
git push origin develop
|
|
255
|
-
|
|
256
|
-
# 4. Cleanup worktree + branche
|
|
257
|
-
WORKTREE_PATH="../worktrees/releases/v$VERSION"
|
|
258
|
-
if [ -d "$WORKTREE_PATH" ]; then
|
|
259
|
-
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
260
|
-
fi
|
|
261
|
-
git branch -d release/v$VERSION
|
|
262
|
-
git push origin --delete release/v$VERSION 2>/dev/null || true
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**Resume:**
|
|
266
|
-
```
|
|
267
|
-
RELEASE FINALISEE
|
|
268
|
-
════════════════════════════════════════
|
|
269
|
-
Version: v{version}
|
|
270
|
-
Tag: v{version} ✓
|
|
271
|
-
Main: ✓ Mergee
|
|
272
|
-
Develop: ✓ Merge back complete
|
|
273
|
-
|
|
274
|
-
Actions effectuees:
|
|
275
|
-
✓ Tag v{version} cree et pousse
|
|
276
|
-
✓ Main mis a jour
|
|
277
|
-
✓ Develop synchronise avec main
|
|
278
|
-
✓ Branche release supprimee
|
|
279
|
-
════════════════════════════════════════
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
### Hotfix (auto-increment PATCH + tag + merge back)
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
# 0. Detecter si on est dans un worktree et trouver le repo principal
|
|
288
|
-
CURRENT_DIR=$(pwd)
|
|
289
|
-
MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
|
|
290
|
-
|
|
291
|
-
# Revenir au repo principal AVANT toute operation
|
|
292
|
-
cd "$MAIN_WORKTREE"
|
|
293
|
-
|
|
294
|
-
# 1. Checkout main et pull
|
|
295
|
-
git checkout main
|
|
296
|
-
git pull origin main
|
|
297
|
-
|
|
298
|
-
# 2. AUTO-INCREMENT PATCH VERSION
|
|
299
|
-
# Lire la version actuelle
|
|
300
|
-
CURRENT_VERSION=$(cat package.json | jq -r '.version')
|
|
301
|
-
|
|
302
|
-
# Calculer la nouvelle version (PATCH increment)
|
|
303
|
-
# Ex: 1.7.1 → 1.7.2
|
|
304
|
-
NEW_VERSION=$(node -e "
|
|
305
|
-
const [major, minor, patch] = '$CURRENT_VERSION'.split('.').map(Number);
|
|
306
|
-
console.log([major, minor, patch + 1].join('.'));
|
|
307
|
-
")
|
|
308
|
-
|
|
309
|
-
# Mettre a jour package.json avec la nouvelle version
|
|
310
|
-
npm version $NEW_VERSION --no-git-tag-version
|
|
311
|
-
|
|
312
|
-
# Committer le bump de version
|
|
313
|
-
git add package.json package-lock.json
|
|
314
|
-
git commit -m "chore: bump version to $NEW_VERSION"
|
|
315
|
-
|
|
316
|
-
# 3. Creer tag avec la nouvelle version
|
|
317
|
-
git tag -a "v$NEW_VERSION" -m "Hotfix v$NEW_VERSION"
|
|
318
|
-
git push origin main
|
|
319
|
-
git push origin "v$NEW_VERSION"
|
|
320
|
-
|
|
321
|
-
# 4. Merge back to develop
|
|
322
|
-
git checkout develop
|
|
323
|
-
git pull origin develop
|
|
324
|
-
git merge main --no-ff -m "chore: merge hotfix v$NEW_VERSION back to develop"
|
|
325
|
-
git push origin develop
|
|
326
|
-
|
|
327
|
-
# 5. Cleanup worktree + branche
|
|
328
|
-
WORKTREE_PATH="../worktrees/hotfixes/{name}"
|
|
329
|
-
if [ -d "$WORKTREE_PATH" ]; then
|
|
330
|
-
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
331
|
-
fi
|
|
332
|
-
git branch -d hotfix/{name}
|
|
333
|
-
git push origin --delete hotfix/{name} 2>/dev/null || true
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
**⚠️ IMPORTANT:** Le bump de version PATCH est automatique. Pas besoin de le faire manuellement avant le finish.
|
|
337
|
-
|
|
338
|
-
**Resume:**
|
|
339
|
-
```
|
|
340
|
-
HOTFIX FINALISE
|
|
341
|
-
════════════════════════════════════════
|
|
342
|
-
Hotfix: {name}
|
|
343
|
-
Version: v{CURRENT_VERSION} → v{NEW_VERSION}
|
|
344
|
-
Tag: v{NEW_VERSION} ✓
|
|
345
|
-
|
|
346
|
-
Actions effectuees:
|
|
347
|
-
✓ Version incrementee (PATCH): {CURRENT_VERSION} → {NEW_VERSION}
|
|
348
|
-
✓ package.json mis a jour
|
|
349
|
-
✓ Tag v{NEW_VERSION} cree et pousse
|
|
350
|
-
✓ Main mis a jour
|
|
351
|
-
✓ Develop synchronise (merge back)
|
|
352
|
-
✓ Branche hotfix supprimee
|
|
353
|
-
════════════════════════════════════════
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
## Gestion des conflits (merge back)
|
|
359
|
-
|
|
360
|
-
Si conflit lors du merge back to develop :
|
|
361
|
-
|
|
362
|
-
```
|
|
363
|
-
⚠️ CONFLIT DETECTE - MERGE BACK
|
|
364
|
-
────────────────────────────────
|
|
365
|
-
Le merge de main vers develop a des conflits.
|
|
366
|
-
|
|
367
|
-
Fichiers en conflit:
|
|
368
|
-
{liste fichiers}
|
|
369
|
-
|
|
370
|
-
Options:
|
|
371
|
-
1. Resoudre manuellement puis: git merge --continue
|
|
372
|
-
2. Annuler: git merge --abort
|
|
373
|
-
|
|
374
|
-
Commande recommandee:
|
|
375
|
-
Resoudre conflits dans IDE
|
|
376
|
-
git add .
|
|
377
|
-
git merge --continue
|
|
378
|
-
git push origin develop
|
|
379
|
-
────────────────────────────────
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
## Cleanup automatique des worktrees
|
|
385
|
-
|
|
386
|
-
Apres chaque finish, un cleanup cible est effectue pour le worktree de la branche finalisee:
|
|
387
|
-
|
|
388
|
-
```bash
|
|
389
|
-
# Fonction de cleanup cible (appelee automatiquement)
|
|
390
|
-
cleanup_worktree_for_branch() {
|
|
391
|
-
BRANCH=$1
|
|
392
|
-
WORKTREE_BASE="../worktrees"
|
|
393
|
-
|
|
394
|
-
# Determiner le chemin selon le type
|
|
395
|
-
if [[ $BRANCH == feature/* ]]; then
|
|
396
|
-
NAME=${BRANCH#feature/}
|
|
397
|
-
WORKTREE_PATH="$WORKTREE_BASE/features/$NAME"
|
|
398
|
-
elif [[ $BRANCH == release/* ]]; then
|
|
399
|
-
VERSION=${BRANCH#release/}
|
|
400
|
-
WORKTREE_PATH="$WORKTREE_BASE/releases/$VERSION"
|
|
401
|
-
elif [[ $BRANCH == hotfix/* ]]; then
|
|
402
|
-
NAME=${BRANCH#hotfix/}
|
|
403
|
-
WORKTREE_PATH="$WORKTREE_BASE/hotfixes/$NAME"
|
|
404
|
-
fi
|
|
405
|
-
|
|
406
|
-
# Supprimer si existe
|
|
407
|
-
if [ -d "$WORKTREE_PATH" ]; then
|
|
408
|
-
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
409
|
-
rm -rf "$WORKTREE_PATH" 2>/dev/null || true
|
|
410
|
-
git worktree prune
|
|
411
|
-
echo "✓ Worktree nettoye: $WORKTREE_PATH"
|
|
412
|
-
fi
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
# Appel automatique
|
|
416
|
-
cleanup_worktree_for_branch "$BRANCH"
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
**Note:** Pour un audit complet de tous les worktrees, utilisez:
|
|
420
|
-
|
|
421
|
-
```
|
|
422
|
-
/gitflow:12-cleanup
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
---
|
|
426
|
-
|
|
427
|
-
## Resume final
|
|
428
|
-
|
|
429
|
-
```
|
|
430
|
-
GITFLOW FINISH COMPLETE
|
|
431
|
-
════════════════════════════════════════
|
|
432
|
-
Type: {feature|release|hotfix}
|
|
433
|
-
Branche: {branch_name}
|
|
434
|
-
Status: FINALISEE
|
|
435
|
-
|
|
436
|
-
Resultats:
|
|
437
|
-
PR: #{number} (mergee)
|
|
438
|
-
Tag: {tag|N/A}
|
|
439
|
-
Main: {updated|N/A}
|
|
440
|
-
Develop: {updated|unchanged}
|
|
441
|
-
Cleanup: ✓ Branche supprimee
|
|
442
|
-
Worktree: ✓ Nettoye
|
|
443
|
-
|
|
444
|
-
════════════════════════════════════════
|
|
445
|
-
Workflow GitFlow complete!
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
---
|
|
449
|
-
|
|
450
|
-
## Modes
|
|
451
|
-
|
|
452
|
-
| Commande | Action |
|
|
453
|
-
|----------|--------|
|
|
454
|
-
| `/gitflow:11-finish` | Finaliser branche courante |
|
|
455
|
-
| `/gitflow:11-finish feature/xxx` | Finaliser branche specifiee |
|
|
456
|
-
| `/gitflow:11-finish --dry-run` | Simulation |
|
|
457
|
-
| `/gitflow:11-finish --skip-tag` | Sans creation de tag |
|
|
1
|
+
---
|
|
2
|
+
description: Phase 11 - Finish and finalize a GitFlow branch (tag + merge back)
|
|
3
|
+
agent: gitflow-finish
|
|
4
|
+
model: sonnet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Phase 11: FINISH - Finaliser une branche GitFlow
|
|
8
|
+
|
|
9
|
+
Tu es expert GitFlow. Finalise une branche apres merge de la PR.
|
|
10
|
+
|
|
11
|
+
**Argument:** `$ARGUMENTS` = branche a finaliser (optionnel, **SCAN AUTOMATIQUE** si absent)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Quand utiliser
|
|
16
|
+
|
|
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
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ETAPE 1: SCAN PROACTIF (si pas d'argument)
|
|
26
|
+
|
|
27
|
+
> **COMPORTEMENT PROACTIF:** Si aucun argument fourni, scanner TOUTES les branches pour proposer celles qui sont pretes a finaliser.
|
|
28
|
+
|
|
29
|
+
### 1.1 Scanner toutes les branches GitFlow
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git fetch --all --quiet
|
|
33
|
+
|
|
34
|
+
# Lister toutes les branches feature/release/hotfix
|
|
35
|
+
FEATURES=$(git branch -r | grep 'origin/feature/' | sed 's|origin/||' | tr -d ' ')
|
|
36
|
+
RELEASES=$(git branch -r | grep 'origin/release/' | sed 's|origin/||' | tr -d ' ')
|
|
37
|
+
HOTFIXES=$(git branch -r | grep 'origin/hotfix/' | sed 's|origin/||' | tr -d ' ')
|
|
38
|
+
|
|
39
|
+
ALL_BRANCHES="$FEATURES $RELEASES $HOTFIXES"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 1.2 Verifier le statut PR de chaque branche
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Pour chaque branche, verifier:
|
|
46
|
+
for BRANCH in $ALL_BRANCHES; do
|
|
47
|
+
# 1. PR mergee?
|
|
48
|
+
PR_MERGED=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt --jq '.[0]')
|
|
49
|
+
|
|
50
|
+
# 2. PR ouverte?
|
|
51
|
+
PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
|
|
52
|
+
|
|
53
|
+
# 3. Pas de PR?
|
|
54
|
+
# Si pas de PR → suggerer /gitflow:7-pull-request
|
|
55
|
+
|
|
56
|
+
# Categoriser
|
|
57
|
+
if [ -n "$PR_MERGED" ]; then
|
|
58
|
+
READY_TO_FINISH+=("$BRANCH")
|
|
59
|
+
elif [ -n "$PR_OPEN" ]; then
|
|
60
|
+
WAITING_FOR_MERGE+=("$BRANCH")
|
|
61
|
+
else
|
|
62
|
+
NEEDS_PR+=("$BRANCH")
|
|
63
|
+
fi
|
|
64
|
+
done
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 1.3 Afficher le tableau de synthese
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
================================================================================
|
|
71
|
+
GITFLOW FINISH - SCAN DES BRANCHES
|
|
72
|
+
================================================================================
|
|
73
|
+
|
|
74
|
+
✅ PRETES A FINALISER (PR mergee):
|
|
75
|
+
┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
|
|
76
|
+
│ Branche │ Type │ PR # │ Mergee le │
|
|
77
|
+
├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
|
|
78
|
+
│ feature/add-user-auth │ feature │ #42 │ 2024-01-15 14:30 │
|
|
79
|
+
│ release/v1.5.0 │ release │ #45 │ 2024-01-15 16:00 │
|
|
80
|
+
└─────────────────────────────┴───────────┴────────────┴─────────────────────┘
|
|
81
|
+
|
|
82
|
+
⏳ EN ATTENTE DE MERGE (PR ouverte):
|
|
83
|
+
┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
|
|
84
|
+
│ Branche │ Type │ PR # │ Statut │
|
|
85
|
+
├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
|
|
86
|
+
│ feature/add-orders │ feature │ #43 │ Review en cours │
|
|
87
|
+
│ hotfix/fix-login │ hotfix │ #44 │ CI en cours │
|
|
88
|
+
└─────────────────────────────┴───────────┴────────────┴─────────────────────┘
|
|
89
|
+
|
|
90
|
+
❌ SANS PR (action requise):
|
|
91
|
+
┌─────────────────────────────┬───────────┬────────────────────────────────────┐
|
|
92
|
+
│ Branche │ Type │ Action suggeree │
|
|
93
|
+
├─────────────────────────────┼───────────┼────────────────────────────────────┤
|
|
94
|
+
│ feature/wip-refactor │ feature │ /gitflow:7-pull-request │
|
|
95
|
+
│ feature/old-abandoned │ feature │ /gitflow:6-abort --branch │
|
|
96
|
+
└─────────────────────────────┴───────────┴────────────────────────────────────┘
|
|
97
|
+
|
|
98
|
+
================================================================================
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 1.4 Proposition interactive
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
// Si plusieurs branches pretes a finaliser
|
|
105
|
+
if (READY_TO_FINISH.length > 0) {
|
|
106
|
+
AskUserQuestion({
|
|
107
|
+
questions: [{
|
|
108
|
+
question: "Quelle branche voulez-vous finaliser ?",
|
|
109
|
+
header: "Finish",
|
|
110
|
+
options: READY_TO_FINISH.map(branch => ({
|
|
111
|
+
label: branch,
|
|
112
|
+
description: `PR #${getPRNumber(branch)} mergee - ${getType(branch)}`
|
|
113
|
+
})).concat([{
|
|
114
|
+
label: "Toutes",
|
|
115
|
+
description: "Finaliser toutes les branches pretes (dans l'ordre recommande)"
|
|
116
|
+
}]),
|
|
117
|
+
multiSelect: false
|
|
118
|
+
}]
|
|
119
|
+
})
|
|
120
|
+
} else if (WAITING_FOR_MERGE.length > 0) {
|
|
121
|
+
// Afficher message d'aide
|
|
122
|
+
console.log("Aucune branche prete a finaliser.")
|
|
123
|
+
console.log("→ Attendez le merge des PRs en cours ou utilisez /gitflow:9-merge")
|
|
124
|
+
} else if (NEEDS_PR.length > 0) {
|
|
125
|
+
// Afficher message d'aide
|
|
126
|
+
console.log("Aucune branche prete. Creez d'abord une PR:")
|
|
127
|
+
console.log("→ /gitflow:7-pull-request")
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 1.5 Ordre recommande pour "Toutes"
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
ORDRE DE FINALISATION RECOMMANDE:
|
|
135
|
+
1. Hotfixes (urgents, vers main puis develop)
|
|
136
|
+
2. Releases (vers main puis develop)
|
|
137
|
+
3. Features (vers develop, par date de merge)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## ETAPE 2: Detecter le contexte (si argument fourni)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Branche specifiee ou selectionnee
|
|
146
|
+
BRANCH=${ARGUMENTS:-$SELECTED_BRANCH}
|
|
147
|
+
|
|
148
|
+
# Determiner le type
|
|
149
|
+
if [[ $BRANCH == feature/* ]]; then TYPE="feature"
|
|
150
|
+
elif [[ $BRANCH == release/* ]]; then TYPE="release"
|
|
151
|
+
elif [[ $BRANCH == hotfix/* ]]; then TYPE="hotfix"
|
|
152
|
+
else
|
|
153
|
+
echo "⚠️ '$BRANCH' n'est pas une branche GitFlow (feature/release/hotfix)"
|
|
154
|
+
echo "→ Utilisez /gitflow:11-finish sans argument pour scanner les branches"
|
|
155
|
+
exit 1
|
|
156
|
+
fi
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## ETAPE 3: Verifier que PR est mergee
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Chercher PR associee
|
|
163
|
+
PR_INFO=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt,title --jq '.[0]')
|
|
164
|
+
|
|
165
|
+
# Si pas mergee
|
|
166
|
+
if [ -z "$PR_INFO" ]; then
|
|
167
|
+
# Verifier si PR ouverte
|
|
168
|
+
PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
|
|
169
|
+
|
|
170
|
+
if [ -n "$PR_OPEN" ]; then
|
|
171
|
+
PR_NUM=$(echo "$PR_OPEN" | jq -r '.number')
|
|
172
|
+
echo "⚠️ PR #$PR_NUM existe mais n'est pas encore mergee"
|
|
173
|
+
echo ""
|
|
174
|
+
echo "Options:"
|
|
175
|
+
echo " 1. Merger la PR: /gitflow:9-merge $PR_NUM"
|
|
176
|
+
echo " 2. Voir la PR: gh pr view $PR_NUM --web"
|
|
177
|
+
echo " 3. Abandonner: /gitflow:6-abort --branch"
|
|
178
|
+
else
|
|
179
|
+
echo "⚠️ Aucune PR trouvee pour '$BRANCH'"
|
|
180
|
+
echo ""
|
|
181
|
+
echo "Options:"
|
|
182
|
+
echo " 1. Creer une PR: /gitflow:7-pull-request"
|
|
183
|
+
echo " 2. Abandonner: /gitflow:6-abort --branch"
|
|
184
|
+
fi
|
|
185
|
+
exit 1
|
|
186
|
+
fi
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Actions selon type
|
|
192
|
+
|
|
193
|
+
### Feature (simple cleanup)
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Detecter si on est dans un worktree et trouver le repo principal
|
|
197
|
+
CURRENT_DIR=$(pwd)
|
|
198
|
+
MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
|
|
199
|
+
|
|
200
|
+
# Revenir au repo principal AVANT de supprimer le worktree
|
|
201
|
+
cd "$MAIN_WORKTREE"
|
|
202
|
+
|
|
203
|
+
# Supprimer worktree si existe
|
|
204
|
+
WORKTREE_PATH="../worktrees/features/{name}"
|
|
205
|
+
if [ -d "$WORKTREE_PATH" ]; then
|
|
206
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
# Supprimer branche locale
|
|
210
|
+
git checkout develop
|
|
211
|
+
git pull origin develop
|
|
212
|
+
git branch -d feature/{name}
|
|
213
|
+
|
|
214
|
+
# Supprimer branche remote (si pas fait par merge)
|
|
215
|
+
git push origin --delete feature/{name} 2>/dev/null || true
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Resume:**
|
|
219
|
+
```
|
|
220
|
+
FEATURE FINALISEE
|
|
221
|
+
────────────────────────────────
|
|
222
|
+
Branche: feature/{name}
|
|
223
|
+
Mergee: develop
|
|
224
|
+
PR: #{number}
|
|
225
|
+
Cleanup: ✓ Branche supprimee
|
|
226
|
+
────────────────────────────────
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### Release (tag + merge back)
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# 0. Detecter si on est dans un worktree et trouver le repo principal
|
|
235
|
+
CURRENT_DIR=$(pwd)
|
|
236
|
+
MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
|
|
237
|
+
|
|
238
|
+
# Revenir au repo principal AVANT toute operation
|
|
239
|
+
cd "$MAIN_WORKTREE"
|
|
240
|
+
|
|
241
|
+
# 1. Checkout main et pull
|
|
242
|
+
git checkout main
|
|
243
|
+
git pull origin main
|
|
244
|
+
|
|
245
|
+
# 2. Creer tag
|
|
246
|
+
VERSION=$(echo $BRANCH | sed 's/release\/v//')
|
|
247
|
+
git tag -a "v$VERSION" -m "Release v$VERSION"
|
|
248
|
+
git push origin "v$VERSION"
|
|
249
|
+
|
|
250
|
+
# 3. Merge back to develop
|
|
251
|
+
git checkout develop
|
|
252
|
+
git pull origin develop
|
|
253
|
+
git merge main --no-ff -m "chore: merge release v$VERSION back to develop"
|
|
254
|
+
git push origin develop
|
|
255
|
+
|
|
256
|
+
# 4. Cleanup worktree + branche
|
|
257
|
+
WORKTREE_PATH="../worktrees/releases/v$VERSION"
|
|
258
|
+
if [ -d "$WORKTREE_PATH" ]; then
|
|
259
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
260
|
+
fi
|
|
261
|
+
git branch -d release/v$VERSION
|
|
262
|
+
git push origin --delete release/v$VERSION 2>/dev/null || true
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Resume:**
|
|
266
|
+
```
|
|
267
|
+
RELEASE FINALISEE
|
|
268
|
+
════════════════════════════════════════
|
|
269
|
+
Version: v{version}
|
|
270
|
+
Tag: v{version} ✓
|
|
271
|
+
Main: ✓ Mergee
|
|
272
|
+
Develop: ✓ Merge back complete
|
|
273
|
+
|
|
274
|
+
Actions effectuees:
|
|
275
|
+
✓ Tag v{version} cree et pousse
|
|
276
|
+
✓ Main mis a jour
|
|
277
|
+
✓ Develop synchronise avec main
|
|
278
|
+
✓ Branche release supprimee
|
|
279
|
+
════════════════════════════════════════
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Hotfix (auto-increment PATCH + tag + merge back)
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# 0. Detecter si on est dans un worktree et trouver le repo principal
|
|
288
|
+
CURRENT_DIR=$(pwd)
|
|
289
|
+
MAIN_WORKTREE=$(git worktree list --porcelain | grep -m1 "^worktree " | sed 's/worktree //')
|
|
290
|
+
|
|
291
|
+
# Revenir au repo principal AVANT toute operation
|
|
292
|
+
cd "$MAIN_WORKTREE"
|
|
293
|
+
|
|
294
|
+
# 1. Checkout main et pull
|
|
295
|
+
git checkout main
|
|
296
|
+
git pull origin main
|
|
297
|
+
|
|
298
|
+
# 2. AUTO-INCREMENT PATCH VERSION
|
|
299
|
+
# Lire la version actuelle
|
|
300
|
+
CURRENT_VERSION=$(cat package.json | jq -r '.version')
|
|
301
|
+
|
|
302
|
+
# Calculer la nouvelle version (PATCH increment)
|
|
303
|
+
# Ex: 1.7.1 → 1.7.2
|
|
304
|
+
NEW_VERSION=$(node -e "
|
|
305
|
+
const [major, minor, patch] = '$CURRENT_VERSION'.split('.').map(Number);
|
|
306
|
+
console.log([major, minor, patch + 1].join('.'));
|
|
307
|
+
")
|
|
308
|
+
|
|
309
|
+
# Mettre a jour package.json avec la nouvelle version
|
|
310
|
+
npm version $NEW_VERSION --no-git-tag-version
|
|
311
|
+
|
|
312
|
+
# Committer le bump de version
|
|
313
|
+
git add package.json package-lock.json
|
|
314
|
+
git commit -m "chore: bump version to $NEW_VERSION"
|
|
315
|
+
|
|
316
|
+
# 3. Creer tag avec la nouvelle version
|
|
317
|
+
git tag -a "v$NEW_VERSION" -m "Hotfix v$NEW_VERSION"
|
|
318
|
+
git push origin main
|
|
319
|
+
git push origin "v$NEW_VERSION"
|
|
320
|
+
|
|
321
|
+
# 4. Merge back to develop
|
|
322
|
+
git checkout develop
|
|
323
|
+
git pull origin develop
|
|
324
|
+
git merge main --no-ff -m "chore: merge hotfix v$NEW_VERSION back to develop"
|
|
325
|
+
git push origin develop
|
|
326
|
+
|
|
327
|
+
# 5. Cleanup worktree + branche
|
|
328
|
+
WORKTREE_PATH="../worktrees/hotfixes/{name}"
|
|
329
|
+
if [ -d "$WORKTREE_PATH" ]; then
|
|
330
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
331
|
+
fi
|
|
332
|
+
git branch -d hotfix/{name}
|
|
333
|
+
git push origin --delete hotfix/{name} 2>/dev/null || true
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**⚠️ IMPORTANT:** Le bump de version PATCH est automatique. Pas besoin de le faire manuellement avant le finish.
|
|
337
|
+
|
|
338
|
+
**Resume:**
|
|
339
|
+
```
|
|
340
|
+
HOTFIX FINALISE
|
|
341
|
+
════════════════════════════════════════
|
|
342
|
+
Hotfix: {name}
|
|
343
|
+
Version: v{CURRENT_VERSION} → v{NEW_VERSION}
|
|
344
|
+
Tag: v{NEW_VERSION} ✓
|
|
345
|
+
|
|
346
|
+
Actions effectuees:
|
|
347
|
+
✓ Version incrementee (PATCH): {CURRENT_VERSION} → {NEW_VERSION}
|
|
348
|
+
✓ package.json mis a jour
|
|
349
|
+
✓ Tag v{NEW_VERSION} cree et pousse
|
|
350
|
+
✓ Main mis a jour
|
|
351
|
+
✓ Develop synchronise (merge back)
|
|
352
|
+
✓ Branche hotfix supprimee
|
|
353
|
+
════════════════════════════════════════
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## Gestion des conflits (merge back)
|
|
359
|
+
|
|
360
|
+
Si conflit lors du merge back to develop :
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
⚠️ CONFLIT DETECTE - MERGE BACK
|
|
364
|
+
────────────────────────────────
|
|
365
|
+
Le merge de main vers develop a des conflits.
|
|
366
|
+
|
|
367
|
+
Fichiers en conflit:
|
|
368
|
+
{liste fichiers}
|
|
369
|
+
|
|
370
|
+
Options:
|
|
371
|
+
1. Resoudre manuellement puis: git merge --continue
|
|
372
|
+
2. Annuler: git merge --abort
|
|
373
|
+
|
|
374
|
+
Commande recommandee:
|
|
375
|
+
Resoudre conflits dans IDE
|
|
376
|
+
git add .
|
|
377
|
+
git merge --continue
|
|
378
|
+
git push origin develop
|
|
379
|
+
────────────────────────────────
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Cleanup automatique des worktrees
|
|
385
|
+
|
|
386
|
+
Apres chaque finish, un cleanup cible est effectue pour le worktree de la branche finalisee:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
# Fonction de cleanup cible (appelee automatiquement)
|
|
390
|
+
cleanup_worktree_for_branch() {
|
|
391
|
+
BRANCH=$1
|
|
392
|
+
WORKTREE_BASE="../worktrees"
|
|
393
|
+
|
|
394
|
+
# Determiner le chemin selon le type
|
|
395
|
+
if [[ $BRANCH == feature/* ]]; then
|
|
396
|
+
NAME=${BRANCH#feature/}
|
|
397
|
+
WORKTREE_PATH="$WORKTREE_BASE/features/$NAME"
|
|
398
|
+
elif [[ $BRANCH == release/* ]]; then
|
|
399
|
+
VERSION=${BRANCH#release/}
|
|
400
|
+
WORKTREE_PATH="$WORKTREE_BASE/releases/$VERSION"
|
|
401
|
+
elif [[ $BRANCH == hotfix/* ]]; then
|
|
402
|
+
NAME=${BRANCH#hotfix/}
|
|
403
|
+
WORKTREE_PATH="$WORKTREE_BASE/hotfixes/$NAME"
|
|
404
|
+
fi
|
|
405
|
+
|
|
406
|
+
# Supprimer si existe
|
|
407
|
+
if [ -d "$WORKTREE_PATH" ]; then
|
|
408
|
+
git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || true
|
|
409
|
+
rm -rf "$WORKTREE_PATH" 2>/dev/null || true
|
|
410
|
+
git worktree prune
|
|
411
|
+
echo "✓ Worktree nettoye: $WORKTREE_PATH"
|
|
412
|
+
fi
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
# Appel automatique
|
|
416
|
+
cleanup_worktree_for_branch "$BRANCH"
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Note:** Pour un audit complet de tous les worktrees, utilisez:
|
|
420
|
+
|
|
421
|
+
```
|
|
422
|
+
/gitflow:12-cleanup
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
---
|
|
426
|
+
|
|
427
|
+
## Resume final
|
|
428
|
+
|
|
429
|
+
```
|
|
430
|
+
GITFLOW FINISH COMPLETE
|
|
431
|
+
════════════════════════════════════════
|
|
432
|
+
Type: {feature|release|hotfix}
|
|
433
|
+
Branche: {branch_name}
|
|
434
|
+
Status: FINALISEE
|
|
435
|
+
|
|
436
|
+
Resultats:
|
|
437
|
+
PR: #{number} (mergee)
|
|
438
|
+
Tag: {tag|N/A}
|
|
439
|
+
Main: {updated|N/A}
|
|
440
|
+
Develop: {updated|unchanged}
|
|
441
|
+
Cleanup: ✓ Branche supprimee
|
|
442
|
+
Worktree: ✓ Nettoye
|
|
443
|
+
|
|
444
|
+
════════════════════════════════════════
|
|
445
|
+
Workflow GitFlow complete!
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
## Modes
|
|
451
|
+
|
|
452
|
+
| Commande | Action |
|
|
453
|
+
|----------|--------|
|
|
454
|
+
| `/gitflow:11-finish` | Finaliser branche courante |
|
|
455
|
+
| `/gitflow:11-finish feature/xxx` | Finaliser branche specifiee |
|
|
456
|
+
| `/gitflow:11-finish --dry-run` | Simulation |
|
|
457
|
+
| `/gitflow:11-finish --skip-tag` | Sans creation de tag |
|