@atlashub/smartstack-cli 1.23.0 → 1.25.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 +3 -3
- package/.documentation/apex.html +18 -18
- package/.documentation/business-analyse.html +38 -38
- package/.documentation/cli-commands.html +1 -1
- package/.documentation/commands.html +29 -29
- package/.documentation/efcore.html +246 -91
- package/.documentation/gitflow.html +1 -1
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +8 -8
- package/.documentation/init.html +1 -1
- package/.documentation/installation.html +9 -9
- package/.documentation/ralph-loop.html +2 -2
- package/.documentation/test-web.html +2 -2
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/skills/check-version/SKILL.md +183 -0
- package/templates/skills/debug/SKILL.md +161 -0
- package/templates/skills/explore/SKILL.md +96 -0
- package/templates/skills/quick-search/SKILL.md +87 -0
- package/templates/skills/refactor/SKILL.md +219 -0
- package/templates/skills/review-code/SKILL.md +72 -44
- package/templates/skills/review-code/references/smartstack-conventions.md +93 -33
- package/templates/skills/ui-components/responsive-guidelines.md +278 -0
- package/templates/skills/utils/SKILL.md +37 -0
- package/templates/{commands/utils → skills/utils/subcommands}/test-web-config.md +35 -43
- package/templates/{commands/utils → skills/utils/subcommands}/test-web.md +25 -53
- package/templates/{commands/validate.md → skills/validate/SKILL.md} +80 -139
- package/templates/commands/check-version.md +0 -267
- package/templates/commands/debug.md +0 -95
- package/templates/commands/efcore/_env-check.md +0 -153
- package/templates/commands/efcore/_shared.md +0 -352
- package/templates/commands/efcore/conflicts.md +0 -90
- package/templates/commands/efcore/db-deploy.md +0 -109
- package/templates/commands/efcore/db-reset.md +0 -180
- package/templates/commands/efcore/db-seed.md +0 -103
- package/templates/commands/efcore/db-status.md +0 -102
- package/templates/commands/efcore/migration.md +0 -186
- package/templates/commands/efcore/rebase-snapshot.md +0 -172
- package/templates/commands/efcore/scan.md +0 -94
- package/templates/commands/efcore/squash.md +0 -329
- package/templates/commands/efcore.md +0 -96
- package/templates/commands/explore.md +0 -45
- package/templates/commands/quick-search.md +0 -72
- package/templates/commands/refactor.md +0 -164
- /package/templates/{commands → skills}/_resources/formatting-guide.md +0 -0
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# EF Core Environment Check (Shared Step)
|
|
2
|
-
|
|
3
|
-
> **Usage:** Include ce step dans toutes les commandes EF Core qui interagissent avec la base de donnees.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## STEP 0: Verification environnement et connexion
|
|
8
|
-
|
|
9
|
-
### 0.1 Detecter les fichiers appsettings disponibles
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# Scanner les fichiers appsettings dans le projet API
|
|
13
|
-
API_DIR=$(find . -type d -name "*.Api" -o -name "*Web" | head -1)
|
|
14
|
-
if [ -z "$API_DIR" ]; then
|
|
15
|
-
API_DIR="."
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
# Lister tous les appsettings
|
|
19
|
-
APPSETTINGS_FILES=$(find "$API_DIR" -maxdepth 1 -name "appsettings*.json" 2>/dev/null | sort)
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### 0.2 Determiner l'environnement a utiliser
|
|
23
|
-
|
|
24
|
-
**Priorite:**
|
|
25
|
-
1. Flag `--env {Environment}` si fourni
|
|
26
|
-
2. `appsettings.Local.json` (defaut recommande)
|
|
27
|
-
3. Erreur si aucun fichier trouve
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# Logique de selection
|
|
31
|
-
ENV_FLAG="$1" # --env Development par exemple
|
|
32
|
-
|
|
33
|
-
if [ -n "$ENV_FLAG" ]; then
|
|
34
|
-
SELECTED_ENV="appsettings.${ENV_FLAG}.json"
|
|
35
|
-
elif [ -f "$API_DIR/appsettings.Local.json" ]; then
|
|
36
|
-
SELECTED_ENV="appsettings.Local.json"
|
|
37
|
-
else
|
|
38
|
-
echo "ERROR: Aucun fichier appsettings trouve"
|
|
39
|
-
echo " Creez appsettings.Local.json ou utilisez --env {Environment}"
|
|
40
|
-
exit 1
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# Verifier que le fichier existe
|
|
44
|
-
if [ ! -f "$API_DIR/$SELECTED_ENV" ]; then
|
|
45
|
-
echo "ERROR: $SELECTED_ENV non trouve dans $API_DIR"
|
|
46
|
-
exit 1
|
|
47
|
-
fi
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 0.3 Extraire et afficher la connection string
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# Extraire la connection string (PowerShell pour parsing JSON fiable)
|
|
54
|
-
CONNECTION_STRING=$(powershell -Command "
|
|
55
|
-
\$json = Get-Content '$API_DIR/$SELECTED_ENV' | ConvertFrom-Json
|
|
56
|
-
\$json.ConnectionStrings.DefaultConnection
|
|
57
|
-
")
|
|
58
|
-
|
|
59
|
-
# Extraire le nom de la base de donnees
|
|
60
|
-
DATABASE_NAME=$(echo "$CONNECTION_STRING" | grep -oP 'Database=\K[^;]+' || echo "Unknown")
|
|
61
|
-
SERVER_NAME=$(echo "$CONNECTION_STRING" | grep -oP 'Server=\K[^;]+' || echo "Unknown")
|
|
62
|
-
|
|
63
|
-
# Masquer le mot de passe si present
|
|
64
|
-
CONNECTION_MASKED=$(echo "$CONNECTION_STRING" | sed 's/Password=[^;]*/Password=****/g')
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### 0.4 Afficher le resume
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
================================================================================
|
|
71
|
-
EF CORE - ENVIRONNEMENT
|
|
72
|
-
================================================================================
|
|
73
|
-
|
|
74
|
-
FICHIERS DISPONIBLES:
|
|
75
|
-
{liste des appsettings detectes}
|
|
76
|
-
|
|
77
|
-
SELECTION: {SELECTED_ENV} {(defaut) si Local}
|
|
78
|
-
|
|
79
|
-
CONNEXION:
|
|
80
|
-
Server: {SERVER_NAME}
|
|
81
|
-
Database: {DATABASE_NAME}
|
|
82
|
-
String: {CONNECTION_MASKED}
|
|
83
|
-
|
|
84
|
-
================================================================================
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 0.5 Protection Production
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Bloquer si Production detecte (sauf pour db-status qui est read-only)
|
|
91
|
-
if [[ "$SELECTED_ENV" == *"Production"* ]]; then
|
|
92
|
-
echo "================================================================================
|
|
93
|
-
BLOQUE - ENVIRONNEMENT PRODUCTION
|
|
94
|
-
================================================================================
|
|
95
|
-
|
|
96
|
-
Cette commande est bloquee pour proteger les donnees de production.
|
|
97
|
-
|
|
98
|
-
OPTIONS:
|
|
99
|
-
1. Utilisez un environnement non-production
|
|
100
|
-
2. Contactez support@atlshub.ch pour assistance
|
|
101
|
-
|
|
102
|
-
================================================================================
|
|
103
|
-
"
|
|
104
|
-
exit 1
|
|
105
|
-
fi
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### 0.6 Confirmation (pour commandes destructives)
|
|
109
|
-
|
|
110
|
-
> **Note:** Utiliser uniquement pour db-reset, db-seed, et autres commandes destructives.
|
|
111
|
-
|
|
112
|
-
```javascript
|
|
113
|
-
AskUserQuestion({
|
|
114
|
-
questions: [{
|
|
115
|
-
question: "Confirmer l'execution sur cette base de donnees?",
|
|
116
|
-
header: "Confirm",
|
|
117
|
-
options: [
|
|
118
|
-
{ label: "Oui, continuer", description: "Executer sur " + DATABASE_NAME },
|
|
119
|
-
{ label: "Non, annuler", description: "Arreter l'execution" }
|
|
120
|
-
],
|
|
121
|
-
multiSelect: false
|
|
122
|
-
}]
|
|
123
|
-
})
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## Variables exportees
|
|
129
|
-
|
|
130
|
-
Apres ce step, les variables suivantes sont disponibles:
|
|
131
|
-
|
|
132
|
-
| Variable | Description |
|
|
133
|
-
|----------|-------------|
|
|
134
|
-
| `SELECTED_ENV` | Fichier appsettings utilise |
|
|
135
|
-
| `CONNECTION_STRING` | Connection string complete |
|
|
136
|
-
| `CONNECTION_MASKED` | Connection string masquee |
|
|
137
|
-
| `DATABASE_NAME` | Nom de la base de donnees |
|
|
138
|
-
| `SERVER_NAME` | Nom du serveur |
|
|
139
|
-
| `API_DIR` | Repertoire du projet API |
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
## Utilisation dans les commandes
|
|
144
|
-
|
|
145
|
-
```markdown
|
|
146
|
-
## STEP 0: Verification environnement
|
|
147
|
-
|
|
148
|
-
> **Include:** `_env-check.md`
|
|
149
|
-
|
|
150
|
-
{Executer les etapes 0.1 a 0.4}
|
|
151
|
-
{Executer 0.5 si commande modifie la base}
|
|
152
|
-
{Executer 0.6 si commande est destructive}
|
|
153
|
-
```
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
# EF Core - Fonctions Partagées
|
|
2
|
-
|
|
3
|
-
> **Usage:** Référencé par toutes les commandes EF Core
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Détection Projet EF Core
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
detect_efcore_project() {
|
|
11
|
-
CSPROJ=$(find . -name "*.csproj" -exec grep -l "Microsoft.EntityFrameworkCore" {} \; | head -1)
|
|
12
|
-
PROJECT_DIR=$(dirname "$CSPROJ")
|
|
13
|
-
PROJECT_NAME=$(basename "$CSPROJ" .csproj)
|
|
14
|
-
MIGRATIONS_DIR="$PROJECT_DIR/Persistence/Migrations"
|
|
15
|
-
|
|
16
|
-
STARTUP_PROJECT=$(find . -name "*.Api.csproj" -o -name "*Web.csproj" | head -1)
|
|
17
|
-
INFRA_PROJECT=$(find . -name "*Infrastructure.csproj" | head -1)
|
|
18
|
-
[ -z "$INFRA_PROJECT" ] && INFRA_PROJECT="$CSPROJ"
|
|
19
|
-
|
|
20
|
-
# Appeler la détection du DbContext
|
|
21
|
-
detect_dbcontext
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Détection DbContext (Core vs Extensions)
|
|
28
|
-
|
|
29
|
-
SmartStack utilise **deux DbContext séparés** avec des historiques de migration distincts :
|
|
30
|
-
|
|
31
|
-
| Context | DbContext | Schema | History Table |
|
|
32
|
-
|---------|-----------|--------|---------------|
|
|
33
|
-
| `core` | `CoreDbContext` | `core` | `core.__EFMigrationsHistory` |
|
|
34
|
-
| `extensions` | `ExtensionsDbContext` | `extensions` | `extensions.__EFMigrationsHistory` |
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
detect_dbcontext() {
|
|
38
|
-
# 1. Vérifier si SmartStack.Domain existe → CoreDbContext
|
|
39
|
-
if find . -type d -name "SmartStack.Domain" | grep -q .; then
|
|
40
|
-
DBCONTEXT="CoreDbContext"
|
|
41
|
-
DBCONTEXT_TYPE="core"
|
|
42
|
-
SCHEMA="core"
|
|
43
|
-
echo "DbContext détecté: CoreDbContext (SmartStack.Domain trouvé)"
|
|
44
|
-
return
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
# 2. Vérifier si projet client avec NuGet SmartStack → ExtensionsDbContext
|
|
48
|
-
if find . -name "*.csproj" -exec grep -l "SmartStack\." {} \; | grep -qv "SmartStack\."; then
|
|
49
|
-
DBCONTEXT="ExtensionsDbContext"
|
|
50
|
-
DBCONTEXT_TYPE="extensions"
|
|
51
|
-
SCHEMA="extensions"
|
|
52
|
-
echo "DbContext détecté: ExtensionsDbContext (Client avec NuGet SmartStack)"
|
|
53
|
-
return
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# 3. Vérifier les DbContext présents dans le code
|
|
57
|
-
CORE_CTX=$(find . -name "*.cs" -exec grep -l "CoreDbContext" {} \; 2>/dev/null | head -1)
|
|
58
|
-
EXT_CTX=$(find . -name "*.cs" -exec grep -l "ExtensionsDbContext" {} \; 2>/dev/null | head -1)
|
|
59
|
-
|
|
60
|
-
if [ -n "$CORE_CTX" ] && [ -z "$EXT_CTX" ]; then
|
|
61
|
-
DBCONTEXT="CoreDbContext"
|
|
62
|
-
DBCONTEXT_TYPE="core"
|
|
63
|
-
SCHEMA="core"
|
|
64
|
-
elif [ -z "$CORE_CTX" ] && [ -n "$EXT_CTX" ]; then
|
|
65
|
-
DBCONTEXT="ExtensionsDbContext"
|
|
66
|
-
DBCONTEXT_TYPE="extensions"
|
|
67
|
-
SCHEMA="extensions"
|
|
68
|
-
else
|
|
69
|
-
# 4. Les deux existent ou aucun trouvé → demander à l'utilisateur
|
|
70
|
-
DBCONTEXT=""
|
|
71
|
-
DBCONTEXT_TYPE=""
|
|
72
|
-
SCHEMA=""
|
|
73
|
-
echo "⚠️ DbContext non détecté automatiquement"
|
|
74
|
-
echo "→ Utiliser AskUserQuestion pour demander à l'utilisateur"
|
|
75
|
-
fi
|
|
76
|
-
}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Variables exportées :**
|
|
80
|
-
|
|
81
|
-
| Variable | Valeurs possibles | Description |
|
|
82
|
-
|----------|-------------------|-------------|
|
|
83
|
-
| `$DBCONTEXT` | `CoreDbContext` / `ExtensionsDbContext` | Nom du DbContext |
|
|
84
|
-
| `$DBCONTEXT_TYPE` | `core` / `extensions` | Type pour le MCP |
|
|
85
|
-
| `$SCHEMA` | `core` / `extensions` | Schéma de base de données |
|
|
86
|
-
|
|
87
|
-
**Si détection échoue, demander à l'utilisateur :**
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
AskUserQuestion({
|
|
91
|
-
questions: [{
|
|
92
|
-
question: "Quel DbContext utiliser pour cette migration ?",
|
|
93
|
-
header: "DbContext",
|
|
94
|
-
options: [
|
|
95
|
-
{ label: "CoreDbContext", description: "Entités SmartStack (User, Role, Navigation...)" },
|
|
96
|
-
{ label: "ExtensionsDbContext", description: "Entités client spécifiques" }
|
|
97
|
-
],
|
|
98
|
-
multiSelect: false
|
|
99
|
-
}]
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
// Puis définir les variables selon la réponse
|
|
103
|
-
if (answer === "CoreDbContext") {
|
|
104
|
-
DBCONTEXT="CoreDbContext"; DBCONTEXT_TYPE="core"; SCHEMA="core";
|
|
105
|
-
} else {
|
|
106
|
-
DBCONTEXT="ExtensionsDbContext"; DBCONTEXT_TYPE="extensions"; SCHEMA="extensions";
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## Détection Environnement
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
detect_environment() {
|
|
116
|
-
API_DIR=$(find . -type d -name "*.Api" | head -1)
|
|
117
|
-
[ -z "$API_DIR" ] && API_DIR="src/SmartStack.Api"
|
|
118
|
-
|
|
119
|
-
# Priorité: --env flag > appsettings.Local.json > erreur
|
|
120
|
-
if [ -n "$ENV_FLAG" ]; then
|
|
121
|
-
SELECTED_ENV="appsettings.${ENV_FLAG}.json"
|
|
122
|
-
elif [ -f "$API_DIR/appsettings.Local.json" ]; then
|
|
123
|
-
SELECTED_ENV="appsettings.Local.json"
|
|
124
|
-
else
|
|
125
|
-
echo "ERROR: Aucun appsettings trouvé"; exit 1
|
|
126
|
-
fi
|
|
127
|
-
|
|
128
|
-
# Extraire connection string
|
|
129
|
-
CONNECTION_STRING=$(powershell -Command "
|
|
130
|
-
\$json = Get-Content '$API_DIR/$SELECTED_ENV' | ConvertFrom-Json
|
|
131
|
-
\$json.ConnectionStrings.DefaultConnection
|
|
132
|
-
")
|
|
133
|
-
DATABASE_NAME=$(echo "$CONNECTION_STRING" | grep -oP 'Database=\K[^;]+')
|
|
134
|
-
SERVER_NAME=$(echo "$CONNECTION_STRING" | grep -oP 'Server=\K[^;]+')
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Protection Production
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
block_production() {
|
|
144
|
-
if [[ "$SELECTED_ENV" == *"Production"* ]]; then
|
|
145
|
-
echo "BLOQUÉ: Environnement Production détecté"
|
|
146
|
-
echo "Utilisez un environnement non-production"
|
|
147
|
-
exit 1
|
|
148
|
-
fi
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Backup Base de Données
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
backup_database() {
|
|
158
|
-
BACKUP_DIR=".claude/gitflow/backup/database"
|
|
159
|
-
mkdir -p "$BACKUP_DIR"
|
|
160
|
-
|
|
161
|
-
BACKUP_FILE="${BACKUP_DIR}/${DATABASE_NAME}_$(date +%Y%m%d_%H%M%S).bak"
|
|
162
|
-
|
|
163
|
-
echo "Backup: $DATABASE_NAME → $BACKUP_FILE"
|
|
164
|
-
|
|
165
|
-
sqlcmd -S "$SERVER_NAME" -E -Q "BACKUP DATABASE [$DATABASE_NAME] TO DISK='$BACKUP_FILE' WITH FORMAT, INIT, COMPRESSION"
|
|
166
|
-
|
|
167
|
-
if [ $? -eq 0 ]; then
|
|
168
|
-
echo "✓ Backup créé: $BACKUP_FILE"
|
|
169
|
-
BACKUP_PATH="$BACKUP_FILE"
|
|
170
|
-
else
|
|
171
|
-
echo "⚠️ Backup échoué (sqlcmd non disponible ou erreur SQL)"
|
|
172
|
-
BACKUP_PATH="none"
|
|
173
|
-
fi
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**Prérequis:** `sqlcmd` doit être installé et accessible dans le PATH.
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Détermination Branche Parente
|
|
182
|
-
|
|
183
|
-
**Règle d'or:** Le ModelSnapshot de référence doit venir de la branche parente (état validé).
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
determine_base_branch() {
|
|
187
|
-
CURRENT_BRANCH=$(git branch --show-current)
|
|
188
|
-
|
|
189
|
-
# Lire config GitFlow si disponible
|
|
190
|
-
CONFIG_FILE=".claude/gitflow/config.json"
|
|
191
|
-
GF_MAIN=$(grep -oP '"main":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "main")
|
|
192
|
-
GF_DEVELOP=$(grep -oP '"develop":\s*"\K[^"]+' "$CONFIG_FILE" 2>/dev/null || echo "develop")
|
|
193
|
-
|
|
194
|
-
case "$CURRENT_BRANCH" in
|
|
195
|
-
feature/*|bugfix/*)
|
|
196
|
-
BASE_BRANCH="$GF_DEVELOP"
|
|
197
|
-
BRANCH_TYPE="feature"
|
|
198
|
-
;;
|
|
199
|
-
develop)
|
|
200
|
-
BASE_BRANCH="$GF_MAIN"
|
|
201
|
-
BRANCH_TYPE="develop"
|
|
202
|
-
;;
|
|
203
|
-
release/*)
|
|
204
|
-
BASE_BRANCH="$GF_MAIN"
|
|
205
|
-
BRANCH_TYPE="release"
|
|
206
|
-
;;
|
|
207
|
-
hotfix/*)
|
|
208
|
-
BASE_BRANCH="$GF_MAIN"
|
|
209
|
-
BRANCH_TYPE="hotfix"
|
|
210
|
-
;;
|
|
211
|
-
main|master)
|
|
212
|
-
echo "❌ BLOQUÉ: Opération interdite sur $CURRENT_BRANCH"
|
|
213
|
-
exit 1
|
|
214
|
-
;;
|
|
215
|
-
*)
|
|
216
|
-
echo "⚠️ Branche non reconnue: $CURRENT_BRANCH"
|
|
217
|
-
echo "→ Utilisation de $GF_DEVELOP comme référence par défaut"
|
|
218
|
-
BASE_BRANCH="$GF_DEVELOP"
|
|
219
|
-
BRANCH_TYPE="unknown"
|
|
220
|
-
;;
|
|
221
|
-
esac
|
|
222
|
-
|
|
223
|
-
# Vérifier que la branche parente existe
|
|
224
|
-
if ! git rev-parse --verify "origin/$BASE_BRANCH" >/dev/null 2>&1; then
|
|
225
|
-
echo "❌ Branche parente '$BASE_BRANCH' introuvable sur origin"
|
|
226
|
-
exit 1
|
|
227
|
-
fi
|
|
228
|
-
|
|
229
|
-
echo "Branche parente: $BASE_BRANCH"
|
|
230
|
-
}
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
| Branche courante | Branche parente | Raison |
|
|
234
|
-
|------------------|-----------------|--------|
|
|
235
|
-
| `feature/*` | `develop` | État validé de develop |
|
|
236
|
-
| `bugfix/*` | `develop` | État validé de develop |
|
|
237
|
-
| `develop` | `main` | État en production |
|
|
238
|
-
| `release/*` | `main` | État en production |
|
|
239
|
-
| `hotfix/*` | `main` | État en production |
|
|
240
|
-
| `main/master` | **BLOQUÉ** | Jamais squash sur branche protégée |
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## Convention Nommage Migration
|
|
245
|
-
|
|
246
|
-
**OBLIGATOIRE : Utiliser le MCP pour le nommage**
|
|
247
|
-
|
|
248
|
-
Pattern: `{context}_v{version}_{sequence}_{Description}`
|
|
249
|
-
|
|
250
|
-
| Contexte | Version | Séquence | Description | Exemple |
|
|
251
|
-
|----------|---------|----------|-------------|---------|
|
|
252
|
-
| core | 1.2.0 | 001 | AddUserRoles | `core_v1.2.0_001_AddUserRoles` |
|
|
253
|
-
| extensions | 1.3.0 | 001 | AddCustomFields | `extensions_v1.3.0_001_AddCustomFields` |
|
|
254
|
-
|
|
255
|
-
**Appel MCP OBLIGATOIRE :**
|
|
256
|
-
|
|
257
|
-
```javascript
|
|
258
|
-
// TOUJOURS appeler le MCP pour obtenir le nom conforme
|
|
259
|
-
mcp__smartstack__suggest_migration({
|
|
260
|
-
description: "Add User Roles", // Description courte
|
|
261
|
-
context: DBCONTEXT_TYPE // "core" ou "extensions" (de detect_dbcontext)
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
// Résultat: core_v1.2.0_001_AddUserRoles
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
**Création migration avec le nom MCP :**
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
# $MIGRATION_NAME = résultat du MCP
|
|
271
|
-
# $DBCONTEXT = CoreDbContext ou ExtensionsDbContext (de detect_dbcontext)
|
|
272
|
-
|
|
273
|
-
dotnet ef migrations add "$MIGRATION_NAME" \
|
|
274
|
-
--context "$DBCONTEXT" \
|
|
275
|
-
--project "$INFRA_PROJECT" \
|
|
276
|
-
--startup-project "$STARTUP_PROJECT" \
|
|
277
|
-
-o Persistence/Migrations
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
> **INTERDIT :** Calculer le nom de migration manuellement. Toujours déléguer au MCP.
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
## Règle d'Or: 1 Migration par Feature
|
|
285
|
-
|
|
286
|
-
**Ne jamais accumuler plusieurs migrations sur une feature.** Si modification du modèle:
|
|
287
|
-
1. Supprimer la migration existante
|
|
288
|
-
2. Recréer avec `/efcore:migration`
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
## Règles de Conformité
|
|
293
|
-
|
|
294
|
-
| ❌ INTERDIT | ✅ OBLIGATOIRE |
|
|
295
|
-
|-------------|----------------|
|
|
296
|
-
| Scripts SQL (.sql) dans le repo | `dotnet ef database update` |
|
|
297
|
-
| `sqlcmd` pour DDL/DML | `dotnet ef migrations add` |
|
|
298
|
-
| `migrationBuilder.Sql()` INSERT | `HasData()` pour seeding |
|
|
299
|
-
|
|
300
|
-
**Exception:** `sqlcmd` est autorisé UNIQUEMENT pour `BACKUP DATABASE` (backup avant reset).
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## MCP Tool Reference
|
|
305
|
-
|
|
306
|
-
**Tool:** `mcp__smartstack__check_migrations`
|
|
307
|
-
|
|
308
|
-
| Paramètre | Type | Description |
|
|
309
|
-
|-----------|------|-------------|
|
|
310
|
-
| `projectPath` | string | Chemin projet EF Core (auto-detect) |
|
|
311
|
-
| `branch` | string | Branche Git (current) |
|
|
312
|
-
| `compareBranch` | string | Branche de comparaison |
|
|
313
|
-
|
|
314
|
-
**Response:** `MigrationCheckResult { hasConflicts, migrations[], conflicts[], suggestions[] }`
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
## Niveaux de Risque Conflit
|
|
319
|
-
|
|
320
|
-
| Condition | Risque | Action |
|
|
321
|
-
|-----------|--------|--------|
|
|
322
|
-
| Snapshot = develop | NONE | Merge OK |
|
|
323
|
-
| Tables différentes | LOW | Merge OK |
|
|
324
|
-
| FK vers même table | MEDIUM | Ordre important |
|
|
325
|
-
| Même tables/colonnes | HIGH | Rebase requis |
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
|
-
## Configuration
|
|
330
|
-
|
|
331
|
-
`.claude/gitflow/config.json`:
|
|
332
|
-
|
|
333
|
-
```json
|
|
334
|
-
{
|
|
335
|
-
"efcore": {
|
|
336
|
-
"database": {
|
|
337
|
-
"configFile": "appsettings.Local.json",
|
|
338
|
-
"connectionStringName": "DefaultConnection"
|
|
339
|
-
},
|
|
340
|
-
"crossBranch": {
|
|
341
|
-
"enabled": true,
|
|
342
|
-
"blockOnConflict": true
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
## Contact Support
|
|
351
|
-
|
|
352
|
-
📧 **support@atlshub.ch**
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Analyze conflicts before merge (BLOCKING if conflict detected)
|
|
3
|
-
agent: efcore-conflicts
|
|
4
|
-
model: sonnet
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# EF Core Conflicts
|
|
8
|
-
|
|
9
|
-
> **Ref:** [_shared.md](_shared.md)
|
|
10
|
-
> **MCP:** `mcp__smartstack__check_migrations`
|
|
11
|
-
> **Comportement:** Exit code 1 si conflit (bloque merge/commit)
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## STEP 1: Invoquer MCP
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"tool": "mcp__smartstack__check_migrations",
|
|
20
|
-
"parameters": {
|
|
21
|
-
"branch": "<current_branch>",
|
|
22
|
-
"compareBranch": "develop"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## STEP 2: Parser Réponse
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
interface MigrationCheckResult {
|
|
33
|
-
hasConflicts: boolean;
|
|
34
|
-
migrations: MigrationInfo[];
|
|
35
|
-
conflicts: MigrationConflict[];
|
|
36
|
-
suggestions: string[];
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## STEP 3: Évaluer Niveau
|
|
43
|
-
|
|
44
|
-
| Type Conflit | Niveau | Action |
|
|
45
|
-
|--------------|--------|--------|
|
|
46
|
-
| `naming` | LOW | Warning |
|
|
47
|
-
| `order` | MEDIUM | Suggérer réordonnancement |
|
|
48
|
-
| `dependency` | HIGH | Bloquer merge |
|
|
49
|
-
| `snapshot` | CRITICAL | Bloquer, exiger rebase |
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Résumé
|
|
54
|
-
|
|
55
|
-
**Si aucun conflit:**
|
|
56
|
-
```
|
|
57
|
-
CONFLICTS - {branch}
|
|
58
|
-
├── Cible: develop
|
|
59
|
-
├── Résultat: ✓ Aucun conflit
|
|
60
|
-
└── Prochains: /gitflow:3-commit, /gitflow:7-pull-request
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Si conflits:**
|
|
64
|
-
```
|
|
65
|
-
CONFLICTS - {branch} - BLOQUÉ
|
|
66
|
-
├── Conflits: {N} trouvés
|
|
67
|
-
├── Types: {snapshot/dependency/order}
|
|
68
|
-
├── Action: /efcore:rebase-snapshot (OBLIGATOIRE)
|
|
69
|
-
└── Force: /efcore:conflicts --force (non recommandé)
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Exit Codes
|
|
75
|
-
|
|
76
|
-
| Code | Signification |
|
|
77
|
-
|------|---------------|
|
|
78
|
-
| 0 | Pas de conflit ou mineur |
|
|
79
|
-
| 1 | Conflit détecté - merge bloqué |
|
|
80
|
-
| 2 | Erreur connexion MCP |
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Options
|
|
85
|
-
|
|
86
|
-
| Option | Description |
|
|
87
|
-
|--------|-------------|
|
|
88
|
-
| `--force` | Ignorer conflit (non recommandé) |
|
|
89
|
-
| `--target <branch>` | Comparer avec autre branche |
|
|
90
|
-
| `--json` | Output JSON brut MCP |
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Deploy EF Core migrations to local database
|
|
3
|
-
agent: efcore-db-deploy
|
|
4
|
-
model: haiku
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# EF Core Database Deploy
|
|
8
|
-
|
|
9
|
-
> **Ref:** [_shared.md](_shared.md)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## STEP 0: Vérification Environnement
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
detect_environment
|
|
17
|
-
block_production
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Afficher: fichiers disponibles, environnement sélectionné, connexion cible.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## STEP 1: Détecter Projet et DbContext
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
detect_efcore_project # Appelle detect_dbcontext() automatiquement
|
|
28
|
-
echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Si DbContext non détecté automatiquement :**
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
AskUserQuestion({
|
|
35
|
-
questions: [{
|
|
36
|
-
question: "Quel DbContext déployer ?",
|
|
37
|
-
header: "DbContext",
|
|
38
|
-
options: [
|
|
39
|
-
{ label: "CoreDbContext", description: "Migrations du schéma core" },
|
|
40
|
-
{ label: "ExtensionsDbContext", description: "Migrations du schéma extensions" },
|
|
41
|
-
{ label: "Les deux", description: "Déployer core puis extensions" }
|
|
42
|
-
],
|
|
43
|
-
multiSelect: false
|
|
44
|
-
}]
|
|
45
|
-
})
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## STEP 2: Vérifier Migrations Pending
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
PENDING_COUNT=$(dotnet ef migrations list \
|
|
54
|
-
--context "$DBCONTEXT" \
|
|
55
|
-
--project "$INFRA_PROJECT" \
|
|
56
|
-
--startup-project "$STARTUP_PROJECT" \
|
|
57
|
-
--json | grep -c '"applied": false')
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## STEP 3: Appliquer
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
dotnet ef database update \
|
|
66
|
-
--context "$DBCONTEXT" \
|
|
67
|
-
--project "$INFRA_PROJECT" \
|
|
68
|
-
--startup-project "$STARTUP_PROJECT" \
|
|
69
|
-
--verbose
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
> **Note :** Si "Les deux" sélectionné, exécuter pour CoreDbContext puis ExtensionsDbContext.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Résumé
|
|
77
|
-
|
|
78
|
-
**Si succès:**
|
|
79
|
-
```
|
|
80
|
-
DEPLOY - {DATABASE_NAME}
|
|
81
|
-
├── Environnement: {SELECTED_ENV}
|
|
82
|
-
├── Serveur: {SERVER_NAME}
|
|
83
|
-
├── Migrations appliquées: {N}
|
|
84
|
-
└── Prochains: /efcore:db-status, /efcore:db-seed
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Si aucune pending:**
|
|
88
|
-
```
|
|
89
|
-
DEPLOY - À jour
|
|
90
|
-
├── Aucune migration en attente
|
|
91
|
-
└── Prochains: /efcore:migration, /efcore:scan
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**Si erreur connexion:**
|
|
95
|
-
```
|
|
96
|
-
DEPLOY - Échec
|
|
97
|
-
├── Vérifications: SQL Server démarré?, DB existe?, Credentials OK?
|
|
98
|
-
└── Commandes: sqlcmd -S {SERVER} -E, /efcore:db-reset
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Options
|
|
104
|
-
|
|
105
|
-
| Option | Description |
|
|
106
|
-
|--------|-------------|
|
|
107
|
-
| `--env {name}` | Utiliser appsettings.{name}.json |
|
|
108
|
-
| `--verbose` | Afficher SQL |
|
|
109
|
-
| `--context {name}` | Spécifier DbContext |
|