@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.
Files changed (50) hide show
  1. package/dist/index.js +28 -32
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +35 -303
  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 +350 -89
  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/cli-app-sync/SKILL.md +2 -2
  19. package/templates/skills/cli-app-sync/references/comparison-map.md +1 -1
  20. package/templates/skills/dev-start/SKILL.md +12 -2
  21. package/templates/skills/documentation/steps/step-03-validate.md +12 -14
  22. package/templates/skills/efcore/SKILL.md +219 -67
  23. package/templates/agents/efcore/conflicts.md +0 -114
  24. package/templates/agents/efcore/db-deploy.md +0 -86
  25. package/templates/agents/efcore/db-reset.md +0 -98
  26. package/templates/agents/efcore/db-seed.md +0 -73
  27. package/templates/agents/efcore/db-status.md +0 -97
  28. package/templates/agents/efcore/scan.md +0 -124
  29. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +0 -126
  30. package/templates/skills/efcore/references/both-contexts.md +0 -32
  31. package/templates/skills/efcore/references/destructive-operations.md +0 -38
  32. package/templates/skills/efcore/steps/db/step-deploy.md +0 -217
  33. package/templates/skills/efcore/steps/db/step-reset.md +0 -186
  34. package/templates/skills/efcore/steps/db/step-seed.md +0 -166
  35. package/templates/skills/efcore/steps/db/step-status.md +0 -173
  36. package/templates/skills/efcore/steps/migration/step-00-init.md +0 -102
  37. package/templates/skills/efcore/steps/migration/step-01-check.md +0 -164
  38. package/templates/skills/efcore/steps/migration/step-02-create.md +0 -160
  39. package/templates/skills/efcore/steps/migration/step-03-validate.md +0 -168
  40. package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +0 -173
  41. package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +0 -100
  42. package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +0 -115
  43. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +0 -112
  44. package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +0 -157
  45. package/templates/skills/efcore/steps/shared/step-00-init.md +0 -131
  46. package/templates/skills/efcore/steps/squash/step-00-init.md +0 -141
  47. package/templates/skills/efcore/steps/squash/step-01-backup.md +0 -120
  48. package/templates/skills/efcore/steps/squash/step-02-fetch.md +0 -168
  49. package/templates/skills/efcore/steps/squash/step-03-create.md +0 -184
  50. package/templates/skills/efcore/steps/squash/step-04-validate.md +0 -174
@@ -1,100 +0,0 @@
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`
@@ -1,115 +0,0 @@
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`
@@ -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` |