sonance-brand-mcp 1.3.42 → 1.3.44
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.
|
@@ -521,17 +521,32 @@ export async function POST(request: Request) {
|
|
|
521
521
|
|
|
522
522
|
// Identify the recommended file (highest scoring file, prefer filename matches)
|
|
523
523
|
if (searchResults.length > 0) {
|
|
524
|
-
//
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
524
|
+
// Helper to extract filename without extension
|
|
525
|
+
const getFilenameWithoutExt = (filePath: string): string => {
|
|
526
|
+
const filename = filePath.split('/').pop() || '';
|
|
527
|
+
return filename.replace(/\.(tsx?|jsx?)$/, '').toLowerCase();
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
// Find file where FILENAME matches a component name (not just path)
|
|
531
|
+
const filenameMatch = searchResults.find(r => {
|
|
532
|
+
const filename = getFilenameWithoutExt(r.path);
|
|
533
|
+
return analysis.componentNames.some(name => {
|
|
534
|
+
const nameLower = name.toLowerCase();
|
|
535
|
+
// Exact match: ProcessDetailPanel === processdetailpanel
|
|
536
|
+
// Or filename contains the component name
|
|
537
|
+
return filename === nameLower || filename.includes(nameLower);
|
|
538
|
+
});
|
|
539
|
+
});
|
|
530
540
|
|
|
531
541
|
if (filenameMatch) {
|
|
542
|
+
const matchedName = analysis.componentNames.find(name => {
|
|
543
|
+
const filename = getFilenameWithoutExt(filenameMatch.path);
|
|
544
|
+
const nameLower = name.toLowerCase();
|
|
545
|
+
return filename === nameLower || filename.includes(nameLower);
|
|
546
|
+
});
|
|
532
547
|
recommendedFile = {
|
|
533
548
|
path: filenameMatch.path,
|
|
534
|
-
reason: `
|
|
549
|
+
reason: `Filename matches component "${matchedName}" from screenshot`
|
|
535
550
|
};
|
|
536
551
|
} else {
|
|
537
552
|
// Fall back to highest score
|
|
@@ -593,7 +608,7 @@ export async function POST(request: Request) {
|
|
|
593
608
|
// Total budget: 100k chars (~25k tokens, safe for Claude)
|
|
594
609
|
// Priority: Recommended file (full) > Page file (limited) > Other components (dynamic)
|
|
595
610
|
const TOTAL_CONTEXT_BUDGET = 100000;
|
|
596
|
-
const MAX_RECOMMENDED_FILE =
|
|
611
|
+
const MAX_RECOMMENDED_FILE = 80000; // 80k chars max for recommended file
|
|
597
612
|
const MAX_PAGE_FILE = 2000; // Page file is just a wrapper
|
|
598
613
|
const MAX_GLOBALS_CSS = 1500;
|
|
599
614
|
const MAX_FILES = 25;
|
|
@@ -823,6 +838,11 @@ CRITICAL: Edit the TARGET COMPONENT (marked with ***), not the page wrapper.`;
|
|
|
823
838
|
validFilePaths.add(comp.path);
|
|
824
839
|
}
|
|
825
840
|
|
|
841
|
+
// FIX: Add the recommended file to validFilePaths (it was spliced out for display purposes)
|
|
842
|
+
if (recommendedFileContent) {
|
|
843
|
+
validFilePaths.add(recommendedFileContent.path);
|
|
844
|
+
}
|
|
845
|
+
|
|
826
846
|
debugLog("VALIDATION: Valid file paths from page context", {
|
|
827
847
|
pageFile: pageContext.pageFile,
|
|
828
848
|
validFilePaths: Array.from(validFilePaths),
|
|
@@ -531,17 +531,32 @@ export async function POST(request: Request) {
|
|
|
531
531
|
|
|
532
532
|
// Identify the recommended file (highest scoring file, prefer filename matches)
|
|
533
533
|
if (searchResults.length > 0) {
|
|
534
|
-
//
|
|
535
|
-
const
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
534
|
+
// Helper to extract filename without extension
|
|
535
|
+
const getFilenameWithoutExt = (filePath: string): string => {
|
|
536
|
+
const filename = filePath.split('/').pop() || '';
|
|
537
|
+
return filename.replace(/\.(tsx?|jsx?)$/, '').toLowerCase();
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
// Find file where FILENAME matches a component name (not just path)
|
|
541
|
+
const filenameMatch = searchResults.find(r => {
|
|
542
|
+
const filename = getFilenameWithoutExt(r.path);
|
|
543
|
+
return analysis.componentNames.some(name => {
|
|
544
|
+
const nameLower = name.toLowerCase();
|
|
545
|
+
// Exact match: ProcessDetailPanel === processdetailpanel
|
|
546
|
+
// Or filename contains the component name
|
|
547
|
+
return filename === nameLower || filename.includes(nameLower);
|
|
548
|
+
});
|
|
549
|
+
});
|
|
540
550
|
|
|
541
551
|
if (filenameMatch) {
|
|
552
|
+
const matchedName = analysis.componentNames.find(name => {
|
|
553
|
+
const filename = getFilenameWithoutExt(filenameMatch.path);
|
|
554
|
+
const nameLower = name.toLowerCase();
|
|
555
|
+
return filename === nameLower || filename.includes(nameLower);
|
|
556
|
+
});
|
|
542
557
|
recommendedFile = {
|
|
543
558
|
path: filenameMatch.path,
|
|
544
|
-
reason: `
|
|
559
|
+
reason: `Filename matches component "${matchedName}" from screenshot`
|
|
545
560
|
};
|
|
546
561
|
} else {
|
|
547
562
|
// Fall back to highest score
|
|
@@ -603,7 +618,7 @@ export async function POST(request: Request) {
|
|
|
603
618
|
// Total budget: 100k chars (~25k tokens, safe for Claude)
|
|
604
619
|
// Priority: Recommended file (full) > Page file (limited) > Other components (dynamic)
|
|
605
620
|
const TOTAL_CONTEXT_BUDGET = 100000;
|
|
606
|
-
const MAX_RECOMMENDED_FILE =
|
|
621
|
+
const MAX_RECOMMENDED_FILE = 80000; // 80k chars max for recommended file
|
|
607
622
|
const MAX_PAGE_FILE = 2000; // Page file is just a wrapper
|
|
608
623
|
const MAX_GLOBALS_CSS = 1500;
|
|
609
624
|
const MAX_FILES = 25;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonance-brand-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.44",
|
|
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",
|