@atlashub/smartstack-cli 4.34.0 → 4.36.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/dist/index.js +28 -32
- package/dist/index.js.map +1 -1
- package/dist/mcp-entry.mjs +35 -303
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/skills/apex/references/checks/seed-checks.sh +1 -1
- package/templates/skills/apex/references/core-seed-data.md +39 -21
- package/templates/skills/application/references/application-roles-template.md +14 -8
- package/templates/skills/application/references/provider-template.md +32 -20
- package/templates/skills/application/templates-frontend.md +350 -89
- package/templates/skills/application/templates-seed.md +23 -11
- package/templates/skills/audit-route/SKILL.md +107 -0
- package/templates/skills/audit-route/references/routing-pattern.md +129 -0
- package/templates/skills/audit-route/steps/step-00-init.md +128 -0
- package/templates/skills/audit-route/steps/step-01-inventory.md +157 -0
- package/templates/skills/audit-route/steps/step-02-conformity.md +193 -0
- package/templates/skills/audit-route/steps/step-03-report.md +201 -0
- package/templates/skills/cli-app-sync/SKILL.md +2 -2
- package/templates/skills/cli-app-sync/references/comparison-map.md +1 -1
- package/templates/skills/dev-start/SKILL.md +12 -2
- package/templates/skills/documentation/steps/step-03-validate.md +12 -14
- package/templates/skills/efcore/SKILL.md +219 -67
- package/templates/agents/efcore/conflicts.md +0 -114
- package/templates/agents/efcore/db-deploy.md +0 -86
- package/templates/agents/efcore/db-reset.md +0 -98
- package/templates/agents/efcore/db-seed.md +0 -73
- package/templates/agents/efcore/db-status.md +0 -97
- package/templates/agents/efcore/scan.md +0 -124
- package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +0 -126
- package/templates/skills/efcore/references/both-contexts.md +0 -32
- package/templates/skills/efcore/references/destructive-operations.md +0 -38
- package/templates/skills/efcore/steps/db/step-deploy.md +0 -217
- package/templates/skills/efcore/steps/db/step-reset.md +0 -186
- package/templates/skills/efcore/steps/db/step-seed.md +0 -166
- package/templates/skills/efcore/steps/db/step-status.md +0 -173
- package/templates/skills/efcore/steps/migration/step-00-init.md +0 -102
- package/templates/skills/efcore/steps/migration/step-01-check.md +0 -164
- package/templates/skills/efcore/steps/migration/step-02-create.md +0 -160
- package/templates/skills/efcore/steps/migration/step-03-validate.md +0 -168
- package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +0 -173
- package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +0 -100
- package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +0 -115
- package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +0 -112
- package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +0 -157
- package/templates/skills/efcore/steps/shared/step-00-init.md +0 -131
- package/templates/skills/efcore/steps/squash/step-00-init.md +0 -141
- package/templates/skills/efcore/steps/squash/step-01-backup.md +0 -120
- package/templates/skills/efcore/steps/squash/step-02-fetch.md +0 -168
- package/templates/skills/efcore/steps/squash/step-03-create.md +0 -184
- package/templates/skills/efcore/steps/squash/step-04-validate.md +0 -174
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: step-00-init
|
|
3
|
-
description: Initialize squash - verify prerequisites and get confirmation
|
|
4
|
-
next_step: step-01-backup.md
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Step 0: Initialize Squash
|
|
8
|
-
|
|
9
|
-
## YOUR TASK:
|
|
10
|
-
|
|
11
|
-
Verify prerequisites for squash operation and get user confirmation.
|
|
12
|
-
|
|
13
|
-
**Requires:** `steps/shared/step-00-init.md` completed (provides {dbcontext}, {base_branch}, etc.)
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## EXECUTION SEQUENCE:
|
|
18
|
-
|
|
19
|
-
### 1. Verify Clean Working Directory
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
[ -n "$(git status --porcelain)" ] && {
|
|
23
|
-
echo "ERROR: Working directory not clean"
|
|
24
|
-
git status --short
|
|
25
|
-
exit 1
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 2. Identify Branch-Only Migrations
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Fetch parent branch
|
|
33
|
-
git fetch origin "$BASE_BRANCH" --quiet
|
|
34
|
-
|
|
35
|
-
# Get migrations from parent branch
|
|
36
|
-
BASE_MIGRATIONS=$(git ls-tree -r --name-only "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR" 2>/dev/null | grep "\.cs$" | grep -v "Designer\|Snapshot" || echo "")
|
|
37
|
-
|
|
38
|
-
# Get local migrations
|
|
39
|
-
LOCAL_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | xargs -I{} basename {} 2>/dev/null || echo "")
|
|
40
|
-
|
|
41
|
-
# Find migrations unique to this branch (exact match, not substring)
|
|
42
|
-
BRANCH_ONLY_MIGRATIONS=()
|
|
43
|
-
for mig in $LOCAL_MIGRATIONS; do
|
|
44
|
-
if ! echo "$BASE_MIGRATIONS" | grep -qx "$(basename "$mig")"; then
|
|
45
|
-
BRANCH_ONLY_MIGRATIONS+=("$mig")
|
|
46
|
-
fi
|
|
47
|
-
done
|
|
48
|
-
|
|
49
|
-
MIGRATION_COUNT=${#BRANCH_ONLY_MIGRATIONS[@]}
|
|
50
|
-
BASE_MIGRATION_COUNT=$(echo "$BASE_MIGRATIONS" | grep -c "." || echo "0")
|
|
51
|
-
|
|
52
|
-
echo "Branch: $CURRENT_BRANCH"
|
|
53
|
-
echo "Parent: $BASE_BRANCH"
|
|
54
|
-
echo "Migrations to squash: $MIGRATION_COUNT (branch-only)"
|
|
55
|
-
echo "Migrations from parent: $BASE_MIGRATION_COUNT (preserved)"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### 3. Check If Squash Needed
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
if [ "$MIGRATION_COUNT" -eq 0 ]; then
|
|
62
|
-
echo "No branch-specific migrations to squash."
|
|
63
|
-
echo "Nothing to do."
|
|
64
|
-
exit 0
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
if [ "$MIGRATION_COUNT" -eq 1 ]; then
|
|
68
|
-
echo "Only 1 migration on branch."
|
|
69
|
-
# Ask if user wants to continue anyway
|
|
70
|
-
fi
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### 4. Display Summary
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
SQUASH PREVIEW
|
|
77
|
-
==============
|
|
78
|
-
Branch: {CURRENT_BRANCH}
|
|
79
|
-
Parent: {BASE_BRANCH}
|
|
80
|
-
DbContext: {DBCONTEXT} ({DBCONTEXT_TYPE})
|
|
81
|
-
|
|
82
|
-
Migrations to squash ({MIGRATION_COUNT}):
|
|
83
|
-
{for mig in BRANCH_ONLY_MIGRATIONS}
|
|
84
|
-
- {mig}
|
|
85
|
-
{endfor}
|
|
86
|
-
|
|
87
|
-
Migrations from parent ({BASE_MIGRATION_COUNT}):
|
|
88
|
-
(will be preserved)
|
|
89
|
-
|
|
90
|
-
Result: {BASE_MIGRATION_COUNT + 1} migrations total
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### 5. User Confirmation
|
|
94
|
-
|
|
95
|
-
**If NOT auto_mode:**
|
|
96
|
-
|
|
97
|
-
```yaml
|
|
98
|
-
AskUserQuestion:
|
|
99
|
-
header: "Squash"
|
|
100
|
-
question: "Squash {MIGRATION_COUNT} migrations from {CURRENT_BRANCH}?
|
|
101
|
-
|
|
102
|
-
The ModelSnapshot and migrations from {BASE_BRANCH} will be recovered.
|
|
103
|
-
Your {MIGRATION_COUNT} migrations will be consolidated into ONE.
|
|
104
|
-
|
|
105
|
-
This operation is DESTRUCTIVE but a backup will be created."
|
|
106
|
-
options:
|
|
107
|
-
- label: "Yes, squash"
|
|
108
|
-
description: "Consolidate on base of {BASE_BRANCH}"
|
|
109
|
-
- label: "View details"
|
|
110
|
-
description: "Show migrations to be squashed"
|
|
111
|
-
- label: "Cancel"
|
|
112
|
-
description: "Do nothing"
|
|
113
|
-
multiSelect: false
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
**Handle response:**
|
|
117
|
-
- "Yes, squash" → Continue to next step
|
|
118
|
-
- "View details" → Show full migration list, ask again
|
|
119
|
-
- "Cancel" → Exit
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## STATE OUTPUT:
|
|
124
|
-
|
|
125
|
-
| Variable | Description |
|
|
126
|
-
|----------|-------------|
|
|
127
|
-
| `{branch_only_migrations}` | Array of migrations to squash |
|
|
128
|
-
| `{migration_count}` | Number of migrations to squash |
|
|
129
|
-
| `{base_migration_count}` | Number of parent migrations |
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## SUCCESS CRITERIA:
|
|
134
|
-
|
|
135
|
-
- Working directory clean
|
|
136
|
-
- At least 1 branch-specific migration
|
|
137
|
-
- User confirmed (or auto_mode)
|
|
138
|
-
|
|
139
|
-
## NEXT STEP:
|
|
140
|
-
|
|
141
|
-
→ `step-01-backup.md`
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: step-01-backup
|
|
3
|
-
description: Create backup of all 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 of all migration files before destructive operations.
|
|
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/squash_${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
|
-
# Backup all .cs files from migrations directory
|
|
33
|
-
cp "$MIGRATIONS_DIR"/*.cs "$BACKUP_DIR/" 2>/dev/null || {
|
|
34
|
-
echo "ERROR: No migration files found to backup"
|
|
35
|
-
exit 1
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
# Count backed up files
|
|
39
|
-
BACKUP_COUNT=$(ls -1 "$BACKUP_DIR"/*.cs 2>/dev/null | wc -l)
|
|
40
|
-
echo "Backed up: $BACKUP_COUNT files"
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 3. Create Backup Manifest
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
cat > "$BACKUP_DIR/MANIFEST.md" << EOF
|
|
47
|
-
# Squash Backup Manifest
|
|
48
|
-
|
|
49
|
-
**Created:** $(date -Iseconds)
|
|
50
|
-
**Branch:** $CURRENT_BRANCH
|
|
51
|
-
**Parent:** $BASE_BRANCH
|
|
52
|
-
**DbContext:** $DBCONTEXT
|
|
53
|
-
|
|
54
|
-
## Files Backed Up
|
|
55
|
-
|
|
56
|
-
\`\`\`
|
|
57
|
-
$(ls -la "$BACKUP_DIR"/*.cs)
|
|
58
|
-
\`\`\`
|
|
59
|
-
|
|
60
|
-
## Migrations to Squash
|
|
61
|
-
|
|
62
|
-
$(for mig in "${BRANCH_ONLY_MIGRATIONS[@]}"; do echo "- $mig"; done)
|
|
63
|
-
|
|
64
|
-
## Restore Command
|
|
65
|
-
|
|
66
|
-
\`\`\`bash
|
|
67
|
-
cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
|
|
68
|
-
\`\`\`
|
|
69
|
-
EOF
|
|
70
|
-
|
|
71
|
-
echo "Manifest created: $BACKUP_DIR/MANIFEST.md"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 4. Verify Backup
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Ensure critical files exist
|
|
78
|
-
SNAPSHOT_BACKUP=$(ls "$BACKUP_DIR"/*ModelSnapshot.cs 2>/dev/null | head -1)
|
|
79
|
-
|
|
80
|
-
if [ -z "$SNAPSHOT_BACKUP" ]; then
|
|
81
|
-
echo "WARNING: No ModelSnapshot in backup"
|
|
82
|
-
fi
|
|
83
|
-
|
|
84
|
-
echo ""
|
|
85
|
-
echo "Backup complete:"
|
|
86
|
-
echo " Directory: $BACKUP_DIR"
|
|
87
|
-
echo " Files: $BACKUP_COUNT"
|
|
88
|
-
echo " Snapshot: $(basename "$SNAPSHOT_BACKUP" 2>/dev/null || echo 'N/A')"
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## STATE OUTPUT:
|
|
94
|
-
|
|
95
|
-
| Variable | Value |
|
|
96
|
-
|----------|-------|
|
|
97
|
-
| `{backup_dir}` | `.claude/gitflow/backup/migrations/squash_{timestamp}` |
|
|
98
|
-
| `{backup_count}` | Number of files backed up |
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## RECOVERY:
|
|
103
|
-
|
|
104
|
-
If squash fails, restore with:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
cp "{BACKUP_DIR}"/*.cs "{MIGRATIONS_DIR}/"
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## SUCCESS CRITERIA:
|
|
113
|
-
|
|
114
|
-
- Backup directory created
|
|
115
|
-
- All migration files copied
|
|
116
|
-
- Manifest created
|
|
117
|
-
|
|
118
|
-
## NEXT STEP:
|
|
119
|
-
|
|
120
|
-
→ `step-02-fetch.md`
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: step-02-fetch
|
|
3
|
-
description: Fetch ModelSnapshot AND migrations from parent branch (CRITICAL)
|
|
4
|
-
next_step: step-03-create.md
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Step 2: Fetch Parent State (CRITICAL)
|
|
8
|
-
|
|
9
|
-
## YOUR TASK:
|
|
10
|
-
|
|
11
|
-
Recover BOTH the ModelSnapshot AND all migrations from the parent branch.
|
|
12
|
-
|
|
13
|
-
**THIS IS THE MOST CRITICAL STEP.** Recovering only the snapshot loses parent migrations!
|
|
14
|
-
|
|
15
|
-
**Previous step:** `step-01-backup.md`
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## PRINCIPLE:
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
GOLDEN RULE: Fetch SNAPSHOT + MIGRATIONS from PARENT branch
|
|
23
|
-
|
|
24
|
-
feature/* → snapshot + migrations from develop
|
|
25
|
-
develop → snapshot + migrations from main
|
|
26
|
-
release/* → snapshot + migrations from main
|
|
27
|
-
hotfix/* → snapshot + migrations from main
|
|
28
|
-
|
|
29
|
-
NEVER fetch only the snapshot without migrations!
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## EXECUTION SEQUENCE:
|
|
35
|
-
|
|
36
|
-
### 1. Fetch Parent Branch
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
echo "Fetching origin/$BASE_BRANCH..."
|
|
40
|
-
git fetch origin "$BASE_BRANCH" --quiet
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 2. Recover ModelSnapshot
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
echo ""
|
|
47
|
-
echo "Recovering ModelSnapshot from origin/$BASE_BRANCH..."
|
|
48
|
-
|
|
49
|
-
SNAPSHOT_FILE=$(git ls-tree -r --name-only "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR" | grep "ModelSnapshot.cs$" | head -1)
|
|
50
|
-
|
|
51
|
-
if [ -n "$SNAPSHOT_FILE" ]; then
|
|
52
|
-
git checkout "origin/$BASE_BRANCH" -- "$SNAPSHOT_FILE"
|
|
53
|
-
echo " Snapshot: $(basename "$SNAPSHOT_FILE")"
|
|
54
|
-
else
|
|
55
|
-
echo " WARNING: No snapshot found on origin/$BASE_BRANCH"
|
|
56
|
-
fi
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 3. Recover ALL Parent Migrations (CRUCIAL!)
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
echo ""
|
|
63
|
-
echo "Recovering migrations from origin/$BASE_BRANCH..."
|
|
64
|
-
|
|
65
|
-
RECOVERED_COUNT=0
|
|
66
|
-
|
|
67
|
-
for base_mig in $BASE_MIGRATIONS; do
|
|
68
|
-
base_name=$(basename "${base_mig%.cs}")
|
|
69
|
-
|
|
70
|
-
# Recover migration file
|
|
71
|
-
git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR/${base_name}.cs" 2>/dev/null && {
|
|
72
|
-
echo " ${base_name}.cs"
|
|
73
|
-
RECOVERED_COUNT=$((RECOVERED_COUNT + 1))
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
# Recover Designer file
|
|
77
|
-
git checkout "origin/$BASE_BRANCH" -- "$MIGRATIONS_DIR/${base_name}.Designer.cs" 2>/dev/null && {
|
|
78
|
-
echo " ${base_name}.Designer.cs"
|
|
79
|
-
}
|
|
80
|
-
done
|
|
81
|
-
|
|
82
|
-
echo ""
|
|
83
|
-
echo "Recovered: $RECOVERED_COUNT migrations from origin/$BASE_BRANCH"
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### 4. Delete Branch-Only Migrations
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
echo ""
|
|
90
|
-
echo "Removing branch-specific migrations..."
|
|
91
|
-
|
|
92
|
-
for mig in "${BRANCH_ONLY_MIGRATIONS[@]}"; do
|
|
93
|
-
mig_name="${mig%.cs}"
|
|
94
|
-
|
|
95
|
-
rm -f "$MIGRATIONS_DIR/${mig_name}.cs"
|
|
96
|
-
rm -f "$MIGRATIONS_DIR/${mig_name}.Designer.cs"
|
|
97
|
-
|
|
98
|
-
echo " Removed: $mig_name"
|
|
99
|
-
done
|
|
100
|
-
|
|
101
|
-
echo ""
|
|
102
|
-
echo "Removed: ${#BRANCH_ONLY_MIGRATIONS[@]} branch-specific migrations"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### 5. Verify State
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
echo ""
|
|
109
|
-
echo "Current state after fetch:"
|
|
110
|
-
echo ""
|
|
111
|
-
|
|
112
|
-
ls -la "$MIGRATIONS_DIR"/*.cs 2>/dev/null | while read line; do
|
|
113
|
-
echo " $line"
|
|
114
|
-
done
|
|
115
|
-
|
|
116
|
-
CURRENT_MIGS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | wc -l)
|
|
117
|
-
echo ""
|
|
118
|
-
echo "Migrations remaining: $CURRENT_MIGS (all from $BASE_BRANCH)"
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## EXPECTED RESULT:
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
After step-02-fetch:
|
|
127
|
-
├── {base_migration_1}.cs ← From parent (preserved)
|
|
128
|
-
├── {base_migration_1}.Designer.cs
|
|
129
|
-
├── {base_migration_N}.cs ← From parent (preserved)
|
|
130
|
-
├── {base_migration_N}.Designer.cs
|
|
131
|
-
└── {DbContext}ModelSnapshot.cs ← From parent (recovered)
|
|
132
|
-
|
|
133
|
-
Branch-specific migrations: DELETED (will be recreated consolidated)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## STATE OUTPUT:
|
|
139
|
-
|
|
140
|
-
| Variable | Description |
|
|
141
|
-
|----------|-------------|
|
|
142
|
-
| `{recovered_count}` | Number of parent migrations recovered |
|
|
143
|
-
| `{snapshot_recovered}` | true if snapshot was recovered |
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## FAILURE HANDLING:
|
|
148
|
-
|
|
149
|
-
If this step fails:
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
# Restore from backup
|
|
153
|
-
cp "{BACKUP_DIR}"/*.cs "{MIGRATIONS_DIR}/"
|
|
154
|
-
echo "Restored from backup"
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## SUCCESS CRITERIA:
|
|
160
|
-
|
|
161
|
-
- ModelSnapshot recovered from parent
|
|
162
|
-
- ALL parent migrations recovered
|
|
163
|
-
- Branch-specific migrations removed
|
|
164
|
-
- No migration loss from parent
|
|
165
|
-
|
|
166
|
-
## NEXT STEP:
|
|
167
|
-
|
|
168
|
-
→ `step-03-create.md`
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: step-03-create
|
|
3
|
-
description: Create consolidated migration using MCP for naming
|
|
4
|
-
next_step: step-04-validate.md
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Step 3: Create Consolidated Migration
|
|
8
|
-
|
|
9
|
-
## YOUR TASK:
|
|
10
|
-
|
|
11
|
-
Create a single consolidated migration that captures all changes from the branch.
|
|
12
|
-
|
|
13
|
-
**MANDATORY:** Use MCP `suggest_migration` for compliant naming. NEVER hardcode names.
|
|
14
|
-
|
|
15
|
-
**Previous step:** `step-02-fetch.md`
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## EXECUTION SEQUENCE:
|
|
20
|
-
|
|
21
|
-
### 1. Build Description from Branch Context
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
case "$BRANCH_TYPE" in
|
|
25
|
-
feature)
|
|
26
|
-
# Extract feature name: feature/user-auth → UserAuth
|
|
27
|
-
FEATURE_NAME=$(echo "$CURRENT_BRANCH" | sed 's|feature/||' | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1' | tr -d ' ')
|
|
28
|
-
DESCRIPTION="${FEATURE_NAME}Consolidated"
|
|
29
|
-
;;
|
|
30
|
-
release)
|
|
31
|
-
VERSION=$(echo "$CURRENT_BRANCH" | sed 's|release/v\?||')
|
|
32
|
-
DESCRIPTION="Release${VERSION}Initial"
|
|
33
|
-
;;
|
|
34
|
-
hotfix)
|
|
35
|
-
VERSION=$(echo "$CURRENT_BRANCH" | sed 's|hotfix/v\?||')
|
|
36
|
-
DESCRIPTION="Hotfix${VERSION}Fix"
|
|
37
|
-
;;
|
|
38
|
-
develop)
|
|
39
|
-
DESCRIPTION="DevelopConsolidated"
|
|
40
|
-
;;
|
|
41
|
-
*)
|
|
42
|
-
DESCRIPTION="Consolidated"
|
|
43
|
-
;;
|
|
44
|
-
esac
|
|
45
|
-
|
|
46
|
-
echo "Description: $DESCRIPTION"
|
|
47
|
-
echo "DbContext Type: $DBCONTEXT_TYPE"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 2. Get Migration Name from MCP (MANDATORY)
|
|
51
|
-
|
|
52
|
-
```javascript
|
|
53
|
-
// DBCONTEXT_TYPE = "core" or "extensions" (from detect_dbcontext)
|
|
54
|
-
// DESCRIPTION = built above (e.g., "MultitenantConsolidated")
|
|
55
|
-
|
|
56
|
-
const result = await mcp__smartstack__suggest_migration({
|
|
57
|
-
description: DESCRIPTION,
|
|
58
|
-
context: DBCONTEXT_TYPE, // NEVER hardcode!
|
|
59
|
-
squash: true // Squash format: {context}_v{version} (no sequence/description)
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Result example: core_v1.9.0 (squash — just version, no _001_Description)
|
|
63
|
-
MIGRATION_NAME = result.migrationName;
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**FORBIDDEN:**
|
|
67
|
-
- Calculating name manually
|
|
68
|
-
- Hardcoding context as "core"
|
|
69
|
-
- Using underscores instead of dots in version
|
|
70
|
-
- Adding sequence/description to squash migrations
|
|
71
|
-
|
|
72
|
-
### 3. Create Migration with EF Core
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
# MIGRATION_NAME = result from MCP (e.g., core_v1.9.0)
|
|
76
|
-
# DBCONTEXT = CoreDbContext or ExtensionsDbContext (from detect_dbcontext)
|
|
77
|
-
|
|
78
|
-
echo ""
|
|
79
|
-
echo "Creating migration: $MIGRATION_NAME"
|
|
80
|
-
echo "Context: $DBCONTEXT"
|
|
81
|
-
echo ""
|
|
82
|
-
|
|
83
|
-
dotnet ef migrations add "$MIGRATION_NAME" \
|
|
84
|
-
--context "$DBCONTEXT" \
|
|
85
|
-
--project "$INFRA_PROJECT" \
|
|
86
|
-
--startup-project "$STARTUP_PROJECT" \
|
|
87
|
-
-o Persistence/Migrations \
|
|
88
|
-
--verbose
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### 4. Verify Migration Created
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
# Check migration files exist
|
|
95
|
-
MIGRATION_FILE="$MIGRATIONS_DIR/${MIGRATION_NAME}.cs"
|
|
96
|
-
DESIGNER_FILE="$MIGRATIONS_DIR/${MIGRATION_NAME}.Designer.cs"
|
|
97
|
-
|
|
98
|
-
if [ ! -f "$MIGRATION_FILE" ]; then
|
|
99
|
-
echo "ERROR: Migration file not created"
|
|
100
|
-
echo "Expected: $MIGRATION_FILE"
|
|
101
|
-
|
|
102
|
-
# Restore from backup
|
|
103
|
-
cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
|
|
104
|
-
echo "Restored from backup"
|
|
105
|
-
exit 1
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
if [ ! -f "$DESIGNER_FILE" ]; then
|
|
109
|
-
echo "ERROR: Designer file not created"
|
|
110
|
-
exit 1
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
echo ""
|
|
114
|
-
echo "Migration created:"
|
|
115
|
-
echo " $MIGRATION_FILE"
|
|
116
|
-
echo " $DESIGNER_FILE"
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### 5. Check Migration Content
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Verify migration has content (not empty)
|
|
123
|
-
UP_METHODS=$(grep -c "protected override void Up" "$MIGRATION_FILE" || echo "0")
|
|
124
|
-
DOWN_METHODS=$(grep -c "protected override void Down" "$MIGRATION_FILE" || echo "0")
|
|
125
|
-
|
|
126
|
-
if [ "$UP_METHODS" -eq 0 ]; then
|
|
127
|
-
echo "WARNING: Migration may be empty (no Up method found)"
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
echo ""
|
|
131
|
-
echo "Migration content:"
|
|
132
|
-
echo " Up methods: $UP_METHODS"
|
|
133
|
-
echo " Down methods: $DOWN_METHODS"
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### 6. Inject SQL Objects (Functions, Views, SP)
|
|
137
|
-
|
|
138
|
-
Load: `references/sql-objects-injection.md`
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## EXPECTED RESULT:
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
After step-03-create:
|
|
146
|
-
├── {base_migration_1}.cs ← From parent (preserved)
|
|
147
|
-
├── {base_migration_1}.Designer.cs
|
|
148
|
-
├── {NEW_MIGRATION_NAME}.cs ← NEW: Consolidated migration
|
|
149
|
-
├── {NEW_MIGRATION_NAME}.Designer.cs ← NEW: Designer file
|
|
150
|
-
└── {DbContext}ModelSnapshot.cs ← Updated with new migration
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## STATE OUTPUT:
|
|
156
|
-
|
|
157
|
-
| Variable | Description |
|
|
158
|
-
|----------|-------------|
|
|
159
|
-
| `{migration_name}` | Name from MCP (e.g., core_v1.9.0) |
|
|
160
|
-
| `{migration_file}` | Full path to .cs file |
|
|
161
|
-
| `{designer_file}` | Full path to .Designer.cs file |
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## ERROR HANDLING:
|
|
166
|
-
|
|
167
|
-
| Error | Resolution |
|
|
168
|
-
|-------|------------|
|
|
169
|
-
| MCP fails | Check MCP connectivity, retry |
|
|
170
|
-
| Migration creation fails | Restore from backup, check errors |
|
|
171
|
-
| Empty migration | Warning only, may be valid |
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## SUCCESS CRITERIA:
|
|
176
|
-
|
|
177
|
-
- MCP called for migration name
|
|
178
|
-
- Migration file created
|
|
179
|
-
- Designer file created
|
|
180
|
-
- Snapshot updated
|
|
181
|
-
|
|
182
|
-
## NEXT STEP:
|
|
183
|
-
|
|
184
|
-
→ `step-04-validate.md`
|