sonance-brand-mcp 1.3.97 → 1.3.99
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.
|
@@ -1341,6 +1341,111 @@ Output format:
|
|
|
1341
1341
|
|
|
1342
1342
|
The "search" field must match the file EXACTLY (copy-paste from the code provided).`;
|
|
1343
1343
|
|
|
1344
|
+
/**
|
|
1345
|
+
* DESIGNER ANALYSIS PROTOCOL
|
|
1346
|
+
* Forces the LLM to analyze the UI like a senior designer before making changes.
|
|
1347
|
+
* Identifies specific visual problems, maps them to code, then makes targeted fixes.
|
|
1348
|
+
*/
|
|
1349
|
+
const DESIGN_REASONING_PROMPT = `
|
|
1350
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1351
|
+
DESIGNER ANALYSIS PROTOCOL
|
|
1352
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1353
|
+
|
|
1354
|
+
You are a senior UI/UX designer reviewing this component. Before generating any code changes, you MUST complete this analysis:
|
|
1355
|
+
|
|
1356
|
+
STEP 1 - VISUAL AUDIT (analyze the screenshot)
|
|
1357
|
+
Examine the UI and identify specific issues in these categories:
|
|
1358
|
+
|
|
1359
|
+
• HIERARCHY: Is there a clear visual focus? Are elements competing for attention?
|
|
1360
|
+
- Look for: competing headings, unclear primary actions, visual clutter
|
|
1361
|
+
|
|
1362
|
+
• SPACING: Are related elements grouped? Is there awkward empty space?
|
|
1363
|
+
- Look for: disconnected labels/values, uneven gaps, cramped or overly spread content
|
|
1364
|
+
|
|
1365
|
+
• ALIGNMENT: Do elements align naturally? Are there visual disconnects?
|
|
1366
|
+
- Look for: misaligned text, floating elements, broken visual flow
|
|
1367
|
+
|
|
1368
|
+
• FEEDBACK: Are progress indicators, states, and actions clear?
|
|
1369
|
+
- Look for: weak progress visualization, unclear states, orphaned status indicators
|
|
1370
|
+
|
|
1371
|
+
• GROUPING: Are related items visually connected? Do containers make sense?
|
|
1372
|
+
- Look for: related content that appears separate, missing visual boundaries
|
|
1373
|
+
|
|
1374
|
+
List each problem you find with a specific description.
|
|
1375
|
+
|
|
1376
|
+
STEP 2 - CODE MAPPING
|
|
1377
|
+
For each problem identified in Step 1, find the EXACT code in the file that causes it:
|
|
1378
|
+
|
|
1379
|
+
Example format:
|
|
1380
|
+
- Problem: "Badge disconnected from its label"
|
|
1381
|
+
- Code: Line 45 shows \`<Badge className="absolute right-0">\` positioned separately from label at Line 42
|
|
1382
|
+
- Fix needed: Move Badge inside the same flex container as the label
|
|
1383
|
+
|
|
1384
|
+
Do this for EACH problem you identified.
|
|
1385
|
+
|
|
1386
|
+
STEP 3 - PRIORITIZED FIXES
|
|
1387
|
+
Rank your fixes by visual impact. Address the most impactful issues first.
|
|
1388
|
+
Each fix should:
|
|
1389
|
+
• Target a specific identified problem from Step 1
|
|
1390
|
+
• Reference the exact code location from Step 2
|
|
1391
|
+
• Make focused changes that fix THAT specific problem
|
|
1392
|
+
|
|
1393
|
+
STEP 4 - GENERATE PATCHES
|
|
1394
|
+
Now generate patches that implement your fixes.
|
|
1395
|
+
• Each patch should be traceable to a specific problem from Step 1
|
|
1396
|
+
• Multiple small patches are better than one large rewrite
|
|
1397
|
+
• Every change must have a clear reason tied to your analysis
|
|
1398
|
+
`;
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* DESIGN DECISION RULES
|
|
1402
|
+
* Informed decision rules that allow fixing real problems while preventing unnecessary rewrites.
|
|
1403
|
+
*/
|
|
1404
|
+
const DESIGN_GUARDRAILS = `
|
|
1405
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1406
|
+
DESIGN DECISION RULES
|
|
1407
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1408
|
+
|
|
1409
|
+
✓ ALLOWED when fixing identified problems:
|
|
1410
|
+
• Adjust spacing, padding, margins to fix grouping issues
|
|
1411
|
+
• Reposition elements to improve visual hierarchy (move badge next to its label, etc.)
|
|
1412
|
+
• Add containers/wrappers to group related content that appears disconnected
|
|
1413
|
+
• Change flex direction or alignment to fix layout issues
|
|
1414
|
+
• Adjust typography for better hierarchy (size, weight, line-height)
|
|
1415
|
+
• Improve progress indicators or status displays for clarity
|
|
1416
|
+
|
|
1417
|
+
✗ STILL AVOID:
|
|
1418
|
+
• Complete rewrites when targeted fixes would work
|
|
1419
|
+
• Changing functionality or interactive behavior
|
|
1420
|
+
• Removing content or features the user didn't ask to remove
|
|
1421
|
+
• Changing color schemes unless specifically identified as a problem
|
|
1422
|
+
• Making changes that aren't traceable to a specific visual problem you identified
|
|
1423
|
+
|
|
1424
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1425
|
+
PRINCIPLE: Every change must trace back to a specific visual problem you identified in Step 1.
|
|
1426
|
+
If you can't explain WHY a change fixes a specific problem, don't make that change.
|
|
1427
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1428
|
+
`;
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Detect if a user request is design-heavy and needs the reasoning protocol.
|
|
1432
|
+
* Simple requests like "change button color to blue" don't need it.
|
|
1433
|
+
*/
|
|
1434
|
+
function isDesignHeavyRequest(userPrompt: string): boolean {
|
|
1435
|
+
const designKeywords = [
|
|
1436
|
+
'redesign', 'design', 'layout', 'improve', 'better', 'modernize', 'modern',
|
|
1437
|
+
'cleaner', 'clean', 'messy', 'cluttered', 'update look', 'looks bad',
|
|
1438
|
+
'ugly', 'prettier', 'beautiful', 'professional', 'polish', 'refine',
|
|
1439
|
+
'restructure', 'reorganize', 'rearrange', 'simplify', 'streamline',
|
|
1440
|
+
'compact', 'spacious', 'breathing room', 'visual', 'aesthetic',
|
|
1441
|
+
'ux', 'user experience', 'ui', 'user interface', 'make it look',
|
|
1442
|
+
'looks weird', 'not right', 'fix the look', 'appearance'
|
|
1443
|
+
];
|
|
1444
|
+
|
|
1445
|
+
const lowerPrompt = userPrompt.toLowerCase();
|
|
1446
|
+
return designKeywords.some(keyword => lowerPrompt.includes(keyword));
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1344
1449
|
export async function POST(request: Request) {
|
|
1345
1450
|
// Only allow in development
|
|
1346
1451
|
if (process.env.NODE_ENV !== "development") {
|
|
@@ -1748,6 +1853,23 @@ User Request: "${userPrompt}"
|
|
|
1748
1853
|
|
|
1749
1854
|
`;
|
|
1750
1855
|
|
|
1856
|
+
// ========== DESIGN REASONING PROTOCOL ==========
|
|
1857
|
+
// For design-heavy requests, add structured reasoning and guardrails
|
|
1858
|
+
// This prevents over-engineering and ensures thoughtful changes
|
|
1859
|
+
const isDesignRequest = isDesignHeavyRequest(userPrompt || '');
|
|
1860
|
+
|
|
1861
|
+
if (isDesignRequest) {
|
|
1862
|
+
debugLog("Design-heavy request detected, adding reasoning protocol", {
|
|
1863
|
+
prompt: userPrompt?.substring(0, 50),
|
|
1864
|
+
triggerKeywords: ['redesign', 'better', 'improve', 'cleaner', 'layout', 'modernize']
|
|
1865
|
+
.filter(k => userPrompt?.toLowerCase().includes(k))
|
|
1866
|
+
});
|
|
1867
|
+
|
|
1868
|
+
textContent += DESIGN_REASONING_PROMPT;
|
|
1869
|
+
textContent += DESIGN_GUARDRAILS;
|
|
1870
|
+
textContent += '\n';
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1751
1873
|
// ========== TARGET COMPONENT ONLY (with line numbers) ==========
|
|
1752
1874
|
// CRITICAL: Only include the TARGET file to avoid overwhelming the LLM with noise
|
|
1753
1875
|
if (recommendedFileContent) {
|
|
@@ -1337,6 +1337,111 @@ Output format:
|
|
|
1337
1337
|
|
|
1338
1338
|
The "search" field must match the file EXACTLY (copy-paste from the code provided).`;
|
|
1339
1339
|
|
|
1340
|
+
/**
|
|
1341
|
+
* DESIGNER ANALYSIS PROTOCOL
|
|
1342
|
+
* Forces the LLM to analyze the UI like a senior designer before making changes.
|
|
1343
|
+
* Identifies specific visual problems, maps them to code, then makes targeted fixes.
|
|
1344
|
+
*/
|
|
1345
|
+
const DESIGN_REASONING_PROMPT = `
|
|
1346
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1347
|
+
DESIGNER ANALYSIS PROTOCOL
|
|
1348
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1349
|
+
|
|
1350
|
+
You are a senior UI/UX designer reviewing this component. Before generating any code changes, you MUST complete this analysis:
|
|
1351
|
+
|
|
1352
|
+
STEP 1 - VISUAL AUDIT (analyze the screenshot)
|
|
1353
|
+
Examine the UI and identify specific issues in these categories:
|
|
1354
|
+
|
|
1355
|
+
• HIERARCHY: Is there a clear visual focus? Are elements competing for attention?
|
|
1356
|
+
- Look for: competing headings, unclear primary actions, visual clutter
|
|
1357
|
+
|
|
1358
|
+
• SPACING: Are related elements grouped? Is there awkward empty space?
|
|
1359
|
+
- Look for: disconnected labels/values, uneven gaps, cramped or overly spread content
|
|
1360
|
+
|
|
1361
|
+
• ALIGNMENT: Do elements align naturally? Are there visual disconnects?
|
|
1362
|
+
- Look for: misaligned text, floating elements, broken visual flow
|
|
1363
|
+
|
|
1364
|
+
• FEEDBACK: Are progress indicators, states, and actions clear?
|
|
1365
|
+
- Look for: weak progress visualization, unclear states, orphaned status indicators
|
|
1366
|
+
|
|
1367
|
+
• GROUPING: Are related items visually connected? Do containers make sense?
|
|
1368
|
+
- Look for: related content that appears separate, missing visual boundaries
|
|
1369
|
+
|
|
1370
|
+
List each problem you find with a specific description.
|
|
1371
|
+
|
|
1372
|
+
STEP 2 - CODE MAPPING
|
|
1373
|
+
For each problem identified in Step 1, find the EXACT code in the file that causes it:
|
|
1374
|
+
|
|
1375
|
+
Example format:
|
|
1376
|
+
- Problem: "Badge disconnected from its label"
|
|
1377
|
+
- Code: Line 45 shows \`<Badge className="absolute right-0">\` positioned separately from label at Line 42
|
|
1378
|
+
- Fix needed: Move Badge inside the same flex container as the label
|
|
1379
|
+
|
|
1380
|
+
Do this for EACH problem you identified.
|
|
1381
|
+
|
|
1382
|
+
STEP 3 - PRIORITIZED FIXES
|
|
1383
|
+
Rank your fixes by visual impact. Address the most impactful issues first.
|
|
1384
|
+
Each fix should:
|
|
1385
|
+
• Target a specific identified problem from Step 1
|
|
1386
|
+
• Reference the exact code location from Step 2
|
|
1387
|
+
• Make focused changes that fix THAT specific problem
|
|
1388
|
+
|
|
1389
|
+
STEP 4 - GENERATE PATCHES
|
|
1390
|
+
Now generate patches that implement your fixes.
|
|
1391
|
+
• Each patch should be traceable to a specific problem from Step 1
|
|
1392
|
+
• Multiple small patches are better than one large rewrite
|
|
1393
|
+
• Every change must have a clear reason tied to your analysis
|
|
1394
|
+
`;
|
|
1395
|
+
|
|
1396
|
+
/**
|
|
1397
|
+
* DESIGN DECISION RULES
|
|
1398
|
+
* Informed decision rules that allow fixing real problems while preventing unnecessary rewrites.
|
|
1399
|
+
*/
|
|
1400
|
+
const DESIGN_GUARDRAILS = `
|
|
1401
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1402
|
+
DESIGN DECISION RULES
|
|
1403
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1404
|
+
|
|
1405
|
+
✓ ALLOWED when fixing identified problems:
|
|
1406
|
+
• Adjust spacing, padding, margins to fix grouping issues
|
|
1407
|
+
• Reposition elements to improve visual hierarchy (move badge next to its label, etc.)
|
|
1408
|
+
• Add containers/wrappers to group related content that appears disconnected
|
|
1409
|
+
• Change flex direction or alignment to fix layout issues
|
|
1410
|
+
• Adjust typography for better hierarchy (size, weight, line-height)
|
|
1411
|
+
• Improve progress indicators or status displays for clarity
|
|
1412
|
+
|
|
1413
|
+
✗ STILL AVOID:
|
|
1414
|
+
• Complete rewrites when targeted fixes would work
|
|
1415
|
+
• Changing functionality or interactive behavior
|
|
1416
|
+
• Removing content or features the user didn't ask to remove
|
|
1417
|
+
• Changing color schemes unless specifically identified as a problem
|
|
1418
|
+
• Making changes that aren't traceable to a specific visual problem you identified
|
|
1419
|
+
|
|
1420
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1421
|
+
PRINCIPLE: Every change must trace back to a specific visual problem you identified in Step 1.
|
|
1422
|
+
If you can't explain WHY a change fixes a specific problem, don't make that change.
|
|
1423
|
+
═══════════════════════════════════════════════════════════════════════════════
|
|
1424
|
+
`;
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Detect if a user request is design-heavy and needs the reasoning protocol.
|
|
1428
|
+
* Simple requests like "change button color to blue" don't need it.
|
|
1429
|
+
*/
|
|
1430
|
+
function isDesignHeavyRequest(userPrompt: string): boolean {
|
|
1431
|
+
const designKeywords = [
|
|
1432
|
+
'redesign', 'design', 'layout', 'improve', 'better', 'modernize', 'modern',
|
|
1433
|
+
'cleaner', 'clean', 'messy', 'cluttered', 'update look', 'looks bad',
|
|
1434
|
+
'ugly', 'prettier', 'beautiful', 'professional', 'polish', 'refine',
|
|
1435
|
+
'restructure', 'reorganize', 'rearrange', 'simplify', 'streamline',
|
|
1436
|
+
'compact', 'spacious', 'breathing room', 'visual', 'aesthetic',
|
|
1437
|
+
'ux', 'user experience', 'ui', 'user interface', 'make it look',
|
|
1438
|
+
'looks weird', 'not right', 'fix the look', 'appearance'
|
|
1439
|
+
];
|
|
1440
|
+
|
|
1441
|
+
const lowerPrompt = userPrompt.toLowerCase();
|
|
1442
|
+
return designKeywords.some(keyword => lowerPrompt.includes(keyword));
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1340
1445
|
export async function POST(request: Request) {
|
|
1341
1446
|
// Only allow in development
|
|
1342
1447
|
if (process.env.NODE_ENV !== "development") {
|
|
@@ -1717,6 +1822,23 @@ User Request: "${userPrompt}"
|
|
|
1717
1822
|
|
|
1718
1823
|
`;
|
|
1719
1824
|
|
|
1825
|
+
// ========== DESIGN REASONING PROTOCOL ==========
|
|
1826
|
+
// For design-heavy requests, add structured reasoning and guardrails
|
|
1827
|
+
// This prevents over-engineering and ensures thoughtful changes
|
|
1828
|
+
const isDesignRequest = isDesignHeavyRequest(userPrompt || '');
|
|
1829
|
+
|
|
1830
|
+
if (isDesignRequest) {
|
|
1831
|
+
debugLog("Design-heavy request detected, adding reasoning protocol", {
|
|
1832
|
+
prompt: userPrompt?.substring(0, 50),
|
|
1833
|
+
triggerKeywords: ['redesign', 'better', 'improve', 'cleaner', 'layout', 'modernize']
|
|
1834
|
+
.filter(k => userPrompt?.toLowerCase().includes(k))
|
|
1835
|
+
});
|
|
1836
|
+
|
|
1837
|
+
textContent += DESIGN_REASONING_PROMPT;
|
|
1838
|
+
textContent += DESIGN_GUARDRAILS;
|
|
1839
|
+
textContent += '\n';
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1720
1842
|
// ========== TARGET COMPONENT ONLY (with line numbers) ==========
|
|
1721
1843
|
// CRITICAL: Only include the TARGET file to avoid overwhelming the LLM with noise
|
|
1722
1844
|
if (recommendedFileContent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonance-brand-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.99",
|
|
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",
|