@csszyx/mcp-server 0.10.5 → 0.10.7

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.mjs CHANGED
@@ -6,7 +6,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
7
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } from '@modelcontextprotocol/sdk/types.js';
8
8
  import fs from 'node:fs';
9
- import { SPECIAL_VARIANTS, KNOWN_VARIANTS, PROPERTY_MAP, transform, SUGGESTION_MAP, BOOLEAN_SHORTHANDS } from '@csszyx/compiler';
9
+ import { SPECIAL_VARIANTS, KNOWN_VARIANTS, PROPERTY_MAP, transform, SUGGESTION_MAP, BOOLEAN_SHORTHANDS, REMOVED_BOOLEAN_SUGAR } from '@csszyx/compiler';
10
10
  import { z } from 'zod';
11
11
  import { migrateSource, classNameToSzObject } from '@csszyx/cli';
12
12
  import { parseThemeBlocks, hasTokens } from '@csszyx/unplugin';
@@ -112,8 +112,22 @@ Key csszyx syntax:
112
112
  }
113
113
  }
114
114
 
115
- const packageRoot = path.resolve(fileURLToPath(import.meta.url), "../../..");
116
- const LLMS_FULL_PATH = path.join(packageRoot, "llms-full.txt");
115
+ function resolveLlmsFullPath() {
116
+ let dir = path.dirname(fileURLToPath(import.meta.url));
117
+ for (let i = 0; i < 6; i++) {
118
+ const candidate = path.join(dir, "llms-full.txt");
119
+ if (fs.existsSync(candidate)) {
120
+ return candidate;
121
+ }
122
+ const parent = path.dirname(dir);
123
+ if (parent === dir) {
124
+ break;
125
+ }
126
+ dir = parent;
127
+ }
128
+ return path.resolve(fileURLToPath(import.meta.url), "../../..", "llms-full.txt");
129
+ }
130
+ const LLMS_FULL_PATH = resolveLlmsFullPath();
117
131
  const SETUP_GUIDE = `# csszyx setup
118
132
 
119
133
  Fastest path: run \`csszyx init\` (it does everything below). Manual steps:
@@ -178,6 +192,28 @@ Without it: \`Property 'sz' does not exist on type 'DetailedHTMLProps<...>'\`.
178
192
  \`\`\`tsx
179
193
  <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
180
194
  \`\`\`
195
+
196
+ ## Troubleshooting
197
+ - **"No prebuilt native binary" warning / \`native engine unavailable\`**: the
198
+ default \`rust\` parser's native binary is missing (unsupported arch, optional
199
+ deps omitted, or a cross-platform frozen lockfile). It is NOT broken and classes
200
+ are UNCHANGED \u2014 all three engines (rust/oxc/babel) emit identical output
201
+ (parity-gated). If you only use the default, csszyx auto-falls back to \`oxc\` and
202
+ the build succeeds; ignore the warning or set \`build.parser: 'oxc'\` to silence
203
+ it. Only an EXPLICIT \`parser:'rust'\` hard-fails. Do NOT tell the user to debug
204
+ their styles over this.
205
+ - **A class generates no CSS**: it wasn't safelisted. The file must contain a
206
+ statically analyzable \`sz=\` or \`szv(\` (the prescan qualifies files by those
207
+ tokens). Arbitrary values (\`m:'20px'\`\u2192\`m-[20px]\`) and large numbers
208
+ (\`p:100\`\u2192\`p-100\`) DO work \u2014 a missing class is a safelisting issue, not a
209
+ lowering one. For a sibling workspace package, opt it in with
210
+ \`compileSources: ['packages/name']\`. In a monorepo, scope Tailwind to the
211
+ generated safelist file.
212
+ - **\`dynamic()\` vs build-time**: \`dynamic()\` is an escape hatch (runtime CSS
213
+ injection, not mangled) \u2014 use ONLY for values unknown at build (JSON/API/user
214
+ config). Literals and finite variant sets are build-time: \`sz\` / \`szv\`. To
215
+ resolve \`szv\` output to a className by hand, use \`szr\` (build-time-safe,
216
+ mangle-aware), not \`dynamic()\`.
181
217
  `;
182
218
  function listResources() {
183
219
  return [
@@ -551,6 +587,15 @@ function handleValidate(input) {
551
587
  });
552
588
  continue;
553
589
  }
590
+ const removed = REMOVED_BOOLEAN_SUGAR[key];
591
+ if (removed && input.sz[key] === true) {
592
+ errors.push({
593
+ key,
594
+ message: `'${key}: true' boolean sugar was removed; it emits no class.`,
595
+ suggestion: `Use { ${removed.key}: ${JSON.stringify(removed.value)} } instead.`
596
+ });
597
+ continue;
598
+ }
554
599
  const isProperty = key in PROPERTY_MAP;
555
600
  const isBoolean = BOOLEAN_SHORTHANDS.has(key);
556
601
  const isVariant = KNOWN_VARIANTS.has(key);
package/llms-full.txt CHANGED
@@ -3480,16 +3480,31 @@ SSR-safe: on the server, returns class names without CSSOM access.
3480
3480
 
3481
3481
  ## Runtime Helpers
3482
3482
 
3483
- For dynamic classes at runtime (the only runtime overhead):
3483
+ For dynamic classes at runtime (the only runtime overhead). Use these PUBLIC,
3484
+ hand-written names (no `_` prefix — `_`-prefixed helpers like `_sz`/`_szMerge`
3485
+ are compiler-injected, do not hand-author them):
3486
+
3487
+ - **`szr(...)`** — resolve sz OBJECT(s) and/or class strings → a mangle-aware
3488
+ className (concatenates, filters falsy). The hand-name for the injected `_sz`.
3489
+ Reach for it to build a className from `szv` factory output (e.g. a code-split
3490
+ layout that declares variants in a `.ts` module and resolves them in a `.tsx`).
3491
+ - **`szcn(...)`** — merge className STRINGS with last-wins override on a
3492
+ same-utility conflict, mangle-aware (the Box-level merge).
3493
+ - `szr` takes sz OBJECTS and concatenates; `szcn` takes STRINGS and overrides.
3484
3494
 
3485
3495
  ```tsx
3486
- import { _sz, _szMerge } from '@csszyx/runtime';
3496
+ import { szr, szv, szcn } from '@csszyx/runtime';
3497
+
3498
+ const cardSz = szv({ variants: { pad: { lg: { p: 8 } } } });
3499
+
3500
+ // Resolve szv factory output → className (the split / no-`sz=` use case)
3501
+ <div className={szr(cardSz({ pad: 'lg' }), isWide && stackSz({ gap: 'xl' }))} />
3487
3502
 
3488
3503
  // Concatenate class strings
3489
- <div className={_sz('base-class', conditionalClass)} />
3504
+ <div className={szr('base-class', conditionalClass)} />
3490
3505
 
3491
- // Conditional class — plain JS conditionals compose with _sz
3492
- <div className={_sz('base-class', isActive && 'active-class')} />
3506
+ // Conditional class — plain JS conditionals compose with szr
3507
+ <div className={szr('base-class', isActive && 'active-class')} />
3493
3508
  <div className={isActive ? 'active-class' : 'inactive-class'} />
3494
3509
 
3495
3510
  // Switch/enum — a plain object lookup
@@ -3499,8 +3514,8 @@ import { _sz, _szMerge } from '@csszyx/runtime';
3499
3514
  success: 'border-green-500',
3500
3515
  }[status]} />
3501
3516
 
3502
- // Merge (last wins for conflicts)
3503
- <div className={_szMerge(baseClasses, overrideClasses)} />
3517
+ // Merge className strings, last-wins for same-utility conflicts
3518
+ <div className={szcn(baseClasses, overrideClasses)} />
3504
3519
  ```
3505
3520
 
3506
3521
  For color CSS variables:
@@ -3571,9 +3586,16 @@ csszyx has two worlds; pick by "is the value set finite and known at build time?
3571
3586
  generated + injected in the browser via insertRule. Escape hatch only.
3572
3587
 
3573
3588
  Engines (BUILD-TIME parse of JSX source only): Rust native (default) → oxc (JS
3574
- fallback) → babel (last resort). The RUNTIME has no parser: `_sz`/`szv`/`splitBox`
3575
- are plain JS; `dynamic()` lowers an sz OBJECT via `@csszyx/compiler/browser` (pure
3576
- JS, no JSX parsing).
3589
+ fallback) → babel (last resort). All three emit IDENTICAL classes (parity-gated) —
3590
+ engine only affects build speed, never output. The native binary ships as
3591
+ per-platform optional deps (`@csszyx/core-*`); if it's missing (unsupported arch,
3592
+ omitted optional deps, cross-platform frozen lockfile) the DEFAULT `rust` auto-
3593
+ degrades to `oxc` with a one-time warning — builds still succeed with identical
3594
+ classes. An EXPLICIT `parser:'rust'` (config or `CSSZYX_PARSER=rust`) hard-fails
3595
+ instead. Don't tell users a missing native binary breaks csszyx or changes
3596
+ classes; tell them to ignore the warning or set `build.parser:'oxc'`. The RUNTIME
3597
+ has no parser: `_sz`/`szr`/`szv`/`splitBox` are plain JS; `dynamic()` lowers an sz
3598
+ OBJECT via `@csszyx/compiler/browser` (pure JS, no JSX parsing).
3577
3599
 
3578
3600
  Helper build-time/runtime:
3579
3601
 
@@ -3584,8 +3606,12 @@ Helper build-time/runtime:
3584
3606
  - `splitBox`/`splitBoxSz` → RUNTIME routing only (pure JS). They re-partition
3585
3607
  existing classes; they emit no new CSS and do NOT force `dynamic()`. CSS comes
3586
3608
  from the static source (a literal or a szv config).
3587
- - `dynamic()` → the only helper that generates CSS at runtime, and only for a
3588
- class not already in the built CSS.
3609
+ - `dynamic()` → ESCAPE HATCH, not a default. The only helper that generates CSS at
3610
+ RUNTIME (injects rules), and the only one that is NOT mangled + has a security
3611
+ surface. Use ONLY when style values come from runtime data unknown at build
3612
+ (JSON/API/user config: `sz={{ w: serverValue }}`), or the rare case build-time
3613
+ helpers can't express it. A literal or a finite set of choices is ALWAYS
3614
+ build-time (`sz`/`szv`) — do not reach for `dynamic()` there.
3589
3615
 
3590
3616
  Safelist requires a statically analyzable position (a literal sz, or a szv config
3591
3617
  literal). File discovery: the prescan scans any file containing `sz=`/`sz:` or a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/mcp-server",
3
- "version": "0.10.5",
3
+ "version": "0.10.7",
4
4
  "description": "Model Context Protocol (MCP) server for csszyx — enables AI agents to understand and generate sz props",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,9 +30,9 @@
30
30
  "dependencies": {
31
31
  "@modelcontextprotocol/sdk": "^1.29.0",
32
32
  "zod": "^3.23.8",
33
- "@csszyx/cli": "0.10.5",
34
- "@csszyx/unplugin": "0.10.5",
35
- "@csszyx/compiler": "0.10.5"
33
+ "@csszyx/compiler": "0.10.7",
34
+ "@csszyx/unplugin": "0.10.7",
35
+ "@csszyx/cli": "0.10.7"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "^6.0.3",