@csszyx/mcp-server 0.10.4 → 0.10.6

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
@@ -178,6 +178,28 @@ Without it: \`Property 'sz' does not exist on type 'DetailedHTMLProps<...>'\`.
178
178
  \`\`\`tsx
179
179
  <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
180
180
  \`\`\`
181
+
182
+ ## Troubleshooting
183
+ - **"No prebuilt native binary" warning / \`native engine unavailable\`**: the
184
+ default \`rust\` parser's native binary is missing (unsupported arch, optional
185
+ deps omitted, or a cross-platform frozen lockfile). It is NOT broken and classes
186
+ are UNCHANGED \u2014 all three engines (rust/oxc/babel) emit identical output
187
+ (parity-gated). If you only use the default, csszyx auto-falls back to \`oxc\` and
188
+ the build succeeds; ignore the warning or set \`build.parser: 'oxc'\` to silence
189
+ it. Only an EXPLICIT \`parser:'rust'\` hard-fails. Do NOT tell the user to debug
190
+ their styles over this.
191
+ - **A class generates no CSS**: it wasn't safelisted. The file must contain a
192
+ statically analyzable \`sz=\` or \`szv(\` (the prescan qualifies files by those
193
+ tokens). Arbitrary values (\`m:'20px'\`\u2192\`m-[20px]\`) and large numbers
194
+ (\`p:100\`\u2192\`p-100\`) DO work \u2014 a missing class is a safelisting issue, not a
195
+ lowering one. For a sibling workspace package, opt it in with
196
+ \`compileSources: ['packages/name']\`. In a monorepo, scope Tailwind to the
197
+ generated safelist file.
198
+ - **\`dynamic()\` vs build-time**: \`dynamic()\` is an escape hatch (runtime CSS
199
+ injection, not mangled) \u2014 use ONLY for values unknown at build (JSON/API/user
200
+ config). Literals and finite variant sets are build-time: \`sz\` / \`szv\`. To
201
+ resolve \`szv\` output to a className by hand, use \`szr\` (build-time-safe,
202
+ mangle-aware), not \`dynamic()\`.
181
203
  `;
182
204
  function listResources() {
183
205
  return [
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
@@ -3768,10 +3794,25 @@ npx @csszyx/cli migrate src/ # migrate all JSX/TSX/HTML under src/
3768
3794
  npx @csszyx/cli migrate --dry-run # preview changes without writing files
3769
3795
  npx @csszyx/cli migrate --ignore "**/*.test.tsx,**/fixtures/**"
3770
3796
  npx @csszyx/cli migrate --pattern "src/components/**/*.tsx"
3797
+ npx @csszyx/cli migrate --keys-only # upgrade existing csszyx code: normalize sz KEYS only, leave className untouched
3771
3798
  ```
3772
3799
 
3773
3800
  Migration logs are written to `.csszyx/logs/`. Add `.csszyx/` to `.gitignore`.
3774
3801
 
3802
+ ### `--keys-only` — upgrade existing csszyx code (not a Tailwind→sz migration)
3803
+
3804
+ Plain `migrate` converts Tailwind `className` strings into `sz` props — for
3805
+ adopting csszyx. If you ALREADY use csszyx and are bumping a version that renamed
3806
+ sz-prop keys to their canonical form (e.g. the 0.9.10 → 0.10.0 key normalization),
3807
+ use `--keys-only`: it rewrites legacy sz-prop keys to canonical inside `sz={...}`
3808
+ and leaves `className` (and everything else) completely untouched. It only edits
3809
+ JSX/TSX (HTML has no sz objects). This is the safe, surgical upgrade path — it
3810
+ won't touch your hand-written classes.
3811
+
3812
+ ```bash
3813
+ npx @csszyx/cli migrate --keys-only --dry-run # preview the key rewrites first
3814
+ ```
3815
+
3775
3816
  ### Audit — discover unrecognized classes
3776
3817
 
3777
3818
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/mcp-server",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
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.4",
34
- "@csszyx/unplugin": "0.10.4",
35
- "@csszyx/compiler": "0.10.4"
33
+ "@csszyx/compiler": "0.10.6",
34
+ "@csszyx/unplugin": "0.10.6",
35
+ "@csszyx/cli": "0.10.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "^6.0.3",