@atlashub/smartstack-cli 4.35.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.
Files changed (46) hide show
  1. package/dist/index.js +28 -32
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +29 -10
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/skills/apex/references/checks/seed-checks.sh +1 -1
  7. package/templates/skills/apex/references/core-seed-data.md +39 -21
  8. package/templates/skills/application/references/application-roles-template.md +14 -8
  9. package/templates/skills/application/references/provider-template.md +32 -20
  10. package/templates/skills/application/templates-frontend.md +294 -2
  11. package/templates/skills/application/templates-seed.md +23 -11
  12. package/templates/skills/audit-route/SKILL.md +107 -0
  13. package/templates/skills/audit-route/references/routing-pattern.md +129 -0
  14. package/templates/skills/audit-route/steps/step-00-init.md +128 -0
  15. package/templates/skills/audit-route/steps/step-01-inventory.md +157 -0
  16. package/templates/skills/audit-route/steps/step-02-conformity.md +193 -0
  17. package/templates/skills/audit-route/steps/step-03-report.md +201 -0
  18. package/templates/skills/dev-start/SKILL.md +12 -2
  19. package/templates/skills/efcore/SKILL.md +219 -67
  20. package/templates/agents/efcore/conflicts.md +0 -114
  21. package/templates/agents/efcore/db-deploy.md +0 -86
  22. package/templates/agents/efcore/db-reset.md +0 -98
  23. package/templates/agents/efcore/db-seed.md +0 -73
  24. package/templates/agents/efcore/db-status.md +0 -97
  25. package/templates/agents/efcore/scan.md +0 -124
  26. package/templates/skills/efcore/references/both-contexts.md +0 -32
  27. package/templates/skills/efcore/references/destructive-operations.md +0 -38
  28. package/templates/skills/efcore/steps/db/step-deploy.md +0 -217
  29. package/templates/skills/efcore/steps/db/step-reset.md +0 -186
  30. package/templates/skills/efcore/steps/db/step-seed.md +0 -166
  31. package/templates/skills/efcore/steps/db/step-status.md +0 -173
  32. package/templates/skills/efcore/steps/migration/step-00-init.md +0 -102
  33. package/templates/skills/efcore/steps/migration/step-01-check.md +0 -164
  34. package/templates/skills/efcore/steps/migration/step-02-create.md +0 -160
  35. package/templates/skills/efcore/steps/migration/step-03-validate.md +0 -168
  36. package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +0 -173
  37. package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +0 -100
  38. package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +0 -115
  39. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +0 -112
  40. package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +0 -157
  41. package/templates/skills/efcore/steps/shared/step-00-init.md +0 -131
  42. package/templates/skills/efcore/steps/squash/step-00-init.md +0 -141
  43. package/templates/skills/efcore/steps/squash/step-01-backup.md +0 -120
  44. package/templates/skills/efcore/steps/squash/step-02-fetch.md +0 -168
  45. package/templates/skills/efcore/steps/squash/step-03-create.md +0 -184
  46. package/templates/skills/efcore/steps/squash/step-04-validate.md +0 -174
@@ -1,112 +0,0 @@
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
- ### 5. Inject SQL Objects (Functions, Views, SP)
91
-
92
- Load: `references/sql-objects-injection.md`
93
-
94
- ---
95
-
96
- ## STATE OUTPUT:
97
-
98
- | Variable | Description |
99
- |----------|-------------|
100
- | `{migration_name}` | Name from MCP |
101
- | `{migration_file}` | Path to .cs file |
102
-
103
- ---
104
-
105
- ## SUCCESS CRITERIA:
106
-
107
- - MCP called successfully
108
- - Migration files created
109
-
110
- ## NEXT STEP:
111
-
112
- → `step-04-validate.md`
@@ -1,157 +0,0 @@
1
- ---
2
- name: step-04-validate
3
- description: Validate rebase-snapshot - build and test
4
- next_step: null
5
- ---
6
-
7
- # Step 4: Validate
8
-
9
- ## YOUR TASK:
10
-
11
- Validate the rebased migration by building and generating a script.
12
-
13
- **Previous step:** `step-03-create.md`
14
-
15
- ---
16
-
17
- ## EXECUTION SEQUENCE:
18
-
19
- ### 1. Build Project
20
-
21
- ```bash
22
- echo "Building project..."
23
-
24
- dotnet build "$INFRA_PROJECT" --no-restore
25
-
26
- if [ $? -ne 0 ]; then
27
- echo ""
28
- echo "ERROR: Build failed"
29
- echo "Restoring from backup..."
30
- cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
31
- exit 1
32
- fi
33
-
34
- echo "Build: OK"
35
- ```
36
-
37
- ### 2. Generate Script
38
-
39
- ```bash
40
- echo ""
41
- echo "Generating migration script..."
42
-
43
- SCRIPT_FILE="$BACKUP_DIR/migration_script.sql"
44
-
45
- dotnet ef migrations script \
46
- --context "$DBCONTEXT" \
47
- --project "$INFRA_PROJECT" \
48
- --startup-project "$STARTUP_PROJECT" \
49
- --idempotent \
50
- --no-build \
51
- -o "$SCRIPT_FILE"
52
-
53
- if [ $? -ne 0 ]; then
54
- echo ""
55
- echo "ERROR: Script generation failed"
56
- echo "Restoring from backup..."
57
- cp "$BACKUP_DIR"/*.cs "$MIGRATIONS_DIR/"
58
- exit 1
59
- fi
60
-
61
- echo "Script: $SCRIPT_FILE"
62
- ```
63
-
64
- ### 3. List Migrations
65
-
66
- ```bash
67
- echo ""
68
- echo "Migration list:"
69
-
70
- dotnet ef migrations list \
71
- --context "$DBCONTEXT" \
72
- --project "$INFRA_PROJECT" \
73
- --startup-project "$STARTUP_PROJECT" \
74
- --no-build
75
- ```
76
-
77
- ### 4. Final Summary
78
-
79
- ```bash
80
- FINAL_COUNT=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | grep -v "Designer\|Snapshot" | wc -l)
81
-
82
- echo ""
83
- echo "==========================================="
84
- echo "REBASE-SNAPSHOT COMPLETE"
85
- echo "==========================================="
86
- echo ""
87
- echo "Branch: $CURRENT_BRANCH"
88
- echo "Parent: $BASE_BRANCH"
89
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
90
- echo ""
91
- echo "Changes:"
92
- echo " - Snapshot reset to $BASE_BRANCH"
93
- echo " - Removed: ${#BRANCH_MIGRATIONS[@]} branch migrations"
94
- echo " - Created: 1 consolidated migration"
95
- echo ""
96
- echo "Result:"
97
- echo " Migration: $MIGRATION_NAME"
98
- echo " Total: $FINAL_COUNT migrations"
99
- echo ""
100
- echo "Backup: $BACKUP_DIR"
101
- echo "Script: $SCRIPT_FILE"
102
- echo ""
103
- echo "==========================================="
104
- echo ""
105
- echo "Next steps:"
106
- echo " /efcore db-reset # Reset local database"
107
- echo " /efcore db-deploy # Apply migrations"
108
- echo " /gitflow commit # Commit changes"
109
- echo ""
110
- ```
111
-
112
- ---
113
-
114
- ## OUTPUT FORMAT:
115
-
116
- ```
117
- REBASE-SNAPSHOT COMPLETE
118
- ========================
119
- Branch: {current_branch}
120
- Parent: {base_branch}
121
- DbContext: {dbcontext} ({dbcontext_type})
122
-
123
- Changes:
124
- - Snapshot reset to {base_branch}
125
- - Removed: {count} branch migrations
126
- - Created: 1 consolidated migration
127
-
128
- Result:
129
- Migration: {migration_name}
130
- Total: {final_count} migrations
131
-
132
- Backup: {backup_dir}
133
- Script: {backup_dir}/migration_script.sql
134
-
135
- Next: /efcore db-reset, /efcore db-deploy, /gitflow commit
136
- ```
137
-
138
- ---
139
-
140
- ## ERROR HANDLING:
141
-
142
- | Error | Action |
143
- |-------|--------|
144
- | Build fails | Restore backup |
145
- | Script fails | Restore backup |
146
-
147
- ---
148
-
149
- ## SUCCESS CRITERIA:
150
-
151
- - Build passes
152
- - Script generates
153
- - Summary displayed
154
-
155
- ## COMPLETION:
156
-
157
- Rebase-snapshot complete. Use `/efcore db-reset` then `/efcore db-deploy` to apply.
@@ -1,131 +0,0 @@
1
- ---
2
- name: step-00-init
3
- description: Initialize EF Core context - detect project, DbContext, and environment
4
- next_step: null
5
- ---
6
-
7
- # Step 0: Initialize EF Core Context
8
-
9
- ## YOUR TASK:
10
-
11
- Detect EF Core project structure, identify DbContext (Core vs Extensions), and load environment configuration.
12
-
13
- **This step runs first for ALL EF Core commands.**
14
-
15
- ---
16
-
17
- ## EXECUTION SEQUENCE:
18
-
19
- Load all helper functions from: `references/shared-init-functions.md`
20
-
21
- This includes:
22
- - `ensure_dotnet_ef()` - Platform-aware dotnet-ef PATH fix
23
- - `detect_efcore_project()` - Find EF Core project
24
- - `detect_dbcontext()` - Detect Core vs Extensions
25
- - `detect_environment()` - Load environment configuration
26
- - `determine_base_branch()` - Determine GitFlow branch
27
- - `block_production()` - Prevent production deployments
28
- - `run_for_contexts()` - Helper for dual context execution
29
-
30
- ### User Prompt (if DbContext Unknown)
31
-
32
- **If `{dbcontext}` is empty after detection:**
33
-
34
- ```yaml
35
- AskUserQuestion:
36
- header: "DbContext"
37
- question: "Which DbContext to use?"
38
- options:
39
- - label: "CoreDbContext"
40
- description: "SmartStack entities (User, Role, Navigation...)"
41
- - label: "ExtensionsDbContext"
42
- description: "Client-specific entities"
43
- - label: "Both"
44
- description: "Run for both contexts"
45
- multiSelect: false
46
- ```
47
-
48
- **Set variables based on response:**
49
- ```javascript
50
- if (answer === "CoreDbContext") {
51
- DBCONTEXT = "CoreDbContext";
52
- DBCONTEXT_TYPE = "core";
53
- SCHEMA = "core";
54
- } else if (answer === "ExtensionsDbContext") {
55
- DBCONTEXT = "ExtensionsDbContext";
56
- DBCONTEXT_TYPE = "extensions";
57
- SCHEMA = "extensions";
58
- } else {
59
- // Both - will run commands twice
60
- RUN_BOTH = true;
61
- }
62
- ```
63
-
64
- ### Display Summary
65
-
66
- ```
67
- EF CORE CONTEXT
68
- ├── Project: {PROJECT_NAME}
69
- ├── DbContext: {DBCONTEXT} ({DBCONTEXT_TYPE})
70
- ├── Run Both: {RUN_BOTH} (Core → Extensions)
71
- ├── Schema: {SCHEMA}
72
- ├── Migrations: {MIGRATIONS_DIR}
73
- ├── Environment:{SELECTED_ENV}
74
- └── Branch: {CURRENT_BRANCH} → {BASE_BRANCH}
75
- ```
76
-
77
- ---
78
-
79
- ## STATE OUTPUT:
80
-
81
- After this step, these variables are available:
82
-
83
- | Variable | Example Value |
84
- |----------|---------------|
85
- | `{project_name}` | SmartStack.Infrastructure |
86
- | `{dbcontext}` | CoreDbContext |
87
- | `{dbcontext_type}` | core |
88
- | `{schema}` | core |
89
- | `{migrations_dir}` | src/SmartStack.Infrastructure/Persistence/Migrations |
90
- | `{infra_project}` | src/SmartStack.Infrastructure/SmartStack.Infrastructure.csproj |
91
- | `{startup_project}` | src/SmartStack.Api/SmartStack.Api.csproj |
92
- | `{base_branch}` | develop |
93
- | `{branch_type}` | feature |
94
- | `{current_branch}` | feature/multitenant |
95
- | `{selected_env}` | Local |
96
- | `{run_both}` | true |
97
-
98
- ---
99
-
100
- ## SUCCESS CRITERIA:
101
-
102
- - EF Core project detected
103
- - DbContext identified (or user prompted)
104
- - Environment loaded
105
- - No production environment
106
- - All paths validated
107
-
108
- ## FAILURE MODES:
109
-
110
- | Error | Resolution |
111
- |-------|------------|
112
- | No EF Core project | Check Microsoft.EntityFrameworkCore reference |
113
- | No appsettings.Local.json | Create file or use --env flag |
114
- | Production detected | Use different environment |
115
- | Both DbContexts found | User will be prompted |
116
-
117
- ---
118
-
119
- ## NEXT STEP:
120
-
121
- Route to command-specific step based on `{command}`:
122
-
123
- | Command | Next Step |
124
- |---------|-----------|
125
- | `db-status` | `../db/step-status.md` |
126
- | `db-deploy` | `../db/step-deploy.md` |
127
- | `db-reset` | `../db/step-reset.md` |
128
- | `db-seed` | `../db/step-seed.md` |
129
- | `migration` | `../migration/step-01-check.md` |
130
- | `squash` | `../squash/step-01-backup.md` |
131
- | `rebase-snapshot` | `../rebase-snapshot/step-01-backup.md` |
@@ -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`