@atlashub/smartstack-cli 1.5.0 → 1.5.2
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/agents.html +920 -916
- package/.documentation/apex.html +1022 -1018
- package/.documentation/business-analyse.html +1505 -1501
- package/.documentation/commands.html +684 -680
- package/.documentation/css/styles.css +2168 -2168
- package/.documentation/efcore.html +2509 -2505
- package/.documentation/gitflow.html +2622 -2618
- package/.documentation/hooks.html +417 -413
- package/.documentation/index.html +327 -323
- package/.documentation/init.html +565 -0
- package/.documentation/installation.html +548 -462
- package/.documentation/js/app.js +794 -794
- package/.documentation/ralph-loop.html +534 -530
- package/.documentation/test-web.html +517 -513
- 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 +18 -8
- 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 -562
- 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,768 +1,768 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Phase 10 - Start a new feature, release or hotfix branch with worktree
|
|
3
|
-
agent: gitflow-start
|
|
4
|
-
model: haiku
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Phase 10: START - Demarrer une branche GitFlow (Worktree)
|
|
8
|
-
|
|
9
|
-
Tu es expert GitFlow. Cree une branche dans un **worktree separe** (par defaut).
|
|
10
|
-
|
|
11
|
-
> **INSTRUCTION CLAUDE:** 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
|
-
**Argument:** `$ARGUMENTS` = `{type} {name} [--no-worktree]`
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## ETAPE 1: Analyser le contexte
|
|
18
|
-
|
|
19
|
-
**IMPORTANT:** Avant toute question, collecter ces informations :
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# 1. Branche courante
|
|
23
|
-
CURRENT_BRANCH=$(git branch --show-current)
|
|
24
|
-
|
|
25
|
-
# 2. Version actuelle (package.json, .csproj, VERSION, etc.)
|
|
26
|
-
VERSION=$(cat package.json 2>/dev/null | grep '"version"' | head -1 | sed 's/.*: "\(.*\)".*/\1/')
|
|
27
|
-
# Ou pour .NET: grep -oP '(?<=<Version>).*(?=</Version>)' *.csproj
|
|
28
|
-
|
|
29
|
-
# 3. Etat working directory
|
|
30
|
-
STATUS=$(git status --porcelain)
|
|
31
|
-
|
|
32
|
-
# 4. Commits develop vs main
|
|
33
|
-
DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
|
|
34
|
-
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
35
|
-
|
|
36
|
-
# 5. Dernier tag
|
|
37
|
-
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
|
38
|
-
|
|
39
|
-
# 6. Branches existantes
|
|
40
|
-
EXISTING_FEATURES=$(git branch -r | grep 'feature/' | wc -l)
|
|
41
|
-
EXISTING_RELEASES=$(git branch -r | grep 'release/' | wc -l)
|
|
42
|
-
EXISTING_HOTFIXES=$(git branch -r | grep 'hotfix/' | wc -l)
|
|
43
|
-
|
|
44
|
-
# 7. Compter les migrations sur develop (pour releases)
|
|
45
|
-
MIGRATIONS_ON_DEVELOP=$(find . -path "*/Migrations/*.cs" -not -name "*Designer*" -not -name "*ModelSnapshot*" 2>/dev/null | wc -l)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## ETAPE 2: Afficher le contexte
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
================================================================================
|
|
54
|
-
GITFLOW START - CONTEXTE
|
|
55
|
-
================================================================================
|
|
56
|
-
|
|
57
|
-
REPOSITORY
|
|
58
|
-
Branche: {CURRENT_BRANCH} | Version: {VERSION} | Tag: {LAST_TAG}
|
|
59
|
-
Working dir: {clean|dirty avec N fichiers}
|
|
60
|
-
|
|
61
|
-
SYNCHRONISATION
|
|
62
|
-
develop → main: {DEVELOP_AHEAD} commits en avance
|
|
63
|
-
main → develop: {MAIN_AHEAD} commits en avance
|
|
64
|
-
{Si DEVELOP_AHEAD > 0: "Une release est recommandee"}
|
|
65
|
-
{Si MAIN_AHEAD > 0: "⚠️ ATTENTION: main contient des commits absents de develop!"}
|
|
66
|
-
|
|
67
|
-
BRANCHES ACTIVES
|
|
68
|
-
Features: {N} | Releases: {N} | Hotfixes: {N}
|
|
69
|
-
|
|
70
|
-
EF CORE (si projet .NET)
|
|
71
|
-
Migrations sur develop: {MIGRATIONS_ON_DEVELOP}
|
|
72
|
-
|
|
73
|
-
================================================================================
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## ETAPE 3: Questions dynamiques selon contexte
|
|
79
|
-
|
|
80
|
-
### Si `$ARGUMENTS` fourni → Parser et executer directement
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
$ARGUMENTS = "feature add-user-auth"
|
|
84
|
-
→ TYPE = "feature", NAME = "add-user-auth"
|
|
85
|
-
→ Sauter les questions, executer directement
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Si PAS d'arguments → Questionnaire dynamique
|
|
89
|
-
|
|
90
|
-
**Construire les options selon le contexte:**
|
|
91
|
-
|
|
92
|
-
```javascript
|
|
93
|
-
// Logique de construction des options
|
|
94
|
-
options = []
|
|
95
|
-
|
|
96
|
-
// Feature: toujours disponible depuis develop
|
|
97
|
-
if (CURRENT_BRANCH === 'develop' || canSwitchTo('develop')) {
|
|
98
|
-
options.push({
|
|
99
|
-
label: "feature",
|
|
100
|
-
description: "Nouvelle fonctionnalite (depuis develop)"
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Release: proposer SI develop a des commits ahead de main
|
|
105
|
-
if (DEVELOP_AHEAD > 0) {
|
|
106
|
-
// Calculer les versions possibles
|
|
107
|
-
const [major, minor, patch] = VERSION.split('.').map(Number)
|
|
108
|
-
options.push({
|
|
109
|
-
label: `release v${major}.${minor + 1}.0`,
|
|
110
|
-
description: `Release minor - ${DEVELOP_AHEAD} commits a publier (Recommande)`
|
|
111
|
-
})
|
|
112
|
-
options.push({
|
|
113
|
-
label: `release v${major + 1}.0.0`,
|
|
114
|
-
description: "Release major - Changements breaking"
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Hotfix: toujours disponible, mais mettre en avant si sur main ou si urgent
|
|
119
|
-
if (CURRENT_BRANCH === 'main') {
|
|
120
|
-
options.unshift({
|
|
121
|
-
label: "hotfix",
|
|
122
|
-
description: "Correction urgente (depuis main) - PRIORITAIRE"
|
|
123
|
-
})
|
|
124
|
-
} else {
|
|
125
|
-
options.push({
|
|
126
|
-
label: "hotfix",
|
|
127
|
-
description: "Correction urgente (depuis main)"
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**AskUserQuestion avec options dynamiques:**
|
|
133
|
-
|
|
134
|
-
```javascript
|
|
135
|
-
AskUserQuestion({
|
|
136
|
-
questions: [{
|
|
137
|
-
question: "Quel type de branche voulez-vous creer ?",
|
|
138
|
-
header: "Type",
|
|
139
|
-
options: options, // Options construites dynamiquement
|
|
140
|
-
multiSelect: false
|
|
141
|
-
}]
|
|
142
|
-
})
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## ETAPE 4: Question de suivi selon le type
|
|
148
|
-
|
|
149
|
-
### Si FEATURE selectionne:
|
|
150
|
-
|
|
151
|
-
```javascript
|
|
152
|
-
AskUserQuestion({
|
|
153
|
-
questions: [{
|
|
154
|
-
question: "Decrivez la feature (utilisé pour le nom de branche)",
|
|
155
|
-
header: "Feature",
|
|
156
|
-
options: [
|
|
157
|
-
{ label: "add-", description: "Ajouter une nouvelle fonctionnalite" },
|
|
158
|
-
{ label: "update-", description: "Ameliorer une fonctionnalite existante" },
|
|
159
|
-
{ label: "refactor-", description: "Refactoring de code" }
|
|
160
|
-
],
|
|
161
|
-
multiSelect: false
|
|
162
|
-
}]
|
|
163
|
-
})
|
|
164
|
-
// Puis demander le nom complet en texte libre
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Si RELEASE selectionne:
|
|
168
|
-
|
|
169
|
-
**Etape A: Verifier l'etat de main**
|
|
170
|
-
|
|
171
|
-
```javascript
|
|
172
|
-
// Si main contient des commits absents de develop (main corrompu/divergent)
|
|
173
|
-
if (MAIN_AHEAD > 0) {
|
|
174
|
-
AskUserQuestion({
|
|
175
|
-
questions: [{
|
|
176
|
-
question: `⚠️ ATTENTION: main contient ${MAIN_AHEAD} commits absents de develop. Comment proceder ?`,
|
|
177
|
-
header: "Main",
|
|
178
|
-
options: [
|
|
179
|
-
{ label: "Reset main", description: "Cette release remettra main en sync avec develop (Recommande)" },
|
|
180
|
-
{ label: "Analyser d'abord", description: "Voir les commits divergents avant de decider" },
|
|
181
|
-
{ label: "Continuer normalement", description: "Ignorer la divergence (non recommande)" }
|
|
182
|
-
],
|
|
183
|
-
multiSelect: false
|
|
184
|
-
}]
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Si "Analyser d'abord" → Afficher les commits divergents:
|
|
189
|
-
// git log origin/develop..origin/main --oneline
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Etape B: Gestion des migrations EF Core**
|
|
193
|
-
|
|
194
|
-
```javascript
|
|
195
|
-
// Si projet .NET avec plusieurs migrations
|
|
196
|
-
if (MIGRATIONS_ON_DEVELOP > 3) {
|
|
197
|
-
AskUserQuestion({
|
|
198
|
-
questions: [{
|
|
199
|
-
question: `Il y a ${MIGRATIONS_ON_DEVELOP} migrations sur develop. Voulez-vous les consolider ?`,
|
|
200
|
-
header: "Migrations",
|
|
201
|
-
options: [
|
|
202
|
-
{ label: "Consolider", description: "Squash en 1 migration propre (Recommande pour releases)" },
|
|
203
|
-
{ label: "Garder separees", description: "Conserver l'historique des migrations" }
|
|
204
|
-
],
|
|
205
|
-
multiSelect: false
|
|
206
|
-
}]
|
|
207
|
-
})
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Si "Consolider" → Executer le processus de squash:
|
|
211
|
-
// 1. Backup de la branche actuelle
|
|
212
|
-
// 2. dotnet ef migrations list → sauvegarder la liste
|
|
213
|
-
// 3. dotnet ef database drop (si DB locale de dev)
|
|
214
|
-
// 4. Supprimer tous les fichiers Migrations/
|
|
215
|
-
// 5. dotnet ef migrations add InitialCreate_v{version}
|
|
216
|
-
// 6. Commit avec message descriptif
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Etape C: Confirmer la version**
|
|
220
|
-
|
|
221
|
-
```javascript
|
|
222
|
-
const [major, minor, patch] = VERSION.split('.').map(Number)
|
|
223
|
-
|
|
224
|
-
AskUserQuestion({
|
|
225
|
-
questions: [{
|
|
226
|
-
question: "Confirmer la version de release",
|
|
227
|
-
header: "Version",
|
|
228
|
-
options: [
|
|
229
|
-
{ label: `${major}.${minor + 1}.0`, description: "Minor - Nouvelles fonctionnalites (Recommande)" },
|
|
230
|
-
{ label: `${major}.${minor}.${patch + 1}`, description: "Patch - Corrections uniquement" },
|
|
231
|
-
{ label: `${major + 1}.0.0`, description: "Major - Changements breaking" }
|
|
232
|
-
],
|
|
233
|
-
multiSelect: false
|
|
234
|
-
}]
|
|
235
|
-
})
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Si HOTFIX selectionne:
|
|
239
|
-
|
|
240
|
-
**⚠️ NOTE VERSIONING:** La version sera automatiquement incrementee (PATCH) lors du `/gitflow:11-finish`.
|
|
241
|
-
Exemple: `1.7.1` → `1.7.2`. Pas besoin de faire `npm version patch` manuellement.
|
|
242
|
-
|
|
243
|
-
```javascript
|
|
244
|
-
AskUserQuestion({
|
|
245
|
-
questions: [{
|
|
246
|
-
question: "Decrivez le hotfix (utilisé pour le nom de branche)",
|
|
247
|
-
header: "Hotfix",
|
|
248
|
-
options: [
|
|
249
|
-
{ label: "fix-", description: "Correction de bug" },
|
|
250
|
-
{ label: "security-", description: "Correction de securite" },
|
|
251
|
-
{ label: "revert-", description: "Annuler un changement" }
|
|
252
|
-
],
|
|
253
|
-
multiSelect: false
|
|
254
|
-
}]
|
|
255
|
-
})
|
|
256
|
-
// Puis demander le nom complet en texte libre
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
## ETAPE 5: Verifications pre-creation
|
|
262
|
-
|
|
263
|
-
| Check | Commande | Action si echec |
|
|
264
|
-
|-------|----------|-----------------|
|
|
265
|
-
| Working tree clean | `git status --porcelain` | Proposer stash ou commit |
|
|
266
|
-
| Branche n'existe pas | `git branch --list {branch}` | Erreur avec suggestion |
|
|
267
|
-
| Base a jour | `git fetch origin` | Fetch automatique |
|
|
268
|
-
|
|
269
|
-
**Si working directory dirty:**
|
|
270
|
-
|
|
271
|
-
```javascript
|
|
272
|
-
AskUserQuestion({
|
|
273
|
-
questions: [{
|
|
274
|
-
question: "Working directory non propre. Que faire ?",
|
|
275
|
-
header: "Action",
|
|
276
|
-
options: [
|
|
277
|
-
{ label: "Stash", description: "git stash - Sauvegarder temporairement" },
|
|
278
|
-
{ label: "Commit", description: "Lancer /gitflow:3-commit d'abord" },
|
|
279
|
-
{ label: "Continuer", description: "Ignorer (non recommande)" }
|
|
280
|
-
],
|
|
281
|
-
multiSelect: false
|
|
282
|
-
}]
|
|
283
|
-
})
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## ETAPE 6: Creer la branche
|
|
289
|
-
|
|
290
|
-
### Detecter le mode worktree
|
|
291
|
-
|
|
292
|
-
```bash
|
|
293
|
-
# Lire la config GitFlow
|
|
294
|
-
CONFIG_FILE=".claude/gitflow/config.json"
|
|
295
|
-
if [ -f "$CONFIG_FILE" ]; then
|
|
296
|
-
WORKTREE_MODE=$(grep -o '"mode": *"[^"]*"' "$CONFIG_FILE" | head -1 | cut -d'"' -f4)
|
|
297
|
-
# Default to adjacent if not specified
|
|
298
|
-
WORKTREE_MODE=${WORKTREE_MODE:-adjacent}
|
|
299
|
-
else
|
|
300
|
-
WORKTREE_MODE="adjacent"
|
|
301
|
-
fi
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Mode Worktree - Organized (v1.3)
|
|
305
|
-
|
|
306
|
-
**Si `worktrees.mode` = "organized"** (structure 01-Main, 02-Develop, etc.)
|
|
307
|
-
|
|
308
|
-
```bash
|
|
309
|
-
# Paths relatifs au projet parent (on est dans 02-Develop)
|
|
310
|
-
PROJECT_ROOT=".."
|
|
311
|
-
|
|
312
|
-
git fetch origin
|
|
313
|
-
|
|
314
|
-
# Feature (depuis develop)
|
|
315
|
-
WORKTREE_PATH="${PROJECT_ROOT}/features/{name}"
|
|
316
|
-
mkdir -p "${PROJECT_ROOT}/features"
|
|
317
|
-
git worktree add -b feature/{name} "$WORKTREE_PATH" origin/develop
|
|
318
|
-
|
|
319
|
-
# Release (depuis develop)
|
|
320
|
-
WORKTREE_PATH="${PROJECT_ROOT}/releases/v{version}"
|
|
321
|
-
mkdir -p "${PROJECT_ROOT}/releases"
|
|
322
|
-
git worktree add -b release/v{version} "$WORKTREE_PATH" origin/develop
|
|
323
|
-
|
|
324
|
-
# Hotfix (depuis main)
|
|
325
|
-
WORKTREE_PATH="${PROJECT_ROOT}/hotfixes/{name}"
|
|
326
|
-
mkdir -p "${PROJECT_ROOT}/hotfixes"
|
|
327
|
-
git worktree add -b hotfix/{name} "$WORKTREE_PATH" origin/main
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
**Structure resultante (Organized):**
|
|
331
|
-
```
|
|
332
|
-
{project}/
|
|
333
|
-
├── 01-Main/
|
|
334
|
-
├── 02-Develop/ ← Current
|
|
335
|
-
├── features/
|
|
336
|
-
│ └── {name}/ ← NEW
|
|
337
|
-
├── releases/
|
|
338
|
-
└── hotfixes/
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Mode Worktree - Adjacent (Legacy v1.2)
|
|
342
|
-
|
|
343
|
-
**Si `worktrees.mode` = "adjacent"** (structure ../worktrees/)
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
WORKTREE_BASE="../worktrees"
|
|
347
|
-
|
|
348
|
-
# Creer le repertoire parent et le sous-repertoire du type
|
|
349
|
-
mkdir -p "${WORKTREE_BASE}/features"
|
|
350
|
-
mkdir -p "${WORKTREE_BASE}/releases"
|
|
351
|
-
mkdir -p "${WORKTREE_BASE}/hotfixes"
|
|
352
|
-
|
|
353
|
-
git fetch origin
|
|
354
|
-
|
|
355
|
-
# Feature (depuis develop)
|
|
356
|
-
WORKTREE_PATH="${WORKTREE_BASE}/features/{name}"
|
|
357
|
-
git worktree add -b feature/{name} "$WORKTREE_PATH" origin/develop
|
|
358
|
-
|
|
359
|
-
# Release (depuis develop)
|
|
360
|
-
WORKTREE_PATH="${WORKTREE_BASE}/releases/v{version}"
|
|
361
|
-
git worktree add -b release/v{version} "$WORKTREE_PATH" origin/develop
|
|
362
|
-
|
|
363
|
-
# Hotfix (depuis main)
|
|
364
|
-
WORKTREE_PATH="${WORKTREE_BASE}/hotfixes/{name}"
|
|
365
|
-
git worktree add -b hotfix/{name} "$WORKTREE_PATH" origin/main
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
**Structure resultante (Adjacent):**
|
|
369
|
-
```
|
|
370
|
-
parent/
|
|
371
|
-
├── repo/ ← Current
|
|
372
|
-
└── worktrees/
|
|
373
|
-
└── features/
|
|
374
|
-
└── {name}/ ← NEW
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Mode --no-worktree
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
# Feature
|
|
381
|
-
git checkout develop && git pull origin develop
|
|
382
|
-
git checkout -b feature/{name}
|
|
383
|
-
|
|
384
|
-
# Release
|
|
385
|
-
git checkout develop && git pull origin develop
|
|
386
|
-
git checkout -b release/v{version}
|
|
387
|
-
|
|
388
|
-
# Hotfix
|
|
389
|
-
git checkout main && git pull origin main
|
|
390
|
-
git checkout -b hotfix/{name}
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
|
-
## ETAPE 6.5: Configuration AUTOMATIQUE appsettings.Local.json (Projets .NET)
|
|
396
|
-
|
|
397
|
-
> **AUTOMATIQUE:** Cette etape s'execute sans intervention utilisateur pour garantir
|
|
398
|
-
> l'isolation des bases de donnees entre worktrees.
|
|
399
|
-
|
|
400
|
-
### 6.5.1: Detecter les projets .NET
|
|
401
|
-
|
|
402
|
-
```bash
|
|
403
|
-
cd "${WORKTREE_PATH}"
|
|
404
|
-
|
|
405
|
-
# Chercher tous les fichiers appsettings.json (peut y en avoir plusieurs)
|
|
406
|
-
APPSETTINGS_FILES=$(find . -name "appsettings.json" -not -path "*/bin/*" -not -path "*/obj/*" 2>/dev/null)
|
|
407
|
-
|
|
408
|
-
if [ -z "$APPSETTINGS_FILES" ]; then
|
|
409
|
-
echo "Pas de projet .NET detecte (aucun appsettings.json)"
|
|
410
|
-
# Continuer sans configuration
|
|
411
|
-
fi
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
### 6.5.2: Generer le nom de base de donnees UNIQUE
|
|
415
|
-
|
|
416
|
-
**Convention de nommage:**
|
|
417
|
-
|
|
418
|
-
| Type de branche | Pattern DB | Exemple |
|
|
419
|
-
|-----------------|------------|---------|
|
|
420
|
-
| develop | `{ProjectName}_Dev` | `SmartStack_Dev` |
|
|
421
|
-
| feature/* | `{ProjectName}_feat_{name}` | `SmartStack_feat_add_user_auth` |
|
|
422
|
-
| hotfix/* | `{ProjectName}_fix_{name}` | `SmartStack_fix_login_bug` |
|
|
423
|
-
| release/* | `{ProjectName}_rel_{version}` | `SmartStack_rel_1_3_0` |
|
|
424
|
-
|
|
425
|
-
```bash
|
|
426
|
-
# Extraire le nom de projet depuis le .csproj ou le dossier
|
|
427
|
-
PROJECT_NAME=$(basename "$(find . -name "*.Api.csproj" -o -name "*.Web.csproj" | head -1)" .csproj 2>/dev/null)
|
|
428
|
-
if [ -z "$PROJECT_NAME" ]; then
|
|
429
|
-
PROJECT_NAME=$(basename "$(pwd)" | sed 's/[^a-zA-Z0-9]/_/g')
|
|
430
|
-
fi
|
|
431
|
-
|
|
432
|
-
# Normaliser le nom de branche pour SQL Server (pas de caracteres speciaux)
|
|
433
|
-
BRANCH_SAFE=$(echo "${BRANCH_NAME}" | sed 's/[\/\-]/_/g' | sed 's/[^a-zA-Z0-9_]//g')
|
|
434
|
-
|
|
435
|
-
# Generer le nom de DB selon le type
|
|
436
|
-
case "$TYPE" in
|
|
437
|
-
feature)
|
|
438
|
-
DB_NAME="${PROJECT_NAME}_feat_${BRANCH_SAFE}"
|
|
439
|
-
;;
|
|
440
|
-
hotfix)
|
|
441
|
-
DB_NAME="${PROJECT_NAME}_fix_${BRANCH_SAFE}"
|
|
442
|
-
;;
|
|
443
|
-
release)
|
|
444
|
-
VERSION_SAFE=$(echo "${VERSION}" | sed 's/\./_/g')
|
|
445
|
-
DB_NAME="${PROJECT_NAME}_rel_${VERSION_SAFE}"
|
|
446
|
-
;;
|
|
447
|
-
*)
|
|
448
|
-
DB_NAME="${PROJECT_NAME}_Dev"
|
|
449
|
-
;;
|
|
450
|
-
esac
|
|
451
|
-
|
|
452
|
-
# Limiter a 128 caracteres (limite SQL Server)
|
|
453
|
-
DB_NAME=$(echo "$DB_NAME" | cut -c1-128)
|
|
454
|
-
|
|
455
|
-
echo "Database name: $DB_NAME"
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
### 6.5.3: Lire la configuration depuis gitflow/config.json
|
|
459
|
-
|
|
460
|
-
```bash
|
|
461
|
-
# Lire les parametres de connexion depuis la section "database" du config GitFlow
|
|
462
|
-
CONFIG_FILE=".claude/gitflow/config.json"
|
|
463
|
-
|
|
464
|
-
if [ -f "$CONFIG_FILE" ]; then
|
|
465
|
-
# Verifier si la creation automatique est activee
|
|
466
|
-
DB_ENABLED=$(grep -oP '"database"[^}]*"enabled":\s*\K(true|false)' "$CONFIG_FILE" 2>/dev/null || echo "true")
|
|
467
|
-
|
|
468
|
-
if [ "$DB_ENABLED" = "false" ]; then
|
|
469
|
-
echo " [SKIP] Database auto-config desactive dans config.json"
|
|
470
|
-
# Sortir de l'etape 6.5 sans creer appsettings.Local.json
|
|
471
|
-
SKIP_DB_CONFIG=true
|
|
472
|
-
fi
|
|
473
|
-
|
|
474
|
-
# Extraire les valeurs de la section "database"
|
|
475
|
-
DB_SERVER=$(grep -oP '"database"[^}]*"server":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "localhost")
|
|
476
|
-
DB_AUTH=$(grep -oP '"database"[^}]*"authType":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "windows")
|
|
477
|
-
DB_USER=$(grep -oP '"database"[^}]*"username":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
478
|
-
DB_PASS=$(grep -oP '"database"[^}]*"password":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
479
|
-
DB_PREFIX=$(grep -oP '"database"[^}]*"namePrefix":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
480
|
-
|
|
481
|
-
# Utiliser le prefix configure si present
|
|
482
|
-
if [ -n "$DB_PREFIX" ]; then
|
|
483
|
-
PROJECT_NAME="$DB_PREFIX"
|
|
484
|
-
fi
|
|
485
|
-
else
|
|
486
|
-
# Valeurs par defaut si pas de config
|
|
487
|
-
DB_SERVER="localhost"
|
|
488
|
-
DB_AUTH="windows"
|
|
489
|
-
DB_ENABLED="true"
|
|
490
|
-
fi
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
### 6.5.4: Creer appsettings.Local.json pour CHAQUE projet
|
|
494
|
-
|
|
495
|
-
```bash
|
|
496
|
-
for APPSETTINGS in $APPSETTINGS_FILES; do
|
|
497
|
-
DIR=$(dirname "$APPSETTINGS")
|
|
498
|
-
LOCAL_FILE="${DIR}/appsettings.Local.json"
|
|
499
|
-
|
|
500
|
-
# Ne pas ecraser si existe deja
|
|
501
|
-
if [ -f "$LOCAL_FILE" ]; then
|
|
502
|
-
echo " [SKIP] $LOCAL_FILE existe deja"
|
|
503
|
-
continue
|
|
504
|
-
fi
|
|
505
|
-
|
|
506
|
-
# Copier le fichier original comme base
|
|
507
|
-
cp "$APPSETTINGS" "$LOCAL_FILE"
|
|
508
|
-
|
|
509
|
-
# Construire la connection string
|
|
510
|
-
if [ "$DB_AUTH" = "windows" ]; then
|
|
511
|
-
CONNECTION_STRING="Server=${DB_SERVER};Database=${DB_NAME};Trusted_Connection=true;TrustServerCertificate=true;MultipleActiveResultSets=true"
|
|
512
|
-
else
|
|
513
|
-
CONNECTION_STRING="Server=${DB_SERVER};Database=${DB_NAME};User Id=${DB_USER};Password=${DB_PASS};TrustServerCertificate=true;MultipleActiveResultSets=true"
|
|
514
|
-
fi
|
|
515
|
-
|
|
516
|
-
# Mettre a jour la connection string dans le fichier JSON
|
|
517
|
-
# Utiliser sed pour remplacer la valeur existante
|
|
518
|
-
sed -i 's|"DefaultConnection":\s*"[^"]*"|"DefaultConnection": "'"$CONNECTION_STRING"'"|g' "$LOCAL_FILE"
|
|
519
|
-
|
|
520
|
-
# Si pas de ConnectionStrings, ajouter le bloc
|
|
521
|
-
if ! grep -q '"ConnectionStrings"' "$LOCAL_FILE"; then
|
|
522
|
-
# Ajouter apres la premiere accolade ouvrante
|
|
523
|
-
sed -i '1a\ "ConnectionStrings": {\n "DefaultConnection": "'"$CONNECTION_STRING"'"\n },' "$LOCAL_FILE"
|
|
524
|
-
fi
|
|
525
|
-
|
|
526
|
-
echo " [OK] $LOCAL_FILE cree avec DB: $DB_NAME"
|
|
527
|
-
done
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
### 6.5.5: Assurer .gitignore
|
|
531
|
-
|
|
532
|
-
```bash
|
|
533
|
-
# S'assurer que appsettings.Local.json est ignore
|
|
534
|
-
GITIGNORE=$(find . -name ".gitignore" -not -path "*/bin/*" | head -1)
|
|
535
|
-
|
|
536
|
-
if [ -n "$GITIGNORE" ]; then
|
|
537
|
-
if ! grep -q "appsettings.Local.json" "$GITIGNORE" 2>/dev/null; then
|
|
538
|
-
echo "" >> "$GITIGNORE"
|
|
539
|
-
echo "# Local settings per worktree (ne pas committer)" >> "$GITIGNORE"
|
|
540
|
-
echo "appsettings.Local.json" >> "$GITIGNORE"
|
|
541
|
-
echo "appsettings.*.Local.json" >> "$GITIGNORE"
|
|
542
|
-
echo " [OK] .gitignore mis a jour"
|
|
543
|
-
fi
|
|
544
|
-
fi
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
### 6.5.6: Afficher resume
|
|
548
|
-
|
|
549
|
-
```
|
|
550
|
-
================================================================================
|
|
551
|
-
CONFIGURATION LOCALE AUTOMATIQUE
|
|
552
|
-
================================================================================
|
|
553
|
-
|
|
554
|
-
WORKTREE: {WORKTREE_PATH}
|
|
555
|
-
BRANCHE: {BRANCH_NAME}
|
|
556
|
-
TYPE: {feature|hotfix|release}
|
|
557
|
-
|
|
558
|
-
BASE DE DONNEES:
|
|
559
|
-
Server: {DB_SERVER}
|
|
560
|
-
Database: {DB_NAME}
|
|
561
|
-
Auth: {Windows|SQL}
|
|
562
|
-
|
|
563
|
-
FICHIERS CREES:
|
|
564
|
-
✓ src/SmartStack.Api/appsettings.Local.json
|
|
565
|
-
{autres fichiers si plusieurs projets}
|
|
566
|
-
|
|
567
|
-
ISOLATION GARANTIE:
|
|
568
|
-
✓ Cette branche utilise sa propre DB
|
|
569
|
-
✓ Pas de conflit avec develop ou autres features
|
|
570
|
-
✓ Fichier ignore par git (credentials securises)
|
|
571
|
-
|
|
572
|
-
================================================================================
|
|
573
|
-
PROCHAINE ETAPE:
|
|
574
|
-
/efcore:db-deploy → Creer et deployer la base de donnees
|
|
575
|
-
================================================================================
|
|
576
|
-
```
|
|
577
|
-
|
|
578
|
-
### 6.5.7: Configuration GitFlow pour DB (optionnel)
|
|
579
|
-
|
|
580
|
-
**Pour pre-configurer les parametres de connexion, ajouter dans `.claude/gitflow/config.json`:**
|
|
581
|
-
|
|
582
|
-
```json
|
|
583
|
-
{
|
|
584
|
-
"database": {
|
|
585
|
-
"server": "localhost",
|
|
586
|
-
"authType": "windows",
|
|
587
|
-
"username": "",
|
|
588
|
-
"password": "",
|
|
589
|
-
"namePrefix": "SmartStack"
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
| Parametre | Description | Defaut |
|
|
595
|
-
|-----------|-------------|--------|
|
|
596
|
-
| `server` | Serveur SQL Server | `localhost` |
|
|
597
|
-
| `authType` | `windows` ou `sql` | `windows` |
|
|
598
|
-
| `username` | User SQL (si sql auth) | - |
|
|
599
|
-
| `password` | Password SQL (si sql auth) | - |
|
|
600
|
-
| `namePrefix` | Prefixe des noms de DB | Nom du projet |
|
|
601
|
-
|
|
602
|
-
---
|
|
603
|
-
|
|
604
|
-
## ETAPE 7: Actions post-creation
|
|
605
|
-
|
|
606
|
-
**Release uniquement** - Bump version :
|
|
607
|
-
```bash
|
|
608
|
-
npm version {version} --no-git-tag-version
|
|
609
|
-
git add package.json package-lock.json
|
|
610
|
-
git commit -m "chore: bump version to {version}"
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
**Push branche:**
|
|
614
|
-
```bash
|
|
615
|
-
git push -u origin {branch}
|
|
616
|
-
```
|
|
617
|
-
|
|
618
|
-
---
|
|
619
|
-
|
|
620
|
-
## ETAPE 8: Resume et prochaines etapes
|
|
621
|
-
|
|
622
|
-
```
|
|
623
|
-
================================================================================
|
|
624
|
-
BRANCHE CREEE
|
|
625
|
-
================================================================================
|
|
626
|
-
|
|
627
|
-
TYPE: {feature|release|hotfix}
|
|
628
|
-
BRANCHE: {branch_name}
|
|
629
|
-
BASE: {develop|main}
|
|
630
|
-
CIBLE: {develop|main+develop}
|
|
631
|
-
VERSION: {version} (si release)
|
|
632
|
-
|
|
633
|
-
WORKTREE:
|
|
634
|
-
- Organized mode: ../{type}s/{name}/ (ex: ../features/add-user/)
|
|
635
|
-
- Adjacent mode: ../worktrees/{type}s/{name}/
|
|
636
|
-
- No worktree: meme repertoire
|
|
637
|
-
|
|
638
|
-
================================================================================
|
|
639
|
-
PROCHAINES ETAPES
|
|
640
|
-
================================================================================
|
|
641
|
-
|
|
642
|
-
1. Naviguer vers le worktree:
|
|
643
|
-
- Organized: cd "../{type}s/{name}" ou code "../{type}s/{name}"
|
|
644
|
-
- Adjacent: cd "../worktrees/{type}s/{name}"
|
|
645
|
-
|
|
646
|
-
2. Faire vos modifications
|
|
647
|
-
3. /gitflow:3-commit
|
|
648
|
-
4. /gitflow:7-pull-request
|
|
649
|
-
5. /gitflow:11-finish (apres merge PR)
|
|
650
|
-
|
|
651
|
-
================================================================================
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
---
|
|
655
|
-
|
|
656
|
-
## Exemples
|
|
657
|
-
|
|
658
|
-
| Commande | Resultat |
|
|
659
|
-
|----------|----------|
|
|
660
|
-
| `/gitflow:10-start` | Mode interactif avec contexte |
|
|
661
|
-
| `/gitflow:10-start feature user-auth` | `feature/user-auth` direct |
|
|
662
|
-
| `/gitflow:10-start release` | Propose versions basees sur actuelle |
|
|
663
|
-
| `/gitflow:10-start hotfix login-fix` | `hotfix/login-fix` direct |
|
|
664
|
-
| `/gitflow:10-start feature test --no-worktree` | Sans worktree |
|
|
665
|
-
|
|
666
|
-
---
|
|
667
|
-
|
|
668
|
-
## Cas speciaux
|
|
669
|
-
|
|
670
|
-
### Develop tres en avance de main (> 10 commits)
|
|
671
|
-
|
|
672
|
-
```
|
|
673
|
-
⚠️ ATTENTION: develop a {N} commits en avance de main.
|
|
674
|
-
Une release est fortement recommandee avant de creer une nouvelle feature.
|
|
675
|
-
|
|
676
|
-
Voulez-vous:
|
|
677
|
-
1. Creer une release d'abord (Recommande)
|
|
678
|
-
2. Continuer avec la feature quand meme
|
|
679
|
-
```
|
|
680
|
-
|
|
681
|
-
### Release en cours
|
|
682
|
-
|
|
683
|
-
```
|
|
684
|
-
⚠️ Une release est deja en cours: release/v1.2.0
|
|
685
|
-
|
|
686
|
-
Voulez-vous:
|
|
687
|
-
1. Continuer sur la release existante
|
|
688
|
-
2. Creer une nouvelle release (rare)
|
|
689
|
-
```
|
|
690
|
-
|
|
691
|
-
### Hotfix urgent depuis n'importe quelle branche
|
|
692
|
-
|
|
693
|
-
```
|
|
694
|
-
Si hotfix selectionne depuis une branche != main:
|
|
695
|
-
→ Stash automatique des changements
|
|
696
|
-
→ Checkout main
|
|
697
|
-
→ Creer hotfix
|
|
698
|
-
→ Message: "Vos changements ont ete stash. Recuperez-les avec 'git stash pop' apres le hotfix."
|
|
699
|
-
```
|
|
700
|
-
|
|
701
|
-
### Main divergent (commits absents de develop)
|
|
702
|
-
|
|
703
|
-
**Situation:** main contient des commits qui ne sont pas sur develop (ex: hotfix mal merge, commit direct sur main)
|
|
704
|
-
|
|
705
|
-
**Detection:**
|
|
706
|
-
```bash
|
|
707
|
-
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
**Si utilisateur choisit "Reset main":**
|
|
711
|
-
```bash
|
|
712
|
-
# Pendant la release, au moment du finish:
|
|
713
|
-
# 1. Merge develop → release (normal)
|
|
714
|
-
# 2. Au lieu de merge release → main, faire un reset:
|
|
715
|
-
git checkout main
|
|
716
|
-
git reset --hard release/v{version}
|
|
717
|
-
git push --force-with-lease origin main
|
|
718
|
-
# 3. Puis merge release → develop (normal)
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
**Note:** This operation is logged in [.claude/gitflow/logs/](.claude/gitflow/logs/)`main-resets.json`
|
|
722
|
-
|
|
723
|
-
### Consolidation des migrations EF Core
|
|
724
|
-
|
|
725
|
-
**Situation:** Plusieurs migrations accumulees sur develop (> 3)
|
|
726
|
-
|
|
727
|
-
**Avantages de consolider:**
|
|
728
|
-
- 1 seule migration = schema propre
|
|
729
|
-
- Pas de conflits ModelSnapshot lors des merges
|
|
730
|
-
- Deploy plus rapide en production
|
|
731
|
-
|
|
732
|
-
**Processus si utilisateur choisit "Consolider":**
|
|
733
|
-
|
|
734
|
-
```bash
|
|
735
|
-
# 1. S'assurer d'etre sur la branche release
|
|
736
|
-
cd "${WORKTREE_PATH}"
|
|
737
|
-
|
|
738
|
-
# 2. Sauvegarder la liste des migrations
|
|
739
|
-
dotnet ef migrations list > migrations-backup.txt
|
|
740
|
-
|
|
741
|
-
# 3. Identifier le DbContext
|
|
742
|
-
CONTEXT=$(grep -l "DbContext" **/*.cs | head -1)
|
|
743
|
-
|
|
744
|
-
# 4. Supprimer toutes les migrations
|
|
745
|
-
rm -rf Migrations/
|
|
746
|
-
|
|
747
|
-
# 5. Creer une migration consolidee
|
|
748
|
-
dotnet ef migrations add InitialCreate_v{version} --context {DbContext}
|
|
749
|
-
|
|
750
|
-
# 6. Verifier que le build passe
|
|
751
|
-
dotnet build
|
|
752
|
-
|
|
753
|
-
# 7. Commit la consolidation
|
|
754
|
-
git add -A
|
|
755
|
-
git commit -m "db(migrations): consolidate migrations for v{version}
|
|
756
|
-
|
|
757
|
-
Merged migrations:
|
|
758
|
-
$(cat migrations-backup.txt)
|
|
759
|
-
|
|
760
|
-
Single migration: InitialCreate_v{version}"
|
|
761
|
-
|
|
762
|
-
rm migrations-backup.txt
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
**⚠️ IMPORTANT:**
|
|
766
|
-
- Ceci est uniquement pour les releases (pas features/hotfixes)
|
|
767
|
-
- La DB de production doit etre synchronisee avec les migrations AVANT la consolidation
|
|
768
|
-
- Apres consolidation, les environnements de dev doivent recreer leur DB locale
|
|
1
|
+
---
|
|
2
|
+
description: Phase 10 - Start a new feature, release or hotfix branch with worktree
|
|
3
|
+
agent: gitflow-start
|
|
4
|
+
model: haiku
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Phase 10: START - Demarrer une branche GitFlow (Worktree)
|
|
8
|
+
|
|
9
|
+
Tu es expert GitFlow. Cree une branche dans un **worktree separe** (par defaut).
|
|
10
|
+
|
|
11
|
+
> **INSTRUCTION CLAUDE:** 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
|
+
**Argument:** `$ARGUMENTS` = `{type} {name} [--no-worktree]`
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## ETAPE 1: Analyser le contexte
|
|
18
|
+
|
|
19
|
+
**IMPORTANT:** Avant toute question, collecter ces informations :
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. Branche courante
|
|
23
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
24
|
+
|
|
25
|
+
# 2. Version actuelle (package.json, .csproj, VERSION, etc.)
|
|
26
|
+
VERSION=$(cat package.json 2>/dev/null | grep '"version"' | head -1 | sed 's/.*: "\(.*\)".*/\1/')
|
|
27
|
+
# Ou pour .NET: grep -oP '(?<=<Version>).*(?=</Version>)' *.csproj
|
|
28
|
+
|
|
29
|
+
# 3. Etat working directory
|
|
30
|
+
STATUS=$(git status --porcelain)
|
|
31
|
+
|
|
32
|
+
# 4. Commits develop vs main
|
|
33
|
+
DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
|
|
34
|
+
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
35
|
+
|
|
36
|
+
# 5. Dernier tag
|
|
37
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
|
38
|
+
|
|
39
|
+
# 6. Branches existantes
|
|
40
|
+
EXISTING_FEATURES=$(git branch -r | grep 'feature/' | wc -l)
|
|
41
|
+
EXISTING_RELEASES=$(git branch -r | grep 'release/' | wc -l)
|
|
42
|
+
EXISTING_HOTFIXES=$(git branch -r | grep 'hotfix/' | wc -l)
|
|
43
|
+
|
|
44
|
+
# 7. Compter les migrations sur develop (pour releases)
|
|
45
|
+
MIGRATIONS_ON_DEVELOP=$(find . -path "*/Migrations/*.cs" -not -name "*Designer*" -not -name "*ModelSnapshot*" 2>/dev/null | wc -l)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## ETAPE 2: Afficher le contexte
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
================================================================================
|
|
54
|
+
GITFLOW START - CONTEXTE
|
|
55
|
+
================================================================================
|
|
56
|
+
|
|
57
|
+
REPOSITORY
|
|
58
|
+
Branche: {CURRENT_BRANCH} | Version: {VERSION} | Tag: {LAST_TAG}
|
|
59
|
+
Working dir: {clean|dirty avec N fichiers}
|
|
60
|
+
|
|
61
|
+
SYNCHRONISATION
|
|
62
|
+
develop → main: {DEVELOP_AHEAD} commits en avance
|
|
63
|
+
main → develop: {MAIN_AHEAD} commits en avance
|
|
64
|
+
{Si DEVELOP_AHEAD > 0: "Une release est recommandee"}
|
|
65
|
+
{Si MAIN_AHEAD > 0: "⚠️ ATTENTION: main contient des commits absents de develop!"}
|
|
66
|
+
|
|
67
|
+
BRANCHES ACTIVES
|
|
68
|
+
Features: {N} | Releases: {N} | Hotfixes: {N}
|
|
69
|
+
|
|
70
|
+
EF CORE (si projet .NET)
|
|
71
|
+
Migrations sur develop: {MIGRATIONS_ON_DEVELOP}
|
|
72
|
+
|
|
73
|
+
================================================================================
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## ETAPE 3: Questions dynamiques selon contexte
|
|
79
|
+
|
|
80
|
+
### Si `$ARGUMENTS` fourni → Parser et executer directement
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
$ARGUMENTS = "feature add-user-auth"
|
|
84
|
+
→ TYPE = "feature", NAME = "add-user-auth"
|
|
85
|
+
→ Sauter les questions, executer directement
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Si PAS d'arguments → Questionnaire dynamique
|
|
89
|
+
|
|
90
|
+
**Construire les options selon le contexte:**
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
// Logique de construction des options
|
|
94
|
+
options = []
|
|
95
|
+
|
|
96
|
+
// Feature: toujours disponible depuis develop
|
|
97
|
+
if (CURRENT_BRANCH === 'develop' || canSwitchTo('develop')) {
|
|
98
|
+
options.push({
|
|
99
|
+
label: "feature",
|
|
100
|
+
description: "Nouvelle fonctionnalite (depuis develop)"
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Release: proposer SI develop a des commits ahead de main
|
|
105
|
+
if (DEVELOP_AHEAD > 0) {
|
|
106
|
+
// Calculer les versions possibles
|
|
107
|
+
const [major, minor, patch] = VERSION.split('.').map(Number)
|
|
108
|
+
options.push({
|
|
109
|
+
label: `release v${major}.${minor + 1}.0`,
|
|
110
|
+
description: `Release minor - ${DEVELOP_AHEAD} commits a publier (Recommande)`
|
|
111
|
+
})
|
|
112
|
+
options.push({
|
|
113
|
+
label: `release v${major + 1}.0.0`,
|
|
114
|
+
description: "Release major - Changements breaking"
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Hotfix: toujours disponible, mais mettre en avant si sur main ou si urgent
|
|
119
|
+
if (CURRENT_BRANCH === 'main') {
|
|
120
|
+
options.unshift({
|
|
121
|
+
label: "hotfix",
|
|
122
|
+
description: "Correction urgente (depuis main) - PRIORITAIRE"
|
|
123
|
+
})
|
|
124
|
+
} else {
|
|
125
|
+
options.push({
|
|
126
|
+
label: "hotfix",
|
|
127
|
+
description: "Correction urgente (depuis main)"
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**AskUserQuestion avec options dynamiques:**
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
AskUserQuestion({
|
|
136
|
+
questions: [{
|
|
137
|
+
question: "Quel type de branche voulez-vous creer ?",
|
|
138
|
+
header: "Type",
|
|
139
|
+
options: options, // Options construites dynamiquement
|
|
140
|
+
multiSelect: false
|
|
141
|
+
}]
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## ETAPE 4: Question de suivi selon le type
|
|
148
|
+
|
|
149
|
+
### Si FEATURE selectionne:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
AskUserQuestion({
|
|
153
|
+
questions: [{
|
|
154
|
+
question: "Decrivez la feature (utilisé pour le nom de branche)",
|
|
155
|
+
header: "Feature",
|
|
156
|
+
options: [
|
|
157
|
+
{ label: "add-", description: "Ajouter une nouvelle fonctionnalite" },
|
|
158
|
+
{ label: "update-", description: "Ameliorer une fonctionnalite existante" },
|
|
159
|
+
{ label: "refactor-", description: "Refactoring de code" }
|
|
160
|
+
],
|
|
161
|
+
multiSelect: false
|
|
162
|
+
}]
|
|
163
|
+
})
|
|
164
|
+
// Puis demander le nom complet en texte libre
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Si RELEASE selectionne:
|
|
168
|
+
|
|
169
|
+
**Etape A: Verifier l'etat de main**
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
// Si main contient des commits absents de develop (main corrompu/divergent)
|
|
173
|
+
if (MAIN_AHEAD > 0) {
|
|
174
|
+
AskUserQuestion({
|
|
175
|
+
questions: [{
|
|
176
|
+
question: `⚠️ ATTENTION: main contient ${MAIN_AHEAD} commits absents de develop. Comment proceder ?`,
|
|
177
|
+
header: "Main",
|
|
178
|
+
options: [
|
|
179
|
+
{ label: "Reset main", description: "Cette release remettra main en sync avec develop (Recommande)" },
|
|
180
|
+
{ label: "Analyser d'abord", description: "Voir les commits divergents avant de decider" },
|
|
181
|
+
{ label: "Continuer normalement", description: "Ignorer la divergence (non recommande)" }
|
|
182
|
+
],
|
|
183
|
+
multiSelect: false
|
|
184
|
+
}]
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Si "Analyser d'abord" → Afficher les commits divergents:
|
|
189
|
+
// git log origin/develop..origin/main --oneline
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Etape B: Gestion des migrations EF Core**
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
// Si projet .NET avec plusieurs migrations
|
|
196
|
+
if (MIGRATIONS_ON_DEVELOP > 3) {
|
|
197
|
+
AskUserQuestion({
|
|
198
|
+
questions: [{
|
|
199
|
+
question: `Il y a ${MIGRATIONS_ON_DEVELOP} migrations sur develop. Voulez-vous les consolider ?`,
|
|
200
|
+
header: "Migrations",
|
|
201
|
+
options: [
|
|
202
|
+
{ label: "Consolider", description: "Squash en 1 migration propre (Recommande pour releases)" },
|
|
203
|
+
{ label: "Garder separees", description: "Conserver l'historique des migrations" }
|
|
204
|
+
],
|
|
205
|
+
multiSelect: false
|
|
206
|
+
}]
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Si "Consolider" → Executer le processus de squash:
|
|
211
|
+
// 1. Backup de la branche actuelle
|
|
212
|
+
// 2. dotnet ef migrations list → sauvegarder la liste
|
|
213
|
+
// 3. dotnet ef database drop (si DB locale de dev)
|
|
214
|
+
// 4. Supprimer tous les fichiers Migrations/
|
|
215
|
+
// 5. dotnet ef migrations add InitialCreate_v{version}
|
|
216
|
+
// 6. Commit avec message descriptif
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Etape C: Confirmer la version**
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
const [major, minor, patch] = VERSION.split('.').map(Number)
|
|
223
|
+
|
|
224
|
+
AskUserQuestion({
|
|
225
|
+
questions: [{
|
|
226
|
+
question: "Confirmer la version de release",
|
|
227
|
+
header: "Version",
|
|
228
|
+
options: [
|
|
229
|
+
{ label: `${major}.${minor + 1}.0`, description: "Minor - Nouvelles fonctionnalites (Recommande)" },
|
|
230
|
+
{ label: `${major}.${minor}.${patch + 1}`, description: "Patch - Corrections uniquement" },
|
|
231
|
+
{ label: `${major + 1}.0.0`, description: "Major - Changements breaking" }
|
|
232
|
+
],
|
|
233
|
+
multiSelect: false
|
|
234
|
+
}]
|
|
235
|
+
})
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Si HOTFIX selectionne:
|
|
239
|
+
|
|
240
|
+
**⚠️ NOTE VERSIONING:** La version sera automatiquement incrementee (PATCH) lors du `/gitflow:11-finish`.
|
|
241
|
+
Exemple: `1.7.1` → `1.7.2`. Pas besoin de faire `npm version patch` manuellement.
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
AskUserQuestion({
|
|
245
|
+
questions: [{
|
|
246
|
+
question: "Decrivez le hotfix (utilisé pour le nom de branche)",
|
|
247
|
+
header: "Hotfix",
|
|
248
|
+
options: [
|
|
249
|
+
{ label: "fix-", description: "Correction de bug" },
|
|
250
|
+
{ label: "security-", description: "Correction de securite" },
|
|
251
|
+
{ label: "revert-", description: "Annuler un changement" }
|
|
252
|
+
],
|
|
253
|
+
multiSelect: false
|
|
254
|
+
}]
|
|
255
|
+
})
|
|
256
|
+
// Puis demander le nom complet en texte libre
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## ETAPE 5: Verifications pre-creation
|
|
262
|
+
|
|
263
|
+
| Check | Commande | Action si echec |
|
|
264
|
+
|-------|----------|-----------------|
|
|
265
|
+
| Working tree clean | `git status --porcelain` | Proposer stash ou commit |
|
|
266
|
+
| Branche n'existe pas | `git branch --list {branch}` | Erreur avec suggestion |
|
|
267
|
+
| Base a jour | `git fetch origin` | Fetch automatique |
|
|
268
|
+
|
|
269
|
+
**Si working directory dirty:**
|
|
270
|
+
|
|
271
|
+
```javascript
|
|
272
|
+
AskUserQuestion({
|
|
273
|
+
questions: [{
|
|
274
|
+
question: "Working directory non propre. Que faire ?",
|
|
275
|
+
header: "Action",
|
|
276
|
+
options: [
|
|
277
|
+
{ label: "Stash", description: "git stash - Sauvegarder temporairement" },
|
|
278
|
+
{ label: "Commit", description: "Lancer /gitflow:3-commit d'abord" },
|
|
279
|
+
{ label: "Continuer", description: "Ignorer (non recommande)" }
|
|
280
|
+
],
|
|
281
|
+
multiSelect: false
|
|
282
|
+
}]
|
|
283
|
+
})
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## ETAPE 6: Creer la branche
|
|
289
|
+
|
|
290
|
+
### Detecter le mode worktree
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Lire la config GitFlow
|
|
294
|
+
CONFIG_FILE=".claude/gitflow/config.json"
|
|
295
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
296
|
+
WORKTREE_MODE=$(grep -o '"mode": *"[^"]*"' "$CONFIG_FILE" | head -1 | cut -d'"' -f4)
|
|
297
|
+
# Default to adjacent if not specified
|
|
298
|
+
WORKTREE_MODE=${WORKTREE_MODE:-adjacent}
|
|
299
|
+
else
|
|
300
|
+
WORKTREE_MODE="adjacent"
|
|
301
|
+
fi
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Mode Worktree - Organized (v1.3)
|
|
305
|
+
|
|
306
|
+
**Si `worktrees.mode` = "organized"** (structure 01-Main, 02-Develop, etc.)
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Paths relatifs au projet parent (on est dans 02-Develop)
|
|
310
|
+
PROJECT_ROOT=".."
|
|
311
|
+
|
|
312
|
+
git fetch origin
|
|
313
|
+
|
|
314
|
+
# Feature (depuis develop)
|
|
315
|
+
WORKTREE_PATH="${PROJECT_ROOT}/features/{name}"
|
|
316
|
+
mkdir -p "${PROJECT_ROOT}/features"
|
|
317
|
+
git worktree add -b feature/{name} "$WORKTREE_PATH" origin/develop
|
|
318
|
+
|
|
319
|
+
# Release (depuis develop)
|
|
320
|
+
WORKTREE_PATH="${PROJECT_ROOT}/releases/v{version}"
|
|
321
|
+
mkdir -p "${PROJECT_ROOT}/releases"
|
|
322
|
+
git worktree add -b release/v{version} "$WORKTREE_PATH" origin/develop
|
|
323
|
+
|
|
324
|
+
# Hotfix (depuis main)
|
|
325
|
+
WORKTREE_PATH="${PROJECT_ROOT}/hotfixes/{name}"
|
|
326
|
+
mkdir -p "${PROJECT_ROOT}/hotfixes"
|
|
327
|
+
git worktree add -b hotfix/{name} "$WORKTREE_PATH" origin/main
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Structure resultante (Organized):**
|
|
331
|
+
```
|
|
332
|
+
{project}/
|
|
333
|
+
├── 01-Main/
|
|
334
|
+
├── 02-Develop/ ← Current
|
|
335
|
+
├── features/
|
|
336
|
+
│ └── {name}/ ← NEW
|
|
337
|
+
├── releases/
|
|
338
|
+
└── hotfixes/
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
### Mode Worktree - Adjacent (Legacy v1.2)
|
|
342
|
+
|
|
343
|
+
**Si `worktrees.mode` = "adjacent"** (structure ../worktrees/)
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
WORKTREE_BASE="../worktrees"
|
|
347
|
+
|
|
348
|
+
# Creer le repertoire parent et le sous-repertoire du type
|
|
349
|
+
mkdir -p "${WORKTREE_BASE}/features"
|
|
350
|
+
mkdir -p "${WORKTREE_BASE}/releases"
|
|
351
|
+
mkdir -p "${WORKTREE_BASE}/hotfixes"
|
|
352
|
+
|
|
353
|
+
git fetch origin
|
|
354
|
+
|
|
355
|
+
# Feature (depuis develop)
|
|
356
|
+
WORKTREE_PATH="${WORKTREE_BASE}/features/{name}"
|
|
357
|
+
git worktree add -b feature/{name} "$WORKTREE_PATH" origin/develop
|
|
358
|
+
|
|
359
|
+
# Release (depuis develop)
|
|
360
|
+
WORKTREE_PATH="${WORKTREE_BASE}/releases/v{version}"
|
|
361
|
+
git worktree add -b release/v{version} "$WORKTREE_PATH" origin/develop
|
|
362
|
+
|
|
363
|
+
# Hotfix (depuis main)
|
|
364
|
+
WORKTREE_PATH="${WORKTREE_BASE}/hotfixes/{name}"
|
|
365
|
+
git worktree add -b hotfix/{name} "$WORKTREE_PATH" origin/main
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Structure resultante (Adjacent):**
|
|
369
|
+
```
|
|
370
|
+
parent/
|
|
371
|
+
├── repo/ ← Current
|
|
372
|
+
└── worktrees/
|
|
373
|
+
└── features/
|
|
374
|
+
└── {name}/ ← NEW
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Mode --no-worktree
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Feature
|
|
381
|
+
git checkout develop && git pull origin develop
|
|
382
|
+
git checkout -b feature/{name}
|
|
383
|
+
|
|
384
|
+
# Release
|
|
385
|
+
git checkout develop && git pull origin develop
|
|
386
|
+
git checkout -b release/v{version}
|
|
387
|
+
|
|
388
|
+
# Hotfix
|
|
389
|
+
git checkout main && git pull origin main
|
|
390
|
+
git checkout -b hotfix/{name}
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## ETAPE 6.5: Configuration AUTOMATIQUE appsettings.Local.json (Projets .NET)
|
|
396
|
+
|
|
397
|
+
> **AUTOMATIQUE:** Cette etape s'execute sans intervention utilisateur pour garantir
|
|
398
|
+
> l'isolation des bases de donnees entre worktrees.
|
|
399
|
+
|
|
400
|
+
### 6.5.1: Detecter les projets .NET
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
cd "${WORKTREE_PATH}"
|
|
404
|
+
|
|
405
|
+
# Chercher tous les fichiers appsettings.json (peut y en avoir plusieurs)
|
|
406
|
+
APPSETTINGS_FILES=$(find . -name "appsettings.json" -not -path "*/bin/*" -not -path "*/obj/*" 2>/dev/null)
|
|
407
|
+
|
|
408
|
+
if [ -z "$APPSETTINGS_FILES" ]; then
|
|
409
|
+
echo "Pas de projet .NET detecte (aucun appsettings.json)"
|
|
410
|
+
# Continuer sans configuration
|
|
411
|
+
fi
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### 6.5.2: Generer le nom de base de donnees UNIQUE
|
|
415
|
+
|
|
416
|
+
**Convention de nommage:**
|
|
417
|
+
|
|
418
|
+
| Type de branche | Pattern DB | Exemple |
|
|
419
|
+
|-----------------|------------|---------|
|
|
420
|
+
| develop | `{ProjectName}_Dev` | `SmartStack_Dev` |
|
|
421
|
+
| feature/* | `{ProjectName}_feat_{name}` | `SmartStack_feat_add_user_auth` |
|
|
422
|
+
| hotfix/* | `{ProjectName}_fix_{name}` | `SmartStack_fix_login_bug` |
|
|
423
|
+
| release/* | `{ProjectName}_rel_{version}` | `SmartStack_rel_1_3_0` |
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
# Extraire le nom de projet depuis le .csproj ou le dossier
|
|
427
|
+
PROJECT_NAME=$(basename "$(find . -name "*.Api.csproj" -o -name "*.Web.csproj" | head -1)" .csproj 2>/dev/null)
|
|
428
|
+
if [ -z "$PROJECT_NAME" ]; then
|
|
429
|
+
PROJECT_NAME=$(basename "$(pwd)" | sed 's/[^a-zA-Z0-9]/_/g')
|
|
430
|
+
fi
|
|
431
|
+
|
|
432
|
+
# Normaliser le nom de branche pour SQL Server (pas de caracteres speciaux)
|
|
433
|
+
BRANCH_SAFE=$(echo "${BRANCH_NAME}" | sed 's/[\/\-]/_/g' | sed 's/[^a-zA-Z0-9_]//g')
|
|
434
|
+
|
|
435
|
+
# Generer le nom de DB selon le type
|
|
436
|
+
case "$TYPE" in
|
|
437
|
+
feature)
|
|
438
|
+
DB_NAME="${PROJECT_NAME}_feat_${BRANCH_SAFE}"
|
|
439
|
+
;;
|
|
440
|
+
hotfix)
|
|
441
|
+
DB_NAME="${PROJECT_NAME}_fix_${BRANCH_SAFE}"
|
|
442
|
+
;;
|
|
443
|
+
release)
|
|
444
|
+
VERSION_SAFE=$(echo "${VERSION}" | sed 's/\./_/g')
|
|
445
|
+
DB_NAME="${PROJECT_NAME}_rel_${VERSION_SAFE}"
|
|
446
|
+
;;
|
|
447
|
+
*)
|
|
448
|
+
DB_NAME="${PROJECT_NAME}_Dev"
|
|
449
|
+
;;
|
|
450
|
+
esac
|
|
451
|
+
|
|
452
|
+
# Limiter a 128 caracteres (limite SQL Server)
|
|
453
|
+
DB_NAME=$(echo "$DB_NAME" | cut -c1-128)
|
|
454
|
+
|
|
455
|
+
echo "Database name: $DB_NAME"
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### 6.5.3: Lire la configuration depuis gitflow/config.json
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
# Lire les parametres de connexion depuis la section "database" du config GitFlow
|
|
462
|
+
CONFIG_FILE=".claude/gitflow/config.json"
|
|
463
|
+
|
|
464
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
465
|
+
# Verifier si la creation automatique est activee
|
|
466
|
+
DB_ENABLED=$(grep -oP '"database"[^}]*"enabled":\s*\K(true|false)' "$CONFIG_FILE" 2>/dev/null || echo "true")
|
|
467
|
+
|
|
468
|
+
if [ "$DB_ENABLED" = "false" ]; then
|
|
469
|
+
echo " [SKIP] Database auto-config desactive dans config.json"
|
|
470
|
+
# Sortir de l'etape 6.5 sans creer appsettings.Local.json
|
|
471
|
+
SKIP_DB_CONFIG=true
|
|
472
|
+
fi
|
|
473
|
+
|
|
474
|
+
# Extraire les valeurs de la section "database"
|
|
475
|
+
DB_SERVER=$(grep -oP '"database"[^}]*"server":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "localhost")
|
|
476
|
+
DB_AUTH=$(grep -oP '"database"[^}]*"authType":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "windows")
|
|
477
|
+
DB_USER=$(grep -oP '"database"[^}]*"username":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
478
|
+
DB_PASS=$(grep -oP '"database"[^}]*"password":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
479
|
+
DB_PREFIX=$(grep -oP '"database"[^}]*"namePrefix":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
480
|
+
|
|
481
|
+
# Utiliser le prefix configure si present
|
|
482
|
+
if [ -n "$DB_PREFIX" ]; then
|
|
483
|
+
PROJECT_NAME="$DB_PREFIX"
|
|
484
|
+
fi
|
|
485
|
+
else
|
|
486
|
+
# Valeurs par defaut si pas de config
|
|
487
|
+
DB_SERVER="localhost"
|
|
488
|
+
DB_AUTH="windows"
|
|
489
|
+
DB_ENABLED="true"
|
|
490
|
+
fi
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### 6.5.4: Creer appsettings.Local.json pour CHAQUE projet
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
for APPSETTINGS in $APPSETTINGS_FILES; do
|
|
497
|
+
DIR=$(dirname "$APPSETTINGS")
|
|
498
|
+
LOCAL_FILE="${DIR}/appsettings.Local.json"
|
|
499
|
+
|
|
500
|
+
# Ne pas ecraser si existe deja
|
|
501
|
+
if [ -f "$LOCAL_FILE" ]; then
|
|
502
|
+
echo " [SKIP] $LOCAL_FILE existe deja"
|
|
503
|
+
continue
|
|
504
|
+
fi
|
|
505
|
+
|
|
506
|
+
# Copier le fichier original comme base
|
|
507
|
+
cp "$APPSETTINGS" "$LOCAL_FILE"
|
|
508
|
+
|
|
509
|
+
# Construire la connection string
|
|
510
|
+
if [ "$DB_AUTH" = "windows" ]; then
|
|
511
|
+
CONNECTION_STRING="Server=${DB_SERVER};Database=${DB_NAME};Trusted_Connection=true;TrustServerCertificate=true;MultipleActiveResultSets=true"
|
|
512
|
+
else
|
|
513
|
+
CONNECTION_STRING="Server=${DB_SERVER};Database=${DB_NAME};User Id=${DB_USER};Password=${DB_PASS};TrustServerCertificate=true;MultipleActiveResultSets=true"
|
|
514
|
+
fi
|
|
515
|
+
|
|
516
|
+
# Mettre a jour la connection string dans le fichier JSON
|
|
517
|
+
# Utiliser sed pour remplacer la valeur existante
|
|
518
|
+
sed -i 's|"DefaultConnection":\s*"[^"]*"|"DefaultConnection": "'"$CONNECTION_STRING"'"|g' "$LOCAL_FILE"
|
|
519
|
+
|
|
520
|
+
# Si pas de ConnectionStrings, ajouter le bloc
|
|
521
|
+
if ! grep -q '"ConnectionStrings"' "$LOCAL_FILE"; then
|
|
522
|
+
# Ajouter apres la premiere accolade ouvrante
|
|
523
|
+
sed -i '1a\ "ConnectionStrings": {\n "DefaultConnection": "'"$CONNECTION_STRING"'"\n },' "$LOCAL_FILE"
|
|
524
|
+
fi
|
|
525
|
+
|
|
526
|
+
echo " [OK] $LOCAL_FILE cree avec DB: $DB_NAME"
|
|
527
|
+
done
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### 6.5.5: Assurer .gitignore
|
|
531
|
+
|
|
532
|
+
```bash
|
|
533
|
+
# S'assurer que appsettings.Local.json est ignore
|
|
534
|
+
GITIGNORE=$(find . -name ".gitignore" -not -path "*/bin/*" | head -1)
|
|
535
|
+
|
|
536
|
+
if [ -n "$GITIGNORE" ]; then
|
|
537
|
+
if ! grep -q "appsettings.Local.json" "$GITIGNORE" 2>/dev/null; then
|
|
538
|
+
echo "" >> "$GITIGNORE"
|
|
539
|
+
echo "# Local settings per worktree (ne pas committer)" >> "$GITIGNORE"
|
|
540
|
+
echo "appsettings.Local.json" >> "$GITIGNORE"
|
|
541
|
+
echo "appsettings.*.Local.json" >> "$GITIGNORE"
|
|
542
|
+
echo " [OK] .gitignore mis a jour"
|
|
543
|
+
fi
|
|
544
|
+
fi
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### 6.5.6: Afficher resume
|
|
548
|
+
|
|
549
|
+
```
|
|
550
|
+
================================================================================
|
|
551
|
+
CONFIGURATION LOCALE AUTOMATIQUE
|
|
552
|
+
================================================================================
|
|
553
|
+
|
|
554
|
+
WORKTREE: {WORKTREE_PATH}
|
|
555
|
+
BRANCHE: {BRANCH_NAME}
|
|
556
|
+
TYPE: {feature|hotfix|release}
|
|
557
|
+
|
|
558
|
+
BASE DE DONNEES:
|
|
559
|
+
Server: {DB_SERVER}
|
|
560
|
+
Database: {DB_NAME}
|
|
561
|
+
Auth: {Windows|SQL}
|
|
562
|
+
|
|
563
|
+
FICHIERS CREES:
|
|
564
|
+
✓ src/SmartStack.Api/appsettings.Local.json
|
|
565
|
+
{autres fichiers si plusieurs projets}
|
|
566
|
+
|
|
567
|
+
ISOLATION GARANTIE:
|
|
568
|
+
✓ Cette branche utilise sa propre DB
|
|
569
|
+
✓ Pas de conflit avec develop ou autres features
|
|
570
|
+
✓ Fichier ignore par git (credentials securises)
|
|
571
|
+
|
|
572
|
+
================================================================================
|
|
573
|
+
PROCHAINE ETAPE:
|
|
574
|
+
/efcore:db-deploy → Creer et deployer la base de donnees
|
|
575
|
+
================================================================================
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### 6.5.7: Configuration GitFlow pour DB (optionnel)
|
|
579
|
+
|
|
580
|
+
**Pour pre-configurer les parametres de connexion, ajouter dans `.claude/gitflow/config.json`:**
|
|
581
|
+
|
|
582
|
+
```json
|
|
583
|
+
{
|
|
584
|
+
"database": {
|
|
585
|
+
"server": "localhost",
|
|
586
|
+
"authType": "windows",
|
|
587
|
+
"username": "",
|
|
588
|
+
"password": "",
|
|
589
|
+
"namePrefix": "SmartStack"
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
| Parametre | Description | Defaut |
|
|
595
|
+
|-----------|-------------|--------|
|
|
596
|
+
| `server` | Serveur SQL Server | `localhost` |
|
|
597
|
+
| `authType` | `windows` ou `sql` | `windows` |
|
|
598
|
+
| `username` | User SQL (si sql auth) | - |
|
|
599
|
+
| `password` | Password SQL (si sql auth) | - |
|
|
600
|
+
| `namePrefix` | Prefixe des noms de DB | Nom du projet |
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
## ETAPE 7: Actions post-creation
|
|
605
|
+
|
|
606
|
+
**Release uniquement** - Bump version :
|
|
607
|
+
```bash
|
|
608
|
+
npm version {version} --no-git-tag-version
|
|
609
|
+
git add package.json package-lock.json
|
|
610
|
+
git commit -m "chore: bump version to {version}"
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
**Push branche:**
|
|
614
|
+
```bash
|
|
615
|
+
git push -u origin {branch}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## ETAPE 8: Resume et prochaines etapes
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
================================================================================
|
|
624
|
+
BRANCHE CREEE
|
|
625
|
+
================================================================================
|
|
626
|
+
|
|
627
|
+
TYPE: {feature|release|hotfix}
|
|
628
|
+
BRANCHE: {branch_name}
|
|
629
|
+
BASE: {develop|main}
|
|
630
|
+
CIBLE: {develop|main+develop}
|
|
631
|
+
VERSION: {version} (si release)
|
|
632
|
+
|
|
633
|
+
WORKTREE:
|
|
634
|
+
- Organized mode: ../{type}s/{name}/ (ex: ../features/add-user/)
|
|
635
|
+
- Adjacent mode: ../worktrees/{type}s/{name}/
|
|
636
|
+
- No worktree: meme repertoire
|
|
637
|
+
|
|
638
|
+
================================================================================
|
|
639
|
+
PROCHAINES ETAPES
|
|
640
|
+
================================================================================
|
|
641
|
+
|
|
642
|
+
1. Naviguer vers le worktree:
|
|
643
|
+
- Organized: cd "../{type}s/{name}" ou code "../{type}s/{name}"
|
|
644
|
+
- Adjacent: cd "../worktrees/{type}s/{name}"
|
|
645
|
+
|
|
646
|
+
2. Faire vos modifications
|
|
647
|
+
3. /gitflow:3-commit
|
|
648
|
+
4. /gitflow:7-pull-request
|
|
649
|
+
5. /gitflow:11-finish (apres merge PR)
|
|
650
|
+
|
|
651
|
+
================================================================================
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
## Exemples
|
|
657
|
+
|
|
658
|
+
| Commande | Resultat |
|
|
659
|
+
|----------|----------|
|
|
660
|
+
| `/gitflow:10-start` | Mode interactif avec contexte |
|
|
661
|
+
| `/gitflow:10-start feature user-auth` | `feature/user-auth` direct |
|
|
662
|
+
| `/gitflow:10-start release` | Propose versions basees sur actuelle |
|
|
663
|
+
| `/gitflow:10-start hotfix login-fix` | `hotfix/login-fix` direct |
|
|
664
|
+
| `/gitflow:10-start feature test --no-worktree` | Sans worktree |
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
## Cas speciaux
|
|
669
|
+
|
|
670
|
+
### Develop tres en avance de main (> 10 commits)
|
|
671
|
+
|
|
672
|
+
```
|
|
673
|
+
⚠️ ATTENTION: develop a {N} commits en avance de main.
|
|
674
|
+
Une release est fortement recommandee avant de creer une nouvelle feature.
|
|
675
|
+
|
|
676
|
+
Voulez-vous:
|
|
677
|
+
1. Creer une release d'abord (Recommande)
|
|
678
|
+
2. Continuer avec la feature quand meme
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
### Release en cours
|
|
682
|
+
|
|
683
|
+
```
|
|
684
|
+
⚠️ Une release est deja en cours: release/v1.2.0
|
|
685
|
+
|
|
686
|
+
Voulez-vous:
|
|
687
|
+
1. Continuer sur la release existante
|
|
688
|
+
2. Creer une nouvelle release (rare)
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
### Hotfix urgent depuis n'importe quelle branche
|
|
692
|
+
|
|
693
|
+
```
|
|
694
|
+
Si hotfix selectionne depuis une branche != main:
|
|
695
|
+
→ Stash automatique des changements
|
|
696
|
+
→ Checkout main
|
|
697
|
+
→ Creer hotfix
|
|
698
|
+
→ Message: "Vos changements ont ete stash. Recuperez-les avec 'git stash pop' apres le hotfix."
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
### Main divergent (commits absents de develop)
|
|
702
|
+
|
|
703
|
+
**Situation:** main contient des commits qui ne sont pas sur develop (ex: hotfix mal merge, commit direct sur main)
|
|
704
|
+
|
|
705
|
+
**Detection:**
|
|
706
|
+
```bash
|
|
707
|
+
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
**Si utilisateur choisit "Reset main":**
|
|
711
|
+
```bash
|
|
712
|
+
# Pendant la release, au moment du finish:
|
|
713
|
+
# 1. Merge develop → release (normal)
|
|
714
|
+
# 2. Au lieu de merge release → main, faire un reset:
|
|
715
|
+
git checkout main
|
|
716
|
+
git reset --hard release/v{version}
|
|
717
|
+
git push --force-with-lease origin main
|
|
718
|
+
# 3. Puis merge release → develop (normal)
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
**Note:** This operation is logged in [.claude/gitflow/logs/](.claude/gitflow/logs/)`main-resets.json`
|
|
722
|
+
|
|
723
|
+
### Consolidation des migrations EF Core
|
|
724
|
+
|
|
725
|
+
**Situation:** Plusieurs migrations accumulees sur develop (> 3)
|
|
726
|
+
|
|
727
|
+
**Avantages de consolider:**
|
|
728
|
+
- 1 seule migration = schema propre
|
|
729
|
+
- Pas de conflits ModelSnapshot lors des merges
|
|
730
|
+
- Deploy plus rapide en production
|
|
731
|
+
|
|
732
|
+
**Processus si utilisateur choisit "Consolider":**
|
|
733
|
+
|
|
734
|
+
```bash
|
|
735
|
+
# 1. S'assurer d'etre sur la branche release
|
|
736
|
+
cd "${WORKTREE_PATH}"
|
|
737
|
+
|
|
738
|
+
# 2. Sauvegarder la liste des migrations
|
|
739
|
+
dotnet ef migrations list > migrations-backup.txt
|
|
740
|
+
|
|
741
|
+
# 3. Identifier le DbContext
|
|
742
|
+
CONTEXT=$(grep -l "DbContext" **/*.cs | head -1)
|
|
743
|
+
|
|
744
|
+
# 4. Supprimer toutes les migrations
|
|
745
|
+
rm -rf Migrations/
|
|
746
|
+
|
|
747
|
+
# 5. Creer une migration consolidee
|
|
748
|
+
dotnet ef migrations add InitialCreate_v{version} --context {DbContext}
|
|
749
|
+
|
|
750
|
+
# 6. Verifier que le build passe
|
|
751
|
+
dotnet build
|
|
752
|
+
|
|
753
|
+
# 7. Commit la consolidation
|
|
754
|
+
git add -A
|
|
755
|
+
git commit -m "db(migrations): consolidate migrations for v{version}
|
|
756
|
+
|
|
757
|
+
Merged migrations:
|
|
758
|
+
$(cat migrations-backup.txt)
|
|
759
|
+
|
|
760
|
+
Single migration: InitialCreate_v{version}"
|
|
761
|
+
|
|
762
|
+
rm migrations-backup.txt
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
**⚠️ IMPORTANT:**
|
|
766
|
+
- Ceci est uniquement pour les releases (pas features/hotfixes)
|
|
767
|
+
- La DB de production doit etre synchronisee avec les migrations AVANT la consolidation
|
|
768
|
+
- Apres consolidation, les environnements de dev doivent recreer leur DB locale
|