@atlashub/smartstack-cli 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.documentation/agents.html +5 -1
- package/.documentation/apex.html +5 -1
- package/.documentation/business-analyse.html +5 -1
- package/.documentation/commands.html +5 -1
- package/.documentation/css/styles.css +2168 -2168
- package/.documentation/efcore.html +5 -1
- package/.documentation/gitflow.html +5 -1
- package/.documentation/hooks.html +5 -1
- package/.documentation/index.html +5 -1
- package/.documentation/init.html +565 -0
- package/.documentation/installation.html +92 -6
- package/.documentation/js/app.js +794 -794
- package/.documentation/ralph-loop.html +534 -530
- package/.documentation/test-web.html +5 -1
- package/dist/index.js +817 -277
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/efcore/conflicts.md +44 -17
- package/templates/agents/efcore/db-status.md +27 -6
- package/templates/agents/efcore/scan.md +43 -13
- package/templates/commands/ai-prompt.md +315 -315
- package/templates/commands/application/create.md +362 -362
- package/templates/commands/controller/create.md +216 -216
- package/templates/commands/controller.md +59 -0
- package/templates/commands/documentation/module.md +202 -202
- package/templates/commands/efcore/_env-check.md +153 -153
- package/templates/commands/efcore/conflicts.md +109 -192
- package/templates/commands/efcore/db-status.md +101 -89
- package/templates/commands/efcore/migration.md +23 -11
- package/templates/commands/efcore/scan.md +115 -119
- package/templates/commands/efcore.md +54 -6
- package/templates/commands/feature-full.md +267 -267
- package/templates/commands/gitflow/11-finish.md +145 -11
- package/templates/commands/gitflow/13-sync.md +216 -216
- package/templates/commands/gitflow/14-rebase.md +251 -251
- package/templates/commands/gitflow/2-status.md +120 -10
- package/templates/commands/gitflow/3-commit.md +150 -0
- package/templates/commands/gitflow/7-pull-request.md +134 -5
- package/templates/commands/gitflow/9-merge.md +142 -1
- package/templates/commands/implement.md +663 -663
- package/templates/commands/init.md +567 -0
- package/templates/commands/mcp-integration.md +330 -0
- package/templates/commands/notification.md +129 -129
- package/templates/commands/validate.md +233 -0
- package/templates/commands/workflow.md +193 -193
- package/templates/skills/ai-prompt/SKILL.md +778 -778
- package/templates/skills/application/SKILL.md +563 -563
- package/templates/skills/application/templates-backend.md +450 -450
- package/templates/skills/application/templates-frontend.md +531 -531
- package/templates/skills/application/templates-i18n.md +520 -520
- package/templates/skills/application/templates-seed.md +647 -647
- package/templates/skills/controller/SKILL.md +240 -240
- package/templates/skills/controller/postman-templates.md +614 -614
- package/templates/skills/controller/templates.md +1468 -1468
- package/templates/skills/documentation/SKILL.md +133 -133
- package/templates/skills/documentation/templates.md +476 -476
- package/templates/skills/feature-full/SKILL.md +838 -838
- package/templates/skills/notification/SKILL.md +555 -555
- package/templates/skills/ui-components/SKILL.md +870 -870
- package/templates/skills/workflow/SKILL.md +582 -582
|
@@ -6,7 +6,7 @@ model: haiku
|
|
|
6
6
|
|
|
7
7
|
# Phase 2: STATUS - Overview
|
|
8
8
|
|
|
9
|
-
Tu es expert GitFlow et EF Core. Affiche l'etat complet du projet
|
|
9
|
+
Tu es expert GitFlow et EF Core. Affiche l'etat complet du projet.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -51,12 +51,49 @@ else
|
|
|
51
51
|
fi
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
### Sync develop vs main (CRITIQUE)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Commits sur develop absents de main (normal - a releaser)
|
|
58
|
+
DEVELOP_AHEAD=$(git rev-list --count origin/main..origin/develop 2>/dev/null || echo "0")
|
|
59
|
+
|
|
60
|
+
# Commits sur main absents de develop (ANORMAL - hotfix non merge back?)
|
|
61
|
+
MAIN_AHEAD=$(git rev-list --count origin/develop..origin/main 2>/dev/null || echo "0")
|
|
62
|
+
|
|
63
|
+
# Determiner l'etat de synchronisation
|
|
64
|
+
if [ "$DEVELOP_AHEAD" -eq 0 ] && [ "$MAIN_AHEAD" -eq 0 ]; then
|
|
65
|
+
BASE_SYNC="SYNCHRONIZED"
|
|
66
|
+
elif [ "$MAIN_AHEAD" -gt 0 ]; then
|
|
67
|
+
BASE_SYNC="DIVERGED" # PROBLEME!
|
|
68
|
+
elif [ "$DEVELOP_AHEAD" -gt 0 ]; then
|
|
69
|
+
BASE_SYNC="RELEASE_NEEDED" # Normal
|
|
70
|
+
fi
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Si MAIN_AHEAD > 0 (main a des commits absents de develop):**
|
|
74
|
+
```bash
|
|
75
|
+
# Lister les commits divergents
|
|
76
|
+
git log origin/develop..origin/main --oneline
|
|
77
|
+
```
|
|
78
|
+
|
|
54
79
|
### Version
|
|
55
80
|
Read from configured source in [.claude/gitflow/config.json](.claude/gitflow/config.json):
|
|
56
|
-
- `versioning.source` → type (csproj, Directory.Build.props, AssemblyInfo, VERSION, git-tag)
|
|
81
|
+
- `versioning.source` → type (csproj, Directory.Build.props, AssemblyInfo, VERSION, git-tag, package.json)
|
|
57
82
|
- `versioning.sourceFile` → file path
|
|
58
83
|
- Read current version from THAT file (not from config.json)
|
|
59
84
|
|
|
85
|
+
Fallback si pas de config:
|
|
86
|
+
```bash
|
|
87
|
+
# package.json
|
|
88
|
+
VERSION=$(grep '"version"' package.json 2>/dev/null | head -1 | sed 's/.*: "\(.*\)".*/\1/')
|
|
89
|
+
# .csproj
|
|
90
|
+
[ -z "$VERSION" ] && VERSION=$(grep -oP '(?<=<Version>).*(?=</Version>)' *.csproj 2>/dev/null | head -1)
|
|
91
|
+
# VERSION file
|
|
92
|
+
[ -z "$VERSION" ] && VERSION=$(cat VERSION 2>/dev/null)
|
|
93
|
+
# Git tag
|
|
94
|
+
[ -z "$VERSION" ] && VERSION=$(git describe --tags --abbrev=0 2>/dev/null)
|
|
95
|
+
```
|
|
96
|
+
|
|
60
97
|
### EF Core
|
|
61
98
|
- Lister les migrations (total et pending)
|
|
62
99
|
- Lister les DbContext detectes
|
|
@@ -85,6 +122,7 @@ done
|
|
|
85
122
|
- Conflits detectes?
|
|
86
123
|
|
|
87
124
|
### Risques
|
|
125
|
+
- **Divergence main/develop** (main a des commits absents de develop)
|
|
88
126
|
- Divergence > 5 commits vs develop
|
|
89
127
|
- Migrations non commitees
|
|
90
128
|
- ModelSnapshot modifie non commite
|
|
@@ -103,10 +141,37 @@ VERSION: {version} ({source})
|
|
|
103
141
|
|
|
104
142
|
REMOTE SYNC
|
|
105
143
|
vs origin/{branch}: {UP-TO-DATE|AHEAD N|BEHIND N|DIVERGED|NO REMOTE}
|
|
106
|
-
{Action: /gitflow:13-sync}
|
|
107
144
|
|
|
108
|
-
|
|
109
|
-
|
|
145
|
+
--------------------------------------------------------------------------------
|
|
146
|
+
SYNC DEVELOP <-> MAIN
|
|
147
|
+
--------------------------------------------------------------------------------
|
|
148
|
+
develop → main: +{DEVELOP_AHEAD} commits {message}
|
|
149
|
+
main → develop: +{MAIN_AHEAD} commits {message}
|
|
150
|
+
|
|
151
|
+
{Si DEVELOP_AHEAD > 0 et MAIN_AHEAD == 0:}
|
|
152
|
+
✓ Normal: develop a {N} commits prets a releaser
|
|
153
|
+
→ Action: /gitflow:10-start release
|
|
154
|
+
|
|
155
|
+
{Si MAIN_AHEAD > 0:}
|
|
156
|
+
⚠️ ATTENTION: main contient {N} commits absents de develop!
|
|
157
|
+
|
|
158
|
+
Commits sur main non merges dans develop:
|
|
159
|
+
{git log origin/develop..origin/main --oneline}
|
|
160
|
+
|
|
161
|
+
Causes possibles:
|
|
162
|
+
- Hotfix non merge back dans develop
|
|
163
|
+
- Commit direct sur main (non recommande)
|
|
164
|
+
- Release mal finalisee
|
|
165
|
+
|
|
166
|
+
→ Actions:
|
|
167
|
+
1. Merger main dans develop: git merge origin/main
|
|
168
|
+
2. Ou via release: /gitflow:10-start release (reset main)
|
|
169
|
+
|
|
170
|
+
{Si DEVELOP_AHEAD == 0 et MAIN_AHEAD == 0:}
|
|
171
|
+
✓ Synchronise: develop et main sont identiques
|
|
172
|
+
--------------------------------------------------------------------------------
|
|
173
|
+
|
|
174
|
+
DERNIER TAG: {tag}
|
|
110
175
|
|
|
111
176
|
EF CORE (branche courante)
|
|
112
177
|
Migrations: {total} total, {pending} pending
|
|
@@ -135,21 +200,64 @@ Actions: /gitflow:13-sync | /gitflow:14-rebase | /gitflow:3-commit | /gitflow:4-
|
|
|
135
200
|
|
|
136
201
|
---
|
|
137
202
|
|
|
203
|
+
## Alertes Specifiques
|
|
204
|
+
|
|
205
|
+
### Alerte: main divergent de develop
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
209
|
+
║ ⚠️ DIVERGENCE DETECTEE: main contient des commits absents de develop ║
|
|
210
|
+
╠══════════════════════════════════════════════════════════════════════════════╣
|
|
211
|
+
║ ║
|
|
212
|
+
║ Commits sur main non presents sur develop ({N}): ║
|
|
213
|
+
║ {hash1} {message1} ║
|
|
214
|
+
║ {hash2} {message2} ║
|
|
215
|
+
║ ... ║
|
|
216
|
+
║ ║
|
|
217
|
+
╠══════════════════════════════════════════════════════════════════════════════╣
|
|
218
|
+
║ RESOLUTIONS: ║
|
|
219
|
+
║ ║
|
|
220
|
+
║ Option 1 - Merger main dans develop (recommande): ║
|
|
221
|
+
║ git checkout develop && git merge origin/main ║
|
|
222
|
+
║ ║
|
|
223
|
+
║ Option 2 - Via la prochaine release: ║
|
|
224
|
+
║ /gitflow:10-start release ║
|
|
225
|
+
║ (La release peut reset main si necessaire) ║
|
|
226
|
+
║ ║
|
|
227
|
+
║ Option 3 - Cherry-pick selectif: ║
|
|
228
|
+
║ git cherry-pick {hash} ║
|
|
229
|
+
║ ║
|
|
230
|
+
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Alerte: Release recommandee
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
237
|
+
│ ℹ️ RELEASE RECOMMANDEE │
|
|
238
|
+
├──────────────────────────────────────────────────────────────────────────────┤
|
|
239
|
+
│ develop a {N} commits en avance de main. │
|
|
240
|
+
│ → /gitflow:10-start release │
|
|
241
|
+
└──────────────────────────────────────────────────────────────────────────────┘
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
138
246
|
## Modes
|
|
139
247
|
|
|
140
248
|
| Mode | Output |
|
|
141
249
|
|------|--------|
|
|
142
250
|
| Normal | Affichage complet |
|
|
143
|
-
| `--short` | `[branch] status \| vX.Y.Z \|
|
|
251
|
+
| `--short` | `[branch] status \| vX.Y.Z \| dev→main:+X \| main→dev:+Y` |
|
|
144
252
|
| `--json` | JSON structure |
|
|
145
253
|
|
|
146
254
|
## Codes sortie
|
|
147
255
|
|
|
148
256
|
| Code | Signification |
|
|
149
257
|
|------|---------------|
|
|
150
|
-
| 0 | OK |
|
|
151
|
-
| 1 | Warnings (pending,
|
|
152
|
-
| 2 | Problemes (conflits, operation en cours) |
|
|
258
|
+
| 0 | OK (synchronise ou release needed) |
|
|
259
|
+
| 1 | Warnings (pending, release recommandee) |
|
|
260
|
+
| 2 | Problemes (divergence main/develop, conflits, operation en cours) |
|
|
153
261
|
| 3 | Erreur (pas repo, no config) |
|
|
154
262
|
|
|
155
263
|
## Actions suggerees
|
|
@@ -158,8 +266,10 @@ Actions: /gitflow:13-sync | /gitflow:14-rebase | /gitflow:3-commit | /gitflow:4-
|
|
|
158
266
|
|------|----------------------|
|
|
159
267
|
| AHEAD N (push needed) | `/gitflow:13-sync` |
|
|
160
268
|
| BEHIND N (pull needed) | `/gitflow:13-sync` |
|
|
161
|
-
| DIVERGED
|
|
269
|
+
| DIVERGED local/remote | `/gitflow:13-sync` |
|
|
162
270
|
| NO REMOTE (not pushed yet) | `/gitflow:13-sync` |
|
|
271
|
+
| **main ahead of develop** | `git merge origin/main` ou `/gitflow:10-start release` |
|
|
272
|
+
| develop ahead of main | `/gitflow:10-start release` |
|
|
163
273
|
| Divergence > 5 vs develop | `/gitflow:14-rebase` |
|
|
164
274
|
| Pending migrations | `/efcore:db-deploy` |
|
|
165
275
|
| Dirty workdir | `/gitflow:3-commit` |
|
|
@@ -15,6 +15,156 @@ You are an expert in GitFlow and EF Core. Manage commits with validation of .NET
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
+
## ETAPE 0: GARDE-FOUS PRE-COMMIT
|
|
19
|
+
|
|
20
|
+
> **PROTECTION:** Verifications de securite AVANT toute operation de commit.
|
|
21
|
+
|
|
22
|
+
### 0.1 Protection des branches
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
26
|
+
|
|
27
|
+
# ═══════════════════════════════════════════════════════════════
|
|
28
|
+
# BLOCAGE: Commit direct sur main
|
|
29
|
+
# ═══════════════════════════════════════════════════════════════
|
|
30
|
+
if [[ "$CURRENT" == "main" ]]; then
|
|
31
|
+
echo ""
|
|
32
|
+
echo "╔══════════════════════════════════════════════════════════════════════════════╗"
|
|
33
|
+
echo "║ ⛔ COMMIT BLOQUE - BRANCHE PROTEGEE ║"
|
|
34
|
+
echo "╠══════════════════════════════════════════════════════════════════════════════╣"
|
|
35
|
+
echo "║ Vous etes sur 'main' - les commits directs ne sont pas autorises. ║"
|
|
36
|
+
echo "║ ║"
|
|
37
|
+
echo "║ GitFlow interdit les commits directs sur main car: ║"
|
|
38
|
+
echo "║ - main represente le code en production ║"
|
|
39
|
+
echo "║ - Les changements doivent passer par release ou hotfix ║"
|
|
40
|
+
echo "║ ║"
|
|
41
|
+
echo "║ ALTERNATIVES: ║"
|
|
42
|
+
echo "║ → Correction urgente? /gitflow:10-start hotfix <nom> ║"
|
|
43
|
+
echo "║ → Nouvelle release? /gitflow:10-start release ║"
|
|
44
|
+
echo "╚══════════════════════════════════════════════════════════════════════════════╝"
|
|
45
|
+
echo ""
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# ═══════════════════════════════════════════════════════════════
|
|
50
|
+
# AVERTISSEMENT: Commit direct sur develop
|
|
51
|
+
# ═══════════════════════════════════════════════════════════════
|
|
52
|
+
if [[ "$CURRENT" == "develop" ]]; then
|
|
53
|
+
echo ""
|
|
54
|
+
echo "╔══════════════════════════════════════════════════════════════════════════════╗"
|
|
55
|
+
echo "║ ⚠️ ATTENTION - COMMIT SUR DEVELOP ║"
|
|
56
|
+
echo "╠══════════════════════════════════════════════════════════════════════════════╣"
|
|
57
|
+
echo "║ Vous etes sur 'develop' - les commits directs sont deconseilles. ║"
|
|
58
|
+
echo "║ ║"
|
|
59
|
+
echo "║ GitFlow recommande de passer par des branches feature car: ║"
|
|
60
|
+
echo "║ - Permet la review avant integration ║"
|
|
61
|
+
echo "║ - Isole les changements en cours ║"
|
|
62
|
+
echo "║ - Facilite le rollback si necessaire ║"
|
|
63
|
+
echo "║ ║"
|
|
64
|
+
echo "║ ALTERNATIVE RECOMMANDEE: ║"
|
|
65
|
+
echo "║ → /gitflow:10-start feature <nom> ║"
|
|
66
|
+
echo "╚══════════════════════════════════════════════════════════════════════════════╝"
|
|
67
|
+
echo ""
|
|
68
|
+
fi
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Si sur develop, demander confirmation:**
|
|
72
|
+
```javascript
|
|
73
|
+
if (CURRENT === "develop") {
|
|
74
|
+
AskUserQuestion({
|
|
75
|
+
questions: [{
|
|
76
|
+
question: "Voulez-vous vraiment committer directement sur develop ?",
|
|
77
|
+
header: "Confirm",
|
|
78
|
+
options: [
|
|
79
|
+
{ label: "Non, creer une feature", description: "Recommande - /gitflow:10-start feature" },
|
|
80
|
+
{ label: "Oui, commit direct", description: "Non recommande - bypass GitFlow" }
|
|
81
|
+
],
|
|
82
|
+
multiSelect: false
|
|
83
|
+
}]
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
if (response === "Non, creer une feature") {
|
|
87
|
+
console.log("→ Lancez: /gitflow:10-start feature <nom>")
|
|
88
|
+
exit(0)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 0.2 Verification synchronisation
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Verifier si la branche est a jour avec le remote
|
|
97
|
+
git fetch origin --quiet 2>/dev/null
|
|
98
|
+
|
|
99
|
+
BEHIND=$(git rev-list --count HEAD..origin/$CURRENT 2>/dev/null || echo "0")
|
|
100
|
+
|
|
101
|
+
if [ "$BEHIND" -gt 0 ]; then
|
|
102
|
+
echo ""
|
|
103
|
+
echo "┌──────────────────────────────────────────────────────────────────────────────┐"
|
|
104
|
+
echo "│ ⚠️ BRANCHE EN RETARD │"
|
|
105
|
+
echo "├──────────────────────────────────────────────────────────────────────────────┤"
|
|
106
|
+
echo "│ Votre branche est $BEHIND commits en retard par rapport au remote. │"
|
|
107
|
+
echo "│ │"
|
|
108
|
+
echo "│ RECOMMANDATION: │"
|
|
109
|
+
echo "│ → Synchronisez d'abord: git pull --rebase origin $CURRENT │"
|
|
110
|
+
echo "│ → Ou utilisez: /gitflow:13-sync │"
|
|
111
|
+
echo "└──────────────────────────────────────────────────────────────────────────────┘"
|
|
112
|
+
echo ""
|
|
113
|
+
fi
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Si en retard, demander synchronisation:**
|
|
117
|
+
```javascript
|
|
118
|
+
if (BEHIND > 0) {
|
|
119
|
+
AskUserQuestion({
|
|
120
|
+
questions: [{
|
|
121
|
+
question: `Votre branche est ${BEHIND} commits en retard. Synchroniser ?`,
|
|
122
|
+
header: "Sync",
|
|
123
|
+
options: [
|
|
124
|
+
{ label: "Oui, synchroniser", description: "git pull --rebase (Recommande)" },
|
|
125
|
+
{ label: "Non, continuer", description: "Commit sans sync (risque de conflit au push)" }
|
|
126
|
+
],
|
|
127
|
+
multiSelect: false
|
|
128
|
+
}]
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
if (response === "Oui, synchroniser") {
|
|
132
|
+
// Executer git pull --rebase
|
|
133
|
+
result = exec("git pull --rebase origin " + CURRENT)
|
|
134
|
+
if (result.exitCode !== 0) {
|
|
135
|
+
console.log("Conflits detectes. Resolvez-les puis relancez /gitflow:3-commit")
|
|
136
|
+
exit(1)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 0.3 Verification working directory
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Verifier s'il y a des fichiers a committer
|
|
146
|
+
STAGED=$(git diff --cached --name-only | wc -l)
|
|
147
|
+
MODIFIED=$(git diff --name-only | wc -l)
|
|
148
|
+
UNTRACKED=$(git ls-files --others --exclude-standard | wc -l)
|
|
149
|
+
|
|
150
|
+
if [ "$STAGED" -eq 0 ] && [ "$MODIFIED" -eq 0 ] && [ "$UNTRACKED" -eq 0 ]; then
|
|
151
|
+
echo ""
|
|
152
|
+
echo "✅ Rien a committer - working directory propre"
|
|
153
|
+
echo ""
|
|
154
|
+
exit 0
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
# Afficher resume
|
|
158
|
+
echo ""
|
|
159
|
+
echo "FICHIERS DETECTES:"
|
|
160
|
+
echo " Staged: $STAGED"
|
|
161
|
+
echo " Modified: $MODIFIED"
|
|
162
|
+
echo " Untracked: $UNTRACKED"
|
|
163
|
+
echo ""
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
18
168
|
## Workflow
|
|
19
169
|
|
|
20
170
|
### 1. Analyze files
|
|
@@ -8,7 +8,127 @@ model: haiku
|
|
|
8
8
|
|
|
9
9
|
Tu es expert GitFlow. Cree une Pull Request avec validation complete.
|
|
10
10
|
|
|
11
|
-
**Argument:** `$ARGUMENTS` = branche cible (optionnel,
|
|
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
|
+
```
|
|
12
132
|
|
|
13
133
|
---
|
|
14
134
|
|
|
@@ -17,13 +137,22 @@ Tu es expert GitFlow. Cree une Pull Request avec validation complete.
|
|
|
17
137
|
### 1. Validation branche et detection cible
|
|
18
138
|
|
|
19
139
|
```bash
|
|
20
|
-
# Branche courante
|
|
140
|
+
# Branche courante (ou selectionnee depuis scan)
|
|
21
141
|
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
22
142
|
|
|
23
|
-
# Verifier que ce n'est pas main/develop
|
|
143
|
+
# Verifier que ce n'est pas main/develop (sauf si scan mode a selectionne une branche)
|
|
24
144
|
if [[ "$CURRENT" == "main" || "$CURRENT" == "develop" ]]; then
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
27
156
|
fi
|
|
28
157
|
|
|
29
158
|
# ============================================
|
|
@@ -8,7 +8,148 @@ model: sonnet
|
|
|
8
8
|
|
|
9
9
|
Tu es expert GitFlow. Execute le merge avec tous les checks de securite.
|
|
10
10
|
|
|
11
|
-
**Argument:** `$ARGUMENTS` = numero PR (
|
|
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
|
+
```
|
|
12
153
|
|
|
13
154
|
---
|
|
14
155
|
|