@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.
Files changed (58) hide show
  1. package/.documentation/agents.html +916 -916
  2. package/.documentation/apex.html +1018 -1018
  3. package/.documentation/business-analyse.html +1501 -1501
  4. package/.documentation/commands.html +680 -680
  5. package/.documentation/css/styles.css +2168 -2168
  6. package/.documentation/efcore.html +2505 -2505
  7. package/.documentation/gitflow.html +2618 -2618
  8. package/.documentation/hooks.html +413 -413
  9. package/.documentation/index.html +323 -323
  10. package/.documentation/installation.html +462 -462
  11. package/.documentation/js/app.js +794 -794
  12. package/.documentation/test-web.html +513 -513
  13. package/dist/index.js +807 -277
  14. package/dist/index.js.map +1 -1
  15. package/package.json +1 -1
  16. package/templates/agents/efcore/conflicts.md +44 -17
  17. package/templates/agents/efcore/db-status.md +27 -6
  18. package/templates/agents/efcore/scan.md +43 -13
  19. package/templates/commands/ai-prompt.md +315 -315
  20. package/templates/commands/application/create.md +362 -362
  21. package/templates/commands/controller/create.md +216 -216
  22. package/templates/commands/controller.md +59 -0
  23. package/templates/commands/documentation/module.md +202 -202
  24. package/templates/commands/efcore/_env-check.md +153 -153
  25. package/templates/commands/efcore/conflicts.md +109 -192
  26. package/templates/commands/efcore/db-status.md +101 -89
  27. package/templates/commands/efcore/migration.md +23 -11
  28. package/templates/commands/efcore/scan.md +115 -119
  29. package/templates/commands/efcore.md +54 -6
  30. package/templates/commands/feature-full.md +267 -267
  31. package/templates/commands/gitflow/11-finish.md +145 -11
  32. package/templates/commands/gitflow/13-sync.md +216 -216
  33. package/templates/commands/gitflow/14-rebase.md +251 -251
  34. package/templates/commands/gitflow/2-status.md +120 -10
  35. package/templates/commands/gitflow/3-commit.md +150 -0
  36. package/templates/commands/gitflow/7-pull-request.md +134 -5
  37. package/templates/commands/gitflow/9-merge.md +142 -1
  38. package/templates/commands/implement.md +663 -663
  39. package/templates/commands/init.md +562 -0
  40. package/templates/commands/mcp-integration.md +330 -0
  41. package/templates/commands/notification.md +129 -129
  42. package/templates/commands/validate.md +233 -0
  43. package/templates/commands/workflow.md +193 -193
  44. package/templates/skills/ai-prompt/SKILL.md +778 -778
  45. package/templates/skills/application/SKILL.md +563 -563
  46. package/templates/skills/application/templates-backend.md +450 -450
  47. package/templates/skills/application/templates-frontend.md +531 -531
  48. package/templates/skills/application/templates-i18n.md +520 -520
  49. package/templates/skills/application/templates-seed.md +647 -647
  50. package/templates/skills/controller/SKILL.md +240 -240
  51. package/templates/skills/controller/postman-templates.md +614 -614
  52. package/templates/skills/controller/templates.md +1468 -1468
  53. package/templates/skills/documentation/SKILL.md +133 -133
  54. package/templates/skills/documentation/templates.md +476 -476
  55. package/templates/skills/feature-full/SKILL.md +838 -838
  56. package/templates/skills/notification/SKILL.md +555 -555
  57. package/templates/skills/ui-components/SKILL.md +870 -870
  58. 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 configuration
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: Test connection
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="❌ Failed"
75
+ CONNECTION_STATUS="FAILED"
48
76
  CONNECTION_ERROR="$CONNECTION_OK"
49
77
  else
50
- CONNECTION_STATUS="OK"
78
+ CONNECTION_STATUS="OK"
51
79
  fi
52
80
  ```
53
81
 
54
82
  ---
55
83
 
56
- ## STEP 3: List migrations
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
- TOTAL_MIGRATIONS=$(echo "$CODE_MIGRATIONS" | wc -l)
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 4: Display report
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: {CONTEXT_NAME}
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: {TOTAL_MIGRATIONS}
89
- Applied: {APPLIED}
90
- Pending: {PENDING} {⚠️ if > 0}
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
- → Use /efcore:db-deploy to apply migrations
105
- ```
124
+ ---
106
125
 
107
- **If connection error:**
126
+ ## STEP 5.1: Display Migration List (from MCP)
108
127
 
109
128
  ```
110
- ⚠️ CONNECTION PROBLEM
111
- ────────────────────────────────────────────────────────────────────────────────
112
- {CONNECTION_ERROR}
113
- ────────────────────────────────────────────────────────────────────────────────
114
-
115
- CHECKS:
116
- 1. Is SQL Server running?
117
- 2. Is appsettings.Local.json configured?
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 4.5: Check "1 migration per feature" rule
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 verification:**
154
+ **Display:**
152
155
 
153
156
  ```
154
157
  "1 MIGRATION PER FEATURE" RULE
155
- ────────────────────────────────────────────────────────────────────────────────
158
+ --------------------------------------------------------------------------------
156
159
  Branch: {CURRENT_BRANCH}
157
- Migrations: {BRANCH_MIGRATIONS} for this branch
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
- **If BRANCH_MIGRATIONS == 1:**
165
+ ---
174
166
 
175
- ```
176
- ✓ Rule respected: 1 migration for this branch
177
- ────────────────────────────────────────────────────────────────────────────────
178
- ```
167
+ ## STEP 6: Show Warnings from MCP
179
168
 
180
- **If BRANCH_MIGRATIONS == 0 and pending modifications:**
169
+ If MCP returned conflicts or warnings:
181
170
 
182
171
  ```
183
- No migrations for this branch
184
- → Use /efcore:migration if you modified the model
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 5: Additional info (optional)
183
+ ## STEP 7: Connection Error Handling
191
184
 
192
- ```bash
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
- STATISTICS
202
- Size: {DB_SIZE} MB
203
- Tables: {TABLE_COUNT}
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: {BranchType}_{Version}_{BranchName}_{Description}
240
- # Example: Feature_1_2_0_UserAuth_AddRolesTable
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
- MIGRATION_NAME="${BRANCH_TYPE}_${VERSION_CLEAN}_${BRANCH_NAME}_${DESCRIPTION}"
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
- | Branch | Version | Description | Final Name |
253
- |--------|---------|-------------|------------|
254
- | feature/user-auth | 1.2.0 | AddRolesTable | Feature_1_2_0_UserAuth_AddRolesTable |
255
- | hotfix/login-fix | 1.2.1 | FixNullEmail | Hotfix_1_2_1_LoginFix_FixNullEmail |
256
- | release/v1.3.0 | 1.3.0 | Initial | Release_1_3_0_Initial |
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: List active worktrees
19
+ ## STEP 1: Detect Active Worktrees
18
20
 
19
21
  ```bash
20
- # Check that worktrees exist
21
- WORKTREE_BASE=$(git config --get gitflow.worktrees.basePath 2>/dev/null || echo "../worktrees")
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: Scan migrations per branch
33
+ ## STEP 2: Invoke MCP for Each Branch
39
34
 
40
- ```bash
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
- echo "$BRANCH | $MIGRATION_COUNT migrations | Snapshot: $SNAPSHOT_HASH"
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
- ## STEP 3: Compare with develop
49
+ **Claude instruction:** Loop through detected branches and invoke MCP:
72
50
 
73
- ```bash
74
- # Get develop's ModelSnapshot hash
75
- DEVELOP_WORKTREE="$WORKTREE_BASE/develop"
76
-
77
- if [ -d "$DEVELOP_WORKTREE" ]; then
78
- DEVELOP_SNAPSHOT=$(find "$DEVELOP_WORKTREE" -name "*ModelSnapshot.cs" 2>/dev/null | head -1)
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 4: Analyze conflict risks
61
+ ## STEP 3: Aggregate Results
91
62
 
92
- ```bash
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
- echo "$BRANCH: $RISK"
125
- fi
126
- done
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 5: Recommend merge order
92
+ ## STEP 4: Calculate Merge Order
93
+
94
+ Based on conflict analysis, recommend merge order:
132
95
 
133
- ```bash
134
- echo ""
135
- echo "RECOMMENDED MERGE ORDER"
136
- echo "========================="
137
- echo "1. Branches with RISK=NONE (independent)"
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
- ## Output Format
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 (5)
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
- develop | 12 migrations | Snapshot: a1b2c3d4 (REFERENCE)
161
- feature/user-auth | 13 migrations | Snapshot: e5f6g7h8
162
- feature/add-products | 13 migrations | Snapshot: i9j0k1l2
163
- hotfix/login-fix | 12 migrations | Snapshot: a1b2c3d4
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
- feature/user-auth : LOW (different table)
167
- feature/add-products : MEDIUM (FK to same table)
168
- hotfix/login-fix : NONE (snapshot = develop)
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
- 1. hotfix/login-fix (NONE - direct merge)
172
- 2. feature/user-auth (LOW - merge OK)
173
- 3. feature/add-products (MEDIUM - after user-auth)
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 output for CI/CD |
185
- | `--branch <name>` | Scan a specific branch |
186
- | `--verbose` | Display difference details |
187
- | `--no-recommend` | Don't display recommendations |
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
- CONFLICTS=$(echo $OUTPUT | jq '.risks[] | select(.level == "HIGH") | length')
199
- if [ "$CONFLICTS" -gt 0 ]; then
200
- echo "::warning::High risk migration conflicts detected"
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