@atlashub/smartstack-cli 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.documentation/agents.html +8 -4
- package/.documentation/apex.html +8 -4
- package/.documentation/business-analyse.html +833 -406
- package/.documentation/commands.html +8 -4
- package/.documentation/css/styles.css +153 -15
- package/.documentation/efcore.html +8 -4
- package/.documentation/gitflow.html +795 -230
- package/.documentation/hooks.html +8 -4
- package/.documentation/index.html +13 -9
- package/.documentation/installation.html +23 -19
- package/.documentation/ralph-loop.html +530 -0
- package/.documentation/test-web.html +8 -4
- package/README.md +52 -10
- package/dist/index.js +813 -283
- 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/create/agent.md +138 -0
- package/templates/commands/create/command.md +166 -0
- package/templates/commands/create/hook.md +234 -0
- package/templates/commands/create/plugin.md +329 -0
- package/templates/commands/create/project.md +507 -0
- package/templates/commands/create/skill.md +199 -0
- package/templates/commands/create.md +220 -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 +562 -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
|
@@ -8,7 +8,7 @@ model: sonnet
|
|
|
8
8
|
|
|
9
9
|
Tu es expert GitFlow. Finalise une branche apres merge de la PR.
|
|
10
10
|
|
|
11
|
-
**Argument:** `$ARGUMENTS` = branche a finaliser (optionnel,
|
|
11
|
+
**Argument:** `$ARGUMENTS` = branche a finaliser (optionnel, **SCAN AUTOMATIQUE** si absent)
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -22,32 +22,166 @@ Tu es expert GitFlow. Finalise une branche apres merge de la PR.
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## ETAPE 1: SCAN PROACTIF (si pas d'argument)
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
> **COMPORTEMENT PROACTIF:** Si aucun argument fourni, scanner TOUTES les branches pour proposer celles qui sont pretes a finaliser.
|
|
28
|
+
|
|
29
|
+
### 1.1 Scanner toutes les branches GitFlow
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git fetch --all --quiet
|
|
33
|
+
|
|
34
|
+
# Lister toutes les branches feature/release/hotfix
|
|
35
|
+
FEATURES=$(git branch -r | grep 'origin/feature/' | sed 's|origin/||' | tr -d ' ')
|
|
36
|
+
RELEASES=$(git branch -r | grep 'origin/release/' | sed 's|origin/||' | tr -d ' ')
|
|
37
|
+
HOTFIXES=$(git branch -r | grep 'origin/hotfix/' | sed 's|origin/||' | tr -d ' ')
|
|
38
|
+
|
|
39
|
+
ALL_BRANCHES="$FEATURES $RELEASES $HOTFIXES"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 1.2 Verifier le statut PR de chaque branche
|
|
28
43
|
|
|
29
44
|
```bash
|
|
30
|
-
#
|
|
31
|
-
BRANCH
|
|
45
|
+
# Pour chaque branche, verifier:
|
|
46
|
+
for BRANCH in $ALL_BRANCHES; do
|
|
47
|
+
# 1. PR mergee?
|
|
48
|
+
PR_MERGED=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt --jq '.[0]')
|
|
49
|
+
|
|
50
|
+
# 2. PR ouverte?
|
|
51
|
+
PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
|
|
52
|
+
|
|
53
|
+
# 3. Pas de PR?
|
|
54
|
+
# Si pas de PR → suggerer /gitflow:7-pull-request
|
|
55
|
+
|
|
56
|
+
# Categoriser
|
|
57
|
+
if [ -n "$PR_MERGED" ]; then
|
|
58
|
+
READY_TO_FINISH+=("$BRANCH")
|
|
59
|
+
elif [ -n "$PR_OPEN" ]; then
|
|
60
|
+
WAITING_FOR_MERGE+=("$BRANCH")
|
|
61
|
+
else
|
|
62
|
+
NEEDS_PR+=("$BRANCH")
|
|
63
|
+
fi
|
|
64
|
+
done
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 1.3 Afficher le tableau de synthese
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
================================================================================
|
|
71
|
+
GITFLOW FINISH - SCAN DES BRANCHES
|
|
72
|
+
================================================================================
|
|
73
|
+
|
|
74
|
+
✅ PRETES A FINALISER (PR mergee):
|
|
75
|
+
┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
|
|
76
|
+
│ Branche │ Type │ PR # │ Mergee le │
|
|
77
|
+
├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
|
|
78
|
+
│ feature/add-user-auth │ feature │ #42 │ 2024-01-15 14:30 │
|
|
79
|
+
│ release/v1.5.0 │ release │ #45 │ 2024-01-15 16:00 │
|
|
80
|
+
└─────────────────────────────┴───────────┴────────────┴─────────────────────┘
|
|
81
|
+
|
|
82
|
+
⏳ EN ATTENTE DE MERGE (PR ouverte):
|
|
83
|
+
┌─────────────────────────────┬───────────┬────────────┬─────────────────────┐
|
|
84
|
+
│ Branche │ Type │ PR # │ Statut │
|
|
85
|
+
├─────────────────────────────┼───────────┼────────────┼─────────────────────┤
|
|
86
|
+
│ feature/add-orders │ feature │ #43 │ Review en cours │
|
|
87
|
+
│ hotfix/fix-login │ hotfix │ #44 │ CI en cours │
|
|
88
|
+
└─────────────────────────────┴───────────┴────────────┴─────────────────────┘
|
|
89
|
+
|
|
90
|
+
❌ SANS PR (action requise):
|
|
91
|
+
┌─────────────────────────────┬───────────┬────────────────────────────────────┐
|
|
92
|
+
│ Branche │ Type │ Action suggeree │
|
|
93
|
+
├─────────────────────────────┼───────────┼────────────────────────────────────┤
|
|
94
|
+
│ feature/wip-refactor │ feature │ /gitflow:7-pull-request │
|
|
95
|
+
│ feature/old-abandoned │ feature │ /gitflow:6-abort --branch │
|
|
96
|
+
└─────────────────────────────┴───────────┴────────────────────────────────────┘
|
|
97
|
+
|
|
98
|
+
================================================================================
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 1.4 Proposition interactive
|
|
102
|
+
|
|
103
|
+
```javascript
|
|
104
|
+
// Si plusieurs branches pretes a finaliser
|
|
105
|
+
if (READY_TO_FINISH.length > 0) {
|
|
106
|
+
AskUserQuestion({
|
|
107
|
+
questions: [{
|
|
108
|
+
question: "Quelle branche voulez-vous finaliser ?",
|
|
109
|
+
header: "Finish",
|
|
110
|
+
options: READY_TO_FINISH.map(branch => ({
|
|
111
|
+
label: branch,
|
|
112
|
+
description: `PR #${getPRNumber(branch)} mergee - ${getType(branch)}`
|
|
113
|
+
})).concat([{
|
|
114
|
+
label: "Toutes",
|
|
115
|
+
description: "Finaliser toutes les branches pretes (dans l'ordre recommande)"
|
|
116
|
+
}]),
|
|
117
|
+
multiSelect: false
|
|
118
|
+
}]
|
|
119
|
+
})
|
|
120
|
+
} else if (WAITING_FOR_MERGE.length > 0) {
|
|
121
|
+
// Afficher message d'aide
|
|
122
|
+
console.log("Aucune branche prete a finaliser.")
|
|
123
|
+
console.log("→ Attendez le merge des PRs en cours ou utilisez /gitflow:9-merge")
|
|
124
|
+
} else if (NEEDS_PR.length > 0) {
|
|
125
|
+
// Afficher message d'aide
|
|
126
|
+
console.log("Aucune branche prete. Creez d'abord une PR:")
|
|
127
|
+
console.log("→ /gitflow:7-pull-request")
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 1.5 Ordre recommande pour "Toutes"
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
ORDRE DE FINALISATION RECOMMANDE:
|
|
135
|
+
1. Hotfixes (urgents, vers main puis develop)
|
|
136
|
+
2. Releases (vers main puis develop)
|
|
137
|
+
3. Features (vers develop, par date de merge)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## ETAPE 2: Detecter le contexte (si argument fourni)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Branche specifiee ou selectionnee
|
|
146
|
+
BRANCH=${ARGUMENTS:-$SELECTED_BRANCH}
|
|
32
147
|
|
|
33
148
|
# Determiner le type
|
|
34
149
|
if [[ $BRANCH == feature/* ]]; then TYPE="feature"
|
|
35
150
|
elif [[ $BRANCH == release/* ]]; then TYPE="release"
|
|
36
151
|
elif [[ $BRANCH == hotfix/* ]]; then TYPE="hotfix"
|
|
37
|
-
else
|
|
152
|
+
else
|
|
153
|
+
echo "⚠️ '$BRANCH' n'est pas une branche GitFlow (feature/release/hotfix)"
|
|
154
|
+
echo "→ Utilisez /gitflow:11-finish sans argument pour scanner les branches"
|
|
155
|
+
exit 1
|
|
38
156
|
fi
|
|
39
157
|
```
|
|
40
158
|
|
|
41
|
-
|
|
159
|
+
## ETAPE 3: Verifier que PR est mergee
|
|
42
160
|
|
|
43
161
|
```bash
|
|
44
162
|
# Chercher PR associee
|
|
45
|
-
gh pr list --head $BRANCH --state merged --json number,mergedAt
|
|
163
|
+
PR_INFO=$(gh pr list --head "$BRANCH" --state merged --json number,mergedAt,title --jq '.[0]')
|
|
46
164
|
|
|
47
165
|
# Si pas mergee
|
|
48
|
-
if [ -z "$
|
|
49
|
-
|
|
50
|
-
|
|
166
|
+
if [ -z "$PR_INFO" ]; then
|
|
167
|
+
# Verifier si PR ouverte
|
|
168
|
+
PR_OPEN=$(gh pr list --head "$BRANCH" --state open --json number,url --jq '.[0]')
|
|
169
|
+
|
|
170
|
+
if [ -n "$PR_OPEN" ]; then
|
|
171
|
+
PR_NUM=$(echo "$PR_OPEN" | jq -r '.number')
|
|
172
|
+
echo "⚠️ PR #$PR_NUM existe mais n'est pas encore mergee"
|
|
173
|
+
echo ""
|
|
174
|
+
echo "Options:"
|
|
175
|
+
echo " 1. Merger la PR: /gitflow:9-merge $PR_NUM"
|
|
176
|
+
echo " 2. Voir la PR: gh pr view $PR_NUM --web"
|
|
177
|
+
echo " 3. Abandonner: /gitflow:6-abort --branch"
|
|
178
|
+
else
|
|
179
|
+
echo "⚠️ Aucune PR trouvee pour '$BRANCH'"
|
|
180
|
+
echo ""
|
|
181
|
+
echo "Options:"
|
|
182
|
+
echo " 1. Creer une PR: /gitflow:7-pull-request"
|
|
183
|
+
echo " 2. Abandonner: /gitflow:6-abort --branch"
|
|
184
|
+
fi
|
|
51
185
|
exit 1
|
|
52
186
|
fi
|
|
53
187
|
```
|
|
@@ -1,216 +1,216 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Phase 13 - Sync local branch with remote (push/pull)
|
|
3
|
-
agent: gitflow-status
|
|
4
|
-
model: haiku
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Phase 13: SYNC - Synchronize with Remote
|
|
8
|
-
|
|
9
|
-
Synchronise la branche locale avec sa branche remote tracking.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## STEP 1: Fetch et analyse
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Fetch pour avoir les infos a jour
|
|
17
|
-
git fetch --quiet 2>/dev/null
|
|
18
|
-
|
|
19
|
-
BRANCH=$(git branch --show-current)
|
|
20
|
-
UPSTREAM=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null)
|
|
21
|
-
|
|
22
|
-
echo "Branche locale: $BRANCH"
|
|
23
|
-
echo "Remote tracking: $UPSTREAM"
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## STEP 2: Determiner l'action necessaire
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
if [ -z "$UPSTREAM" ]; then
|
|
32
|
-
# Pas de remote tracking - proposer push initial
|
|
33
|
-
ACTION="PUSH_NEW"
|
|
34
|
-
echo "Status: NO REMOTE - branche non pushee"
|
|
35
|
-
else
|
|
36
|
-
LOCAL=$(git rev-parse @)
|
|
37
|
-
REMOTE=$(git rev-parse @{upstream})
|
|
38
|
-
BASE=$(git merge-base @ @{upstream})
|
|
39
|
-
|
|
40
|
-
if [ "$LOCAL" = "$REMOTE" ]; then
|
|
41
|
-
ACTION="UP_TO_DATE"
|
|
42
|
-
echo "Status: UP-TO-DATE - rien a faire"
|
|
43
|
-
elif [ "$LOCAL" = "$BASE" ]; then
|
|
44
|
-
BEHIND=$(git rev-list --count @..@{upstream})
|
|
45
|
-
ACTION="PULL"
|
|
46
|
-
echo "Status: BEHIND $BEHIND commits - pull needed"
|
|
47
|
-
elif [ "$REMOTE" = "$BASE" ]; then
|
|
48
|
-
AHEAD=$(git rev-list --count @{upstream}..@)
|
|
49
|
-
ACTION="PUSH"
|
|
50
|
-
echo "Status: AHEAD $AHEAD commits - push needed"
|
|
51
|
-
else
|
|
52
|
-
AHEAD=$(git rev-list --count @{upstream}..@)
|
|
53
|
-
BEHIND=$(git rev-list --count @..@{upstream})
|
|
54
|
-
ACTION="DIVERGED"
|
|
55
|
-
echo "Status: DIVERGED +$AHEAD/-$BEHIND - pull --rebase needed"
|
|
56
|
-
fi
|
|
57
|
-
fi
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## STEP 3: Executer l'action
|
|
63
|
-
|
|
64
|
-
### Si UP_TO_DATE
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
================================================================================
|
|
68
|
-
ALREADY SYNCHRONIZED
|
|
69
|
-
================================================================================
|
|
70
|
-
|
|
71
|
-
Branche: {branch}
|
|
72
|
-
Remote: {upstream}
|
|
73
|
-
Status: UP-TO-DATE
|
|
74
|
-
|
|
75
|
-
Rien a faire.
|
|
76
|
-
|
|
77
|
-
================================================================================
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Si PUSH_NEW (pas de remote)
|
|
81
|
-
|
|
82
|
-
```javascript
|
|
83
|
-
AskUserQuestion({
|
|
84
|
-
questions: [{
|
|
85
|
-
question: "Push this branch to remote for the first time?",
|
|
86
|
-
header: "Push new",
|
|
87
|
-
options: [
|
|
88
|
-
{ label: "Yes, push", description: "git push -u origin {branch}" },
|
|
89
|
-
{ label: "No, cancel", description: "Keep local only" }
|
|
90
|
-
],
|
|
91
|
-
multiSelect: false
|
|
92
|
-
}]
|
|
93
|
-
})
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Si Yes:**
|
|
97
|
-
```bash
|
|
98
|
-
git push -u origin "$BRANCH"
|
|
99
|
-
echo "Branche pushee et tracking configure"
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Si PULL
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
echo "Pulling $BEHIND commits from remote..."
|
|
106
|
-
git pull --ff-only
|
|
107
|
-
|
|
108
|
-
if [ $? -ne 0 ]; then
|
|
109
|
-
echo "WARNING: Fast-forward not possible, trying rebase..."
|
|
110
|
-
git pull --rebase
|
|
111
|
-
fi
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Si PUSH
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
echo "Pushing $AHEAD commits to remote..."
|
|
118
|
-
git push
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Si DIVERGED
|
|
122
|
-
|
|
123
|
-
```javascript
|
|
124
|
-
AskUserQuestion({
|
|
125
|
-
questions: [{
|
|
126
|
-
question: "Branch has diverged from remote. How to resolve?",
|
|
127
|
-
header: "Diverged",
|
|
128
|
-
options: [
|
|
129
|
-
{ label: "Pull --rebase (recommended)", description: "Rebase local commits on top of remote" },
|
|
130
|
-
{ label: "Force push", description: "Overwrite remote with local (DANGEROUS)" },
|
|
131
|
-
{ label: "Cancel", description: "Review manually first" }
|
|
132
|
-
],
|
|
133
|
-
multiSelect: false
|
|
134
|
-
}]
|
|
135
|
-
})
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**Si Pull --rebase:**
|
|
139
|
-
```bash
|
|
140
|
-
git pull --rebase
|
|
141
|
-
if [ $? -ne 0 ]; then
|
|
142
|
-
echo "CONFLITS DETECTES - resolvez puis: git rebase --continue"
|
|
143
|
-
exit 1
|
|
144
|
-
fi
|
|
145
|
-
git push
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
**Si Force push:**
|
|
149
|
-
```bash
|
|
150
|
-
# Double confirmation pour force push
|
|
151
|
-
echo "WARNING: Force push va ecraser les commits distants!"
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
```javascript
|
|
155
|
-
AskUserQuestion({
|
|
156
|
-
questions: [{
|
|
157
|
-
question: "CONFIRM: Force push will overwrite remote commits. Are you sure?",
|
|
158
|
-
header: "Force push",
|
|
159
|
-
options: [
|
|
160
|
-
{ label: "Yes, force push", description: "I understand the risk" },
|
|
161
|
-
{ label: "No, cancel", description: "Abort operation" }
|
|
162
|
-
],
|
|
163
|
-
multiSelect: false
|
|
164
|
-
}]
|
|
165
|
-
})
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
git push --force-with-lease
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## STEP 4: Verification
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
echo ""
|
|
178
|
-
echo "Verification post-sync..."
|
|
179
|
-
|
|
180
|
-
LOCAL=$(git rev-parse @)
|
|
181
|
-
REMOTE=$(git rev-parse @{upstream} 2>/dev/null)
|
|
182
|
-
|
|
183
|
-
if [ "$LOCAL" = "$REMOTE" ]; then
|
|
184
|
-
echo "SYNCHRONIZED"
|
|
185
|
-
else
|
|
186
|
-
echo "WARNING: Still not synchronized"
|
|
187
|
-
git status
|
|
188
|
-
fi
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
## Summary
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
================================================================================
|
|
197
|
-
SYNC COMPLETE
|
|
198
|
-
================================================================================
|
|
199
|
-
|
|
200
|
-
Branche: {branch}
|
|
201
|
-
Remote: origin/{branch}
|
|
202
|
-
Action: {PULL|PUSH|PUSH_NEW|REBASE}
|
|
203
|
-
Status: SYNCHRONIZED
|
|
204
|
-
|
|
205
|
-
================================================================================
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## Codes sortie
|
|
211
|
-
|
|
212
|
-
| Code | Signification |
|
|
213
|
-
|------|---------------|
|
|
214
|
-
| 0 | Sync reussie |
|
|
215
|
-
| 1 | Conflits (rebase en cours) |
|
|
216
|
-
| 2 | Erreur reseau ou permission |
|
|
1
|
+
---
|
|
2
|
+
description: Phase 13 - Sync local branch with remote (push/pull)
|
|
3
|
+
agent: gitflow-status
|
|
4
|
+
model: haiku
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Phase 13: SYNC - Synchronize with Remote
|
|
8
|
+
|
|
9
|
+
Synchronise la branche locale avec sa branche remote tracking.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## STEP 1: Fetch et analyse
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Fetch pour avoir les infos a jour
|
|
17
|
+
git fetch --quiet 2>/dev/null
|
|
18
|
+
|
|
19
|
+
BRANCH=$(git branch --show-current)
|
|
20
|
+
UPSTREAM=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null)
|
|
21
|
+
|
|
22
|
+
echo "Branche locale: $BRANCH"
|
|
23
|
+
echo "Remote tracking: $UPSTREAM"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## STEP 2: Determiner l'action necessaire
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
if [ -z "$UPSTREAM" ]; then
|
|
32
|
+
# Pas de remote tracking - proposer push initial
|
|
33
|
+
ACTION="PUSH_NEW"
|
|
34
|
+
echo "Status: NO REMOTE - branche non pushee"
|
|
35
|
+
else
|
|
36
|
+
LOCAL=$(git rev-parse @)
|
|
37
|
+
REMOTE=$(git rev-parse @{upstream})
|
|
38
|
+
BASE=$(git merge-base @ @{upstream})
|
|
39
|
+
|
|
40
|
+
if [ "$LOCAL" = "$REMOTE" ]; then
|
|
41
|
+
ACTION="UP_TO_DATE"
|
|
42
|
+
echo "Status: UP-TO-DATE - rien a faire"
|
|
43
|
+
elif [ "$LOCAL" = "$BASE" ]; then
|
|
44
|
+
BEHIND=$(git rev-list --count @..@{upstream})
|
|
45
|
+
ACTION="PULL"
|
|
46
|
+
echo "Status: BEHIND $BEHIND commits - pull needed"
|
|
47
|
+
elif [ "$REMOTE" = "$BASE" ]; then
|
|
48
|
+
AHEAD=$(git rev-list --count @{upstream}..@)
|
|
49
|
+
ACTION="PUSH"
|
|
50
|
+
echo "Status: AHEAD $AHEAD commits - push needed"
|
|
51
|
+
else
|
|
52
|
+
AHEAD=$(git rev-list --count @{upstream}..@)
|
|
53
|
+
BEHIND=$(git rev-list --count @..@{upstream})
|
|
54
|
+
ACTION="DIVERGED"
|
|
55
|
+
echo "Status: DIVERGED +$AHEAD/-$BEHIND - pull --rebase needed"
|
|
56
|
+
fi
|
|
57
|
+
fi
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## STEP 3: Executer l'action
|
|
63
|
+
|
|
64
|
+
### Si UP_TO_DATE
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
================================================================================
|
|
68
|
+
ALREADY SYNCHRONIZED
|
|
69
|
+
================================================================================
|
|
70
|
+
|
|
71
|
+
Branche: {branch}
|
|
72
|
+
Remote: {upstream}
|
|
73
|
+
Status: UP-TO-DATE
|
|
74
|
+
|
|
75
|
+
Rien a faire.
|
|
76
|
+
|
|
77
|
+
================================================================================
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Si PUSH_NEW (pas de remote)
|
|
81
|
+
|
|
82
|
+
```javascript
|
|
83
|
+
AskUserQuestion({
|
|
84
|
+
questions: [{
|
|
85
|
+
question: "Push this branch to remote for the first time?",
|
|
86
|
+
header: "Push new",
|
|
87
|
+
options: [
|
|
88
|
+
{ label: "Yes, push", description: "git push -u origin {branch}" },
|
|
89
|
+
{ label: "No, cancel", description: "Keep local only" }
|
|
90
|
+
],
|
|
91
|
+
multiSelect: false
|
|
92
|
+
}]
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Si Yes:**
|
|
97
|
+
```bash
|
|
98
|
+
git push -u origin "$BRANCH"
|
|
99
|
+
echo "Branche pushee et tracking configure"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Si PULL
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
echo "Pulling $BEHIND commits from remote..."
|
|
106
|
+
git pull --ff-only
|
|
107
|
+
|
|
108
|
+
if [ $? -ne 0 ]; then
|
|
109
|
+
echo "WARNING: Fast-forward not possible, trying rebase..."
|
|
110
|
+
git pull --rebase
|
|
111
|
+
fi
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Si PUSH
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
echo "Pushing $AHEAD commits to remote..."
|
|
118
|
+
git push
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Si DIVERGED
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
AskUserQuestion({
|
|
125
|
+
questions: [{
|
|
126
|
+
question: "Branch has diverged from remote. How to resolve?",
|
|
127
|
+
header: "Diverged",
|
|
128
|
+
options: [
|
|
129
|
+
{ label: "Pull --rebase (recommended)", description: "Rebase local commits on top of remote" },
|
|
130
|
+
{ label: "Force push", description: "Overwrite remote with local (DANGEROUS)" },
|
|
131
|
+
{ label: "Cancel", description: "Review manually first" }
|
|
132
|
+
],
|
|
133
|
+
multiSelect: false
|
|
134
|
+
}]
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Si Pull --rebase:**
|
|
139
|
+
```bash
|
|
140
|
+
git pull --rebase
|
|
141
|
+
if [ $? -ne 0 ]; then
|
|
142
|
+
echo "CONFLITS DETECTES - resolvez puis: git rebase --continue"
|
|
143
|
+
exit 1
|
|
144
|
+
fi
|
|
145
|
+
git push
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Si Force push:**
|
|
149
|
+
```bash
|
|
150
|
+
# Double confirmation pour force push
|
|
151
|
+
echo "WARNING: Force push va ecraser les commits distants!"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
AskUserQuestion({
|
|
156
|
+
questions: [{
|
|
157
|
+
question: "CONFIRM: Force push will overwrite remote commits. Are you sure?",
|
|
158
|
+
header: "Force push",
|
|
159
|
+
options: [
|
|
160
|
+
{ label: "Yes, force push", description: "I understand the risk" },
|
|
161
|
+
{ label: "No, cancel", description: "Abort operation" }
|
|
162
|
+
],
|
|
163
|
+
multiSelect: false
|
|
164
|
+
}]
|
|
165
|
+
})
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
git push --force-with-lease
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## STEP 4: Verification
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
echo ""
|
|
178
|
+
echo "Verification post-sync..."
|
|
179
|
+
|
|
180
|
+
LOCAL=$(git rev-parse @)
|
|
181
|
+
REMOTE=$(git rev-parse @{upstream} 2>/dev/null)
|
|
182
|
+
|
|
183
|
+
if [ "$LOCAL" = "$REMOTE" ]; then
|
|
184
|
+
echo "SYNCHRONIZED"
|
|
185
|
+
else
|
|
186
|
+
echo "WARNING: Still not synchronized"
|
|
187
|
+
git status
|
|
188
|
+
fi
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Summary
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
================================================================================
|
|
197
|
+
SYNC COMPLETE
|
|
198
|
+
================================================================================
|
|
199
|
+
|
|
200
|
+
Branche: {branch}
|
|
201
|
+
Remote: origin/{branch}
|
|
202
|
+
Action: {PULL|PUSH|PUSH_NEW|REBASE}
|
|
203
|
+
Status: SYNCHRONIZED
|
|
204
|
+
|
|
205
|
+
================================================================================
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Codes sortie
|
|
211
|
+
|
|
212
|
+
| Code | Signification |
|
|
213
|
+
|------|---------------|
|
|
214
|
+
| 0 | Sync reussie |
|
|
215
|
+
| 1 | Conflits (rebase en cours) |
|
|
216
|
+
| 2 | Erreur reseau ou permission |
|