@atlashub/smartstack-cli 1.4.1 → 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 +916 -916
- package/.documentation/apex.html +1018 -1018
- package/.documentation/business-analyse.html +1501 -1501
- package/.documentation/commands.html +680 -680
- package/.documentation/css/styles.css +2168 -2168
- package/.documentation/efcore.html +2505 -2505
- package/.documentation/gitflow.html +2618 -2618
- package/.documentation/hooks.html +413 -413
- package/.documentation/index.html +323 -323
- package/.documentation/installation.html +462 -462
- package/.documentation/js/app.js +794 -794
- package/.documentation/test-web.html +513 -513
- package/dist/index.js +807 -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 +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
|
@@ -1,153 +1,153 @@
|
|
|
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
|
+
# 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
|
+
```
|
|
@@ -6,257 +6,149 @@ model: sonnet
|
|
|
6
6
|
|
|
7
7
|
# EF Core Conflicts - Cross-Branch Conflict Analysis
|
|
8
8
|
|
|
9
|
-
Analyzes potential conflicts between current branch and
|
|
9
|
+
Analyzes potential conflicts between current branch and target branch using **SmartStack MCP**.
|
|
10
10
|
|
|
11
11
|
**USAGE:** Before a merge or commit to ensure there are no migration conflicts.
|
|
12
12
|
|
|
13
13
|
**BEHAVIOR:** Returns exit code 1 if conflict detected (blocks merge/commit).
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## STEP 1: Check current branch
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
CURRENT_BRANCH=$(git branch --show-current)
|
|
21
|
-
echo "Current branch: $CURRENT_BRANCH"
|
|
22
|
-
|
|
23
|
-
if [ "$CURRENT_BRANCH" = "main" ] || [ "$CURRENT_BRANCH" = "develop" ]; then
|
|
24
|
-
echo "No analysis needed on $CURRENT_BRANCH"
|
|
25
|
-
exit 0
|
|
26
|
-
fi
|
|
27
|
-
```
|
|
15
|
+
**INTEGRATION:** Uses `mcp__smartstack__check_migrations` for structured analysis.
|
|
28
16
|
|
|
29
17
|
---
|
|
30
18
|
|
|
31
|
-
## STEP
|
|
19
|
+
## STEP 1: Invoke MCP check_migrations
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
LOCAL_SNAPSHOT=$(find . -name "*ModelSnapshot.cs" -not -path "*/node_modules/*" 2>/dev/null | head -1)
|
|
36
|
-
|
|
37
|
-
if [ -z "$LOCAL_SNAPSHOT" ]; then
|
|
38
|
-
echo "No ModelSnapshot found - no EF Core migrations"
|
|
39
|
-
exit 0
|
|
40
|
-
fi
|
|
21
|
+
> **MCP INTEGRATION:** This command delegates conflict analysis to the SmartStack MCP server
|
|
22
|
+
> which provides structured, consistent analysis across all SmartStack projects.
|
|
41
23
|
|
|
42
|
-
|
|
24
|
+
```
|
|
25
|
+
CALL mcp__smartstack__check_migrations WITH:
|
|
26
|
+
- branch: {current branch}
|
|
27
|
+
- compareBranch: "develop" (or specified target)
|
|
28
|
+
```
|
|
43
29
|
|
|
44
|
-
|
|
45
|
-
WORKTREE_BASE=$(git config --get gitflow.worktrees.basePath 2>/dev/null || echo "../worktrees")
|
|
46
|
-
DEVELOP_SNAPSHOT="$WORKTREE_BASE/develop/$(dirname $LOCAL_SNAPSHOT)/*ModelSnapshot.cs"
|
|
30
|
+
**Claude instruction:** Use the MCP tool `mcp__smartstack__check_migrations` with parameters:
|
|
47
31
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
exit 1
|
|
54
|
-
fi
|
|
55
|
-
fi
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"branch": "<current_branch>",
|
|
35
|
+
"compareBranch": "develop"
|
|
36
|
+
}
|
|
56
37
|
```
|
|
57
38
|
|
|
58
39
|
---
|
|
59
40
|
|
|
60
|
-
## STEP
|
|
41
|
+
## STEP 2: Parse MCP Response
|
|
61
42
|
|
|
62
|
-
|
|
63
|
-
echo ""
|
|
64
|
-
echo "MODELSNAPSHOT COMPARISON"
|
|
65
|
-
echo "========================="
|
|
66
|
-
|
|
67
|
-
# Create temporary file for develop if needed
|
|
68
|
-
if [ -n "$DEVELOP_SNAPSHOT_CONTENT" ]; then
|
|
69
|
-
TEMP_DEVELOP=$(mktemp)
|
|
70
|
-
echo "$DEVELOP_SNAPSHOT_CONTENT" > "$TEMP_DEVELOP"
|
|
71
|
-
DEVELOP_SNAPSHOT="$TEMP_DEVELOP"
|
|
72
|
-
fi
|
|
43
|
+
The MCP returns a structured `MigrationCheckResult`:
|
|
73
44
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
DIFF_LINES=$(echo "$DIFF_OUTPUT" | wc -l)
|
|
45
|
+
```typescript
|
|
46
|
+
interface MigrationCheckResult {
|
|
47
|
+
hasConflicts: boolean;
|
|
48
|
+
migrations: MigrationInfo[];
|
|
49
|
+
conflicts: MigrationConflict[];
|
|
50
|
+
suggestions: string[];
|
|
51
|
+
}
|
|
82
52
|
|
|
83
|
-
|
|
84
|
-
|
|
53
|
+
interface MigrationConflict {
|
|
54
|
+
type: 'order' | 'snapshot' | 'dependency' | 'naming';
|
|
55
|
+
description: string;
|
|
56
|
+
files: string[];
|
|
57
|
+
resolution: string;
|
|
58
|
+
}
|
|
85
59
|
```
|
|
86
60
|
|
|
87
61
|
---
|
|
88
62
|
|
|
89
|
-
## STEP
|
|
63
|
+
## STEP 3: Evaluate Conflict Level
|
|
90
64
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
DEVELOP_TABLES=$(grep -oE 'ToTable\("([^"]+)"' "$DEVELOP_SNAPSHOT" | sort -u)
|
|
100
|
-
|
|
101
|
-
# Compare tables
|
|
102
|
-
COMMON_MODIFIED=$(comm -12 <(echo "$LOCAL_TABLES") <(echo "$DEVELOP_TABLES"))
|
|
103
|
-
|
|
104
|
-
if [ -n "$COMMON_MODIFIED" ]; then
|
|
105
|
-
echo ""
|
|
106
|
-
echo "TABLES MODIFIED ON BOTH SIDES:"
|
|
107
|
-
echo "$COMMON_MODIFIED"
|
|
108
|
-
CONFLICT_LEVEL="HIGH"
|
|
109
|
-
else
|
|
110
|
-
CONFLICT_LEVEL="LOW"
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
# Check columns
|
|
114
|
-
LOCAL_COLUMNS=$(grep -oE 'Property<[^>]+>\("([^"]+)"' "$LOCAL_SNAPSHOT" | sort -u)
|
|
115
|
-
DEVELOP_COLUMNS=$(grep -oE 'Property<[^>]+>\("([^"]+)"' "$DEVELOP_SNAPSHOT" | sort -u)
|
|
116
|
-
|
|
117
|
-
# New local columns
|
|
118
|
-
NEW_LOCAL_COLUMNS=$(comm -23 <(echo "$LOCAL_COLUMNS") <(echo "$DEVELOP_COLUMNS"))
|
|
119
|
-
|
|
120
|
-
if [ -n "$NEW_LOCAL_COLUMNS" ]; then
|
|
121
|
-
echo ""
|
|
122
|
-
echo "NEW COLUMNS (this branch):"
|
|
123
|
-
echo "$NEW_LOCAL_COLUMNS" | head -10
|
|
124
|
-
fi
|
|
125
|
-
fi
|
|
126
|
-
```
|
|
65
|
+
Based on MCP response:
|
|
66
|
+
|
|
67
|
+
| Conflict Type | Level | Action |
|
|
68
|
+
|---------------|-------|--------|
|
|
69
|
+
| `naming` | LOW | Warning only |
|
|
70
|
+
| `order` | MEDIUM | Warning, suggest reorder |
|
|
71
|
+
| `dependency` | HIGH | Block merge |
|
|
72
|
+
| `snapshot` | CRITICAL | Block merge, require rebase |
|
|
127
73
|
|
|
128
74
|
---
|
|
129
75
|
|
|
130
|
-
## STEP
|
|
76
|
+
## STEP 4: Display Results
|
|
77
|
+
|
|
78
|
+
**If `hasConflicts: false`:**
|
|
131
79
|
|
|
132
|
-
```bash
|
|
133
|
-
echo ""
|
|
134
|
-
echo "OTHER BRANCHES WITH MIGRATIONS"
|
|
135
|
-
echo "==============================="
|
|
136
|
-
|
|
137
|
-
for worktree in $(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2); do
|
|
138
|
-
BRANCH=$(git -C "$worktree" branch --show-current 2>/dev/null)
|
|
139
|
-
|
|
140
|
-
if [ "$BRANCH" = "$CURRENT_BRANCH" ] || [ "$BRANCH" = "develop" ] || [ "$BRANCH" = "main" ]; then
|
|
141
|
-
continue
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
OTHER_SNAPSHOT=$(find "$worktree" -name "*ModelSnapshot.cs" 2>/dev/null | head -1)
|
|
145
|
-
|
|
146
|
-
if [ -n "$OTHER_SNAPSHOT" ]; then
|
|
147
|
-
if ! diff -q "$LOCAL_SNAPSHOT" "$OTHER_SNAPSHOT" > /dev/null 2>&1; then
|
|
148
|
-
echo "$BRANCH: Different ModelSnapshot"
|
|
149
|
-
|
|
150
|
-
# Check if same table modified
|
|
151
|
-
OTHER_TABLES=$(grep -oE 'ToTable\("([^"]+)"' "$OTHER_SNAPSHOT" | sort -u)
|
|
152
|
-
OVERLAP=$(comm -12 <(echo "$LOCAL_TABLES") <(echo "$OTHER_TABLES"))
|
|
153
|
-
|
|
154
|
-
if [ -n "$OVERLAP" ]; then
|
|
155
|
-
echo " WARNING: Common tables modified with $BRANCH"
|
|
156
|
-
CONFLICT_LEVEL="HIGH"
|
|
157
|
-
fi
|
|
158
|
-
fi
|
|
159
|
-
fi
|
|
160
|
-
done
|
|
161
80
|
```
|
|
81
|
+
================================================================================
|
|
82
|
+
EF CORE CONFLICT ANALYSIS (via MCP)
|
|
83
|
+
================================================================================
|
|
162
84
|
|
|
163
|
-
|
|
85
|
+
BRANCH: {current_branch}
|
|
86
|
+
TARGET: develop
|
|
164
87
|
|
|
165
|
-
|
|
88
|
+
STATUS: OK - No conflicts detected
|
|
89
|
+
|
|
90
|
+
Migrations: {count}
|
|
91
|
+
ModelSnapshot: Synchronized
|
|
166
92
|
|
|
167
|
-
```bash
|
|
168
|
-
echo ""
|
|
169
|
-
echo "================================================================================
|
|
170
|
-
ANALYSIS RESULT
|
|
171
93
|
================================================================================
|
|
172
|
-
"
|
|
173
|
-
|
|
174
|
-
case $CONFLICT_LEVEL in
|
|
175
|
-
"NONE")
|
|
176
|
-
echo "STATUS: OK"
|
|
177
|
-
echo "No conflict detected. Merge allowed."
|
|
178
|
-
exit 0
|
|
179
|
-
;;
|
|
180
|
-
"LOW")
|
|
181
|
-
echo "STATUS: OK (with caution)"
|
|
182
|
-
echo "Modifications on different tables. Merge allowed."
|
|
183
|
-
exit 0
|
|
184
|
-
;;
|
|
185
|
-
"MEDIUM")
|
|
186
|
-
echo "STATUS: CAUTION"
|
|
187
|
-
echo "FK to same tables. Check merge order."
|
|
188
|
-
exit 0
|
|
189
|
-
;;
|
|
190
|
-
"HIGH")
|
|
191
|
-
echo "STATUS: CONFLICT DETECTED"
|
|
192
|
-
echo ""
|
|
193
|
-
echo "RESOLUTION REQUIRED:"
|
|
194
|
-
echo " 1. /efcore:rebase-snapshot (recommended)"
|
|
195
|
-
echo " 2. /efcore:conflicts --force (not recommended)"
|
|
196
|
-
echo " 3. Merge other branch first"
|
|
197
|
-
echo ""
|
|
198
|
-
echo "BLOCKING: Merge not allowed."
|
|
199
|
-
exit 1
|
|
200
|
-
;;
|
|
201
|
-
"CRITICAL")
|
|
202
|
-
echo "STATUS: CRITICAL CONFLICT"
|
|
203
|
-
echo ""
|
|
204
|
-
echo "Same column modified on both sides."
|
|
205
|
-
echo "Manual intervention required."
|
|
206
|
-
echo ""
|
|
207
|
-
exit 1
|
|
208
|
-
;;
|
|
209
|
-
esac
|
|
210
94
|
```
|
|
211
95
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
## Output Format
|
|
96
|
+
**If `hasConflicts: true`:**
|
|
215
97
|
|
|
216
98
|
```
|
|
217
99
|
================================================================================
|
|
218
|
-
EF CORE CONFLICT ANALYSIS
|
|
100
|
+
EF CORE CONFLICT ANALYSIS (via MCP)
|
|
219
101
|
================================================================================
|
|
220
102
|
|
|
221
|
-
BRANCH:
|
|
103
|
+
BRANCH: {current_branch}
|
|
222
104
|
TARGET: develop
|
|
223
105
|
|
|
224
|
-
|
|
225
|
-
Local: a1b2c3d4 (13 migrations)
|
|
226
|
-
Develop: e5f6g7h8 (12 migrations)
|
|
227
|
-
Status: DIFFERENT
|
|
228
|
-
|
|
229
|
-
MODIFIED TABLES
|
|
230
|
-
Local: Users, Roles, UserRoles
|
|
231
|
-
Develop: Users, Permissions
|
|
106
|
+
STATUS: CONFLICT DETECTED
|
|
232
107
|
|
|
233
|
-
|
|
234
|
-
|
|
108
|
+
CONFLICTS FOUND:
|
|
109
|
+
{for each conflict in conflicts}
|
|
110
|
+
[{conflict.type}] {conflict.description}
|
|
111
|
+
Files: {conflict.files.join(', ')}
|
|
112
|
+
Resolution: {conflict.resolution}
|
|
113
|
+
{end for}
|
|
235
114
|
|
|
236
|
-
|
|
237
|
-
|
|
115
|
+
SUGGESTIONS:
|
|
116
|
+
{for each suggestion in suggestions}
|
|
117
|
+
- {suggestion}
|
|
118
|
+
{end for}
|
|
238
119
|
|
|
239
120
|
================================================================================
|
|
240
|
-
|
|
121
|
+
BLOCKING: Merge not allowed until conflicts are resolved.
|
|
241
122
|
================================================================================
|
|
242
123
|
|
|
243
|
-
RESOLUTION:
|
|
244
|
-
/efcore:rebase-snapshot Rebase on develop (recommended)
|
|
245
|
-
/efcore:conflicts --force
|
|
124
|
+
RESOLUTION OPTIONS:
|
|
125
|
+
/efcore:rebase-snapshot Rebase ModelSnapshot on develop (recommended)
|
|
126
|
+
/efcore:conflicts --force Ignore and proceed (not recommended)
|
|
246
127
|
|
|
247
128
|
================================================================================
|
|
248
129
|
```
|
|
249
130
|
|
|
250
131
|
---
|
|
251
132
|
|
|
133
|
+
## STEP 5: Exit Code
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
if [ "$HAS_CONFLICTS" = "true" ]; then
|
|
137
|
+
exit 1 # BLOCKING
|
|
138
|
+
else
|
|
139
|
+
exit 0 # OK
|
|
140
|
+
fi
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
252
145
|
## Options
|
|
253
146
|
|
|
254
147
|
| Option | Description |
|
|
255
148
|
|--------|-------------|
|
|
256
149
|
| `--force` | Ignore conflict (not recommended) |
|
|
257
|
-
| `--verbose` | Display detailed differences |
|
|
258
|
-
| `--json` | JSON output for CI/CD |
|
|
259
150
|
| `--target <branch>` | Compare with branch other than develop |
|
|
151
|
+
| `--json` | Output raw MCP JSON response |
|
|
260
152
|
|
|
261
153
|
---
|
|
262
154
|
|
|
@@ -266,4 +158,29 @@ RESOLUTION:
|
|
|
266
158
|
|------|---------|
|
|
267
159
|
| 0 | No conflict or minor conflict |
|
|
268
160
|
| 1 | Conflict detected - merge blocked |
|
|
269
|
-
| 2 |
|
|
161
|
+
| 2 | MCP connection error |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## MCP Tool Reference
|
|
166
|
+
|
|
167
|
+
**Tool:** `mcp__smartstack__check_migrations`
|
|
168
|
+
|
|
169
|
+
**Description:** Analyze EF Core migrations for conflicts, ordering issues, and ModelSnapshot discrepancies between branches
|
|
170
|
+
|
|
171
|
+
**Parameters:**
|
|
172
|
+
|
|
173
|
+
| Parameter | Type | Description |
|
|
174
|
+
|-----------|------|-------------|
|
|
175
|
+
| `projectPath` | string | EF Core project path (default: auto-detect) |
|
|
176
|
+
| `branch` | string | Git branch to check (default: current) |
|
|
177
|
+
| `compareBranch` | string | Branch to compare against |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Why MCP Integration?
|
|
182
|
+
|
|
183
|
+
1. **Consistency:** Same analysis logic across CLI, CI/CD, and IDE
|
|
184
|
+
2. **Maintainability:** Single source of truth in MCP server
|
|
185
|
+
3. **Structured Output:** Typed responses instead of bash text parsing
|
|
186
|
+
4. **Extensibility:** Easy to add new conflict types in one place
|