@vizejs/musea-mcp-server 0.101.0 → 0.104.0

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/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as startServer } from "./src-BrRHhfXh.mjs";
2
+ import { n as startServer } from "./src-Bm2NHBYp.mjs";
3
3
  //#region src/cli.ts
4
4
  /**
5
5
  * Musea MCP Server CLI.
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as startServer, t as createMuseaServer } from "./src-BrRHhfXh.mjs";
1
+ import { n as startServer, t as createMuseaServer } from "./src-Bm2NHBYp.mjs";
2
2
  export { createMuseaServer, createMuseaServer as default, startServer };
@@ -1265,106 +1265,21 @@ async function handleRecommendComponents(ctx, args) {
1265
1265
  //#endregion
1266
1266
  //#region src/tokens.ts
1267
1267
  async function parseTokensFromPath(tokensPath) {
1268
- if ((await fs.promises.stat(tokensPath)).isDirectory()) {
1269
- const entries = await fs.promises.readdir(tokensPath, { withFileTypes: true });
1270
- const categories = [];
1271
- for (const entry of entries) if (entry.isFile() && (entry.name.endsWith(".json") || entry.name.endsWith(".tokens.json"))) {
1272
- const filePath = path.join(tokensPath, entry.name);
1273
- const content = await fs.promises.readFile(filePath, "utf-8");
1274
- const tokens = JSON.parse(content);
1275
- const categoryName = path.basename(entry.name, path.extname(entry.name)).replace(".tokens", "");
1276
- categories.push({
1277
- name: formatCategoryName(categoryName),
1278
- tokens: extractTokenValues(tokens),
1279
- subcategories: extractSubcats(tokens)
1280
- });
1281
- }
1282
- return categories;
1283
- }
1284
- const content = await fs.promises.readFile(tokensPath, "utf-8");
1285
- return flattenTokenStructure(JSON.parse(content));
1268
+ return normalizeCategories(loadNative().parseDesignTokensFromPath(tokensPath));
1286
1269
  }
1287
1270
  function generateTokensMarkdown(categories) {
1288
- const renderCategory = (category, level = 2) => {
1289
- let md = `\n${"#".repeat(level)} ${category.name}\n\n`;
1290
- if (Object.keys(category.tokens).length > 0) {
1291
- md += "| Token | Value | Description |\n";
1292
- md += "|-------|-------|-------------|\n";
1293
- for (const [name, token] of Object.entries(category.tokens)) md += `| \`${name}\` | \`${token.value}\` | ${token.description || "-"} |\n`;
1294
- md += "\n";
1295
- }
1296
- if (category.subcategories) for (const sub of category.subcategories) md += renderCategory(sub, level + 1);
1297
- return md;
1298
- };
1299
- let markdown = "# Design Tokens\n";
1300
- for (const category of categories) markdown += renderCategory(category);
1301
- return markdown;
1302
- }
1303
- function flattenTokenCategories(categories, parentPath = []) {
1304
- const flattened = [];
1305
- for (const category of categories) {
1306
- const categoryPath = [...parentPath, category.name];
1307
- for (const [name, token] of Object.entries(category.tokens)) flattened.push({
1308
- name,
1309
- path: [...categoryPath, name].join("."),
1310
- categoryPath,
1311
- value: token.value,
1312
- type: token.type,
1313
- description: token.description
1314
- });
1315
- if (category.subcategories) flattened.push(...flattenTokenCategories(category.subcategories, categoryPath));
1316
- }
1317
- return flattened;
1271
+ return loadNative().generateDesignTokensMarkdown(categories);
1318
1272
  }
1319
- function isTokenLeaf(value) {
1320
- if (typeof value !== "object" || value === null) return false;
1321
- const obj = value;
1322
- return "value" in obj && (typeof obj.value === "string" || typeof obj.value === "number");
1273
+ function flattenTokenCategories(categories) {
1274
+ return loadNative().flattenDesignTokenCategories(categories);
1323
1275
  }
1324
- function extractTokenValues(obj) {
1325
- const tokens = {};
1326
- for (const [key, value] of Object.entries(obj)) if (isTokenLeaf(value)) {
1327
- const raw = value;
1328
- tokens[key] = {
1329
- value: raw.value,
1330
- type: raw.type,
1331
- description: raw.description
1332
- };
1333
- }
1334
- return tokens;
1335
- }
1336
- function extractSubcats(obj) {
1337
- const subcategories = [];
1338
- for (const [key, value] of Object.entries(obj)) if (!isTokenLeaf(value) && typeof value === "object" && value !== null) {
1339
- const tokens = extractTokenValues(value);
1340
- const nested = extractSubcats(value);
1341
- if (Object.keys(tokens).length > 0 || nested && nested.length > 0) subcategories.push({
1342
- name: formatCategoryName(key),
1343
- tokens,
1344
- subcategories: nested
1345
- });
1346
- }
1347
- return subcategories.length > 0 ? subcategories : void 0;
1348
- }
1349
- function flattenTokenStructure(tokens) {
1350
- const categories = [];
1351
- for (const [key, value] of Object.entries(tokens)) {
1352
- if (isTokenLeaf(value)) continue;
1353
- if (typeof value === "object" && value !== null) {
1354
- const categoryTokens = extractTokenValues(value);
1355
- const subcategories = flattenTokenStructure(value);
1356
- if (Object.keys(categoryTokens).length > 0 || subcategories.length > 0) categories.push({
1357
- name: formatCategoryName(key),
1358
- tokens: categoryTokens,
1359
- subcategories: subcategories.length > 0 ? subcategories : void 0
1360
- });
1361
- }
1276
+ function normalizeCategories(categories) {
1277
+ for (const category of categories) {
1278
+ category.tokens = Object.assign(Object.create(null), category.tokens);
1279
+ if (category.subcategories) normalizeCategories(category.subcategories);
1362
1280
  }
1363
1281
  return categories;
1364
1282
  }
1365
- function formatCategoryName(name) {
1366
- return name.replace(/[-_]/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
1367
- }
1368
1283
  //#endregion
1369
1284
  //#region src/tools/handler/generation.ts
1370
1285
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/musea-mcp-server",
3
- "version": "0.101.0",
3
+ "version": "0.104.0",
4
4
  "description": "MCP server for building Vue.js design systems - component analysis, documentation, variant generation, and design tokens",
5
5
  "keywords": [
6
6
  "ai",
@@ -11,6 +11,10 @@
11
11
  "musea",
12
12
  "vue"
13
13
  ],
14
+ "homepage": "https://github.com/ubugeeei/vize",
15
+ "bugs": {
16
+ "url": "https://github.com/ubugeeei/vize/issues"
17
+ },
14
18
  "license": "MIT",
15
19
  "author": "ubugeeei",
16
20
  "repository": {
@@ -38,7 +42,7 @@
38
42
  },
39
43
  "dependencies": {
40
44
  "@modelcontextprotocol/sdk": "1.29.0",
41
- "@vizejs/native": "0.101.0"
45
+ "@vizejs/native": "0.104.0"
42
46
  },
43
47
  "devDependencies": {
44
48
  "@tsdown/css": "0.22.0",
@@ -48,6 +52,9 @@
48
52
  "vite": "npm:@voidzero-dev/vite-plus-core@0.1.21",
49
53
  "vite-plus": "0.1.21"
50
54
  },
55
+ "engines": {
56
+ "node": ">=22"
57
+ },
51
58
  "scripts": {
52
59
  "build": "vp pack",
53
60
  "dev": "vp pack --watch",