@atlashub/smartstack-cli 4.12.0 → 4.14.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.
- package/dist/mcp-entry.mjs +2 -2
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +55 -0
- package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +55 -0
- package/templates/skills/application/steps/step-05-frontend.md +4 -2
package/package.json
CHANGED
|
@@ -24,6 +24,23 @@ const {EntityName}Page = lazy(() => import('@/pages/{Application}/{Module}/{Enti
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
+
## Step 4a.5: Import Generated Route Extensions (if scaffold_routes was used)
|
|
28
|
+
|
|
29
|
+
If `scaffold_routes` generated `applicationRoutes.generated.tsx`, import and spread:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { applicationRouteExtensions } from '@/routes/applicationRoutes.generated';
|
|
33
|
+
|
|
34
|
+
const applicationRoutes: ApplicationRouteExtensions = {
|
|
35
|
+
...applicationRouteExtensions,
|
|
36
|
+
// additional manual routes if needed...
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If no generated file exists, add routes directly to the existing `applicationRoutes` object.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
27
44
|
## Step 4b: Detect App.tsx Routing Pattern
|
|
28
45
|
|
|
29
46
|
Read App.tsx and detect which pattern is used:
|
|
@@ -81,6 +98,27 @@ Find `<Route path="/t/:slug">` and add the **same route entries** there.
|
|
|
81
98
|
|
|
82
99
|
---
|
|
83
100
|
|
|
101
|
+
## Step 4b.5: Verify mergeRoutes() Call (BLOCKING)
|
|
102
|
+
|
|
103
|
+
**BEFORE modifying routes, READ App.tsx and verify the `mergeRoutes()` call has 2 parameters.**
|
|
104
|
+
|
|
105
|
+
✅ Correct:
|
|
106
|
+
```tsx
|
|
107
|
+
const routes = mergeRoutes(clientRoutes, applicationRoutes);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
❌ If you see only 1 parameter:
|
|
111
|
+
```tsx
|
|
112
|
+
const routes = mergeRoutes(clientRoutes);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
→ Add the `applicationRoutes` object and pass it as 2nd parameter.
|
|
116
|
+
Without it, ALL application routes are silently ignored → blank page or /login redirect.
|
|
117
|
+
|
|
118
|
+
**NEVER remove the `applicationRoutes` parameter or the `ApplicationRouteExtensions` import.**
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
84
122
|
## Step 4c: Application-to-Layout Mapping
|
|
85
123
|
|
|
86
124
|
| Application prefix | Layout Component | Route path |
|
|
@@ -136,6 +174,23 @@ The `to` prop is resolved relative to the **parent route** (`/{application}`), s
|
|
|
136
174
|
- Adding application routes to `clientRoutes[]` with absolute paths — `clientRoutes` is ONLY for routes outside SmartStack applications (e.g., `/about`, `/pricing`)
|
|
137
175
|
- Adding routes OUTSIDE the Layout wrapper (shell will not render)
|
|
138
176
|
- Using `createBrowserRouter` (SmartStack uses `useRoutes()` + `mergeRoutes()`)
|
|
177
|
+
- Adding custom application routes to `clientRoutes[]` with absolute paths:
|
|
178
|
+
```tsx
|
|
179
|
+
// ❌ WRONG — bypasses RouteGuard + TenantLayout + AppLayout → /login redirect
|
|
180
|
+
const clientRoutes: RouteConfig[] = [
|
|
181
|
+
{ path: '/human-resources/employees/management', element: <EmployeePage /> },
|
|
182
|
+
];
|
|
183
|
+
```
|
|
184
|
+
Custom application routes MUST go in `applicationRoutes` with RELATIVE paths:
|
|
185
|
+
```tsx
|
|
186
|
+
// ✅ CORRECT
|
|
187
|
+
const applicationRoutes: ApplicationRouteExtensions = {
|
|
188
|
+
'human-resources': [
|
|
189
|
+
{ path: 'employees/management', element: <EmployeePage /> },
|
|
190
|
+
],
|
|
191
|
+
};
|
|
192
|
+
```
|
|
193
|
+
- Removing the `applicationRoutes` 2nd parameter from `mergeRoutes()` — this silently breaks ALL custom routes
|
|
139
194
|
|
|
140
195
|
---
|
|
141
196
|
|
|
@@ -24,6 +24,23 @@ const {EntityName}Page = lazy(() => import('@/pages/{Application}/{Module}/{Enti
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
+
## Step 4a.5: Import Generated Route Extensions (if scaffold_routes was used)
|
|
28
|
+
|
|
29
|
+
If `scaffold_routes` generated `applicationRoutes.generated.tsx`, import and spread:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { applicationRouteExtensions } from '@/routes/applicationRoutes.generated';
|
|
33
|
+
|
|
34
|
+
const applicationRoutes: ApplicationRouteExtensions = {
|
|
35
|
+
...applicationRouteExtensions,
|
|
36
|
+
// additional manual routes if needed...
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If no generated file exists, add routes directly to the existing `applicationRoutes` object.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
27
44
|
## Step 4b: Detect App.tsx Routing Pattern
|
|
28
45
|
|
|
29
46
|
Read App.tsx and detect which pattern is used:
|
|
@@ -77,6 +94,27 @@ Find `<Route path="/t/:slug">` and add the **same route entries** there.
|
|
|
77
94
|
|
|
78
95
|
---
|
|
79
96
|
|
|
97
|
+
## Step 4b.5: Verify mergeRoutes() Call (BLOCKING)
|
|
98
|
+
|
|
99
|
+
**BEFORE modifying routes, READ App.tsx and verify the `mergeRoutes()` call has 2 parameters.**
|
|
100
|
+
|
|
101
|
+
✅ Correct:
|
|
102
|
+
```tsx
|
|
103
|
+
const routes = mergeRoutes(clientRoutes, applicationRoutes);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
❌ If you see only 1 parameter:
|
|
107
|
+
```tsx
|
|
108
|
+
const routes = mergeRoutes(clientRoutes);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
→ Add the `applicationRoutes` object and pass it as 2nd parameter.
|
|
112
|
+
Without it, ALL application routes are silently ignored → blank page or /login redirect.
|
|
113
|
+
|
|
114
|
+
**NEVER remove the `applicationRoutes` parameter or the `ApplicationRouteExtensions` import.**
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
80
118
|
## Step 4c: Application-to-Layout Mapping
|
|
81
119
|
|
|
82
120
|
| Application prefix | Layout Component | Route path |
|
|
@@ -104,6 +142,23 @@ If `appWiring.issues` is not empty, fix the wiring before proceeding.
|
|
|
104
142
|
- Adding application routes to `clientRoutes[]` with absolute paths — `clientRoutes` is ONLY for routes outside SmartStack applications (e.g., `/about`, `/pricing`)
|
|
105
143
|
- Adding routes OUTSIDE the Layout wrapper (shell will not render)
|
|
106
144
|
- Using `createBrowserRouter` (SmartStack uses `useRoutes()` + `mergeRoutes()`)
|
|
145
|
+
- Adding custom application routes to `clientRoutes[]` with absolute paths:
|
|
146
|
+
```tsx
|
|
147
|
+
// ❌ WRONG — bypasses RouteGuard + TenantLayout + AppLayout → /login redirect
|
|
148
|
+
const clientRoutes: RouteConfig[] = [
|
|
149
|
+
{ path: '/human-resources/employees/management', element: <EmployeePage /> },
|
|
150
|
+
];
|
|
151
|
+
```
|
|
152
|
+
Custom application routes MUST go in `applicationRoutes` with RELATIVE paths:
|
|
153
|
+
```tsx
|
|
154
|
+
// ✅ CORRECT
|
|
155
|
+
const applicationRoutes: ApplicationRouteExtensions = {
|
|
156
|
+
'human-resources': [
|
|
157
|
+
{ path: 'employees/management', element: <EmployeePage /> },
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
```
|
|
161
|
+
- Removing the `applicationRoutes` 2nd parameter from `mergeRoutes()` — this silently breaks ALL custom routes
|
|
107
162
|
|
|
108
163
|
---
|
|
109
164
|
|
|
@@ -113,11 +113,13 @@ This generates:
|
|
|
113
113
|
### 4. Wire Routes to App.tsx (BLOCKING)
|
|
114
114
|
|
|
115
115
|
See [references/frontend-route-wiring-app-tsx.md](../references/frontend-route-wiring-app-tsx.md) for:
|
|
116
|
-
- Step 4a: Import page components
|
|
116
|
+
- Step 4a: Import page components (lazy)
|
|
117
|
+
- Step 4a.5: Import generated route extensions (if scaffold_routes was used)
|
|
117
118
|
- Step 4b: Detect App.tsx routing pattern (Pattern A vs Pattern B)
|
|
119
|
+
- Step 4b.5: Verify mergeRoutes() has 2 parameters (BLOCKING)
|
|
118
120
|
- Step 4c: Application-to-Layout mapping table
|
|
119
121
|
- Step 4d: Route wiring verification
|
|
120
|
-
- Forbidden patterns (absolute paths, outside Layout,
|
|
122
|
+
- Forbidden patterns (absolute paths in clientRoutes, outside Layout, missing 2nd param)
|
|
121
123
|
|
|
122
124
|
### 5-6. Verify i18n & Present Output
|
|
123
125
|
|