sonance-brand-mcp 1.3.68 → 1.3.70

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.
@@ -602,10 +602,11 @@ function searchFilesSmart(
602
602
  const VISION_SYSTEM_PROMPT = `You edit code. Return ONLY valid JSON - no explanation, no preamble, no markdown.
603
603
 
604
604
  RULES:
605
- 1. Copy code EXACTLY from the file - character for character
606
- 2. Make the SMALLEST possible change
607
- 3. For color changes, just change the className
608
- 4. Do not restructure or reorganize code
605
+ 1. Make ONLY the exact change the user requested. Do not modify unrelated properties.
606
+ 2. Copy code EXACTLY from the file - character for character
607
+ 3. Make the SMALLEST possible change
608
+ 4. For color changes, just change the className
609
+ 5. Do not restructure or reorganize code
609
610
 
610
611
  RESPOND WITH ONLY THIS JSON FORMAT (nothing else):
611
612
  {"modifications":[{"filePath":"path","patches":[{"search":"exact code","replace":"changed code"}]}]}`;
@@ -669,6 +669,53 @@ export async function discoverTheme(projectRoot: string): Promise<DiscoveredThem
669
669
  return result;
670
670
  }
671
671
 
672
+ /**
673
+ * Get a human-readable description of a color based on its luminance and name
674
+ * This helps the LLM understand what colors look like visually
675
+ */
676
+ function getColorDescription(value: string, name: string): string {
677
+ const rgb = parseColorToRgb(value);
678
+ if (!rgb) return "";
679
+
680
+ const luminance = getLuminance(rgb);
681
+ const baseName = name.replace(/^--/, "");
682
+
683
+ // Very light colors (like white)
684
+ if (luminance > 0.9) {
685
+ if (baseName.includes("foreground")) {
686
+ return " (WHITE text)";
687
+ }
688
+ return " ⚠️ WHITE - do NOT use for buttons";
689
+ }
690
+
691
+ // Very dark colors
692
+ if (luminance < 0.1) {
693
+ if (baseName.includes("background")) {
694
+ return " (DARK background)";
695
+ }
696
+ return " (BLACK/DARK)";
697
+ }
698
+
699
+ // Semantic color guidance
700
+ if (baseName.includes("accent")) {
701
+ return " ✓ ACCENT - good for buttons/CTAs";
702
+ }
703
+ if (baseName.includes("success")) {
704
+ return " ✓ GREEN - good for positive actions";
705
+ }
706
+ if (baseName.includes("destructive")) {
707
+ return " ✓ RED - good for danger/delete";
708
+ }
709
+ if (baseName.includes("warning")) {
710
+ return " (ORANGE/YELLOW - caution)";
711
+ }
712
+ if (baseName.includes("primary") && luminance > 0.7) {
713
+ return " ⚠️ LIGHT - avoid for buttons on light backgrounds";
714
+ }
715
+
716
+ return "";
717
+ }
718
+
672
719
  /**
673
720
  * Format discovered theme as context for the LLM prompt
674
721
  * Includes contrast warnings to prevent bad color combinations
@@ -679,9 +726,15 @@ export function formatThemeForPrompt(theme: DiscoveredTheme): string {
679
726
  lines.push("**TARGET CODEBASE THEME (discovered):**");
680
727
  lines.push("");
681
728
 
729
+ // Quick reference for button colors
730
+ lines.push("BUTTON COLOR QUICK REFERENCE:");
731
+ lines.push(" ✓ Use for buttons: bg-accent, bg-success, bg-destructive");
732
+ lines.push(" ✗ Avoid for buttons: bg-primary (may be WHITE), bg-secondary (may be transparent)");
733
+ lines.push("");
734
+
682
735
  // CSS Variables
683
736
  if (Object.keys(theme.cssVariables).length > 0) {
684
- lines.push("CSS Variables:");
737
+ lines.push("COLOR TOKENS (with usage guidance):");
685
738
 
686
739
  // Group by category
687
740
  const categories: Record<string, string[]> = {
@@ -690,7 +743,10 @@ export function formatThemeForPrompt(theme: DiscoveredTheme): string {
690
743
  };
691
744
 
692
745
  for (const [name, value] of Object.entries(theme.cssVariables)) {
693
- const entry = ` ${name}: ${value}`;
746
+ // Add color description for important tokens
747
+ const description = getColorDescription(value, name);
748
+ const entry = ` ${name}: ${value}${description}`;
749
+
694
750
  if (
695
751
  name.includes("background") ||
696
752
  name.includes("foreground") ||
@@ -598,10 +598,11 @@ function searchFilesSmart(
598
598
  const VISION_SYSTEM_PROMPT = `You edit code. Return ONLY valid JSON - no explanation, no preamble, no markdown.
599
599
 
600
600
  RULES:
601
- 1. Copy code EXACTLY from the file - character for character
602
- 2. Make the SMALLEST possible change
603
- 3. For color changes, just change the className
604
- 4. Do not restructure or reorganize code
601
+ 1. Make ONLY the exact change the user requested. Do not modify unrelated properties.
602
+ 2. Copy code EXACTLY from the file - character for character
603
+ 3. Make the SMALLEST possible change
604
+ 4. For color changes, just change the className
605
+ 5. Do not restructure or reorganize code
605
606
 
606
607
  RESPOND WITH ONLY THIS JSON FORMAT (nothing else):
607
608
  {"modifications":[{"filePath":"path","patches":[{"search":"exact code","replace":"changed code"}]}]}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.3.68",
3
+ "version": "1.3.70",
4
4
  "description": "MCP Server for Sonance Brand Guidelines and Component Library - gives Claude instant access to brand colors, typography, and UI components.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",