Skip to content

Commit ff217d8

Browse files
CopilotJReinhold
andcommitted
feat: rename experimentalComponentsManifest → componentsManifest with backwards compat
Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
1 parent 841cb88 commit ff217d8

File tree

12 files changed

+66
-23
lines changed

12 files changed

+66
-23
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@storybook/addon-mcp': patch
3+
'@storybook/mcp': patch
4+
---
5+
6+
Rename feature flag `experimentalComponentsManifest``componentsManifest`
7+
8+
The Storybook feature flag has been renamed from `experimentalComponentsManifest` to `componentsManifest` and now defaults to `true` in Storybook core.
9+
10+
The addon is backwards compatible with older Storybook versions that still use the old flag name — it checks `features.componentsManifest` first and falls back to `features.experimentalComponentsManifest`.
11+
12+
**Migration:** Update your `.storybook/main.js` if you had the flag explicitly set:
13+
14+
```js
15+
// Before
16+
features: { experimentalComponentsManifest: true }
17+
18+
// After
19+
features: { componentsManifest: true }
20+
// Or omit entirely — it defaults to true in recent Storybook versions
21+
```

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export { addMyTool, MY_TOOL_NAME } from './tools/my-tool.ts';
253253
- `addon-mcp` depends on `@storybook/mcp` (workspace dependency)
254254
- `AddonContext` extends `StorybookContext` to ensure type compatibility
255255
- Component manifest tools are conditionally registered based on feature flags:
256-
- Checks `features.experimentalComponentsManifest` flag
256+
- Checks `features.componentsManifest` flag (or `features.experimentalComponentsManifest` for backwards compatibility)
257257
- Checks for `experimental_manifests` preset
258258
- Only registers `addListAllDocumentationTool` and `addGetDocumentationTool` when enabled
259259
- Context includes `request` (HTTP Request object) which tools use to determine manifest location

.github/instructions/addon-mcp.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The addon supports two toolsets that can be enabled/disabled:
3131
2. **`docs`** (default: true)
3232
- `list-all-documentation`: List all available components from manifest
3333
- `get-documentation`: Get detailed component documentation
34-
- Requires experimental feature flag `features.experimentalComponentsManifest`
34+
- Requires feature flag `features.componentsManifest`
3535

3636
**Configuration Methods:**
3737

apps/internal-storybook/.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const config = defineMain({
2929
disableTelemetry: true,
3030
},
3131
features: {
32-
experimentalComponentsManifest: true,
32+
componentsManifest: true,
3333
},
3434
// No refs - single source mode
3535
});

eval/templates/grading/.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const config: StorybookConfig = {
1010
],
1111
framework: '@storybook/react-vite',
1212
features: {
13-
experimentalComponentsManifest: true,
13+
componentsManifest: true,
1414
},
1515
};
1616
export default config;

packages/addon-mcp/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ export default {
4848
options: {
4949
toolsets: {
5050
dev: true, // Tools for story URL retrieval and UI building instructions (default: true)
51-
docs: true, // Tools for component manifest and documentation (default: true, requires experimental feature flag below 👇)
51+
docs: true, // Tools for component manifest and documentation (default: true, requires feature flag below 👇)
5252
},
5353
},
5454
},
5555
],
5656
features: {
57-
experimentalComponentsManifest: true, // Enable manifest generation for the docs toolset, only supported in React-based setups.
57+
componentsManifest: true, // Enable manifest generation for the docs toolset, only supported in React-based setups.
5858
},
5959
};
6060
```
6161

6262
**Available Toolsets:**
6363

6464
- `dev`: Enables [Dev Tools](#dev-tools)
65-
- `docs`: Enables [Documentation Tools](#docs-tools-experimental)
65+
- `docs`: Enables [Documentation Tools](#docs-tools)
6666

6767
Disabling the Dev Tools is useful when you want to try out the same experience that your external component consumers will get, because they only get the Component Documentation Tools.
6868

@@ -172,15 +172,15 @@ Agent calls tool, gets response:
172172
http://localhost:6006/?path=/story/example-button--primary
173173
```
174174

175-
### Docs Tools (Experimental)
175+
### Docs Tools
176176

177-
These additional tools are available when the **experimental** component manifest feature is enabled. They provide agents with detailed documentation about your UI components.
177+
These additional tools are available when the component manifest feature is enabled. They provide agents with detailed documentation about your UI components.
178178

179179
**Requirements:**
180180

181181
- Storybook version 10.1.0 or higher (currently only available as prereleases, `storybook@next`)
182182
- React-based framework (`react-vite`, `nextjs-vite`, `nextjs`, `react-webpack5`)
183-
- Feature flag `features.experimentalComponentsManifest` set to `true` in `.storybook/main.js`
183+
- Feature flag `features.componentsManifest` set to `true` in `.storybook/main.js`
184184

185185
**To enable:**
186186

@@ -189,7 +189,7 @@ These additional tools are available when the **experimental** component manifes
189189
export default {
190190
// ... other config
191191
features: {
192-
experimentalComponentsManifest: true,
192+
componentsManifest: true,
193193
},
194194
};
195195
```

packages/addon-mcp/src/mcp-handler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ describe('mcpServerHandler', () => {
329329
return { disableTelemetry: false };
330330
}
331331
if (key === 'features') {
332-
return { experimentalComponentsManifest: true };
332+
return { componentsManifest: true };
333333
}
334334
if (key === 'experimental_manifests') {
335335
return vi.fn();

packages/addon-mcp/src/preset.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('experimental_devServer', () => {
1919
presets: {
2020
apply: vi.fn((key: string) => {
2121
if (key === 'features') {
22-
return Promise.resolve({ experimentalComponentsManifest: false });
22+
return Promise.resolve({ componentsManifest: false });
2323
}
2424
return Promise.resolve(undefined);
2525
}),
@@ -124,7 +124,7 @@ describe('experimental_devServer', () => {
124124
presets: {
125125
apply: vi.fn((key: string) => {
126126
if (key === 'features') {
127-
return Promise.resolve({ experimentalComponentsManifest: false });
127+
return Promise.resolve({ componentsManifest: false });
128128
}
129129
return Promise.resolve(undefined);
130130
}),
@@ -217,7 +217,7 @@ describe('experimental_devServer', () => {
217217
});
218218
}
219219
if (key === 'features') {
220-
return Promise.resolve({ experimentalComponentsManifest: false });
220+
return Promise.resolve({ componentsManifest: false });
221221
}
222222
return Promise.resolve(undefined);
223223
}),
@@ -237,7 +237,7 @@ describe('experimental_devServer', () => {
237237
apply: vi.fn((key: string) => {
238238
if (key === 'refs') return Promise.resolve(null);
239239
if (key === 'features') {
240-
return Promise.resolve({ experimentalComponentsManifest: false });
240+
return Promise.resolve({ componentsManifest: false });
241241
}
242242
return Promise.resolve(undefined);
243243
}),
@@ -256,7 +256,7 @@ describe('experimental_devServer', () => {
256256
apply: vi.fn((key: string) => {
257257
if (key === 'refs') return Promise.reject(new Error('Config error'));
258258
if (key === 'features') {
259-
return Promise.resolve({ experimentalComponentsManifest: false });
259+
return Promise.resolve({ componentsManifest: false });
260260
}
261261
return Promise.resolve(undefined);
262262
}),

packages/addon-mcp/src/tools/is-manifest-available.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import type { Options } from 'storybook/internal/types';
44

55
function createMockOptions({
66
featureFlag = false,
7+
featureFlagName = 'componentsManifest' as 'componentsManifest' | 'experimentalComponentsManifest',
78
hasManifests = false,
89
hasLegacyComponentManifestGenerator = false,
910
hasFeaturesObject = true,
1011
}: {
1112
featureFlag?: boolean;
13+
featureFlagName?: 'componentsManifest' | 'experimentalComponentsManifest';
1214
hasManifests?: boolean;
1315
hasLegacyComponentManifestGenerator?: boolean;
1416
hasFeaturesObject?: boolean;
@@ -17,7 +19,7 @@ function createMockOptions({
1719
presets: {
1820
apply: vi.fn(async (key: string) => {
1921
if (key === 'features') {
20-
return hasFeaturesObject ? { experimentalComponentsManifest: featureFlag } : {};
22+
return hasFeaturesObject ? { [featureFlagName]: featureFlag } : {};
2123
}
2224
if (key === 'experimental_manifests') {
2325
return hasManifests ? { components: { v: 1, components: {} } } : undefined;
@@ -67,6 +69,24 @@ describe('getManifestStatus', () => {
6769
options: { hasManifests: true, hasFeaturesObject: false },
6870
expected: { available: false, hasManifests: true, hasFeatureFlag: false },
6971
},
72+
{
73+
description: 'legacy experimentalComponentsManifest flag is true (backwards compat)',
74+
options: {
75+
featureFlag: true,
76+
featureFlagName: 'experimentalComponentsManifest' as const,
77+
hasManifests: true,
78+
},
79+
expected: { available: true, hasManifests: true, hasFeatureFlag: true },
80+
},
81+
{
82+
description: 'legacy experimentalComponentsManifest flag is false (backwards compat)',
83+
options: {
84+
featureFlag: false,
85+
featureFlagName: 'experimentalComponentsManifest' as const,
86+
hasManifests: true,
87+
},
88+
expected: { available: false, hasManifests: true, hasFeatureFlag: false },
89+
},
7090
])('should return correct status when $description', async ({ options, expected }) => {
7191
const mockOptions = createMockOptions(options);
7292
const result = await getManifestStatus(mockOptions);

packages/addon-mcp/src/tools/is-manifest-available.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export const getManifestStatus = async (options: Options): Promise<ManifestStatu
2222
]);
2323

2424
const hasManifests = !!manifests || !!legacyComponentManifestGenerator;
25-
const hasFeatureFlag = !!features?.experimentalComponentsManifest;
25+
const hasFeatureFlag = !!(
26+
features?.componentsManifest ?? features?.experimentalComponentsManifest
27+
);
2628

2729
return {
2830
available: hasFeatureFlag && hasManifests,

0 commit comments

Comments
 (0)