@corva/ui 3.77.0-6 → 3.77.0-8
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/README.md +2 -2
- package/mcp-server/server.mjs +29 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,8 +54,8 @@ added or updated. Restart your IDE (or reload its MCP servers) afterward, then a
|
|
|
54
54
|
component to confirm the tools are picked up.
|
|
55
55
|
|
|
56
56
|
The full MCP docs (all tools and prompts, per-IDE local / monorepo / global setup, troubleshooting, telemetry and
|
|
57
|
-
privacy) ship inside the package as `node_modules/@corva/ui/MCP_README.md`.
|
|
58
|
-
online
|
|
57
|
+
privacy) ship inside the package as `node_modules/@corva/ui/MCP_README.md`. You can also
|
|
58
|
+
[read the latest published copy online](https://cdn.jsdelivr.net/npm/@corva/ui/MCP_README.md).
|
|
59
59
|
|
|
60
60
|
## Figma Code Connect
|
|
61
61
|
|
package/mcp-server/server.mjs
CHANGED
|
@@ -248,7 +248,7 @@ const validateDsn = dsn => {
|
|
|
248
248
|
|
|
249
249
|
const MCP_SERVER_VERSION = '1.5.0';
|
|
250
250
|
|
|
251
|
-
var version = "3.77.0-
|
|
251
|
+
var version = "3.77.0-8";
|
|
252
252
|
|
|
253
253
|
const CORVA_UI_VERSION = version;
|
|
254
254
|
|
|
@@ -37297,6 +37297,19 @@ const componentDocsToolSchema = {
|
|
|
37297
37297
|
name: z.string().describe("Component name (e.g., 'Button', 'Tooltip', 'DatePicker')"),
|
|
37298
37298
|
category: z.enum(['v2', 'v1']).optional().describe('Component category - v2 for modern, v1 for older')
|
|
37299
37299
|
};
|
|
37300
|
+
const CATALOGUES = {
|
|
37301
|
+
v2: componentsV2,
|
|
37302
|
+
v1: componentsV1
|
|
37303
|
+
};
|
|
37304
|
+
const otherCategory = category => category === 'v2' ? 'v1' : 'v2';
|
|
37305
|
+
const findByName = (catalogue, name) => catalogue.find(c => c.name.toLowerCase() === name.toLowerCase());
|
|
37306
|
+
|
|
37307
|
+
/**
|
|
37308
|
+
* The one line that keeps a versioned name from answering as the wrong app: 27 names live in both
|
|
37309
|
+
* catalogues, the lookup prefers v2, and an agent editing a v1 app cannot tell from a v2 page that
|
|
37310
|
+
* it was ever offered a choice.
|
|
37311
|
+
*/
|
|
37312
|
+
const otherVersionLine = (component, category) => `A ${category} ${component.name} also exists. Pass category: "${category}" to get it.`;
|
|
37300
37313
|
const handleGetComponentDocs = args => {
|
|
37301
37314
|
const {
|
|
37302
37315
|
name,
|
|
@@ -37306,10 +37319,10 @@ const handleGetComponentDocs = args => {
|
|
|
37306
37319
|
// Search in both V2 and V1 if category not specified
|
|
37307
37320
|
let component;
|
|
37308
37321
|
if (!category || category === 'v2') {
|
|
37309
|
-
component = componentsV2
|
|
37322
|
+
component = findByName(componentsV2, name);
|
|
37310
37323
|
}
|
|
37311
37324
|
if (!component && (!category || category === 'v1')) {
|
|
37312
|
-
component = componentsV1
|
|
37325
|
+
component = findByName(componentsV1, name);
|
|
37313
37326
|
}
|
|
37314
37327
|
|
|
37315
37328
|
// Step 2: Try alias resolution
|
|
@@ -37319,10 +37332,10 @@ const handleGetComponentDocs = args => {
|
|
|
37319
37332
|
if (aliasResult.wasAliased) {
|
|
37320
37333
|
const searchCategory = aliasResult.aliasCategory;
|
|
37321
37334
|
if (!searchCategory || searchCategory === 'v2') {
|
|
37322
|
-
component = componentsV2
|
|
37335
|
+
component = findByName(componentsV2, aliasResult.resolvedName);
|
|
37323
37336
|
}
|
|
37324
37337
|
if (!component && (!searchCategory || searchCategory === 'v1')) {
|
|
37325
|
-
component = componentsV1
|
|
37338
|
+
component = findByName(componentsV1, aliasResult.resolvedName);
|
|
37326
37339
|
}
|
|
37327
37340
|
if (component) {
|
|
37328
37341
|
aliasNote = `> **Note:** "${name}" resolved to **${component.name}** (${component.category}).\n\n`;
|
|
@@ -37334,7 +37347,12 @@ const handleGetComponentDocs = args => {
|
|
|
37334
37347
|
if (!component) {
|
|
37335
37348
|
const allComponents = [...(!category || category === 'v2' ? componentsV2 : []), ...(!category || category === 'v1' ? componentsV1 : [])];
|
|
37336
37349
|
const suggestions = findSimilarComponents(name, allComponents);
|
|
37337
|
-
|
|
37350
|
+
|
|
37351
|
+
// A category was asked for and the other catalogue holds the exact name: say so, with the
|
|
37352
|
+
// argument that gets it. Without this the caller reads "not found" for a component that exists.
|
|
37353
|
+
const asked = category === 'v2' || category === 'v1' ? category : undefined;
|
|
37354
|
+
const elsewhere = asked && findByName(CATALOGUES[otherCategory(asked)], name);
|
|
37355
|
+
let notFoundMsg = asked && elsewhere ? `Component "${name}" not found in ${asked}. ${otherVersionLine(elsewhere, otherCategory(asked))}` : `Component "${name}" not found.`;
|
|
37338
37356
|
if (suggestions.length > 0) {
|
|
37339
37357
|
notFoundMsg += ` Did you mean: ${suggestions.join(', ')}?`;
|
|
37340
37358
|
}
|
|
@@ -37359,11 +37377,15 @@ const handleGetComponentDocs = args => {
|
|
|
37359
37377
|
caveat
|
|
37360
37378
|
} = renderImportRecipe(component.importRecipe);
|
|
37361
37379
|
const importSection = [statement && `**Import:** \`${statement}\``, caveat].filter(Boolean).join('\n');
|
|
37380
|
+
// Only a call with no category was resolved by preference rather than by request. The default
|
|
37381
|
+
// stays v2; the line tells the caller the choice existed.
|
|
37382
|
+
const twin = category ? undefined : findByName(CATALOGUES[otherCategory(component.category)], component.name);
|
|
37383
|
+
const otherVersionSection = twin ? `**Also in ${twin.category}:** ${otherVersionLine(twin, twin.category)}\n` : '';
|
|
37362
37384
|
const text = `${aliasNote}# ${component.name}
|
|
37363
37385
|
|
|
37364
37386
|
**Category:** ${component.category}
|
|
37365
37387
|
${importSection}
|
|
37366
|
-
${component.isExperimental ? '**Experimental** - Recently added component, fully functional and safe to use.\n' : ''}${notice ? `${notice}\n` : ''}
|
|
37388
|
+
${otherVersionSection}${component.isExperimental ? '**Experimental** - Recently added component, fully functional and safe to use.\n' : ''}${notice ? `${notice}\n` : ''}
|
|
37367
37389
|
|
|
37368
37390
|
${component.description}
|
|
37369
37391
|
|