@csszyx/mcp-server 0.11.5 → 0.11.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.
Files changed (2) hide show
  1. package/dist/index.mjs +36 -29
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -306,8 +306,7 @@ function handleBatch(input) {
306
306
  const result = transform(sz);
307
307
  return {
308
308
  index,
309
- className: result.className,
310
- attributes: Object.keys(result.attributes).length > 0 ? result.attributes : void 0
309
+ className: result.className
311
310
  };
312
311
  } catch (err) {
313
312
  return {
@@ -348,7 +347,6 @@ function handleExpand(input) {
348
347
  text: JSON.stringify(
349
348
  {
350
349
  className: result.className,
351
- attributes: result.attributes,
352
350
  classCount: result.className.split(/\s+/).filter(Boolean).length
353
351
  },
354
352
  null,
@@ -579,44 +577,53 @@ function handleTheme(input) {
579
577
  const validateSchema = z.object({
580
578
  sz: z.record(z.any()).describe('The sz prop object to validate. Example: { padding: 4, bg: "blue-500" }')
581
579
  });
580
+ function validateEntry(key, value) {
581
+ const suggestion = SUGGESTION_MAP[key];
582
+ if (suggestion) {
583
+ return {
584
+ key,
585
+ message: `Unknown prop '${key}'. This is a CSS property name, not an sz key.`,
586
+ suggestion: `Use '${suggestion}' instead. Example: { ${suggestion.split(/[\s/(]/)[0]}: ${JSON.stringify(value)} }`
587
+ };
588
+ }
589
+ const removed = REMOVED_BOOLEAN_SUGAR[key];
590
+ if (removed && value === true) {
591
+ return {
592
+ key,
593
+ message: `'${key}: true' boolean sugar was removed; it emits no class.`,
594
+ suggestion: `Use { ${removed.key}: ${JSON.stringify(removed.value)} } instead.`
595
+ };
596
+ }
597
+ const isSpecial = ["css", "@container", "*"].includes(key) || key.startsWith("@") || key.startsWith("[");
598
+ const isKnown = key in PROPERTY_MAP || BOOLEAN_SHORTHANDS.has(key) || KNOWN_VARIANTS.has(key) || isSpecial;
599
+ return isKnown ? void 0 : {
600
+ key,
601
+ message: `Unknown prop '${key}'. Not a valid sz key, variant, or special prop.`
602
+ };
603
+ }
582
604
  function handleValidate(input) {
583
605
  const errors = [];
584
606
  const warnings = [];
585
607
  for (const key of Object.keys(input.sz)) {
586
- if (SUGGESTION_MAP[key]) {
587
- errors.push({
588
- key,
589
- message: `Unknown prop '${key}'. This is a CSS property name, not an sz key.`,
590
- suggestion: `Use '${SUGGESTION_MAP[key]}' instead. Example: { ${SUGGESTION_MAP[key].split(/[\s/(]/)[0]}: ${JSON.stringify(input.sz[key])} }`
591
- });
592
- continue;
593
- }
594
- const removed = REMOVED_BOOLEAN_SUGAR[key];
595
- if (removed && input.sz[key] === true) {
596
- errors.push({
597
- key,
598
- message: `'${key}: true' boolean sugar was removed; it emits no class.`,
599
- suggestion: `Use { ${removed.key}: ${JSON.stringify(removed.value)} } instead.`
600
- });
601
- continue;
602
- }
603
- const isProperty = key in PROPERTY_MAP;
604
- const isBoolean = BOOLEAN_SHORTHANDS.has(key);
605
- const isVariant = KNOWN_VARIANTS.has(key);
606
- const isSpecial = ["css", "@container", "*"].includes(key) || key.startsWith("@") || key.startsWith("[");
607
- if (!isProperty && !isBoolean && !isVariant && !isSpecial) {
608
- errors.push({
609
- key,
610
- message: `Unknown prop '${key}'. Not a valid sz key, variant, or special prop.`
611
- });
608
+ const error = validateEntry(key, input.sz[key]);
609
+ if (error) {
610
+ errors.push(error);
612
611
  }
613
612
  }
614
613
  let transformResult = null;
615
614
  let transformError = null;
615
+ const originalWarn = console.warn;
616
+ console.warn = (...args) => {
617
+ warnings.push(
618
+ args.map((arg) => typeof arg === "string" ? arg : JSON.stringify(arg)).join(" ")
619
+ );
620
+ };
616
621
  try {
617
622
  transformResult = transform(input.sz);
618
623
  } catch (err) {
619
624
  transformError = err instanceof Error ? err.message : String(err);
625
+ } finally {
626
+ console.warn = originalWarn;
620
627
  }
621
628
  return {
622
629
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/mcp-server",
3
- "version": "0.11.5",
3
+ "version": "0.11.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/compiler": "0.11.5",
34
- "@csszyx/unplugin": "0.11.5",
35
- "@csszyx/cli": "0.11.5"
33
+ "@csszyx/compiler": "0.11.7",
34
+ "@csszyx/unplugin": "0.11.7",
35
+ "@csszyx/cli": "0.11.7"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "^6.0.3",