@csszyx/mcp-server 0.11.7 → 0.11.9

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
 
4
4
  /**
5
5
  * @csszyx/mcp-server — Model Context Protocol server for csszyx.
@@ -15,40 +15,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
15
15
  * @module
16
16
  */
17
17
 
18
- declare const server: Server<{
19
- method: string;
20
- params?: {
21
- [x: string]: unknown;
22
- _meta?: {
23
- [x: string]: unknown;
24
- progressToken?: string | number | undefined;
25
- "io.modelcontextprotocol/related-task"?: {
26
- taskId: string;
27
- } | undefined;
28
- } | undefined;
29
- } | undefined;
30
- }, {
31
- method: string;
32
- params?: {
33
- [x: string]: unknown;
34
- _meta?: {
35
- [x: string]: unknown;
36
- progressToken?: string | number | undefined;
37
- "io.modelcontextprotocol/related-task"?: {
38
- taskId: string;
39
- } | undefined;
40
- } | undefined;
41
- } | undefined;
42
- }, {
43
- [x: string]: unknown;
44
- _meta?: {
45
- [x: string]: unknown;
46
- progressToken?: string | number | undefined;
47
- "io.modelcontextprotocol/related-task"?: {
48
- taskId: string;
49
- } | undefined;
50
- } | undefined;
51
- }>;
18
+ declare const server: McpServer;
52
19
  declare const TOOLS: ({
53
20
  name: string;
54
21
  description: string;
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import fs, { realpathSync } from 'node:fs';
3
3
  import { createRequire } from 'node:module';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
7
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
8
8
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } from '@modelcontextprotocol/sdk/types.js';
9
9
  import { sortStrings, SPECIAL_VARIANTS, KNOWN_VARIANTS, PROPERTY_MAP, transform, SUGGESTION_MAP, BOOLEAN_SHORTHANDS, REMOVED_BOOLEAN_SUGAR } from '@csszyx/compiler';
@@ -550,7 +550,7 @@ function handleReverse(input) {
550
550
 
551
551
  const themeSchema = z.object({
552
552
  css: z.string().describe(
553
- 'CSS file content containing @theme blocks. Example: "@theme { --color-brand: #ff6b35; --font-display: \\"Cal Sans\\"; }"'
553
+ 'CSS file content containing @theme blocks. Example: "@theme { --color-brand: #ff6b35; --font-display: "Cal Sans"; }"'
554
554
  )
555
555
  });
556
556
  function handleTheme(input) {
@@ -653,7 +653,7 @@ const packageJson = _require(
653
653
  path.resolve(fileURLToPath(import.meta.url), "../../package.json")
654
654
  );
655
655
  const VERSION = packageJson.version;
656
- const server = new Server(
656
+ const server = new McpServer(
657
657
  {
658
658
  name: "csszyx-mcp-server",
659
659
  version: VERSION
@@ -784,10 +784,10 @@ const TOOL_HANDLERS = {
784
784
  csszyx_batch: { schema: batchSchema, handler: handleBatch },
785
785
  csszyx_theme: { schema: themeSchema, handler: handleTheme }
786
786
  };
787
- server.setRequestHandler(ListToolsRequestSchema, async () => {
787
+ server.server.setRequestHandler(ListToolsRequestSchema, async () => {
788
788
  return { tools: TOOLS };
789
789
  });
790
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
790
+ server.server.setRequestHandler(CallToolRequestSchema, async (request) => {
791
791
  const { name, arguments: args } = request.params;
792
792
  const entry = TOOL_HANDLERS[name];
793
793
  if (!entry) {
@@ -806,10 +806,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
806
806
  };
807
807
  }
808
808
  });
809
- server.setRequestHandler(ListResourcesRequestSchema, async () => {
809
+ server.server.setRequestHandler(ListResourcesRequestSchema, async () => {
810
810
  return { resources: listResources() };
811
811
  });
812
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
812
+ server.server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
813
813
  try {
814
814
  return readResource(request.params.uri);
815
815
  } catch (error) {
@@ -817,10 +817,10 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
817
817
  throw new Error(`Resource error: ${message}`);
818
818
  }
819
819
  });
820
- server.setRequestHandler(ListPromptsRequestSchema, async () => {
820
+ server.server.setRequestHandler(ListPromptsRequestSchema, async () => {
821
821
  return { prompts: listPrompts() };
822
822
  });
823
- server.setRequestHandler(GetPromptRequestSchema, async (request) => {
823
+ server.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
824
824
  try {
825
825
  return getPrompt(
826
826
  request.params.name,
package/llms-full.txt CHANGED
@@ -645,16 +645,16 @@ Strategy for static analysis vs runtime generation.
645
645
 
646
646
  **Core Decision**: `CSSzyx` uses **AST Parsing**, not Regex Scanning. This allows for smarter static extraction and shake-tree logic.
647
647
 
648
- | Concept | Tailwind Scanner (Regex) | `sz` Compiler (AST) | Note |
649
- | :---------------------------- | :----------------------- | :----------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
650
- | **String Interpolation** | ❌ Fails `bg-${color}` | ✅ **Runtime Support** | Compiler marks as dynamic, handled at runtime via variable injection. |
651
- | **Conditionals** | ❌ Fails logic | ✅ **Static Extraction** | `{ bg: active ? 'blue' : 'gray' }` and `{ scale: shrunk ? 75 : 100 }` → both branches compiled to static Tailwind classes at build time. CSS variable fallback only when a branch is a runtime expression (not a literal). |
652
- | **Variable reference** | ❌ Not applicable | ✅ **Build time** | `sz={myVar}` — pass variable directly when no override needed. Compiler resolves the binding to its object literal initializer (incl. `as const`, `satisfies`, explicit type annotation). |
653
- | **Object Spread** | ❌ Fails spread | ✅ **Static Analysis** | `sz={{ ...baseProps, key: val }}` — use spread only when overriding/adding; last key wins. Resolved at build time for local literals. Multiple/nested spreads supported. Imported vars fall back to `_sz()` — no crash. |
654
- | **Array variable items** | ❌ Not applicable | ✅ **Build time** | `sz={[varA, varB]}` and `sz={[varA, cond && varB]}` — LATER WINS composition. All-static-object arrays deep-merge at build (later leaf wins per key path, sibling keys survive) into one className; arrays with strings/conditions/dynamic elements emit `_szcn(...)` — a compiler-injected helper (`_` = generated code, never hand-authored; the unmemoized twin of `szcn`) applying the same later-wins rule per property group at runtime; dynamic elements (e.g. a forwarded `szsc` slot) pass through `_szPart` (string passthrough / sz-object compile). |
655
- | **Ternary variable branches** | ❌ Not applicable | ✅ **Build time** | `sz={cond ? varA : varB}` — both branches compiled to static strings when variables are local literals. |
656
- | **Chained variables** | ❌ Not applicable | ✅ **Build time** | `const b = { ...a, key: val }; <div sz={b} />` — compiler resolves the chain recursively. |
657
- | **Safelist** | Required for dynamic | **Not Required** | Auto-detected for static logic; Auto-injected for runtime values. |
648
+ | Concept | Tailwind Scanner (Regex) | `sz` Compiler (AST) | Note |
649
+ | :---------------------------- | :----------------------- | :----------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
650
+ | **String Interpolation** | ❌ Fails `bg-${color}` | ✅ **Runtime Support** | Compiler marks as dynamic, handled at runtime via variable injection. |
651
+ | **Conditionals** | ❌ Fails logic | ✅ **Static Extraction** | `{ bg: active ? 'blue' : 'gray' }` and `{ scale: shrunk ? 75 : 100 }` → both branches compiled to static Tailwind classes at build time. A runtime branch uses a CSS variable; an opposite `undefined`, `null`, `false`, or empty-string branch omits both the utility and variable value. Numeric `0` remains valid. |
652
+ | **Variable reference** | ❌ Not applicable | ✅ **Build time** | `sz={myVar}` — pass variable directly when no override needed. Compiler resolves the binding to its object literal initializer (incl. `as const`, `satisfies`, explicit type annotation). |
653
+ | **Object Spread** | ❌ Fails spread | ✅ **Static Analysis** | `sz={{ ...baseProps, key: val }}` — use spread only when overriding/adding; last key wins. Resolved at build time for local literals. Multiple/nested spreads supported. Imported vars fall back to `_sz()` — no crash. When runtime `sz` emits CSS variables beside one direct object-literal JSX prop spread, or one conditional with object-literal branches, generated variables merge into every branch's `style`; unresolved/multiple JSX spreads retain a collision diagnostic. |
654
+ | **Array variable items** | ❌ Not applicable | ✅ **Build time** | `sz={[varA, varB]}` and `sz={[varA, cond && varB]}` — LATER WINS composition. All-static-object arrays deep-merge at build (later leaf wins per key path, sibling keys survive) into one className; arrays with strings/conditions/dynamic elements emit `_szcn(...)` — a compiler-injected helper (`_` = generated code, never hand-authored; the unmemoized twin of `szcn`) applying the same later-wins rule per property group at runtime. Finite ternary elements and finite conditional object properties compile to conditional class strings; only truly dynamic elements (e.g. a forwarded `szsc` slot) pass through `_szPart` (string passthrough / sz-object compile). |
655
+ | **Ternary variable branches** | ❌ Not applicable | ✅ **Build time** | `sz={cond ? varA : varB}` — both branches compiled to static strings when variables are local literals. |
656
+ | **Chained variables** | ❌ Not applicable | ✅ **Build time** | `const b = { ...a, key: val }; <div sz={b} />` — compiler resolves the chain recursively. |
657
+ | **Safelist** | Required for dynamic | **Not Required** | Auto-detected for static logic; Auto-injected for runtime values. |
658
658
 
659
659
  **Performance Rule**: Prefer **Static Strings** in `sz` objects.
660
660
 
@@ -3504,6 +3504,8 @@ Controlling text wrapping and overflow.
3504
3504
  | Concept | CSS Rule | Tailwind v4 Class | `sz` Prop (Object Syntax) | Note |
3505
3505
  | :---------------------- | :--------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------- |
3506
3506
  | **Overflow** | `text-overflow: ellipsis` | `truncate`, `text-ellipsis`, `text-clip` | `{ textOverflow: 'ellipsis' }`(etc) | |
3507
+ | **Ellipsis Flag** | `text-overflow: ellipsis` | `text-ellipsis` | `{ textEllipsis: true }` | `false` emits no class. |
3508
+ | **Clip Flag** | `text-overflow: clip` | `text-clip` | `{ textClip: true }` | `false` emits no class. |
3507
3509
  | **Wrap** | `text-wrap: wrap` | `text-wrap`, `text-nowrap`, `text-balance`, `text-pretty` | `{ textWrap: 'wrap' }`(etc) | |
3508
3510
  | **Indent Spacing** | `text-indent: calc(var(--spacing) * <number>)` | `indent-<number>` | `{ indent: <number> }` | v4: fully dynamic, accept any integer or 0.5-step decimal bare |
3509
3511
  | **Indent Px** | `text-indent: 1px` | `indent-px` | `{ indent: 'px' }` | |
@@ -3582,6 +3584,13 @@ forwarded `szsc` slot) pass through `_szPart`:
3582
3584
  />
3583
3585
  // slot-default one-liner in a compound component:
3584
3586
  <h3 sz={[{ weight: "semibold", text: "base" }, szsc?.title]} />
3587
+
3588
+ // Finite ternaries stay compiler-owned, including conditionals inside an object:
3589
+ <a sz={[{ decoration: "none" }, disabled ? { color: "muted" } : { color: "main" }, szsc?.link]} />
3590
+ // → _szcn("no-underline", disabled ? "text-muted" : "text-main", _szPart(szsc?.link))
3591
+
3592
+ <div sz={[{ decoration: "none", flex: fluid ? 1 : undefined }, szsc?.root]} />
3593
+ // → _szcn("no-underline", fluid ? "flex-1" : "", _szPart(szsc?.root))
3585
3594
  ```
3586
3595
 
3587
3596
  ## Reusing Styles
@@ -3603,7 +3612,8 @@ sz={{ scale: shrunk ? 75 : 100 }} // inline prop ternary — both lit
3603
3612
  - Use `sz={var}` when no override needed (simpler)
3604
3613
  - Use `sz={{ ...var, key: val }}` only when overriding/adding
3605
3614
  - Variables in array elements, ternary branches, and chained initializers all resolve at build time
3606
- - `sz={{ key: cond ? a : b }}` — both literal branches compiled to static Tailwind classes; CSS variable fallback only when a branch is a runtime expression
3615
+ - `sz={{ key: cond ? a : b }}` — both literal branches compile to static classes; a runtime branch uses a CSS variable. An opposite `undefined`, `null`, `false`, or `''` branch omits the utility and variable value (`0` remains valid)
3616
+ - When runtime `sz` values emit inline CSS variables beside one direct object-literal JSX spread, or one conditional whose branches are object literals, the compiler injects the variables into every spread branch's `style` so both authored and generated values survive. Keep unresolved or multiple spreads' style explicit; csszyx warns when it cannot prove a single-evaluation merge is safe
3607
3617
  - `sz={{ ...(cond ? a : b), static: val }}` — conditional spread hoist: compiler resolves both branches at build time
3608
3618
  - Imported variables / function call results fall back to `_sz()` runtime — dev mode emits a build-time compiler warning explaining the fallback reason and suggesting `szv()` or `dynamic()`
3609
3619
 
@@ -3734,6 +3744,10 @@ are compiler-injected, do not hand-author them):
3734
3744
  names shadowing built-in keywords, or defined in two conflicting
3735
3745
  categories, are rejected to keep-both — never a wrong merge).
3736
3746
  - Fail-safe: a token szcn cannot confidently group is NEVER dropped.
3747
+ - Compiler-injected `_szMerge(existingClassName, compiledSz)` in the full
3748
+ runtime uses the same uncached, mangle-aware utility merge engine as `szcn`,
3749
+ so the compiled `sz` argument wins same-utility conflicts. The intentionally
3750
+ tiny `@csszyx/runtime/lite` compatibility helper only exact-dedupes tokens.
3737
3751
  - `szr` takes sz OBJECTS and concatenates; `szcn` takes STRINGS and overrides.
3738
3752
 
3739
3753
  ```tsx
@@ -3956,9 +3970,20 @@ In production, class names are mangled for maximum compression:
3956
3970
 
3957
3971
  Output: `<div class="z y x" />` — the CSS `.z { padding: 1rem }` etc. is injected automatically.
3958
3972
 
3973
+ If an `sz`-generated utility also appears as a static string or template quasi in a
3974
+ source-level `class` or `className` attribute/property (including a `clsx(...)`
3975
+ expression), csszyx keeps that class unmangled. This ensures raw and `sz` consumers
3976
+ continue to reference the same emitted rule. Use `mangleExclude` when the class is
3977
+ only visible through an imported constant, DOM selector/class API, ignored
3978
+ dependency, downstream macro, or another value unavailable to the source scan.
3979
+
3980
+ Final-output class mangling is available in Vite, Webpack, and Rollup. The esbuild
3981
+ adapter keeps class names readable (and warns when `production.mangle: true` is
3982
+ explicit) because normal esbuild write-to-disk builds do not expose mutable final
3983
+ assets; source transforms and safelist generation still run.
3984
+
3959
3985
  Set `production: { mangle: false }` to keep readable class names — the supported way to
3960
- inspect the emitted CSS, and recommended for hybrid apps that also ship non-csszyx
3961
- stylesheets keyed on the original class names. To check what a single `sz` object
3986
+ inspect the emitted CSS. To check what a single `sz` object
3962
3987
  compiles to without a build, run `csszyx explain "{ p: 4, bg: 'blue-500' }"`.
3963
3988
 
3964
3989
  ### AST budget guard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/mcp-server",
3
- "version": "0.11.7",
3
+ "version": "0.11.9",
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/compiler": "0.11.7",
34
- "@csszyx/unplugin": "0.11.7",
35
- "@csszyx/cli": "0.11.7"
33
+ "@csszyx/compiler": "0.11.9",
34
+ "@csszyx/cli": "0.11.9",
35
+ "@csszyx/unplugin": "0.11.9"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "^6.0.3",