@atlashub/smartstack-cli 1.17.0 → 1.19.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 (35) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/efcore/db-deploy.md +5 -0
  3. package/templates/agents/efcore/db-reset.md +5 -0
  4. package/templates/agents/efcore/db-seed.md +5 -0
  5. package/templates/agents/efcore/db-status.md +5 -0
  6. package/templates/agents/efcore/migration.md +8 -0
  7. package/templates/agents/efcore/rebase-snapshot.md +9 -0
  8. package/templates/agents/efcore/squash.md +50 -20
  9. package/templates/commands/efcore/squash.md +24 -12
  10. package/templates/skills/efcore/SKILL.md +162 -0
  11. package/templates/skills/efcore/steps/db/step-deploy.md +208 -0
  12. package/templates/skills/efcore/steps/db/step-reset.md +259 -0
  13. package/templates/skills/efcore/steps/db/step-seed.md +244 -0
  14. package/templates/skills/efcore/steps/db/step-status.md +198 -0
  15. package/templates/skills/efcore/steps/migration/step-00-init.md +102 -0
  16. package/templates/skills/efcore/steps/migration/step-01-check.md +138 -0
  17. package/templates/skills/efcore/steps/migration/step-02-create.md +144 -0
  18. package/templates/skills/efcore/steps/migration/step-03-validate.md +203 -0
  19. package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +173 -0
  20. package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +100 -0
  21. package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +115 -0
  22. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +108 -0
  23. package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +157 -0
  24. package/templates/skills/efcore/steps/shared/step-00-init.md +266 -0
  25. package/templates/skills/efcore/steps/squash/step-00-init.md +141 -0
  26. package/templates/skills/efcore/steps/squash/step-01-backup.md +120 -0
  27. package/templates/skills/efcore/steps/squash/step-02-fetch.md +168 -0
  28. package/templates/skills/efcore/steps/squash/step-03-create.md +178 -0
  29. package/templates/skills/efcore/steps/squash/step-04-validate.md +174 -0
  30. package/templates/skills/gitflow/steps/step-commit.md +14 -2
  31. package/templates/skills/gitflow/steps/step-finish.md +26 -0
  32. package/templates/skills/gitflow/steps/step-merge.md +8 -3
  33. package/templates/skills/gitflow/steps/step-pr.md +10 -0
  34. package/templates/skills/gitflow/steps/step-start.md +12 -1
  35. package/templates/skills/gitflow/steps/step-sync.md +24 -0
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: step-03-validate
3
+ description: Validate migration and optionally deploy
4
+ next_step: null
5
+ ---
6
+
7
+ # Step 3: Validate Migration
8
+
9
+ ## YOUR TASK:
10
+
11
+ Validate the created migration and optionally apply it to the local database.
12
+
13
+ **Previous step:** `step-02-create.md`
14
+
15
+ ---
16
+
17
+ ## EXECUTION SEQUENCE:
18
+
19
+ ### 1. Build Project
20
+
21
+ ```bash
22
+ echo "Building project..."
23
+ echo ""
24
+
25
+ dotnet build "$INFRA_PROJECT" --no-restore
26
+
27
+ if [ $? -ne 0 ]; then
28
+ echo ""
29
+ echo "ERROR: Build failed"
30
+ echo "Please fix compilation errors and retry."
31
+ exit 1
32
+ fi
33
+
34
+ echo "Build: OK"
35
+ ```
36
+
37
+ ### 2. Show Migration Content Summary
38
+
39
+ ```bash
40
+ echo ""
41
+ echo "Migration content:"
42
+ echo ""
43
+
44
+ # Count operations in migration
45
+ UP_TABLES=$(grep -c "CreateTable" "$MIGRATION_FILE" || echo "0")
46
+ UP_COLUMNS=$(grep -c "AddColumn" "$MIGRATION_FILE" || echo "0")
47
+ UP_INDEXES=$(grep -c "CreateIndex" "$MIGRATION_FILE" || echo "0")
48
+ UP_FOREIGN=$(grep -c "AddForeignKey" "$MIGRATION_FILE" || echo "0")
49
+
50
+ echo " Tables: $UP_TABLES"
51
+ echo " Columns: $UP_COLUMNS"
52
+ echo " Indexes: $UP_INDEXES"
53
+ echo " Foreign Keys:$UP_FOREIGN"
54
+ ```
55
+
56
+ ### 3. Ask User to Validate
57
+
58
+ **If NOT auto mode:**
59
+
60
+ ```yaml
61
+ AskUserQuestion:
62
+ header: "Validation"
63
+ question: "Migration created. What do you want to do?"
64
+ options:
65
+ - label: "Apply to local DB"
66
+ description: "Run /efcore db-deploy now"
67
+ - label: "Keep without applying"
68
+ description: "Apply later manually"
69
+ - label: "Delete and retry"
70
+ description: "Remove migration, start over"
71
+ multiSelect: false
72
+ ```
73
+
74
+ ### 4. Handle Response
75
+
76
+ ```javascript
77
+ if (answer === "Apply to local DB") {
78
+ // Apply migration
79
+ ACTION = "deploy";
80
+ } else if (answer === "Keep without applying") {
81
+ ACTION = "keep";
82
+ } else {
83
+ // Delete and start over
84
+ ACTION = "delete";
85
+ }
86
+ ```
87
+
88
+ ### 5. Execute Action
89
+
90
+ **If deploy:**
91
+
92
+ ```bash
93
+ echo ""
94
+ echo "Applying migration..."
95
+
96
+ dotnet ef database update \
97
+ --context "$DBCONTEXT" \
98
+ --project "$INFRA_PROJECT" \
99
+ --startup-project "$STARTUP_PROJECT" \
100
+ --verbose
101
+
102
+ if [ $? -eq 0 ]; then
103
+ echo ""
104
+ echo "Migration applied successfully."
105
+ else
106
+ echo ""
107
+ echo "ERROR: Migration failed to apply."
108
+ echo "Database may need reset: /efcore db-reset"
109
+ fi
110
+ ```
111
+
112
+ **If delete:**
113
+
114
+ ```bash
115
+ echo ""
116
+ echo "Removing migration..."
117
+
118
+ dotnet ef migrations remove \
119
+ --context "$DBCONTEXT" \
120
+ --project "$INFRA_PROJECT" \
121
+ --startup-project "$STARTUP_PROJECT" \
122
+ --force
123
+
124
+ echo "Migration removed. Run /efcore migration to start over."
125
+ exit 0
126
+ ```
127
+
128
+ ### 6. Final Summary
129
+
130
+ ```bash
131
+ echo ""
132
+ echo "==========================================="
133
+ echo "MIGRATION COMPLETE"
134
+ echo "==========================================="
135
+ echo ""
136
+ echo "Branch: $CURRENT_BRANCH"
137
+ echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
138
+ echo ""
139
+ echo "Migration: $MIGRATION_NAME"
140
+ echo "Files:"
141
+ echo " - ${MIGRATION_NAME}.cs"
142
+ echo " - ${MIGRATION_NAME}.Designer.cs"
143
+ echo " - ${DBCONTEXT}ModelSnapshot.cs (updated)"
144
+ echo ""
145
+ echo "Content:"
146
+ echo " Tables: $UP_TABLES"
147
+ echo " Columns: $UP_COLUMNS"
148
+ echo " Indexes: $UP_INDEXES"
149
+ echo " Foreign Keys:$UP_FOREIGN"
150
+ echo ""
151
+ if [ "$ACTION" = "deploy" ]; then
152
+ echo "Status: Applied to local database"
153
+ else
154
+ echo "Status: Created (not applied)"
155
+ echo " Run /efcore db-deploy to apply"
156
+ fi
157
+ echo ""
158
+ echo "==========================================="
159
+ echo ""
160
+ echo "Next steps:"
161
+ echo " /gitflow commit # Commit changes"
162
+ echo " /efcore db-status # Check database status"
163
+ echo ""
164
+ ```
165
+
166
+ ---
167
+
168
+ ## OUTPUT FORMAT:
169
+
170
+ ```
171
+ MIGRATION COMPLETE
172
+ ==================
173
+ Branch: {current_branch}
174
+ DbContext: {dbcontext} ({dbcontext_type})
175
+
176
+ Migration: {migration_name}
177
+ Files:
178
+ - {migration_name}.cs
179
+ - {migration_name}.Designer.cs
180
+ - {dbcontext}ModelSnapshot.cs (updated)
181
+
182
+ Content:
183
+ Tables: {count}
184
+ Columns: {count}
185
+ Indexes: {count}
186
+ Foreign Keys:{count}
187
+
188
+ Status: {Applied | Created (not applied)}
189
+
190
+ Next: /gitflow commit, /efcore db-status
191
+ ```
192
+
193
+ ---
194
+
195
+ ## SUCCESS CRITERIA:
196
+
197
+ - Build passes
198
+ - Migration content reviewed
199
+ - User action executed
200
+
201
+ ## COMPLETION:
202
+
203
+ Migration workflow complete.
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: step-00-init
3
+ description: Initialize rebase-snapshot - verify prerequisites
4
+ next_step: step-01-backup.md
5
+ ---
6
+
7
+ # Step 0: Initialize Rebase-Snapshot
8
+
9
+ ## YOUR TASK:
10
+
11
+ Verify prerequisites for rebase-snapshot operation.
12
+
13
+ **Requires:** `steps/shared/step-00-init.md` completed (provides {dbcontext}, {base_branch}, etc.)
14
+
15
+ ---
16
+
17
+ ## WHEN TO USE:
18
+
19
+ | Situation | Action |
20
+ |-----------|--------|
21
+ | `/efcore conflicts` shows HIGH | Use rebase-snapshot |
22
+ | ModelSnapshot merge conflict | Use rebase-snapshot |
23
+ | Multiple migrations to consolidate | Use rebase-snapshot |
24
+ | Snapshot diverged from parent | Use rebase-snapshot |
25
+
26
+ ---
27
+
28
+ ## EXECUTION SEQUENCE:
29
+
30
+ ### 1. Verify Branch Type
31
+
32
+ ```bash
33
+ case "$BRANCH_TYPE" in
34
+ feature|release|hotfix)
35
+ echo "Branch type: $BRANCH_TYPE (OK)"
36
+ ;;
37
+ develop|main|master)
38
+ echo "ERROR: Cannot rebase-snapshot on $BRANCH_TYPE branch"
39
+ exit 1
40
+ ;;
41
+ *)
42
+ echo "WARNING: Unknown branch type: $BRANCH_TYPE"
43
+ ;;
44
+ esac
45
+ ```
46
+
47
+ ### 2. Verify Clean Working Directory
48
+
49
+ ```bash
50
+ if [ -n "$(git status --porcelain)" ]; then
51
+ echo "ERROR: Working directory not clean"
52
+ git status --short
53
+ exit 1
54
+ fi
55
+ ```
56
+
57
+ ### 3. Display Context
58
+
59
+ ```bash
60
+ echo ""
61
+ echo "Rebase-Snapshot Context"
62
+ echo "======================="
63
+ echo ""
64
+ echo "Branch: $CURRENT_BRANCH"
65
+ echo "Parent: $BASE_BRANCH"
66
+ echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
67
+ echo "Schema: $SCHEMA"
68
+ echo "Migrations: $MIGRATIONS_DIR"
69
+ ```
70
+
71
+ ### 4. Identify Branch Migrations
72
+
73
+ ```bash
74
+ # Fetch parent
75
+ git fetch origin "$BASE_BRANCH" --quiet
76
+
77
+ # Get migrations from parent
78
+ PARENT_MIGRATIONS=$(git ls-tree -r --name-only "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR" 2>/dev/null | grep "\.cs$" | grep -v "Designer\|Snapshot" || echo "")
79
+
80
+ # Get local migrations
81
+ LOCAL_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | xargs -I{} basename {} 2>/dev/null || echo "")
82
+
83
+ # Find branch-only migrations
84
+ BRANCH_MIGRATIONS=()
85
+ for mig in $LOCAL_MIGRATIONS; do
86
+ if ! echo "$PARENT_MIGRATIONS" | grep -q "$(basename "$mig")"; then
87
+ BRANCH_MIGRATIONS+=("$mig")
88
+ fi
89
+ done
90
+
91
+ BRANCH_MIG_COUNT=${#BRANCH_MIGRATIONS[@]}
92
+
93
+ echo ""
94
+ echo "Branch migrations: $BRANCH_MIG_COUNT"
95
+ for mig in "${BRANCH_MIGRATIONS[@]}"; do
96
+ echo " - $mig"
97
+ done
98
+ ```
99
+
100
+ ### 5. Check Snapshot Divergence
101
+
102
+ ```bash
103
+ echo ""
104
+ echo "Checking snapshot divergence..."
105
+
106
+ PARENT_SNAPSHOT=$(git show "origin/$BASE_BRANCH:$MIGRATIONS_DIR/${DBCONTEXT}ModelSnapshot.cs" 2>/dev/null || echo "")
107
+ LOCAL_SNAPSHOT=$(cat "$MIGRATIONS_DIR/${DBCONTEXT}ModelSnapshot.cs" 2>/dev/null || echo "")
108
+
109
+ if [ -n "$PARENT_SNAPSHOT" ] && [ -n "$LOCAL_SNAPSHOT" ]; then
110
+ DIFF_LINES=$(diff <(echo "$PARENT_SNAPSHOT") <(echo "$LOCAL_SNAPSHOT") 2>/dev/null | wc -l)
111
+ echo " Snapshot difference: $DIFF_LINES lines"
112
+
113
+ if [ "$DIFF_LINES" -eq 0 ]; then
114
+ echo ""
115
+ echo "Snapshot is already synchronized with $BASE_BRANCH."
116
+ echo "Nothing to do."
117
+
118
+ if [ "$FORCE_FLAG" != "true" ]; then
119
+ exit 0
120
+ fi
121
+ fi
122
+ else
123
+ echo " WARNING: Could not compare snapshots"
124
+ DIFF_LINES="unknown"
125
+ fi
126
+ ```
127
+
128
+ ### 6. Confirmation
129
+
130
+ **If NOT auto mode:**
131
+
132
+ ```yaml
133
+ AskUserQuestion:
134
+ header: "Rebase"
135
+ question: "Rebase snapshot from {BASE_BRANCH}?
136
+
137
+ This will:
138
+ 1. Backup all migration files
139
+ 2. Reset ModelSnapshot to {BASE_BRANCH}
140
+ 3. Delete {BRANCH_MIG_COUNT} branch migrations
141
+ 4. Create ONE consolidated migration
142
+
143
+ Snapshot difference: {DIFF_LINES} lines"
144
+ options:
145
+ - label: "Yes, rebase"
146
+ description: "Proceed with rebase-snapshot"
147
+ - label: "Cancel"
148
+ description: "Do nothing"
149
+ multiSelect: false
150
+ ```
151
+
152
+ ---
153
+
154
+ ## STATE OUTPUT:
155
+
156
+ | Variable | Description |
157
+ |----------|-------------|
158
+ | `{branch_migrations}` | Array of migrations to remove |
159
+ | `{branch_mig_count}` | Number of branch migrations |
160
+ | `{diff_lines}` | Snapshot divergence (lines) |
161
+
162
+ ---
163
+
164
+ ## SUCCESS CRITERIA:
165
+
166
+ - Branch type is feature/release/hotfix
167
+ - Working directory clean
168
+ - Branch migrations identified
169
+ - User confirmed
170
+
171
+ ## NEXT STEP:
172
+
173
+ → `step-01-backup.md`
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: step-01-backup
3
+ description: Create backup of migration files
4
+ next_step: step-02-fetch.md
5
+ ---
6
+
7
+ # Step 1: Backup
8
+
9
+ ## YOUR TASK:
10
+
11
+ Create a complete backup before modifying migration files.
12
+
13
+ **Previous step:** `step-00-init.md`
14
+
15
+ ---
16
+
17
+ ## EXECUTION SEQUENCE:
18
+
19
+ ### 1. Create Backup Directory
20
+
21
+ ```bash
22
+ TIMESTAMP=$(date +%Y%m%d_%H%M%S)
23
+ BACKUP_DIR=".claude/gitflow/backup/migrations/rebase_${TIMESTAMP}"
24
+
25
+ mkdir -p "$BACKUP_DIR"
26
+ echo "Backup directory: $BACKUP_DIR"
27
+ ```
28
+
29
+ ### 2. Backup All Migration Files
30
+
31
+ ```bash
32
+ cp "$MIGRATIONS_DIR"/*.cs "$BACKUP_DIR/" 2>/dev/null || {
33
+ echo "ERROR: No migration files to backup"
34
+ exit 1
35
+ }
36
+
37
+ BACKUP_COUNT=$(ls -1 "$BACKUP_DIR"/*.cs 2>/dev/null | wc -l)
38
+ echo "Backed up: $BACKUP_COUNT files"
39
+ ```
40
+
41
+ ### 3. Create Manifest
42
+
43
+ ```bash
44
+ cat > "$BACKUP_DIR/MANIFEST.md" << EOF
45
+ # Rebase-Snapshot Backup Manifest
46
+
47
+ **Created:** $(date -Iseconds)
48
+ **Branch:** $CURRENT_BRANCH
49
+ **Parent:** $BASE_BRANCH
50
+ **DbContext:** $DBCONTEXT
51
+
52
+ ## Branch Migrations (to be replaced)
53
+
54
+ $(for mig in "${BRANCH_MIGRATIONS[@]}"; do echo "- $mig"; done)
55
+
56
+ ## Restore Command
57
+
58
+ \`\`\`bash
59
+ cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
60
+ \`\`\`
61
+ EOF
62
+ ```
63
+
64
+ ### 4. Verify Backup
65
+
66
+ ```bash
67
+ echo ""
68
+ echo "Backup complete:"
69
+ echo " Directory: $BACKUP_DIR"
70
+ echo " Files: $BACKUP_COUNT"
71
+ ```
72
+
73
+ ---
74
+
75
+ ## STATE OUTPUT:
76
+
77
+ | Variable | Description |
78
+ |----------|-------------|
79
+ | `{backup_dir}` | Backup directory path |
80
+ | `{backup_count}` | Number of files backed up |
81
+
82
+ ---
83
+
84
+ ## RECOVERY:
85
+
86
+ ```bash
87
+ cp "{BACKUP_DIR}"/*.cs "{MIGRATIONS_DIR}/"
88
+ ```
89
+
90
+ ---
91
+
92
+ ## SUCCESS CRITERIA:
93
+
94
+ - Backup directory created
95
+ - All files copied
96
+ - Manifest created
97
+
98
+ ## NEXT STEP:
99
+
100
+ → `step-02-fetch.md`
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: step-02-fetch
3
+ description: Reset snapshot to parent and delete branch migrations
4
+ next_step: step-03-create.md
5
+ ---
6
+
7
+ # Step 2: Fetch Parent Snapshot
8
+
9
+ ## YOUR TASK:
10
+
11
+ Reset the ModelSnapshot to the parent branch state and remove branch-specific migrations.
12
+
13
+ **Previous step:** `step-01-backup.md`
14
+
15
+ ---
16
+
17
+ ## EXECUTION SEQUENCE:
18
+
19
+ ### 1. Fetch Latest Parent
20
+
21
+ ```bash
22
+ echo "Fetching origin/$BASE_BRANCH..."
23
+ git fetch origin "$BASE_BRANCH" --quiet
24
+ ```
25
+
26
+ ### 2. Reset ModelSnapshot
27
+
28
+ ```bash
29
+ echo ""
30
+ echo "Resetting ModelSnapshot from origin/$BASE_BRANCH..."
31
+
32
+ SNAPSHOT_FILE="$MIGRATIONS_DIR/${DBCONTEXT}ModelSnapshot.cs"
33
+
34
+ git checkout "origin/$BASE_BRANCH" -- "$SNAPSHOT_FILE" 2>/dev/null
35
+
36
+ if [ $? -eq 0 ]; then
37
+ echo " Snapshot reset to origin/$BASE_BRANCH"
38
+ else
39
+ echo " WARNING: Could not fetch snapshot from origin/$BASE_BRANCH"
40
+ echo " Using local snapshot (may cause issues)"
41
+ fi
42
+ ```
43
+
44
+ ### 3. Delete Branch Migrations
45
+
46
+ ```bash
47
+ echo ""
48
+ echo "Removing branch-specific migrations..."
49
+
50
+ for mig in "${BRANCH_MIGRATIONS[@]}"; do
51
+ mig_name="${mig%.cs}"
52
+
53
+ rm -f "$MIGRATIONS_DIR/${mig_name}.cs"
54
+ rm -f "$MIGRATIONS_DIR/${mig_name}.Designer.cs"
55
+
56
+ echo " Removed: $mig_name"
57
+ done
58
+
59
+ echo ""
60
+ echo "Removed: ${#BRANCH_MIGRATIONS[@]} migration(s)"
61
+ ```
62
+
63
+ ### 4. Verify State
64
+
65
+ ```bash
66
+ echo ""
67
+ echo "Current migrations after reset:"
68
+
69
+ REMAINING=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | wc -l)
70
+
71
+ echo " Remaining: $REMAINING (from $BASE_BRANCH)"
72
+ ```
73
+
74
+ ---
75
+
76
+ ## EXPECTED STATE:
77
+
78
+ ```
79
+ After step-02-fetch:
80
+ ├── {parent_migration_1}.cs ← From parent (unchanged)
81
+ ├── {parent_migration_1}.Designer.cs
82
+ ├── ...
83
+ └── {DbContext}ModelSnapshot.cs ← Reset to parent state
84
+
85
+ Branch migrations: DELETED
86
+ ```
87
+
88
+ ---
89
+
90
+ ## STATE OUTPUT:
91
+
92
+ | Variable | Description |
93
+ |----------|-------------|
94
+ | `{snapshot_reset}` | true if reset successful |
95
+ | `{remaining_migrations}` | Count after deletion |
96
+
97
+ ---
98
+
99
+ ## ERROR HANDLING:
100
+
101
+ If snapshot fetch fails:
102
+ - Continue with local snapshot
103
+ - Migration may contain more changes than expected
104
+ - Warn user
105
+
106
+ ---
107
+
108
+ ## SUCCESS CRITERIA:
109
+
110
+ - Snapshot reset to parent
111
+ - Branch migrations removed
112
+
113
+ ## NEXT STEP:
114
+
115
+ → `step-03-create.md`
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: step-03-create
3
+ description: Create consolidated migration with MCP naming
4
+ next_step: step-04-validate.md
5
+ ---
6
+
7
+ # Step 3: Create Consolidated Migration
8
+
9
+ ## YOUR TASK:
10
+
11
+ Generate a new consolidated migration capturing all branch changes.
12
+
13
+ **MANDATORY:** Use MCP for naming. NEVER hardcode.
14
+
15
+ **Previous step:** `step-02-fetch.md`
16
+
17
+ ---
18
+
19
+ ## EXECUTION SEQUENCE:
20
+
21
+ ### 1. Build Description
22
+
23
+ ```bash
24
+ # Extract feature name from branch
25
+ FEATURE_NAME=$(echo "$CURRENT_BRANCH" | sed 's|.*/||' | sed 's/-/ /g' | \
26
+ awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1' | \
27
+ tr -d ' ')
28
+
29
+ DESCRIPTION="${FEATURE_NAME}Consolidated"
30
+
31
+ echo "Description: $DESCRIPTION"
32
+ ```
33
+
34
+ ### 2. Call MCP for Migration Name (MANDATORY)
35
+
36
+ ```javascript
37
+ // DESCRIPTION = from above (e.g., "UserAuthConsolidated")
38
+ // DBCONTEXT_TYPE = "core" or "extensions" (from detect_dbcontext)
39
+
40
+ const result = await mcp__smartstack__suggest_migration({
41
+ description: DESCRIPTION,
42
+ context: DBCONTEXT_TYPE // NEVER hardcode!
43
+ });
44
+
45
+ // Result example: core_v1.7.0_001_UserAuthConsolidated
46
+ MIGRATION_NAME = result.migrationName;
47
+ ```
48
+
49
+ **FORBIDDEN:**
50
+ - Manual name calculation
51
+ - Hardcoding context
52
+
53
+ ### 3. Create Migration
54
+
55
+ ```bash
56
+ echo ""
57
+ echo "Creating migration: $MIGRATION_NAME"
58
+ echo "Context: $DBCONTEXT"
59
+ echo ""
60
+
61
+ dotnet ef migrations add "$MIGRATION_NAME" \
62
+ --context "$DBCONTEXT" \
63
+ --project "$INFRA_PROJECT" \
64
+ --startup-project "$STARTUP_PROJECT" \
65
+ -o Persistence/Migrations \
66
+ --verbose
67
+ ```
68
+
69
+ ### 4. Verify Files Created
70
+
71
+ ```bash
72
+ MIGRATION_FILE="$MIGRATIONS_DIR/${MIGRATION_NAME}.cs"
73
+ DESIGNER_FILE="$MIGRATIONS_DIR/${MIGRATION_NAME}.Designer.cs"
74
+
75
+ if [ ! -f "$MIGRATION_FILE" ]; then
76
+ echo "ERROR: Migration file not created"
77
+
78
+ # Restore backup
79
+ cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
80
+ echo "Restored from backup"
81
+ exit 1
82
+ fi
83
+
84
+ echo ""
85
+ echo "Migration created:"
86
+ echo " $MIGRATION_FILE"
87
+ echo " $DESIGNER_FILE"
88
+ ```
89
+
90
+ ---
91
+
92
+ ## STATE OUTPUT:
93
+
94
+ | Variable | Description |
95
+ |----------|-------------|
96
+ | `{migration_name}` | Name from MCP |
97
+ | `{migration_file}` | Path to .cs file |
98
+
99
+ ---
100
+
101
+ ## SUCCESS CRITERIA:
102
+
103
+ - MCP called successfully
104
+ - Migration files created
105
+
106
+ ## NEXT STEP:
107
+
108
+ → `step-04-validate.md`