@morya-ui/mcp 0.3.2 → 0.3.3

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/tools.js CHANGED
@@ -47,6 +47,25 @@ function pickLocale(record, locale) {
47
47
  function vueName(name) {
48
48
  return `M${name}`;
49
49
  }
50
+ function mapDecisionOption(option, locale) {
51
+ const zh = locale !== 'en-US';
52
+ const recipe = {
53
+ props: zh ? option.recipe.props : option.recipe.propsEn,
54
+ ...(option.recipe.slots?.length
55
+ ? { slots: zh ? option.recipe.slots : option.recipe.slotsEn }
56
+ : {}),
57
+ ...(option.recipe.events?.length
58
+ ? { events: zh ? option.recipe.events : option.recipe.eventsEn }
59
+ : {}),
60
+ };
61
+ return {
62
+ component: option.component,
63
+ when: zh ? option.when : option.whenEn,
64
+ avoidWhen: zh ? option.avoidWhen : option.avoidWhenEn,
65
+ recipe,
66
+ antiPatterns: zh ? option.antiPatterns : option.antiPatternsEn,
67
+ };
68
+ }
50
69
  function generatedPageCode(patternId, intent, locale) {
51
70
  const zh = locale === 'zh-CN';
52
71
  const isList = patternId === 'admin-list';
@@ -1170,11 +1189,7 @@ export function createToolHandlers(catalog = loadCatalog()) {
1170
1189
  title: locale === 'en-US' ? decision.titleEn : decision.title,
1171
1190
  question: locale === 'en-US' ? decision.questionEn : decision.question,
1172
1191
  keywords: decision.keywords,
1173
- options: decision.options.map((option) => ({
1174
- component: option.component,
1175
- when: locale === 'en-US' ? option.whenEn : option.when,
1176
- avoidWhen: locale === 'en-US' ? option.avoidWhenEn : option.avoidWhen,
1177
- })),
1192
+ options: decision.options.map((option) => mapDecisionOption(option, locale)),
1178
1193
  });
1179
1194
  }
1180
1195
  if (!args.query) {
@@ -1194,14 +1209,10 @@ export function createToolHandlers(catalog = loadCatalog()) {
1194
1209
  decision: matched.id,
1195
1210
  title: locale === 'en-US' ? matched.titleEn : matched.title,
1196
1211
  question: locale === 'en-US' ? matched.questionEn : matched.question,
1197
- recommendations: matched.options.map((option) => ({
1198
- component: option.component,
1199
- when: locale === 'en-US' ? option.whenEn : option.when,
1200
- avoidWhen: locale === 'en-US' ? option.avoidWhenEn : option.avoidWhen,
1201
- })),
1212
+ recommendations: matched.options.map((option) => mapDecisionOption(option, locale)),
1202
1213
  nextStep: locale === 'en-US'
1203
- ? 'Use get_component and get_example for the selected component before implementing.'
1204
- : '实现前请用 get_component 和 get_example 核对所选组件 API。',
1214
+ ? 'Apply the recipe props/slots/events, then use get_component and get_example before implementing. Run validate_usage before delivery.'
1215
+ : '先按 recipe 的 props/slots/events 落地,再用 get_component / get_example 核对 API;交付前跑 validate_usage。',
1205
1216
  });
1206
1217
  }
1207
1218
  function getSetup(args) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morya-ui/mcp",
3
3
  "type": "module",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "description": "MCP server for morya-ui — component docs, examples, and usage guidance for AI coding agents.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/morya-space/morya-ui/tree/main/packages/ui-mcp#readme",
@@ -39,11 +39,13 @@
39
39
  },
40
40
  "scripts": {
41
41
  "generate": "node ./scripts/generate-catalog.mjs",
42
+ "generate:recipes": "node --experimental-strip-types ./scripts/generate-decision-recipes.mjs",
43
+ "check-recipes": "node --experimental-strip-types ./scripts/generate-decision-recipes.mjs --check",
42
44
  "check-catalog": "node ./scripts/generate-catalog.mjs --check",
43
45
  "validate-catalog": "node ./scripts/validate-catalog.mjs",
44
46
  "audit-example-coverage": "node ./scripts/audit-example-coverage.mjs",
45
47
  "write-example-coverage": "node ./scripts/audit-example-coverage.mjs --write",
46
- "build": "pnpm run generate && tsc -p tsconfig.json",
48
+ "build": "pnpm run generate && tsc -p tsconfig.json && pnpm run generate:recipes",
47
49
  "start": "node ./dist/index.js",
48
50
  "test": "vitest run --config ../../vitest.config.ts src/__tests__",
49
51
  "typecheck": "tsc -p tsconfig.json --noEmit"