@atlashub/smartstack-cli 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.documentation/css/styles.css +2168 -2168
  2. package/.documentation/js/app.js +794 -794
  3. package/config/default-config.json +86 -86
  4. package/config/settings.json +53 -53
  5. package/config/settings.local.example.json +16 -16
  6. package/dist/index.js +0 -0
  7. package/dist/index.js.map +1 -1
  8. package/package.json +88 -88
  9. package/templates/agents/action.md +36 -36
  10. package/templates/agents/efcore/conflicts.md +84 -84
  11. package/templates/agents/efcore/db-deploy.md +51 -51
  12. package/templates/agents/efcore/db-reset.md +59 -59
  13. package/templates/agents/efcore/db-seed.md +56 -56
  14. package/templates/agents/efcore/db-status.md +64 -64
  15. package/templates/agents/efcore/migration.md +85 -85
  16. package/templates/agents/efcore/rebase-snapshot.md +62 -62
  17. package/templates/agents/efcore/scan.md +90 -90
  18. package/templates/agents/efcore/squash.md +67 -67
  19. package/templates/agents/explore-codebase.md +65 -65
  20. package/templates/agents/explore-docs.md +97 -97
  21. package/templates/agents/fix-grammar.md +49 -49
  22. package/templates/agents/gitflow/abort.md +45 -45
  23. package/templates/agents/gitflow/cleanup.md +85 -85
  24. package/templates/agents/gitflow/commit.md +40 -40
  25. package/templates/agents/gitflow/exec.md +48 -48
  26. package/templates/agents/gitflow/finish.md +92 -92
  27. package/templates/agents/gitflow/init.md +139 -139
  28. package/templates/agents/gitflow/merge.md +62 -62
  29. package/templates/agents/gitflow/plan.md +42 -42
  30. package/templates/agents/gitflow/pr.md +78 -78
  31. package/templates/agents/gitflow/review.md +49 -49
  32. package/templates/agents/gitflow/start.md +61 -61
  33. package/templates/agents/gitflow/status.md +32 -32
  34. package/templates/agents/snipper.md +36 -36
  35. package/templates/agents/websearch.md +46 -46
  36. package/templates/commands/_resources/formatting-guide.md +124 -124
  37. package/templates/commands/ai-prompt.md +315 -315
  38. package/templates/commands/apex/1-analyze.md +100 -100
  39. package/templates/commands/apex/2-plan.md +145 -145
  40. package/templates/commands/apex/3-execute.md +171 -171
  41. package/templates/commands/apex/4-examine.md +116 -116
  42. package/templates/commands/apex/5-tasks.md +209 -209
  43. package/templates/commands/apex.md +76 -76
  44. package/templates/commands/application/create.md +362 -362
  45. package/templates/commands/application/templates-backend.md +463 -463
  46. package/templates/commands/application/templates-frontend.md +517 -517
  47. package/templates/commands/application/templates-i18n.md +478 -478
  48. package/templates/commands/application/templates-seed.md +362 -362
  49. package/templates/commands/application.md +303 -303
  50. package/templates/commands/business-analyse/0-orchestrate.md +640 -640
  51. package/templates/commands/business-analyse/1-init.md +269 -269
  52. package/templates/commands/business-analyse/2-discover.md +520 -520
  53. package/templates/commands/business-analyse/3-analyse.md +408 -408
  54. package/templates/commands/business-analyse/4-specify.md +598 -598
  55. package/templates/commands/business-analyse/5-validate.md +326 -326
  56. package/templates/commands/business-analyse/6-handoff.md +746 -746
  57. package/templates/commands/business-analyse/7-doc-html.md +602 -602
  58. package/templates/commands/business-analyse/bug.md +325 -325
  59. package/templates/commands/business-analyse/change-request.md +368 -368
  60. package/templates/commands/business-analyse/hotfix.md +200 -200
  61. package/templates/commands/business-analyse.md +640 -640
  62. package/templates/commands/controller/create.md +216 -216
  63. package/templates/commands/controller/postman-templates.md +528 -528
  64. package/templates/commands/controller/templates.md +600 -600
  65. package/templates/commands/controller.md +337 -337
  66. package/templates/commands/create/agent.md +138 -138
  67. package/templates/commands/create/command.md +166 -166
  68. package/templates/commands/create/hook.md +234 -234
  69. package/templates/commands/create/plugin.md +329 -329
  70. package/templates/commands/create/project.md +507 -507
  71. package/templates/commands/create/skill.md +199 -199
  72. package/templates/commands/create.md +220 -220
  73. package/templates/commands/debug.md +95 -95
  74. package/templates/commands/documentation/module.md +202 -202
  75. package/templates/commands/documentation/templates.md +432 -432
  76. package/templates/commands/documentation.md +190 -190
  77. package/templates/commands/efcore/_env-check.md +153 -153
  78. package/templates/commands/efcore/conflicts.md +186 -186
  79. package/templates/commands/efcore/db-deploy.md +193 -193
  80. package/templates/commands/efcore/db-reset.md +426 -426
  81. package/templates/commands/efcore/db-seed.md +326 -326
  82. package/templates/commands/efcore/db-status.md +226 -226
  83. package/templates/commands/efcore/migration.md +400 -400
  84. package/templates/commands/efcore/rebase-snapshot.md +264 -264
  85. package/templates/commands/efcore/scan.md +198 -198
  86. package/templates/commands/efcore/squash.md +298 -298
  87. package/templates/commands/efcore.md +224 -224
  88. package/templates/commands/epct.md +69 -69
  89. package/templates/commands/explain.md +186 -186
  90. package/templates/commands/explore.md +45 -45
  91. package/templates/commands/feature-full.md +267 -267
  92. package/templates/commands/gitflow/1-init.md +1038 -1038
  93. package/templates/commands/gitflow/10-start.md +768 -768
  94. package/templates/commands/gitflow/11-finish.md +457 -457
  95. package/templates/commands/gitflow/12-cleanup.md +276 -276
  96. package/templates/commands/gitflow/13-sync.md +216 -216
  97. package/templates/commands/gitflow/14-rebase.md +251 -251
  98. package/templates/commands/gitflow/2-status.md +277 -277
  99. package/templates/commands/gitflow/3-commit.md +344 -344
  100. package/templates/commands/gitflow/4-plan.md +145 -145
  101. package/templates/commands/gitflow/5-exec.md +147 -147
  102. package/templates/commands/gitflow/6-abort.md +344 -344
  103. package/templates/commands/gitflow/7-pull-request.md +453 -355
  104. package/templates/commands/gitflow/8-review.md +240 -176
  105. package/templates/commands/gitflow/9-merge.md +451 -365
  106. package/templates/commands/gitflow.md +128 -128
  107. package/templates/commands/implement.md +663 -663
  108. package/templates/commands/init.md +567 -567
  109. package/templates/commands/mcp-integration.md +330 -330
  110. package/templates/commands/notification.md +129 -129
  111. package/templates/commands/oneshot.md +57 -57
  112. package/templates/commands/quick-search.md +72 -72
  113. package/templates/commands/ralph-loop/cancel-ralph.md +18 -18
  114. package/templates/commands/ralph-loop/help.md +126 -126
  115. package/templates/commands/ralph-loop/ralph-loop.md +18 -18
  116. package/templates/commands/review.md +106 -106
  117. package/templates/commands/utils/test-web-config.md +160 -160
  118. package/templates/commands/utils/test-web.md +151 -151
  119. package/templates/commands/validate.md +233 -233
  120. package/templates/commands/workflow.md +193 -193
  121. package/templates/gitflow/config.json +138 -138
  122. package/templates/hooks/ef-migration-check.md +139 -139
  123. package/templates/hooks/hooks.json +25 -25
  124. package/templates/hooks/stop-hook.sh +177 -177
  125. package/templates/skills/ai-prompt/SKILL.md +778 -778
  126. package/templates/skills/application/SKILL.md +563 -563
  127. package/templates/skills/application/templates-backend.md +450 -450
  128. package/templates/skills/application/templates-frontend.md +531 -531
  129. package/templates/skills/application/templates-i18n.md +520 -520
  130. package/templates/skills/application/templates-seed.md +647 -647
  131. package/templates/skills/business-analyse/SKILL.md +191 -191
  132. package/templates/skills/business-analyse/questionnaire.md +283 -283
  133. package/templates/skills/business-analyse/templates-frd.md +477 -477
  134. package/templates/skills/business-analyse/templates-react.md +580 -580
  135. package/templates/skills/controller/SKILL.md +240 -240
  136. package/templates/skills/controller/postman-templates.md +614 -614
  137. package/templates/skills/controller/templates.md +1468 -1468
  138. package/templates/skills/documentation/SKILL.md +133 -133
  139. package/templates/skills/documentation/templates.md +476 -476
  140. package/templates/skills/feature-full/SKILL.md +838 -838
  141. package/templates/skills/notification/SKILL.md +555 -555
  142. package/templates/skills/ui-components/SKILL.md +870 -870
  143. package/templates/skills/workflow/SKILL.md +582 -582
  144. package/templates/test-web/api-health.json +38 -38
  145. package/templates/test-web/minimal.json +19 -19
  146. package/templates/test-web/npm-package.json +46 -46
  147. package/templates/test-web/seo-check.json +54 -54
@@ -1,355 +1,453 @@
1
- ---
2
- description: Phase 7 - Create Pull Request with auto-generated description and checks
3
- agent: gitflow-pr
4
- model: haiku
5
- ---
6
-
7
- # Phase 7: PULL-REQUEST - Creation PR avec checks
8
-
9
- Tu es expert GitFlow. Cree une Pull Request avec validation complete.
10
-
11
- **Argument:** `$ARGUMENTS` = branche cible (optionnel, **SCAN AUTOMATIQUE** si sur main/develop)
12
-
13
- ---
14
-
15
- ## ETAPE 0: SCAN PROACTIF (si sur main/develop)
16
-
17
- > **COMPORTEMENT PROACTIF:** Si on est sur main ou develop, scanner TOUTES les branches pour proposer celles qui ont besoin d'une PR.
18
-
19
- ### 0.1 Detection du contexte
20
-
21
- ```bash
22
- CURRENT=$(git rev-parse --abbrev-ref HEAD)
23
-
24
- # Si sur main ou develop mode scan
25
- if [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]]; then
26
- SCAN_MODE=true
27
- else
28
- SCAN_MODE=false
29
- fi
30
- ```
31
-
32
- ### 0.2 Scanner les branches sans PR (si SCAN_MODE)
33
-
34
- ```bash
35
- if [ "$SCAN_MODE" = true ]; then
36
- git fetch --all --quiet
37
-
38
- # Lister toutes les branches feature/release/hotfix
39
- FEATURES=$(git branch -r | grep 'origin/feature/' | sed 's|origin/||' | tr -d ' ')
40
- RELEASES=$(git branch -r | grep 'origin/release/' | sed 's|origin/||' | tr -d ' ')
41
- HOTFIXES=$(git branch -r | grep 'origin/hotfix/' | sed 's|origin/||' | tr -d ' ')
42
-
43
- ALL_BRANCHES="$FEATURES $RELEASES $HOTFIXES"
44
-
45
- for BRANCH in $ALL_BRANCHES; do
46
- # Verifier si PR existe (ouverte ou mergee)
47
- PR_EXISTS=$(gh pr list --head "$BRANCH" --json number --jq '.[0]')
48
-
49
- if [ -z "$PR_EXISTS" ]; then
50
- # Pas de PR → candidat
51
- # Compter les commits
52
- if [[ "$BRANCH" == hotfix/* || "$BRANCH" == release/* ]]; then
53
- BASE="main"
54
- else
55
- BASE="develop"
56
- fi
57
- COMMITS=$(git rev-list --count origin/$BASE..origin/$BRANCH 2>/dev/null || echo "0")
58
-
59
- if [ "$COMMITS" -gt 0 ]; then
60
- NEEDS_PR+=("$BRANCH|$COMMITS|$BASE")
61
- fi
62
- fi
63
- done
64
- fi
65
- ```
66
-
67
- ### 0.3 Afficher le tableau des branches sans PR
68
-
69
- ```
70
- ================================================================================
71
- GITFLOW PULL-REQUEST - SCAN DES BRANCHES
72
- ================================================================================
73
-
74
- 📋 BRANCHES SANS PR (action recommandee):
75
- ┌─────────────────────────────┬───────────┬──────────┬───────────┬─────────────┐
76
- Branche │ Type │ Commits │ Cible │ Prete? │
77
- ├─────────────────────────────┼───────────┼──────────┼───────────┼─────────────┤
78
- feature/add-user-auth │ feature │ 5 │ develop │ ✅ Oui │
79
- │ feature/wip-refactor │ feature │ 2 │ develop │ ⚠️ Build? │
80
- │ hotfix/fix-login │ hotfix │ 1 │ main │ ✅ Oui │
81
- release/v1.5.0 │ release │ 8 │ main │ ✅ Oui │
82
- └─────────────────────────────┴───────────┴──────────┴───────────┴─────────────┘
83
-
84
- BRANCHES AVEC PR OUVERTE:
85
- ┌─────────────────────────────┬───────────┬────────────┬────────────────────────┐
86
- │ Branche │ Type │ PR # │ Statut │
87
- ├─────────────────────────────┼───────────┼────────────┼────────────────────────┤
88
- │ feature/add-orders │ feature │ #43 │ Review en cours │
89
- └─────────────────────────────┴───────────┴────────────┴────────────────────────┘
90
-
91
- ================================================================================
92
- ```
93
-
94
- ### 0.4 Proposition interactive (si SCAN_MODE)
95
-
96
- ```javascript
97
- if (NEEDS_PR.length > 0) {
98
- // Trier par priorite: hotfixes > releases > features
99
- const sorted = NEEDS_PR.sort((a, b) => {
100
- const priority = { 'hotfix': 0, 'release': 1, 'feature': 2 }
101
- return priority[getType(a)] - priority[getType(b)]
102
- })
103
-
104
- AskUserQuestion({
105
- questions: [{
106
- question: "Pour quelle branche voulez-vous creer une PR ?",
107
- header: "PR",
108
- options: sorted.map(item => {
109
- const [branch, commits, target] = item.split('|')
110
- return {
111
- label: branch,
112
- description: `${commits} commits ${target} (${getType(branch)})`
113
- }
114
- }),
115
- multiSelect: false
116
- }]
117
- })
118
-
119
- // Switcher vers la branche selectionnee
120
- // git checkout $SELECTED_BRANCH
121
- // Puis continuer avec le workflow normal
122
- } else {
123
- console.log("✅ Toutes les branches ont deja une PR!")
124
- console.log("")
125
- console.log("Actions disponibles:")
126
- console.log(" - Voir les PRs: gh pr list")
127
- console.log(" - Merger une PR: /gitflow:9-merge <numero>")
128
- console.log(" - Finaliser: /gitflow:11-finish")
129
- exit(0)
130
- }
131
- ```
132
-
133
- ---
134
-
135
- ## Pre-checks obligatoires
136
-
137
- ### 1. Validation branche et detection cible
138
-
139
- ```bash
140
- # Branche courante (ou selectionnee depuis scan)
141
- CURRENT=$(git rev-parse --abbrev-ref HEAD)
142
-
143
- # Verifier que ce n'est pas main/develop (sauf si scan mode a selectionne une branche)
144
- if [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]]; then
145
- if [ "$SCAN_MODE" = true ] && [ -n "$SELECTED_BRANCH" ]; then
146
- # On a selectionne une branche depuis le scan, switcher
147
- git checkout "$SELECTED_BRANCH"
148
- CURRENT="$SELECTED_BRANCH"
149
- else
150
- echo "⚠️ Vous etes sur '$CURRENT' - impossible de creer une PR depuis cette branche."
151
- echo ""
152
- echo "→ Utilisez cette commande depuis une branche feature/release/hotfix"
153
- echo " ou executez-la depuis main/develop pour scanner les branches disponibles."
154
- exit 1
155
- fi
156
- fi
157
-
158
- # ============================================
159
- # DETECTION AUTOMATIQUE DE LA CIBLE
160
- # ============================================
161
- # GitFlow standard:
162
- # - feature/* develop
163
- # - release/* main (puis merge back to develop apres)
164
- # - hotfix/* → main (puis merge back to develop apres)
165
- # ============================================
166
-
167
- if [[ -n "$ARGUMENTS" && "$ARGUMENTS" != "--"* ]]; then
168
- # Cible explicite fournie par l'utilisateur
169
- TARGET="$ARGUMENTS"
170
- else
171
- # Detection automatique selon le type de branche
172
- if [[ "$CURRENT" == hotfix/* ]]; then
173
- TARGET="main"
174
- echo "Hotfix detecte → PR vers main (GitFlow standard)"
175
- elif [[ "$CURRENT" == release/* ]]; then
176
- TARGET="main"
177
- echo "Release detectee → PR vers main (GitFlow standard)"
178
- else
179
- TARGET="develop"
180
- echo "Feature/autre → PR vers develop"
181
- fi
182
- fi
183
-
184
- echo "Cible: $TARGET"
185
- ```
186
-
187
- **Cibles par defaut (GitFlow standard):**
188
-
189
- | Type branche | Cible PR | Raison |
190
- |--------------|----------|--------|
191
- | `feature/*` | `develop` | Features integrees sur develop |
192
- | `release/*` | `main` | Releases deployees sur main |
193
- | `hotfix/*` | `main` | Hotfixes appliques sur main d'abord |
194
-
195
- ### 2. Synchronisation
196
-
197
- | Check | Commande | Action si echec |
198
- |-------|----------|-----------------|
199
- | Fetch | `git fetch origin` | - |
200
- | A jour vs target | `git rev-list --count HEAD..origin/{target}` | `git rebase origin/{target}` |
201
- | Pas de conflits | `git merge-tree` | Resoudre conflits d'abord |
202
-
203
- ### 3. Qualite code
204
-
205
- | Check | Commande | Bloquant |
206
- |-------|----------|----------|
207
- | Build | `dotnet build` | OUI |
208
- | Tests | `dotnet test` | OUI |
209
- | Format | `dotnet format --verify-no-changes` | NON (warning) |
210
-
211
- ### 4. EF Core (si applicable)
212
-
213
- | Check | Validation |
214
- |-------|------------|
215
- | Migrations completes | 3 fichiers (Migration + Designer + ModelSnapshot) |
216
- | Build avec migrations | `dotnet ef migrations script --idempotent` |
217
- | Pas de pending | Toutes migrations commitees |
218
-
219
- ---
220
-
221
- ## Generation PR
222
-
223
- ### Titre automatique
224
-
225
- | Type branche | Format titre |
226
- |--------------|--------------|
227
- | `feature/*` | `feat: {description from branch name}` |
228
- | `hotfix/*` | `fix: {description from branch name}` |
229
- | `release/*` | `release: v{version}` |
230
- | Autre | `{branch name}` |
231
-
232
- **Extraction description:**
233
- ```
234
- feature/add-user-authentication "add user authentication"
235
- hotfix/fix-login-bug "fix login bug"
236
- ```
237
-
238
- ### Description automatique
239
-
240
- ```markdown
241
- ## Summary
242
-
243
- {Liste des commits depuis divergence avec develop}
244
-
245
- ## Changes
246
-
247
- - {Fichiers modifies groupes par type}
248
-
249
- ## Checklist
250
-
251
- - [ ] Tests ajoutés/mis à jour
252
- - [ ] Documentation mise à jour
253
- - [ ] Breaking changes documentés
254
- - [ ] Migration EF Core testée (si applicable)
255
-
256
- ## EF Core Migrations
257
-
258
- {Liste des migrations incluses, ou "Aucune migration"}
259
-
260
- ---
261
- 🤖 Generated with GitFlow
262
- ```
263
-
264
- ### Labels automatiques
265
-
266
- | Condition | Label |
267
- |-----------|-------|
268
- | `feature/*` | `enhancement` |
269
- | `hotfix/*` | `bug` |
270
- | `release/*` | `release` |
271
- | Contient migrations | `database` |
272
- | Tests modifies | `tests` |
273
-
274
- ---
275
-
276
- ## Execution
277
-
278
- ```bash
279
- gh pr create \
280
- --base {target} \
281
- --title "{titre}" \
282
- --body "{description}" \
283
- --label "{labels}" \
284
- --assignee "@me"
285
- ```
286
-
287
- ### Options supplementaires
288
-
289
- | Option | Condition | Action |
290
- |--------|-----------|--------|
291
- | `--draft` | Si WIP dans titre | Creer comme draft |
292
- | `--reviewer` | Si configure dans config.json | Ajouter reviewers |
293
- | `--milestone` | Si release | Associer milestone |
294
-
295
- ---
296
-
297
- ## Post-creation
298
-
299
- 1. Afficher URL de la PR
300
- 2. Afficher checklist restante
301
- 3. Suggerer `/gitflow:8-review` pour auto-review
302
-
303
- ---
304
-
305
- ## Resume
306
-
307
- ```
308
- PULL REQUEST CREEE
309
- ────────────────────────────────
310
- PR: #{number}
311
- Titre: {titre}
312
- Base: {target} ← {current}
313
- URL: {url}
314
-
315
- Checks:
316
- Build: ✓/✗
317
- Tests: ✓/✗
318
- EF Core: ✓/✗/N/A
319
- Conflicts: ✓/✗
320
-
321
- Labels: {labels}
322
- ────────────────────────────────
323
- Prochain: /gitflow:8-review #{number}
324
- ```
325
-
326
- ---
327
-
328
- ## Erreurs courantes
329
-
330
- | Erreur | Solution |
331
- |--------|----------|
332
- | "No commits between" | Verifier que branche a des commits |
333
- | "Merge conflict" | `git rebase origin/{target}` + resoudre |
334
- | "Build failed" | Corriger erreurs avant PR |
335
- | "PR already exists" | Afficher URL existante |
336
-
337
- ## Modes
338
-
339
- | Commande | Action |
340
- |----------|--------|
341
- | `/gitflow:7-pull-request` | PR vers cible auto-detectee (feature→develop, hotfix/release→main) |
342
- | `/gitflow:7-pull-request develop` | PR vers develop (override) |
343
- | `/gitflow:7-pull-request main` | PR vers main (override) |
344
- | `/gitflow:7-pull-request --draft` | PR en draft |
345
- | `/gitflow:7-pull-request --dry-run` | Simulation |
346
-
347
- **Detection automatique de la cible:**
348
-
349
- ```
350
- feature/* → develop (integration continue)
351
- release/* → main (deploiement production)
352
- hotfix/* → main (correction urgente production)
353
- ```
354
-
355
- > **Note:** Le merge back vers develop est gere par `/gitflow:11-finish` apres le merge de la PR.
1
+ ---
2
+ description: Phase 7 - Create Pull Request with auto-generated description and checks
3
+ agent: gitflow-pr
4
+ model: haiku
5
+ ---
6
+
7
+ # Phase 7: PULL-REQUEST - Creation PR avec checks
8
+
9
+ Tu es expert GitFlow. Cree une Pull Request avec validation complete.
10
+
11
+ **Argument:** `$ARGUMENTS` = branche cible (optionnel, **SCAN AUTOMATIQUE** si sur main/develop)
12
+
13
+ ---
14
+
15
+ ## ETAPE 0: DETECTION DU PROVIDER GIT
16
+
17
+ > **CRITIQUE:** Detecter si le remote est GitHub ou Azure DevOps pour utiliser le bon CLI.
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
+ ```
71
+
72
+ ---
73
+
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
79
+
80
+ ```bash
81
+ CURRENT=$(git rev-parse --abbrev-ref HEAD)
82
+
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
+ if [ "$SCAN_MODE" = true ]; then
95
+ 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
126
+ done
127
+ fi
128
+ ```
129
+
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
+ ```
199
+
200
+ ---
201
+
202
+ ## Pre-checks obligatoires
203
+
204
+ ### 1. Validation branche et detection cible
205
+
206
+ ```bash
207
+ # Branche courante (ou selectionnee depuis scan)
208
+ CURRENT=$(git rev-parse --abbrev-ref HEAD)
209
+
210
+ # Verifier que ce n'est pas main/develop (sauf si scan mode a selectionne une branche)
211
+ if [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]]; then
212
+ if [ "$SCAN_MODE" = true ] && [ -n "$SELECTED_BRANCH" ]; then
213
+ # On a selectionne une branche depuis le scan, switcher
214
+ git checkout "$SELECTED_BRANCH"
215
+ CURRENT="$SELECTED_BRANCH"
216
+ else
217
+ echo "⚠️ Vous etes sur '$CURRENT' - impossible de creer une PR depuis cette branche."
218
+ echo ""
219
+ echo "→ Utilisez cette commande depuis une branche feature/release/hotfix"
220
+ echo " ou executez-la depuis main/develop pour scanner les branches disponibles."
221
+ exit 1
222
+ fi
223
+ fi
224
+
225
+ # ============================================
226
+ # DETECTION AUTOMATIQUE DE LA CIBLE
227
+ # ============================================
228
+ # GitFlow standard:
229
+ # - feature/* develop
230
+ # - release/* main (puis merge back to develop apres)
231
+ # - hotfix/* → main (puis merge back to develop apres)
232
+ # ============================================
233
+
234
+ if [[ -n "$ARGUMENTS" && "$ARGUMENTS" != "--"* ]]; then
235
+ # Cible explicite fournie par l'utilisateur
236
+ TARGET="$ARGUMENTS"
237
+ else
238
+ # Detection automatique selon le type de branche
239
+ if [[ "$CURRENT" == hotfix/* ]]; then
240
+ TARGET="main"
241
+ echo "Hotfix detecte → PR vers main (GitFlow standard)"
242
+ elif [[ "$CURRENT" == release/* ]]; then
243
+ TARGET="main"
244
+ echo "Release detectee → PR vers main (GitFlow standard)"
245
+ else
246
+ TARGET="develop"
247
+ echo "Feature/autre PR vers develop"
248
+ fi
249
+ fi
250
+
251
+ echo "Cible: $TARGET"
252
+ ```
253
+
254
+ **Cibles par defaut (GitFlow standard):**
255
+
256
+ | Type branche | Cible PR | Raison |
257
+ |--------------|----------|--------|
258
+ | `feature/*` | `develop` | Features integrees sur develop |
259
+ | `release/*` | `main` | Releases deployees sur main |
260
+ | `hotfix/*` | `main` | Hotfixes appliques sur main d'abord |
261
+
262
+ ### 2. Synchronisation
263
+
264
+ | Check | Commande | Action si echec |
265
+ |-------|----------|-----------------|
266
+ | Fetch | `git fetch origin` | - |
267
+ | A jour vs target | `git rev-list --count HEAD..origin/{target}` | `git rebase origin/{target}` |
268
+ | Pas de conflits | `git merge-tree` | Resoudre conflits d'abord |
269
+
270
+ ### 3. Qualite code
271
+
272
+ | Check | Commande | Bloquant |
273
+ |-------|----------|----------|
274
+ | Build | `dotnet build` | OUI |
275
+ | Tests | `dotnet test` | OUI |
276
+ | Format | `dotnet format --verify-no-changes` | NON (warning) |
277
+
278
+ ### 4. EF Core (si applicable)
279
+
280
+ | Check | Validation |
281
+ |-------|------------|
282
+ | Migrations completes | 3 fichiers (Migration + Designer + ModelSnapshot) |
283
+ | Build avec migrations | `dotnet ef migrations script --idempotent` |
284
+ | Pas de pending | Toutes migrations commitees |
285
+
286
+ ---
287
+
288
+ ## Generation PR
289
+
290
+ ### Titre automatique
291
+
292
+ | Type branche | Format titre |
293
+ |--------------|--------------|
294
+ | `feature/*` | `feat: {description from branch name}` |
295
+ | `hotfix/*` | `fix: {description from branch name}` |
296
+ | `release/*` | `release: v{version}` |
297
+ | Autre | `{branch name}` |
298
+
299
+ **Extraction description:**
300
+ ```
301
+ feature/add-user-authentication "add user authentication"
302
+ hotfix/fix-login-bug → "fix login bug"
303
+ ```
304
+
305
+ ### Description automatique
306
+
307
+ ```markdown
308
+ ## Summary
309
+
310
+ {Liste des commits depuis divergence avec develop}
311
+
312
+ ## Changes
313
+
314
+ - {Fichiers modifies groupes par type}
315
+
316
+ ## Checklist
317
+
318
+ - [ ] Tests ajoutés/mis à jour
319
+ - [ ] Documentation mise à jour
320
+ - [ ] Breaking changes documentés
321
+ - [ ] Migration EF Core testée (si applicable)
322
+
323
+ ## EF Core Migrations
324
+
325
+ {Liste des migrations incluses, ou "Aucune migration"}
326
+
327
+ ---
328
+ 🤖 Generated with GitFlow
329
+ ```
330
+
331
+ ### Labels automatiques
332
+
333
+ | Condition | Label |
334
+ |-----------|-------|
335
+ | `feature/*` | `enhancement` |
336
+ | `hotfix/*` | `bug` |
337
+ | `release/*` | `release` |
338
+ | Contient migrations | `database` |
339
+ | Tests modifies | `tests` |
340
+
341
+ ---
342
+
343
+ ## Execution
344
+
345
+ ### Pour GitHub
346
+
347
+ ```bash
348
+ if [ "$GIT_PROVIDER" = "github" ]; then
349
+ gh pr create \
350
+ --base {target} \
351
+ --title "{titre}" \
352
+ --body "{description}" \
353
+ --label "{labels}" \
354
+ --assignee "@me"
355
+ fi
356
+ ```
357
+
358
+ ### Pour Azure DevOps
359
+
360
+ ```bash
361
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
362
+ az repos pr create \
363
+ --repository "$AZURE_REPO" \
364
+ --source-branch "$CURRENT" \
365
+ --target-branch "{target}" \
366
+ --title "{titre}" \
367
+ --description "{description}" \
368
+ --organization "https://dev.azure.com/$AZURE_ORG" \
369
+ --project "$AZURE_PROJECT"
370
+ fi
371
+ ```
372
+
373
+ > **Note Azure DevOps:** Les labels et assignees ne sont pas supportes via CLI. Ajoutez-les manuellement via l'interface web si necessaire.
374
+
375
+ ### Options supplementaires
376
+
377
+ | Option | Condition | GitHub | Azure DevOps |
378
+ |--------|-----------|--------|--------------|
379
+ | Draft | Si WIP dans titre | `--draft` | `--draft` |
380
+ | Reviewer | Si configure | `--reviewer` | Non supporte CLI |
381
+ | Milestone | Si release | `--milestone` | Non supporte CLI |
382
+
383
+ ---
384
+
385
+ ## Post-creation
386
+
387
+ 1. Afficher URL de la PR
388
+ 2. Afficher checklist restante
389
+ 3. Suggerer `/gitflow:8-review` pour auto-review
390
+
391
+ ---
392
+
393
+ ## Resume
394
+
395
+ ```
396
+ PULL REQUEST CREEE
397
+ ────────────────────────────────
398
+ PR: #{number}
399
+ Titre: {titre}
400
+ Base: {target} ← {current}
401
+ URL: {url}
402
+
403
+ Checks:
404
+ Build: ✓/✗
405
+ Tests: ✓/✗
406
+ EF Core: ✓/✗/N/A
407
+ Conflicts: ✓/✗
408
+
409
+ Labels: {labels}
410
+ ────────────────────────────────
411
+ Prochain: /gitflow:8-review #{number}
412
+ ```
413
+
414
+ ---
415
+
416
+ ## Erreurs courantes
417
+
418
+ | Erreur | Solution |
419
+ |--------|----------|
420
+ | "No commits between" | Verifier que branche a des commits |
421
+ | "Merge conflict" | `git rebase origin/{target}` + resoudre |
422
+ | "Build failed" | Corriger erreurs avant PR |
423
+ | "PR already exists" | Afficher URL existante |
424
+ | "az: command not found" | Installer Azure CLI: `winget install Microsoft.AzureCLI` |
425
+ | "gh: command not found" | Installer GitHub CLI: https://cli.github.com |
426
+ | "Please run 'az login'" | Authentification requise: `az login` |
427
+
428
+ ## Providers supportes
429
+
430
+ | Provider | CLI | Detection URL |
431
+ |----------|-----|---------------|
432
+ | **GitHub** | `gh` | `github.com` |
433
+ | **Azure DevOps** | `az repos` | `dev.azure.com` ou `visualstudio.com` |
434
+
435
+ ## Modes
436
+
437
+ | Commande | Action |
438
+ |----------|--------|
439
+ | `/gitflow:7-pull-request` | PR vers cible auto-detectee (feature→develop, hotfix/release→main) |
440
+ | `/gitflow:7-pull-request develop` | PR vers develop (override) |
441
+ | `/gitflow:7-pull-request main` | PR vers main (override) |
442
+ | `/gitflow:7-pull-request --draft` | PR en draft |
443
+ | `/gitflow:7-pull-request --dry-run` | Simulation |
444
+
445
+ **Detection automatique de la cible:**
446
+
447
+ ```
448
+ feature/* → develop (integration continue)
449
+ release/* → main (deploiement production)
450
+ hotfix/* → main (correction urgente production)
451
+ ```
452
+
453
+ > **Note:** Le merge back vers develop est gere par `/gitflow:11-finish` apres le merge de la PR.