@wordpress/design-system-mcp 0.16.0 → 0.17.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.
@@ -45,6 +45,7 @@ function formatComponentDetail(detail) {
45
45
  lines.push("", "## Examples", "");
46
46
  for (const story of detail.stories) {
47
47
  lines.push(`### ${story.name}`);
48
+ if (story.description) lines.push("", story.description);
48
49
  if (story.snippet) lines.push("", "```tsx", story.snippet, "```");
49
50
  lines.push("");
50
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"format.mjs","names":[],"sources":["../src/format.ts"],"sourcesContent":["import type { Component, ComponentDetail, Pattern } from './types.ts';\n\n/**\n * Format a component's name, package, and description as markdown.\n *\n * @param component - The component to format.\n * @param headingLevel - The heading level for the component name.\n * @return Markdown lines.\n */\nfunction formatComponentSummary(\n\tcomponent: Component,\n\theadingLevel: number\n): string[] {\n\tconst heading = '#'.repeat( headingLevel );\n\tconst lines = [ `${ heading } ${ component.name }` ];\n\n\tif ( component.description ) {\n\t\tlines.push( '', component.description );\n\t}\n\n\treturn lines;\n}\n\n/**\n * Format the component list as markdown.\n *\n * @param components - The components to format.\n * @return Formatted markdown.\n */\nexport function formatComponents( components: Component[] ): string {\n\tconst lines = [ '# WordPress Design System Components' ];\n\n\tfor ( const component of components ) {\n\t\tlines.push( '', ...formatComponentSummary( component, 2 ) );\n\t}\n\n\treturn lines.join( '\\n' );\n}\n\n/**\n * Format a single component's detail as markdown documentation.\n *\n * @param detail - The component detail to format.\n * @return Formatted markdown.\n */\nexport function formatComponentDetail( detail: ComponentDetail ): string {\n\tconst lines = formatComponentSummary( detail, 1 );\n\n\tlines.push( '', `**Package:** \\`${ detail.packageName }\\`` );\n\n\tif ( detail.importStatement ) {\n\t\tlines.push(\n\t\t\t'',\n\t\t\t'## Import',\n\t\t\t'',\n\t\t\t'```ts',\n\t\t\tdetail.importStatement,\n\t\t\t'```'\n\t\t);\n\t}\n\n\tif ( detail.props.length > 0 ) {\n\t\tlines.push( '', '## Props', '' );\n\t\tfor ( const prop of detail.props ) {\n\t\t\tconst required = prop.required ? ' **(required)**' : '';\n\t\t\tconst defaultNote = prop.defaultValue\n\t\t\t\t? ` (default: \\`${ prop.defaultValue }\\`)`\n\t\t\t\t: '';\n\t\t\tlines.push(\n\t\t\t\t`### \\`${ prop.name }\\`: \\`${ prop.type }\\`${ required }${ defaultNote }`,\n\t\t\t\t''\n\t\t\t);\n\t\t\tif ( prop.description ) {\n\t\t\t\tlines.push( prop.description, '' );\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( detail.stories.length > 0 ) {\n\t\tlines.push( '', '## Examples', '' );\n\t\tfor ( const story of detail.stories ) {\n\t\t\tlines.push( `### ${ story.name }` );\n\t\t\tif ( story.snippet ) {\n\t\t\t\tlines.push( '', '```tsx', story.snippet, '```' );\n\t\t\t}\n\t\t\tlines.push( '' );\n\t\t}\n\t}\n\n\treturn lines.join( '\\n' );\n}\n\n/**\n * Format the pattern list as markdown.\n *\n * @param patterns - The patterns to format.\n * @return Formatted markdown.\n */\nexport function formatPatterns( patterns: Pattern[] ): string {\n\tconst lines = [\n\t\t'# WordPress Design System Patterns',\n\t\t'',\n\t\t'Call `get_pattern_details` with a slug for the full guidance.',\n\t];\n\n\tfor ( const pattern of patterns ) {\n\t\tlines.push(\n\t\t\t'',\n\t\t\t`## ${ pattern.title }`,\n\t\t\t'',\n\t\t\t`**Slug:** \\`${ pattern.slug }\\``,\n\t\t\t'',\n\t\t\tpattern.description\n\t\t);\n\t}\n\n\treturn lines.join( '\\n' );\n}\n"],"mappings":";;;;;;;;AASA,SAAS,uBACR,WACA,cACW;CAEX,MAAM,QAAQ,CAAE,GADA,IAAI,OAAQ,YACF,EAAG,GAAI,UAAU,MAAQ;CAEnD,IAAK,UAAU,aACd,MAAM,KAAM,IAAI,UAAU,WAAY;CAGvC,OAAO;AACR;;;;;;;AAQA,SAAgB,iBAAkB,YAAkC;CACnE,MAAM,QAAQ,CAAE,sCAAu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esContent":["import type { Component, ComponentDetail, Pattern } from './types.ts';\n\n/**\n * Format a component's name, package, and description as markdown.\n *\n * @param component - The component to format.\n * @param headingLevel - The heading level for the component name.\n * @return Markdown lines.\n */\nfunction formatComponentSummary(\n\tcomponent: Component,\n\theadingLevel: number\n): string[] {\n\tconst heading = '#'.repeat( headingLevel );\n\tconst lines = [ `${ heading } ${ component.name }` ];\n\n\tif ( component.description ) {\n\t\tlines.push( '', component.description );\n\t}\n\n\treturn lines;\n}\n\n/**\n * Format the component list as markdown.\n *\n * @param components - The components to format.\n * @return Formatted markdown.\n */\nexport function formatComponents( components: Component[] ): string {\n\tconst lines = [ '# WordPress Design System Components' ];\n\n\tfor ( const component of components ) {\n\t\tlines.push( '', ...formatComponentSummary( component, 2 ) );\n\t}\n\n\treturn lines.join( '\\n' );\n}\n\n/**\n * Format a single component's detail as markdown documentation.\n *\n * @param detail - The component detail to format.\n * @return Formatted markdown.\n */\nexport function formatComponentDetail( detail: ComponentDetail ): string {\n\tconst lines = formatComponentSummary( detail, 1 );\n\n\tlines.push( '', `**Package:** \\`${ detail.packageName }\\`` );\n\n\tif ( detail.importStatement ) {\n\t\tlines.push(\n\t\t\t'',\n\t\t\t'## Import',\n\t\t\t'',\n\t\t\t'```ts',\n\t\t\tdetail.importStatement,\n\t\t\t'```'\n\t\t);\n\t}\n\n\tif ( detail.props.length > 0 ) {\n\t\tlines.push( '', '## Props', '' );\n\t\tfor ( const prop of detail.props ) {\n\t\t\tconst required = prop.required ? ' **(required)**' : '';\n\t\t\tconst defaultNote = prop.defaultValue\n\t\t\t\t? ` (default: \\`${ prop.defaultValue }\\`)`\n\t\t\t\t: '';\n\t\t\tlines.push(\n\t\t\t\t`### \\`${ prop.name }\\`: \\`${ prop.type }\\`${ required }${ defaultNote }`,\n\t\t\t\t''\n\t\t\t);\n\t\t\tif ( prop.description ) {\n\t\t\t\tlines.push( prop.description, '' );\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( detail.stories.length > 0 ) {\n\t\tlines.push( '', '## Examples', '' );\n\t\tfor ( const story of detail.stories ) {\n\t\t\tlines.push( `### ${ story.name }` );\n\t\t\tif ( story.description ) {\n\t\t\t\tlines.push( '', story.description );\n\t\t\t}\n\t\t\tif ( story.snippet ) {\n\t\t\t\tlines.push( '', '```tsx', story.snippet, '```' );\n\t\t\t}\n\t\t\tlines.push( '' );\n\t\t}\n\t}\n\n\treturn lines.join( '\\n' );\n}\n\n/**\n * Format the pattern list as markdown.\n *\n * @param patterns - The patterns to format.\n * @return Formatted markdown.\n */\nexport function formatPatterns( patterns: Pattern[] ): string {\n\tconst lines = [\n\t\t'# WordPress Design System Patterns',\n\t\t'',\n\t\t'Call `get_pattern_details` with a slug for the full guidance.',\n\t];\n\n\tfor ( const pattern of patterns ) {\n\t\tlines.push(\n\t\t\t'',\n\t\t\t`## ${ pattern.title }`,\n\t\t\t'',\n\t\t\t`**Slug:** \\`${ pattern.slug }\\``,\n\t\t\t'',\n\t\t\tpattern.description\n\t\t);\n\t}\n\n\treturn lines.join( '\\n' );\n}\n"],"mappings":";;;;;;;;AASA,SAAS,uBACR,WACA,cACW;CAEX,MAAM,QAAQ,CAAE,GADA,IAAI,OAAQ,YACF,EAAG,GAAI,UAAU,MAAQ;CAEnD,IAAK,UAAU,aACd,MAAM,KAAM,IAAI,UAAU,WAAY;CAGvC,OAAO;AACR;;;;;;;AAQA,SAAgB,iBAAkB,YAAkC;CACnE,MAAM,QAAQ,CAAE,sCAAuC;CAEvD,KAAM,MAAM,aAAa,YACxB,MAAM,KAAM,IAAI,GAAG,uBAAwB,WAAW,CAAE,CAAE;CAG3D,OAAO,MAAM,KAAM,IAAK;AACzB;;;;;;;AAQA,SAAgB,sBAAuB,QAAkC;CACxE,MAAM,QAAQ,uBAAwB,QAAQ,CAAE;CAEhD,MAAM,KAAM,IAAI,kBAAmB,OAAO,YAAa,GAAI;CAE3D,IAAK,OAAO,iBACX,MAAM,KACL,IACA,aACA,IACA,SACA,OAAO,iBACP,KACD;CAGD,IAAK,OAAO,MAAM,SAAS,GAAI;EAC9B,MAAM,KAAM,IAAI,YAAY,EAAG;EAC/B,KAAM,MAAM,QAAQ,OAAO,OAAQ;GAClC,MAAM,WAAW,KAAK,WAAW,oBAAoB;GACrD,MAAM,cAAc,KAAK,eACtB,gBAAiB,KAAK,aAAc,OACpC;GACH,MAAM,KACL,SAAU,KAAK,KAAM,QAAS,KAAK,KAAM,IAAK,WAAa,eAC3D,EACD;GACA,IAAK,KAAK,aACT,MAAM,KAAM,KAAK,aAAa,EAAG;EAEnC;CACD;CAEA,IAAK,OAAO,QAAQ,SAAS,GAAI;EAChC,MAAM,KAAM,IAAI,eAAe,EAAG;EAClC,KAAM,MAAM,SAAS,OAAO,SAAU;GACrC,MAAM,KAAM,OAAQ,MAAM,MAAQ;GAClC,IAAK,MAAM,aACV,MAAM,KAAM,IAAI,MAAM,WAAY;GAEnC,IAAK,MAAM,SACV,MAAM,KAAM,IAAI,UAAU,MAAM,SAAS,KAAM;GAEhD,MAAM,KAAM,EAAG;EAChB;CACD;CAEA,OAAO,MAAM,KAAM,IAAK;AACzB;;;;;;;AAQA,SAAgB,eAAgB,UAA8B;CAC7D,MAAM,QAAQ;EACb;EACA;EACA;CACD;CAEA,KAAM,MAAM,WAAW,UACtB,MAAM,KACL,IACA,MAAO,QAAQ,SACf,IACA,eAAgB,QAAQ,KAAM,KAC9B,IACA,QAAQ,WACT;CAGD,OAAO,MAAM,KAAM,IAAK;AACzB"}
@@ -11,7 +11,7 @@ function createServer() {
11
11
  "Provides guidance for building interfaces with the WordPress Design System, at three levels:",
12
12
  [
13
13
  "- Patterns describe how to approach a kind of interaction, such as confirming a destructive action or saving a form. A pattern says which components to choose for the situation and how to configure them.",
14
- "- Components are the building blocks in `@wordpress/ui` and `@wordpress/components`, documented with their props, examples, and import statements.",
14
+ "- Components are the building blocks in design system packages such as `@wordpress/ui`, `@wordpress/components`, and `@wordpress/admin-ui`, documented with their props, examples, and import statements.",
15
15
  "- Design tokens are the themeable `--wpds-*` CSS custom properties from `@wordpress/theme` that the components are built on, for styling that no component covers."
16
16
  ].join("\n"),
17
17
  "Use the appropriate tool for each request:",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/server';\nimport { registerTools } from './tools/index.ts';\n\nexport { parseComponents, parseComponentDetail } from './parse-components.ts';\nexport { parsePatterns } from './parse-patterns.ts';\n\nexport function createServer() {\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: 'WordPress Design System',\n\t\t\tversion: '0.1.0',\n\t\t},\n\t\t{\n\t\t\tinstructions: [\n\t\t\t\t'Provides guidance for building interfaces with the WordPress Design System, at three levels:',\n\t\t\t\t[\n\t\t\t\t\t'- Patterns describe how to approach a kind of interaction, such as confirming a destructive action or saving a form. A pattern says which components to choose for the situation and how to configure them.',\n\t\t\t\t\t'- Components are the building blocks in `@wordpress/ui` and `@wordpress/components`, documented with their props, examples, and import statements.',\n\t\t\t\t\t'- Design tokens are the themeable `--wpds-*` CSS custom properties from `@wordpress/theme` that the components are built on, for styling that no component covers.',\n\t\t\t\t].join( '\\n' ),\n\t\t\t\t'Use the appropriate tool for each request:',\n\t\t\t\t[\n\t\t\t\t\t'- To answer a question about a specific component, such as its props or how to import it, call `get_component_details`. When the request uses a generic name (\"dropdown menu\") instead of the export name, call `get_components` first to find it.',\n\t\t\t\t\t'- To build an interface or a user flow, call `get_patterns` first to check whether a pattern covers the situation. If one does, call `get_pattern_details` and follow it: patterns record decisions that component documentation cannot, such as when to use one component instead of another. If none does, work from the components. In both cases, call `get_component_details` for the components you will use.',\n\t\t\t\t\t'- For custom styling, call `get_design_tokens`. Prefer component props when a component already expresses the styling intent.',\n\t\t\t\t].join( '\\n' ),\n\t\t\t].join( '\\n\\n' ),\n\t\t}\n\t);\n\n\tregisterTools( server );\n\n\treturn server;\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAe;CAC9B,MAAM,SAAS,IAAI,UAClB;EACC,MAAM;EACN,SAAS;CACV,GACA,EACC,cAAc;EACb;EACA;GACC;GACA;GACA;EACD,CAAC,CAAC,KAAM,IAAK;EACb;EACA;GACC;GACA;GACA;EACD,CAAC,CAAC,KAAM,IAAK;CACd,CAAC,CAAC,KAAM,MAAO,EAChB,CACD;CAEA,cAAe,MAAO;CAEtB,OAAO;AACR"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/server';\nimport { registerTools } from './tools/index.ts';\n\nexport { parseComponents, parseComponentDetail } from './parse-components.ts';\nexport { parsePatterns } from './parse-patterns.ts';\n\nexport function createServer() {\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: 'WordPress Design System',\n\t\t\tversion: '0.1.0',\n\t\t},\n\t\t{\n\t\t\tinstructions: [\n\t\t\t\t'Provides guidance for building interfaces with the WordPress Design System, at three levels:',\n\t\t\t\t[\n\t\t\t\t\t'- Patterns describe how to approach a kind of interaction, such as confirming a destructive action or saving a form. A pattern says which components to choose for the situation and how to configure them.',\n\t\t\t\t\t'- Components are the building blocks in design system packages such as `@wordpress/ui`, `@wordpress/components`, and `@wordpress/admin-ui`, documented with their props, examples, and import statements.',\n\t\t\t\t\t'- Design tokens are the themeable `--wpds-*` CSS custom properties from `@wordpress/theme` that the components are built on, for styling that no component covers.',\n\t\t\t\t].join( '\\n' ),\n\t\t\t\t'Use the appropriate tool for each request:',\n\t\t\t\t[\n\t\t\t\t\t'- To answer a question about a specific component, such as its props or how to import it, call `get_component_details`. When the request uses a generic name (\"dropdown menu\") instead of the export name, call `get_components` first to find it.',\n\t\t\t\t\t'- To build an interface or a user flow, call `get_patterns` first to check whether a pattern covers the situation. If one does, call `get_pattern_details` and follow it: patterns record decisions that component documentation cannot, such as when to use one component instead of another. If none does, work from the components. In both cases, call `get_component_details` for the components you will use.',\n\t\t\t\t\t'- For custom styling, call `get_design_tokens`. Prefer component props when a component already expresses the styling intent.',\n\t\t\t\t].join( '\\n' ),\n\t\t\t].join( '\\n\\n' ),\n\t\t}\n\t);\n\n\tregisterTools( server );\n\n\treturn server;\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAe;CAC9B,MAAM,SAAS,IAAI,UAClB;EACC,MAAM;EACN,SAAS;CACV,GACA,EACC,cAAc;EACb;EACA;GACC;GACA;GACA;EACD,CAAC,CAAC,KAAM,IAAK;EACb;EACA;GACC;GACA;GACA;EACD,CAAC,CAAC,KAAM,IAAK;CACd,CAAC,CAAC,KAAM,MAAO,EAChB,CACD;CAEA,cAAe,MAAO;CAEtB,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAuBtE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,UAAU,EAAE,SAAS,EAAE,GAAI,MAAM,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAE,MAAM,EAAE,eAAe,GAAI,MAAM,CA6CvE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAE,QAAQ,EAAE,OAAO,EAAE,GAAI,MAAM,CAmB5D"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAuBtE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,UAAU,EAAE,SAAS,EAAE,GAAI,MAAM,CAQlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAE,MAAM,EAAE,eAAe,GAAI,MAAM,CAgDvE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAE,QAAQ,EAAE,OAAO,EAAE,GAAI,MAAM,CAmB5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/design-system-mcp",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "MCP server for the WordPress Design System.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^24.13.3",
49
- "vitest": "^5.0.5"
49
+ "vitest": "^5.1.0"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "gitHead": "9b70363b9f93cff0583a1f3153738d383cf5a49e"
54
+ "gitHead": "1000cdf1dffd5b5e69f75cc4360aa76db8252264"
55
55
  }