@atlashub/smartstack-cli 3.20.0 → 3.22.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 (41) hide show
  1. package/dist/index.js +70 -6
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +69 -3
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/project/api.ts.template +8 -29
  7. package/templates/project/appsettings.json.template +1 -0
  8. package/templates/skills/application/references/application-roles-template.md +2 -2
  9. package/templates/skills/application/steps/step-05-frontend.md +40 -35
  10. package/templates/skills/application/templates-frontend.md +64 -36
  11. package/templates/skills/business-analyse/html/ba-interactive.html +642 -156
  12. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +11 -6
  13. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +209 -4
  14. package/templates/skills/business-analyse/html/src/scripts/04-render-modules.js +2 -8
  15. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +95 -8
  16. package/templates/skills/business-analyse/html/src/scripts/07-render-handoff.js +3 -1
  17. package/templates/skills/business-analyse/html/src/scripts/08-editing.js +112 -22
  18. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +7 -0
  19. package/templates/skills/business-analyse/html/src/styles/02-layout.css +1 -1
  20. package/templates/skills/business-analyse/html/src/styles/03-navigation.css +89 -31
  21. package/templates/skills/business-analyse/html/src/styles/05-modules.css +64 -0
  22. package/templates/skills/business-analyse/html/src/styles/06-wireframes.css +42 -0
  23. package/templates/skills/business-analyse/html/src/template.html +8 -76
  24. package/templates/skills/business-analyse/references/acceptance-criteria.md +169 -0
  25. package/templates/skills/business-analyse/references/deploy-data-build.md +13 -9
  26. package/templates/skills/business-analyse/references/handoff-file-templates.md +2 -1
  27. package/templates/skills/business-analyse/references/html-data-mapping.md +20 -28
  28. package/templates/skills/business-analyse/references/naming-conventions.md +245 -0
  29. package/templates/skills/business-analyse/references/validate-incremental-html.md +28 -5
  30. package/templates/skills/business-analyse/references/validation-checklist.md +31 -11
  31. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +335 -0
  32. package/templates/skills/business-analyse/steps/step-03b-ui.md +59 -0
  33. package/templates/skills/business-analyse/steps/step-03c-compile.md +169 -2
  34. package/templates/skills/business-analyse/steps/step-03d-validate.md +217 -28
  35. package/templates/skills/business-analyse/steps/step-05a-handoff.md +189 -3
  36. package/templates/skills/business-analyse/steps/step-05b-deploy.md +55 -0
  37. package/templates/skills/ralph-loop/references/category-rules.md +5 -2
  38. package/templates/skills/ralph-loop/references/compact-loop.md +52 -1
  39. package/templates/skills/ralph-loop/references/core-seed-data.md +232 -21
  40. package/templates/skills/ralph-loop/steps/step-01-task.md +36 -4
  41. package/templates/skills/ralph-loop/steps/step-02-execute.md +81 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "3.20.0",
3
+ "version": "3.22.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -1,31 +1,10 @@
1
- import axios from 'axios';
1
+ // Re-export SmartStack's shared API client
2
+ // IMPORTANT: Do NOT create a custom axios instance — use the SmartStack-provided client
3
+ // which handles authentication, token refresh, and session management automatically.
4
+ import { apiClient } from '@atlashub/smartstack';
2
5
 
3
- const api = axios.create({
4
- baseURL: '/api',
5
- headers: {
6
- 'Content-Type': 'application/json',
7
- },
8
- });
6
+ export default apiClient;
9
7
 
10
- // Request interceptor for auth token
11
- api.interceptors.request.use((config) => {
12
- const token = localStorage.getItem('token');
13
- if (token) {
14
- config.headers.Authorization = `Bearer ${token}`;
15
- }
16
- return config;
17
- });
18
-
19
- // Response interceptor for error handling
20
- api.interceptors.response.use(
21
- (response) => response,
22
- (error) => {
23
- if (error.response?.status === 401) {
24
- localStorage.removeItem('token');
25
- window.location.href = '/login';
26
- }
27
- return Promise.reject(error);
28
- }
29
- );
30
-
31
- export default api;
8
+ // For module-specific API calls, extend from the shared client:
9
+ // import apiClient from './api';
10
+ // export const getEmployees = () => apiClient.get('/api/business/humanresources/employees');
@@ -10,6 +10,7 @@
10
10
  "UseEntraId": false,
11
11
  "EnableSwagger": true,
12
12
  "CorsOrigins": [
13
+ "http://localhost:3000",
13
14
  "http://localhost:5173",
14
15
  "http://localhost:5174",
15
16
  "http://localhost:5175"
@@ -50,7 +50,7 @@ public static class ApplicationRolesSeedData
50
50
  {
51
51
  // Deterministic GUIDs for application roles
52
52
  // Generated from: "role-{applicationId}-{roleType}"
53
- private static readonly Guid ApplicationId = {ApplicationGuid}; // From NavigationApplicationSeedData
53
+ public static readonly Guid ApplicationId = NavigationApplicationSeedData.ApplicationId;
54
54
 
55
55
  public static readonly Guid AdminRoleId = GenerateRoleGuid("admin");
56
56
  public static readonly Guid ManagerRoleId = GenerateRoleGuid("manager");
@@ -141,7 +141,7 @@ public class ApplicationRoleSeedEntry
141
141
  |-------------|-------------|---------|
142
142
  | `{BaseNamespace}` | Root namespace of the client project | `SmartStack.Modules.RessourcesHumaines` |
143
143
  | `{AppLabel}` | Human-readable application label (EN) | `Human Resources` |
144
- | `{ApplicationGuid}` | GUID of the application (from NavigationApplicationSeedData) | `30f1fbba-e8c3-4879-9a49-d18deaa70a83` |
144
+ | `ApplicationId` | Deterministic GUID from `NavigationApplicationSeedData.ApplicationId` NO placeholder needed | Auto-resolved |
145
145
 
146
146
  ---
147
147
 
@@ -102,7 +102,7 @@ This generates:
102
102
 
103
103
  > **CRITICAL:** This step is MANDATORY. Without it, routes exist as files but are invisible to the React Router. The page will be BLANK.
104
104
 
105
- After `scaffold_routes` generates the route files, you MUST manually insert the routes into `App.tsx`:
105
+ After `scaffold_routes` generates the route files, you MUST manually insert the routes into `App.tsx`.
106
106
 
107
107
  **Step 4a:** Import the page components at the top of App.tsx:
108
108
 
@@ -112,33 +112,49 @@ import { {EntityName}Page } from '@/pages/{Context}/{Application}/{Module}/{Enti
112
112
  const {EntityName}Page = lazy(() => import('@/pages/{Context}/{Application}/{Module}/{EntityName}Page'));
113
113
  ```
114
114
 
115
- **Step 4b:** Find the correct Layout wrapper block in App.tsx:
115
+ **Step 4b:** Detect the App.tsx routing pattern:
116
116
 
117
- | Context | Layout block to find |
118
- |---------|---------------------|
119
- | `platform.*` | `<Route path="/platform" element={<AdminLayout />}>` |
120
- | `business.*` | `<Route path="/business" element={<BusinessLayout />}>` |
121
- | `personal.*` | `<Route path="/personal/myspace" element={<UserLayout />}>` |
117
+ Read App.tsx and detect which pattern is used:
122
118
 
123
- **Step 4c:** Insert route entries INSIDE the Layout block (as children, using relative paths):
119
+ **Pattern A** If App.tsx contains `contextRoutes: ContextRouteExtensions`:
120
+ → Add routes to `contextRoutes.{context}[]` with **RELATIVE** paths (no leading `/`)
124
121
 
125
- ```tsx
126
- // CORRECT - Route added INSIDE the layout wrapper
127
- <Route path="/business" element={<BusinessLayout />}>
128
- {/* ... existing routes ... */}
129
- <Route path="{application}/{module}" element={<{EntityName}Page />} />
130
- </Route>
122
+ ```tsx
123
+ const contextRoutes: ContextRouteExtensions = {
124
+ business: [
125
+ // existing routes...
126
+ { path: '{application}/{module}/list', element: <{EntityName}ListPage /> },
127
+ { path: '{application}/{module}/new', element: <Create{EntityName}Page /> },
128
+ { path: '{application}/{module}/:id', element: <{EntityName}DetailPage /> },
129
+ { path: '{application}/{module}/:id/edit', element: <Create{EntityName}Page /> },
130
+ ],
131
+ };
132
+ ```
131
133
 
132
- // FORBIDDEN - Route added OUTSIDE layout (shell will NOT render!)
133
- <Route path="/business/{application}/{module}" element={<{EntityName}Page />} />
134
- ```
134
+ Routes are automatically injected into BOTH standard (`/business/...`) and tenant-prefixed (`/t/:slug/business/...`) route trees by `mergeRoutes()`. No manual duplication needed.
135
+
136
+ **Pattern B** — If App.tsx contains `<Route path="/{context}" element={<{Layout} />}>` (JSX Routes):
137
+ → Insert `<Route>` children inside the Layout wrapper (see below)
135
138
 
136
- **Step 4d:** ALSO add the same routes inside the tenant-prefixed block:
139
+ ```tsx
140
+ <Route path="/business" element={<BusinessLayout />}>
141
+ {/* ... existing routes ... */}
142
+ <Route path="{application}/{module}" element={<{EntityName}Page />} />
143
+ </Route>
144
+ ```
137
145
 
138
- Find `<Route path="/t/:slug">` and locate the matching `<Route path="{context}" element={<{Layout} />}>` inside it.
139
- Add the **same route entries** there.
146
+ ALSO add the same routes inside the tenant-prefixed block:
147
+ Find `<Route path="/t/:slug">` and add the **same route entries** there.
140
148
 
141
- **Step 4e:** Verify wiring:
149
+ **Step 4c:** Context-to-Layout mapping:
150
+
151
+ | Context | Layout Component | Route path |
152
+ |---------|------------------|------------|
153
+ | `platform.*` | `AdminLayout` | `/platform` |
154
+ | `business.*` | `BusinessLayout` | `/business` |
155
+ | `personal.*` | `UserLayout` | `/personal/myspace` |
156
+
157
+ **Step 4d:** Verify wiring:
142
158
 
143
159
  ```
144
160
  Tool: mcp__smartstack__validate_frontend_routes
@@ -148,21 +164,10 @@ Args:
148
164
 
149
165
  If `appWiring.issues` is not empty, fix the wiring before proceeding.
150
166
 
151
- **For new applications (no existing layout route for the context):**
152
-
153
- If the context doesn't have a layout route yet, create one wrapping all child routes:
154
-
155
- ```tsx
156
- <Route path="/{context}/{application}" element={<{Context}Layout />}>
157
- <Route index element={<Navigate to="{default_module}" replace />} />
158
- <Route path="{module}" element={<{EntityName}Page />} />
159
- </Route>
160
- ```
161
-
162
- **FORBIDDEN:**
167
+ **FORBIDDEN (both patterns):**
168
+ - Adding business/platform/personal routes to `clientRoutes[]` with absolute paths — `clientRoutes` is ONLY for routes outside SmartStack contexts (e.g., `/about`, `/pricing`)
163
169
  - Adding routes OUTSIDE the Layout wrapper (shell will not render)
164
- - Adding routes only in the standard block but not in the tenant block
165
- - Using `createBrowserRouter` (SmartStack uses `BrowserRouter` with JSX `<Routes>`)
170
+ - Using `createBrowserRouter` (SmartStack uses `useRoutes()` + `mergeRoutes()`)
166
171
 
167
172
  ### 5. Verify i18n Files
168
173
 
@@ -488,7 +488,51 @@ export const $moduleApi = {
488
488
 
489
489
  ## TEMPLATE: ROUTES (App.tsx)
490
490
 
491
- ### ⚠️ CRITICAL RULE 1: ROUTES MUST BE INSIDE LAYOUT WRAPPER
491
+ ### Detect App.tsx Routing Pattern FIRST
492
+
493
+ Before adding routes, **read App.tsx** and detect which pattern is used:
494
+
495
+ | Pattern | How to detect | Action |
496
+ |---------|---------------|--------|
497
+ | **Pattern A** (mergeRoutes) | `contextRoutes: ContextRouteExtensions` present | Add to `contextRoutes.{context}[]` array |
498
+ | **Pattern B** (JSX Routes) | `<Route path="/{context}" element={<{Layout} />}>` present | Insert `<Route>` children inside Layout wrapper |
499
+
500
+ ### Pattern A: mergeRoutes (contextRoutes array)
501
+
502
+ > **This is the DEFAULT pattern** generated by `smartstack init`.
503
+ > Routes added to `contextRoutes` are automatically injected into BOTH standard and tenant-prefixed route trees by `mergeRoutes()`. No manual duplication needed.
504
+
505
+ ```tsx
506
+ // Add to App.tsx — imports at top
507
+ import { $MODULE_PASCALPage } from '@/pages/$CONTEXT/$APPLICATION/$MODULE/$MODULE_PASCALPage';
508
+ import { $MODULE_PASCALDetailPage } from '@/pages/$CONTEXT/$APPLICATION/$MODULE/$MODULE_PASCALDetailPage';
509
+ import { Create$MODULE_PASCALPage } from '@/pages/$CONTEXT/$APPLICATION/$MODULE/Create$MODULE_PASCALPage';
510
+
511
+ // Add routes to contextRoutes.{context}[] with RELATIVE paths (no leading /)
512
+ const contextRoutes: ContextRouteExtensions = {
513
+ $CONTEXT: [
514
+ // ... existing routes ...
515
+ { path: '$APPLICATION/$MODULE', element: <$MODULE_PASCALPage /> },
516
+ { path: '$APPLICATION/$MODULE/new', element: <Create$MODULE_PASCALPage /> },
517
+ { path: '$APPLICATION/$MODULE/:id', element: <$MODULE_PASCALDetailPage /> },
518
+ { path: '$APPLICATION/$MODULE/:id/edit', element: <Create$MODULE_PASCALPage /> },
519
+ ],
520
+ };
521
+ ```
522
+
523
+ **mergeRoutes auto-generates redirects** for intermediate paths (e.g., `$APPLICATION` → `$APPLICATION/$DEFAULT_MODULE`) so you don't need to add index redirects manually.
524
+
525
+ **Context-to-Layout mapping (automatic via mergeRoutes):**
526
+
527
+ | Context key | Injected into Layout | Standard path | Tenant path |
528
+ |-------------|---------------------|---------------|-------------|
529
+ | `platform` | `AdminLayout` | `/platform/...` | `/t/:slug/platform/...` |
530
+ | `business` | `BusinessLayout` | `/business/...` | `/t/:slug/business/...` |
531
+ | `personal` | `UserLayout` | `/personal/myspace/...` | `/t/:slug/personal/myspace/...` |
532
+
533
+ ### Pattern B: JSX Routes (inside Layout wrapper)
534
+
535
+ > **Legacy pattern** — only used if App.tsx was manually restructured with JSX `<Route>` elements.
492
536
 
493
537
  SmartStack layouts (`AdminLayout`, `BusinessLayout`, `UserLayout`) provide the application shell: **header with AvatarMenu**, sidebar, navigation. They render child pages via React Router's `<Outlet />`.
494
538
 
@@ -504,13 +548,6 @@ SmartStack layouts (`AdminLayout`, `BusinessLayout`, `UserLayout`) provide the a
504
548
  3. Add the new routes **INSIDE** that `<Route>` block
505
549
  4. If a tenant-prefixed block exists (`/t/:slug/...`), add the routes there too
506
550
 
507
- **❌ FORBIDDEN - Flat routes OUTSIDE layout (AvatarMenu disappears!)**
508
- ```tsx
509
- // These routes bypass the layout system entirely = NO header, NO sidebar, NO AvatarMenu
510
- <Route path="/$CONTEXT/$APPLICATION/$MODULE" element={<$MODULE_PASCALPage />} />
511
- ```
512
-
513
- **✅ MANDATORY - Routes INSIDE the existing layout wrapper**
514
551
  ```tsx
515
552
  // Add to App.tsx
516
553
 
@@ -533,42 +570,33 @@ import { Create$MODULE_PASCALPage } from '@/pages/$CONTEXT/$APPLICATION/$MODULE/
533
570
  </Route>
534
571
  ```
535
572
 
536
- ### Context-to-Layout mapping
573
+ ### ⚠️ CRITICAL RULES (both patterns)
537
574
 
538
- | Context | Layout Component | Layout Route Path |
539
- |---------|------------------|-------------------|
540
- | `platform` | `AdminLayout` | `/platform` |
541
- | `business` | `BusinessLayout` | `/business` |
542
- | `personal` | `UserLayout` | `/personal/myspace` |
543
-
544
- ### ⚠️ CRITICAL RULE 2: NESTED ROUTES MANDATORY
545
-
546
- React Router v7 **requires** nested routes for multi-module applications.
547
-
548
- **❌ FORBIDDEN - Flat routes (cause redirects to Home)**
575
+ **FORBIDDEN Adding to clientRoutes[] with absolute paths:**
549
576
  ```tsx
550
- <Route path="$APPLICATION" element={<Navigate to="/$CONTEXT/$APPLICATION/$DEFAULT_MODULE" replace />} />
551
- <Route path="$APPLICATION/$MODULE" element={<$MODULE_PASCALPage />} />
577
+ // WRONG bypasses layout entirely, shell will NOT render
578
+ const clientRoutes: RouteConfig[] = [
579
+ { path: '/business/$APPLICATION/$MODULE', element: <$MODULE_PASCALPage /> },
580
+ ];
552
581
  ```
553
582
 
554
- **✅ MANDATORY - Nested routes with index**
583
+ `clientRoutes` is ONLY for routes **outside** SmartStack locked contexts (e.g., `/about`, `/pricing`).
584
+
585
+ **FORBIDDEN — Flat routes outside layout:**
555
586
  ```tsx
556
- <Route path="$APPLICATION">
557
- <Route index element={<Navigate to="$DEFAULT_MODULE" replace />} />
558
- <Route path="$MODULE" element={<$MODULE_PASCALPage />} />
559
- </Route>
587
+ // ❌ WRONG (Pattern B only) — flat route bypasses layout
588
+ <Route path="/$CONTEXT/$APPLICATION/$MODULE" element={<$MODULE_PASCALPage />} />
560
589
  ```
561
590
 
562
- ### Why this structure?
591
+ ### Why nested/context routes?
563
592
 
564
- | Aspect | Flat routes | Nested routes |
565
- |--------|------------|----------------|
566
- | Shell rendered | No (bypasses layout) | Yes (Outlet pattern) |
567
- | AvatarMenu visible | No | Yes |
568
- | Matching | Ambiguous between siblings | Hierarchical clear |
569
- | Navigate | Must be absolute | Can be relative |
570
- | Outlet | Not supported | Supported |
571
- | Redirect | Can fail | Always works |
593
+ | Aspect | clientRoutes (wrong) | contextRoutes / nested (correct) |
594
+ |--------|---------------------|----------------------------------|
595
+ | Shell rendered | No (bypasses layout) | Yes (Outlet pattern) |
596
+ | AvatarMenu visible | No | Yes |
597
+ | Tenant prefix | Manual duplication | Automatic (mergeRoutes) |
598
+ | Auto-redirects | None | Generated for intermediate paths |
599
+ | Permission check | Bypassed (no RouteGuard) | Enforced by RouteGuard |
572
600
 
573
601
  ---
574
602