@atlashub/smartstack-cli 4.75.0 → 4.79.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/index.js +87 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/project/claude-md/root.CLAUDE.md.template +1 -1
- package/templates/skills/ai-prompt/SKILL.md +64 -0
- package/templates/skills/ai-prompt/references/ai-agent-modes.md +89 -0
- package/templates/skills/ai-prompt/references/eval-framework.md +129 -0
- package/templates/skills/apex/SKILL.md +2 -2
- package/templates/skills/apex/references/checks/frontend-checks.sh +123 -11
- package/templates/skills/apex/references/checks/seed-checks.sh +81 -7
- package/templates/skills/apex/references/core-seed-data.md +27 -22
- package/templates/skills/apex/references/domain-events-pattern.md +45 -0
- package/templates/skills/apex/references/entity-hooks-pattern.md +68 -0
- package/templates/skills/apex/references/licensing-enforcement.md +52 -0
- package/templates/skills/apex/references/post-checks.md +18 -1
- package/templates/skills/apex/references/smartstack-api.md +116 -5
- package/templates/skills/apex/references/smartstack-frontend.md +1 -1
- package/templates/skills/apex/references/smartstack-layers.md +6 -6
- package/templates/skills/apex/steps/step-00-init.md +1 -1
- package/templates/skills/apex/steps/step-03b-layer1-seed.md +26 -0
- package/templates/skills/apex/steps/step-03d-layer3-frontend.md +124 -2
- package/templates/skills/apex/steps/step-04-examine.md +163 -0
- package/templates/skills/apex-verify/SKILL.md +110 -0
- package/templates/skills/apex-verify/references/audit-rules.md +50 -0
- package/templates/skills/apex-verify/steps/step-00-init.md +119 -0
- package/templates/skills/apex-verify/steps/step-01-nav-audit.md +96 -0
- package/templates/skills/apex-verify/steps/step-02-crud-audit.md +127 -0
- package/templates/skills/apex-verify/steps/step-03-perm-audit.md +119 -0
- package/templates/skills/apex-verify/steps/step-04-route-audit.md +98 -0
- package/templates/skills/apex-verify/steps/step-05-report.md +110 -0
- package/templates/skills/application/references/contexts-cheatsheet.md +86 -0
- package/templates/skills/application/references/extensions-system.md +158 -0
- package/templates/skills/application/references/frontend-route-naming.md +7 -5
- package/templates/skills/application/references/frontend-verification.md +7 -5
- package/templates/skills/application/references/provider-template.md +4 -2
- package/templates/skills/application/references/smartstack-provider.md +118 -0
- package/templates/skills/application/references/themes-db-driven.md +484 -0
- package/templates/skills/application/templates-frontend.md +2 -2
- package/templates/skills/application/templates-seed.md +4 -2
- package/templates/skills/audit-route/references/routing-pattern.md +3 -1
- package/templates/skills/business-analyse/SKILL.md +3 -3
- package/templates/skills/business-analyse/_shared.md +37 -0
- package/templates/skills/business-analyse/react/components.md +30 -28
- package/templates/skills/business-analyse/references/03-json-schemas.md +11 -3
- package/templates/skills/business-analyse/references/03-post-check-validation.md +64 -0
- package/templates/skills/business-analyse/references/canonical-json-formats.md +7 -3
- package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
- package/templates/skills/business-analyse/references/validation-checklist.md +5 -5
- package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +15 -4
- package/templates/skills/business-analyse/steps/step-03-specify.md +162 -4
- package/templates/skills/business-analyse/steps/step-04-consolidate.md +211 -1
- package/templates/skills/business-analyse/templates-react.md +15 -15
- package/templates/skills/business-analyse-handoff/references/agent-handoff-transform-prompt.md +3 -0
- package/templates/skills/business-analyse-html/html/ba-interactive.html +198 -16
- package/templates/skills/business-analyse-html/html/src/scripts/01-data-init.js +64 -0
- package/templates/skills/business-analyse-html/html/src/scripts/05-render-specs.js +80 -11
- package/templates/skills/business-analyse-html/html/src/scripts/06-render-consolidation.js +2 -2
- package/templates/skills/business-analyse-html/html/src/scripts/06-render-mockups.js +6 -3
- package/templates/skills/business-analyse-html/html/src/scripts/12-render-diagrams.js +46 -0
- package/templates/skills/business-analyse-html/references/02-feature-data-building.md +4 -2
- package/templates/skills/business-analyse-html/references/data-build.md +2 -0
- package/templates/skills/business-analyse-html/references/data-mapping.md +88 -21
- package/templates/skills/business-analyse-html/steps/step-02-build-data.md +6 -0
- package/templates/skills/business-analyse-html/steps/step-04-verify.md +92 -3
- package/templates/skills/business-analyse-quick/SKILL.md +807 -0
- package/templates/skills/{sketch → business-analyse-quick}/references/domain-heuristics.md +59 -3
- package/templates/skills/business-analyse-quick/references/prd-schema.md +268 -0
- package/templates/skills/business-analyse-review/references/review-data-mapping.md +6 -0
- package/templates/skills/cli-app-sync/SKILL.md +105 -4
- package/templates/skills/cli-app-sync/references/comparison-map.md +13 -0
- package/templates/skills/cli-app-sync/references/diff-entities.md +162 -0
- package/templates/skills/dev-start/SKILL.md +7 -7
- package/templates/skills/documentation/templates.md +16 -16
- package/templates/skills/migrate/SKILL.md +312 -0
- package/templates/skills/migrate/references/v3.34-to-v3.46.md +289 -0
- package/templates/skills/sketch/SKILL.md +15 -153
- package/templates/skills/smoke-generation/SKILL.md +313 -0
- package/templates/skills/ui-components/SKILL.md +11 -1
- package/templates/skills/ui-components/patterns/data-table.md +1 -1
- package/templates/skills/ui-components/references/component-catalog.md +82 -0
- package/templates/skills/workflow/SKILL.md +70 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Extension System — Slot/Fill, Page Overrides, Hooks
|
|
2
|
+
|
|
3
|
+
> **Reference for `application` skill** — how a client project enriches a SmartStack page without forking the SDK.
|
|
4
|
+
|
|
5
|
+
## When This Reference Applies
|
|
6
|
+
|
|
7
|
+
- Client wants to inject content into an existing SmartStack page (header action, table column, side panel)
|
|
8
|
+
- Client wants to fully replace a built-in page with a custom one
|
|
9
|
+
- Client needs to react to navigation/auth/tenant lifecycle events
|
|
10
|
+
- The user asks "how do I add a column to UsersList", "how do I override the AdministrationDashboard page", "how do I customize a SmartStack form"
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Three extension mechanisms
|
|
15
|
+
|
|
16
|
+
### 1. Page overrides — `componentRegistry` + `PageRegistry`
|
|
17
|
+
|
|
18
|
+
Override a built-in page by registering your component under the same key :
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
// In your client componentRegistry.generated.ts (or a custom registry.ts)
|
|
22
|
+
import { PageRegistry } from '@atlashub/smartstack';
|
|
23
|
+
import { lazy } from 'react';
|
|
24
|
+
|
|
25
|
+
PageRegistry.register(
|
|
26
|
+
'administration.users', // built-in key — replaces SmartStack page
|
|
27
|
+
lazy(() => import('@/pages/MyCustomUsers')), // your component
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Or via SmartStackConfig.extensions.pages (declarative)
|
|
31
|
+
const config: SmartStackConfig = {
|
|
32
|
+
apiUrl: '...',
|
|
33
|
+
extensions: {
|
|
34
|
+
pages: {
|
|
35
|
+
'administration.users': () => import('@/pages/MyCustomUsers'),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The `DynamicRouter` calls `PageRegistry.resolve(componentKey)` and your override wins.
|
|
42
|
+
|
|
43
|
+
> **Tip** — for net-new pages on client-defined routes, prefer the MCP tool `mcp__smartstack__scaffold_routes` to keep `componentRegistry.generated.ts` consistent.
|
|
44
|
+
|
|
45
|
+
### 2. Slot / Fill — render-prop injection
|
|
46
|
+
|
|
47
|
+
Inject content into a named slot exposed by a SmartStack page :
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Fill } from '@atlashub/smartstack';
|
|
51
|
+
|
|
52
|
+
// Inject into the slot 'users.header.actions'
|
|
53
|
+
<Fill slot="users.header.actions">
|
|
54
|
+
<button onClick={...}>My custom action</button>
|
|
55
|
+
</Fill>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Available slot names follow the convention `{section}.{location}.{purpose}` (see `extensions/types.ts` SlotName union for the full list — examples : `users.header.actions`, `users.table.columns.before`, `users.table.row.actions`, `users.form.fields.after`, `users.detail.tabs.after`).
|
|
59
|
+
|
|
60
|
+
You can declare slots once via `SmartStackConfig.extensions.slots` :
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
extensions: {
|
|
64
|
+
slots: {
|
|
65
|
+
'users.header.actions': MyHeaderWidget,
|
|
66
|
+
'dashboard.kpi.before': MyKpi,
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Lifecycle hooks
|
|
72
|
+
|
|
73
|
+
Subscribe to platform events from anywhere :
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
extensions: {
|
|
77
|
+
hooks: {
|
|
78
|
+
onAuthSuccess: (user) => analytics.identify(user.id),
|
|
79
|
+
onTenantSwitch: (tenant) => router.navigate('/dashboard'),
|
|
80
|
+
onNavigationChanged: (menu) => console.log('menu refreshed'),
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Table columns & form fields extensions
|
|
88
|
+
|
|
89
|
+
Extend the standard `DataTable` or `EntityForm` of any built-in section :
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
extensions: {
|
|
93
|
+
tableColumns: {
|
|
94
|
+
'administration.users.list': [
|
|
95
|
+
{
|
|
96
|
+
key: 'department',
|
|
97
|
+
label: 'Department',
|
|
98
|
+
render: (row) => row.department?.name,
|
|
99
|
+
align: 'left',
|
|
100
|
+
sortable: true,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
formFields: {
|
|
105
|
+
'administration.users.create': [
|
|
106
|
+
{
|
|
107
|
+
name: 'department',
|
|
108
|
+
type: 'select',
|
|
109
|
+
label: 'Department',
|
|
110
|
+
options: () => departmentApi.list(),
|
|
111
|
+
validation: { required: true },
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
These extensions are consumed by the corresponding hooks in the SmartStack page :
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
const extraColumns = useTableColumnExtensions('administration.users.list');
|
|
122
|
+
const extraFields = useFormFieldExtensions('administration.users.create');
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## DO / DON'T
|
|
128
|
+
|
|
129
|
+
| ✅ DO | ❌ DON'T |
|
|
130
|
+
|---|---|
|
|
131
|
+
| Use `PageRegistry.register()` once at startup | Register the same key twice (last wins, but ambiguous) |
|
|
132
|
+
| Use lazy imports for page overrides | Import override pages eagerly (kills code splitting) |
|
|
133
|
+
| Match exact componentKey from the navigation menu | Guess the key — read it from `/api/navigation/menu` response |
|
|
134
|
+
| Use slots for additive content | Use slots to remove content (use page override instead) |
|
|
135
|
+
| Type custom column data via `row` typing | Cast `row as any` |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## MCP delegation
|
|
140
|
+
|
|
141
|
+
For complex extension scaffolds (page override + slots + tests), prefer the MCP tool over hand-written code :
|
|
142
|
+
|
|
143
|
+
| Goal | MCP tool |
|
|
144
|
+
|---|---|
|
|
145
|
+
| Generate a page override + register it | `mcp__smartstack__scaffold_frontend_extension` (type: `page-override`) |
|
|
146
|
+
| Generate a custom Slot component | `mcp__smartstack__scaffold_frontend_extension` (type: `slot`) |
|
|
147
|
+
| Generate a custom column extension | `mcp__smartstack__scaffold_frontend_extension` (type: `table-column`) |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Reference source files (read-only)
|
|
152
|
+
|
|
153
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\extensions\PageRegistry.tsx`
|
|
154
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\extensions\types.ts` (SlotName, ColumnExtension, FormFieldExtension)
|
|
155
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\extensions\ExtensionContext.tsx` (useExtensions, useTableColumnExtensions, useFormFieldExtensions)
|
|
156
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\extensions\SlotFill.tsx` (Slot, Fill, SlotFillProvider)
|
|
157
|
+
|
|
158
|
+
See also [smartstack-provider.md](smartstack-provider.md) for the SmartStackConfig shape that hosts `extensions`.
|
|
@@ -79,19 +79,21 @@ const applicationRoutes: ApplicationRouteExtensions = {
|
|
|
79
79
|
|
|
80
80
|
## Implementation Pattern
|
|
81
81
|
|
|
82
|
+
> **v3.46+ note** — The domain-specific layouts `AdminLayout`, `BusinessLayout`, `UserLayout`, `HRLayout`, `SalesLayout` are REMOVED. `AppLayout` is now the SOLE shell for authenticated application routes. Routes are resolved dynamically by `DynamicRouter` via `componentRegistry.generated.ts` — the JSX `<Route>` blocks below are illustrative for naming convention only, not for manual declaration. See `references/smartstack-provider.md` for the full provider/router setup.
|
|
83
|
+
|
|
82
84
|
When generating routes, apply kebab-case to all multi-word segments:
|
|
83
85
|
|
|
84
86
|
```tsx
|
|
85
|
-
// CORRECT
|
|
86
|
-
<Route path="/human-resources" element={<
|
|
87
|
+
// CORRECT — kebab-case convention (illustrative — actual routes flow through DynamicRouter)
|
|
88
|
+
<Route path="/human-resources" element={<AppLayout />}>
|
|
87
89
|
<Route path="employees" element={<EmployeesPage />} />
|
|
88
90
|
<Route path="time-management" element={<TimeManagementPage />} />
|
|
89
91
|
</Route>
|
|
90
92
|
|
|
91
93
|
// FORBIDDEN
|
|
92
|
-
<Route path="/humanresources" element={<
|
|
93
|
-
<Route path="/HR" element={<
|
|
94
|
-
<Route path="/human_resources" element={<
|
|
94
|
+
<Route path="/humanresources" element={<AppLayout />} />
|
|
95
|
+
<Route path="/HR" element={<AppLayout />} />
|
|
96
|
+
<Route path="/human_resources" element={<AppLayout />} />
|
|
95
97
|
```
|
|
96
98
|
|
|
97
99
|
---
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
## Routing Rules
|
|
6
6
|
|
|
7
|
+
> ⚠️ **DEPRECATED PATTERN — v3.46+** : Domain-specific layouts (`SalesLayout`, `AdminLayout`, `BusinessLayout`, `UserLayout`, `HRLayout`) are REMOVED. There are now **only 4 layouts** : `AppLayout` (sole shell for authenticated app routes), `AuthLayout` (login/register), `PublicLayout` (public pages), `DocsLayout` (documentation). The "manual `<Route>` declaration" examples below are LEGACY ; on v3.46+ routes are resolved by `DynamicRouter` via `componentRegistry.generated.ts` (see Section 5b below + `references/smartstack-provider.md`). The examples are kept for projects on v3.6 and earlier.
|
|
8
|
+
|
|
7
9
|
### Rule 1: Routes MUST be inside Layout wrappers
|
|
8
10
|
|
|
9
|
-
**CRITICAL:** All routes MUST be nested inside the appropriate context layout. This is what provides the SmartStack shell (header with AvatarMenu, sidebar, navigation).
|
|
11
|
+
**CRITICAL (legacy v3.6 only):** All routes MUST be nested inside the appropriate context layout. This is what provides the SmartStack shell (header with AvatarMenu, sidebar, navigation). On v3.46+, `AppLayout` is the SOLE shell.
|
|
10
12
|
|
|
11
13
|
```tsx
|
|
12
|
-
// CORRECT - Inside
|
|
13
|
-
<Route path="/sales" element={<
|
|
14
|
+
// CORRECT (v3.46+) - Inside AppLayout (shell renders: header + AvatarMenu + sidebar)
|
|
15
|
+
<Route path="/sales" element={<AppLayout />}>
|
|
14
16
|
<Route path="products" element={<ProductsPage />} />
|
|
15
17
|
</Route>
|
|
16
18
|
|
|
@@ -23,8 +25,8 @@
|
|
|
23
25
|
**CRITICAL:** SmartStack requires NESTED routes within the layout:
|
|
24
26
|
|
|
25
27
|
```tsx
|
|
26
|
-
// CORRECT - Nested routes inside layout
|
|
27
|
-
<Route path="/sales" element={<
|
|
28
|
+
// CORRECT - Nested routes inside layout (v3.46+ uses AppLayout)
|
|
29
|
+
<Route path="/sales" element={<AppLayout />}>
|
|
28
30
|
<Route path="products">
|
|
29
31
|
<Route index element={<Navigate to="products" replace />} />
|
|
30
32
|
<Route path="products" element={<ProductsPage />} />
|
|
@@ -42,10 +42,12 @@ public class {AppPascalName}SeedDataProvider : IClientSeedDataProvider
|
|
|
42
42
|
}
|
|
43
43
|
else
|
|
44
44
|
{
|
|
45
|
+
// v3.46+ signature : Zone removed. New flags isOpen + isPersonal at the END (optional, default false).
|
|
45
46
|
app = NavigationApplication.Create(
|
|
46
|
-
|
|
47
|
+
appEntry.Code, appEntry.Label,
|
|
47
48
|
appEntry.Description, appEntry.Icon, appEntry.IconType,
|
|
48
|
-
appEntry.Route, appEntry.DisplayOrder
|
|
49
|
+
appEntry.Route, appEntry.DisplayOrder,
|
|
50
|
+
isOpen: appEntry.IsOpen, isPersonal: appEntry.IsPersonal);
|
|
49
51
|
context.NavigationApplications.Add(app);
|
|
50
52
|
await ((DbContext)context).SaveChangesAsync(ct);
|
|
51
53
|
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# SmartStackProvider — Wrapping the Client App
|
|
2
|
+
|
|
3
|
+
> **Reference for `application` skill** — how to bootstrap a SmartStack client project (npm `@atlashub/smartstack`) using the SDK provider.
|
|
4
|
+
|
|
5
|
+
## When This Reference Applies
|
|
6
|
+
|
|
7
|
+
- The client project consumes `@atlashub/smartstack` as an npm package (v3.7+)
|
|
8
|
+
- You are generating or auditing `App.tsx` / `main.tsx` / the application bootstrap
|
|
9
|
+
- The user asks "how do I wrap my app", "where do I put providers", "how do I configure SmartStack"
|
|
10
|
+
|
|
11
|
+
If the project is the SmartStack platform itself (`SmartStack.app`), the platform's internal `App.tsx` already inlines the providers and does NOT use `<SmartStackProvider>` — only client projects use it.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## SmartStackConfig shape
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
interface SmartStackConfig {
|
|
19
|
+
apiUrl: string; // REQUIRED — backend root URL (e.g. "https://api.client.com")
|
|
20
|
+
defaultLanguage?: 'fr' | 'en' | 'it' | 'de'; // default 'fr'
|
|
21
|
+
debug?: boolean; // verbose logging
|
|
22
|
+
logo?: ReactNode; // override branding logo
|
|
23
|
+
appName?: string; // displayed in title/header fallback
|
|
24
|
+
licenseKey?: string; // license string (validated against /api/license)
|
|
25
|
+
extensions?: ExtensionConfig; // see references/extensions-system.md
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Wrapping order (Outer → Inner)
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
35
|
+
import { SmartStackProvider, DynamicRouter } from '@atlashub/smartstack';
|
|
36
|
+
import '@atlashub/smartstack/theme.css';
|
|
37
|
+
|
|
38
|
+
const config: SmartStackConfig = {
|
|
39
|
+
apiUrl: import.meta.env.VITE_API_URL,
|
|
40
|
+
defaultLanguage: 'fr',
|
|
41
|
+
appName: 'My Client App',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
createRoot(document.getElementById('root')!).render(
|
|
45
|
+
<StrictMode>
|
|
46
|
+
<BrowserRouter>
|
|
47
|
+
<SmartStackProvider config={config}>
|
|
48
|
+
<DynamicRouter />
|
|
49
|
+
</SmartStackProvider>
|
|
50
|
+
</BrowserRouter>
|
|
51
|
+
</StrictMode>,
|
|
52
|
+
);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`<SmartStackProvider>` internally nests, in this order :
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
SmartStackContext (config)
|
|
59
|
+
└─ GlobalErrorBoundary
|
|
60
|
+
└─ ExtensionProvider
|
|
61
|
+
└─ ThemeProvider
|
|
62
|
+
└─ FeatureConfigProvider
|
|
63
|
+
└─ AuthProvider
|
|
64
|
+
└─ TenantProvider
|
|
65
|
+
└─ LicenseProvider
|
|
66
|
+
└─ FavoritesProvider
|
|
67
|
+
└─ SidebarProvider
|
|
68
|
+
└─ SessionProvider
|
|
69
|
+
└─ ThemeSync
|
|
70
|
+
└─ NavigationProvider
|
|
71
|
+
└─ SignalRProvider
|
|
72
|
+
└─ {children}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Do NOT re-wrap any of these providers manually.** They are exported only for advanced cases (e.g., Storybook).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Hooks consumable from any descendant
|
|
80
|
+
|
|
81
|
+
| Hook | Context | Returns |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| `useSmartStack()` | SmartStackContext | `{ config }` |
|
|
84
|
+
| `useAuth()` | AuthContext | `{ user, login, logout, refresh, hasPermission }` |
|
|
85
|
+
| `useTenant()` | TenantContext | `{ currentTenant, userTenants, switchTenant, isGlobalView }` |
|
|
86
|
+
| `useNavigation()` | NavigationContext | `{ menu, reload, currentApp, currentModule, isLoading }` |
|
|
87
|
+
| `useTheme()` | ThemeContext | `{ mode, selectedTheme, selectedPreset, setTheme, setPreset, toggleMode }` |
|
|
88
|
+
| `useLicense()` | LicenseContext | `{ license, isFeatureEnabled, hasModule }` |
|
|
89
|
+
| `useSignalR()` | SignalRContext | `{ isConnected, on, off, emit }` |
|
|
90
|
+
| `useFavorites()` | FavoritesContext | `{ favorites, toggleFavorite, isFavorite }` |
|
|
91
|
+
| `useSidebar()` | SidebarContext | `{ isCollapsed, toggle, setCollapsed }` |
|
|
92
|
+
| `useFeatureConfig()` | FeatureConfigContext | `{ features }` |
|
|
93
|
+
| `useDocPanel()` | DocPanelContext | `{ isOpen, toggle, openDoc }` |
|
|
94
|
+
|
|
95
|
+
See [contexts-cheatsheet.md](contexts-cheatsheet.md) for usage examples.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## DO / DON'T
|
|
100
|
+
|
|
101
|
+
| ✅ DO | ❌ DON'T |
|
|
102
|
+
|---|---|
|
|
103
|
+
| Place `<SmartStackProvider>` exactly once at root | Wrap the same provider twice |
|
|
104
|
+
| Put `<BrowserRouter>` ABOVE `<SmartStackProvider>` | Put `<SmartStackProvider>` above the router |
|
|
105
|
+
| Read config via `useSmartStack()` from any descendant | Pass config down via props |
|
|
106
|
+
| Import `componentRegistry.generated` in `main.tsx` BEFORE the render | Forget the import (DynamicRouter will not resolve pages) |
|
|
107
|
+
| Wait for `i18nReady` promise before render | Render before i18n loaded (causes FOUC) |
|
|
108
|
+
| Provide `apiUrl` via `import.meta.env.VITE_API_URL` | Hardcode the backend URL |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Reference source files (read-only — DO NOT copy verbatim)
|
|
113
|
+
|
|
114
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\provider\SmartStackProvider.tsx`
|
|
115
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\router\types.ts` (SmartStackConfig)
|
|
116
|
+
- `D:\01 - projets\SmartStack.app\features\IA-Workflow\web\smartstack-web\src\main.tsx` (i18nReady + componentRegistry import)
|
|
117
|
+
|
|
118
|
+
For overrides via `extensions`, see [extensions-system.md](extensions-system.md).
|