sonance-brand-mcp 1.3.107 → 1.3.108
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.
|
@@ -2035,6 +2035,7 @@ export async function POST(request: Request) {
|
|
|
2035
2035
|
let recommendedFile: { path: string; reason: string } | null = null;
|
|
2036
2036
|
let deterministicMatch: { path: string; lineNumber: number } | null = null;
|
|
2037
2037
|
let phase1VisibleText: string[] = []; // Store Phase 1 visible text for use in file scoring
|
|
2038
|
+
let smartSearchTopPath: string | null = null; // Top smart search result for fallback
|
|
2038
2039
|
|
|
2039
2040
|
// ========================================================================
|
|
2040
2041
|
// PHASE 0: Deterministic Element ID Search (Cursor-style explicit selection)
|
|
@@ -2141,7 +2142,7 @@ export async function POST(request: Request) {
|
|
|
2141
2142
|
// IMPROVED: Relative scoring - compare focused element vs smart search
|
|
2142
2143
|
// This prevents false positives from generic element IDs in wrong files
|
|
2143
2144
|
const smartSearchTopScore = searchResults[0]?.score || 0;
|
|
2144
|
-
|
|
2145
|
+
smartSearchTopPath = searchResults[0]?.path || null; // Assign to outer scope variable
|
|
2145
2146
|
const focusedTopScore = focusedElementHints[0]?.score || 0;
|
|
2146
2147
|
const focusedTopPath = focusedElementHints[0]?.path || null;
|
|
2147
2148
|
|
|
@@ -2510,6 +2511,22 @@ export async function POST(request: Request) {
|
|
|
2510
2511
|
}
|
|
2511
2512
|
}
|
|
2512
2513
|
|
|
2514
|
+
// ========== SMART SEARCH FALLBACK ==========
|
|
2515
|
+
// If we still don't have a good target file (just the page wrapper),
|
|
2516
|
+
// use the smart search top result - it already found relevant files!
|
|
2517
|
+
if (actualTargetFile && actualTargetFile.path === pageContext.pageFile && smartSearchTopPath) {
|
|
2518
|
+
const smartSearchFullPath = path.join(projectRoot, smartSearchTopPath);
|
|
2519
|
+
if (fs.existsSync(smartSearchFullPath)) {
|
|
2520
|
+
const smartSearchContent = fs.readFileSync(smartSearchFullPath, 'utf-8');
|
|
2521
|
+
actualTargetFile = { path: smartSearchTopPath, content: smartSearchContent };
|
|
2522
|
+
debugLog("SMART SEARCH FALLBACK: Using top smart search result as target", {
|
|
2523
|
+
originalFile: pageContext.pageFile,
|
|
2524
|
+
redirectTo: smartSearchTopPath,
|
|
2525
|
+
contentLength: smartSearchContent.length
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2513
2530
|
debugLog("File redirect complete", {
|
|
2514
2531
|
originalRecommended: recommendedFileContent?.path || 'none',
|
|
2515
2532
|
actualTarget: actualTargetFile?.path || 'none',
|
|
@@ -2004,6 +2004,7 @@ export async function POST(request: Request) {
|
|
|
2004
2004
|
let recommendedFile: { path: string; reason: string } | null = null;
|
|
2005
2005
|
let deterministicMatch: { path: string; lineNumber: number } | null = null;
|
|
2006
2006
|
let phase1VisibleText: string[] = []; // Store Phase 1 visible text for use in file scoring
|
|
2007
|
+
let smartSearchTopPath: string | null = null; // Top smart search result for fallback
|
|
2007
2008
|
|
|
2008
2009
|
// ========================================================================
|
|
2009
2010
|
// PHASE 0: Deterministic Element ID Search (Cursor-style explicit selection)
|
|
@@ -2110,7 +2111,7 @@ export async function POST(request: Request) {
|
|
|
2110
2111
|
// IMPROVED: Relative scoring - compare focused element vs smart search
|
|
2111
2112
|
// This prevents false positives from generic element IDs in wrong files
|
|
2112
2113
|
const smartSearchTopScore = searchResults[0]?.score || 0;
|
|
2113
|
-
|
|
2114
|
+
smartSearchTopPath = searchResults[0]?.path || null; // Assign to outer scope variable
|
|
2114
2115
|
const focusedTopScore = focusedElementHints[0]?.score || 0;
|
|
2115
2116
|
const focusedTopPath = focusedElementHints[0]?.path || null;
|
|
2116
2117
|
|
|
@@ -2479,6 +2480,22 @@ export async function POST(request: Request) {
|
|
|
2479
2480
|
}
|
|
2480
2481
|
}
|
|
2481
2482
|
|
|
2483
|
+
// ========== SMART SEARCH FALLBACK ==========
|
|
2484
|
+
// If we still don't have a good target file (just the page wrapper),
|
|
2485
|
+
// use the smart search top result - it already found relevant files!
|
|
2486
|
+
if (actualTargetFile && actualTargetFile.path === pageContext.pageFile && smartSearchTopPath) {
|
|
2487
|
+
const smartSearchFullPath = path.join(projectRoot, smartSearchTopPath);
|
|
2488
|
+
if (fs.existsSync(smartSearchFullPath)) {
|
|
2489
|
+
const smartSearchContent = fs.readFileSync(smartSearchFullPath, 'utf-8');
|
|
2490
|
+
actualTargetFile = { path: smartSearchTopPath, content: smartSearchContent };
|
|
2491
|
+
debugLog("SMART SEARCH FALLBACK: Using top smart search result as target", {
|
|
2492
|
+
originalFile: pageContext.pageFile,
|
|
2493
|
+
redirectTo: smartSearchTopPath,
|
|
2494
|
+
contentLength: smartSearchContent.length
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2482
2499
|
debugLog("File redirect complete", {
|
|
2483
2500
|
originalRecommended: recommendedFileContent?.path || 'none',
|
|
2484
2501
|
actualTarget: actualTargetFile?.path || 'none',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sonance-brand-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.108",
|
|
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",
|