viewgate-mcp 1.0.14 → 1.0.16
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.
- package/dist/index.js +12 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -225,8 +225,12 @@ function createMcpServer(apiKey, personalKey) {
|
|
|
225
225
|
componentPath: ann.reference?.componentPath,
|
|
226
226
|
selector: ann.reference?.selector,
|
|
227
227
|
tag: ann.reference?.tag,
|
|
228
|
+
figmaReference: ann.figmaReference,
|
|
228
229
|
backendEndpoints: ann.backendEndpoints || [ann.backendEndpoint].filter(Boolean),
|
|
229
|
-
_ia_fix_instruction: `###
|
|
230
|
+
_ia_fix_instruction: `### 🎨 DESIGN CONTEXT (Figma)
|
|
231
|
+
${ann.figmaReference ? `A design reference is available: ${Array.isArray(ann.figmaReference) ? (ann.figmaReference[0]?.link || ann.figmaReference[0]) : (ann.figmaReference.link || ann.figmaReference)}. Use the 'get_figma_preview' tool to fetch design details and image previews before implementing.` : 'No explicit figma design linked.'}
|
|
232
|
+
|
|
233
|
+
### 🔬 SURGICAL FIX PROTOCOL (Language: ${data.preferredLanguage || 'en'})
|
|
230
234
|
1. **PRIMARY**: Search for \`data-vg-id="${ann.reference?.vgId}"\`.
|
|
231
235
|
2. **SECONDARY**: Check \`${file}\` L${line} (Fiber Source).
|
|
232
236
|
3. **TERTIARY**: Match Tag(\`${ann.reference?.tag}\`) + Role(\`${ann.reference?.fingerprint?.role}\`) + Text("${ann.reference?.text?.slice(0, 30)}").
|
|
@@ -427,16 +431,20 @@ Instruction: ${ann.message}`
|
|
|
427
431
|
};
|
|
428
432
|
}
|
|
429
433
|
// 2. Parse Figma URL
|
|
430
|
-
const fileKeyMatch = url.match(/(file|design)\/([a-zA-Z0-9]+)/);
|
|
434
|
+
const fileKeyMatch = url.match(/(?:file|design)\/([a-zA-Z0-9]+)/);
|
|
431
435
|
if (!fileKeyMatch) {
|
|
432
436
|
throw new Error("Invalid Figma URL format. File key not found.");
|
|
433
437
|
}
|
|
434
|
-
const fileKey = fileKeyMatch[
|
|
438
|
+
const fileKey = fileKeyMatch[1];
|
|
435
439
|
// Extract node-id if present
|
|
436
440
|
const urlObj = new URL(url.replace(/#/g, '?')); // Handle hash-based node-id
|
|
437
441
|
let nodeId = urlObj.searchParams.get('node-id') || urlObj.searchParams.get('m');
|
|
438
442
|
if (!nodeId && url.includes('node-id=')) {
|
|
439
|
-
nodeId = url.split('node-id=')[1].split('&')[0]
|
|
443
|
+
nodeId = url.split('node-id=')[1].split('&')[0];
|
|
444
|
+
}
|
|
445
|
+
// Figma API expects node-id with : instead of - (which is used in browser URL)
|
|
446
|
+
if (nodeId) {
|
|
447
|
+
nodeId = nodeId.replace(/%3A/g, ':').replace(/-/g, ':');
|
|
440
448
|
}
|
|
441
449
|
// 3. Fetch Data from Figma
|
|
442
450
|
// First get file info
|