@atlashub/smartstack-cli 4.35.0 → 4.37.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 (49) hide show
  1. package/dist/index.js +54 -100
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +54 -11
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/agents/efcore/migration.md +43 -0
  7. package/templates/agents/efcore/rebase-snapshot.md +36 -0
  8. package/templates/agents/efcore/squash.md +36 -0
  9. package/templates/skills/apex/references/checks/seed-checks.sh +1 -1
  10. package/templates/skills/apex/references/core-seed-data.md +39 -21
  11. package/templates/skills/application/references/application-roles-template.md +14 -8
  12. package/templates/skills/application/references/provider-template.md +32 -20
  13. package/templates/skills/application/templates-frontend.md +294 -2
  14. package/templates/skills/application/templates-seed.md +23 -11
  15. package/templates/skills/audit-route/SKILL.md +107 -0
  16. package/templates/skills/audit-route/references/routing-pattern.md +129 -0
  17. package/templates/skills/audit-route/steps/step-00-init.md +128 -0
  18. package/templates/skills/audit-route/steps/step-01-inventory.md +157 -0
  19. package/templates/skills/audit-route/steps/step-02-conformity.md +193 -0
  20. package/templates/skills/audit-route/steps/step-03-report.md +201 -0
  21. package/templates/skills/dev-start/SKILL.md +12 -2
  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/skills/efcore/references/both-contexts.md +0 -32
  30. package/templates/skills/efcore/references/destructive-operations.md +0 -38
  31. package/templates/skills/efcore/steps/db/step-deploy.md +0 -217
  32. package/templates/skills/efcore/steps/db/step-reset.md +0 -186
  33. package/templates/skills/efcore/steps/db/step-seed.md +0 -166
  34. package/templates/skills/efcore/steps/db/step-status.md +0 -173
  35. package/templates/skills/efcore/steps/migration/step-00-init.md +0 -102
  36. package/templates/skills/efcore/steps/migration/step-01-check.md +0 -164
  37. package/templates/skills/efcore/steps/migration/step-02-create.md +0 -160
  38. package/templates/skills/efcore/steps/migration/step-03-validate.md +0 -168
  39. package/templates/skills/efcore/steps/rebase-snapshot/step-00-init.md +0 -173
  40. package/templates/skills/efcore/steps/rebase-snapshot/step-01-backup.md +0 -100
  41. package/templates/skills/efcore/steps/rebase-snapshot/step-02-fetch.md +0 -115
  42. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +0 -112
  43. package/templates/skills/efcore/steps/rebase-snapshot/step-04-validate.md +0 -157
  44. package/templates/skills/efcore/steps/shared/step-00-init.md +0 -131
  45. package/templates/skills/efcore/steps/squash/step-00-init.md +0 -141
  46. package/templates/skills/efcore/steps/squash/step-01-backup.md +0 -120
  47. package/templates/skills/efcore/steps/squash/step-02-fetch.md +0 -168
  48. package/templates/skills/efcore/steps/squash/step-03-create.md +0 -184
  49. package/templates/skills/efcore/steps/squash/step-04-validate.md +0 -174
@@ -1,186 +0,0 @@
1
- ---
2
- name: step-reset
3
- description: Reset database - drop and recreate
4
- next_step: null
5
- ---
6
-
7
- # Database Reset
8
-
9
- ## YOUR TASK:
10
-
11
- Completely reset the database: drop, recreate, and apply all migrations.
12
-
13
- **WARNING:** This is DESTRUCTIVE. All data will be lost!
14
-
15
- **Requires:** `steps/shared/step-00-init.md` completed
16
-
17
- ---
18
-
19
- ## COMPLIANCE:
20
-
21
- | FORBIDDEN | REQUIRED |
22
- |-----------|----------|
23
- | `sqlcmd` for DDL/DML | `dotnet ef database drop` |
24
- | SQL scripts in repo | `dotnet ef database update` |
25
- | INSERT via scripts | `HasData()` for seeding |
26
-
27
- **Exception:** `sqlcmd` allowed ONLY for `BACKUP DATABASE`.
28
-
29
- ---
30
-
31
- ## EXECUTION SEQUENCE:
32
-
33
- ### 1. Environment Check
34
-
35
- Load validation: `references/database-operations.md#check-required-variables`
36
-
37
- ```bash
38
- echo "Reset Configuration"
39
- echo "==================="
40
- echo ""
41
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
42
- echo "Environment: $SELECTED_ENV"
43
- echo "Database: $DATABASE_NAME"
44
- echo "Server: $SERVER_NAME"
45
- echo ""
46
- echo "WARNING: ALL DATA WILL BE LOST!"
47
-
48
- # Block production
49
- block_production
50
- ```
51
-
52
- ### 2. Confirmation (MANDATORY)
53
-
54
- ```yaml
55
- AskUserQuestion:
56
- header: "Reset DB"
57
- question: "DANGER: Permanently delete '{DATABASE_NAME}'?
58
-
59
- ALL DATA WILL BE LOST!
60
-
61
- This action is IRREVERSIBLE."
62
- options:
63
- - label: "Yes, delete {DATABASE_NAME}"
64
- description: "Drop + Recreate (IRREVERSIBLE)"
65
- - label: "No, cancel"
66
- description: "Keep database"
67
- multiSelect: false
68
- ```
69
-
70
- ### 3. Optional Backup
71
-
72
- ```yaml
73
- AskUserQuestion:
74
- header: "Backup"
75
- question: "Backup database before deletion?"
76
- options:
77
- - label: "Yes, backup (Recommended)"
78
- description: "Create .bak via sqlcmd"
79
- - label: "No"
80
- description: "Dev data only - continue"
81
- - label: "Manual backup"
82
- description: "Via SSMS/Azure Portal (stops here)"
83
- multiSelect: false
84
- ```
85
-
86
- **If backup requested:**
87
-
88
- Load: `references/database-operations.md#backup-command`
89
-
90
- ### 4. Drop Database
91
-
92
- Load: `references/reset-operations.md#drop-database`
93
-
94
- ### 5. Recreate + Apply Migrations
95
-
96
- Load: `references/reset-operations.md#recreate--apply-migrations`
97
-
98
- ### 6. Optional Seed
99
-
100
- ```yaml
101
- AskUserQuestion:
102
- header: "Seed"
103
- question: "Populate with test data (HasData)?"
104
- options:
105
- - label: "Yes (recommended)"
106
- description: "Apply HasData configurations"
107
- - label: "No"
108
- description: "Empty database"
109
- multiSelect: false
110
- ```
111
-
112
- **If seed requested:**
113
-
114
- ```bash
115
- echo ""
116
- echo "Running seed..."
117
-
118
- # HasData is already applied via migrations
119
- # For custom seeding:
120
- dotnet run --project "$STARTUP_PROJECT" -- --seed 2>/dev/null || echo "No --seed argument supported"
121
- ```
122
-
123
- ### 7. Summary
124
-
125
- Load: `references/reset-operations.md#summary-after-reset`
126
-
127
- ---
128
-
129
- ## OUTPUT FORMAT:
130
-
131
- ```
132
- RESET COMPLETE
133
- ==============
134
- Database: {database_name}
135
- Environment: {env}
136
- DbContext: {dbcontext}
137
-
138
- Operations:
139
- - Drop: OK
140
- - Create: OK
141
- - Migrations: {N} applied
142
- - Backup: {path | none}
143
-
144
- Compliance: EF Core CLI only
145
-
146
- Next: /efcore db-status, /efcore db-seed
147
- ```
148
-
149
- ---
150
-
151
- ## PROTECTIONS:
152
-
153
- Load: `references/troubleshooting.md#reset-protections`
154
-
155
- ---
156
-
157
- ## BOTH CONTEXTS:
158
-
159
- If "Both" selected:
160
-
161
- ```bash
162
- # Drop + Recreate CoreDbContext
163
- DBCONTEXT="CoreDbContext"
164
- # ... execute reset ...
165
-
166
- # Then ExtensionsDbContext
167
- DBCONTEXT="ExtensionsDbContext"
168
- # ... execute reset ...
169
- ```
170
-
171
- ---
172
-
173
- ## OPTIONS:
174
-
175
- | Option | Description |
176
- |--------|-------------|
177
- | `--env {name}` | Use appsettings.{name}.json |
178
- | `--no-backup` | Skip backup step |
179
- | `--context {name}` | Specify DbContext |
180
- | `--seed` | Auto-seed after reset |
181
-
182
- ---
183
-
184
- ## COMPLETION:
185
-
186
- Database reset complete. Fresh state with all migrations applied.
@@ -1,166 +0,0 @@
1
- ---
2
- name: step-seed
3
- description: Populate database with test data
4
- next_step: null
5
- ---
6
-
7
- # Database Seed
8
-
9
- ## YOUR TASK:
10
-
11
- Populate the database with test or initial data using EF Core conventions.
12
-
13
- **Requires:** `steps/shared/step-00-init.md` completed
14
-
15
- ---
16
-
17
- ## COMPLIANCE:
18
-
19
- | FORBIDDEN | REQUIRED |
20
- |-----------|----------|
21
- | SQL scripts in repo | `HasData()` in configurations |
22
- | `sqlcmd` with INSERT | `IDataSeeder` classes |
23
- | `migrationBuilder.Sql()` INSERT | EF Core typed migrations |
24
-
25
- ---
26
-
27
- ## EXECUTION SEQUENCE:
28
-
29
- ### 1. Environment Check
30
-
31
- Load validation: `references/database-operations.md#check-required-variables`
32
-
33
- ```bash
34
- echo "Seed Configuration"
35
- echo "=================="
36
- echo ""
37
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
38
- echo "Environment: $SELECTED_ENV"
39
- echo "Database: $DATABASE_NAME"
40
-
41
- # Block production
42
- block_production
43
- ```
44
-
45
- ### 2. Detect Available Seed Methods
46
-
47
- Load: `references/seed-methods.md#detect-available-seed-methods`
48
-
49
- ### 3. Select Method
50
-
51
- **If multiple methods available:**
52
-
53
- ```yaml
54
- AskUserQuestion:
55
- header: "Seed"
56
- question: "Which seed method to use?"
57
- options:
58
- - label: "HasData (Recommended)"
59
- description: "Via EF Core migrations"
60
- - label: "Seeder Class"
61
- description: "Run DbSeeder/DataSeeder"
62
- - label: "CLI --seed"
63
- description: "Launch app with --seed"
64
- multiSelect: false
65
- ```
66
-
67
- ### 4. Execute Seed
68
-
69
- Load execution methods from: `references/seed-methods.md#execute-seed-*`
70
-
71
- - HasData: `references/seed-methods.md#execute-seed---hasdata`
72
- - Seeder Class: `references/seed-methods.md#execute-seed---seeder-class`
73
- - CLI Argument: `references/seed-methods.md#execute-seed---cli-argument`
74
-
75
- ### 5. Verify (Optional)
76
-
77
- Load: `references/seed-methods.md#verify-seed-data`
78
-
79
- ### 6. Summary
80
-
81
- ```bash
82
- echo ""
83
- echo "==========================================="
84
- echo "SEED COMPLETE"
85
- echo "==========================================="
86
- echo ""
87
- echo "Database: $DATABASE_NAME"
88
- echo "Environment: $SELECTED_ENV"
89
- echo "Method: $SEED_METHOD"
90
- echo ""
91
- echo "Compliance: EF Core native, No raw SQL"
92
- echo ""
93
- echo "==========================================="
94
- echo ""
95
- echo "Next steps:"
96
- echo " /efcore db-status # Check status"
97
- echo " dotnet run # Start application"
98
- echo ""
99
- ```
100
-
101
- ---
102
-
103
- ## OUTPUT FORMAT:
104
-
105
- ```
106
- SEED COMPLETE
107
- =============
108
- Database: {database_name}
109
- Environment: {env}
110
- Method: {hasdata | seeder-class | cli-argument}
111
-
112
- Compliance: EF Core native, No raw SQL
113
-
114
- Next: /efcore db-status, dotnet run
115
- ```
116
-
117
- ---
118
-
119
- ## NO SEED METHODS FOUND:
120
-
121
- Load: `references/troubleshooting.md#seed-setup-guide`
122
-
123
- ---
124
-
125
- ## MIGRATION FROM SQL:
126
-
127
- Load: `references/troubleshooting.md#migration-from-sql`
128
-
129
- ---
130
-
131
- ## BOTH CONTEXTS:
132
-
133
- If `RUN_BOTH=true` (auto-detected for client projects with SmartStack NuGet):
134
-
135
- Run the seed sequence for both contexts, in order:
136
-
137
- ```bash
138
- # 1. Seed CoreDbContext first (system data: Users, Roles, Permissions...)
139
- echo "=== Seeding CoreDbContext (core schema) ==="
140
- DBCONTEXT="CoreDbContext"
141
- # Run steps 2-6 with CoreDbContext...
142
-
143
- # 2. Then ExtensionsDbContext (client data)
144
- echo ""
145
- echo "=== Seeding ExtensionsDbContext (extensions schema) ==="
146
- DBCONTEXT="ExtensionsDbContext"
147
- # Run steps 2-6 with ExtensionsDbContext...
148
- ```
149
-
150
- **Order matters:** Core MUST be seeded first (Extensions may reference Core data via foreign keys).
151
-
152
- ---
153
-
154
- ## OPTIONS:
155
-
156
- | Option | Description |
157
- |--------|-------------|
158
- | `--env {name}` | Use appsettings.{name}.json |
159
- | `--context {name}` | Specify DbContext |
160
- | `--method {name}` | Force seed method (hasdata, seeder-class, cli-argument) |
161
-
162
- ---
163
-
164
- ## COMPLETION:
165
-
166
- Seed data applied. Use `/efcore db-status` to verify.
@@ -1,173 +0,0 @@
1
- ---
2
- name: step-status
3
- description: Display migrations and database status
4
- next_step: null
5
- ---
6
-
7
- # Database Status
8
-
9
- ## YOUR TASK:
10
-
11
- Display comprehensive status of EF Core migrations and database connection.
12
-
13
- **Requires:** `steps/shared/step-00-init.md` completed
14
-
15
- **Type:** Read-only, no modifications
16
-
17
- ---
18
-
19
- ## EXECUTION SEQUENCE:
20
-
21
- ### 0. Validate Required Variables
22
-
23
- Load: `references/database-operations.md#check-required-variables`
24
-
25
- ### 1. Display Configuration
26
-
27
- ```bash
28
- echo ""
29
- echo "EF CORE STATUS"
30
- echo "=============="
31
- echo ""
32
- echo "Project: $PROJECT_NAME"
33
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
34
- echo "Schema: $SCHEMA"
35
- echo "Environment: $SELECTED_ENV"
36
- echo "Config: $CONFIG_FILE"
37
- ```
38
-
39
- ### 2. Test Database Connection
40
-
41
- Load: `references/database-operations.md#connection-test`
42
-
43
- ### 3. List Migrations
44
-
45
- ```bash
46
- echo ""
47
- echo "Migrations:"
48
-
49
- dotnet ef migrations list \
50
- --context "$DBCONTEXT" \
51
- --project "$INFRA_PROJECT" \
52
- --startup-project "$STARTUP_PROJECT"
53
- ```
54
-
55
- ### 4. Count Applied vs Pending
56
-
57
- Load: `references/database-operations.md#migration-count-utilities`
58
-
59
- ```bash
60
- echo ""
61
- echo "Summary:"
62
- echo " Total: $TOTAL migrations"
63
- echo " Applied: $APPLIED"
64
- echo " Pending: $PENDING"
65
- ```
66
-
67
- ### 5. Check MCP for Conflicts (Optional)
68
-
69
- ```javascript
70
- // Call MCP for additional analysis
71
- const result = await mcp__smartstack__check_migrations({
72
- branch: CURRENT_BRANCH
73
- });
74
-
75
- if (result.conflicts && result.conflicts.length > 0) {
76
- console.log("");
77
- console.log("Conflicts detected:");
78
- result.conflicts.forEach(c => console.log(" - " + c));
79
- }
80
- ```
81
-
82
- ### 6. Check Naming Compliance
83
-
84
- ```bash
85
- echo ""
86
- echo "Naming compliance:"
87
-
88
- # Check migration naming pattern
89
- PATTERN="^(core|extensions)_v[0-9]+\.[0-9]+\.[0-9]+_[0-9]+_"
90
- NON_COMPLIANT=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | \
91
- grep -v "Designer\|Snapshot" | \
92
- xargs -I{} basename {} .cs | \
93
- grep -v -E "$PATTERN" | \
94
- wc -l)
95
-
96
- if [ "$NON_COMPLIANT" -eq 0 ]; then
97
- echo " All migrations follow naming convention"
98
- else
99
- echo " WARNING: $NON_COMPLIANT migrations have non-standard names"
100
- fi
101
- ```
102
-
103
- ### 7. Check 1-Migration-Per-Feature Rule
104
-
105
- ```bash
106
- # Count migrations for current branch
107
- BRANCH_MIGS=$(find "$MIGRATIONS_DIR" -name "*.cs" 2>/dev/null | \
108
- grep -v "Designer\|Snapshot" | \
109
- xargs -I{} basename {} | \
110
- grep -i "$(echo "$CURRENT_BRANCH" | sed 's|.*/||' | tr '-' '_')" | \
111
- wc -l)
112
-
113
- echo ""
114
- if [ "$BRANCH_MIGS" -le 1 ]; then
115
- echo "1-migration-per-feature: OK"
116
- else
117
- echo "1-migration-per-feature: WARNING ($BRANCH_MIGS migrations for this branch)"
118
- echo " Consider: /efcore squash"
119
- fi
120
- ```
121
-
122
- ---
123
-
124
- ## OUTPUT FORMAT:
125
-
126
- ```
127
- EF CORE STATUS
128
- ==============
129
- Project: {project_name}
130
- DbContext: {dbcontext} ({dbcontext_type})
131
- Schema: {schema}
132
- Environment: {env}
133
- Config: {config_file}
134
-
135
- Connection: {OK | FAILED}
136
-
137
- Migrations:
138
- {list of migrations}
139
-
140
- Summary:
141
- Total: {N} migrations
142
- Applied: {N}
143
- Pending: {N}
144
-
145
- Naming compliance: {OK | WARNING}
146
- 1-migration-per-feature: {OK | WARNING}
147
-
148
- {if pending}
149
- Next: /efcore db-deploy
150
- {endif}
151
- ```
152
-
153
- ---
154
-
155
- ## TROUBLESHOOTING (if connection fails):
156
-
157
- Load: `references/troubleshooting.md#database-status`
158
-
159
- ---
160
-
161
- ## OPTIONS:
162
-
163
- | Option | Description |
164
- |--------|-------------|
165
- | `--verbose` | Show all migrations with details |
166
- | `--json` | Output as JSON |
167
- | `--context` | Specify DbContext |
168
-
169
- ---
170
-
171
- ## COMPLETION:
172
-
173
- Status displayed. No modifications made.
@@ -1,102 +0,0 @@
1
- ---
2
- name: step-00-init
3
- description: Initialize migration - cross-branch check and context detection
4
- next_step: step-01-check.md
5
- ---
6
-
7
- # Step 0: Initialize Migration
8
-
9
- ## YOUR TASK:
10
-
11
- Detect context, check for cross-branch conflicts, and prepare for migration creation.
12
-
13
- **Requires:** `steps/shared/step-00-init.md` completed (provides {dbcontext}, {base_branch}, etc.)
14
-
15
- ---
16
-
17
- ## RULE:
18
-
19
- ```
20
- 1 MIGRATION PER FEATURE
21
-
22
- - If migration exists for this branch → recreate it
23
- - Never accumulate multiple migrations per feature
24
- - Squash before merge if needed
25
- ```
26
-
27
- ---
28
-
29
- ## EXECUTION SEQUENCE:
30
-
31
- ### 1. Display Context
32
-
33
- ```bash
34
- echo "Migration Context"
35
- echo "================"
36
- echo ""
37
- echo "Branch: $CURRENT_BRANCH"
38
- echo "Type: $BRANCH_TYPE"
39
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
40
- echo "Schema: $SCHEMA"
41
- echo "Migrations: $MIGRATIONS_DIR"
42
- ```
43
-
44
- ### 2. Cross-Branch Validation (Optional)
45
-
46
- ```bash
47
- if [ "$CROSS_BRANCH_ENABLED" = "true" ]; then
48
- echo ""
49
- echo "Checking cross-branch conflicts..."
50
-
51
- # Get snapshot from develop
52
- DEVELOP_SNAPSHOT=$(git show "origin/$BASE_BRANCH:$MIGRATIONS_DIR/${DBCONTEXT}ModelSnapshot.cs" 2>/dev/null || echo "")
53
- LOCAL_SNAPSHOT=$(cat "$MIGRATIONS_DIR/${DBCONTEXT}ModelSnapshot.cs" 2>/dev/null || echo "")
54
-
55
- if [ -n "$DEVELOP_SNAPSHOT" ] && [ -n "$LOCAL_SNAPSHOT" ]; then
56
- DIFF_LINES=$(diff <(echo "$DEVELOP_SNAPSHOT") <(echo "$LOCAL_SNAPSHOT") 2>/dev/null | wc -l)
57
-
58
- if [ "$DIFF_LINES" -gt 100 ]; then
59
- echo ""
60
- echo "WARNING: Cross-branch conflict detected ($DIFF_LINES lines differ)"
61
- echo "Recommendation: /efcore rebase-snapshot"
62
- echo ""
63
-
64
- if [ "$BLOCK_ON_CONFLICT" = "true" ]; then
65
- echo "BLOCKED: Use --force to override or rebase first"
66
- exit 1
67
- fi
68
- else
69
- echo " No significant conflicts detected"
70
- fi
71
- fi
72
- fi
73
- ```
74
-
75
- ### 3. Skip If --force Flag
76
-
77
- ```bash
78
- if [ "$FORCE_FLAG" = "true" ]; then
79
- echo ""
80
- echo "Force mode: skipping cross-branch check"
81
- fi
82
- ```
83
-
84
- ---
85
-
86
- ## STATE OUTPUT:
87
-
88
- | Variable | Description |
89
- |----------|-------------|
90
- | `{cross_branch_ok}` | true if no conflicts or force mode |
91
- | `{diff_lines}` | Number of lines different from parent |
92
-
93
- ---
94
-
95
- ## SUCCESS CRITERIA:
96
-
97
- - DbContext detected
98
- - Cross-branch check passed (or forced)
99
-
100
- ## NEXT STEP:
101
-
102
- → `step-01-check.md`