@atlashub/smartstack-cli 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/.documentation/agents.html +920 -916
  2. package/.documentation/apex.html +1022 -1018
  3. package/.documentation/business-analyse.html +1505 -1501
  4. package/.documentation/commands.html +684 -680
  5. package/.documentation/css/styles.css +2168 -2168
  6. package/.documentation/efcore.html +2509 -2505
  7. package/.documentation/gitflow.html +2622 -2618
  8. package/.documentation/hooks.html +417 -413
  9. package/.documentation/index.html +327 -323
  10. package/.documentation/init.html +565 -0
  11. package/.documentation/installation.html +548 -462
  12. package/.documentation/js/app.js +794 -794
  13. package/.documentation/ralph-loop.html +534 -530
  14. package/.documentation/test-web.html +517 -513
  15. package/config/default-config.json +86 -86
  16. package/config/settings.json +53 -53
  17. package/config/settings.local.example.json +16 -16
  18. package/dist/index.js +18 -8
  19. package/dist/index.js.map +1 -1
  20. package/package.json +88 -88
  21. package/templates/agents/action.md +36 -36
  22. package/templates/agents/efcore/conflicts.md +84 -84
  23. package/templates/agents/efcore/db-deploy.md +51 -51
  24. package/templates/agents/efcore/db-reset.md +59 -59
  25. package/templates/agents/efcore/db-seed.md +56 -56
  26. package/templates/agents/efcore/db-status.md +64 -64
  27. package/templates/agents/efcore/migration.md +85 -85
  28. package/templates/agents/efcore/rebase-snapshot.md +62 -62
  29. package/templates/agents/efcore/scan.md +90 -90
  30. package/templates/agents/efcore/squash.md +67 -67
  31. package/templates/agents/explore-codebase.md +65 -65
  32. package/templates/agents/explore-docs.md +97 -97
  33. package/templates/agents/fix-grammar.md +49 -49
  34. package/templates/agents/gitflow/abort.md +45 -45
  35. package/templates/agents/gitflow/cleanup.md +85 -85
  36. package/templates/agents/gitflow/commit.md +40 -40
  37. package/templates/agents/gitflow/exec.md +48 -48
  38. package/templates/agents/gitflow/finish.md +92 -92
  39. package/templates/agents/gitflow/init.md +139 -139
  40. package/templates/agents/gitflow/merge.md +62 -62
  41. package/templates/agents/gitflow/plan.md +42 -42
  42. package/templates/agents/gitflow/pr.md +78 -78
  43. package/templates/agents/gitflow/review.md +49 -49
  44. package/templates/agents/gitflow/start.md +61 -61
  45. package/templates/agents/gitflow/status.md +32 -32
  46. package/templates/agents/snipper.md +36 -36
  47. package/templates/agents/websearch.md +46 -46
  48. package/templates/commands/_resources/formatting-guide.md +124 -124
  49. package/templates/commands/ai-prompt.md +315 -315
  50. package/templates/commands/apex/1-analyze.md +100 -100
  51. package/templates/commands/apex/2-plan.md +145 -145
  52. package/templates/commands/apex/3-execute.md +171 -171
  53. package/templates/commands/apex/4-examine.md +116 -116
  54. package/templates/commands/apex/5-tasks.md +209 -209
  55. package/templates/commands/apex.md +76 -76
  56. package/templates/commands/application/create.md +362 -362
  57. package/templates/commands/application/templates-backend.md +463 -463
  58. package/templates/commands/application/templates-frontend.md +517 -517
  59. package/templates/commands/application/templates-i18n.md +478 -478
  60. package/templates/commands/application/templates-seed.md +362 -362
  61. package/templates/commands/application.md +303 -303
  62. package/templates/commands/business-analyse/0-orchestrate.md +640 -640
  63. package/templates/commands/business-analyse/1-init.md +269 -269
  64. package/templates/commands/business-analyse/2-discover.md +520 -520
  65. package/templates/commands/business-analyse/3-analyse.md +408 -408
  66. package/templates/commands/business-analyse/4-specify.md +598 -598
  67. package/templates/commands/business-analyse/5-validate.md +326 -326
  68. package/templates/commands/business-analyse/6-handoff.md +746 -746
  69. package/templates/commands/business-analyse/7-doc-html.md +602 -602
  70. package/templates/commands/business-analyse/bug.md +325 -325
  71. package/templates/commands/business-analyse/change-request.md +368 -368
  72. package/templates/commands/business-analyse/hotfix.md +200 -200
  73. package/templates/commands/business-analyse.md +640 -640
  74. package/templates/commands/controller/create.md +216 -216
  75. package/templates/commands/controller/postman-templates.md +528 -528
  76. package/templates/commands/controller/templates.md +600 -600
  77. package/templates/commands/controller.md +337 -337
  78. package/templates/commands/create/agent.md +138 -138
  79. package/templates/commands/create/command.md +166 -166
  80. package/templates/commands/create/hook.md +234 -234
  81. package/templates/commands/create/plugin.md +329 -329
  82. package/templates/commands/create/project.md +507 -507
  83. package/templates/commands/create/skill.md +199 -199
  84. package/templates/commands/create.md +220 -220
  85. package/templates/commands/debug.md +95 -95
  86. package/templates/commands/documentation/module.md +202 -202
  87. package/templates/commands/documentation/templates.md +432 -432
  88. package/templates/commands/documentation.md +190 -190
  89. package/templates/commands/efcore/_env-check.md +153 -153
  90. package/templates/commands/efcore/conflicts.md +186 -186
  91. package/templates/commands/efcore/db-deploy.md +193 -193
  92. package/templates/commands/efcore/db-reset.md +426 -426
  93. package/templates/commands/efcore/db-seed.md +326 -326
  94. package/templates/commands/efcore/db-status.md +226 -226
  95. package/templates/commands/efcore/migration.md +400 -400
  96. package/templates/commands/efcore/rebase-snapshot.md +264 -264
  97. package/templates/commands/efcore/scan.md +198 -198
  98. package/templates/commands/efcore/squash.md +298 -298
  99. package/templates/commands/efcore.md +224 -224
  100. package/templates/commands/epct.md +69 -69
  101. package/templates/commands/explain.md +186 -186
  102. package/templates/commands/explore.md +45 -45
  103. package/templates/commands/feature-full.md +267 -267
  104. package/templates/commands/gitflow/1-init.md +1038 -1038
  105. package/templates/commands/gitflow/10-start.md +768 -768
  106. package/templates/commands/gitflow/11-finish.md +457 -457
  107. package/templates/commands/gitflow/12-cleanup.md +276 -276
  108. package/templates/commands/gitflow/13-sync.md +216 -216
  109. package/templates/commands/gitflow/14-rebase.md +251 -251
  110. package/templates/commands/gitflow/2-status.md +277 -277
  111. package/templates/commands/gitflow/3-commit.md +344 -344
  112. package/templates/commands/gitflow/4-plan.md +145 -145
  113. package/templates/commands/gitflow/5-exec.md +147 -147
  114. package/templates/commands/gitflow/6-abort.md +344 -344
  115. package/templates/commands/gitflow/7-pull-request.md +453 -355
  116. package/templates/commands/gitflow/8-review.md +240 -176
  117. package/templates/commands/gitflow/9-merge.md +451 -365
  118. package/templates/commands/gitflow.md +128 -128
  119. package/templates/commands/implement.md +663 -663
  120. package/templates/commands/init.md +567 -562
  121. package/templates/commands/mcp-integration.md +330 -330
  122. package/templates/commands/notification.md +129 -129
  123. package/templates/commands/oneshot.md +57 -57
  124. package/templates/commands/quick-search.md +72 -72
  125. package/templates/commands/ralph-loop/cancel-ralph.md +18 -18
  126. package/templates/commands/ralph-loop/help.md +126 -126
  127. package/templates/commands/ralph-loop/ralph-loop.md +18 -18
  128. package/templates/commands/review.md +106 -106
  129. package/templates/commands/utils/test-web-config.md +160 -160
  130. package/templates/commands/utils/test-web.md +151 -151
  131. package/templates/commands/validate.md +233 -233
  132. package/templates/commands/workflow.md +193 -193
  133. package/templates/gitflow/config.json +138 -138
  134. package/templates/hooks/ef-migration-check.md +139 -139
  135. package/templates/hooks/hooks.json +25 -25
  136. package/templates/hooks/stop-hook.sh +177 -177
  137. package/templates/skills/ai-prompt/SKILL.md +778 -778
  138. package/templates/skills/application/SKILL.md +563 -563
  139. package/templates/skills/application/templates-backend.md +450 -450
  140. package/templates/skills/application/templates-frontend.md +531 -531
  141. package/templates/skills/application/templates-i18n.md +520 -520
  142. package/templates/skills/application/templates-seed.md +647 -647
  143. package/templates/skills/business-analyse/SKILL.md +191 -191
  144. package/templates/skills/business-analyse/questionnaire.md +283 -283
  145. package/templates/skills/business-analyse/templates-frd.md +477 -477
  146. package/templates/skills/business-analyse/templates-react.md +580 -580
  147. package/templates/skills/controller/SKILL.md +240 -240
  148. package/templates/skills/controller/postman-templates.md +614 -614
  149. package/templates/skills/controller/templates.md +1468 -1468
  150. package/templates/skills/documentation/SKILL.md +133 -133
  151. package/templates/skills/documentation/templates.md +476 -476
  152. package/templates/skills/feature-full/SKILL.md +838 -838
  153. package/templates/skills/notification/SKILL.md +555 -555
  154. package/templates/skills/ui-components/SKILL.md +870 -870
  155. package/templates/skills/workflow/SKILL.md +582 -582
  156. package/templates/test-web/api-health.json +38 -38
  157. package/templates/test-web/minimal.json +19 -19
  158. package/templates/test-web/npm-package.json +46 -46
  159. package/templates/test-web/seo-check.json +54 -54
@@ -1,365 +1,451 @@
1
- ---
2
- description: Phase 9 - Merge Pull Request with all checks validated
3
- agent: gitflow-merge
4
- model: sonnet
5
- ---
6
-
7
- # Phase 9: MERGE - Merge PR avec validation complete
8
-
9
- Tu es expert GitFlow. Execute le merge avec tous les checks de securite.
10
-
11
- **Argument:** `$ARGUMENTS` = numero PR (optionnel, **SCAN AUTOMATIQUE** si absent)
12
-
13
- ---
14
-
15
- ## ETAPE 0: SCAN PROACTIF (si pas d'argument)
16
-
17
- > **COMPORTEMENT PROACTIF:** Si aucun numero de PR fourni, scanner TOUTES les PRs ouvertes pour proposer celles qui sont pretes a merger.
18
-
19
- ### 0.1 Scanner les PRs ouvertes
20
-
21
- ```bash
22
- # Lister toutes les PRs ouvertes avec leur statut
23
- gh pr list --state open --json number,title,headRefName,mergeable,reviewDecision,statusCheckRollup \
24
- --jq '.[] | {
25
- number: .number,
26
- title: .title,
27
- branch: .headRefName,
28
- mergeable: .mergeable,
29
- review: .reviewDecision,
30
- checks: (.statusCheckRollup | if . then (map(select(.conclusion == "SUCCESS")) | length) else 0 end)
31
- }'
32
- ```
33
-
34
- ### 0.2 Categoriser les PRs
35
-
36
- ```bash
37
- for PR in $ALL_PRS; do
38
- # Extraire les infos
39
- NUMBER=$(echo "$PR" | jq -r '.number')
40
- MERGEABLE=$(echo "$PR" | jq -r '.mergeable')
41
- REVIEW=$(echo "$PR" | jq -r '.review')
42
- CHECKS_OK=$(echo "$PR" | jq -r '.checks')
43
-
44
- # Categoriser
45
- if [[ "$MERGEABLE" == "MERGEABLE" && "$REVIEW" == "APPROVED" ]]; then
46
- READY_TO_MERGE+=("$PR")
47
- elif [[ "$REVIEW" == "CHANGES_REQUESTED" ]]; then
48
- NEEDS_CHANGES+=("$PR")
49
- elif [[ "$REVIEW" != "APPROVED" ]]; then
50
- NEEDS_REVIEW+=("$PR")
51
- elif [[ "$MERGEABLE" != "MERGEABLE" ]]; then
52
- HAS_CONFLICTS+=("$PR")
53
- else
54
- WAITING_CI+=("$PR")
55
- fi
56
- done
57
- ```
58
-
59
- ### 0.3 Afficher le tableau des PRs
60
-
61
- ```
62
- ================================================================================
63
- GITFLOW MERGE - SCAN DES PULL REQUESTS
64
- ================================================================================
65
-
66
- PRETES A MERGER (approuvees + CI vert):
67
- ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
68
- │ PR # │ Titre │ Branche │ Reviews │
69
- ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
70
- │ #42 │ feat: add user auth │ feature/user-auth │ 2 approvals │
71
- #45 │ release: v1.5.0 │ release/v1.5.0 │ 1 approval │
72
- └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
73
-
74
- EN ATTENTE DE REVIEW:
75
- ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
76
- PR # │ Titre │ Branche │ Statut │
77
- ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
78
- #43 │ feat: add orders │ feature/add-orders │ Awaiting review
79
- └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
80
-
81
- ⚠️ CHANGEMENTS DEMANDES:
82
- ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
83
- PR # │ Titre │ Branche │ Reviewer │
84
- ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
85
- │ #44 │ fix: login bug │ hotfix/login │ @john requested │
86
- └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
87
-
88
- CONFLITS A RESOUDRE:
89
- ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
90
- │ PR # │ Titre │ Branche │ Action │
91
- ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
92
- │ #46 │ feat: refactor api │ feature/refactor │ Rebase requis │
93
- └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
94
-
95
- ================================================================================
96
- ```
97
-
98
- ### 0.4 Proposition interactive
99
-
100
- ```javascript
101
- if (READY_TO_MERGE.length > 0) {
102
- // Trier par priorite: hotfixes > releases > features
103
- const sorted = READY_TO_MERGE.sort((a, b) => {
104
- const priority = { 'hotfix': 0, 'release': 1, 'feature': 2 }
105
- return priority[getType(a.branch)] - priority[getType(b.branch)]
106
- })
107
-
108
- AskUserQuestion({
109
- questions: [{
110
- question: "Quelle PR voulez-vous merger ?",
111
- header: "Merge",
112
- options: sorted.map(pr => ({
113
- label: `#${pr.number}`,
114
- description: `${pr.title} (${pr.branch})`
115
- })).concat([{
116
- label: "Toutes",
117
- description: "Merger toutes les PRs pretes (dans l'ordre recommande)"
118
- }]),
119
- multiSelect: false
120
- }]
121
- })
122
- } else if (NEEDS_REVIEW.length > 0 || NEEDS_CHANGES.length > 0) {
123
- console.log("❌ Aucune PR prete a merger.")
124
- console.log("")
125
- if (NEEDS_REVIEW.length > 0) {
126
- console.log("→ PRs en attente de review: " + NEEDS_REVIEW.map(p => '#'+p.number).join(', '))
127
- console.log(" Demandez une review ou utilisez: /gitflow:8-review <numero>")
128
- }
129
- if (NEEDS_CHANGES.length > 0) {
130
- console.log("→ PRs avec changements demandes: " + NEEDS_CHANGES.map(p => '#'+p.number).join(', '))
131
- console.log(" Adressez le feedback puis re-demandez une review")
132
- }
133
- if (HAS_CONFLICTS.length > 0) {
134
- console.log("→ PRs avec conflits: " + HAS_CONFLICTS.map(p => '#'+p.number).join(', '))
135
- console.log(" Resolvez les conflits avec: git rebase origin/<target>")
136
- }
137
- exit(1)
138
- } else {
139
- console.log("✅ Aucune PR ouverte!")
140
- console.log("→ Creez une PR avec: /gitflow:7-pull-request")
141
- exit(0)
142
- }
143
- ```
144
-
145
- ### 0.5 Ordre recommande pour "Toutes"
146
-
147
- ```
148
- ORDRE DE MERGE RECOMMANDE:
149
- 1. Hotfixes (urgents, patches production)
150
- 2. Releases (vers main, puis merge back)
151
- 3. Features (par date de creation, plus anciennes d'abord)
152
- ```
153
-
154
- ---
155
-
156
- ## Pre-merge checks
157
-
158
- ### 1. Status PR
159
-
160
- ```bash
161
- gh pr view {number} --json state,mergeable,mergeStateStatus,reviews,checks
162
- ```
163
-
164
- | Check | Requis | Action si echec |
165
- |-------|--------|-----------------|
166
- | State = OPEN | OUI | "PR deja mergee ou fermee" |
167
- | Mergeable = true | OUI | "Resoudre conflits d'abord" |
168
- | MergeStateStatus = CLEAN | OUI | Attendre CI ou resoudre |
169
-
170
- ### 2. Reviews
171
-
172
- | Check | Condition | Action |
173
- |-------|-----------|--------|
174
- | Min approvals | Config: `minReviewers` | Attendre reviews |
175
- | No changes requested | Aucun "Request changes" actif | Resoudre feedback |
176
- | Required reviewers | Si configure | Verifier presence |
177
-
178
- ```bash
179
- # Verifier reviews
180
- gh pr view {number} --json reviews --jq '.reviews[] | select(.state=="APPROVED")'
181
- ```
182
-
183
- ### 3. CI/CD Checks
184
-
185
- ```bash
186
- gh pr checks {number}
187
- ```
188
-
189
- | Status | Action |
190
- |--------|--------|
191
- | Tous ✓ | Continuer |
192
- | En cours | Attendre |
193
- | Echec | BLOQUER - afficher details |
194
-
195
- ### 4. Branch Protection
196
-
197
- | Rule | Verification |
198
- |------|--------------|
199
- | Up-to-date | `git rev-list --count HEAD..origin/{base}` = 0 |
200
- | Linear history | Si requis, rebase avant merge |
201
- | Signed commits | Si requis, verifier signatures |
202
-
203
- ---
204
-
205
- ## EF Core Pre-merge (si applicable)
206
-
207
- ### Validation migrations
208
-
209
- ```bash
210
- # Lister migrations dans la PR
211
- git diff origin/{base}...HEAD --name-only | grep -E "Migrations/.*\.cs$"
212
- ```
213
-
214
- | Check | Validation | Bloquant |
215
- |-------|------------|----------|
216
- | Sync ModelSnapshot | Pas de conflit avec develop | OUI |
217
- | Build migrations | `dotnet ef migrations script` OK | OUI |
218
- | Pas de data loss | Scan DropTable/DropColumn | WARNING |
219
-
220
- ### Si conflit ModelSnapshot detecte
221
-
222
- ```
223
- ⚠️ CONFLIT MODELSNAPSHOT DETECTE
224
- ────────────────────────────────
225
- Le ModelSnapshot a diverge de develop.
226
-
227
- Options:
228
- 1. Rebase + recreer migration (recommande)
229
- 2. Merge manuel (risque)
230
-
231
- Commande recommandee:
232
- git rebase origin/develop
233
- dotnet ef migrations remove
234
- dotnet ef migrations add {MigrationName}
235
- ────────────────────────────────
236
- ```
237
-
238
- ---
239
-
240
- ## Execution Merge
241
-
242
- ### Strategie selon type
243
-
244
- | Type branche | Merge strategy | Options |
245
- |--------------|----------------|---------|
246
- | `feature/*` | Squash | `--squash` |
247
- | `hotfix/*` | Merge commit | `--merge` |
248
- | `release/*` | Merge commit | `--merge` |
249
-
250
- ### Commande
251
-
252
- ```bash
253
- # Squash (feature)
254
- gh pr merge {number} --squash --delete-branch
255
-
256
- # Merge commit (hotfix/release)
257
- gh pr merge {number} --merge --delete-branch
258
- ```
259
-
260
- ### Options supplementaires
261
-
262
- | Option | Condition | Action |
263
- |--------|-----------|--------|
264
- | `--auto` | CI en cours | Merge auto quand vert |
265
- | `--delete-branch` | Config autoDeleteBranch | Supprimer branche source |
266
- | `--admin` | Override protections | DANGEREUX - confirmation requise |
267
-
268
- ---
269
-
270
- ## Post-merge actions
271
-
272
- ### 1. Versioning (si release/hotfix)
273
-
274
- ```bash
275
- # Lire version actuelle
276
- VERSION=$(cat package.json | jq -r '.version')
277
-
278
- # Creer tag
279
- git tag -a "v$VERSION" -m "Release v$VERSION"
280
- git push origin "v$VERSION"
281
- ```
282
-
283
- ### 2. Changelog (optionnel)
284
-
285
- ```bash
286
- # Ajouter entree CHANGELOG
287
- echo "## v$VERSION - $(date +%Y-%m-%d)" >> CHANGELOG.md
288
- gh pr view {number} --json title,body >> CHANGELOG.md
289
- ```
290
-
291
- ### 3. Notifications (si configure)
292
-
293
- | Canal | Message |
294
- |-------|---------|
295
- | Slack | "PR #{number} merged to {base}" |
296
- | Teams | Idem |
297
- | Email | Idem |
298
-
299
- ### 4. Cleanup
300
-
301
- ```bash
302
- # Supprimer branche locale
303
- git branch -d {branch}
304
-
305
- # Fetch et prune
306
- git fetch --prune
307
- ```
308
-
309
- ---
310
-
311
- ## Resume
312
-
313
- ```
314
- MERGE COMPLETE
315
- ════════════════════════════════════════
316
- PR: #{number}
317
- Titre: {title}
318
- Base: {base}
319
- Strategy: {squash|merge}
320
-
321
- Checks passes:
322
- ✓ Reviews: {count} approvals
323
- CI: All green
324
- Conflicts: None
325
- EF Core: {OK|N/A}
326
-
327
- Post-merge:
328
- Branch deleted: {branch}
329
- Tag created: {tag|N/A}
330
-
331
- ════════════════════════════════════════
332
- ```
333
-
334
- ---
335
-
336
- ## Erreurs et recovery
337
-
338
- | Erreur | Cause | Solution |
339
- |--------|-------|----------|
340
- | "Not mergeable" | Conflits | `git rebase origin/{base}` |
341
- | "Checks failing" | CI rouge | Corriger et re-push |
342
- | "Review required" | Pas d'approval | Demander review |
343
- | "Branch protected" | Rules non respectees | Verifier requirements |
344
-
345
- ### Rollback si probleme post-merge
346
-
347
- ```bash
348
- # Identifier commit merge
349
- MERGE_COMMIT=$(git log --merges -1 --format="%H")
350
-
351
- # Revert
352
- git revert -m 1 $MERGE_COMMIT
353
- git push origin {base}
354
- ```
355
-
356
- ---
357
-
358
- ## Modes
359
-
360
- | Commande | Action |
361
- |----------|--------|
362
- | `/gitflow:9-merge 123` | Merge PR #123 |
363
- | `/gitflow:9-merge 123 --auto` | Merge auto quand CI vert |
364
- | `/gitflow:9-merge 123 --dry-run` | Simulation |
365
- | `/gitflow:9-merge 123 --admin` | Override protections (danger) |
1
+ ---
2
+ description: Phase 9 - Merge Pull Request with all checks validated
3
+ agent: gitflow-merge
4
+ model: sonnet
5
+ ---
6
+
7
+ # Phase 9: MERGE - Merge PR avec validation complete
8
+
9
+ Tu es expert GitFlow. Execute le merge avec tous les checks de securite.
10
+
11
+ **Argument:** `$ARGUMENTS` = numero PR (optionnel, **SCAN AUTOMATIQUE** si absent)
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
+ ```bash
20
+ REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
21
+
22
+ if [[ "$REMOTE_URL" == *"dev.azure.com"* ]] || [[ "$REMOTE_URL" == *"visualstudio.com"* ]]; then
23
+ GIT_PROVIDER="azuredevops"
24
+ if [[ "$REMOTE_URL" =~ dev\.azure\.com/([^/]+)/([^/]+)/_git/([^/]+) ]]; then
25
+ AZURE_ORG="${BASH_REMATCH[1]}"
26
+ AZURE_PROJECT="${BASH_REMATCH[2]}"
27
+ AZURE_REPO="${BASH_REMATCH[3]}"
28
+ fi
29
+ echo "Provider: Azure DevOps (org: $AZURE_ORG, project: $AZURE_PROJECT)"
30
+ elif [[ "$REMOTE_URL" == *"github.com"* ]]; then
31
+ GIT_PROVIDER="github"
32
+ echo "Provider: GitHub"
33
+ else
34
+ GIT_PROVIDER="unknown"
35
+ fi
36
+ ```
37
+
38
+ ---
39
+
40
+ ## ETAPE 1: SCAN PROACTIF (si pas d'argument)
41
+
42
+ > **COMPORTEMENT PROACTIF:** Si aucun numero de PR fourni, scanner TOUTES les PRs ouvertes pour proposer celles qui sont pretes a merger.
43
+
44
+ ### 1.1 Scanner les PRs ouvertes
45
+
46
+ ```bash
47
+ # Lister toutes les PRs ouvertes avec leur statut
48
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
49
+ # Azure DevOps - format different
50
+ az repos pr list \
51
+ --repository "$AZURE_REPO" \
52
+ --status active \
53
+ --organization "https://dev.azure.com/$AZURE_ORG" \
54
+ --project "$AZURE_PROJECT" \
55
+ --query "[].{number:pullRequestId, title:title, branch:sourceRefName, status:status, mergeStatus:mergeStatus}" \
56
+ -o json
57
+ else
58
+ # GitHub
59
+ gh pr list --state open --json number,title,headRefName,mergeable,reviewDecision,statusCheckRollup \
60
+ --jq '.[] | {
61
+ number: .number,
62
+ title: .title,
63
+ branch: .headRefName,
64
+ mergeable: .mergeable,
65
+ review: .reviewDecision,
66
+ checks: (.statusCheckRollup | if . then (map(select(.conclusion == "SUCCESS")) | length) else 0 end)
67
+ }'
68
+ fi
69
+ ```
70
+
71
+ ### 0.2 Categoriser les PRs
72
+
73
+ ```bash
74
+ for PR in $ALL_PRS; do
75
+ # Extraire les infos
76
+ NUMBER=$(echo "$PR" | jq -r '.number')
77
+ MERGEABLE=$(echo "$PR" | jq -r '.mergeable')
78
+ REVIEW=$(echo "$PR" | jq -r '.review')
79
+ CHECKS_OK=$(echo "$PR" | jq -r '.checks')
80
+
81
+ # Categoriser
82
+ if [[ "$MERGEABLE" == "MERGEABLE" && "$REVIEW" == "APPROVED" ]]; then
83
+ READY_TO_MERGE+=("$PR")
84
+ elif [[ "$REVIEW" == "CHANGES_REQUESTED" ]]; then
85
+ NEEDS_CHANGES+=("$PR")
86
+ elif [[ "$REVIEW" != "APPROVED" ]]; then
87
+ NEEDS_REVIEW+=("$PR")
88
+ elif [[ "$MERGEABLE" != "MERGEABLE" ]]; then
89
+ HAS_CONFLICTS+=("$PR")
90
+ else
91
+ WAITING_CI+=("$PR")
92
+ fi
93
+ done
94
+ ```
95
+
96
+ ### 0.3 Afficher le tableau des PRs
97
+
98
+ ```
99
+ ================================================================================
100
+ GITFLOW MERGE - SCAN DES PULL REQUESTS
101
+ ================================================================================
102
+
103
+ PRETES A MERGER (approuvees + CI vert):
104
+ ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
105
+ PR # │ Titre │ Branche │ Reviews │
106
+ ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
107
+ │ #42 │ feat: add user auth │ feature/user-auth │ 2 approvals │
108
+ │ #45 │ release: v1.5.0 │ release/v1.5.0 │ 1 approval │
109
+ └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
110
+
111
+ ⏳ EN ATTENTE DE REVIEW:
112
+ ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
113
+ PR # │ Titre │ Branche │ Statut │
114
+ ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
115
+ │ #43 │ feat: add orders │ feature/add-orders │ Awaiting review │
116
+ └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
117
+
118
+ ⚠️ CHANGEMENTS DEMANDES:
119
+ ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
120
+ │ PR # │ Titre │ Branche │ Reviewer │
121
+ ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
122
+ #44 │ fix: login bug │ hotfix/login │ @john requested
123
+ └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
124
+
125
+ CONFLITS A RESOUDRE:
126
+ ┌────────┬─────────────────────────────┬─────────────────────┬─────────────────┐
127
+ PR # │ Titre │ Branche │ Action │
128
+ ├────────┼─────────────────────────────┼─────────────────────┼─────────────────┤
129
+ #46 │ feat: refactor api │ feature/refactor │ Rebase requis │
130
+ └────────┴─────────────────────────────┴─────────────────────┴─────────────────┘
131
+
132
+ ================================================================================
133
+ ```
134
+
135
+ ### 0.4 Proposition interactive
136
+
137
+ ```javascript
138
+ if (READY_TO_MERGE.length > 0) {
139
+ // Trier par priorite: hotfixes > releases > features
140
+ const sorted = READY_TO_MERGE.sort((a, b) => {
141
+ const priority = { 'hotfix': 0, 'release': 1, 'feature': 2 }
142
+ return priority[getType(a.branch)] - priority[getType(b.branch)]
143
+ })
144
+
145
+ AskUserQuestion({
146
+ questions: [{
147
+ question: "Quelle PR voulez-vous merger ?",
148
+ header: "Merge",
149
+ options: sorted.map(pr => ({
150
+ label: `#${pr.number}`,
151
+ description: `${pr.title} (${pr.branch})`
152
+ })).concat([{
153
+ label: "Toutes",
154
+ description: "Merger toutes les PRs pretes (dans l'ordre recommande)"
155
+ }]),
156
+ multiSelect: false
157
+ }]
158
+ })
159
+ } else if (NEEDS_REVIEW.length > 0 || NEEDS_CHANGES.length > 0) {
160
+ console.log("❌ Aucune PR prete a merger.")
161
+ console.log("")
162
+ if (NEEDS_REVIEW.length > 0) {
163
+ console.log("→ PRs en attente de review: " + NEEDS_REVIEW.map(p => '#'+p.number).join(', '))
164
+ console.log(" Demandez une review ou utilisez: /gitflow:8-review <numero>")
165
+ }
166
+ if (NEEDS_CHANGES.length > 0) {
167
+ console.log("→ PRs avec changements demandes: " + NEEDS_CHANGES.map(p => '#'+p.number).join(', '))
168
+ console.log(" Adressez le feedback puis re-demandez une review")
169
+ }
170
+ if (HAS_CONFLICTS.length > 0) {
171
+ console.log("→ PRs avec conflits: " + HAS_CONFLICTS.map(p => '#'+p.number).join(', '))
172
+ console.log(" Resolvez les conflits avec: git rebase origin/<target>")
173
+ }
174
+ exit(1)
175
+ } else {
176
+ console.log("✅ Aucune PR ouverte!")
177
+ console.log("→ Creez une PR avec: /gitflow:7-pull-request")
178
+ exit(0)
179
+ }
180
+ ```
181
+
182
+ ### 0.5 Ordre recommande pour "Toutes"
183
+
184
+ ```
185
+ ORDRE DE MERGE RECOMMANDE:
186
+ 1. Hotfixes (urgents, patches production)
187
+ 2. Releases (vers main, puis merge back)
188
+ 3. Features (par date de creation, plus anciennes d'abord)
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Pre-merge checks
194
+
195
+ ### 1. Status PR
196
+
197
+ ```bash
198
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
199
+ az repos pr show --id {number} \
200
+ --organization "https://dev.azure.com/$AZURE_ORG" \
201
+ --project "$AZURE_PROJECT" \
202
+ --query "{status:status, mergeStatus:mergeStatus, reviewers:reviewers}"
203
+ else
204
+ gh pr view {number} --json state,mergeable,mergeStateStatus,reviews,checks
205
+ fi
206
+ ```
207
+
208
+ | Check | Requis | Action si echec |
209
+ |-------|--------|-----------------|
210
+ | State = OPEN/active | OUI | "PR deja mergee ou fermee" |
211
+ | Mergeable = true | OUI | "Resoudre conflits d'abord" |
212
+ | MergeStateStatus = CLEAN | OUI | Attendre CI ou resoudre |
213
+
214
+ ### 2. Reviews
215
+
216
+ | Check | Condition | Action |
217
+ |-------|-----------|--------|
218
+ | Min approvals | Config: `minReviewers` | Attendre reviews |
219
+ | No changes requested | Aucun "Request changes" actif | Resoudre feedback |
220
+ | Required reviewers | Si configure | Verifier presence |
221
+
222
+ ```bash
223
+ # Verifier reviews
224
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
225
+ az repos pr show --id {number} \
226
+ --organization "https://dev.azure.com/$AZURE_ORG" \
227
+ --project "$AZURE_PROJECT" \
228
+ --query "reviewers[?vote>0]"
229
+ else
230
+ gh pr view {number} --json reviews --jq '.reviews[] | select(.state=="APPROVED")'
231
+ fi
232
+ ```
233
+
234
+ ### 3. CI/CD Checks
235
+
236
+ ```bash
237
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
238
+ # Azure DevOps - checks via policy status
239
+ az repos pr policy list --id {number} \
240
+ --organization "https://dev.azure.com/$AZURE_ORG" \
241
+ --project "$AZURE_PROJECT"
242
+ else
243
+ gh pr checks {number}
244
+ fi
245
+ ```
246
+
247
+ | Status | Action |
248
+ |--------|--------|
249
+ | Tous ✓ | Continuer |
250
+ | En cours | Attendre |
251
+ | Echec | BLOQUER - afficher details |
252
+
253
+ ### 4. Branch Protection
254
+
255
+ | Rule | Verification |
256
+ |------|--------------|
257
+ | Up-to-date | `git rev-list --count HEAD..origin/{base}` = 0 |
258
+ | Linear history | Si requis, rebase avant merge |
259
+ | Signed commits | Si requis, verifier signatures |
260
+
261
+ ---
262
+
263
+ ## EF Core Pre-merge (si applicable)
264
+
265
+ ### Validation migrations
266
+
267
+ ```bash
268
+ # Lister migrations dans la PR
269
+ git diff origin/{base}...HEAD --name-only | grep -E "Migrations/.*\.cs$"
270
+ ```
271
+
272
+ | Check | Validation | Bloquant |
273
+ |-------|------------|----------|
274
+ | Sync ModelSnapshot | Pas de conflit avec develop | OUI |
275
+ | Build migrations | `dotnet ef migrations script` OK | OUI |
276
+ | Pas de data loss | Scan DropTable/DropColumn | WARNING |
277
+
278
+ ### Si conflit ModelSnapshot detecte
279
+
280
+ ```
281
+ ⚠️ CONFLIT MODELSNAPSHOT DETECTE
282
+ ────────────────────────────────
283
+ Le ModelSnapshot a diverge de develop.
284
+
285
+ Options:
286
+ 1. Rebase + recreer migration (recommande)
287
+ 2. Merge manuel (risque)
288
+
289
+ Commande recommandee:
290
+ git rebase origin/develop
291
+ dotnet ef migrations remove
292
+ dotnet ef migrations add {MigrationName}
293
+ ────────────────────────────────
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Execution Merge
299
+
300
+ ### Strategie selon type
301
+
302
+ | Type branche | Merge strategy | GitHub | Azure DevOps |
303
+ |--------------|----------------|--------|--------------|
304
+ | `feature/*` | Squash | `--squash` | `--squash true` |
305
+ | `hotfix/*` | Merge commit | `--merge` | `--squash false` |
306
+ | `release/*` | Merge commit | `--merge` | `--squash false` |
307
+
308
+ ### Commande GitHub
309
+
310
+ ```bash
311
+ if [ "$GIT_PROVIDER" = "github" ]; then
312
+ # Squash (feature)
313
+ gh pr merge {number} --squash --delete-branch
314
+
315
+ # Merge commit (hotfix/release)
316
+ gh pr merge {number} --merge --delete-branch
317
+ fi
318
+ ```
319
+
320
+ ### Commande Azure DevOps
321
+
322
+ ```bash
323
+ if [ "$GIT_PROVIDER" = "azuredevops" ]; then
324
+ # Complete la PR (merge)
325
+ az repos pr update --id {number} \
326
+ --organization "https://dev.azure.com/$AZURE_ORG" \
327
+ --project "$AZURE_PROJECT" \
328
+ --status completed \
329
+ --squash {true|false} \
330
+ --delete-source-branch true
331
+
332
+ # Note: Si merge policies bloquent, utiliser --bypass-policy (admin requis)
333
+ fi
334
+ ```
335
+
336
+ ### Options supplementaires
337
+
338
+ | Option | GitHub | Azure DevOps |
339
+ |--------|--------|--------------|
340
+ | Auto-merge quand CI vert | `--auto` | `--auto-complete true` |
341
+ | Supprimer branche source | `--delete-branch` | `--delete-source-branch true` |
342
+ | Override protections | `--admin` | `--bypass-policy` (danger) |
343
+
344
+ ---
345
+
346
+ ## Post-merge actions
347
+
348
+ ### 1. Versioning (si release/hotfix)
349
+
350
+ ```bash
351
+ # Lire version actuelle
352
+ VERSION=$(cat package.json | jq -r '.version')
353
+
354
+ # Creer tag
355
+ git tag -a "v$VERSION" -m "Release v$VERSION"
356
+ git push origin "v$VERSION"
357
+ ```
358
+
359
+ ### 2. Changelog (optionnel)
360
+
361
+ ```bash
362
+ # Ajouter entree CHANGELOG
363
+ echo "## v$VERSION - $(date +%Y-%m-%d)" >> CHANGELOG.md
364
+ gh pr view {number} --json title,body >> CHANGELOG.md
365
+ ```
366
+
367
+ ### 3. Notifications (si configure)
368
+
369
+ | Canal | Message |
370
+ |-------|---------|
371
+ | Slack | "PR #{number} merged to {base}" |
372
+ | Teams | Idem |
373
+ | Email | Idem |
374
+
375
+ ### 4. Cleanup
376
+
377
+ ```bash
378
+ # Supprimer branche locale
379
+ git branch -d {branch}
380
+
381
+ # Fetch et prune
382
+ git fetch --prune
383
+ ```
384
+
385
+ ---
386
+
387
+ ## Resume
388
+
389
+ ```
390
+ MERGE COMPLETE
391
+ ════════════════════════════════════════
392
+ PR: #{number}
393
+ Titre: {title}
394
+ Base: {base}
395
+ Strategy: {squash|merge}
396
+
397
+ Checks passes:
398
+ ✓ Reviews: {count} approvals
399
+ ✓ CI: All green
400
+ ✓ Conflicts: None
401
+ ✓ EF Core: {OK|N/A}
402
+
403
+ Post-merge:
404
+ ✓ Branch deleted: {branch}
405
+ ✓ Tag created: {tag|N/A}
406
+
407
+ ════════════════════════════════════════
408
+ ```
409
+
410
+ ---
411
+
412
+ ## Erreurs et recovery
413
+
414
+ | Erreur | Cause | Solution |
415
+ |--------|-------|----------|
416
+ | "Not mergeable" | Conflits | `git rebase origin/{base}` |
417
+ | "Checks failing" | CI rouge | Corriger et re-push |
418
+ | "Review required" | Pas d'approval | Demander review |
419
+ | "Branch protected" | Rules non respectees | Verifier requirements |
420
+ | "az: command not found" | Azure CLI manquant | `winget install Microsoft.AzureCLI` |
421
+ | "gh: command not found" | GitHub CLI manquant | https://cli.github.com |
422
+ | "Please run 'az login'" | Non authentifie | `az login` |
423
+
424
+ ## Providers supportes
425
+
426
+ | Provider | CLI | Merge command |
427
+ |----------|-----|---------------|
428
+ | **GitHub** | `gh pr merge` | Squash/Merge/Rebase |
429
+ | **Azure DevOps** | `az repos pr update --status completed` | Squash ou Merge |
430
+
431
+ ### Rollback si probleme post-merge
432
+
433
+ ```bash
434
+ # Identifier commit merge
435
+ MERGE_COMMIT=$(git log --merges -1 --format="%H")
436
+
437
+ # Revert
438
+ git revert -m 1 $MERGE_COMMIT
439
+ git push origin {base}
440
+ ```
441
+
442
+ ---
443
+
444
+ ## Modes
445
+
446
+ | Commande | Action |
447
+ |----------|--------|
448
+ | `/gitflow:9-merge 123` | Merge PR #123 |
449
+ | `/gitflow:9-merge 123 --auto` | Merge auto quand CI vert |
450
+ | `/gitflow:9-merge 123 --dry-run` | Simulation |
451
+ | `/gitflow:9-merge 123 --admin` | Override protections (danger) |