@atlashub/smartstack-cli 1.10.2 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/.documentation/agents.html +7 -2
  2. package/.documentation/apex.html +7 -2
  3. package/.documentation/business-analyse.html +7 -2
  4. package/.documentation/cli-commands.html +871 -0
  5. package/.documentation/commands.html +7 -2
  6. package/.documentation/efcore.html +7 -2
  7. package/.documentation/gitflow.html +7 -2
  8. package/.documentation/hooks.html +7 -2
  9. package/.documentation/index.html +7 -2
  10. package/.documentation/init.html +7 -2
  11. package/.documentation/installation.html +7 -2
  12. package/.documentation/ralph-loop.html +7 -2
  13. package/.documentation/test-web.html +7 -2
  14. package/dist/index.js +1932 -336
  15. package/dist/index.js.map +1 -1
  16. package/package.json +8 -2
  17. package/templates/agents/efcore/squash.md +67 -31
  18. package/templates/agents/gitflow/finish.md +68 -56
  19. package/templates/commands/business-analyse/0-orchestrate.md +72 -556
  20. package/templates/commands/business-analyse/1-init.md +23 -193
  21. package/templates/commands/business-analyse/2-discover.md +85 -462
  22. package/templates/commands/business-analyse/3-analyse.md +40 -342
  23. package/templates/commands/business-analyse/4-specify.md +72 -537
  24. package/templates/commands/business-analyse/5-validate.md +43 -237
  25. package/templates/commands/business-analyse/6-handoff.md +93 -682
  26. package/templates/commands/business-analyse/7-doc-html.md +45 -544
  27. package/templates/commands/business-analyse/_shared.md +176 -0
  28. package/templates/commands/business-analyse/bug.md +50 -257
  29. package/templates/commands/business-analyse/change-request.md +59 -283
  30. package/templates/commands/business-analyse/hotfix.md +36 -120
  31. package/templates/commands/business-analyse.md +55 -574
  32. package/templates/commands/efcore/_shared.md +206 -0
  33. package/templates/commands/efcore/conflicts.md +39 -201
  34. package/templates/commands/efcore/db-deploy.md +28 -237
  35. package/templates/commands/efcore/db-reset.md +41 -390
  36. package/templates/commands/efcore/db-seed.md +44 -323
  37. package/templates/commands/efcore/db-status.md +31 -210
  38. package/templates/commands/efcore/migration.md +45 -368
  39. package/templates/commands/efcore/rebase-snapshot.md +38 -241
  40. package/templates/commands/efcore/scan.md +35 -204
  41. package/templates/commands/efcore/squash.md +158 -251
  42. package/templates/commands/efcore.md +49 -177
  43. package/templates/commands/gitflow/1-init.md +94 -1318
  44. package/templates/commands/gitflow/10-start.md +86 -990
  45. package/templates/commands/gitflow/11-finish.md +264 -454
  46. package/templates/commands/gitflow/12-cleanup.md +40 -213
  47. package/templates/commands/gitflow/2-status.md +51 -386
  48. package/templates/commands/gitflow/3-commit.md +108 -801
  49. package/templates/commands/gitflow/4-plan.md +42 -13
  50. package/templates/commands/gitflow/5-exec.md +60 -5
  51. package/templates/commands/gitflow/6-abort.md +54 -277
  52. package/templates/commands/gitflow/7-pull-request.md +74 -717
  53. package/templates/commands/gitflow/8-review.md +51 -178
  54. package/templates/commands/gitflow/9-merge.md +74 -404
  55. package/templates/commands/gitflow/_shared.md +196 -0
  56. package/templates/commands/quickstart.md +154 -0
  57. package/templates/commands/ralph-loop/ralph-loop.md +104 -2
  58. package/templates/hooks/hooks.json +13 -0
  59. package/templates/hooks/ralph-mcp-logger.sh +46 -0
  60. package/templates/hooks/ralph-session-end.sh +69 -0
  61. package/templates/ralph/README.md +91 -0
  62. package/templates/ralph/ralph.config.yaml +113 -0
  63. package/templates/scripts/setup-ralph-loop.sh +173 -0
  64. package/templates/skills/_shared.md +117 -0
  65. package/templates/skills/ai-prompt/SKILL.md +87 -654
  66. package/templates/skills/application/SKILL.md +76 -499
  67. package/templates/skills/controller/SKILL.md +38 -165
  68. package/templates/skills/documentation/SKILL.md +2 -1
  69. package/templates/skills/feature-full/SKILL.md +107 -732
  70. package/templates/skills/notification/SKILL.md +85 -474
  71. package/templates/skills/ui-components/SKILL.md +62 -762
  72. package/templates/skills/workflow/SKILL.md +85 -489
  73. package/templates/commands/gitflow/rescue.md +0 -867
  74. package/templates/skills/business-analyse/SKILL.md +0 -191
@@ -4,816 +4,173 @@ agent: gitflow-pr
4
4
  model: haiku
5
5
  ---
6
6
 
7
- # Phase 7: PULL-REQUEST - Creation PR avec checks
7
+ # Phase 7: PULL-REQUEST - Création PR avec checks
8
8
 
9
- Tu es expert GitFlow. Cree une Pull Request avec validation complete.
9
+ **Argument:** `$ARGUMENTS` = branche cible (optionnel, SCAN si sur main/develop)
10
10
 
11
- **Argument:** `$ARGUMENTS` = branche cible (optionnel, **SCAN AUTOMATIQUE** si sur main/develop)
11
+ > **Ref:** Fonction `detect_git_provider()` dans [_shared.md](_shared.md)
12
12
 
13
13
  ---
14
14
 
15
- ## ETAPE 0: DETECTION DU PROVIDER GIT
15
+ ## Étape 0: Détection Provider & CLI
16
16
 
17
- > **CRITIQUE:** Detecter si le remote est GitHub ou Azure DevOps pour utiliser le bon CLI.
17
+ Utiliser `detect_git_provider()` de [_shared.md](_shared.md)
18
18
 
19
- ### 0.0 Detection du provider
20
-
21
- ```bash
22
- REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
23
-
24
- if [[ "$REMOTE_URL" == *"dev.azure.com"* ]] || [[ "$REMOTE_URL" == *"visualstudio.com"* ]]; then
25
- GIT_PROVIDER="azuredevops"
26
- # Extraire org et project depuis l'URL Azure DevOps
27
- # Format: https://dev.azure.com/{org}/{project}/_git/{repo}
28
- # ou: https://{org}@dev.azure.com/{org}/{project}/_git/{repo}
29
- if [[ "$REMOTE_URL" =~ dev\.azure\.com/([^/]+)/([^/]+)/_git/([^/]+) ]]; then
30
- AZURE_ORG="${BASH_REMATCH[1]}"
31
- AZURE_PROJECT="${BASH_REMATCH[2]}"
32
- AZURE_REPO="${BASH_REMATCH[3]}"
33
- fi
34
- echo "Provider: Azure DevOps (org: $AZURE_ORG, project: $AZURE_PROJECT)"
35
- elif [[ "$REMOTE_URL" == *"github.com"* ]]; then
36
- GIT_PROVIDER="github"
37
- echo "Provider: GitHub"
38
- else
39
- GIT_PROVIDER="unknown"
40
- echo "⚠️ Provider non reconnu - tentative avec GitHub CLI"
41
- fi
42
- ```
43
-
44
- ### 0.0.1 Verification CLI disponible
45
-
46
- ```bash
47
- if [ "$GIT_PROVIDER" = "azuredevops" ]; then
48
- if ! command -v az &> /dev/null; then
49
- echo "❌ Azure CLI non installe!"
50
- echo ""
51
- echo "Installation:"
52
- echo " Windows: winget install Microsoft.AzureCLI"
53
- echo " macOS: brew install azure-cli"
54
- echo " Linux: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash"
55
- exit 1
56
- fi
57
- # Verifier extension devops
58
- if ! az devops --help &> /dev/null; then
59
- echo "Installation extension Azure DevOps..."
60
- az extension add --name azure-devops
61
- fi
62
- else
63
- if ! command -v gh &> /dev/null; then
64
- echo "❌ GitHub CLI non installe!"
65
- echo ""
66
- echo "Installation: https://cli.github.com"
67
- exit 1
68
- fi
69
- fi
70
- ```
19
+ **Vérifier CLI:**
20
+ - GitHub: `gh` requis
21
+ - Azure DevOps: `az` + extension `azure-devops` requis
71
22
 
72
23
  ---
73
24
 
74
- ## ETAPE 1: SCAN PROACTIF (si sur main/develop)
75
-
76
- > **COMPORTEMENT PROACTIF:** Si on est sur main ou develop, scanner TOUTES les branches pour proposer celles qui ont besoin d'une PR.
77
-
78
- ### 1.1 Detection du contexte
25
+ ## Étape 1: Scan Proactif (si sur main/develop)
79
26
 
80
27
  ```bash
81
28
  CURRENT=$(git rev-parse --abbrev-ref HEAD)
29
+ [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]] && SCAN_MODE=true
82
30
 
83
- # Si sur main ou develop → mode scan
84
- if [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]]; then
85
- SCAN_MODE=true
86
- else
87
- SCAN_MODE=false
88
- fi
89
- ```
90
-
91
- ### 1.2 Scanner les branches sans PR (si SCAN_MODE)
92
-
93
- ```bash
94
31
  if [ "$SCAN_MODE" = true ]; then
95
32
  git fetch --all --quiet
96
-
97
- # Lister toutes les branches feature/release/hotfix
98
- FEATURES=$(git branch -r | grep 'origin/feature/' | sed 's|origin/||' | tr -d ' ')
99
- RELEASES=$(git branch -r | grep 'origin/release/' | sed 's|origin/||' | tr -d ' ')
100
- HOTFIXES=$(git branch -r | grep 'origin/hotfix/' | sed 's|origin/||' | tr -d ' ')
101
-
102
- ALL_BRANCHES="$FEATURES $RELEASES $HOTFIXES"
103
-
104
- for BRANCH in $ALL_BRANCHES; do
105
- # Verifier si PR existe (ouverte ou mergee)
106
- if [ "$GIT_PROVIDER" = "azuredevops" ]; then
107
- PR_EXISTS=$(az repos pr list --repository "$AZURE_REPO" --source-branch "$BRANCH" --organization "https://dev.azure.com/$AZURE_ORG" --project "$AZURE_PROJECT" --query "[0].pullRequestId" -o tsv 2>/dev/null)
108
- else
109
- PR_EXISTS=$(gh pr list --head "$BRANCH" --json number --jq '.[0]')
110
- fi
111
-
112
- if [ -z "$PR_EXISTS" ]; then
113
- # Pas de PR → candidat
114
- # Compter les commits
115
- if [[ "$BRANCH" == hotfix/* || "$BRANCH" == release/* ]]; then
116
- BASE="main"
117
- else
118
- BASE="develop"
119
- fi
120
- COMMITS=$(git rev-list --count origin/$BASE..origin/$BRANCH 2>/dev/null || echo "0")
121
-
122
- if [ "$COMMITS" -gt 0 ]; then
123
- NEEDS_PR+=("$BRANCH|$COMMITS|$BASE")
124
- fi
125
- fi
33
+ # Lister branches feature/release/hotfix sans PR
34
+ for BRANCH in $(git branch -r | grep -E 'feature/|release/|hotfix/' | sed 's|origin/||'); do
35
+ # Vérifier si PR existe
36
+ PR_EXISTS=$(gh pr list --head "$BRANCH" --json number --jq '.[0]' 2>/dev/null)
37
+ [ -z "$PR_EXISTS" ] && NEEDS_PR+=("$BRANCH")
126
38
  done
127
39
  fi
128
40
  ```
129
41
 
130
- ### 0.3 Afficher le tableau des branches sans PR
131
-
132
- ```
133
- ================================================================================
134
- GITFLOW PULL-REQUEST - SCAN DES BRANCHES
135
- ================================================================================
136
-
137
- 📋 BRANCHES SANS PR (action recommandee):
138
- ┌─────────────────────────────┬───────────┬──────────┬───────────┬─────────────┐
139
- │ Branche │ Type │ Commits │ Cible │ Prete? │
140
- ├─────────────────────────────┼───────────┼──────────┼───────────┼─────────────┤
141
- │ feature/add-user-auth │ feature │ 5 │ develop │ ✅ Oui │
142
- │ feature/wip-refactor │ feature │ 2 │ develop │ ⚠️ Build? │
143
- │ hotfix/fix-login │ hotfix │ 1 │ main │ ✅ Oui │
144
- │ release/v1.5.0 │ release │ 8 │ main │ ✅ Oui │
145
- └─────────────────────────────┴───────────┴──────────┴───────────┴─────────────┘
146
-
147
- ✅ BRANCHES AVEC PR OUVERTE:
148
- ┌─────────────────────────────┬───────────┬────────────┬────────────────────────┐
149
- │ Branche │ Type │ PR # │ Statut │
150
- ├─────────────────────────────┼───────────┼────────────┼────────────────────────┤
151
- │ feature/add-orders │ feature │ #43 │ Review en cours │
152
- └─────────────────────────────┴───────────┴────────────┴────────────────────────┘
153
-
154
- ================================================================================
155
- ```
156
-
157
- ### 0.4 Proposition interactive (si SCAN_MODE)
158
-
159
- ```javascript
160
- if (NEEDS_PR.length > 0) {
161
- // Trier par priorite: hotfixes > releases > features
162
- const sorted = NEEDS_PR.sort((a, b) => {
163
- const priority = { 'hotfix': 0, 'release': 1, 'feature': 2 }
164
- return priority[getType(a)] - priority[getType(b)]
165
- })
166
-
167
- AskUserQuestion({
168
- questions: [{
169
- question: "Pour quelle branche voulez-vous creer une PR ?",
170
- header: "PR",
171
- options: sorted.map(item => {
172
- const [branch, commits, target] = item.split('|')
173
- return {
174
- label: branch,
175
- description: `${commits} commits → ${target} (${getType(branch)})`
176
- }
177
- }),
178
- multiSelect: false
179
- }]
180
- })
181
-
182
- // Switcher vers la branche selectionnee
183
- // git checkout $SELECTED_BRANCH
184
- // Puis continuer avec le workflow normal
185
- } else {
186
- console.log("✅ Toutes les branches ont deja une PR!")
187
- console.log("")
188
- console.log("Actions disponibles:")
189
- if (GIT_PROVIDER === "azuredevops") {
190
- console.log(" - Voir les PRs: az repos pr list --repository " + AZURE_REPO)
191
- } else {
192
- console.log(" - Voir les PRs: gh pr list")
193
- }
194
- console.log(" - Merger une PR: /gitflow:9-merge <numero>")
195
- console.log(" - Finaliser: /gitflow:11-finish")
196
- exit(0)
197
- }
198
- ```
42
+ **Afficher branches sans PR** puis proposer sélection interactive.
199
43
 
200
44
  ---
201
45
 
202
- ## ETAPE 2: SYNCHRONISATION ET VERIFICATION AHEAD/BEHIND
203
-
204
- > **CRITIQUE:** Vérifier la synchronisation avec le remote avant de créer une PR.
46
+ ## Étape 2: Synchronisation
205
47
 
206
48
  ```bash
207
- # Fetch pour avoir les dernières infos (si pas déjà fait en scan mode)
208
49
  git fetch origin --quiet
209
-
210
- CURRENT=$(git rev-parse --abbrev-ref HEAD)
211
-
212
- # Déterminer la branche cible
213
- if [[ "$CURRENT" == hotfix/* || "$CURRENT" == release/* ]]; then
214
- TARGET="main"
215
- else
216
- TARGET="develop"
217
- fi
218
-
219
- # Vérifier synchronisation de la branche source
220
50
  AHEAD=$(git rev-list --count origin/$CURRENT..HEAD 2>/dev/null || echo "0")
221
51
  BEHIND=$(git rev-list --count HEAD..origin/$CURRENT 2>/dev/null || echo "0")
222
-
223
- echo ""
224
- echo "SYNCHRONISATION"
225
- echo "───────────────────────────────────────"
226
- echo " Branche: $CURRENT → $TARGET"
227
- echo " AHEAD: $AHEAD commit(s) non poussé(s)"
228
- echo " BEHIND: $BEHIND commit(s) non récupéré(s)"
229
- echo ""
230
-
231
- # Avertissements
232
- if [ "$BEHIND" -gt 0 ]; then
233
- echo "⚠️ ATTENTION: Votre branche locale est en retard de $BEHIND commit(s)"
234
- echo "→ Recommandation: git pull origin $CURRENT avant de créer la PR"
235
- echo ""
236
- fi
237
-
238
- if [ "$AHEAD" -eq 0 ]; then
239
- echo "ℹ️ Tous vos commits sont déjà poussés sur origin"
240
- fi
241
-
242
- # Vérifier si branche à jour par rapport à la cible
243
52
  BEHIND_TARGET=$(git rev-list --count HEAD..origin/$TARGET 2>/dev/null || echo "0")
244
- if [ "$BEHIND_TARGET" -gt 0 ]; then
245
- echo "⚠️ Votre branche est en retard de $BEHIND_TARGET commit(s) par rapport à $TARGET"
246
- echo "→ Recommandation: git rebase origin/$TARGET pour intégrer les derniers changements"
247
- echo ""
248
- fi
249
53
  ```
250
54
 
251
- | État | Signification | Action |
252
- |------|---------------|--------|
253
- | AHEAD > 0, BEHIND = 0 | Commits prêts à être dans la PR | ✅ Continuer |
254
- | BEHIND > 0 | Commits remote non récupérés | `git pull origin {branch}` |
255
- | BEHIND_TARGET > 0 | Branche cible a avancé | `git rebase origin/{target}` |
55
+ | État | Action |
56
+ |------|--------|
57
+ | BEHIND > 0 | `git pull origin {branch}` |
58
+ | BEHIND_TARGET > 0 | `git rebase origin/{target}` |
256
59
 
257
60
  ---
258
61
 
259
- ## Pre-checks obligatoires
62
+ ## Étape 3: Détection Cible Auto
260
63
 
261
- ### 1. Validation branche et detection cible
64
+ | Type branche | Cible | Raison |
65
+ |--------------|-------|--------|
66
+ | `feature/*` | `develop` | Intégration continue |
67
+ | `release/*` | `main` | Déploiement production |
68
+ | `hotfix/*` | `main` | Correction urgente |
262
69
 
263
- ```bash
264
- # Branche courante (ou selectionnee depuis scan)
265
- CURRENT=$(git rev-parse --abbrev-ref HEAD)
266
-
267
- # Verifier que ce n'est pas main/develop (sauf si scan mode a selectionne une branche)
268
- if [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]]; then
269
- if [ "$SCAN_MODE" = true ] && [ -n "$SELECTED_BRANCH" ]; then
270
- # On a selectionne une branche depuis le scan, switcher
271
- git checkout "$SELECTED_BRANCH"
272
- CURRENT="$SELECTED_BRANCH"
273
- else
274
- echo "⚠️ Vous etes sur '$CURRENT' - impossible de creer une PR depuis cette branche."
275
- echo ""
276
- echo "→ Utilisez cette commande depuis une branche feature/release/hotfix"
277
- echo " ou executez-la depuis main/develop pour scanner les branches disponibles."
278
- exit 1
279
- fi
280
- fi
281
-
282
- # ============================================
283
- # DETECTION AUTOMATIQUE DE LA CIBLE
284
- # ============================================
285
- # GitFlow standard:
286
- # - feature/* → develop
287
- # - release/* → main (puis merge back to develop apres)
288
- # - hotfix/* → main (puis merge back to develop apres)
289
- # ============================================
290
-
291
- if [[ -n "$ARGUMENTS" && "$ARGUMENTS" != "--"* ]]; then
292
- # Cible explicite fournie par l'utilisateur
293
- TARGET="$ARGUMENTS"
294
- else
295
- # Detection automatique selon le type de branche
296
- if [[ "$CURRENT" == hotfix/* ]]; then
297
- TARGET="main"
298
- echo "Hotfix detecte → PR vers main (GitFlow standard)"
299
- elif [[ "$CURRENT" == release/* ]]; then
300
- TARGET="main"
301
- echo "Release detectee → PR vers main (GitFlow standard)"
302
- else
303
- TARGET="develop"
304
- echo "Feature/autre → PR vers develop"
305
- fi
306
- fi
307
-
308
- echo "Cible: $TARGET"
309
- ```
310
-
311
- **Cibles par defaut (GitFlow standard):**
312
-
313
- | Type branche | Cible PR | Raison |
314
- |--------------|----------|--------|
315
- | `feature/*` | `develop` | Features integrees sur develop |
316
- | `release/*` | `main` | Releases deployees sur main |
317
- | `hotfix/*` | `main` | Hotfixes appliques sur main d'abord |
318
-
319
- ### 2. Synchronisation
320
-
321
- | Check | Commande | Action si echec |
322
- |-------|----------|-----------------|
323
- | Fetch | `git fetch origin` | - |
324
- | A jour vs target | `git rev-list --count HEAD..origin/{target}` | `git rebase origin/{target}` |
325
- | Pas de conflits | `git merge-tree` | Resoudre conflits d'abord |
70
+ ---
326
71
 
327
- ### 3. Qualite code
72
+ ## Étape 4: Pre-checks
328
73
 
329
74
  | Check | Commande | Bloquant |
330
75
  |-------|----------|----------|
331
76
  | Build | `dotnet build` | OUI |
332
77
  | Tests | `dotnet test` | OUI |
333
- | Format | `dotnet format --verify-no-changes` | NON (warning) |
334
-
335
- ### 4. EF Core (si applicable)
336
-
337
- | Check | Validation |
338
- |-------|------------|
339
- | Migrations completes | 3 fichiers (Migration + Designer + ModelSnapshot) |
340
- | Build avec migrations | `dotnet ef migrations script --idempotent` |
341
- | Pas de pending | Toutes migrations commitees |
78
+ | Format | `dotnet format --verify-no-changes` | NON |
79
+ | EF Core | 3 fichiers migration complets | OUI |
342
80
 
343
81
  ---
344
82
 
345
- ## Generation PR
346
-
347
- ### Titre automatique
348
-
349
- > **IMPORTANT:** Le titre de PR doit etre standardise et sans fautes d'orthographe.
350
- >
351
- > **Prefixes TOUJOURS en anglais (Conventional Commits):**
352
- > - `feat:` pour les features (jamais "fonctionnalite:")
353
- > - `fix:` pour les corrections (jamais "corriger:")
354
- > - `release:` pour les releases
355
- >
356
- > Seule la **description** (apres le prefix) utilise la langue configuree.
357
-
358
- | Type branche | Format titre | Exemple FR |
359
- |--------------|--------------|------------|
360
- | `feature/*` | `feat: {description}` | `feat: Ajouter Authentification` |
361
- | `hotfix/*` | `fix: {description}` | `fix: Corriger Bug Login` |
362
- | `release/*` | `release: v{version}` | `release: v1.5.0` |
363
-
364
- **Extraction et normalisation de la description:**
365
-
366
- ```bash
367
- # ═══════════════════════════════════════════════════════════════
368
- # EXTRACTION DU TITRE DE PR DEPUIS LE NOM DE BRANCHE
369
- # ═══════════════════════════════════════════════════════════════
370
-
371
- # Fonction pour convertir le nom de branche en titre lisible
372
- branch_to_title() {
373
- local branch="$1"
374
-
375
- # Extraire la partie apres feature/, hotfix/, release/
376
- local name=$(echo "$branch" | sed 's|^[^/]*/||')
377
-
378
- # Remplacer les tirets par des espaces
379
- local title=$(echo "$name" | tr '-' ' ')
380
-
381
- # Mettre en majuscule la premiere lettre de chaque mot significatif
382
- # (garder les mots courts comme "de", "le", "la" en minuscules si FR)
383
- title=$(echo "$title" | sed 's/\b\(.\)/\u\1/g')
384
-
385
- echo "$title"
386
- }
387
-
388
- # Exemples:
389
- # feature/add-user-authentication → "Add User Authentication"
390
- # hotfix/fix-login-bug → "Fix Login Bug"
391
- # feature/ameliorer-performance-api → "Ameliorer Performance Api"
392
- ```
393
-
394
- **Generer le titre selon la langue configuree:**
395
-
396
- ```bash
397
- # Lire la configuration de langue
398
- CONFIG_FILE=".claude/gitflow/config.json"
399
- LANG_CODE="en"
400
- if [ -f "$CONFIG_FILE" ]; then
401
- LANG_CODE=$(grep -oP '"code":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null | head -1)
402
- LANG_CODE=${LANG_CODE:-en}
403
- fi
404
-
405
- # Extraire le type de branche
406
- if [[ "$CURRENT" == feature/* ]]; then
407
- BRANCH_TYPE="feature"
408
- PREFIX="feat"
409
- elif [[ "$CURRENT" == hotfix/* ]]; then
410
- BRANCH_TYPE="hotfix"
411
- PREFIX="fix"
412
- elif [[ "$CURRENT" == release/* ]]; then
413
- BRANCH_TYPE="release"
414
- PREFIX="release"
415
- # Pour les releases, extraire la version
416
- VERSION=$(echo "$CURRENT" | sed 's|release/v\?||')
417
- fi
418
-
419
- # Generer le titre
420
- if [ "$BRANCH_TYPE" = "release" ]; then
421
- PR_TITLE="${PREFIX}: v${VERSION}"
422
- else
423
- DESCRIPTION=$(branch_to_title "$CURRENT")
424
- PR_TITLE="${PREFIX}: ${DESCRIPTION}"
425
- fi
426
-
427
- echo "Titre PR genere: $PR_TITLE"
428
- ```
83
+ ## Étape 5: Génération PR
429
84
 
430
- **Validation du titre:**
85
+ ### Titre
431
86
 
432
87
  ```bash
433
- # ═══════════════════════════════════════════════════════════════
434
- # VALIDATION DU TITRE DE PR
435
- # ═══════════════════════════════════════════════════════════════
436
- # Regles:
437
- # - Longueur max: 72 caracteres
438
- # - Format: {prefix}: {description}
439
- # - Pas de caracteres speciaux interdits
440
- # - Premiere lettre de description en majuscule
441
- # ═══════════════════════════════════════════════════════════════
442
-
443
- validate_pr_title() {
444
- local title="$1"
445
-
446
- # 1. Verifier la longueur
447
- if [ ${#title} -gt 72 ]; then
448
- echo "⚠️ Titre trop long (${#title} > 72 chars), sera tronque"
449
- title=$(echo "$title" | cut -c1-72)
450
- fi
451
-
452
- # 2. Verifier le format prefix:
453
- if ! echo "$title" | grep -qE '^(feat|fix|release|chore|docs|refactor|test|perf|ci):'; then
454
- echo "⚠️ Titre sans prefix valide, ajout de 'feat:'"
455
- title="feat: $title"
456
- fi
457
-
458
- # 3. S'assurer que la description commence par une majuscule
459
- title=$(echo "$title" | sed 's/: \([a-z]\)/: \U\1/')
460
-
461
- echo "$title"
462
- }
463
-
464
- PR_TITLE=$(validate_pr_title "$PR_TITLE")
88
+ case "$CURRENT" in
89
+ feature/*) PREFIX="feat" ;;
90
+ hotfix/*) PREFIX="fix" ;;
91
+ release/*) PREFIX="release" ;;
92
+ esac
93
+ DESCRIPTION=$(echo "$CURRENT" | sed 's|^[^/]*/||' | tr '-' ' ' | sed 's/\b./\u&/g')
94
+ PR_TITLE="${PREFIX}: ${DESCRIPTION}"
465
95
  ```
466
96
 
467
- ### Description automatique
468
-
469
- > **CLAUDE INSTRUCTION - REDACTION EXPERTE DES PR**
470
- >
471
- > La description de PR doit etre **auto-explicative** et permettre a un reviewer de comprendre:
472
- > 1. **Le contexte** - Pourquoi ce changement?
473
- > 2. **La solution** - Quelle approche technique?
474
- > 3. **L'impact** - Quel benefice concret?
475
- >
476
- > **Chaque point majeur = 1 paragraphe autonome** (comprehensible sans lire le reste)
97
+ ### Description
477
98
 
478
- #### Format expert de description PR
99
+ Format expert:
479
100
 
480
101
  ```markdown
481
- ## Resume
482
-
483
- {1 phrase: Quoi + Pourquoi - pas de liste, juste l'essentiel}
102
+ ## Résumé
103
+ {1 phrase: Quoi + Pourquoi}
484
104
 
485
105
  ## Changements
106
+ ### {Nom}
107
+ **CONTEXTE:** {situation avant}
108
+ **SOLUTION:** {approche technique}
109
+ **BÉNÉFICE:** {impact concret}
486
110
 
487
- {Pour CHAQUE modification majeure, un paragraphe structure:}
488
-
489
- ### {Nom du changement 1}
490
-
491
- **CONTEXTE:** {Situation problematique avant - quel etait le manque ou le bug?}
492
-
493
- **SOLUTION:** {Approche technique choisie - comment ca fonctionne maintenant?}
494
-
495
- **BENEFICE:** {Impact concret mesurable - qu'est-ce que l'utilisateur/dev gagne?}
496
-
497
- ### {Nom du changement 2}
498
-
499
- **CONTEXTE:** {Description de la situation initiale}
500
-
501
- **SOLUTION:** {Implementation technique}
502
-
503
- **BENEFICE:** {Gain apporte}
504
-
505
- ## Fichiers cles
506
-
507
- | Fichier | Role |
508
- |---------|------|
509
- | `path/file1.ext` | {role en 5 mots max} |
510
- | `path/file2.ext` | {role en 5 mots max} |
511
-
512
- ## Migrations EF Core
513
-
514
- {Si applicable:}
515
- | Migration | Apport |
516
- |-----------|--------|
517
- | `{Timestamp}_{Name}` | {Ce qu'elle ajoute/modifie} |
518
-
519
- {Sinon: "Aucune migration incluse"}
111
+ ## Fichiers clés
112
+ | Fichier | Rôle |
520
113
 
521
114
  ## Test
522
-
523
- {Comment valider que ca fonctionne - etapes concretes}
524
-
525
- ## Checklist
526
-
527
- - [ ] Tests ajoutes/mis a jour
528
- - [ ] Documentation mise a jour si necessaire
529
- - [ ] Breaking changes documentes
530
- - [ ] Migration EF Core testee (si applicable)
115
+ {étapes de validation}
531
116
 
532
117
  ---
533
118
  🤖 Generated with GitFlow
534
119
  ```
535
120
 
536
- #### Regles de redaction PR
537
-
538
- | Principe | Application |
539
- |----------|-------------|
540
- | **Contexte d'abord** | Toujours expliquer le POURQUOI avant le COMMENT |
541
- | **Paragraphes autonomes** | Chaque section comprehensible independamment |
542
- | **Impact mesurable** | Benefices concrets, pas de vagues "ameliorations" |
543
- | **Fichiers avec role** | Pas juste la liste, mais CE QUE fait chaque fichier |
544
- | **Zero jargon sans explication** | Si terme technique, l'expliquer brievement |
545
-
546
- #### Verbes d'impact pour titres de sections
547
-
548
- | Eviter | Utiliser |
549
- |--------|----------|
550
- | "Ajout de X" | "Implemente X pour permettre Y" |
551
- | "Modification de X" | "Optimise X - gain de Y" |
552
- | "Correction de X" | "Resout X qui causait Y" |
553
- | "Mise a jour de X" | "Ameliore X en ajoutant Y" |
554
-
555
- #### Exemples de paragraphes bien rediges
556
-
557
- **BON:**
558
- ```
559
- ### Rescue to Feature
560
-
561
- **CONTEXTE:** Les developpeurs qui commitaient par erreur sur develop perdaient
562
- leur travail lors du reset, sans moyen simple de le recuperer.
563
-
564
- **SOLUTION:** Detection automatique des modifications sur develop (commits,
565
- fichiers stages, untracked) avec creation d'un tag de sauvegarde avant toute
566
- operation destructive, puis migration transparente vers une feature branch.
567
-
568
- **BENEFICE:** Zero perte de travail - meme en cas d'erreur de workflow,
569
- le code est preserve et accessible via le tag rescue.
570
- ```
571
-
572
- **MAUVAIS:**
573
- ```
574
- ### Rescue to Feature
575
-
576
- Ajout d'une fonctionnalite de rescue. Permet de sauvegarder le travail.
577
- Modifie plusieurs fichiers.
578
- ```
579
-
580
- ### Labels automatiques
581
-
582
- | Condition | Label |
583
- |-----------|-------|
584
- | `feature/*` | `enhancement` |
585
- | `hotfix/*` | `bug` |
586
- | `release/*` | `release` |
587
- | Contient migrations | `database` |
588
- | Tests modifies | `tests` |
589
-
590
121
  ---
591
122
 
592
- ## Execution
593
-
594
- ### Pour GitHub
123
+ ## Étape 6: Exécution
595
124
 
125
+ ### GitHub
596
126
  ```bash
597
- if [ "$GIT_PROVIDER" = "github" ]; then
598
- gh pr create \
599
- --base {target} \
600
- --title "{titre}" \
601
- --body "{description}" \
602
- --label "{labels}" \
603
- --assignee "@me"
604
- fi
127
+ gh pr create --base "$TARGET" --title "$PR_TITLE" --body "$BODY" --assignee "@me"
605
128
  ```
606
129
 
607
- ### Pour Azure DevOps
608
-
130
+ ### Azure DevOps
609
131
  ```bash
610
- if [ "$GIT_PROVIDER" = "azuredevops" ]; then
611
- az repos pr create \
612
- --repository "$AZURE_REPO" \
613
- --source-branch "$CURRENT" \
614
- --target-branch "{target}" \
615
- --title "{titre}" \
616
- --description "{description}" \
617
- --organization "https://dev.azure.com/$AZURE_ORG" \
618
- --project "$AZURE_PROJECT"
619
- fi
132
+ az repos pr create --repository "$AZURE_REPO" --source-branch "$CURRENT" \
133
+ --target-branch "$TARGET" --title "$PR_TITLE" --description "$BODY" \
134
+ --organization "https://dev.azure.com/$AZURE_ORG" --project "$AZURE_PROJECT"
620
135
  ```
621
136
 
622
- > **Note Azure DevOps:** Les labels et assignees ne sont pas supportes via CLI. Ajoutez-les manuellement via l'interface web si necessaire.
623
-
624
- ### Options supplementaires
625
-
626
- | Option | Condition | GitHub | Azure DevOps |
627
- |--------|-----------|--------|--------------|
628
- | Draft | Si WIP dans titre | `--draft` | `--draft` |
629
- | Reviewer | Si configure | `--reviewer` | Non supporte CLI |
630
- | Milestone | Si release | `--milestone` | Non supporte CLI |
631
-
632
- ---
633
-
634
- ## Post-creation
635
-
636
- 1. Afficher URL de la PR
637
- 2. Afficher checklist restante
638
- 3. Suggerer `/gitflow:8-review` pour auto-review
639
-
640
137
  ---
641
138
 
642
- ## Resume
643
-
644
- **Afficher un resume adapte au TYPE de branche et au PROVIDER:**
645
-
646
- ### Si FEATURE:
139
+ ## Résumé
647
140
 
648
141
  ```
649
- ═══════════════════════════════════════════════════════════════════════════════
650
- PULL REQUEST CRÉÉE
651
- ═══════════════════════════════════════════════════════════════════════════════
652
-
653
- PR DETAILS
654
- ───────────────────────────────────────────────────────────────────────────────
655
- • PR: #{number} - Statut: ACTIVE
656
- • Branche: feature/{name} → develop
657
- • Build: ✓ Passes (TypeScript types verified)
658
- • Commits: {N} commits ({description})
659
-
660
- URL DIRECT:
661
- {url}
662
-
663
- WORKFLOW STATUT
664
- ───────────────────────────────────────────────────────────────────────────────
665
- ✓ Branche synchronisée avec develop
666
- ✓ Build vérifié
667
- ✓ Tests passés
668
- ✓ PR créée sur {GitHub|Azure DevOps}
669
- ✓ Branche poussée à origin
670
-
671
- ═══════════════════════════════════════════════════════════════════════════════
672
- PROCHAINES ÉTAPES
673
- ═══════════════════════════════════════════════════════════════════════════════
674
-
675
- 1. Attendre la review et l'approbation de la PR
676
-
677
- 2. Merger la PR:
678
- /gitflow:9-merge {pr_number}
679
-
680
- 3. Finaliser et nettoyer:
681
- /gitflow:11-finish feature/{name}
682
- Cela va:
683
- ✓ Supprimer la branche feature/{name}
684
- ✓ Nettoyer le worktree
685
-
686
- ═══════════════════════════════════════════════════════════════════════════════
142
+ PR CRÉÉE
143
+ - PR: #{number} | {branch} → {target}
144
+ - Build: ✓ | Tests: ✓
145
+ - URL: {url}
687
146
  ```
688
147
 
689
- ### Si RELEASE:
690
-
691
- ```
692
- ═══════════════════════════════════════════════════════════════════════════════
693
- PULL REQUEST CRÉÉE
694
- ═══════════════════════════════════════════════════════════════════════════════
695
-
696
- PR DETAILS
697
- ───────────────────────────────────────────────────────────────────────────────
698
- • PR: #{number} - Statut: ACTIVE
699
- • Branche: release/v{version} → main
700
- • Build: ✓ Passes (TypeScript types verified)
701
- • Commits: {N} commits (version bump + changes)
702
-
703
- URL DIRECT:
704
- {url}
705
-
706
- WORKFLOW STATUT
707
- ───────────────────────────────────────────────────────────────────────────────
708
- ✓ Branche synchronisée avec main
709
- ✓ Build vérifié
710
- ✓ Tests passés
711
- ✓ PR créée sur {GitHub|Azure DevOps}
712
- ✓ Branche poussée à origin
713
-
714
- ═══════════════════════════════════════════════════════════════════════════════
715
- PROCHAINES ÉTAPES
716
- ═══════════════════════════════════════════════════════════════════════════════
148
+ **PROCHAINES ÉTAPES**
717
149
 
718
150
  1. Attendre la review et l'approbation de la PR
151
+ 2. Merger la PR
152
+ 3. Finaliser la branche
719
153
 
720
- 2. Merger la PR:
721
- /gitflow:9-merge {pr_number}
154
+ **COMMANDES**
722
155
 
723
- 3. Finaliser la release:
724
- /gitflow:11-finish release/v{version}
725
- Cela va:
726
- ✓ Créer le tag v{version}
727
- ✓ Merger main → develop (merge back)
728
- ✓ Incrémenter la version sur develop ({version} → {next_minor})
729
- ✓ Nettoyer le worktree
156
+ Merger la PR:
730
157
 
731
- ═══════════════════════════════════════════════════════════════════════════════
732
158
  ```
733
-
734
- ### Si HOTFIX:
735
-
159
+ /gitflow:9-merge {number}
736
160
  ```
737
- ═══════════════════════════════════════════════════════════════════════════════
738
- PULL REQUEST CRÉÉE
739
- ═══════════════════════════════════════════════════════════════════════════════
740
-
741
- PR DETAILS
742
- ───────────────────────────────────────────────────────────────────────────────
743
- • PR: #{number} - Statut: ACTIVE
744
- • Branche: hotfix/{name} → main
745
- • Build: ✓ Passes (TypeScript types verified)
746
- • Commits: {N} commits (bug fixes)
747
-
748
- URL DIRECT:
749
- {url}
750
-
751
- WORKFLOW STATUT
752
- ───────────────────────────────────────────────────────────────────────────────
753
- ✓ Branche synchronisée avec main
754
- ✓ Build vérifié
755
- ✓ Tests passés
756
- ✓ PR créée sur {GitHub|Azure DevOps}
757
- ✓ Branche poussée à origin
758
-
759
- ═══════════════════════════════════════════════════════════════════════════════
760
- PROCHAINES ÉTAPES
761
- ═══════════════════════════════════════════════════════════════════════════════
762
161
 
763
- 1. Attendre la review et l'approbation de la PR
764
- ⚠️ HOTFIX: Priorité élevée - review urgente recommandée
162
+ Finaliser:
765
163
 
766
- 2. Merger la PR:
767
- /gitflow:9-merge {pr_number}
768
-
769
- 3. Finaliser le hotfix:
770
- /gitflow:11-finish hotfix/{name}
771
- Cela va:
772
- ✓ Incrémenter la version PATCH ({current} → {current+patch})
773
- ✓ Créer le tag v{new_version}
774
- ✓ Merger main → develop (merge back)
775
- ✓ Nettoyer le worktree
776
-
777
- ═══════════════════════════════════════════════════════════════════════════════
164
+ ```
165
+ /gitflow:11-finish {branch}
778
166
  ```
779
167
 
780
168
  ---
781
169
 
782
- ## Erreurs courantes
783
-
784
- | Erreur | Solution |
785
- |--------|----------|
786
- | "No commits between" | Verifier que branche a des commits |
787
- | "Merge conflict" | `git rebase origin/{target}` + resoudre |
788
- | "Build failed" | Corriger erreurs avant PR |
789
- | "PR already exists" | Afficher URL existante |
790
- | "az: command not found" | Installer Azure CLI: `winget install Microsoft.AzureCLI` |
791
- | "gh: command not found" | Installer GitHub CLI: https://cli.github.com |
792
- | "Please run 'az login'" | Authentification requise: `az login` |
793
-
794
- ## Providers supportes
795
-
796
- | Provider | CLI | Detection URL |
797
- |----------|-----|---------------|
798
- | **GitHub** | `gh` | `github.com` |
799
- | **Azure DevOps** | `az repos` | `dev.azure.com` ou `visualstudio.com` |
800
-
801
170
  ## Modes
802
171
 
803
172
  | Commande | Action |
804
173
  |----------|--------|
805
- | `/gitflow:7-pull-request` | PR vers cible auto-detectee (feature→develop, hotfix/release→main) |
806
- | `/gitflow:7-pull-request develop` | PR vers develop (override) |
807
- | `/gitflow:7-pull-request main` | PR vers main (override) |
174
+ | `/gitflow:7-pull-request` | PR vers cible auto |
175
+ | `/gitflow:7-pull-request develop` | PR vers develop |
808
176
  | `/gitflow:7-pull-request --draft` | PR en draft |
809
- | `/gitflow:7-pull-request --dry-run` | Simulation |
810
-
811
- **Detection automatique de la cible:**
812
-
813
- ```
814
- feature/* → develop (integration continue)
815
- release/* → main (deploiement production)
816
- hotfix/* → main (correction urgente production)
817
- ```
818
-
819
- > **Note:** Le merge back vers develop est gere par `/gitflow:11-finish` apres le merge de la PR.