@atlashub/smartstack-cli 1.14.3 → 1.17.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 (28) hide show
  1. package/dist/index.js +74897 -1477
  2. package/dist/index.js.map +1 -1
  3. package/package.json +5 -1
  4. package/templates/agents/efcore/migration.md +37 -25
  5. package/templates/agents/efcore/rebase-snapshot.md +32 -12
  6. package/templates/agents/efcore/squash.md +14 -4
  7. package/templates/agents/mcp-healthcheck.md +161 -0
  8. package/templates/commands/efcore/_shared.md +117 -0
  9. package/templates/commands/efcore/db-deploy.md +32 -4
  10. package/templates/commands/efcore/db-reset.md +38 -2
  11. package/templates/commands/efcore/db-status.md +24 -6
  12. package/templates/commands/efcore/migration.md +57 -9
  13. package/templates/commands/efcore/rebase-snapshot.md +56 -3
  14. package/templates/commands/efcore/squash.md +72 -17
  15. package/templates/hooks/mcp-check.md +64 -0
  16. package/templates/skills/application/SKILL.md +50 -4
  17. package/templates/skills/application/steps/step-00-init.md +153 -0
  18. package/templates/skills/application/steps/step-01-navigation.md +144 -0
  19. package/templates/skills/application/steps/step-02-permissions.md +159 -0
  20. package/templates/skills/application/steps/step-03-roles.md +158 -0
  21. package/templates/skills/application/steps/step-04-backend.md +202 -0
  22. package/templates/skills/application/steps/step-05-frontend.md +218 -0
  23. package/templates/skills/application/steps/step-06-migration.md +190 -0
  24. package/templates/skills/gitflow/steps/step-commit.md +25 -20
  25. package/templates/skills/gitflow/steps/step-start.md +9 -0
  26. package/templates/skills/mcp/SKILL.md +246 -0
  27. package/templates/skills/review-code/SKILL.md +77 -0
  28. package/templates/skills/review-code/references/smartstack-conventions.md +302 -0
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: step-05-frontend
3
+ description: Generate frontend code using MCP tools (component, API client, routes, i18n)
4
+ prev_step: steps/step-04-backend.md
5
+ next_step: steps/step-06-migration.md
6
+ ---
7
+
8
+ # Step 5: Frontend Generation
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use MCP tools for frontend generation
13
+ - ALWAYS generate i18n for 4 languages (fr, en, it, de)
14
+ - ALWAYS use nested routes (not flat)
15
+ - YOU ARE AN ORCHESTRATOR calling MCP, not a generator
16
+
17
+ ## YOUR TASK
18
+
19
+ Use MCP tools to generate:
20
+ 1. React component (scaffold_extension type: component)
21
+ 2. TypeScript API client (scaffold_api_client)
22
+ 3. Route configuration (scaffold_routes)
23
+ 4. i18n files (scaffold_translations for UI)
24
+
25
+ ---
26
+
27
+ ## AVAILABLE STATE
28
+
29
+ From previous steps:
30
+
31
+ | Variable | Description |
32
+ |----------|-------------|
33
+ | `{full_path}` | Complete navigation path (navRoute) |
34
+ | `{entity_name}` | PascalCase entity name |
35
+ | `{entity_code}` | kebab-case code |
36
+ | `{labels}` | Object with fr, en, it, de |
37
+ | `{api_route}` | API endpoint path |
38
+
39
+ ---
40
+
41
+ ## EXECUTION SEQUENCE
42
+
43
+ ### 1. Generate React Component
44
+
45
+ ```
46
+ Tool: mcp__smartstack__scaffold_extension
47
+ Args:
48
+ type: "component"
49
+ name: "{entity_name}"
50
+ options:
51
+ outputPath: "web/src/pages/{context}/{application}/{module}"
52
+ dryRun: false
53
+ ```
54
+
55
+ This generates:
56
+ - `{EntityName}Page.tsx` - Main page component
57
+ - `{EntityName}ListView.tsx` - Reusable list view
58
+ - `use{EntityName}.ts` - Custom hook for data
59
+
60
+ ### 2. Generate API Client
61
+
62
+ ```
63
+ Tool: mcp__smartstack__scaffold_api_client
64
+ Args:
65
+ navRoute: "{full_path}"
66
+ name: "{entity_name}"
67
+ methods: ["getAll", "getById", "create", "update", "delete"]
68
+ options:
69
+ includeTypes: true
70
+ includeHook: true
71
+ ```
72
+
73
+ This generates:
74
+ - `services/api/{entityCode}Api.ts` - API service
75
+ - `types/{entityName}.types.ts` - TypeScript interfaces
76
+ - `hooks/use{EntityName}Api.ts` - React Query hook (optional)
77
+
78
+ ### 3. Update Route Configuration
79
+
80
+ ```
81
+ Tool: mcp__smartstack__scaffold_routes
82
+ Args:
83
+ source: "controllers"
84
+ scope: "all"
85
+ options:
86
+ includeGuards: true
87
+ generateRegistry: true
88
+ ```
89
+
90
+ This updates:
91
+ - `navRoutes.generated.ts` - Route registry
92
+ - `routes.tsx` - React Router configuration
93
+
94
+ ### 4. Generate i18n Files
95
+
96
+ Create translation files for each language:
97
+
98
+ ```markdown
99
+ ### French (fr/{entityCode}.json)
100
+ ```json
101
+ {
102
+ "title": "{labels.fr}",
103
+ "subtitle": "Gestion de {labels.fr}",
104
+ "columns": {
105
+ "code": "Code",
106
+ "name": "Nom",
107
+ "createdAt": "Créé le",
108
+ "actions": "Actions"
109
+ },
110
+ "form": {
111
+ "code": "Code",
112
+ "name": "Nom",
113
+ "submit": "Enregistrer",
114
+ "cancel": "Annuler"
115
+ },
116
+ "messages": {
117
+ "created": "{labels.fr} créé avec succès",
118
+ "updated": "{labels.fr} mis à jour avec succès",
119
+ "deleted": "{labels.fr} supprimé avec succès",
120
+ "error": "Une erreur est survenue"
121
+ }
122
+ }
123
+ ```
124
+
125
+ Repeat for en, it, de with appropriate translations.
126
+
127
+ ### 5. Present Output to User
128
+
129
+ ```markdown
130
+ ## Frontend Code Generated
131
+
132
+ ### Components
133
+ - `pages/{context}/{application}/{module}/{EntityName}Page.tsx`
134
+ - `pages/{context}/{application}/{module}/{EntityName}ListView.tsx`
135
+ - `hooks/use{EntityName}.ts`
136
+
137
+ ### API Client
138
+ - `services/api/{entityCode}Api.ts`
139
+ - `types/{entityName}.types.ts`
140
+
141
+ ### Routes
142
+ - Updated `navRoutes.generated.ts`
143
+ - Updated `routes.tsx` with nested route
144
+
145
+ ### i18n
146
+ - `locales/fr/{entityCode}.json`
147
+ - `locales/en/{entityCode}.json`
148
+ - `locales/it/{entityCode}.json`
149
+ - `locales/de/{entityCode}.json`
150
+
151
+ ### Route Configuration
152
+ ```tsx
153
+ // In routes.tsx - NESTED routes (not flat!)
154
+ <Route path="{application}">
155
+ <Route index element={<Navigate to="{module}" replace />} />
156
+ <Route path="{module}" element={<{EntityName}Page />} />
157
+ </Route>
158
+ ```
159
+ ```
160
+
161
+ ---
162
+
163
+ ## ROUTING RULES
164
+
165
+ **CRITICAL:** SmartStack requires NESTED routes:
166
+
167
+ ```tsx
168
+ // ✅ CORRECT - Nested routes
169
+ <Route path="sales">
170
+ <Route index element={<Navigate to="products" replace />} />
171
+ <Route path="products" element={<ProductsPage />} />
172
+ <Route path="orders" element={<OrdersPage />} />
173
+ </Route>
174
+
175
+ // ❌ FORBIDDEN - Flat routes (cause redirect issues)
176
+ <Route path="sales" element={<Navigate to="products" />} />
177
+ <Route path="sales/products" element={<ProductsPage />} />
178
+ ```
179
+
180
+ ---
181
+
182
+ ## I18N STRUCTURE
183
+
184
+ All i18n files must follow this structure:
185
+
186
+ ```
187
+ locales/
188
+ ├── fr/
189
+ │ └── {entityCode}.json
190
+ ├── en/
191
+ │ └── {entityCode}.json
192
+ ├── it/
193
+ │ └── {entityCode}.json
194
+ └── de/
195
+ └── {entityCode}.json
196
+ ```
197
+
198
+ ---
199
+
200
+ ## SUCCESS METRICS
201
+
202
+ - React component generated
203
+ - API client generated with types
204
+ - Routes updated (nested structure)
205
+ - i18n files created (4 languages)
206
+ - Proceeded to step-06-migration.md
207
+
208
+ ## FAILURE MODES
209
+
210
+ - Component generation failed (check entity name)
211
+ - API client generation failed (check navRoute)
212
+ - Route configuration failed (check existing routes)
213
+
214
+ ---
215
+
216
+ ## NEXT STEP
217
+
218
+ After displaying frontend code, proceed to `./step-06-migration.md`
@@ -0,0 +1,190 @@
1
+ ---
2
+ name: step-06-migration
3
+ description: Create EF Core migration and finalize application setup
4
+ prev_step: steps/step-05-frontend.md
5
+ next_step: null
6
+ ---
7
+
8
+ # Step 6: Migration & Finalization
9
+
10
+ ## MANDATORY EXECUTION RULES
11
+
12
+ - ALWAYS use MCP `suggest_migration` to get proper migration name
13
+ - ALWAYS use `/efcore:migration` skill for migration creation
14
+ - NEVER use raw SQL in migrations
15
+ - YOU ARE AN ORCHESTRATOR, finalizing the application setup
16
+
17
+ ## YOUR TASK
18
+
19
+ 1. Get suggested migration name from MCP
20
+ 2. Create the EF Core migration
21
+ 3. Provide final checklist to user
22
+
23
+ ---
24
+
25
+ ## AVAILABLE STATE
26
+
27
+ From previous steps:
28
+
29
+ | Variable | Description |
30
+ |----------|-------------|
31
+ | `{entity_name}` | PascalCase entity name |
32
+ | `{full_path}` | Complete navigation path |
33
+ | `{level}` | Navigation level |
34
+ | `{labels}` | Translated labels |
35
+
36
+ ---
37
+
38
+ ## EXECUTION SEQUENCE
39
+
40
+ ### 1. Get Migration Name Suggestion
41
+
42
+ ```
43
+ Tool: mcp__smartstack__suggest_migration
44
+ Args:
45
+ description: "Add {entity_name} with navigation and permissions"
46
+ context: "core"
47
+ ```
48
+
49
+ Response example:
50
+ ```
51
+ Migration name: core_v1.2.0_003_Add{EntityName}WithNavigationAndPermissions
52
+ Command: dotnet ef migrations add core_v1.2.0_003_Add{EntityName}WithNavigationAndPermissions --context CoreDbContext -o Persistence/Migrations
53
+ ```
54
+
55
+ ### 2. Create Migration
56
+
57
+ Use the /efcore:migration skill or direct command:
58
+
59
+ ```bash
60
+ cd Infrastructure
61
+ dotnet ef migrations add {suggested_migration_name} --context CoreDbContext -o Persistence/Migrations
62
+ ```
63
+
64
+ ### 3. Verify Migration Content
65
+
66
+ The migration should include:
67
+ - Navigation entity (Context/Application/Module/Section)
68
+ - Navigation translations (4 languages)
69
+ - Permissions (CRUD + wildcard)
70
+ - RolePermissions (role assignments)
71
+ - Domain entity table
72
+ - Indexes and constraints
73
+
74
+ ### 4. Apply Migration
75
+
76
+ ```bash
77
+ dotnet ef database update --context CoreDbContext
78
+ ```
79
+
80
+ ### 5. Present Final Checklist
81
+
82
+ ```markdown
83
+ ## Application Setup Complete
84
+
85
+ ### Summary
86
+
87
+ | Item | Status |
88
+ |------|--------|
89
+ | Navigation | ✅ {level}: {full_path} |
90
+ | Translations | ✅ 4 languages (fr, en, it, de) |
91
+ | Permissions | ✅ CRUD + Wildcard |
92
+ | Role Mappings | ✅ PlatformAdmin, TenantAdmin, StandardUser |
93
+ | Entity | ✅ {entity_name} |
94
+ | Service | ✅ I{entity_name}Service |
95
+ | Controller | ✅ {entity_name}Controller |
96
+ | DTOs | ✅ Create, Update, Response |
97
+ | Frontend | ✅ Page, ListView, Hook |
98
+ | API Client | ✅ TypeScript with types |
99
+ | i18n | ✅ 4 languages |
100
+ | Routes | ✅ Nested configuration |
101
+ | Migration | ✅ {migration_name} |
102
+
103
+ ### Final Steps
104
+
105
+ 1. **Verify DbSet registration:**
106
+ ```csharp
107
+ // In ICoreDbContext.cs
108
+ public DbSet<{entity_name}> {entity_name}s => Set<{entity_name}>();
109
+ ```
110
+
111
+ 2. **Verify DI registration:**
112
+ ```csharp
113
+ // In DependencyInjection.cs
114
+ services.AddScoped<I{entity_name}Service, {entity_name}Service>();
115
+ ```
116
+
117
+ 3. **Test the application:**
118
+ ```bash
119
+ # Backend
120
+ dotnet run --project Api
121
+
122
+ # Frontend
123
+ cd web && npm run dev
124
+ ```
125
+
126
+ 4. **Verify navigation:**
127
+ - Login to the application
128
+ - Navigate to {full_path}
129
+ - Verify CRUD operations work
130
+
131
+ ### API Endpoints
132
+
133
+ | Method | Endpoint | Permission |
134
+ |--------|----------|------------|
135
+ | GET | /api/{entity_code} | {full_path}.read |
136
+ | GET | /api/{entity_code}/{id} | {full_path}.read |
137
+ | POST | /api/{entity_code} | {full_path}.create |
138
+ | PUT | /api/{entity_code}/{id} | {full_path}.update |
139
+ | DELETE | /api/{entity_code}/{id} | {full_path}.delete |
140
+ ```
141
+
142
+ ---
143
+
144
+ ## TROUBLESHOOTING
145
+
146
+ ### Common Issues
147
+
148
+ | Issue | Solution |
149
+ |-------|----------|
150
+ | Migration conflicts | Run `/efcore:conflicts` to analyze |
151
+ | Permission 403 errors | Verify Permissions.cs and PermissionConfiguration.cs are in sync |
152
+ | Navigation not visible | Check user role has appropriate permissions |
153
+ | Route not found | Verify nested route structure in routes.tsx |
154
+ | i18n missing | Check locale files exist and are properly loaded |
155
+
156
+ ### Quick Fixes
157
+
158
+ ```bash
159
+ # Rebuild and restart
160
+ dotnet build
161
+ dotnet ef database update
162
+
163
+ # Clear frontend cache
164
+ cd web && rm -rf node_modules/.cache && npm run dev
165
+ ```
166
+
167
+ ---
168
+
169
+ ## SUCCESS METRICS
170
+
171
+ - Migration name suggested via MCP
172
+ - Migration created and applied
173
+ - All checklist items verified
174
+ - Application functional
175
+
176
+ ## COMPLETION
177
+
178
+ The /application skill workflow is complete. The user now has:
179
+ - Full navigation structure
180
+ - RBAC permissions
181
+ - Backend CRUD API
182
+ - Frontend components
183
+ - i18n support
184
+ - Database migration
185
+
186
+ ---
187
+
188
+ ## END OF WORKFLOW
189
+
190
+ This is the final step. No further steps to proceed.
@@ -188,27 +188,32 @@ EOF
188
188
  COMMIT_HASH=$(git rev-parse --short HEAD)
189
189
  ```
190
190
 
191
- ### 7. Auto-Push (based on config)
191
+ ### 7. Push to Remote (ALWAYS ASK USER)
192
+
193
+ **MANDATORY: Always ask user before pushing commits:**
194
+
195
+ ```yaml
196
+ AskUserQuestion:
197
+ header: "Push"
198
+ question: "Push commit to origin/$CURRENT?"
199
+ options:
200
+ - label: "Yes, push now"
201
+ description: "git push origin $CURRENT"
202
+ - label: "No, later"
203
+ description: "Keep commit local for now"
204
+ ```
192
205
 
206
+ **If user chooses "Yes":**
193
207
  ```bash
194
- PUSH_MODE=$(grep -oP '"afterCommit":\s*"\K[^"]+' .claude/gitflow/config.json 2>/dev/null || echo "ask")
195
-
196
- case "$PUSH_MODE" in
197
- always)
198
- git push origin $CURRENT
199
- PUSHED="yes"
200
- ;;
201
- worktree)
202
- # Push if in worktree
203
- [ -n "$(git worktree list | grep $(pwd))" ] && git push origin $CURRENT && PUSHED="yes"
204
- ;;
205
- ask)
206
- # Ask user
207
- ;;
208
- never)
209
- PUSHED="no"
210
- ;;
211
- esac
208
+ git push origin $CURRENT
209
+ PUSHED="yes"
210
+ echo "✅ Pushed to origin/$CURRENT"
211
+ ```
212
+
213
+ **If user chooses "No":**
214
+ ```bash
215
+ PUSHED="no"
216
+ echo "⏸️ Commit kept local. Push later with: git push origin $CURRENT"
212
217
  ```
213
218
 
214
219
  ### 8. Summary
@@ -248,7 +253,7 @@ esac
248
253
  - Migrations validated (if present)
249
254
  - Destructive operations confirmed
250
255
  - Commit created with proper message
251
- - Pushed (if configured)
256
+ - **Push: ALWAYS ask user (never automatic)**
252
257
 
253
258
  ## NEXT STEP:
254
259
 
@@ -152,6 +152,14 @@ git checkout "$BASE_BRANCH" && git pull origin "$BASE_BRANCH"
152
152
  git checkout -b "$FULL_BRANCH"
153
153
  ```
154
154
 
155
+ ### 6b. Push Branch to Remote (AUTOMATIC)
156
+
157
+ **ALWAYS push immediately after branch creation:**
158
+ ```bash
159
+ git push -u origin "$FULL_BRANCH"
160
+ echo "✅ Branch pushed to origin/$FULL_BRANCH"
161
+ ```
162
+
155
163
  ### 7. Create Local Environment Config (Backend + Frontend)
156
164
 
157
165
  **Detect project structure:**
@@ -323,6 +331,7 @@ EOF
323
331
  ## SUCCESS CRITERIA:
324
332
 
325
333
  - Branch created from correct base
334
+ - **Branch pushed to remote (AUTOMATIC)**
326
335
  - Worktree set up (if enabled)
327
336
  - Backend local config created: `appsettings.Local.json` (if .NET API detected)
328
337
  - Frontend local config created: `.env.local` + `npm run local` script (if web project detected)