Skip to content

design-system-mcp: Remove Storybook dependency in TypeScript types#79132

Merged
manzoorwanijk merged 3 commits into
trunkfrom
update/ds-mcp-rm-storybook-dep
Jun 13, 2026
Merged

design-system-mcp: Remove Storybook dependency in TypeScript types#79132
manzoorwanijk merged 3 commits into
trunkfrom
update/ds-mcp-rm-storybook-dep

Conversation

@aduth

@aduth aduth commented Jun 11, 2026

Copy link
Copy Markdown
Member

What?

Related: #79095 (comment)

Updates @wordpress/design-system-mcp to remove storybook as a dependency.

Why?

Fixes an issue where built TypeScript types have an implicit dependency on storybook, but it isn't defined as a dependency by the package. Defining storybook as a dependency of the MCP server is not acceptable because it is a large dependency tree, and the MCP server relies on recurring updates / installs to keep itself up to date (via npx).

How?

Replaces the TypeScript type sourced from storybook package internals with a duplicate copy.

The motivation for using the internal types is explained in #78185 (comment), essentially as a way to provide some awareness when the internal shape changes, since the MCP relies on the shape of the component manifest. However, as explained later in the same thread, we have additional assurances for this through a separate validation step added in 8f53c41. Maintaining a duplicate type is some additional overhead for us, but it's much better than making storybook a dependency.

Testing Instructions

Verify npm run build passes, which includes TypeScript type-checking.

Observe there are no references to storybook package in packages/design-system-mcp/build-types after build.

Observe that the "Validate manifest matches design-system-mcp contract" CI check on this pull request passes.

Use of AI Tools

No AI was used.

@aduth aduth requested a review from manzoorwanijk June 11, 2026 19:46
@aduth aduth requested a review from a team as a code owner June 11, 2026 19:46
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@aduth aduth added the [Type] Build Tooling Issues or PRs related to build tooling label Jun 11, 2026
It's technically a required field in Storybook's internal types, but we don't use it. It was added as part of referencing Storybook internal types, but can be safely dropped from the tests now that we maintain our own type.
@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 8.59 MB

compressed-size-action

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Flaky tests detected in 0379bfe.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27433645378
📝 Reported issues:

@aduth aduth added the [Package] Design System MCP /packages/design-system-mcp label Jun 12, 2026

@manzoorwanijk manzoorwanijk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the problem. Thanks

npx --yes @mawesome/dependency-audit packages/design-system-mcp
trunk This PR
Image Image

@manzoorwanijk manzoorwanijk merged commit 018727f into trunk Jun 13, 2026
41 checks passed
@manzoorwanijk manzoorwanijk deleted the update/ds-mcp-rm-storybook-dep branch June 13, 2026 05:34
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that our types can now go out of sync with Storybook's first-party types, do have a way to know if/when we should update our types? In other words, should we strengthen runtime checks to validate the object structure received from Storybook APIs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the type gets used in the config etc. it should be caught if there is a major upstream change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do lose some assurances here, since the other usage of Storybook internal types doesn't exercise the ComponentManifest type that we rely on so heavily in the MCP package. But also, a lot of what we depend on comes through the reactDocgen types that aren't part of those internal types anyways.

We still have the CI check for ensuring that the manifest is parseable. This should be enough to catch an issue if a Storybook upgrade would regress the ability to retrieve component information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Design System MCP /packages/design-system-mcp [Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants