@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,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`
@@ -1,164 +0,0 @@
1
- ---
2
- name: step-01-check
3
- description: Check for existing migration and decide action
4
- next_step: step-02-create.md
5
- ---
6
-
7
- # Step 1: Check Existing Migration
8
-
9
- ## YOUR TASK:
10
-
11
- Search for existing migrations for this branch and decide whether to recreate or skip.
12
-
13
- **Previous step:** `step-00-init.md`
14
-
15
- ---
16
-
17
- ## EXECUTION SEQUENCE:
18
-
19
- ### 0. Validate Required Variables
20
-
21
- ```bash
22
- # Validate required variables from step-00-init
23
- for VAR_NAME in DBCONTEXT DBCONTEXT_TYPE MIGRATIONS_DIR INFRA_PROJECT STARTUP_PROJECT CURRENT_BRANCH BRANCH_TYPE; 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
-
33
- ### 1. Build Search Pattern
34
-
35
- ```bash
36
- # Extract branch name for pattern
37
- case "$BRANCH_TYPE" in
38
- feature)
39
- BRANCH_SHORT=$(echo "$CURRENT_BRANCH" | sed 's|feature/||' | tr '-' '_')
40
- ;;
41
- release)
42
- BRANCH_SHORT=$(echo "$CURRENT_BRANCH" | sed 's|release/||' | tr '.' '_')
43
- ;;
44
- hotfix)
45
- BRANCH_SHORT=$(echo "$CURRENT_BRANCH" | sed 's|hotfix/||' | tr '.' '_')
46
- ;;
47
- *)
48
- BRANCH_SHORT=""
49
- ;;
50
- esac
51
-
52
- echo "Searching for existing migrations..."
53
- echo " Pattern: *${BRANCH_SHORT}*"
54
- ```
55
-
56
- ### 2. Find Existing Migrations
57
-
58
- ```bash
59
- # Sanitize branch name: only allow alphanumeric, underscore (prevent regex/shell injection)
60
- BRANCH_SHORT_SAFE=$(echo "$BRANCH_SHORT" | sed 's/[^a-zA-Z0-9_]//g')
61
- if [ -z "$BRANCH_SHORT_SAFE" ]; then
62
- echo "ERROR: Invalid branch name (no alphanumeric characters after sanitization)"
63
- exit 1
64
- fi
65
-
66
- # Search for migrations matching this branch (-F = fixed-string, prevents regex injection)
67
- EXISTING_MIGRATIONS=$(find "$MIGRATIONS_DIR" -name "*.cs" ! -name "*Designer.cs" ! -name "*Snapshot.cs" -type f 2>/dev/null | \
68
- xargs -I{} basename {} | \
69
- grep -iF "$BRANCH_SHORT_SAFE" || echo "")
70
-
71
- EXISTING_COUNT=$(echo "$EXISTING_MIGRATIONS" | grep -c "^[^ ]" 2>/dev/null || echo "0")
72
-
73
- echo ""
74
- if [ "$EXISTING_COUNT" -gt 0 ]; then
75
- echo "Found $EXISTING_COUNT existing migration(s):"
76
- echo "$EXISTING_MIGRATIONS" | while read mig; do
77
- echo " - $mig"
78
- done
79
- else
80
- echo "No existing migration for this branch."
81
- fi
82
- ```
83
-
84
- ### 3. Decide Action
85
-
86
- **If migrations exist and NOT force mode:**
87
-
88
- ```yaml
89
- AskUserQuestion:
90
- header: "Migration"
91
- question: "Found {EXISTING_COUNT} existing migration(s). What do you want to do?"
92
- options:
93
- - label: "Recreate (Recommended)"
94
- description: "Delete existing and create new"
95
- - label: "Keep and add new"
96
- description: "Add another migration (not recommended)"
97
- - label: "Cancel"
98
- description: "Do nothing"
99
- multiSelect: false
100
- ```
101
-
102
- **Handle response:**
103
-
104
- ```javascript
105
- if (answer === "Recreate (Recommended)" || force_mode) {
106
- // Delete existing migrations
107
- ACTION = "recreate";
108
- } else if (answer === "Keep and add new") {
109
- ACTION = "add";
110
- // Warning: violates 1-migration-per-feature rule
111
- } else {
112
- // Cancel
113
- exit(0);
114
- }
115
- ```
116
-
117
- ### 4. Delete Existing (If Recreate)
118
-
119
- ```bash
120
- if [ "$ACTION" = "recreate" ]; then
121
- echo ""
122
- echo "Removing existing migrations..."
123
-
124
- for mig in $EXISTING_MIGRATIONS; do
125
- mig_name="${mig%.cs}"
126
-
127
- rm -f "$MIGRATIONS_DIR/${mig_name}.cs"
128
- rm -f "$MIGRATIONS_DIR/${mig_name}.Designer.cs"
129
-
130
- # Verify deletion succeeded
131
- if [ -f "$MIGRATIONS_DIR/${mig_name}.cs" ]; then
132
- echo " ERROR: Failed to delete ${mig_name}.cs"
133
- exit 1
134
- fi
135
-
136
- echo " Removed: $mig_name"
137
- done
138
-
139
- echo ""
140
- echo "Existing migrations removed."
141
- fi
142
- ```
143
-
144
- ---
145
-
146
- ## STATE OUTPUT:
147
-
148
- | Variable | Description |
149
- |----------|-------------|
150
- | `{existing_migrations}` | List of existing migrations |
151
- | `{existing_count}` | Number found |
152
- | `{action}` | "recreate", "add", or "cancel" |
153
-
154
- ---
155
-
156
- ## SUCCESS CRITERIA:
157
-
158
- - Existing migrations identified
159
- - User decision captured
160
- - Old migrations removed (if recreate)
161
-
162
- ## NEXT STEP:
163
-
164
- → `step-02-create.md`