@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,73 +0,0 @@
1
- ---
2
- name: efcore-db-seed
3
- description: EF Core database seed - populate test data
4
- color: yellow
5
- model: haiku
6
- tools: Bash, Glob, Read
7
- ---
8
-
9
- # EF Core Database Seed Agent
10
-
11
- Populates the database with test data.
12
-
13
- ## FORBIDDEN
14
-
15
- - **NEVER** create, delete, modify, or recreate migrations (`dotnet ef migrations add/remove` is FORBIDDEN)
16
- - **NEVER** drop or recreate the database (`dotnet ef database drop` is FORBIDDEN)
17
- - This agent ONLY seeds data into an existing database
18
-
19
- ## WSL Preflight (MANDATORY - run BEFORE any git command)
20
-
21
- ```bash
22
- # Repair worktree .git file if Windows path detected under WSL
23
- if [ -f .git ] && grep -q '^gitdir: [A-Za-z]:' .git 2>/dev/null && grep -qi microsoft /proc/version 2>/dev/null; then
24
- p=$(sed 's/^gitdir: //' .git | tr -d '\r\n'); d=$(echo "${p:0:1}" | tr A-Z a-z); r="${p:2}"; r="${r//\\//}"
25
- printf 'gitdir: %s\n' "$(realpath -m --relative-to="$(pwd)" "/mnt/$d$r")" > .git
26
- echo "Worktree .git path repaired for WSL"
27
- fi
28
- ```
29
-
30
- ## Workflow
31
-
32
- 1. **Detect** available seeding method:
33
- - SQL Script: `scripts/seed.sql`
34
- - HasData: in configurations
35
- - CLI: `--seed` argument
36
- 2. **Execute** the found method
37
- 3. **Verify** insertion
38
-
39
- ## Detection
40
-
41
- ```bash
42
- # SQL Script
43
- test -f scripts/seed.sql && echo "sql-script"
44
-
45
- # HasData
46
- grep -r "\.HasData(" --include="*.cs" && echo "hasdata"
47
-
48
- # CLI seed
49
- grep -q "\-\-seed" Program.cs && echo "cli-seed"
50
- ```
51
-
52
- ## Execution
53
-
54
- ```bash
55
- # SQL Script
56
- sqlcmd -S $SERVER -E -d $DATABASE -i scripts/seed.sql
57
-
58
- # CLI
59
- dotnet run -- --seed
60
- ```
61
-
62
- ## Output Format
63
-
64
- ```
65
- DB SEED
66
- Method: {sql-script|hasdata|cli}
67
- Status: {success|error}
68
- Records: {n} inserted (if available)
69
- ```
70
-
71
- ## Priority
72
-
73
- Speed > Detail. Execute without too many questions.
@@ -1,97 +0,0 @@
1
- ---
2
- name: efcore-db-status
3
- description: EF Core database status - fast migration state check
4
- color: blue
5
- model: haiku
6
- tools: Bash, Glob
7
- ---
8
-
9
- # EF Core Database Status Agent
10
-
11
- Fast check of EF Core migration state using **SmartStack MCP**.
12
-
13
- ## FORBIDDEN
14
-
15
- - **NEVER** create, delete, modify, or recreate migrations
16
- - **NEVER** modify the database (`dotnet ef database update/drop` is FORBIDDEN)
17
- - This agent is READ-ONLY: it only checks status, never modifies anything
18
-
19
- ## WSL Preflight (MANDATORY - run BEFORE any git command)
20
-
21
- ```bash
22
- # Repair worktree .git file if Windows path detected under WSL
23
- if [ -f .git ] && grep -q '^gitdir: [A-Za-z]:' .git 2>/dev/null && grep -qi microsoft /proc/version 2>/dev/null; then
24
- p=$(sed 's/^gitdir: //' .git | tr -d '\r\n'); d=$(echo "${p:0:1}" | tr A-Z a-z); r="${p:2}"; r="${r//\\//}"
25
- printf 'gitdir: %s\n' "$(realpath -m --relative-to="$(pwd)" "/mnt/$d$r")" > .git
26
- echo "Worktree .git path repaired for WSL"
27
- fi
28
- ```
29
-
30
- ## Workflow
31
-
32
- 1. **Invoke MCP** for migration list and naming validation
33
- 2. **Test** DB connection with `dotnet ef`
34
- 3. **Count** applied vs pending
35
- 4. **Verify** 1 migration per feature rule
36
- 5. **Output** compact summary
37
-
38
- ## MCP Integration
39
-
40
- **Primary method:** Get structured migration data
41
-
42
- ```
43
- CALL mcp__smartstack__check_migrations WITH:
44
- - branch: {current_branch}
45
- ```
46
-
47
- **Response fields used:**
48
- - `migrations[]` - List with name, context, version, sequence
49
- - `conflicts[]` - Any naming issues
50
-
51
- ## Fallback Commands (if MCP unavailable)
52
-
53
- ```bash
54
- # Migrations
55
- dotnet ef migrations list --no-build 2>/dev/null | grep -v "^Build"
56
-
57
- # Branch
58
- git branch --show-current
59
- ```
60
-
61
- ## Output Format
62
-
63
- ```
64
- ================================================================================
65
- EF CORE - DATABASE STATUS
66
- ================================================================================
67
-
68
- CORE CONTEXT (CoreDbContext)
69
- Schema: core
70
- History: core.__EFMigrationsHistory
71
- Migrations: {applied}/{total} | {pending} pending
72
-
73
- EXTENSIONS CONTEXT (ExtensionsDbContext)
74
- Schema: extensions
75
- History: extensions.__EFMigrationsHistory
76
- Migrations: {applied}/{total} | {pending} pending
77
-
78
- BRANCH STATUS
79
- Branch: {branch}
80
- Core migrations: {n}
81
- Extensions migrations: {n}
82
- Naming: {ok|warnings}
83
- 1-migration rule: {ok|warning}
84
-
85
- ================================================================================
86
- ```
87
-
88
- ## Dual DbContext Notes
89
-
90
- - **Core migrations** use `--context CoreDbContext`
91
- - **Extensions migrations** use `--context ExtensionsDbContext`
92
- - Each context has its own `__EFMigrationsHistory` table
93
- - Check both contexts when verifying migration status
94
-
95
- ## Priority
96
-
97
- Speed > Detail. Use MCP for structured data, dotnet ef for connection test.
@@ -1,124 +0,0 @@
1
- ---
2
- name: efcore-scan
3
- description: EF Core cross-branch migration scanner - detect conflicts before they happen
4
- color: cyan
5
- model: haiku
6
- tools: Bash, Glob, Read
7
- ---
8
-
9
- # EF Core Scan Agent
10
-
11
- Cross-branch scanner using **SmartStack MCP** to detect migrations across all active branches.
12
-
13
- ## WSL Preflight (MANDATORY - run BEFORE any git command)
14
-
15
- ```bash
16
- # Repair worktree .git file if Windows path detected under WSL
17
- if [ -f .git ] && grep -q '^gitdir: [A-Za-z]:' .git 2>/dev/null && grep -qi microsoft /proc/version 2>/dev/null; then
18
- p=$(sed 's/^gitdir: //' .git | tr -d '\r\n'); d=$(echo "${p:0:1}" | tr A-Z a-z); r="${p:2}"; r="${r//\\//}"
19
- printf 'gitdir: %s\n' "$(realpath -m --relative-to="$(pwd)" "/mnt/$d$r")" > .git
20
- echo "Worktree .git path repaired for WSL"
21
- fi
22
- ```
23
-
24
- ## Mission
25
-
26
- 1. **List** all active worktrees
27
- 2. **Invoke MCP** for each branch
28
- 3. **Aggregate** results into summary
29
- 4. **Analyze** conflict risks
30
- 5. **Recommend** optimal merge order
31
-
32
- ## Base Branch Determination
33
-
34
- **BEFORE calling MCP, determine the correct base branch for each worktree:**
35
-
36
- ```bash
37
- # For each branch, determine its base:
38
- # feature/* → compareBranch: "develop"
39
- # release/* → compareBranch: "main"
40
- # hotfix/* → compareBranch: "main"
41
- # develop → compareBranch: "main"
42
- determine_compare_branch() {
43
- case "$1" in
44
- feature/*) echo "develop" ;;
45
- release/*) echo "main" ;;
46
- hotfix/*) echo "main" ;;
47
- develop) echo "main" ;;
48
- *) echo "develop" ;;
49
- esac
50
- }
51
- ```
52
-
53
- ## MCP Integration
54
-
55
- **Primary method:** Loop through branches and call MCP with the **correct base branch**
56
-
57
- ```
58
- FOR each branch in active_worktrees:
59
- COMPARE_BRANCH = determine_compare_branch(branch)
60
- CALL mcp__smartstack__check_migrations WITH:
61
- - branch: {branch}
62
- - compareBranch: {COMPARE_BRANCH}
63
- STORE result
64
- ```
65
-
66
- **Response structure:**
67
-
68
- ```typescript
69
- {
70
- hasConflicts: boolean;
71
- migrations: MigrationInfo[];
72
- conflicts: MigrationConflict[];
73
- suggestions: string[];
74
- }
75
- ```
76
-
77
- ## Fallback Commands (if MCP unavailable)
78
-
79
- ```bash
80
- # List worktrees (run preflight_git_check first for cross-platform compatibility)
81
- detect_platform
82
- repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
83
- git worktree list
84
-
85
- # ModelSnapshot hash
86
- md5sum Migrations/*ModelSnapshot.cs | cut -d' ' -f1
87
-
88
- # Compare with develop
89
- diff -q local/Snapshot.cs develop/Snapshot.cs
90
-
91
- # Count migrations
92
- find Migrations -name "*.cs" | grep -v Designer | grep -v Snapshot | wc -l
93
- ```
94
-
95
- ## Risk Levels
96
-
97
- | MCP Conflict Type | Level | Action |
98
- |-------------------|-------|--------|
99
- | (none) | NONE | Direct merge OK |
100
- | `naming` | LOW | Merge OK |
101
- | `order` | MEDIUM | Attention to order |
102
- | `dependency` | HIGH | Rebase required |
103
- | `snapshot` | CRITICAL | Manual intervention |
104
-
105
- ## Output Format
106
-
107
- ```
108
- ================================================================================
109
- EF CORE CROSS-BRANCH SCAN (via MCP)
110
- ================================================================================
111
-
112
- BRANCHES (n)
113
- {branch} | {migrations.length} | Risk: {level}
114
-
115
- RECOMMENDED MERGE ORDER
116
- 1. {branch} (reason)
117
- 2. {branch} (reason)
118
-
119
- ================================================================================
120
- ```
121
-
122
- ## Priority
123
-
124
- Speed > Accuracy. Read-only, no modifications.
@@ -1,32 +0,0 @@
1
- # Both Contexts Deployment
2
-
3
- When `RUN_BOTH=true` (auto-detected for client projects with SmartStack NuGet):
4
-
5
- ```bash
6
- # 1. Deploy CoreDbContext first (system tables: Users, Roles, Tenants...)
7
- echo "=== Deploying CoreDbContext (core schema) ==="
8
- DBCONTEXT="CoreDbContext"
9
- SCHEMA="core"
10
- # Run steps 2-6 with CoreDbContext...
11
-
12
- dotnet ef database update \
13
- --context "CoreDbContext" \
14
- --project "$INFRA_PROJECT" \
15
- --startup-project "$STARTUP_PROJECT" \
16
- --verbose
17
-
18
- # 2. Then ExtensionsDbContext (client tables)
19
- echo ""
20
- echo "=== Deploying ExtensionsDbContext (extensions schema) ==="
21
- DBCONTEXT="ExtensionsDbContext"
22
- SCHEMA="extensions"
23
- # Run steps 2-6 with ExtensionsDbContext...
24
-
25
- dotnet ef database update \
26
- --context "ExtensionsDbContext" \
27
- --project "$INFRA_PROJECT" \
28
- --startup-project "$STARTUP_PROJECT" \
29
- --verbose
30
- ```
31
-
32
- **Order matters:** Core MUST be deployed first (Extensions may have foreign keys to Core tables).
@@ -1,38 +0,0 @@
1
- # Destructive Operations & Zero-Downtime Patterns
2
-
3
- When a migration contains destructive operations (DropColumn, RenameColumn, AlterColumn, DropTable), consider zero-downtime patterns for production deployments.
4
-
5
- ## Detection
6
-
7
- Migration Analysis counts:
8
- - DropColumn
9
- - RenameColumn
10
- - AlterColumn
11
- - DropTable
12
-
13
- If any count > 0, display warning and reference this document.
14
-
15
- ## Zero-Downtime Patterns
16
-
17
- For production deployments with destructive operations:
18
-
19
- 1. **Add → Populate → Migrate → Remove** (for column renames)
20
- - Add new column
21
- - Populate from old column
22
- - Deploy migration
23
- - Remove old column in next deployment window
24
-
25
- 2. **Feature Flags** (for table changes)
26
- - Add feature flag
27
- - Deploy new code path
28
- - Migrate data
29
- - Remove old code path after stabilization
30
-
31
- 3. **Gradual Rollout**
32
- - Deploy to staging first
33
- - Monitor for issues
34
- - Gradually roll to production clusters
35
-
36
- ## Reference
37
-
38
- See OWASP and database migration best practices for your platform.
@@ -1,217 +0,0 @@
1
- ---
2
- name: step-deploy
3
- description: Deploy pending migrations to database
4
- next_step: null
5
- ---
6
-
7
- # Database Deploy
8
-
9
- ## YOUR TASK:
10
-
11
- Apply pending EF Core migrations to the local database.
12
-
13
- **Requires:** `steps/shared/step-00-init.md` completed
14
-
15
- ---
16
-
17
- ## EXECUTION SEQUENCE:
18
-
19
- ### 1. Environment Check
20
-
21
- ```bash
22
- # Validate required variables from step-00-init
23
- for VAR_NAME in DBCONTEXT DBCONTEXT_TYPE INFRA_PROJECT STARTUP_PROJECT SELECTED_ENV; do
24
- eval VAR_VALUE=\$$VAR_NAME
25
- if [ -z "$VAR_VALUE" ]; then
26
- echo "ERROR: Required variable $VAR_NAME is not set"
27
- echo "Run step-00-init first"
28
- exit 1
29
- fi
30
- done
31
-
32
- echo "Deploy Configuration"
33
- echo "===================="
34
- echo ""
35
- echo "DbContext: $DBCONTEXT ($DBCONTEXT_TYPE)"
36
- echo "Environment: $SELECTED_ENV"
37
- echo "Database: $DATABASE_NAME"
38
- echo "Server: $SERVER_NAME"
39
-
40
- # Block production
41
- block_production
42
- ```
43
-
44
- ### 2. Check Pending Migrations
45
-
46
- ```bash
47
- echo ""
48
- echo "Checking pending migrations..."
49
-
50
- EF_STDERR=$(mktemp)
51
- PENDING=$(dotnet ef migrations list \
52
- --context "$DBCONTEXT" \
53
- --project "$INFRA_PROJECT" \
54
- --startup-project "$STARTUP_PROJECT" 2>"$EF_STDERR" | \
55
- grep -c "(Pending)" || echo "0")
56
-
57
- # Check for real errors (not just build output)
58
- if grep -qi "error\|exception\|failed" "$EF_STDERR" 2>/dev/null; then
59
- echo "WARNING: EF Core reported errors:"
60
- grep -i "error\|exception\|failed" "$EF_STDERR" | head -5
61
- fi
62
- rm -f "$EF_STDERR"
63
-
64
- echo "Pending: $PENDING migration(s)"
65
-
66
- if [ "$PENDING" -eq 0 ]; then
67
- echo ""
68
- echo "No pending migrations. Database is up to date."
69
- echo ""
70
- echo "Next steps:"
71
- echo " /efcore migration # Create new migration"
72
- echo " /efcore db-status # Check status"
73
- exit 0
74
- fi
75
- ```
76
-
77
- ### 3. List Pending Migrations
78
-
79
- ```bash
80
- echo ""
81
- echo "Migrations to apply:"
82
-
83
- dotnet ef migrations list \
84
- --context "$DBCONTEXT" \
85
- --project "$INFRA_PROJECT" \
86
- --startup-project "$STARTUP_PROJECT" 2>/dev/null | \
87
- grep "(Pending)" | while read line; do
88
- echo " - $line"
89
- done
90
- ```
91
-
92
- ### 4. Confirmation (if not auto mode)
93
-
94
- ```yaml
95
- AskUserQuestion:
96
- header: "Deploy"
97
- question: "Apply {PENDING} migration(s) to {DATABASE_NAME}?"
98
- options:
99
- - label: "Yes, apply"
100
- description: "Deploy to {SELECTED_ENV} environment"
101
- - label: "Cancel"
102
- description: "Do not apply"
103
- multiSelect: false
104
- ```
105
-
106
- ### 5. Apply Migrations
107
-
108
- ```bash
109
- echo ""
110
- echo "Applying migrations..."
111
- echo ""
112
-
113
- dotnet ef database update \
114
- --context "$DBCONTEXT" \
115
- --project "$INFRA_PROJECT" \
116
- --startup-project "$STARTUP_PROJECT" \
117
- --verbose
118
- EXIT_CODE=$?
119
-
120
- if [ $EXIT_CODE -ne 0 ]; then
121
- echo ""
122
- echo "ERROR: Migration failed (exit code: $EXIT_CODE)"
123
- echo ""
124
- echo "Troubleshooting:"
125
- echo " - Check database connection"
126
- echo " - Review migration content"
127
- echo " - Try: /efcore db-reset"
128
- exit 1
129
- fi
130
- ```
131
-
132
- ### 6. Verify
133
-
134
- ```bash
135
- echo ""
136
- echo "Verifying..."
137
-
138
- NEW_PENDING=$(dotnet ef migrations list \
139
- --context "$DBCONTEXT" \
140
- --project "$INFRA_PROJECT" \
141
- --startup-project "$STARTUP_PROJECT" 2>/dev/null | \
142
- grep -c "(Pending)" || echo "0")
143
-
144
- if [ "$NEW_PENDING" -eq 0 ]; then
145
- echo "All migrations applied successfully."
146
- else
147
- echo "WARNING: $NEW_PENDING migrations still pending"
148
- fi
149
- ```
150
-
151
- ### 7. Summary
152
-
153
- ```bash
154
- echo ""
155
- echo "==========================================="
156
- echo "DEPLOY COMPLETE"
157
- echo "==========================================="
158
- echo ""
159
- echo "Database: $DATABASE_NAME"
160
- echo "Environment: $SELECTED_ENV"
161
- echo "DbContext: $DBCONTEXT"
162
- echo "Applied: $PENDING migration(s)"
163
- echo ""
164
- echo "==========================================="
165
- echo ""
166
- echo "Next steps:"
167
- echo " /efcore db-status # Verify status"
168
- echo " /efcore db-seed # Add test data"
169
- echo ""
170
- ```
171
-
172
- ---
173
-
174
- ## OUTPUT FORMAT:
175
-
176
- ```
177
- DEPLOY COMPLETE
178
- ===============
179
- Database: {database_name}
180
- Environment: {env}
181
- DbContext: {dbcontext}
182
- Applied: {N} migration(s)
183
-
184
- Next: /efcore db-status, /efcore db-seed
185
- ```
186
-
187
- ---
188
-
189
- ## ERROR HANDLING:
190
-
191
- | Error | Resolution |
192
- |-------|------------|
193
- | Connection failed | Check SQL Server, credentials |
194
- | Migration error | Review migration, consider reset |
195
- | Constraint violation | Check data, may need seed |
196
-
197
- ---
198
-
199
- ## OPTIONS:
200
-
201
- | Option | Description |
202
- |--------|-------------|
203
- | `--env {name}` | Use appsettings.{name}.json |
204
- | `--verbose` | Show SQL statements |
205
- | `--context {name}` | Specify DbContext |
206
-
207
- ---
208
-
209
- ## BOTH CONTEXTS:
210
-
211
- Load: `references/both-contexts.md`
212
-
213
- ---
214
-
215
- ## COMPLETION:
216
-
217
- Migrations applied. Use `/efcore db-status` to verify.