@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,13 +6,15 @@ model: haiku
|
|
|
6
6
|
|
|
7
7
|
# EF Core Database Status
|
|
8
8
|
|
|
9
|
-
Displays the complete status of EF Core migrations and database connection
|
|
9
|
+
Displays the complete status of EF Core migrations and database connection using **SmartStack MCP**.
|
|
10
10
|
|
|
11
11
|
**Quick command, read-only, no modifications.**
|
|
12
12
|
|
|
13
|
+
**INTEGRATION:** Uses `mcp__smartstack__check_migrations` for migration analysis.
|
|
14
|
+
|
|
13
15
|
---
|
|
14
16
|
|
|
15
|
-
## STEP 1: Detect
|
|
17
|
+
## STEP 1: Detect Configuration
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
# Check config files
|
|
@@ -36,7 +38,33 @@ PROJECT_NAME=$(basename "$CSPROJ" .csproj)
|
|
|
36
38
|
|
|
37
39
|
---
|
|
38
40
|
|
|
39
|
-
## STEP 2:
|
|
41
|
+
## STEP 2: Invoke MCP for Migration Status
|
|
42
|
+
|
|
43
|
+
> **MCP INTEGRATION:** Get structured migration info from SmartStack MCP.
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"tool": "mcp__smartstack__check_migrations",
|
|
48
|
+
"parameters": {
|
|
49
|
+
"branch": "<current_branch>"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Claude instruction:** Call the MCP tool to get migration list:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
CALL mcp__smartstack__check_migrations WITH:
|
|
58
|
+
- branch: {current_branch}
|
|
59
|
+
|
|
60
|
+
EXTRACT from response:
|
|
61
|
+
- migrations[] -> list of all migrations
|
|
62
|
+
- conflicts[] -> any naming/ordering issues
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## STEP 3: Test Database Connection
|
|
40
68
|
|
|
41
69
|
```bash
|
|
42
70
|
cd "$PROJECT_DIR"
|
|
@@ -44,30 +72,27 @@ cd "$PROJECT_DIR"
|
|
|
44
72
|
# Test connection with EF Core
|
|
45
73
|
CONNECTION_OK=$(dotnet ef database list 2>&1)
|
|
46
74
|
if echo "$CONNECTION_OK" | grep -q "error\|Error\|failed"; then
|
|
47
|
-
CONNECTION_STATUS="
|
|
75
|
+
CONNECTION_STATUS="FAILED"
|
|
48
76
|
CONNECTION_ERROR="$CONNECTION_OK"
|
|
49
77
|
else
|
|
50
|
-
CONNECTION_STATUS="
|
|
78
|
+
CONNECTION_STATUS="OK"
|
|
51
79
|
fi
|
|
52
80
|
```
|
|
53
81
|
|
|
54
82
|
---
|
|
55
83
|
|
|
56
|
-
## STEP
|
|
84
|
+
## STEP 4: Get Applied vs Pending
|
|
57
85
|
|
|
58
86
|
```bash
|
|
59
|
-
# Migrations in code
|
|
87
|
+
# Migrations in code vs applied
|
|
60
88
|
CODE_MIGRATIONS=$(dotnet ef migrations list 2>/dev/null | grep -v "^Build" | grep -v "^$")
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# Applied vs pending migrations
|
|
64
|
-
APPLIED=$(dotnet ef migrations list 2>/dev/null | grep "(Pending)" -v | grep -v "^Build" | wc -l)
|
|
89
|
+
APPLIED=$(dotnet ef migrations list 2>/dev/null | grep -v "(Pending)" | grep -v "^Build" | wc -l)
|
|
65
90
|
PENDING=$(dotnet ef migrations list 2>/dev/null | grep "(Pending)" | wc -l)
|
|
66
91
|
```
|
|
67
92
|
|
|
68
93
|
---
|
|
69
94
|
|
|
70
|
-
## STEP
|
|
95
|
+
## STEP 5: Display Report
|
|
71
96
|
|
|
72
97
|
```
|
|
73
98
|
================================================================================
|
|
@@ -77,130 +102,102 @@ PENDING=$(dotnet ef migrations list 2>/dev/null | grep "(Pending)" | wc -l)
|
|
|
77
102
|
PROJECT
|
|
78
103
|
Name: {PROJECT_NAME}
|
|
79
104
|
Config: {CONFIG_USED}
|
|
80
|
-
DbContext:
|
|
105
|
+
DbContext: ApplicationDbContext
|
|
81
106
|
|
|
82
107
|
CONNECTION
|
|
83
108
|
Status: {CONNECTION_STATUS}
|
|
84
109
|
Server: {SERVER}
|
|
85
110
|
Database: {DATABASE}
|
|
86
111
|
|
|
87
|
-
MIGRATIONS
|
|
88
|
-
Total: {
|
|
89
|
-
Applied: {APPLIED}
|
|
90
|
-
Pending: {PENDING} {
|
|
112
|
+
MIGRATIONS (from MCP)
|
|
113
|
+
Total: {migrations.length}
|
|
114
|
+
Applied: {APPLIED}
|
|
115
|
+
Pending: {PENDING} {if > 0: "-> /efcore:db-deploy"}
|
|
91
116
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
**If pending migrations:**
|
|
117
|
+
NAMING CONVENTION CHECK (from MCP)
|
|
118
|
+
Format: {context}_v{version}_{sequence}_{Description}
|
|
119
|
+
Compliance: {conflicts.filter(c => c.type === 'naming').length === 0 ? "OK" : "WARNINGS"}
|
|
96
120
|
|
|
121
|
+
================================================================================
|
|
97
122
|
```
|
|
98
|
-
PENDING MIGRATIONS
|
|
99
|
-
────────────────────────────────────────────────────────────────────────────────
|
|
100
|
-
1. {MigrationName1} (Pending)
|
|
101
|
-
2. {MigrationName2} (Pending)
|
|
102
|
-
────────────────────────────────────────────────────────────────────────────────
|
|
103
123
|
|
|
104
|
-
|
|
105
|
-
```
|
|
124
|
+
---
|
|
106
125
|
|
|
107
|
-
|
|
126
|
+
## STEP 5.1: Display Migration List (from MCP)
|
|
108
127
|
|
|
109
128
|
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
3. Does the database exist?
|
|
119
|
-
|
|
120
|
-
COMMANDS:
|
|
121
|
-
/efcore:db-reset → Create/recreate database
|
|
122
|
-
/gitflow:10-start → Configure appsettings.Local.json
|
|
129
|
+
MIGRATIONS LIST
|
|
130
|
+
--------------------------------------------------------------------------------
|
|
131
|
+
# | Name | Context | Version | Sequence
|
|
132
|
+
--------------------------------------------------------------------------------
|
|
133
|
+
{for each migration in migrations}
|
|
134
|
+
{i} | {migration.name} | {migration.context} | {migration.version} | {migration.sequence}
|
|
135
|
+
{end for}
|
|
136
|
+
--------------------------------------------------------------------------------
|
|
123
137
|
```
|
|
124
138
|
|
|
125
139
|
---
|
|
126
140
|
|
|
127
|
-
## STEP
|
|
141
|
+
## STEP 5.2: Check "1 Migration per Feature" Rule
|
|
128
142
|
|
|
129
143
|
```bash
|
|
130
|
-
# Current branch
|
|
131
144
|
CURRENT_BRANCH=$(git branch --show-current)
|
|
132
145
|
|
|
133
146
|
# Extract branch type
|
|
134
147
|
if [[ "$CURRENT_BRANCH" == feature/* ]]; then
|
|
135
148
|
BRANCH_TYPE="Feature"
|
|
136
|
-
BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's/feature\///' | sed 's/-/_/g')
|
|
137
149
|
elif [[ "$CURRENT_BRANCH" == hotfix/* ]]; then
|
|
138
150
|
BRANCH_TYPE="Hotfix"
|
|
139
|
-
BRANCH_NAME=$(echo "$CURRENT_BRANCH" | sed 's/hotfix\///' | sed 's/-/_/g')
|
|
140
|
-
else
|
|
141
|
-
BRANCH_TYPE=""
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
# If on a feature/hotfix, count migrations for this branch
|
|
145
|
-
if [ -n "$BRANCH_TYPE" ]; then
|
|
146
|
-
# Search for migrations matching the branch pattern
|
|
147
|
-
BRANCH_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -iE "${BRANCH_TYPE}.*${BRANCH_NAME}" | grep -v "Designer" | grep -v "Snapshot" | wc -l)
|
|
148
151
|
fi
|
|
149
152
|
```
|
|
150
153
|
|
|
151
|
-
**Display
|
|
154
|
+
**Display:**
|
|
152
155
|
|
|
153
156
|
```
|
|
154
157
|
"1 MIGRATION PER FEATURE" RULE
|
|
155
|
-
|
|
158
|
+
--------------------------------------------------------------------------------
|
|
156
159
|
Branch: {CURRENT_BRANCH}
|
|
157
|
-
Migrations: {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
**If BRANCH_MIGRATIONS > 1:**
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
⚠️ WARNING: {BRANCH_MIGRATIONS} migrations detected for this branch!
|
|
164
|
-
Rule: 1 migration only per feature/hotfix
|
|
165
|
-
|
|
166
|
-
RECOMMENDED ACTION:
|
|
167
|
-
/efcore:migration → Recreate as single migration
|
|
168
|
-
|
|
169
|
-
Multiple migrations cause problems during merge.
|
|
170
|
-
────────────────────────────────────────────────────────────────────────────────
|
|
160
|
+
Migrations: {count for this branch}
|
|
161
|
+
Status: {OK if count <= 1, else WARNING}
|
|
162
|
+
--------------------------------------------------------------------------------
|
|
171
163
|
```
|
|
172
164
|
|
|
173
|
-
|
|
165
|
+
---
|
|
174
166
|
|
|
175
|
-
|
|
176
|
-
✓ Rule respected: 1 migration for this branch
|
|
177
|
-
────────────────────────────────────────────────────────────────────────────────
|
|
178
|
-
```
|
|
167
|
+
## STEP 6: Show Warnings from MCP
|
|
179
168
|
|
|
180
|
-
|
|
169
|
+
If MCP returned conflicts or warnings:
|
|
181
170
|
|
|
182
171
|
```
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
172
|
+
WARNINGS (from MCP analysis)
|
|
173
|
+
--------------------------------------------------------------------------------
|
|
174
|
+
{for each conflict in conflicts}
|
|
175
|
+
[{conflict.type}] {conflict.description}
|
|
176
|
+
Resolution: {conflict.resolution}
|
|
177
|
+
{end for}
|
|
178
|
+
--------------------------------------------------------------------------------
|
|
186
179
|
```
|
|
187
180
|
|
|
188
181
|
---
|
|
189
182
|
|
|
190
|
-
## STEP
|
|
183
|
+
## STEP 7: Connection Error Handling
|
|
191
184
|
|
|
192
|
-
|
|
193
|
-
# Database size (if connection OK)
|
|
194
|
-
DB_SIZE=$(sqlcmd -S "$SERVER" -E -Q "SELECT CAST(SUM(size * 8 / 1024.0) AS DECIMAL(10,2)) AS 'MB' FROM sys.master_files WHERE database_id = DB_ID('$DATABASE')" -h -1 2>/dev/null)
|
|
185
|
+
**If connection error:**
|
|
195
186
|
|
|
196
|
-
# Number of tables
|
|
197
|
-
TABLE_COUNT=$(sqlcmd -S "$SERVER" -E -d "$DATABASE" -Q "SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'" -h -1 2>/dev/null)
|
|
198
187
|
```
|
|
188
|
+
CONNECTION PROBLEM
|
|
189
|
+
--------------------------------------------------------------------------------
|
|
190
|
+
{CONNECTION_ERROR}
|
|
191
|
+
--------------------------------------------------------------------------------
|
|
199
192
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
193
|
+
TROUBLESHOOTING:
|
|
194
|
+
1. Is SQL Server running?
|
|
195
|
+
2. Is appsettings.Local.json configured?
|
|
196
|
+
3. Does the database exist?
|
|
197
|
+
|
|
198
|
+
COMMANDS:
|
|
199
|
+
/efcore:db-reset -> Create/recreate database
|
|
200
|
+
/gitflow:10-start -> Configure appsettings.Local.json
|
|
204
201
|
```
|
|
205
202
|
|
|
206
203
|
---
|
|
@@ -212,3 +209,18 @@ STATISTICS
|
|
|
212
209
|
| `--verbose` | Display all migrations with details |
|
|
213
210
|
| `--json` | JSON output for scripting |
|
|
214
211
|
| `--context {name}` | Specify the DbContext |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## MCP Tool Reference
|
|
216
|
+
|
|
217
|
+
**Tool:** `mcp__smartstack__check_migrations`
|
|
218
|
+
|
|
219
|
+
**Used for:**
|
|
220
|
+
- Getting structured list of migrations (name, context, version, sequence)
|
|
221
|
+
- Detecting naming convention violations
|
|
222
|
+
- Checking migration order
|
|
223
|
+
|
|
224
|
+
**Response fields used:**
|
|
225
|
+
- `migrations[]` - List of all migrations with parsed metadata
|
|
226
|
+
- `conflicts[]` - Any issues detected (naming, order)
|
|
@@ -236,24 +236,36 @@ AskUserQuestion({
|
|
|
236
236
|
## STEP 6: Generate Migration Name
|
|
237
237
|
|
|
238
238
|
```bash
|
|
239
|
-
# Pattern: {
|
|
240
|
-
# Example:
|
|
239
|
+
# Pattern: {context}_v{version}_{sequence}_{Description}
|
|
240
|
+
# Example: core_v1.0.0_001_AddUserRoles
|
|
241
|
+
# This format is aligned with SmartStack MCP conventions
|
|
241
242
|
|
|
242
|
-
|
|
243
|
+
# Determine context based on branch type
|
|
244
|
+
if [[ "$BRANCH_TYPE" == "Feature" ]] || [[ "$BRANCH_TYPE" == "Hotfix" ]]; then
|
|
245
|
+
CONTEXT="core" # Default context for feature/hotfix
|
|
246
|
+
else
|
|
247
|
+
CONTEXT="core"
|
|
248
|
+
fi
|
|
249
|
+
|
|
250
|
+
# Get next sequence number
|
|
251
|
+
EXISTING_COUNT=$(find "$MIGRATIONS_DIR" -name "${CONTEXT}_v${VERSION}*.cs" | grep -v "Designer" | grep -v "Snapshot" | wc -l)
|
|
252
|
+
SEQUENCE=$(printf "%03d" $((EXISTING_COUNT + 1)))
|
|
253
|
+
|
|
254
|
+
MIGRATION_NAME="${CONTEXT}_v${VERSION}_${SEQUENCE}_${DESCRIPTION}"
|
|
243
255
|
|
|
244
|
-
# Clean the name (no spaces, no special characters)
|
|
245
|
-
MIGRATION_NAME=$(echo "$MIGRATION_NAME" | sed 's/[^a-zA-Z0-9_]//g')
|
|
256
|
+
# Clean the name (no spaces, no special characters except underscore and dot)
|
|
257
|
+
MIGRATION_NAME=$(echo "$MIGRATION_NAME" | sed 's/[^a-zA-Z0-9_.]//g')
|
|
246
258
|
|
|
247
259
|
echo "Migration name: $MIGRATION_NAME"
|
|
248
260
|
```
|
|
249
261
|
|
|
250
|
-
**Generated name examples:**
|
|
262
|
+
**Generated name examples (aligned with MCP):**
|
|
251
263
|
|
|
252
|
-
|
|
|
253
|
-
|
|
254
|
-
|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
264
|
+
| Context | Version | Sequence | Description | Final Name |
|
|
265
|
+
|---------|---------|----------|-------------|------------|
|
|
266
|
+
| core | 1.2.0 | 001 | AddUserRoles | core_v1.2.0_001_AddUserRoles |
|
|
267
|
+
| core | 1.2.0 | 002 | AddPermissions | core_v1.2.0_002_AddPermissions |
|
|
268
|
+
| extensions | 1.3.0 | 001 | AddCustomFields | extensions_v1.3.0_001_AddCustomFields |
|
|
257
269
|
|
|
258
270
|
---
|
|
259
271
|
|
|
@@ -6,27 +6,22 @@ model: sonnet
|
|
|
6
6
|
|
|
7
7
|
# EF Core Scan - Cross-Branch Migration Scanner
|
|
8
8
|
|
|
9
|
-
Scans all active branches to detect migrations and analyze conflict risks
|
|
9
|
+
Scans all active branches to detect migrations and analyze conflict risks using **SmartStack MCP**.
|
|
10
10
|
|
|
11
11
|
**USAGE:** Before creating a migration or before a merge to check the status of other branches.
|
|
12
12
|
|
|
13
13
|
**SECURITY:** Read-only - no modifications.
|
|
14
14
|
|
|
15
|
+
**INTEGRATION:** Uses `mcp__smartstack__check_migrations` for each branch comparison.
|
|
16
|
+
|
|
15
17
|
---
|
|
16
18
|
|
|
17
|
-
## STEP 1:
|
|
19
|
+
## STEP 1: Detect Active Worktrees
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if [ ! -d "$WORKTREE_BASE" ]; then
|
|
24
|
-
echo "Worktrees structure not found: $WORKTREE_BASE"
|
|
25
|
-
echo "Run /gitflow:1-init to create structure"
|
|
26
|
-
exit 1
|
|
27
|
-
fi
|
|
22
|
+
# List all git worktrees
|
|
23
|
+
WORKTREES=$(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2)
|
|
28
24
|
|
|
29
|
-
# List all worktrees
|
|
30
25
|
echo "DETECTED WORKTREES"
|
|
31
26
|
echo "=================="
|
|
32
27
|
git worktree list
|
|
@@ -35,142 +30,115 @@ echo ""
|
|
|
35
30
|
|
|
36
31
|
---
|
|
37
32
|
|
|
38
|
-
## STEP 2:
|
|
33
|
+
## STEP 2: Invoke MCP for Each Branch
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
# For each worktree
|
|
42
|
-
for worktree in $(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2); do
|
|
43
|
-
BRANCH=$(git -C "$worktree" branch --show-current 2>/dev/null)
|
|
44
|
-
|
|
45
|
-
if [ -z "$BRANCH" ]; then
|
|
46
|
-
continue
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
# Find Migrations folder
|
|
50
|
-
MIGRATIONS_DIR=$(find "$worktree" -type d -name "Migrations" 2>/dev/null | head -1)
|
|
51
|
-
|
|
52
|
-
if [ -n "$MIGRATIONS_DIR" ]; then
|
|
53
|
-
# Count migrations
|
|
54
|
-
MIGRATION_COUNT=$(find "$MIGRATIONS_DIR" -name "*.cs" | grep -v "Designer" | grep -v "Snapshot" | wc -l)
|
|
55
|
-
|
|
56
|
-
# ModelSnapshot hash
|
|
57
|
-
SNAPSHOT=$(find "$MIGRATIONS_DIR" -name "*ModelSnapshot.cs" 2>/dev/null | head -1)
|
|
58
|
-
if [ -n "$SNAPSHOT" ]; then
|
|
59
|
-
SNAPSHOT_HASH=$(md5sum "$SNAPSHOT" 2>/dev/null | cut -d' ' -f1 | head -c 8)
|
|
60
|
-
else
|
|
61
|
-
SNAPSHOT_HASH="N/A"
|
|
62
|
-
fi
|
|
35
|
+
> **MCP INTEGRATION:** For each active branch, call the MCP to get structured analysis.
|
|
63
36
|
|
|
64
|
-
|
|
65
|
-
fi
|
|
66
|
-
done
|
|
67
|
-
```
|
|
37
|
+
For each worktree/branch, call:
|
|
68
38
|
|
|
69
|
-
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"tool": "mcp__smartstack__check_migrations",
|
|
42
|
+
"parameters": {
|
|
43
|
+
"branch": "<branch_name>",
|
|
44
|
+
"compareBranch": "develop"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
70
48
|
|
|
71
|
-
|
|
49
|
+
**Claude instruction:** Loop through detected branches and invoke MCP:
|
|
72
50
|
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if [ -n "$DEVELOP_SNAPSHOT" ]; then
|
|
81
|
-
DEVELOP_HASH=$(md5sum "$DEVELOP_SNAPSHOT" 2>/dev/null | cut -d' ' -f1)
|
|
82
|
-
echo ""
|
|
83
|
-
echo "REFERENCE: develop ModelSnapshot = ${DEVELOP_HASH:0:8}"
|
|
84
|
-
fi
|
|
85
|
-
fi
|
|
51
|
+
```
|
|
52
|
+
FOR each branch in [feature/*, hotfix/*, release/*]:
|
|
53
|
+
CALL mcp__smartstack__check_migrations WITH:
|
|
54
|
+
- branch: {branch}
|
|
55
|
+
- compareBranch: "develop"
|
|
56
|
+
STORE result in BRANCH_RESULTS[branch]
|
|
86
57
|
```
|
|
87
58
|
|
|
88
59
|
---
|
|
89
60
|
|
|
90
|
-
## STEP
|
|
61
|
+
## STEP 3: Aggregate Results
|
|
91
62
|
|
|
92
|
-
|
|
93
|
-
echo ""
|
|
94
|
-
echo "RISK ANALYSIS"
|
|
95
|
-
echo "==================="
|
|
96
|
-
|
|
97
|
-
# Compare each branch with develop
|
|
98
|
-
for worktree in $(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2); do
|
|
99
|
-
BRANCH=$(git -C "$worktree" branch --show-current 2>/dev/null)
|
|
100
|
-
|
|
101
|
-
if [ "$BRANCH" = "develop" ] || [ "$BRANCH" = "main" ]; then
|
|
102
|
-
continue
|
|
103
|
-
fi
|
|
104
|
-
|
|
105
|
-
SNAPSHOT=$(find "$worktree" -name "*ModelSnapshot.cs" 2>/dev/null | head -1)
|
|
106
|
-
|
|
107
|
-
if [ -n "$SNAPSHOT" ] && [ -n "$DEVELOP_SNAPSHOT" ]; then
|
|
108
|
-
# Compare snapshots
|
|
109
|
-
if diff -q "$SNAPSHOT" "$DEVELOP_SNAPSHOT" > /dev/null 2>&1; then
|
|
110
|
-
RISK="NONE"
|
|
111
|
-
else
|
|
112
|
-
# Analyze differences
|
|
113
|
-
DIFF_LINES=$(diff "$DEVELOP_SNAPSHOT" "$SNAPSHOT" 2>/dev/null | wc -l)
|
|
114
|
-
|
|
115
|
-
if [ "$DIFF_LINES" -lt 50 ]; then
|
|
116
|
-
RISK="LOW"
|
|
117
|
-
elif [ "$DIFF_LINES" -lt 200 ]; then
|
|
118
|
-
RISK="MEDIUM"
|
|
119
|
-
else
|
|
120
|
-
RISK="HIGH"
|
|
121
|
-
fi
|
|
122
|
-
fi
|
|
63
|
+
Parse MCP responses to build summary:
|
|
123
64
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
65
|
+
```typescript
|
|
66
|
+
interface ScanSummary {
|
|
67
|
+
branches: BranchScan[];
|
|
68
|
+
totalMigrations: number;
|
|
69
|
+
conflictCount: number;
|
|
70
|
+
recommendedMergeOrder: string[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface BranchScan {
|
|
74
|
+
name: string;
|
|
75
|
+
migrationCount: number;
|
|
76
|
+
riskLevel: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH';
|
|
77
|
+
conflicts: MigrationConflict[];
|
|
78
|
+
}
|
|
127
79
|
```
|
|
128
80
|
|
|
81
|
+
**Risk Level Calculation:**
|
|
82
|
+
|
|
83
|
+
| Condition | Risk Level |
|
|
84
|
+
|-----------|------------|
|
|
85
|
+
| Snapshot identical to develop | NONE |
|
|
86
|
+
| Different tables modified | LOW |
|
|
87
|
+
| FK to same tables | MEDIUM |
|
|
88
|
+
| Same tables/columns modified | HIGH |
|
|
89
|
+
|
|
129
90
|
---
|
|
130
91
|
|
|
131
|
-
## STEP
|
|
92
|
+
## STEP 4: Calculate Merge Order
|
|
93
|
+
|
|
94
|
+
Based on conflict analysis, recommend merge order:
|
|
132
95
|
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
echo "2. Branches with RISK=LOW (minor modifications)"
|
|
139
|
-
echo "3. Branches with RISK=MEDIUM (order matters)"
|
|
140
|
-
echo "4. Branches with RISK=HIGH (rebase required before merge)"
|
|
96
|
+
```
|
|
97
|
+
1. Branches with RISK=NONE (can merge immediately)
|
|
98
|
+
2. Branches with RISK=LOW (minor modifications, safe to merge)
|
|
99
|
+
3. Branches with RISK=MEDIUM (order matters, merge carefully)
|
|
100
|
+
4. Branches with RISK=HIGH (rebase required before merge)
|
|
141
101
|
```
|
|
142
102
|
|
|
143
103
|
---
|
|
144
104
|
|
|
145
|
-
##
|
|
105
|
+
## STEP 5: Display Report
|
|
146
106
|
|
|
147
107
|
```
|
|
148
108
|
================================================================================
|
|
149
|
-
EF CORE CROSS-BRANCH SCAN
|
|
109
|
+
EF CORE CROSS-BRANCH SCAN (via MCP)
|
|
150
110
|
================================================================================
|
|
151
111
|
|
|
152
|
-
DETECTED WORKTREES (
|
|
112
|
+
DETECTED WORKTREES ({count})
|
|
153
113
|
main/ [main]
|
|
154
|
-
develop/ [develop]
|
|
114
|
+
develop/ [develop] <- REFERENCE
|
|
155
115
|
features/user-auth/ [feature/user-auth]
|
|
156
116
|
features/add-products/ [feature/add-products]
|
|
157
117
|
hotfixes/login-fix/ [hotfix/login-fix]
|
|
158
118
|
|
|
159
119
|
MIGRATIONS PER BRANCH
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
120
|
+
--------------------------------------------------------------------------------
|
|
121
|
+
Branch | Migrations | Snapshot | vs Develop
|
|
122
|
+
--------------------------------------------------------------------------------
|
|
123
|
+
develop | 12 | a1b2c3d4 | REFERENCE
|
|
124
|
+
feature/user-auth | 13 | e5f6g7h8 | +1 migration
|
|
125
|
+
feature/add-products | 13 | i9j0k1l2 | +1 migration
|
|
126
|
+
hotfix/login-fix | 12 | a1b2c3d4 | identical
|
|
127
|
+
--------------------------------------------------------------------------------
|
|
164
128
|
|
|
165
129
|
RISK ANALYSIS
|
|
166
|
-
|
|
167
|
-
feature/
|
|
168
|
-
|
|
130
|
+
--------------------------------------------------------------------------------
|
|
131
|
+
feature/user-auth : LOW (different tables)
|
|
132
|
+
feature/add-products : MEDIUM (FK to same table)
|
|
133
|
+
hotfix/login-fix : NONE (snapshot = develop)
|
|
134
|
+
--------------------------------------------------------------------------------
|
|
169
135
|
|
|
170
136
|
RECOMMENDED MERGE ORDER
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
137
|
+
--------------------------------------------------------------------------------
|
|
138
|
+
1. hotfix/login-fix -> NONE (direct merge OK)
|
|
139
|
+
2. feature/user-auth -> LOW (merge OK)
|
|
140
|
+
3. feature/add-products -> MEDIUM (after user-auth, then rebase)
|
|
141
|
+
--------------------------------------------------------------------------------
|
|
174
142
|
|
|
175
143
|
================================================================================
|
|
176
144
|
```
|
|
@@ -181,10 +149,10 @@ RECOMMENDED MERGE ORDER
|
|
|
181
149
|
|
|
182
150
|
| Option | Description |
|
|
183
151
|
|--------|-------------|
|
|
184
|
-
| `--json` | JSON
|
|
185
|
-
| `--branch <name>` | Scan
|
|
186
|
-
| `--verbose` |
|
|
187
|
-
| `--no-recommend` |
|
|
152
|
+
| `--json` | Output raw JSON for CI/CD |
|
|
153
|
+
| `--branch <name>` | Scan specific branch only |
|
|
154
|
+
| `--verbose` | Show detailed MCP responses |
|
|
155
|
+
| `--no-recommend` | Skip merge order recommendations |
|
|
188
156
|
|
|
189
157
|
---
|
|
190
158
|
|
|
@@ -194,9 +162,37 @@ RECOMMENDED MERGE ORDER
|
|
|
194
162
|
# GitHub Actions
|
|
195
163
|
- name: Scan EF Core migrations
|
|
196
164
|
run: |
|
|
165
|
+
# Claude Code will use MCP internally
|
|
197
166
|
OUTPUT=$(claude-code "/efcore:scan --json")
|
|
198
|
-
|
|
199
|
-
if [ "$
|
|
200
|
-
echo "::warning
|
|
167
|
+
HIGH_RISK=$(echo $OUTPUT | jq '[.branches[] | select(.riskLevel == "HIGH")] | length')
|
|
168
|
+
if [ "$HIGH_RISK" -gt 0 ]; then
|
|
169
|
+
echo "::warning::$HIGH_RISK branches have HIGH risk migration conflicts"
|
|
201
170
|
fi
|
|
202
171
|
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## MCP Tool Reference
|
|
176
|
+
|
|
177
|
+
**Tool:** `mcp__smartstack__check_migrations`
|
|
178
|
+
|
|
179
|
+
**Description:** Analyze EF Core migrations for conflicts, ordering issues, and ModelSnapshot discrepancies between branches
|
|
180
|
+
|
|
181
|
+
**Parameters:**
|
|
182
|
+
|
|
183
|
+
| Parameter | Type | Description |
|
|
184
|
+
|-----------|------|-------------|
|
|
185
|
+
| `projectPath` | string | EF Core project path (default: auto-detect) |
|
|
186
|
+
| `branch` | string | Git branch to check (default: current) |
|
|
187
|
+
| `compareBranch` | string | Branch to compare against |
|
|
188
|
+
|
|
189
|
+
**Response:** `MigrationCheckResult` with `hasConflicts`, `migrations[]`, `conflicts[]`, `suggestions[]`
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Why MCP Integration?
|
|
194
|
+
|
|
195
|
+
1. **Consistency:** Identical analysis logic for single branch (`/efcore:conflicts`) and multi-branch (`/efcore:scan`)
|
|
196
|
+
2. **Accuracy:** Structured parsing instead of regex on ModelSnapshot files
|
|
197
|
+
3. **Extensibility:** New conflict types added in MCP benefit all commands
|
|
198
|
+
4. **Caching:** MCP can cache results for faster subsequent scans
|