@atlashub/smartstack-cli 1.11.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.documentation/agents.html +7 -2
- package/.documentation/apex.html +7 -2
- package/.documentation/business-analyse.html +7 -2
- package/.documentation/cli-commands.html +871 -0
- package/.documentation/commands.html +7 -2
- package/.documentation/efcore.html +7 -2
- package/.documentation/gitflow.html +7 -2
- package/.documentation/hooks.html +7 -2
- package/.documentation/index.html +7 -2
- package/.documentation/init.html +7 -2
- package/.documentation/installation.html +7 -2
- package/.documentation/ralph-loop.html +7 -2
- package/.documentation/test-web.html +7 -2
- package/dist/index.js +1932 -336
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/templates/agents/efcore/squash.md +67 -31
- package/templates/agents/gitflow/finish.md +68 -56
- package/templates/commands/business-analyse/0-orchestrate.md +72 -556
- package/templates/commands/business-analyse/1-init.md +23 -193
- package/templates/commands/business-analyse/2-discover.md +85 -462
- package/templates/commands/business-analyse/3-analyse.md +40 -342
- package/templates/commands/business-analyse/4-specify.md +72 -537
- package/templates/commands/business-analyse/5-validate.md +43 -237
- package/templates/commands/business-analyse/6-handoff.md +93 -682
- package/templates/commands/business-analyse/7-doc-html.md +45 -544
- package/templates/commands/business-analyse/_shared.md +176 -0
- package/templates/commands/business-analyse/bug.md +50 -257
- package/templates/commands/business-analyse/change-request.md +59 -283
- package/templates/commands/business-analyse/hotfix.md +36 -120
- package/templates/commands/business-analyse.md +55 -574
- package/templates/commands/efcore/_shared.md +206 -0
- package/templates/commands/efcore/conflicts.md +39 -201
- package/templates/commands/efcore/db-deploy.md +28 -237
- package/templates/commands/efcore/db-reset.md +41 -390
- package/templates/commands/efcore/db-seed.md +44 -323
- package/templates/commands/efcore/db-status.md +31 -210
- package/templates/commands/efcore/migration.md +45 -368
- package/templates/commands/efcore/rebase-snapshot.md +38 -241
- package/templates/commands/efcore/scan.md +35 -204
- package/templates/commands/efcore/squash.md +158 -251
- package/templates/commands/efcore.md +49 -177
- package/templates/commands/gitflow/1-init.md +94 -1318
- package/templates/commands/gitflow/10-start.md +86 -990
- package/templates/commands/gitflow/11-finish.md +264 -454
- package/templates/commands/gitflow/12-cleanup.md +40 -213
- package/templates/commands/gitflow/2-status.md +51 -386
- package/templates/commands/gitflow/3-commit.md +108 -801
- package/templates/commands/gitflow/4-plan.md +42 -13
- package/templates/commands/gitflow/5-exec.md +60 -5
- package/templates/commands/gitflow/6-abort.md +54 -277
- package/templates/commands/gitflow/7-pull-request.md +74 -717
- package/templates/commands/gitflow/8-review.md +51 -178
- package/templates/commands/gitflow/9-merge.md +74 -404
- package/templates/commands/gitflow/_shared.md +196 -0
- package/templates/commands/quickstart.md +154 -0
- package/templates/commands/ralph-loop/ralph-loop.md +104 -2
- package/templates/hooks/hooks.json +13 -0
- package/templates/hooks/ralph-mcp-logger.sh +46 -0
- package/templates/hooks/ralph-session-end.sh +69 -0
- package/templates/ralph/README.md +91 -0
- package/templates/ralph/ralph.config.yaml +113 -0
- package/templates/scripts/setup-ralph-loop.sh +173 -0
- package/templates/skills/_shared.md +117 -0
- package/templates/skills/ai-prompt/SKILL.md +87 -654
- package/templates/skills/application/SKILL.md +76 -499
- package/templates/skills/controller/SKILL.md +38 -165
- package/templates/skills/documentation/SKILL.md +2 -1
- package/templates/skills/feature-full/SKILL.md +107 -732
- package/templates/skills/notification/SKILL.md +85 -474
- package/templates/skills/ui-components/SKILL.md +62 -762
- package/templates/skills/workflow/SKILL.md +85 -489
- package/templates/commands/gitflow/rescue.md +0 -867
- package/templates/skills/business-analyse/SKILL.md +0 -191
|
@@ -4,1091 +4,187 @@ agent: gitflow-start
|
|
|
4
4
|
model: haiku
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Phase 10: START -
|
|
7
|
+
# Phase 10: START - Démarrer une branche GitFlow
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
**Argument:** `$ARGUMENTS` = `{type} {name} [--no-worktree]`
|
|
10
10
|
|
|
11
|
-
> **
|
|
11
|
+
> **Ref:** Fonctions `normalize_branch_name()`, `detect_worktree_mode()`, `read_gitflow_config()` dans [_shared.md](_shared.md)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Flux d'Exécution
|
|
14
16
|
|
|
15
|
-
**FLUX D'EXECUTION:**
|
|
16
17
|
```
|
|
17
|
-
AVEC
|
|
18
|
-
SANS
|
|
19
|
-
↑
|
|
20
|
-
TOUJOURS OBLIGATOIRE
|
|
18
|
+
AVEC args: Analyser → Vérifications → Créer branche → Config DB → Résumé
|
|
19
|
+
SANS args: Analyser → Question Type → Question Nom → Vérifications → Créer → Config DB → Résumé
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
---
|
|
24
23
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
**IMPORTANT:** Avant toute question, collecter ces informations :
|
|
24
|
+
## Étape 1: Analyser le contexte
|
|
28
25
|
|
|
29
26
|
```bash
|
|
30
|
-
# 1. Branche courante
|
|
31
27
|
CURRENT_BRANCH=$(git branch --show-current)
|
|
32
|
-
|
|
33
|
-
# 2. Version actuelle (package.json, .csproj, VERSION, etc.)
|
|
34
|
-
VERSION=$(cat package.json 2>/dev/null | grep '"version"' | head -1 | sed 's/.*: "\(.*\)".*/\1/')
|
|
35
|
-
# Ou pour .NET: grep -oP '(?<=<Version>).*(?=</Version>)' *.csproj
|
|
36
|
-
|
|
37
|
-
# 3. Etat working directory
|
|
28
|
+
VERSION=$(grep -oP '"version":\s*"\K[^"]+' package.json 2>/dev/null || echo "0.1.0")
|
|
38
29
|
STATUS=$(git status --porcelain)
|
|
39
|
-
|
|
40
|
-
# 4. Commits develop vs main
|
|
41
30
|
DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
|
|
42
|
-
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
43
|
-
|
|
44
|
-
# 5. Dernier tag
|
|
45
31
|
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
|
46
|
-
|
|
47
|
-
# 6. Branches existantes
|
|
48
|
-
EXISTING_FEATURES=$(git branch -r | grep 'feature/' | wc -l)
|
|
49
|
-
EXISTING_RELEASES=$(git branch -r | grep 'release/' | wc -l)
|
|
50
|
-
EXISTING_HOTFIXES=$(git branch -r | grep 'hotfix/' | wc -l)
|
|
51
|
-
|
|
52
|
-
# 7. Compter les migrations sur develop (pour releases)
|
|
53
|
-
MIGRATIONS_ON_DEVELOP=$(find . -path "*/Migrations/*.cs" -not -name "*Designer*" -not -name "*ModelSnapshot*" 2>/dev/null | wc -l)
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## ETAPE 2: Afficher le contexte
|
|
59
|
-
|
|
60
32
|
```
|
|
61
|
-
================================================================================
|
|
62
|
-
GITFLOW START - CONTEXTE
|
|
63
|
-
================================================================================
|
|
64
33
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
SYNCHRONISATION
|
|
70
|
-
develop → main: {DEVELOP_AHEAD} commits en avance
|
|
71
|
-
main → develop: {MAIN_AHEAD} commits en avance
|
|
72
|
-
{Si DEVELOP_AHEAD > 0: "Une release est recommandee"}
|
|
73
|
-
{Si MAIN_AHEAD > 0: "⚠️ ATTENTION: main contient des commits absents de develop!"}
|
|
74
|
-
|
|
75
|
-
BRANCHES ACTIVES
|
|
76
|
-
Features: {N} | Releases: {N} | Hotfixes: {N}
|
|
77
|
-
|
|
78
|
-
EF CORE (si projet .NET)
|
|
79
|
-
Migrations sur develop: {MIGRATIONS_ON_DEVELOP}
|
|
80
|
-
|
|
81
|
-
================================================================================
|
|
82
|
-
```
|
|
34
|
+
**Afficher:**
|
|
35
|
+
- Branche: `{CURRENT_BRANCH}` | Version: `{VERSION}` | Tag: `{LAST_TAG}`
|
|
36
|
+
- develop → main: `{DEVELOP_AHEAD}` commits (si >0: "Release recommandée")
|
|
83
37
|
|
|
84
38
|
---
|
|
85
39
|
|
|
86
|
-
##
|
|
87
|
-
|
|
88
|
-
### Si `$ARGUMENTS` fourni → Parser et aller aux verifications
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
$ARGUMENTS = "feature add-user-auth"
|
|
92
|
-
→ TYPE = "feature", NAME = "add-user-auth"
|
|
93
|
-
→ Sauter les questions (ETAPES 3-4), aller directement a ETAPE 5 (verifications)
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**IMPORTANT:** Meme avec des arguments, tu DOIS executer l'ETAPE 5 (verifications) avant de creer la branche.
|
|
97
|
-
|
|
98
|
-
### Si PAS d'arguments → Questionnaire dynamique
|
|
99
|
-
|
|
100
|
-
**Construire les options selon le contexte:**
|
|
40
|
+
## Étape 2: Questions (si pas d'arguments)
|
|
101
41
|
|
|
102
|
-
|
|
103
|
-
// Logique de construction des options
|
|
104
|
-
options = []
|
|
42
|
+
### Type de branche
|
|
105
43
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
description: "Nouvelle fonctionnalite (depuis develop)"
|
|
111
|
-
})
|
|
112
|
-
}
|
|
44
|
+
Options dynamiques selon contexte:
|
|
45
|
+
- `feature`: Depuis develop (toujours dispo)
|
|
46
|
+
- `release v{X.Y+1.0}`: Si DEVELOP_AHEAD > 0 (recommandé)
|
|
47
|
+
- `hotfix`: Depuis main
|
|
113
48
|
|
|
114
|
-
|
|
115
|
-
if (DEVELOP_AHEAD > 0) {
|
|
116
|
-
// Calculer les versions possibles
|
|
117
|
-
const [major, minor, patch] = VERSION.split('.').map(Number)
|
|
118
|
-
options.push({
|
|
119
|
-
label: `release v${major}.${minor + 1}.0`,
|
|
120
|
-
description: `Release minor - ${DEVELOP_AHEAD} commits a publier (Recommande)`
|
|
121
|
-
})
|
|
122
|
-
options.push({
|
|
123
|
-
label: `release v${major + 1}.0.0`,
|
|
124
|
-
description: "Release major - Changements breaking"
|
|
125
|
-
})
|
|
126
|
-
}
|
|
49
|
+
### Nom de branche
|
|
127
50
|
|
|
128
|
-
|
|
129
|
-
if (CURRENT_BRANCH === 'main') {
|
|
130
|
-
options.unshift({
|
|
131
|
-
label: "hotfix",
|
|
132
|
-
description: "Correction urgente (depuis main) - PRIORITAIRE"
|
|
133
|
-
})
|
|
134
|
-
} else {
|
|
135
|
-
options.push({
|
|
136
|
-
label: "hotfix",
|
|
137
|
-
description: "Correction urgente (depuis main)"
|
|
138
|
-
})
|
|
139
|
-
}
|
|
140
|
-
```
|
|
51
|
+
Selon langue configurée (`config.language.code`):
|
|
141
52
|
|
|
142
|
-
|
|
53
|
+
| Langue | Options suggérées |
|
|
54
|
+
|--------|-------------------|
|
|
55
|
+
| `en` | add-, update-, fix-, refactor-, improve- |
|
|
56
|
+
| `fr` | ajouter-, modifier-, corriger-, refactorer-, ameliorer- |
|
|
143
57
|
|
|
144
|
-
|
|
145
|
-
AskUserQuestion({
|
|
146
|
-
questions: [{
|
|
147
|
-
question: "Quel type de branche voulez-vous creer ?",
|
|
148
|
-
header: "Type",
|
|
149
|
-
options: options, // Options construites dynamiquement
|
|
150
|
-
multiSelect: false
|
|
151
|
-
}]
|
|
152
|
-
})
|
|
153
|
-
```
|
|
58
|
+
**Normalisation automatique:** Utiliser `normalize_branch_name()` de [_shared.md](_shared.md)
|
|
154
59
|
|
|
155
60
|
---
|
|
156
61
|
|
|
157
|
-
##
|
|
158
|
-
|
|
159
|
-
### Si FEATURE selectionne:
|
|
160
|
-
|
|
161
|
-
**Lire la configuration de langue:**
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
# ═══════════════════════════════════════════════════════════════
|
|
165
|
-
# CONFIGURATION DE LANGUE
|
|
166
|
-
# ═══════════════════════════════════════════════════════════════
|
|
167
|
-
CONFIG_FILE=".claude/gitflow/config.json"
|
|
168
|
-
LANG_CODE="en"
|
|
169
|
-
if [ -f "$CONFIG_FILE" ]; then
|
|
170
|
-
LANG_CODE=$(grep -oP '"code":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null | head -1)
|
|
171
|
-
LANG_CODE=${LANG_CODE:-en}
|
|
172
|
-
fi
|
|
173
|
-
echo "Langue configuree: $LANG_CODE"
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Demander la description selon la langue configuree:**
|
|
177
|
-
|
|
178
|
-
> **NOTE:** Le prefix `feature/` reste TOUJOURS en anglais.
|
|
179
|
-
> Seule la partie descriptive (apres `feature/`) utilise la langue configuree.
|
|
180
|
-
|
|
181
|
-
```javascript
|
|
182
|
-
// Lire la config de langue
|
|
183
|
-
const langConfig = readConfig()?.language || { code: "en" }
|
|
184
|
-
const isEnglish = langConfig.code === "en"
|
|
185
|
-
|
|
186
|
-
// Suggestions de verbes d'action selon la langue
|
|
187
|
-
// Le prefix de branche "feature/" ne change PAS
|
|
188
|
-
const featureOptions = isEnglish ? [
|
|
189
|
-
{ label: "add-", description: "Add a new feature → feature/add-..." },
|
|
190
|
-
{ label: "update-", description: "Update existing → feature/update-..." },
|
|
191
|
-
{ label: "fix-", description: "Fix a bug → feature/fix-..." },
|
|
192
|
-
{ label: "refactor-", description: "Refactor code → feature/refactor-..." },
|
|
193
|
-
{ label: "improve-", description: "Improve perf/UX → feature/improve-..." }
|
|
194
|
-
] : [
|
|
195
|
-
{ label: "ajouter-", description: "Nouvelle fonctionnalite → feature/ajouter-..." },
|
|
196
|
-
{ label: "modifier-", description: "Modifier existant → feature/modifier-..." },
|
|
197
|
-
{ label: "corriger-", description: "Corriger un bug → feature/corriger-..." },
|
|
198
|
-
{ label: "refactorer-", description: "Refactorer du code → feature/refactorer-..." },
|
|
199
|
-
{ label: "ameliorer-", description: "Ameliorer perf/UX → feature/ameliorer-..." }
|
|
200
|
-
]
|
|
201
|
-
|
|
202
|
-
AskUserQuestion({
|
|
203
|
-
questions: [{
|
|
204
|
-
question: isEnglish
|
|
205
|
-
? "Describe the feature (branch will be feature/your-description)"
|
|
206
|
-
: "Decrivez la feature (branche sera feature/votre-description)",
|
|
207
|
-
header: "Feature",
|
|
208
|
-
options: featureOptions,
|
|
209
|
-
multiSelect: false
|
|
210
|
-
}]
|
|
211
|
-
})
|
|
212
|
-
// L'utilisateur complete via "Other" pour le nom complet
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
**Normaliser le nom saisi:**
|
|
62
|
+
## Étape 3: Vérifications (OBLIGATOIRE même avec args)
|
|
216
63
|
|
|
217
64
|
```bash
|
|
218
|
-
|
|
219
|
-
# FONCTION DE NORMALISATION DES NOMS DE BRANCHES
|
|
220
|
-
# ═══════════════════════════════════════════════════════════════
|
|
221
|
-
normalize_branch_name() {
|
|
222
|
-
local input="$1"
|
|
223
|
-
local max_length="${2:-50}"
|
|
224
|
-
|
|
225
|
-
# 1. Convertir en minuscules
|
|
226
|
-
local result=$(echo "$input" | tr '[:upper:]' '[:lower:]')
|
|
227
|
-
|
|
228
|
-
# 2. Supprimer les accents (francais et autres)
|
|
229
|
-
result=$(echo "$result" | sed 'y/àâäéèêëïîôùûüçœæÀÂÄÉÈÊËÏÎÔÙÛÜÇŒÆ/aaaeeeeiioouucoaAAaEeeeIIOOuucoa/')
|
|
230
|
-
|
|
231
|
-
# 3. Remplacer espaces, underscores, apostrophes par des tirets
|
|
232
|
-
result=$(echo "$result" | sed "s/[ _']/-/g")
|
|
233
|
-
|
|
234
|
-
# 4. Supprimer les caracteres non autorises
|
|
235
|
-
result=$(echo "$result" | sed 's/[^a-z0-9-]//g')
|
|
236
|
-
|
|
237
|
-
# 5. Supprimer les tirets multiples
|
|
238
|
-
result=$(echo "$result" | sed 's/--*/-/g')
|
|
239
|
-
|
|
240
|
-
# 6. Supprimer les tirets en debut/fin
|
|
241
|
-
result=$(echo "$result" | sed 's/^-//;s/-$//')
|
|
242
|
-
|
|
243
|
-
# 7. Tronquer a la longueur max
|
|
244
|
-
result=$(echo "$result" | cut -c1-$max_length)
|
|
245
|
-
|
|
246
|
-
# 8. Supprimer le tiret final apres troncature
|
|
247
|
-
result=$(echo "$result" | sed 's/-$//')
|
|
248
|
-
|
|
249
|
-
echo "$result"
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
# Normaliser le nom fourni par l'utilisateur
|
|
253
|
-
RAW_NAME="$USER_INPUT"
|
|
254
|
-
FEATURE_NAME=$(normalize_branch_name "$RAW_NAME" 50)
|
|
255
|
-
|
|
256
|
-
# Afficher si normalisation appliquee
|
|
257
|
-
if [ "$RAW_NAME" != "$FEATURE_NAME" ]; then
|
|
258
|
-
echo ""
|
|
259
|
-
echo "┌──────────────────────────────────────────────────────────────────────────────┐"
|
|
260
|
-
echo "│ ℹ️ NOM NORMALISE │"
|
|
261
|
-
echo "├──────────────────────────────────────────────────────────────────────────────┤"
|
|
262
|
-
echo "│ Saisi: $RAW_NAME"
|
|
263
|
-
echo "│ Normalise: $FEATURE_NAME"
|
|
264
|
-
echo "├──────────────────────────────────────────────────────────────────────────────┤"
|
|
265
|
-
echo "│ Raisons possibles: │"
|
|
266
|
-
echo "│ - Accents supprimes (e→e, a→a) │"
|
|
267
|
-
echo "│ - Espaces remplaces par tirets │"
|
|
268
|
-
echo "│ - Caracteres speciaux supprimes │"
|
|
269
|
-
echo "│ - Majuscules converties en minuscules │"
|
|
270
|
-
echo "└──────────────────────────────────────────────────────────────────────────────┘"
|
|
271
|
-
fi
|
|
272
|
-
|
|
273
|
-
BRANCH_NAME="feature/$FEATURE_NAME"
|
|
274
|
-
echo "Branche: $BRANCH_NAME"
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
**Exemples de normalisation:**
|
|
278
|
-
|
|
279
|
-
| Entree utilisateur | Resultat normalise |
|
|
280
|
-
|--------------------|-------------------|
|
|
281
|
-
| "Ajouter l'authentification" | `ajouter-lauthentification` |
|
|
282
|
-
| "Add User Auth !!" | `add-user-auth` |
|
|
283
|
-
| "Améliorer_Performance_API" | `ameliorer-performance-api` |
|
|
284
|
-
| "fix: Bug dans le login" | `fix-bug-dans-le-login` |
|
|
285
|
-
| "FEATURE majuscules" | `feature-majuscules` |
|
|
286
|
-
|
|
287
|
-
### Si RELEASE selectionne:
|
|
288
|
-
|
|
289
|
-
**Etape A: Verifier l'etat de main**
|
|
290
|
-
|
|
291
|
-
```javascript
|
|
292
|
-
// Si main contient des commits absents de develop (main corrompu/divergent)
|
|
293
|
-
if (MAIN_AHEAD > 0) {
|
|
294
|
-
AskUserQuestion({
|
|
295
|
-
questions: [{
|
|
296
|
-
question: `⚠️ ATTENTION: main contient ${MAIN_AHEAD} commits absents de develop. Comment proceder ?`,
|
|
297
|
-
header: "Main",
|
|
298
|
-
options: [
|
|
299
|
-
{ label: "Reset main", description: "Cette release remettra main en sync avec develop (Recommande)" },
|
|
300
|
-
{ label: "Analyser d'abord", description: "Voir les commits divergents avant de decider" },
|
|
301
|
-
{ label: "Continuer normalement", description: "Ignorer la divergence (non recommande)" }
|
|
302
|
-
],
|
|
303
|
-
multiSelect: false
|
|
304
|
-
}]
|
|
305
|
-
})
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Si "Analyser d'abord" → Afficher les commits divergents:
|
|
309
|
-
// git log origin/develop..origin/main --oneline
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
**Etape B: Gestion des migrations EF Core**
|
|
313
|
-
|
|
314
|
-
```javascript
|
|
315
|
-
// Si projet .NET avec plusieurs migrations
|
|
316
|
-
if (MIGRATIONS_ON_DEVELOP > 3) {
|
|
317
|
-
AskUserQuestion({
|
|
318
|
-
questions: [{
|
|
319
|
-
question: `Il y a ${MIGRATIONS_ON_DEVELOP} migrations sur develop. Voulez-vous les consolider ?`,
|
|
320
|
-
header: "Migrations",
|
|
321
|
-
options: [
|
|
322
|
-
{ label: "Consolider", description: "Squash en 1 migration propre (Recommande pour releases)" },
|
|
323
|
-
{ label: "Garder separees", description: "Conserver l'historique des migrations" }
|
|
324
|
-
],
|
|
325
|
-
multiSelect: false
|
|
326
|
-
}]
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// Si "Consolider" → Executer le processus de squash:
|
|
331
|
-
// 1. Backup de la branche actuelle
|
|
332
|
-
// 2. dotnet ef migrations list → sauvegarder la liste
|
|
333
|
-
// 3. dotnet ef database drop (si DB locale de dev)
|
|
334
|
-
// 4. Supprimer tous les fichiers Migrations/
|
|
335
|
-
// 5. dotnet ef migrations add InitialCreate_v{version}
|
|
336
|
-
// 6. Commit avec message descriptif
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
**Etape C: Confirmer la version**
|
|
340
|
-
|
|
341
|
-
```javascript
|
|
342
|
-
const [major, minor, patch] = VERSION.split('.').map(Number)
|
|
343
|
-
|
|
344
|
-
AskUserQuestion({
|
|
345
|
-
questions: [{
|
|
346
|
-
question: "Confirmer la version de release",
|
|
347
|
-
header: "Version",
|
|
348
|
-
options: [
|
|
349
|
-
{ label: `${major}.${minor + 1}.0`, description: "Minor - Nouvelles fonctionnalites (Recommande)" },
|
|
350
|
-
{ label: `${major}.${minor}.${patch + 1}`, description: "Patch - Corrections uniquement" },
|
|
351
|
-
{ label: `${major + 1}.0.0`, description: "Major - Changements breaking" }
|
|
352
|
-
],
|
|
353
|
-
multiSelect: false
|
|
354
|
-
}]
|
|
355
|
-
})
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### Si HOTFIX selectionne:
|
|
359
|
-
|
|
360
|
-
**⚠️ NOTE VERSIONING:** La version sera automatiquement incrementee (PATCH) lors du `/gitflow:11-finish`.
|
|
361
|
-
Exemple: `1.7.1` → `1.7.2`. Pas besoin de faire `npm version patch` manuellement.
|
|
362
|
-
|
|
363
|
-
**Demander la description selon la langue configuree:**
|
|
364
|
-
|
|
365
|
-
> **NOTE:** Le prefix `hotfix/` reste TOUJOURS en anglais.
|
|
366
|
-
> Seule la partie descriptive utilise la langue configuree.
|
|
367
|
-
|
|
368
|
-
```javascript
|
|
369
|
-
// Lire la config de langue
|
|
370
|
-
const langConfig = readConfig()?.language || { code: "en" }
|
|
371
|
-
const isEnglish = langConfig.code === "en"
|
|
372
|
-
|
|
373
|
-
// Suggestions selon la langue (prefix hotfix/ ne change pas)
|
|
374
|
-
const hotfixOptions = isEnglish ? [
|
|
375
|
-
{ label: "fix-", description: "Bug fix → hotfix/fix-..." },
|
|
376
|
-
{ label: "security-", description: "Security fix → hotfix/security-..." },
|
|
377
|
-
{ label: "revert-", description: "Revert a change → hotfix/revert-..." },
|
|
378
|
-
{ label: "patch-", description: "Quick patch → hotfix/patch-..." }
|
|
379
|
-
] : [
|
|
380
|
-
{ label: "corriger-", description: "Correction bug → hotfix/corriger-..." },
|
|
381
|
-
{ label: "securite-", description: "Correction securite → hotfix/securite-..." },
|
|
382
|
-
{ label: "annuler-", description: "Annuler changement → hotfix/annuler-..." },
|
|
383
|
-
{ label: "patch-", description: "Correctif rapide → hotfix/patch-..." }
|
|
384
|
-
]
|
|
385
|
-
|
|
386
|
-
AskUserQuestion({
|
|
387
|
-
questions: [{
|
|
388
|
-
question: isEnglish
|
|
389
|
-
? "Describe the hotfix (branch will be hotfix/your-description)"
|
|
390
|
-
: "Decrivez le hotfix (branche sera hotfix/votre-description)",
|
|
391
|
-
header: "Hotfix",
|
|
392
|
-
options: hotfixOptions,
|
|
393
|
-
multiSelect: false
|
|
394
|
-
}]
|
|
395
|
-
})
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
**Normaliser le nom (meme fonction que feature):**
|
|
399
|
-
|
|
400
|
-
```bash
|
|
401
|
-
# Utiliser la meme fonction normalize_branch_name definie plus haut
|
|
402
|
-
RAW_NAME="$USER_INPUT"
|
|
403
|
-
HOTFIX_NAME=$(normalize_branch_name "$RAW_NAME" 50)
|
|
404
|
-
|
|
405
|
-
if [ "$RAW_NAME" != "$HOTFIX_NAME" ]; then
|
|
406
|
-
echo "Nom normalise: '$RAW_NAME' → '$HOTFIX_NAME'"
|
|
407
|
-
fi
|
|
408
|
-
|
|
409
|
-
BRANCH_NAME="hotfix/$HOTFIX_NAME"
|
|
410
|
-
echo "Branche: $BRANCH_NAME"
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
---
|
|
414
|
-
|
|
415
|
-
## ETAPE 5: Verifications pre-creation
|
|
416
|
-
|
|
417
|
-
> **OBLIGATOIRE:** Cette etape doit TOUJOURS etre executee, meme quand des arguments sont fournis via `$ARGUMENTS`. Ne JAMAIS sauter cette etape.
|
|
418
|
-
|
|
419
|
-
| Check | Commande | Action si echec |
|
|
420
|
-
|-------|----------|-----------------|
|
|
421
|
-
| Working tree clean | `git status --porcelain` | Proposer stash ou commit |
|
|
422
|
-
| Branche n'existe pas | `git branch -a --list {branch}` | Erreur avec suggestion |
|
|
423
|
-
| Base a jour | `git fetch origin` | Fetch automatique |
|
|
424
|
-
|
|
425
|
-
### 5.1 Verifier que la branche SPECIFIQUE n'existe pas
|
|
426
|
-
|
|
427
|
-
**IMPORTANT:** Cette verification doit etre faite sur la branche EXACTE demandee, pas sur le nombre total de branches.
|
|
428
|
-
|
|
429
|
-
```bash
|
|
430
|
-
# Construire le nom complet de la branche
|
|
431
|
-
BRANCH_FULL_NAME="${TYPE}/${NAME}" # ex: feature/add-user-auth
|
|
432
|
-
|
|
433
|
-
# Fetch pour avoir les branches remote a jour
|
|
65
|
+
BRANCH_FULL_NAME="${TYPE}/${NAME}"
|
|
434
66
|
git fetch origin --quiet
|
|
435
67
|
|
|
436
|
-
#
|
|
68
|
+
# Vérifier existence
|
|
437
69
|
LOCAL_EXISTS=$(git branch --list "$BRANCH_FULL_NAME")
|
|
438
|
-
|
|
439
|
-
# Verifier si la branche existe en REMOTE
|
|
440
70
|
REMOTE_EXISTS=$(git branch -r --list "origin/$BRANCH_FULL_NAME")
|
|
441
71
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
echo ""
|
|
447
|
-
|
|
448
|
-
if [ -n "$LOCAL_EXISTS" ]; then
|
|
449
|
-
echo " - Existe en LOCAL"
|
|
450
|
-
fi
|
|
451
|
-
if [ -n "$REMOTE_EXISTS" ]; then
|
|
452
|
-
echo " - Existe en REMOTE (origin)"
|
|
453
|
-
fi
|
|
454
|
-
|
|
455
|
-
echo ""
|
|
456
|
-
echo "Options:"
|
|
457
|
-
echo " 1. Choisir un autre nom"
|
|
458
|
-
echo " 2. Supprimer la branche existante: git branch -D $BRANCH_FULL_NAME"
|
|
459
|
-
echo " 3. Continuer sur la branche existante: git checkout $BRANCH_FULL_NAME"
|
|
460
|
-
echo ""
|
|
461
|
-
|
|
462
|
-
# Proposer a l'utilisateur
|
|
463
|
-
AskUserQuestion({
|
|
464
|
-
questions: [{
|
|
465
|
-
question: "La branche '$BRANCH_FULL_NAME' existe deja. Que faire ?",
|
|
466
|
-
header: "Conflit",
|
|
467
|
-
options: [
|
|
468
|
-
{ label: "Autre nom", description: "Choisir un nom different" },
|
|
469
|
-
{ label: "Checkout", description: "Basculer sur la branche existante" },
|
|
470
|
-
{ label: "Supprimer", description: "Supprimer et recreer (ATTENTION: perte de donnees)" }
|
|
471
|
-
],
|
|
472
|
-
multiSelect: false
|
|
473
|
-
}]
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
# Actions selon choix:
|
|
477
|
-
# - "Autre nom" -> Retourner a ETAPE 4 pour redemander le nom
|
|
478
|
-
# - "Checkout" -> git checkout $BRANCH_FULL_NAME && exit
|
|
479
|
-
# - "Supprimer" -> git branch -D $BRANCH_FULL_NAME && git push origin --delete $BRANCH_FULL_NAME 2>/dev/null
|
|
480
|
-
fi
|
|
481
|
-
|
|
482
|
-
echo "OK Branche '$BRANCH_FULL_NAME' disponible"
|
|
72
|
+
[ -n "$LOCAL_EXISTS" ] || [ -n "$REMOTE_EXISTS" ] && {
|
|
73
|
+
echo "ERROR: Branche '$BRANCH_FULL_NAME' existe déjà"
|
|
74
|
+
# Options: Autre nom | Checkout existante | Supprimer
|
|
75
|
+
}
|
|
483
76
|
```
|
|
484
77
|
|
|
485
|
-
### 5.2 Verifier working directory
|
|
486
|
-
|
|
487
78
|
**Si working directory dirty:**
|
|
488
|
-
|
|
489
|
-
```javascript
|
|
490
|
-
AskUserQuestion({
|
|
491
|
-
questions: [{
|
|
492
|
-
question: "Working directory non propre. Que faire ?",
|
|
493
|
-
header: "Action",
|
|
494
|
-
options: [
|
|
495
|
-
{ label: "Stash", description: "git stash - Sauvegarder temporairement" },
|
|
496
|
-
{ label: "Commit", description: "Lancer /gitflow:3-commit d'abord" },
|
|
497
|
-
{ label: "Continuer", description: "Ignorer (non recommande)" }
|
|
498
|
-
],
|
|
499
|
-
multiSelect: false
|
|
500
|
-
}]
|
|
501
|
-
})
|
|
502
|
-
```
|
|
79
|
+
Options: `Stash` | `Commit (/gitflow:3-commit)` | `Continuer`
|
|
503
80
|
|
|
504
81
|
---
|
|
505
82
|
|
|
506
|
-
##
|
|
83
|
+
## Étape 4: Créer la branche
|
|
507
84
|
|
|
508
|
-
###
|
|
85
|
+
### Détection mode worktree
|
|
509
86
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
```bash
|
|
513
|
-
# ═══════════════════════════════════════════════════════════════
|
|
514
|
-
# ETAPE 1: Detection automatique basee sur la structure des dossiers
|
|
515
|
-
# ═══════════════════════════════════════════════════════════════
|
|
87
|
+
Utiliser `detect_worktree_mode()` de [_shared.md](_shared.md)
|
|
516
88
|
|
|
517
|
-
|
|
518
|
-
# Ces dossiers sont a la racine du projet parent (..)
|
|
519
|
-
if [ -d "../features" ] && [ -d "../releases" ] && [ -d "../hotfixes" ]; then
|
|
520
|
-
# Structure organized detectee
|
|
521
|
-
WORKTREE_MODE="organized"
|
|
522
|
-
echo "[AUTO-DETECT] Structure organized detectee (../features/, ../releases/, ../hotfixes/)"
|
|
523
|
-
elif [ -d "../01-Main" ] && [ -d "../02-Develop" ]; then
|
|
524
|
-
# Structure organized detectee via les prefixes numerotes
|
|
525
|
-
WORKTREE_MODE="organized"
|
|
526
|
-
echo "[AUTO-DETECT] Structure organized detectee (../01-Main/, ../02-Develop/)"
|
|
527
|
-
elif [ -d "../worktrees" ]; then
|
|
528
|
-
# Structure adjacent/legacy detectee
|
|
529
|
-
WORKTREE_MODE="adjacent"
|
|
530
|
-
echo "[AUTO-DETECT] Structure adjacent detectee (../worktrees/)"
|
|
531
|
-
else
|
|
532
|
-
# ═══════════════════════════════════════════════════════════════
|
|
533
|
-
# ETAPE 2: Fallback sur la config GitFlow si structure non detectee
|
|
534
|
-
# ═══════════════════════════════════════════════════════════════
|
|
535
|
-
CONFIG_FILE=".claude/gitflow/config.json"
|
|
536
|
-
if [ -f "$CONFIG_FILE" ]; then
|
|
537
|
-
WORKTREE_MODE=$(grep -o '"mode": *"[^"]*"' "$CONFIG_FILE" | head -1 | cut -d'"' -f4)
|
|
538
|
-
WORKTREE_MODE=${WORKTREE_MODE:-adjacent}
|
|
539
|
-
echo "[CONFIG] Mode lu depuis config.json: $WORKTREE_MODE"
|
|
540
|
-
else
|
|
541
|
-
# Default: adjacent si rien n'est detecte
|
|
542
|
-
WORKTREE_MODE="adjacent"
|
|
543
|
-
echo "[DEFAULT] Aucune structure detectee, mode par defaut: adjacent"
|
|
544
|
-
fi
|
|
545
|
-
fi
|
|
546
|
-
|
|
547
|
-
echo "WORKTREE_MODE=$WORKTREE_MODE"
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
### Mode Worktree - Organized (v1.3)
|
|
551
|
-
|
|
552
|
-
**Si `worktrees.mode` = "organized"** (structure 01-Main, 02-Develop, etc.)
|
|
89
|
+
### Mode Organized
|
|
553
90
|
|
|
554
91
|
```bash
|
|
555
|
-
# Paths relatifs au projet parent (on est dans 02-Develop)
|
|
556
92
|
PROJECT_ROOT=".."
|
|
557
|
-
|
|
558
|
-
git fetch origin
|
|
559
|
-
|
|
560
|
-
# Feature (depuis develop)
|
|
561
|
-
WORKTREE_PATH="${PROJECT_ROOT}/features/{name}"
|
|
562
|
-
mkdir -p "${PROJECT_ROOT}/features"
|
|
563
|
-
git worktree add -b feature/{name} "$WORKTREE_PATH" origin/develop
|
|
564
|
-
|
|
565
|
-
# Release (depuis develop)
|
|
566
|
-
WORKTREE_PATH="${PROJECT_ROOT}/releases/v{version}"
|
|
567
|
-
mkdir -p "${PROJECT_ROOT}/releases"
|
|
568
|
-
git worktree add -b release/v{version} "$WORKTREE_PATH" origin/develop
|
|
569
|
-
|
|
570
|
-
# Hotfix (depuis main)
|
|
571
|
-
WORKTREE_PATH="${PROJECT_ROOT}/hotfixes/{name}"
|
|
572
|
-
mkdir -p "${PROJECT_ROOT}/hotfixes"
|
|
573
|
-
git worktree add -b hotfix/{name} "$WORKTREE_PATH" origin/main
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
**Structure resultante (Organized):**
|
|
577
|
-
```
|
|
578
|
-
{project}/
|
|
579
|
-
├── 01-Main/
|
|
580
|
-
├── 02-Develop/ ← Current
|
|
581
|
-
├── features/
|
|
582
|
-
│ └── {name}/ ← NEW
|
|
583
|
-
├── releases/
|
|
584
|
-
└── hotfixes/
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
### Mode Worktree - Adjacent (Legacy v1.2)
|
|
588
|
-
|
|
589
|
-
**Si `worktrees.mode` = "adjacent"** (structure ../worktrees/)
|
|
590
|
-
|
|
591
|
-
```bash
|
|
592
|
-
WORKTREE_BASE="../worktrees"
|
|
593
|
-
|
|
594
|
-
# Creer le repertoire parent et le sous-repertoire du type
|
|
595
|
-
mkdir -p "${WORKTREE_BASE}/features"
|
|
596
|
-
mkdir -p "${WORKTREE_BASE}/releases"
|
|
597
|
-
mkdir -p "${WORKTREE_BASE}/hotfixes"
|
|
598
|
-
|
|
599
93
|
git fetch origin
|
|
600
94
|
|
|
601
|
-
|
|
602
|
-
WORKTREE_PATH="$
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
WORKTREE_PATH="${WORKTREE_BASE}/releases/v{version}"
|
|
607
|
-
git worktree add -b release/v{version} "$WORKTREE_PATH" origin/develop
|
|
608
|
-
|
|
609
|
-
# Hotfix (depuis main)
|
|
610
|
-
WORKTREE_PATH="${WORKTREE_BASE}/hotfixes/{name}"
|
|
611
|
-
git worktree add -b hotfix/{name} "$WORKTREE_PATH" origin/main
|
|
612
|
-
```
|
|
95
|
+
case "$TYPE" in
|
|
96
|
+
feature) WORKTREE_PATH="$PROJECT_ROOT/features/$NAME"; BASE="origin/develop" ;;
|
|
97
|
+
release) WORKTREE_PATH="$PROJECT_ROOT/releases/v$VERSION"; BASE="origin/develop" ;;
|
|
98
|
+
hotfix) WORKTREE_PATH="$PROJECT_ROOT/hotfixes/$NAME"; BASE="origin/main" ;;
|
|
99
|
+
esac
|
|
613
100
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
parent/
|
|
617
|
-
├── repo/ ← Current
|
|
618
|
-
└── worktrees/
|
|
619
|
-
└── features/
|
|
620
|
-
└── {name}/ ← NEW
|
|
101
|
+
mkdir -p "$(dirname $WORKTREE_PATH)"
|
|
102
|
+
git worktree add -b "$TYPE/$NAME" "$WORKTREE_PATH" "$BASE"
|
|
621
103
|
```
|
|
622
104
|
|
|
623
105
|
### Mode --no-worktree
|
|
624
106
|
|
|
625
107
|
```bash
|
|
626
|
-
|
|
627
|
-
git checkout
|
|
628
|
-
git checkout -b feature/{name}
|
|
629
|
-
|
|
630
|
-
# Release
|
|
631
|
-
git checkout develop && git pull origin develop
|
|
632
|
-
git checkout -b release/v{version}
|
|
633
|
-
|
|
634
|
-
# Hotfix
|
|
635
|
-
git checkout main && git pull origin main
|
|
636
|
-
git checkout -b hotfix/{name}
|
|
108
|
+
git checkout ${BASE_BRANCH} && git pull origin ${BASE_BRANCH}
|
|
109
|
+
git checkout -b ${TYPE}/${NAME}
|
|
637
110
|
```
|
|
638
111
|
|
|
639
112
|
---
|
|
640
113
|
|
|
641
|
-
##
|
|
114
|
+
## Étape 5: Config DB automatique (.NET)
|
|
642
115
|
|
|
643
|
-
|
|
644
|
-
> l'isolation des bases de donnees entre worktrees.
|
|
645
|
-
|
|
646
|
-
### 6.5.1: Detecter les projets .NET
|
|
116
|
+
Si `appsettings.json` détecté, créer `appsettings.Local.json`:
|
|
647
117
|
|
|
648
118
|
```bash
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
# Chercher tous les fichiers appsettings.json (peut y en avoir plusieurs)
|
|
652
|
-
APPSETTINGS_FILES=$(find . -name "appsettings.json" -not -path "*/bin/*" -not -path "*/obj/*" 2>/dev/null)
|
|
653
|
-
|
|
654
|
-
if [ -z "$APPSETTINGS_FILES" ]; then
|
|
655
|
-
echo "Pas de projet .NET detecte (aucun appsettings.json)"
|
|
656
|
-
# Continuer sans configuration
|
|
657
|
-
fi
|
|
119
|
+
DB_NAME="${PROJECT_NAME}_${TYPE}_${NAME}" | cut -c1-128
|
|
120
|
+
CONNECTION="Server=localhost;Database=$DB_NAME;Trusted_Connection=true;TrustServerCertificate=true"
|
|
658
121
|
```
|
|
659
122
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
**Convention de nommage:**
|
|
123
|
+
Convention: `{prefix}_feat_{name}` | `{prefix}_fix_{name}` | `{prefix}_rel_{version}`
|
|
663
124
|
|
|
664
|
-
|
|
665
|
-
|-----------------|------------|---------|
|
|
666
|
-
| develop | `{ProjectName}_Dev` | `SmartStack_Dev` |
|
|
667
|
-
| feature/* | `{ProjectName}_feat_{name}` | `SmartStack_feat_add_user_auth` |
|
|
668
|
-
| hotfix/* | `{ProjectName}_fix_{name}` | `SmartStack_fix_login_bug` |
|
|
669
|
-
| release/* | `{ProjectName}_rel_{version}` | `SmartStack_rel_1_3_0` |
|
|
670
|
-
|
|
671
|
-
```bash
|
|
672
|
-
# Extraire le nom de projet depuis le .csproj ou le dossier
|
|
673
|
-
PROJECT_NAME=$(basename "$(find . -name "*.Api.csproj" -o -name "*.Web.csproj" | head -1)" .csproj 2>/dev/null)
|
|
674
|
-
if [ -z "$PROJECT_NAME" ]; then
|
|
675
|
-
PROJECT_NAME=$(basename "$(pwd)" | sed 's/[^a-zA-Z0-9]/_/g')
|
|
676
|
-
fi
|
|
677
|
-
|
|
678
|
-
# Normaliser le nom de branche pour SQL Server (pas de caracteres speciaux)
|
|
679
|
-
BRANCH_SAFE=$(echo "${BRANCH_NAME}" | sed 's/[\/\-]/_/g' | sed 's/[^a-zA-Z0-9_]//g')
|
|
680
|
-
|
|
681
|
-
# Generer le nom de DB selon le type
|
|
682
|
-
case "$TYPE" in
|
|
683
|
-
feature)
|
|
684
|
-
DB_NAME="${PROJECT_NAME}_feat_${BRANCH_SAFE}"
|
|
685
|
-
;;
|
|
686
|
-
hotfix)
|
|
687
|
-
DB_NAME="${PROJECT_NAME}_fix_${BRANCH_SAFE}"
|
|
688
|
-
;;
|
|
689
|
-
release)
|
|
690
|
-
VERSION_SAFE=$(echo "${VERSION}" | sed 's/\./_/g')
|
|
691
|
-
DB_NAME="${PROJECT_NAME}_rel_${VERSION_SAFE}"
|
|
692
|
-
;;
|
|
693
|
-
*)
|
|
694
|
-
DB_NAME="${PROJECT_NAME}_Dev"
|
|
695
|
-
;;
|
|
696
|
-
esac
|
|
125
|
+
---
|
|
697
126
|
|
|
698
|
-
|
|
699
|
-
DB_NAME=$(echo "$DB_NAME" | cut -c1-128)
|
|
127
|
+
## Étape 6: Résumé
|
|
700
128
|
|
|
701
|
-
echo "Database name: $DB_NAME"
|
|
702
129
|
```
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
# Lire les parametres de connexion depuis la section "database" du config GitFlow
|
|
708
|
-
CONFIG_FILE=".claude/gitflow/config.json"
|
|
709
|
-
|
|
710
|
-
if [ -f "$CONFIG_FILE" ]; then
|
|
711
|
-
# Verifier si la creation automatique est activee
|
|
712
|
-
DB_ENABLED=$(grep -oP '"database"[^}]*"enabled":\s*\K(true|false)' "$CONFIG_FILE" 2>/dev/null || echo "true")
|
|
713
|
-
|
|
714
|
-
if [ "$DB_ENABLED" = "false" ]; then
|
|
715
|
-
echo " [SKIP] Database auto-config desactive dans config.json"
|
|
716
|
-
# Sortir de l'etape 6.5 sans creer appsettings.Local.json
|
|
717
|
-
SKIP_DB_CONFIG=true
|
|
718
|
-
fi
|
|
719
|
-
|
|
720
|
-
# Extraire les valeurs de la section "database"
|
|
721
|
-
DB_SERVER=$(grep -oP '"database"[^}]*"server":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "localhost")
|
|
722
|
-
DB_AUTH=$(grep -oP '"database"[^}]*"authType":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "windows")
|
|
723
|
-
DB_USER=$(grep -oP '"database"[^}]*"username":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
724
|
-
DB_PASS=$(grep -oP '"database"[^}]*"password":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
725
|
-
DB_PREFIX=$(grep -oP '"database"[^}]*"namePrefix":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "")
|
|
726
|
-
|
|
727
|
-
# Utiliser le prefix configure si present
|
|
728
|
-
if [ -n "$DB_PREFIX" ]; then
|
|
729
|
-
PROJECT_NAME="$DB_PREFIX"
|
|
730
|
-
fi
|
|
731
|
-
else
|
|
732
|
-
# Valeurs par defaut si pas de config
|
|
733
|
-
DB_SERVER="localhost"
|
|
734
|
-
DB_AUTH="windows"
|
|
735
|
-
DB_ENABLED="true"
|
|
736
|
-
fi
|
|
130
|
+
{TYPE} CRÉÉ
|
|
131
|
+
- Branche: {type}/{name}
|
|
132
|
+
- Base: {develop|main} → Cible: {develop|main+develop}
|
|
133
|
+
- Worktree: {path}
|
|
737
134
|
```
|
|
738
135
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
```bash
|
|
742
|
-
for APPSETTINGS in $APPSETTINGS_FILES; do
|
|
743
|
-
DIR=$(dirname "$APPSETTINGS")
|
|
744
|
-
LOCAL_FILE="${DIR}/appsettings.Local.json"
|
|
745
|
-
|
|
746
|
-
# Ne pas ecraser si existe deja
|
|
747
|
-
if [ -f "$LOCAL_FILE" ]; then
|
|
748
|
-
echo " [SKIP] $LOCAL_FILE existe deja"
|
|
749
|
-
continue
|
|
750
|
-
fi
|
|
751
|
-
|
|
752
|
-
# Copier le fichier original comme base
|
|
753
|
-
cp "$APPSETTINGS" "$LOCAL_FILE"
|
|
754
|
-
|
|
755
|
-
# Construire la connection string
|
|
756
|
-
if [ "$DB_AUTH" = "windows" ]; then
|
|
757
|
-
CONNECTION_STRING="Server=${DB_SERVER};Database=${DB_NAME};Trusted_Connection=true;TrustServerCertificate=true;MultipleActiveResultSets=true"
|
|
758
|
-
else
|
|
759
|
-
CONNECTION_STRING="Server=${DB_SERVER};Database=${DB_NAME};User Id=${DB_USER};Password=${DB_PASS};TrustServerCertificate=true;MultipleActiveResultSets=true"
|
|
760
|
-
fi
|
|
761
|
-
|
|
762
|
-
# Mettre a jour la connection string dans le fichier JSON
|
|
763
|
-
# Utiliser sed pour remplacer la valeur existante
|
|
764
|
-
sed -i 's|"DefaultConnection":\s*"[^"]*"|"DefaultConnection": "'"$CONNECTION_STRING"'"|g' "$LOCAL_FILE"
|
|
136
|
+
**PROCHAINES ÉTAPES**
|
|
765
137
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
fi
|
|
138
|
+
1. Aller dans le worktree
|
|
139
|
+
2. Faire vos modifications et commiter
|
|
140
|
+
3. Créer la Pull Request
|
|
141
|
+
4. Après merge de la PR, finaliser
|
|
771
142
|
|
|
772
|
-
|
|
773
|
-
done
|
|
774
|
-
```
|
|
143
|
+
**COMMANDES**
|
|
775
144
|
|
|
776
|
-
|
|
145
|
+
Aller dans le worktree:
|
|
777
146
|
|
|
778
147
|
```bash
|
|
779
|
-
|
|
780
|
-
GITIGNORE=$(find . -name ".gitignore" -not -path "*/bin/*" | head -1)
|
|
781
|
-
|
|
782
|
-
if [ -n "$GITIGNORE" ]; then
|
|
783
|
-
if ! grep -q "appsettings.Local.json" "$GITIGNORE" 2>/dev/null; then
|
|
784
|
-
echo "" >> "$GITIGNORE"
|
|
785
|
-
echo "# Local settings per worktree (ne pas committer)" >> "$GITIGNORE"
|
|
786
|
-
echo "appsettings.Local.json" >> "$GITIGNORE"
|
|
787
|
-
echo "appsettings.*.Local.json" >> "$GITIGNORE"
|
|
788
|
-
echo " [OK] .gitignore mis a jour"
|
|
789
|
-
fi
|
|
790
|
-
fi
|
|
791
|
-
```
|
|
792
|
-
|
|
793
|
-
### 6.5.6: Afficher resume
|
|
794
|
-
|
|
148
|
+
cd {worktree_path}
|
|
795
149
|
```
|
|
796
|
-
================================================================================
|
|
797
|
-
CONFIGURATION LOCALE AUTOMATIQUE
|
|
798
|
-
================================================================================
|
|
799
|
-
|
|
800
|
-
WORKTREE: {WORKTREE_PATH}
|
|
801
|
-
BRANCHE: {BRANCH_NAME}
|
|
802
|
-
TYPE: {feature|hotfix|release}
|
|
803
|
-
|
|
804
|
-
BASE DE DONNEES:
|
|
805
|
-
Server: {DB_SERVER}
|
|
806
|
-
Database: {DB_NAME}
|
|
807
|
-
Auth: {Windows|SQL}
|
|
808
|
-
|
|
809
|
-
FICHIERS CREES:
|
|
810
|
-
✓ src/SmartStack.Api/appsettings.Local.json
|
|
811
|
-
{autres fichiers si plusieurs projets}
|
|
812
150
|
|
|
813
|
-
|
|
814
|
-
✓ Cette branche utilise sa propre DB
|
|
815
|
-
✓ Pas de conflit avec develop ou autres features
|
|
816
|
-
✓ Fichier ignore par git (credentials securises)
|
|
151
|
+
Commiter:
|
|
817
152
|
|
|
818
|
-
================================================================================
|
|
819
|
-
PROCHAINE ETAPE:
|
|
820
|
-
/efcore:db-deploy → Creer et deployer la base de donnees
|
|
821
|
-
================================================================================
|
|
822
153
|
```
|
|
823
|
-
|
|
824
|
-
### 6.5.7: Configuration GitFlow pour DB (optionnel)
|
|
825
|
-
|
|
826
|
-
**Pour pre-configurer les parametres de connexion, ajouter dans `.claude/gitflow/config.json`:**
|
|
827
|
-
|
|
828
|
-
```json
|
|
829
|
-
{
|
|
830
|
-
"database": {
|
|
831
|
-
"server": "localhost",
|
|
832
|
-
"authType": "windows",
|
|
833
|
-
"username": "",
|
|
834
|
-
"password": "",
|
|
835
|
-
"namePrefix": "SmartStack"
|
|
836
|
-
}
|
|
837
|
-
}
|
|
154
|
+
/gitflow:3-commit
|
|
838
155
|
```
|
|
839
156
|
|
|
840
|
-
|
|
841
|
-
|-----------|-------------|--------|
|
|
842
|
-
| `server` | Serveur SQL Server | `localhost` |
|
|
843
|
-
| `authType` | `windows` ou `sql` | `windows` |
|
|
844
|
-
| `username` | User SQL (si sql auth) | - |
|
|
845
|
-
| `password` | Password SQL (si sql auth) | - |
|
|
846
|
-
| `namePrefix` | Prefixe des noms de DB | Nom du projet |
|
|
157
|
+
Créer la PR:
|
|
847
158
|
|
|
848
|
-
---
|
|
849
|
-
|
|
850
|
-
## ETAPE 7: Actions post-creation
|
|
851
|
-
|
|
852
|
-
**Release uniquement** - Bump version :
|
|
853
|
-
```bash
|
|
854
|
-
npm version {version} --no-git-tag-version
|
|
855
|
-
git add package.json package-lock.json
|
|
856
|
-
git commit -m "chore: bump version to {version}"
|
|
857
159
|
```
|
|
858
|
-
|
|
859
|
-
**Push branche:**
|
|
860
|
-
```bash
|
|
861
|
-
git push -u origin {branch}
|
|
160
|
+
/gitflow:7-pull-request
|
|
862
161
|
```
|
|
863
162
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
## ETAPE 8: Resume et prochaines etapes
|
|
867
|
-
|
|
868
|
-
**Afficher un resume adapte au TYPE de branche creee:**
|
|
869
|
-
|
|
870
|
-
### Si FEATURE:
|
|
163
|
+
Finaliser:
|
|
871
164
|
|
|
872
165
|
```
|
|
873
|
-
|
|
874
|
-
FEATURE CREEE
|
|
875
|
-
================================================================================
|
|
876
|
-
|
|
877
|
-
BRANCHE: feature/{name}
|
|
878
|
-
BASE: develop
|
|
879
|
-
CIBLE: develop
|
|
880
|
-
WORKTREE: ../features/{name}/
|
|
881
|
-
|
|
882
|
-
================================================================================
|
|
883
|
-
PROCHAINES ETAPES
|
|
884
|
-
================================================================================
|
|
885
|
-
|
|
886
|
-
1. Naviguer vers le worktree:
|
|
887
|
-
cd ../features/{name}
|
|
888
|
-
# ou dans VSCode:
|
|
889
|
-
code ../features/{name}
|
|
890
|
-
|
|
891
|
-
2. Faire vos modifications et committer:
|
|
892
|
-
/gitflow:3-commit
|
|
893
|
-
|
|
894
|
-
3. Creer une Pull Request (feature/{name} → develop):
|
|
895
|
-
/gitflow:7-pull-request feature/{name}
|
|
896
|
-
|
|
897
|
-
4. Apres merge de la PR, nettoyer:
|
|
898
|
-
/gitflow:11-finish feature/{name}
|
|
899
|
-
Cela va:
|
|
900
|
-
✓ Supprimer la branche feature/{name}
|
|
901
|
-
✓ Nettoyer le worktree
|
|
902
|
-
|
|
903
|
-
================================================================================
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
### Si RELEASE:
|
|
907
|
-
|
|
908
|
-
```
|
|
909
|
-
================================================================================
|
|
910
|
-
RELEASE CREEE
|
|
911
|
-
================================================================================
|
|
912
|
-
|
|
913
|
-
BRANCHE: release/v{version}
|
|
914
|
-
BASE: develop
|
|
915
|
-
CIBLE: main + develop (merge back)
|
|
916
|
-
VERSION: v{version}
|
|
917
|
-
WORKTREE: ../releases/v{version}/
|
|
918
|
-
|
|
919
|
-
================================================================================
|
|
920
|
-
PROCHAINES ETAPES
|
|
921
|
-
================================================================================
|
|
922
|
-
|
|
923
|
-
1. Naviguer vers le worktree:
|
|
924
|
-
cd ../releases/v{version}
|
|
925
|
-
# ou dans VSCode:
|
|
926
|
-
code ../releases/v{version}
|
|
927
|
-
|
|
928
|
-
2. Creer une Pull Request (release/v{version} → main):
|
|
929
|
-
/gitflow:7-pull-request release/v{version}
|
|
930
|
-
|
|
931
|
-
3. Apres merge de la PR, finaliser:
|
|
932
|
-
/gitflow:11-finish release/v{version}
|
|
933
|
-
Cela va:
|
|
934
|
-
✓ Creer le tag v{version}
|
|
935
|
-
✓ Merger main → develop (merge back)
|
|
936
|
-
✓ Incrementer la version sur develop ({version} → {next_minor})
|
|
937
|
-
✓ Nettoyer le worktree
|
|
938
|
-
|
|
939
|
-
================================================================================
|
|
940
|
-
```
|
|
941
|
-
|
|
942
|
-
### Si HOTFIX:
|
|
943
|
-
|
|
166
|
+
/gitflow:11-finish {type}/{name}
|
|
944
167
|
```
|
|
945
|
-
================================================================================
|
|
946
|
-
HOTFIX CREE
|
|
947
|
-
================================================================================
|
|
948
|
-
|
|
949
|
-
BRANCHE: hotfix/{name}
|
|
950
|
-
BASE: main
|
|
951
|
-
CIBLE: main + develop (merge back)
|
|
952
|
-
WORKTREE: ../hotfixes/{name}/
|
|
953
|
-
|
|
954
|
-
================================================================================
|
|
955
|
-
PROCHAINES ETAPES
|
|
956
|
-
================================================================================
|
|
957
168
|
|
|
958
|
-
|
|
959
|
-
cd ../hotfixes/{name}
|
|
960
|
-
# ou dans VSCode:
|
|
961
|
-
code ../hotfixes/{name}
|
|
962
|
-
|
|
963
|
-
2. Faire vos corrections et committer:
|
|
964
|
-
/gitflow:3-commit
|
|
965
|
-
|
|
966
|
-
3. Creer une Pull Request (hotfix/{name} → main):
|
|
967
|
-
/gitflow:7-pull-request hotfix/{name}
|
|
169
|
+
---
|
|
968
170
|
|
|
969
|
-
|
|
970
|
-
/gitflow:11-finish hotfix/{name}
|
|
971
|
-
Cela va:
|
|
972
|
-
✓ Incrementer la version PATCH ({current} → {current+patch})
|
|
973
|
-
✓ Creer le tag v{new_version}
|
|
974
|
-
✓ Merger main → develop (merge back)
|
|
975
|
-
✓ Nettoyer le worktree
|
|
171
|
+
## Cas Spéciaux
|
|
976
172
|
|
|
977
|
-
|
|
978
|
-
|
|
173
|
+
| Situation | Action |
|
|
174
|
+
|-----------|--------|
|
|
175
|
+
| develop > 10 commits ahead | Proposer release d'abord |
|
|
176
|
+
| Release déjà en cours | Proposer continuer ou nouvelle |
|
|
177
|
+
| Hotfix depuis branche != main | Stash auto → checkout main |
|
|
178
|
+
| main divergent de develop | Option "Reset main" dans release |
|
|
979
179
|
|
|
980
180
|
---
|
|
981
181
|
|
|
982
|
-
##
|
|
182
|
+
## Modes CLI
|
|
983
183
|
|
|
984
|
-
| Commande |
|
|
184
|
+
| Commande | Résultat |
|
|
985
185
|
|----------|----------|
|
|
986
|
-
| `/gitflow:10-start` | Mode interactif
|
|
987
|
-
| `/gitflow:10-start feature user-auth` |
|
|
988
|
-
| `/gitflow:10-start release` | Propose versions
|
|
989
|
-
| `/gitflow:10-start hotfix login-fix` |
|
|
186
|
+
| `/gitflow:10-start` | Mode interactif |
|
|
187
|
+
| `/gitflow:10-start feature user-auth` | Direct: feature/user-auth |
|
|
188
|
+
| `/gitflow:10-start release` | Propose versions |
|
|
189
|
+
| `/gitflow:10-start hotfix login-fix` | Direct: hotfix/login-fix |
|
|
990
190
|
| `/gitflow:10-start feature test --no-worktree` | Sans worktree |
|
|
991
|
-
|
|
992
|
-
---
|
|
993
|
-
|
|
994
|
-
## Cas speciaux
|
|
995
|
-
|
|
996
|
-
### Develop tres en avance de main (> 10 commits)
|
|
997
|
-
|
|
998
|
-
```
|
|
999
|
-
⚠️ ATTENTION: develop a {N} commits en avance de main.
|
|
1000
|
-
Une release est fortement recommandee avant de creer une nouvelle feature.
|
|
1001
|
-
|
|
1002
|
-
Voulez-vous:
|
|
1003
|
-
1. Creer une release d'abord (Recommande)
|
|
1004
|
-
2. Continuer avec la feature quand meme
|
|
1005
|
-
```
|
|
1006
|
-
|
|
1007
|
-
### Release en cours
|
|
1008
|
-
|
|
1009
|
-
```
|
|
1010
|
-
⚠️ Une release est deja en cours: release/v1.2.0
|
|
1011
|
-
|
|
1012
|
-
Voulez-vous:
|
|
1013
|
-
1. Continuer sur la release existante
|
|
1014
|
-
2. Creer une nouvelle release (rare)
|
|
1015
|
-
```
|
|
1016
|
-
|
|
1017
|
-
### Hotfix urgent depuis n'importe quelle branche
|
|
1018
|
-
|
|
1019
|
-
```
|
|
1020
|
-
Si hotfix selectionne depuis une branche != main:
|
|
1021
|
-
→ Stash automatique des changements
|
|
1022
|
-
→ Checkout main
|
|
1023
|
-
→ Creer hotfix
|
|
1024
|
-
→ Message: "Vos changements ont ete stash. Recuperez-les avec 'git stash pop' apres le hotfix."
|
|
1025
|
-
```
|
|
1026
|
-
|
|
1027
|
-
### Main divergent (commits absents de develop)
|
|
1028
|
-
|
|
1029
|
-
**Situation:** main contient des commits qui ne sont pas sur develop (ex: hotfix mal merge, commit direct sur main)
|
|
1030
|
-
|
|
1031
|
-
**Detection:**
|
|
1032
|
-
```bash
|
|
1033
|
-
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
1034
|
-
```
|
|
1035
|
-
|
|
1036
|
-
**Si utilisateur choisit "Reset main":**
|
|
1037
|
-
```bash
|
|
1038
|
-
# Pendant la release, au moment du finish:
|
|
1039
|
-
# 1. Merge develop → release (normal)
|
|
1040
|
-
# 2. Au lieu de merge release → main, faire un reset:
|
|
1041
|
-
git checkout main
|
|
1042
|
-
git reset --hard release/v{version}
|
|
1043
|
-
git push --force-with-lease origin main
|
|
1044
|
-
# 3. Puis merge release → develop (normal)
|
|
1045
|
-
```
|
|
1046
|
-
|
|
1047
|
-
**Note:** This operation is logged in [.claude/gitflow/logs/](.claude/gitflow/logs/)`main-resets.json`
|
|
1048
|
-
|
|
1049
|
-
### Consolidation des migrations EF Core
|
|
1050
|
-
|
|
1051
|
-
**Situation:** Plusieurs migrations accumulees sur develop (> 3)
|
|
1052
|
-
|
|
1053
|
-
**Avantages de consolider:**
|
|
1054
|
-
- 1 seule migration = schema propre
|
|
1055
|
-
- Pas de conflits ModelSnapshot lors des merges
|
|
1056
|
-
- Deploy plus rapide en production
|
|
1057
|
-
|
|
1058
|
-
**Processus si utilisateur choisit "Consolider":**
|
|
1059
|
-
|
|
1060
|
-
```bash
|
|
1061
|
-
# 1. S'assurer d'etre sur la branche release
|
|
1062
|
-
cd "${WORKTREE_PATH}"
|
|
1063
|
-
|
|
1064
|
-
# 2. Sauvegarder la liste des migrations
|
|
1065
|
-
dotnet ef migrations list > migrations-backup.txt
|
|
1066
|
-
|
|
1067
|
-
# 3. Identifier le DbContext
|
|
1068
|
-
CONTEXT=$(grep -l "DbContext" **/*.cs | head -1)
|
|
1069
|
-
|
|
1070
|
-
# 4. Supprimer toutes les migrations
|
|
1071
|
-
rm -rf Migrations/
|
|
1072
|
-
|
|
1073
|
-
# 5. Creer une migration consolidee
|
|
1074
|
-
dotnet ef migrations add InitialCreate_v{version} --context {DbContext}
|
|
1075
|
-
|
|
1076
|
-
# 6. Verifier que le build passe
|
|
1077
|
-
dotnet build
|
|
1078
|
-
|
|
1079
|
-
# 7. Commit la consolidation
|
|
1080
|
-
git add -A
|
|
1081
|
-
git commit -m "db(migrations): consolidate migrations for v{version}
|
|
1082
|
-
|
|
1083
|
-
Merged migrations:
|
|
1084
|
-
$(cat migrations-backup.txt)
|
|
1085
|
-
|
|
1086
|
-
Single migration: InitialCreate_v{version}"
|
|
1087
|
-
|
|
1088
|
-
rm migrations-backup.txt
|
|
1089
|
-
```
|
|
1090
|
-
|
|
1091
|
-
**⚠️ IMPORTANT:**
|
|
1092
|
-
- Ceci est uniquement pour les releases (pas features/hotfixes)
|
|
1093
|
-
- La DB de production doit etre synchronisee avec les migrations AVANT la consolidation
|
|
1094
|
-
- Apres consolidation, les environnements de dev doivent recreer leur DB locale
|