eha-design-system-ai 0.3.0 → 0.5.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 (2) hide show
  1. package/README.md +170 -33
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,62 +1,199 @@
1
1
  # eha-design-system-ai
2
2
 
3
- MCP server for the EHA Design System. It exposes components, design tokens, recipes, and brand-specific setup data to AI agents through the Model Context Protocol.
3
+ AI compatibility layer for EHA Design System, enables LLMs to reliably generate UI components without hallucination.
4
4
 
5
- ## Tools
5
+ ## What It Does
6
6
 
7
- | Tool | Description |
8
- |------|-------------|
9
- | `get_brand` | Returns brand setup (`ThemeProvider`, CSS import), brand color scales, and key brand differences |
10
- | `get_components` | Lists available DS components, optionally filtered by category or search |
11
- | `get_component` | Returns full component details (props, usage, notes, Figma aliases) |
12
- | `resolve_figma` | Maps Figma node names to DS components and flags missing items |
13
- | `get_tokens` | Returns token data by category, with optional brand-specific colors |
14
- | `get_recipe` | Returns recipe code by id, or lists recipes by category |
15
- | `get_rules` | Returns AI guardrails and do/don't implementation rules |
7
+ Provides an MCP (Model Context Protocol) server that gives AI coding agents structured access to:
16
8
 
17
- ## Setup
9
+ - **Component definitions** — Props, variants, usage examples, and Figma node name mappings for all 23 EHA DS components + 2 full-page templates
10
+ - **Multi-brand theming** — Full token sets for all 4 brands: `eha`, `etrac`, `lomis`, `reach`
11
+ - **Figma resolution** — Map design node names to exact code components before generating any code
12
+ - **Design tokens** — Colors, spacing, typography, border radius, shadows per brand
13
+ - **Layout recipes** — Pre-built patterns for dashboards, forms, tables, drawers, modals
14
+ - **Agent rules** — Constraints that prevent AI from inventing props or building custom implementations
18
15
 
19
- ```bash
20
- npm install
21
- npm run build
22
- ```
16
+ ---
23
17
 
24
- ## Run Locally
18
+ ## Installation
25
19
 
26
20
  ```bash
27
- npm run start
21
+ # Use directly with npx (no install needed)
22
+ npx eha-design-system-ai
23
+
24
+ # Or install in your project
25
+ npm install --save-dev eha-design-system-ai
28
26
  ```
29
27
 
30
- ## MCP Config (Local Build)
28
+ ---
29
+
30
+ ## Project Integration
31
+
32
+ Add `.mcp.json` to your project root:
31
33
 
32
34
  ```json
33
35
  {
34
36
  "mcpServers": {
35
37
  "eha-design-system": {
36
- "command": "node",
37
- "args": ["/absolute/path/to/eha-ai/dist/mcp/server.js"]
38
+ "command": "npx",
39
+ "args": ["eha-design-system-ai"]
38
40
  }
39
41
  }
40
42
  }
41
43
  ```
42
44
 
43
- ## MCP Config (Published Package)
45
+ This is picked up automatically by Claude Code, opencode, Cursor, and other MCP-compatible agents.
46
+
47
+ ---
48
+
49
+ ## MCP Tools
50
+
51
+ | Tool | Description |
52
+ |------|-------------|
53
+ | `get_brand` | **Call first for branded projects.** Returns ThemeProvider setup, CSS import, and brand-specific colour tokens |
54
+ | `get_components` | List all components, filter by category or search term |
55
+ | `get_component` | Full props, usage, and common mistakes for a specific component |
56
+ | `resolve_figma` | Map Figma node names to DS components, flag MISSING ones |
57
+ | `get_tokens` | Design tokens — pass `brandId` for brand-specific colours |
58
+ | `get_recipe` | Pre-built layout patterns for common page types |
59
+ | `get_rules` | Agent rules, import conventions, and constraints |
60
+
61
+ ---
62
+
63
+ ## Multi-Brand Theming
64
+
65
+ EHA Design System supports 4 brands. Each brand has its own colour token set and CSS stylesheet. Spacing, typography, border radius, shadows, and z-index are **identical across all brands**.
66
+
67
+
68
+ ### Setup (Two Steps)
69
+
70
+ **Step 1 — Import the brand CSS at your app entry point (`main.tsx` or `App.tsx`):**
71
+
72
+ ```tsx
73
+ // Choose your brand:
74
+ import 'eha-design-system/styles/brands/eha.css';
75
+ import 'eha-design-system/styles/brands/etrac.css';
76
+ import 'eha-design-system/styles/brands/lomis.css';
77
+ import 'eha-design-system/styles/brands/reach.css';
78
+ ```
79
+
80
+ **Step 2 — Wrap your app root with `ThemeProvider`:**
81
+
82
+ ```tsx
83
+ import { ThemeProvider } from 'eha-design-system';
84
+
85
+ function App() {
86
+ return (
87
+ <ThemeProvider brandId="lomis">
88
+ <YourApp />
89
+ </ThemeProvider>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Agent Workflow
97
+
98
+ When given a Figma page, the agent should:
99
+
100
+ 1. Call `get_brand` with the target brand ID
101
+ 2. Call `get_rules` to load constraints
102
+ 3. Call `resolve_figma` with all Figma node names
103
+ 4. Get confirmation on any MISSING components
104
+ 5. Call `get_component` for each resolved component
105
+ 6. Optionally call `get_recipe` for page-level layout patterns
106
+ 7. Generate code using ONLY resolved components with correct brand setup
107
+
108
+ ---
109
+
110
+ ## Programmatic Usage
111
+
112
+ ```typescript
113
+ import { getAllManifests, getComponentManifest, tokens, brandConfigs } from 'eha-design-system-ai';
114
+
115
+ // Get all components
116
+ const all = getAllManifests();
117
+
118
+ // Get a specific component
119
+ const button = getComponentManifest('Button');
120
+
121
+ // Access default (eha) tokens
122
+ console.log(tokens.colors.primary); // '#0090FC'
123
+
124
+ // Access brand-specific config
125
+ const lomis = brandConfigs.lomis;
126
+ console.log(lomis.primary); // '#0090FC'
127
+ console.log(lomis.tertiary); // '#1E3A5F'
128
+ console.log(lomis.cssImport); // "import 'eha-design-system/styles/brands/lomis.css'"
129
+
130
+ const reach = brandConfigs.reach;
131
+ console.log(reach.primary); // '#522E1C'
132
+ console.log(reach.keyDifferences); // array of what makes reach different
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Core Rules for Agents
138
+
139
+ 1. **Call `get_brand` first** when building for a specific brand
140
+ 2. **Import brand CSS before `ThemeProvider`** — order matters
141
+ 3. **Never hardcode brand colours** — use ThemeProvider CSS custom properties
142
+ 4. **All imports from `eha-design-system`** — never from `rsuite` directly
143
+ 5. **Button always uses `variant` prop** — `'primary' | 'secondary' | 'tertiary' | 'ghost'`
144
+ 6. **Missing components** → output `// MISSING: [Name] — not in EHA Design System`, do NOT build manually
145
+ 7. **For Login/Settings pages** → use `LoginTemplate` / `ProfileSettingsTemplate` first
146
+
147
+ ---
148
+
149
+ ## Available Components
150
+
151
+ | Component | Category | Key Props |
152
+ |-----------|----------|-----------|
153
+ | Button | input | variant, size, isLoading, fullWidth |
154
+ | Input | input | label, helperText, error, fullWidth |
155
+ | SelectPicker | input | data, label, error, block |
156
+ | Checkbox + CheckboxGroup | input | size, CheckboxGroup label |
157
+ | Radio + RadioGroup | input | RadioGroup name, value |
158
+ | DatePicker | input | label, helperText, error |
159
+ | Table | display | data, autoHeight, Table.Column, Table.Pagination |
160
+ | MetricCard | display | value, label, icon, variant, breakdown |
161
+ | Avatar | display | src, circle, Avatar.Group |
162
+ | Badge | display | content, color |
163
+ | Tag | display | color, closable, Tag.Group |
164
+ | Modal | feedback | open, onClose, size, sub-components |
165
+ | Notification + useToaster | feedback | type, header |
166
+ | Loader | feedback | size, content, center, backdrop |
167
+ | Progress | feedback | Progress.Line, Progress.Circle |
168
+ | Sidenav | navigation | expanded, items, logo, activeKey |
169
+ | Tabs | navigation | defaultActiveKey, Tabs.Tab |
170
+ | Breadcrumb | navigation | Breadcrumb.Item |
171
+ | Steps | navigation | current, status, Steps.Item |
172
+ | Dropdown | navigation | title, trigger, Dropdown.Item |
173
+ | PageHeader | layout | title, subtitle, user, onAction |
174
+ | Drawer | layout | open, placement, size, sub-components |
175
+ | Accordion | layout | bordered, Accordion.Panel |
176
+
177
+ ## Full-Page Templates
178
+
179
+ | Template | Use Case |
180
+ |----------|----------|
181
+ | `LoginTemplate` | Full login/auth page — split screen layout |
182
+ | `ProfileSettingsTemplate` | Full profile settings page with sidebar |
183
+
184
+ ---
185
+
186
+ ## Peer Dependencies
44
187
 
45
188
  ```json
46
189
  {
47
- "mcpServers": {
48
- "eha-design-system": {
49
- "command": "npx",
50
- "args": ["eha-design-system-ai"]
51
- }
52
- }
190
+ "eha-design-system": ">=0.2.2",
191
+ "react": "^18.0.0 || ^19.0.0"
53
192
  }
54
193
  ```
55
194
 
56
- ## Sync Version Marker From DS
195
+ ---
57
196
 
58
- ```bash
59
- npm run sync
60
- ```
197
+ ## License
61
198
 
62
- This updates the `eha-design-system@x.y.z` version reference in the token source file to match the installed package version.
199
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eha-design-system-ai",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "AI compatibility layer for EHA Design System — enables LLMs to reliably generate UI without hallucination",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",