@atomixstudio/mcp 1.0.15 → 1.0.17
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/README.md +104 -125
- package/dist/index.js +129 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
# @atomixstudio/mcp
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server and CLI for Atomix Design System. Query and sync design tokens
|
|
4
|
-
|
|
5
|
-
## Quick Start (CLI)
|
|
6
|
-
|
|
7
|
-
The easiest way to use Atomix is via the CLI:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Sync tokens + AI rules (default behavior)
|
|
11
|
-
npx heyatomix sync
|
|
12
|
-
|
|
13
|
-
# Sync tokens only (skip AI rules)
|
|
14
|
-
npx heyatomix sync --no-rules
|
|
15
|
-
|
|
16
|
-
# Create config file
|
|
17
|
-
npx heyatomix init
|
|
18
|
-
```
|
|
3
|
+
MCP (Model Context Protocol) server and CLI for Atomix Design System. Query and sync design tokens from AI coding tools (Cursor, Claude Desktop, Windsurf, etc.) or from the command line.
|
|
19
4
|
|
|
20
5
|
## Getting Your Credentials
|
|
21
6
|
|
|
@@ -24,79 +9,9 @@ npx heyatomix init
|
|
|
24
9
|
3. Click **Publish** to make your DS available via API
|
|
25
10
|
4. Your `ds-id` is in the URL: `atomixstudio.eu/ds/[ds-id]`
|
|
26
11
|
|
|
27
|
-
## CLI Commands
|
|
28
|
-
|
|
29
|
-
### `heyatomix sync`
|
|
30
|
-
|
|
31
|
-
Sync design tokens and AI rules to your project. **Both tokens and AI guidance rules sync by default** since the rules reference tokens.
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx heyatomix sync # Sync tokens + AI rules
|
|
35
|
-
npx heyatomix sync --no-rules # Sync tokens only
|
|
36
|
-
npx heyatomix sync -o src/tokens.css # Custom output path
|
|
37
|
-
npx heyatomix sync --format scss # Output as SCSS
|
|
38
|
-
npx heyatomix sync -y # Auto-confirm changes
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**⚠️ Important: File Structure**
|
|
42
|
-
|
|
43
|
-
The output file (e.g., `tokens.css`) is **completely rewritten** on each sync:
|
|
44
|
-
|
|
45
|
-
- ✅ **Preserved**: CSS custom properties (variables) - both design system tokens and custom variables
|
|
46
|
-
- ❌ **Lost**: Regular CSS rules (selectors, classes, media queries, etc.)
|
|
47
|
-
|
|
48
|
-
**Best Practice**: Keep your tokens file separate from custom CSS. Use a separate file (e.g., `custom.css` or `styles.css`) for custom styles.
|
|
49
|
-
|
|
50
|
-
### `heyatomix init`
|
|
51
|
-
|
|
52
|
-
Create a `.atomixrc` config file:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npx heyatomix init
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
This creates:
|
|
59
|
-
|
|
60
|
-
```json
|
|
61
|
-
{
|
|
62
|
-
"dsId": "your-design-system-id",
|
|
63
|
-
"output": "./tokens.css",
|
|
64
|
-
"format": "css"
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### CLI Options
|
|
69
|
-
|
|
70
|
-
| Option | Description |
|
|
71
|
-
|--------|-------------|
|
|
72
|
-
| `--ds-id` | Design system ID (or set in .atomixrc) |
|
|
73
|
-
| `--api-key` | API key for private design systems |
|
|
74
|
-
| `--output, -o` | Output file path [./tokens.css] |
|
|
75
|
-
| `--format` | Output format (see below) |
|
|
76
|
-
| `--no-rules` | Skip syncing AI rules (tokens + rules sync by default) |
|
|
77
|
-
| `--rules-dir` | Directory for rules files [project root] |
|
|
78
|
-
| `-y, --yes` | Auto-confirm changes |
|
|
79
|
-
|
|
80
|
-
### Output Formats
|
|
81
|
-
|
|
82
|
-
**Web:**
|
|
83
|
-
- `css` — CSS custom properties (`:root { --var: value }`)
|
|
84
|
-
- `scss` — CSS vars + SCSS variables (`$var: value`)
|
|
85
|
-
- `less` — CSS vars + Less variables (`@var: value`)
|
|
86
|
-
- `json` — Raw token JSON
|
|
87
|
-
- `ts` — TypeScript with types
|
|
88
|
-
- `js` — JavaScript module
|
|
89
|
-
|
|
90
|
-
**Native:**
|
|
91
|
-
- `swift` — Swift/SwiftUI for iOS
|
|
92
|
-
- `kotlin` — Kotlin/Compose for Android
|
|
93
|
-
- `dart` — Dart for Flutter
|
|
94
|
-
|
|
95
|
-
All formats include **light and dark mode** values.
|
|
96
|
-
|
|
97
12
|
## MCP Server Setup
|
|
98
13
|
|
|
99
|
-
|
|
14
|
+
Connect your AI tool so it can query your design system directly.
|
|
100
15
|
|
|
101
16
|
### Cursor IDE
|
|
102
17
|
|
|
@@ -134,7 +49,7 @@ Create `.windsurf/mcp.json` in your project root (same format as Cursor).
|
|
|
134
49
|
|
|
135
50
|
## MCP Tools
|
|
136
51
|
|
|
137
|
-
Once connected, AI
|
|
52
|
+
Once connected, the AI can call these tools:
|
|
138
53
|
|
|
139
54
|
| Tool | Description |
|
|
140
55
|
|------|-------------|
|
|
@@ -146,55 +61,49 @@ Once connected, AI tools can use these:
|
|
|
146
61
|
| `getAIToolRules(tool)` | Generate AI coding rules for your design system |
|
|
147
62
|
| `exportMCPConfig(tool)` | Get MCP configuration for different tools |
|
|
148
63
|
| `getSetupInstructions(tool)` | Get detailed setup guide |
|
|
149
|
-
| `getDependencies(platform?, stack?)` | Get suggested dependencies (icons, fonts, SKILL.md,
|
|
64
|
+
| `getDependencies(platform?, stack?)` | Get suggested dependencies (icons, fonts, SKILL.md, token files). Optional: `platform` (web, ios, android), `stack` (e.g. react, vue, next). Use with **/--getstarted** prompt. |
|
|
150
65
|
|
|
151
66
|
### getDependencies
|
|
152
67
|
|
|
153
|
-
Returns DS-derived suggestions so the
|
|
68
|
+
Returns DS-derived suggestions so the AI can build a "Suggested" vs "Already present" list and, after user approval, install or copy assets.
|
|
154
69
|
|
|
155
|
-
**Parameters (optional):**
|
|
156
|
-
|
|
157
|
-
| Parameter | Description |
|
|
158
|
-
|-----------|-------------|
|
|
159
|
-
| `platform` | `web`, `ios`, or `android` |
|
|
160
|
-
| `stack` | e.g. `react`, `vue`, `next`, `swift`, `kotlin` |
|
|
70
|
+
**Parameters (optional):** `platform` — `web`, `ios`, or `android`; `stack` — e.g. `react`, `vue`, `next`, `swift`, `kotlin`.
|
|
161
71
|
|
|
162
72
|
**Returns (JSON):**
|
|
163
73
|
|
|
164
|
-
- **iconLibrary** — `package`, `nativePackage`, and a
|
|
165
|
-
- **fonts** — Font family names from typography tokens +
|
|
74
|
+
- **iconLibrary** — `package`, `nativePackage`, and a performance hint (use individual imports; apply the DS icon sizing/weight token when rendering icons).
|
|
75
|
+
- **fonts** — Font family names from typography tokens + hint to link fonts via URL (e.g. Google Fonts); no need to download or add font files to the repo.
|
|
166
76
|
- **skill** — `path` (e.g. `.cursor/skills/atomix-ds/SKILL.md`) and `content` (generic, platform-agnostic SKILL.md).
|
|
167
|
-
- **
|
|
168
|
-
- **tokenFiles** — e.g. `["tokens.css", "tokens.json"]` with short copy instructions.
|
|
77
|
+
- **tokenFiles** — e.g. `["tokens.css", "tokens.json"]` with copy instructions.
|
|
169
78
|
|
|
170
|
-
If the design system
|
|
79
|
+
If the design system is unavailable, the tool may fail; the client should tell the user the design system could not be reached.
|
|
171
80
|
|
|
172
81
|
## MCP Prompts
|
|
173
82
|
|
|
174
|
-
|
|
83
|
+
Run these prompts from your AI tool (e.g. **/--hello**, **/--getstarted**):
|
|
175
84
|
|
|
176
85
|
| Prompt | Description |
|
|
177
86
|
|--------|-------------|
|
|
178
87
|
| **/--hello** | Get started — overview, tokens, and tools. Run this first. |
|
|
179
|
-
| **/--
|
|
88
|
+
| **/--getstarted** | Get started with design system in project. Three phases; creates files only after you approve. |
|
|
180
89
|
| **/--rules** | Governance rules for your AI tool (Cursor, Copilot, Windsurf, etc.). |
|
|
181
90
|
| **/--sync** | Sync tokens to a local file. Use **/--refactor** to migrate deprecated tokens. |
|
|
182
91
|
| **/--refactor** | Migrate deprecated tokens in codebase. Run after **/--sync**. |
|
|
183
92
|
|
|
184
|
-
## --
|
|
93
|
+
## --getstarted (get started)
|
|
185
94
|
|
|
186
|
-
The
|
|
95
|
+
The **/--getstarted** prompt suggests dependencies for your design system so you can get up and running quickly. It does **not** install anything by default; the AI presents a list and asks before making changes.
|
|
187
96
|
|
|
188
97
|
**Flow (phased instructions):**
|
|
189
98
|
|
|
190
99
|
1. **Resolve platform and stack** — Infer from the project (e.g. `package.json`, `build.gradle`) or **ask the user** if the project gives no hint (e.g. blank repo). Do not assume web or any default.
|
|
191
|
-
2. **Get suggested dependencies** — Call `getDependencies(platform, stack)`. If the call fails
|
|
100
|
+
2. **Get suggested dependencies** — Call `getDependencies(platform, stack)`. If the call fails, tell the user the design system could not be reached and stop.
|
|
192
101
|
3. **Scan codebase and build suggestion list** — Scan for `package.json` (or equivalent), existing skill path, token files, font/icon usage. Build **Suggested dependencies** (from getDependencies minus what's present) and **Already present**. Do not install or copy anything in this phase.
|
|
193
102
|
4. **Present list and ask before install** — Reply with "Suggested dependencies: …" and "Already present: …" and state: "Do not install or copy anything until you confirm. Would you like me to install or add these?" Only perform steps the user approves.
|
|
194
|
-
5. **Optional: suggest global
|
|
195
|
-
6. **Report what was created** — After any install/copy steps, list what was created or updated (e.g. "Installed: lucide-react. Added: .cursor/skills/atomix-ds/SKILL.md.
|
|
103
|
+
5. **Optional: suggest global typeset** — If the project has no global styles that use the design system tokens, offer to build a full typeset (Display, Heading, body, caption) from the DS typography tokens via getToken/listTokens, including fontFamily, fontSize, fontWeight, lineHeight, letterSpacing—not just font imports.
|
|
104
|
+
6. **Report what was created** — After any install/copy steps, list what was created or updated (e.g. "Installed: lucide-react. Added: .cursor/skills/atomix-ds/SKILL.md. Synced: tokens.css.").
|
|
196
105
|
|
|
197
|
-
**Single SKILL.md:** The
|
|
106
|
+
**Single SKILL.md:** The getstarted flow suggests adding a generic, coding-platform agnostic SKILL at `.cursor/skills/atomix-ds/SKILL.md`. It instructs the AI to call `getAIToolRules({ tool: "<tool>" })` where `<tool>` matches the current environment (cursor, windsurf, copilot, cline, continue, zed, generic).
|
|
198
107
|
|
|
199
108
|
## Token Categories
|
|
200
109
|
|
|
@@ -208,9 +117,91 @@ The **--setup** prompt suggests dependencies for your design system so you can g
|
|
|
208
117
|
- **motion** — Duration and easing tokens
|
|
209
118
|
- **zIndex** — Layer tokens
|
|
210
119
|
|
|
211
|
-
##
|
|
120
|
+
## Example Usage (MCP)
|
|
121
|
+
|
|
122
|
+
Once MCP is connected, you can say:
|
|
123
|
+
|
|
124
|
+
> "Sync my design tokens to tokens.css"
|
|
125
|
+
|
|
126
|
+
> "What color tokens are available?"
|
|
127
|
+
|
|
128
|
+
> "Use the correct spacing token for 16px padding"
|
|
129
|
+
|
|
130
|
+
> "Validate this: style={{ backgroundColor: '#007061' }}"
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## CLI
|
|
135
|
+
|
|
136
|
+
Use the CLI when you prefer commands over the AI, or in scripts/CI.
|
|
137
|
+
|
|
138
|
+
### Quick Start (CLI)
|
|
212
139
|
|
|
213
|
-
|
|
140
|
+
```bash
|
|
141
|
+
# Sync tokens + AI rules (default behavior)
|
|
142
|
+
npx heyatomix sync
|
|
143
|
+
|
|
144
|
+
# Sync tokens only (skip AI rules)
|
|
145
|
+
npx heyatomix sync --no-rules
|
|
146
|
+
|
|
147
|
+
# Create config file
|
|
148
|
+
npx heyatomix init
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### `heyatomix sync`
|
|
152
|
+
|
|
153
|
+
Sync design tokens and AI rules to your project. **Both tokens and AI guidance rules sync by default** since the rules reference tokens.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npx heyatomix sync # Sync tokens + AI rules
|
|
157
|
+
npx heyatomix sync --no-rules # Sync tokens only
|
|
158
|
+
npx heyatomix sync -o src/tokens.css # Custom output path
|
|
159
|
+
npx heyatomix sync --format scss # Output as SCSS
|
|
160
|
+
npx heyatomix sync -y # Auto-confirm changes
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**File structure:** The output file (e.g., `tokens.css`) is **completely rewritten** on each sync. Preserved: CSS custom properties (variables). Lost: regular CSS rules (selectors, classes, media queries). Keep your tokens file separate from custom CSS (e.g. use `custom.css` for custom styles).
|
|
164
|
+
|
|
165
|
+
### `heyatomix init`
|
|
166
|
+
|
|
167
|
+
Create a `.atomixrc` config file:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx heyatomix init
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Creates:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"dsId": "your-design-system-id",
|
|
178
|
+
"output": "./tokens.css",
|
|
179
|
+
"format": "css"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### CLI Options
|
|
184
|
+
|
|
185
|
+
| Option | Description |
|
|
186
|
+
|--------|-------------|
|
|
187
|
+
| `--ds-id` | Design system ID (or set in .atomixrc) |
|
|
188
|
+
| `--api-key` | API key for private design systems |
|
|
189
|
+
| `--output, -o` | Output file path [./tokens.css] |
|
|
190
|
+
| `--format` | Output format (see below) |
|
|
191
|
+
| `--no-rules` | Skip syncing AI rules (tokens + rules sync by default) |
|
|
192
|
+
| `--rules-dir` | Directory for rules files [project root] |
|
|
193
|
+
| `-y, --yes` | Auto-confirm changes |
|
|
194
|
+
|
|
195
|
+
### Output Formats
|
|
196
|
+
|
|
197
|
+
**Web:** `css`, `scss`, `less`, `json`, `ts`, `js`
|
|
198
|
+
**Native:** `swift`, `kotlin`, `dart`
|
|
199
|
+
|
|
200
|
+
All formats include **light and dark mode** values.
|
|
201
|
+
|
|
202
|
+
### AI Rules Files (CLI)
|
|
203
|
+
|
|
204
|
+
By default, `sync` also updates AI rules files:
|
|
214
205
|
|
|
215
206
|
| File | AI Tool |
|
|
216
207
|
|------|---------|
|
|
@@ -221,25 +212,13 @@ By default, `sync` also updates AI rules files based on which AI tools you use:
|
|
|
221
212
|
| `.github/copilot-instructions.md` | Copilot |
|
|
222
213
|
| `AI_GUIDELINES.md` | Generic |
|
|
223
214
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
## Example Usage
|
|
227
|
-
|
|
228
|
-
**CLI:**
|
|
215
|
+
### Example Usage (CLI)
|
|
229
216
|
|
|
230
217
|
```bash
|
|
231
218
|
npx heyatomix sync
|
|
232
219
|
```
|
|
233
220
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
> "Sync my design tokens to tokens.css"
|
|
237
|
-
|
|
238
|
-
> "What color tokens are available?"
|
|
239
|
-
|
|
240
|
-
> "Use the correct spacing token for 16px padding"
|
|
241
|
-
|
|
242
|
-
> "Validate this: style={{ backgroundColor: '#007061' }}"
|
|
221
|
+
---
|
|
243
222
|
|
|
244
223
|
## Package Aliases
|
|
245
224
|
|
package/dist/index.js
CHANGED
|
@@ -1345,7 +1345,7 @@ var TOKEN_CATEGORIES = ["colors", "typography", "spacing", "sizing", "shadows",
|
|
|
1345
1345
|
var server = new Server(
|
|
1346
1346
|
{
|
|
1347
1347
|
name: "atomix-mcp-user",
|
|
1348
|
-
version: "1.0.
|
|
1348
|
+
version: "1.0.17"
|
|
1349
1349
|
},
|
|
1350
1350
|
{
|
|
1351
1351
|
capabilities: {
|
|
@@ -1490,7 +1490,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
1490
1490
|
},
|
|
1491
1491
|
{
|
|
1492
1492
|
name: "getDependencies",
|
|
1493
|
-
description: "Get suggested dependencies for this design system (icon package, fonts, SKILL.md, token files). Use with
|
|
1493
|
+
description: "Get suggested dependencies for this design system (icon package, fonts, SKILL.md, token files). Use with /--getstarted prompt. Optional platform and stack for tailored suggestions.",
|
|
1494
1494
|
inputSchema: {
|
|
1495
1495
|
type: "object",
|
|
1496
1496
|
properties: {
|
|
@@ -2053,11 +2053,13 @@ Last updated: ${lastUpdated}`
|
|
|
2053
2053
|
iconLibrary: {
|
|
2054
2054
|
package: iconPkgs.web,
|
|
2055
2055
|
nativePackage: iconPkgs.native,
|
|
2056
|
-
|
|
2056
|
+
strokeWidthToken: icons?.strokeWidth != null ? "icons.strokeWidth" : void 0,
|
|
2057
|
+
strokeWidthValue: icons?.strokeWidth,
|
|
2058
|
+
performanceHint: "Use individual SVG imports for tree-shaking. Apply the design system's icon tokens: sizing via getToken('sizing.icon.sm') or listTokens('sizing'), and stroke width via getToken('icons.strokeWidth') when the DS defines it. Do not use hardcoded sizes or stroke widths."
|
|
2057
2059
|
},
|
|
2058
2060
|
fonts: {
|
|
2059
2061
|
families: fontNames,
|
|
2060
|
-
performanceHint: "
|
|
2062
|
+
performanceHint: "Link fonts via URL (e.g. Google Fonts <link> or CSS @import); no need to download font files or add them to the repo. Prefer font-display: swap when possible. You must also build a typeset: CSS rules (e.g. .typeset-display, .typeset-heading, .typeset-body) that use var(--atmx-typography-*) for font-family, font-size, font-weight, line-height, letter-spacing from getToken/listTokens(typography). Do not create a file that only contains a font import."
|
|
2061
2063
|
},
|
|
2062
2064
|
skill: {
|
|
2063
2065
|
path: ".cursor/skills/atomix-ds/SKILL.md",
|
|
@@ -2067,6 +2069,11 @@ Last updated: ${lastUpdated}`
|
|
|
2067
2069
|
files: ["tokens.css", "tokens.json"],
|
|
2068
2070
|
copyInstructions: "Call the syncTokens MCP tool to create the token file; do not only suggest the user run sync later."
|
|
2069
2071
|
},
|
|
2072
|
+
showcase: platform === "web" || !platform ? {
|
|
2073
|
+
path: "atomix-setup-showcase.html",
|
|
2074
|
+
template: SHOWCASE_HTML_TEMPLATE,
|
|
2075
|
+
substitutionInstructions: "Replace placeholders with values from the synced token file. MCP/sync/export use the --atmx- prefix. {{TOKENS_CSS_PATH}} = path to the synced token file (e.g. ./tokens.css, same as syncTokens output). {{DS_NAME}} = design system name. {{BRAND_PRIMARY_VAR}} = var(--atmx-color-brand-primary). {{BRAND_PRIMARY_FOREGROUND_VAR}} = var(--atmx-color-brand-primary-foreground). {{HEADING_FONT_VAR}} = var(--atmx-typography-font-family-heading) or var(--atmx-typography-font-family-display). {{FONT_FAMILY_VAR}} = var(--atmx-typography-font-family-body). {{FONT_LINK_TAG}} = Google Fonts <link> for the font, or empty string. Do not invent CSS variable names; use only vars that exist in the export."
|
|
2076
|
+
} : void 0,
|
|
2070
2077
|
meta: { dsName: data.meta.name, platform: platform ?? void 0, stack: stack ?? void 0 }
|
|
2071
2078
|
};
|
|
2072
2079
|
return {
|
|
@@ -2126,35 +2133,109 @@ Last updated: ${lastUpdated}`
|
|
|
2126
2133
|
});
|
|
2127
2134
|
var GENERIC_SKILL_MD = `---
|
|
2128
2135
|
name: atomix-ds
|
|
2129
|
-
description: Use
|
|
2136
|
+
description: Use the Atomix design system for UI, tokens, and styles. Fetch rules and tokens via MCP tools; never hardcode design values.
|
|
2130
2137
|
---
|
|
2131
2138
|
|
|
2132
2139
|
# Atomix Design System
|
|
2133
2140
|
|
|
2141
|
+
Use this skill when editing UI, design system files, or when the user asks to follow the project's design system. Your job is to **get the relevant data from the design system via MCP** and apply it\u2014not to guess or invent values.
|
|
2142
|
+
|
|
2143
|
+
## Goal
|
|
2144
|
+
|
|
2145
|
+
Complete the user's task using the design system as the single source of truth. Every color, spacing, typography, radius, shadow, or sizing value must come from the MCP tools (tokens or governance rules). Do not hardcode hex codes, pixel values, or font names.
|
|
2146
|
+
|
|
2134
2147
|
## When to use
|
|
2135
2148
|
|
|
2136
|
-
-
|
|
2137
|
-
- Working in design system or token files
|
|
2138
|
-
- User asks to follow the
|
|
2149
|
+
- Building or editing UI components, pages, or styles
|
|
2150
|
+
- Working in design system or token files (e.g. \`tokens.css\`, theme files)
|
|
2151
|
+
- User asks to "follow the design system", "use tokens", or "match the DS"
|
|
2152
|
+
- Validating or refactoring existing code, UI or visual design for token compliance
|
|
2139
2153
|
|
|
2140
|
-
## How to
|
|
2154
|
+
## How to get design system data
|
|
2141
2155
|
|
|
2142
|
-
1.
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
- **cline** (Cline)
|
|
2147
|
-
- **continue** (Continue)
|
|
2148
|
-
- **zed** (Zed)
|
|
2149
|
-
- **generic** (other tools)
|
|
2156
|
+
**1. Governance rules (how to use tokens in code)**
|
|
2157
|
+
Call **getAIToolRules** with the tool id for your current environment: \`cursor\`, \`windsurf\`, \`copilot\`, \`cline\`, \`continue\`, \`zed\`, or \`generic\`.
|
|
2158
|
+
Example: \`getAIToolRules({ tool: "cursor" })\`.
|
|
2159
|
+
Alternatively use the **/--rules** prompt or the resource \`atomix://rules/<tool>\`.
|
|
2150
2160
|
|
|
2151
|
-
|
|
2161
|
+
**2. Token values (what to use in code)**
|
|
2162
|
+
- **getToken(path)** \u2014 One token by path (e.g. \`colors.brand.primary\`, \`typography.fontSize.lg\`, \`sizing.icon.sm\`, \`icons.strokeWidth\`). Icon stroke width is at \`icons.strokeWidth\` when the design system defines it.
|
|
2163
|
+
- **listTokens(category)** \u2014 All tokens in a category: \`colors\`, \`typography\`, \`spacing\`, \`sizing\`, \`shadows\`, \`radius\`, \`borders\`, \`motion\`, \`zIndex\`. For icon config (e.g. stroke width), use \`getToken("icons.strokeWidth")\` since \`icons\` is not a list category.
|
|
2164
|
+
- **searchTokens(query)** \u2014 Find tokens by name or value.
|
|
2152
2165
|
|
|
2153
|
-
|
|
2166
|
+
**3. Validation**
|
|
2167
|
+
- **validateUsage(value, context)** \u2014 Check if a CSS/value should use a token instead (e.g. \`validateUsage("#007061", "color")\`).
|
|
2154
2168
|
|
|
2155
|
-
|
|
2169
|
+
**4. Syncing tokens to a file**
|
|
2170
|
+
- **syncTokens({ output, format })** \u2014 Writes the current design system tokens to a file (e.g. \`./tokens.css\`). Use when the user wants a local token file.
|
|
2156
2171
|
|
|
2157
|
-
|
|
2172
|
+
Use the returned rules and token paths/values when generating or editing code. Prefer CSS variables (e.g. \`var(--atmx-*)\`) or the exact token references from the tools.
|
|
2173
|
+
|
|
2174
|
+
## Best practices
|
|
2175
|
+
|
|
2176
|
+
- **Fetch first:** Before writing UI or styles, call getAIToolRules and/or getToken/listTokens so you know the exact tokens and conventions.
|
|
2177
|
+
- **Icons:** Apply the design system's icon tokens when rendering icons: sizing via \`getToken("sizing.icon.sm")\` or \`listTokens("sizing")\`, and stroke width via \`getToken("icons.strokeWidth")\` when the DS defines it; do not use hardcoded sizes or stroke widths.
|
|
2178
|
+
- **Typography:** Use typography tokens (fontFamily, fontSize, fontWeight, lineHeight, letterSpacing) from the DS for any text; build typesets (Display, Heading, body) from those tokens when creating global styles.
|
|
2179
|
+
- **No guessing:** If a value is not in the rules or token list, use searchTokens or listTokens to find the closest match rather than inventing a value.
|
|
2180
|
+
`;
|
|
2181
|
+
var SHOWCASE_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
2182
|
+
<html lang="en">
|
|
2183
|
+
<head>
|
|
2184
|
+
<meta charset="UTF-8">
|
|
2185
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2186
|
+
<title>Setup complete \u2014 {{DS_NAME}}</title>
|
|
2187
|
+
{{FONT_LINK_TAG}}
|
|
2188
|
+
<link rel="stylesheet" href="{{TOKENS_CSS_PATH}}">
|
|
2189
|
+
<style>
|
|
2190
|
+
* { box-sizing: border-box; }
|
|
2191
|
+
body {
|
|
2192
|
+
margin: 0;
|
|
2193
|
+
font-family: {{FONT_FAMILY_VAR}}, system-ui, sans-serif;
|
|
2194
|
+
background: {{BRAND_PRIMARY_VAR}};
|
|
2195
|
+
color: {{BRAND_PRIMARY_FOREGROUND_VAR}};
|
|
2196
|
+
min-height: 100vh;
|
|
2197
|
+
padding: 2rem;
|
|
2198
|
+
display: flex;
|
|
2199
|
+
align-items: center;
|
|
2200
|
+
justify-content: center;
|
|
2201
|
+
text-align: center;
|
|
2202
|
+
}
|
|
2203
|
+
.wrap { width: 375px; max-width: 100%; }
|
|
2204
|
+
.icon { width: 2rem; height: 2rem; margin: 0 auto 1rem; }
|
|
2205
|
+
h1 {
|
|
2206
|
+
font-family: {{HEADING_FONT_VAR}}, {{FONT_FAMILY_VAR}}, system-ui, sans-serif;
|
|
2207
|
+
font-size: clamp(1.5rem, 4vw, 2.25rem);
|
|
2208
|
+
font-weight: 700;
|
|
2209
|
+
margin: 0 0 0.75rem;
|
|
2210
|
+
line-height: 1.25;
|
|
2211
|
+
}
|
|
2212
|
+
.lead { margin: 0 0 1.5rem; font-size: 1rem; line-height: 1.5; opacity: 0.95; }
|
|
2213
|
+
.now { margin: 1.5rem 0 0; font-size: 0.875rem; line-height: 1.6; opacity: 0.95; text-align: left; }
|
|
2214
|
+
.now strong { display: block; margin-bottom: 0.5rem; }
|
|
2215
|
+
.now ul { margin: 0; padding-left: 1.25rem; }
|
|
2216
|
+
.tips { margin-top: 1.5rem; font-size: 0.875rem; line-height: 1.6; opacity: 0.9; }
|
|
2217
|
+
.tips a { color: inherit; text-decoration: underline; }
|
|
2218
|
+
</style>
|
|
2219
|
+
</head>
|
|
2220
|
+
<body>
|
|
2221
|
+
<div class="wrap">
|
|
2222
|
+
<div class="icon" aria-hidden="true">
|
|
2223
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="32" height="32"><path d="M20 6L9 17l-5-5"/></svg>
|
|
2224
|
+
</div>
|
|
2225
|
+
<h1>You're all set with {{DS_NAME}}</h1>
|
|
2226
|
+
<p class="lead">This page uses your design system: brand primary as background, headline and body typesets, and an icon. Token file is linked above.</p>
|
|
2227
|
+
<div class="now">
|
|
2228
|
+
<strong>What you can do now:</strong>
|
|
2229
|
+
<ul>
|
|
2230
|
+
<li>Ask your agent to build your designs using the design system tokens</li>
|
|
2231
|
+
<li>Build components and pages that use <code>var(--atmx-*)</code> for colors, spacing, and typography</li>
|
|
2232
|
+
<li>Run <code>/--rules</code> to load governance rules; run <code>/--sync</code> and <code>/--refactor</code> after you change tokens in Atomix Studio</li>
|
|
2233
|
+
</ul>
|
|
2234
|
+
</div>
|
|
2235
|
+
<p class="tips">Keep the source of truth at <a href="https://atomixstudio.eu" target="_blank" rel="noopener">atomixstudio.eu</a> \u2014 avoid editing token values in this repo.</p>
|
|
2236
|
+
</div>
|
|
2237
|
+
</body>
|
|
2238
|
+
</html>
|
|
2158
2239
|
`;
|
|
2159
2240
|
var AI_TOOLS = ["cursor", "copilot", "windsurf", "cline", "continue", "zed", "generic"];
|
|
2160
2241
|
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
@@ -2240,21 +2321,8 @@ Get your DS ID from: https://atomixstudio.eu/ds/[your-ds-id]`
|
|
|
2240
2321
|
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
2241
2322
|
const prompts = [
|
|
2242
2323
|
{ name: "--hello", description: "Get started with this design system - overview, tokens, and tools. Run this first!" },
|
|
2243
|
-
{
|
|
2244
|
-
|
|
2245
|
-
description: "Setup design system in project. Three phases: scan, report and ask, then create only after you approve.",
|
|
2246
|
-
arguments: [
|
|
2247
|
-
{ name: "platform", description: "Target platform (web, ios, android). Optional.", required: false },
|
|
2248
|
-
{ name: "stack", description: "Stack or framework (e.g. react, vue, next, swift, kotlin). Optional.", required: false }
|
|
2249
|
-
]
|
|
2250
|
-
},
|
|
2251
|
-
{
|
|
2252
|
-
name: "--rules",
|
|
2253
|
-
description: "Get the design system governance rules for your AI coding tool",
|
|
2254
|
-
arguments: [
|
|
2255
|
-
{ name: "tool", description: "AI tool (cursor, copilot, windsurf, cline, continue, zed, generic). Optional.", required: false }
|
|
2256
|
-
]
|
|
2257
|
-
},
|
|
2324
|
+
{ name: "--getstarted", description: "Get started with design system in project. Three phases: scan, report and ask, then create only after you approve." },
|
|
2325
|
+
{ name: "--rules", description: "Get the design system governance rules for your AI coding tool (default: cursor)." },
|
|
2258
2326
|
{ name: "--sync", description: "Sync tokens to a local file. Safe: adds new, updates existing, marks deprecated. Use /--refactor to migrate." },
|
|
2259
2327
|
{ name: "--refactor", description: "Migrate deprecated tokens in codebase. Run after /--sync." }
|
|
2260
2328
|
];
|
|
@@ -2262,7 +2330,7 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
|
2262
2330
|
});
|
|
2263
2331
|
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
2264
2332
|
const { name, arguments: args } = request.params;
|
|
2265
|
-
const canonicalName = name === "--hello" ? "hello" : name === "--
|
|
2333
|
+
const canonicalName = name === "--hello" ? "hello" : name === "--getstarted" ? "atomix-setup" : name === "--rules" ? "design-system-rules" : name === "--sync" ? "sync" : name === "--refactor" ? "refactor" : name;
|
|
2266
2334
|
const shouldForceRefresh = canonicalName === "sync";
|
|
2267
2335
|
let data = null;
|
|
2268
2336
|
let stats = null;
|
|
@@ -2694,49 +2762,45 @@ Use \`/color\`, \`/spacing\`, \`/radius\`, \`/typography\`, \`/shadow\`, \`/bord
|
|
|
2694
2762
|
};
|
|
2695
2763
|
}
|
|
2696
2764
|
case "atomix-setup": {
|
|
2697
|
-
const setupInstructions = `You are running **
|
|
2765
|
+
const setupInstructions = `You are running **/--getstarted** (get started with design system). Three phases only.
|
|
2698
2766
|
|
|
2699
|
-
**Rule:** Do not create, write, or modify any file until Phase 3 and only after the user has explicitly approved (e.g.
|
|
2767
|
+
**Rule:** Do not create, write, or modify any file until Phase 3 and only after the user has explicitly approved (e.g. "Yes", "Yes for all", "Go ahead").
|
|
2700
2768
|
|
|
2701
2769
|
## Todo list (required)
|
|
2702
2770
|
|
|
2703
|
-
-
|
|
2704
|
-
- Work **step by step**: complete Phase 1, then Phase 2; do not run Phase 3 until the user has replied with approval.
|
|
2705
|
-
- Mark todo items completed as you finish each phase. Use this pattern so the user and you can track progress.
|
|
2771
|
+
- Create a todo list at the start: Phase 1, Phase 2, Phase 3. Work step by step; do not run Phase 3 until the user has replied with approval. Mark items completed as you go.
|
|
2706
2772
|
|
|
2707
2773
|
## Phase 1 \u2013 Scan
|
|
2708
2774
|
|
|
2709
|
-
- Resolve platform/stack: infer from the project (e.g. package.json, build.gradle, Xcode) or ask
|
|
2710
|
-
- Call
|
|
2711
|
-
- Scan the repo for
|
|
2712
|
-
- **
|
|
2713
|
-
- **Native (iOS/Android):** Scan for existing theme or style files (e.g. SwiftUI theme/asset catalog, Android themes.xml/styles.xml, Compose theme). Note whether the project already has a theme or style setup.
|
|
2714
|
-
- Build two lists: **Suggested** (from getDependencies minus what exists) and **Already present**. Only include: icon package, fonts, skill (.cursor/skills/atomix-ds/SKILL.md), token files. No MCP.
|
|
2775
|
+
- Resolve platform/stack: infer from the project (e.g. package.json, build.gradle, Xcode) or ask once: "Which platform? (e.g. web, Android, iOS)" and if relevant "Which stack? (e.g. React, Vue, Next, Swift, Kotlin)." Do not assume a default.
|
|
2776
|
+
- Call **getDependencies** with \`platform\` and optional \`stack\`. If it fails, tell the user the design system could not be reached and stop.
|
|
2777
|
+
- Scan the repo for: .cursor/skills/atomix-ds/SKILL.md, a tokens file (e.g. tokens.css or src/tokens.css), icon package from getDependencies, font links. **Web:** note any existing CSS (globals.css, main.css, Tailwind, etc.). **Native:** note any theme/style files (SwiftUI, Android themes, Compose).
|
|
2778
|
+
- Build two lists: **Suggested** (from getDependencies minus what exists) and **Already present**. Include: icon package, font links, skill (.cursor/skills/atomix-ds/SKILL.md), token files; for web, also include the **showcase page** (atomix-setup-showcase.html) if getDependencies returned a \`showcase\` object.
|
|
2715
2779
|
- Do not write, create, or add anything in Phase 1.
|
|
2716
2780
|
|
|
2717
|
-
## Phase 2 \u2013 Report and ask
|
|
2781
|
+
## Phase 2 \u2013 Report and ask
|
|
2718
2782
|
|
|
2719
2783
|
- Reply with: **Suggested:** [list] and **Already present:** [list].
|
|
2720
|
-
- Ask exactly once: "Do you want me to add the suggested items? (Yes for all, or say which ones.)"
|
|
2721
|
-
- **Stop.** Do not run Phase 3 in this response.
|
|
2784
|
+
- Ask exactly once: "Do you want me to add the suggested items? (Yes for all, or say which ones.)"
|
|
2785
|
+
- **Stop.** Wait for the user to reply. Do not run Phase 3 in this response.
|
|
2722
2786
|
|
|
2723
|
-
## Phase 3 \u2013 Create
|
|
2787
|
+
## Phase 3 \u2013 Create (only after user approval)
|
|
2724
2788
|
|
|
2725
2789
|
- Run only when the user has said yes (all or specific items).
|
|
2726
2790
|
- For each approved item:
|
|
2727
2791
|
- **Skill:** Write the skill content from getDependencies to .cursor/skills/atomix-ds/SKILL.md.
|
|
2728
|
-
- **Token file:** Call
|
|
2729
|
-
- **Icon package
|
|
2730
|
-
-
|
|
2731
|
-
- **After
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
Create your todo list first, then
|
|
2792
|
+
- **Token file:** Call **syncTokens** with \`output\` set to the path (e.g. "./src/tokens.css" or "./tokens.css"). You must call syncTokens; do not only suggest the user run it later.
|
|
2793
|
+
- **Icon package:** Install per getDependencies. When rendering icons, apply the design system's icon tokens: use getToken(\`sizing.icon.*\`) or listTokens(\`sizing\`) for size, and getToken(\`icons.strokeWidth\`) for stroke width when the DS defines it; do not use hardcoded sizes or stroke widths.
|
|
2794
|
+
- **Fonts and typeset:** Add font links (e.g. \`<link>\` or \`@import\` from Google Fonts). Then build a **typeset** in CSS: use **getToken** / **listTokens** (category \`typography\`) to get fontFamily, fontSize, fontWeight, lineHeight, letterSpacing for display, heading, and body, and write CSS rules (e.g. \`.typeset-display\`, \`.typeset-heading\`, \`.typeset-body\`, or \`h1\`/\`h2\`/\`p\`) that set those properties to \`var(--atmx-typography-*)\`. The typeset file (or section) must define the full type scale\u2014not only a font import. Do not create a CSS file that contains only a font import.
|
|
2795
|
+
- **Showcase page (web only):** If platform is web and getDependencies returned a \`showcase\` object, create the file at \`showcase.path\` using \`showcase.template\`. Replace every placeholder per \`showcase.substitutionInstructions\`: TOKENS_CSS_PATH, DS_NAME, BRAND_PRIMARY_VAR (page background), BRAND_PRIMARY_FOREGROUND_VAR (text on brand), HEADING_FONT_VAR (h1), FONT_FAMILY_VAR (body), FONT_LINK_TAG. Use only CSS variable names that exist in the synced token file. Do not change the HTML structure. After creating the file, launch it in the default browser (e.g. \`open atomix-setup-showcase.html\` on macOS, \`xdg-open atomix-setup-showcase.html\` on Linux, or the equivalent on Windows).
|
|
2796
|
+
- Report only what you actually created or updated. Do not claim the token file was added if you did not call syncTokens.
|
|
2797
|
+
- **After reporting \u2013 styles/theme:**
|
|
2798
|
+
- **Web:** If the project already has at least one CSS file: recommend how to integrate Atomix (e.g. import the synced tokens file, use \`var(--atmx-*)\`). Do not suggest a new global CSS. Only if there is **no** CSS file at all, ask once: "There are no CSS files yet. Do you want me to build a global typeset from the design system?" If yes, create a CSS file that includes: (1) font \`@import\` or document that a font link is needed, and (2) **typeset rules**\u2014CSS classes or element rules that set font-family, font-size, font-weight, line-height, letter-spacing using \`var(--atmx-typography-*)\` from the token file (e.g. \`.typeset-display\`, \`.typeset-heading\`, \`.typeset-body\`). You must call getToken/listTokens to get the exact typography token paths and write the corresponding var() references. The output must not be only a font import; it must define the full typeset (Display, Heading, body) with every style detail from the design system.
|
|
2799
|
+
- **iOS/Android:** If the project already has theme/style files: recommend how to integrate Atomix tokens. Do not suggest a new global theme. Only if there is **no** theme/style at all, ask once: "There's no theme/style setup yet. Do you want a minimal token-based theme?" and add only if the user says yes.
|
|
2800
|
+
|
|
2801
|
+
Create your todo list first, then Phase 1 (resolve platform/stack, call getDependencies, scan, build lists), then Phase 2 (report and ask). Do not perform Phase 3 until the user replies.`;
|
|
2738
2802
|
return {
|
|
2739
|
-
description: "
|
|
2803
|
+
description: "Get started with design system in project (/--getstarted). Create todo list; Phase 1 scan, Phase 2 report and ask, Phase 3 create only after user approval.",
|
|
2740
2804
|
messages: [
|
|
2741
2805
|
{
|
|
2742
2806
|
role: "user",
|
|
@@ -2807,12 +2871,12 @@ ${tokenSummary}
|
|
|
2807
2871
|
| Command | What to expect |
|
|
2808
2872
|
|---------|----------------|
|
|
2809
2873
|
| **/--hello** | Get started - overview, tokens, and tools. Run this first! |
|
|
2810
|
-
| **/--
|
|
2874
|
+
| **/--getstarted** | Get started with design system in project. Three phases; creates files only after you approve. |
|
|
2811
2875
|
| **/--rules** | Governance rules for your AI tool (Cursor, Copilot, Windsurf, etc.). |
|
|
2812
2876
|
| **/--sync** | Sync tokens to a local file. Safe: adds new, updates existing, marks deprecated. |
|
|
2813
2877
|
| **/--refactor** | Migrate deprecated tokens in codebase. Run after /--sync. |
|
|
2814
2878
|
|
|
2815
|
-
**Suggested next step:** Run **/--
|
|
2879
|
+
**Suggested next step:** Run **/--getstarted** to set up global styles, icons, fonts, and token files; the AI will list options and ask before adding anything.
|
|
2816
2880
|
|
|
2817
2881
|
---
|
|
2818
2882
|
|