sonance-brand-mcp 1.3.56 → 1.3.57
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.
|
@@ -704,8 +704,15 @@ export async function POST(request: Request) {
|
|
|
704
704
|
// This forces the LLM to articulate the problem before trying to fix it
|
|
705
705
|
interface VisualAnalysis {
|
|
706
706
|
element: string;
|
|
707
|
+
elementText: string; // The visible text content of the element (for finding in code)
|
|
707
708
|
problem: string;
|
|
708
|
-
|
|
709
|
+
changeType: "styling" | "structural" | "content" | "other";
|
|
710
|
+
currentClasses?: string; // For styling changes: what classes appear to be applied
|
|
711
|
+
classChange?: {
|
|
712
|
+
remove?: string[]; // Classes to remove
|
|
713
|
+
add?: string[]; // Classes to add
|
|
714
|
+
};
|
|
715
|
+
structuralChange?: string; // For structural changes: what to add/remove/wrap
|
|
709
716
|
solution: string;
|
|
710
717
|
confidence: "high" | "medium" | "low";
|
|
711
718
|
}
|
|
@@ -735,7 +742,7 @@ export async function POST(request: Request) {
|
|
|
735
742
|
},
|
|
736
743
|
{
|
|
737
744
|
type: "text",
|
|
738
|
-
text: `You are analyzing a UI screenshot to understand
|
|
745
|
+
text: `You are analyzing a UI screenshot to understand what the user wants changed.
|
|
739
746
|
|
|
740
747
|
User request: "${userPrompt}"
|
|
741
748
|
|
|
@@ -743,21 +750,44 @@ ${focusedElements && focusedElements.length > 0 ? `User clicked on these element
|
|
|
743
750
|
${focusedElements.map((el) => `- ${el.name} (${el.type}) at position (${el.coordinates.x}, ${el.coordinates.y})`).join("\n")}
|
|
744
751
|
` : ""}
|
|
745
752
|
|
|
746
|
-
|
|
753
|
+
Analyze the request and determine:
|
|
754
|
+
1. ELEMENT: Which specific UI element needs to change? (describe location and appearance)
|
|
755
|
+
2. ELEMENT TEXT: What text is visible inside this element? (EXACT text for finding in code)
|
|
756
|
+
3. PROBLEM: What is wrong or what does the user want changed?
|
|
757
|
+
4. CHANGE TYPE: Is this a "styling" (colors/size/spacing), "structural" (add/remove elements), "content" (text changes), or "other" change?
|
|
758
|
+
5. For STYLING changes: What Tailwind classes should be REMOVED and what should be ADDED?
|
|
759
|
+
6. For STRUCTURAL changes: What element should be added, removed, or wrapped?
|
|
760
|
+
7. SOLUTION: Describe the complete fix
|
|
761
|
+
8. CONFIDENCE: high/medium/low
|
|
762
|
+
|
|
763
|
+
IMPORTANT for styling fixes:
|
|
764
|
+
- If text is invisible on a background, typically REMOVE the problematic text color class and ADD a contrasting one
|
|
765
|
+
- Common fix for invisible text on colored backgrounds: REMOVE "text-accent-foreground" or similar, ADD "text-white" or "text-black"
|
|
766
|
+
- Be SPECIFIC about exact class names
|
|
747
767
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
768
|
+
Return ONLY valid JSON:
|
|
769
|
+
{
|
|
770
|
+
"element": "description of the UI element",
|
|
771
|
+
"elementText": "exact visible text in the element",
|
|
772
|
+
"problem": "what is wrong",
|
|
773
|
+
"changeType": "styling",
|
|
774
|
+
"currentClasses": "classes that appear to be applied (best guess)",
|
|
775
|
+
"classChange": {
|
|
776
|
+
"remove": ["text-accent-foreground"],
|
|
777
|
+
"add": ["text-white"]
|
|
778
|
+
},
|
|
779
|
+
"solution": "complete description of the fix",
|
|
780
|
+
"confidence": "high"
|
|
781
|
+
}
|
|
754
782
|
|
|
755
|
-
|
|
783
|
+
For structural changes:
|
|
756
784
|
{
|
|
757
|
-
"element": "
|
|
758
|
-
"
|
|
759
|
-
"
|
|
760
|
-
"
|
|
785
|
+
"element": "description of the UI element",
|
|
786
|
+
"elementText": "text near the element",
|
|
787
|
+
"problem": "what is wrong",
|
|
788
|
+
"changeType": "structural",
|
|
789
|
+
"structuralChange": "Add a new button after the existing one",
|
|
790
|
+
"solution": "complete description of the fix",
|
|
761
791
|
"confidence": "high"
|
|
762
792
|
}`,
|
|
763
793
|
},
|
|
@@ -842,20 +872,54 @@ ${focusedElements.map((el) => `- ${el.name} (${el.type}) at (${el.coordinates.x}
|
|
|
842
872
|
|
|
843
873
|
// ========== VISUAL PROBLEM ANALYSIS (from Phase A) ==========
|
|
844
874
|
if (visualAnalysis) {
|
|
845
|
-
|
|
875
|
+
let analysisInstructions = `═══════════════════════════════════════════════════════════════════════════════
|
|
846
876
|
🔍 VISUAL PROBLEM ANALYSIS (I analyzed the screenshot first)
|
|
847
877
|
═══════════════════════════════════════════════════════════════════════════════
|
|
848
878
|
|
|
849
879
|
**Element:** ${visualAnalysis.element}
|
|
880
|
+
**Element Text:** "${visualAnalysis.elementText || "unknown"}"
|
|
850
881
|
**Problem:** ${visualAnalysis.problem}
|
|
851
|
-
**
|
|
852
|
-
**
|
|
882
|
+
**Change Type:** ${visualAnalysis.changeType}
|
|
883
|
+
**Solution:** ${visualAnalysis.solution}
|
|
853
884
|
**Confidence:** ${visualAnalysis.confidence}
|
|
854
885
|
|
|
855
|
-
|
|
856
|
-
Find the code that renders "${visualAnalysis.element}" and apply "${visualAnalysis.solution}".
|
|
886
|
+
`;
|
|
857
887
|
|
|
888
|
+
// Add specific instructions based on change type
|
|
889
|
+
if (visualAnalysis.changeType === "styling" && visualAnalysis.classChange) {
|
|
890
|
+
analysisInstructions += `🎯 EXACT CLASS CHANGES REQUIRED:
|
|
891
|
+
`;
|
|
892
|
+
if (visualAnalysis.classChange.remove && visualAnalysis.classChange.remove.length > 0) {
|
|
893
|
+
analysisInstructions += ` REMOVE these classes: ${visualAnalysis.classChange.remove.join(", ")}
|
|
858
894
|
`;
|
|
895
|
+
}
|
|
896
|
+
if (visualAnalysis.classChange.add && visualAnalysis.classChange.add.length > 0) {
|
|
897
|
+
analysisInstructions += ` ADD these classes: ${visualAnalysis.classChange.add.join(", ")}
|
|
898
|
+
`;
|
|
899
|
+
}
|
|
900
|
+
analysisInstructions += `
|
|
901
|
+
⚠️ YOUR PATCH MUST:
|
|
902
|
+
1. Find the element containing "${visualAnalysis.elementText || visualAnalysis.element}"
|
|
903
|
+
2. In its className, ${visualAnalysis.classChange.remove?.length ? `REMOVE: ${visualAnalysis.classChange.remove.join(", ")}` : ""}
|
|
904
|
+
3. ${visualAnalysis.classChange.add?.length ? `ADD: ${visualAnalysis.classChange.add.join(", ")}` : ""}
|
|
905
|
+
4. Do NOT add unrelated changes like font-weight or hover states unless specifically requested
|
|
906
|
+
|
|
907
|
+
`;
|
|
908
|
+
} else if (visualAnalysis.changeType === "structural" && visualAnalysis.structuralChange) {
|
|
909
|
+
analysisInstructions += `🔧 STRUCTURAL CHANGE REQUIRED:
|
|
910
|
+
${visualAnalysis.structuralChange}
|
|
911
|
+
|
|
912
|
+
⚠️ YOUR PATCH MUST implement this structural change exactly as described.
|
|
913
|
+
|
|
914
|
+
`;
|
|
915
|
+
} else {
|
|
916
|
+
analysisInstructions += `⚠️ IMPORTANT: Your patches MUST implement the fix described above.
|
|
917
|
+
Find the code that renders "${visualAnalysis.element}" and apply: ${visualAnalysis.solution}
|
|
918
|
+
|
|
919
|
+
`;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
textContent += analysisInstructions;
|
|
859
923
|
}
|
|
860
924
|
|
|
861
925
|
// ========== TARGET COMPONENT (RECOMMENDED FILE) - SHOWN FIRST ==========
|
|
@@ -713,8 +713,15 @@ export async function POST(request: Request) {
|
|
|
713
713
|
// This forces the LLM to articulate the problem before trying to fix it
|
|
714
714
|
interface VisualAnalysis {
|
|
715
715
|
element: string;
|
|
716
|
+
elementText: string; // The visible text content of the element (for finding in code)
|
|
716
717
|
problem: string;
|
|
717
|
-
|
|
718
|
+
changeType: "styling" | "structural" | "content" | "other";
|
|
719
|
+
currentClasses?: string; // For styling changes: what classes appear to be applied
|
|
720
|
+
classChange?: {
|
|
721
|
+
remove?: string[]; // Classes to remove
|
|
722
|
+
add?: string[]; // Classes to add
|
|
723
|
+
};
|
|
724
|
+
structuralChange?: string; // For structural changes: what to add/remove/wrap
|
|
718
725
|
solution: string;
|
|
719
726
|
confidence: "high" | "medium" | "low";
|
|
720
727
|
}
|
|
@@ -744,7 +751,7 @@ export async function POST(request: Request) {
|
|
|
744
751
|
},
|
|
745
752
|
{
|
|
746
753
|
type: "text",
|
|
747
|
-
text: `You are analyzing a UI screenshot to understand
|
|
754
|
+
text: `You are analyzing a UI screenshot to understand what the user wants changed.
|
|
748
755
|
|
|
749
756
|
User request: "${userPrompt}"
|
|
750
757
|
|
|
@@ -752,21 +759,44 @@ ${focusedElements && focusedElements.length > 0 ? `User clicked on these element
|
|
|
752
759
|
${focusedElements.map((el) => `- ${el.name} (${el.type}) at position (${el.coordinates.x}, ${el.coordinates.y})`).join("\n")}
|
|
753
760
|
` : ""}
|
|
754
761
|
|
|
755
|
-
|
|
762
|
+
Analyze the request and determine:
|
|
763
|
+
1. ELEMENT: Which specific UI element needs to change? (describe location and appearance)
|
|
764
|
+
2. ELEMENT TEXT: What text is visible inside this element? (EXACT text for finding in code)
|
|
765
|
+
3. PROBLEM: What is wrong or what does the user want changed?
|
|
766
|
+
4. CHANGE TYPE: Is this a "styling" (colors/size/spacing), "structural" (add/remove elements), "content" (text changes), or "other" change?
|
|
767
|
+
5. For STYLING changes: What Tailwind classes should be REMOVED and what should be ADDED?
|
|
768
|
+
6. For STRUCTURAL changes: What element should be added, removed, or wrapped?
|
|
769
|
+
7. SOLUTION: Describe the complete fix
|
|
770
|
+
8. CONFIDENCE: high/medium/low
|
|
771
|
+
|
|
772
|
+
IMPORTANT for styling fixes:
|
|
773
|
+
- If text is invisible on a background, typically REMOVE the problematic text color class and ADD a contrasting one
|
|
774
|
+
- Common fix for invisible text on colored backgrounds: REMOVE "text-accent-foreground" or similar, ADD "text-white" or "text-black"
|
|
775
|
+
- Be SPECIFIC about exact class names
|
|
756
776
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
777
|
+
Return ONLY valid JSON:
|
|
778
|
+
{
|
|
779
|
+
"element": "description of the UI element",
|
|
780
|
+
"elementText": "exact visible text in the element",
|
|
781
|
+
"problem": "what is wrong",
|
|
782
|
+
"changeType": "styling",
|
|
783
|
+
"currentClasses": "classes that appear to be applied (best guess)",
|
|
784
|
+
"classChange": {
|
|
785
|
+
"remove": ["text-accent-foreground"],
|
|
786
|
+
"add": ["text-white"]
|
|
787
|
+
},
|
|
788
|
+
"solution": "complete description of the fix",
|
|
789
|
+
"confidence": "high"
|
|
790
|
+
}
|
|
763
791
|
|
|
764
|
-
|
|
792
|
+
For structural changes:
|
|
765
793
|
{
|
|
766
|
-
"element": "
|
|
767
|
-
"
|
|
768
|
-
"
|
|
769
|
-
"
|
|
794
|
+
"element": "description of the UI element",
|
|
795
|
+
"elementText": "text near the element",
|
|
796
|
+
"problem": "what is wrong",
|
|
797
|
+
"changeType": "structural",
|
|
798
|
+
"structuralChange": "Add a new button after the existing one",
|
|
799
|
+
"solution": "complete description of the fix",
|
|
770
800
|
"confidence": "high"
|
|
771
801
|
}`,
|
|
772
802
|
},
|
|
@@ -851,20 +881,54 @@ ${focusedElements.map((el) => `- ${el.name} (${el.type}) at (${el.coordinates.x}
|
|
|
851
881
|
|
|
852
882
|
// ========== VISUAL PROBLEM ANALYSIS (from Phase A) ==========
|
|
853
883
|
if (visualAnalysis) {
|
|
854
|
-
|
|
884
|
+
let analysisInstructions = `═══════════════════════════════════════════════════════════════════════════════
|
|
855
885
|
🔍 VISUAL PROBLEM ANALYSIS (I analyzed the screenshot first)
|
|
856
886
|
═══════════════════════════════════════════════════════════════════════════════
|
|
857
887
|
|
|
858
888
|
**Element:** ${visualAnalysis.element}
|
|
889
|
+
**Element Text:** "${visualAnalysis.elementText || "unknown"}"
|
|
859
890
|
**Problem:** ${visualAnalysis.problem}
|
|
860
|
-
**
|
|
861
|
-
**
|
|
891
|
+
**Change Type:** ${visualAnalysis.changeType}
|
|
892
|
+
**Solution:** ${visualAnalysis.solution}
|
|
862
893
|
**Confidence:** ${visualAnalysis.confidence}
|
|
863
894
|
|
|
864
|
-
|
|
865
|
-
Find the code that renders "${visualAnalysis.element}" and apply "${visualAnalysis.solution}".
|
|
895
|
+
`;
|
|
866
896
|
|
|
897
|
+
// Add specific instructions based on change type
|
|
898
|
+
if (visualAnalysis.changeType === "styling" && visualAnalysis.classChange) {
|
|
899
|
+
analysisInstructions += `🎯 EXACT CLASS CHANGES REQUIRED:
|
|
900
|
+
`;
|
|
901
|
+
if (visualAnalysis.classChange.remove && visualAnalysis.classChange.remove.length > 0) {
|
|
902
|
+
analysisInstructions += ` REMOVE these classes: ${visualAnalysis.classChange.remove.join(", ")}
|
|
867
903
|
`;
|
|
904
|
+
}
|
|
905
|
+
if (visualAnalysis.classChange.add && visualAnalysis.classChange.add.length > 0) {
|
|
906
|
+
analysisInstructions += ` ADD these classes: ${visualAnalysis.classChange.add.join(", ")}
|
|
907
|
+
`;
|
|
908
|
+
}
|
|
909
|
+
analysisInstructions += `
|
|
910
|
+
⚠️ YOUR PATCH MUST:
|
|
911
|
+
1. Find the element containing "${visualAnalysis.elementText || visualAnalysis.element}"
|
|
912
|
+
2. In its className, ${visualAnalysis.classChange.remove?.length ? `REMOVE: ${visualAnalysis.classChange.remove.join(", ")}` : ""}
|
|
913
|
+
3. ${visualAnalysis.classChange.add?.length ? `ADD: ${visualAnalysis.classChange.add.join(", ")}` : ""}
|
|
914
|
+
4. Do NOT add unrelated changes like font-weight or hover states unless specifically requested
|
|
915
|
+
|
|
916
|
+
`;
|
|
917
|
+
} else if (visualAnalysis.changeType === "structural" && visualAnalysis.structuralChange) {
|
|
918
|
+
analysisInstructions += `🔧 STRUCTURAL CHANGE REQUIRED:
|
|
919
|
+
${visualAnalysis.structuralChange}
|
|
920
|
+
|
|
921
|
+
⚠️ YOUR PATCH MUST implement this structural change exactly as described.
|
|
922
|
+
|
|
923
|
+
`;
|
|
924
|
+
} else {
|
|
925
|
+
analysisInstructions += `⚠️ IMPORTANT: Your patches MUST implement the fix described above.
|
|
926
|
+
Find the code that renders "${visualAnalysis.element}" and apply: ${visualAnalysis.solution}
|
|
927
|
+
|
|
928
|
+
`;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
textContent += analysisInstructions;
|
|
868
932
|
}
|
|
869
933
|
|
|
870
934
|
// ========== TARGET COMPONENT (RECOMMENDED FILE) - SHOWN FIRST ==========
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonance-brand-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.57",
|
|
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",
|