@tpitre/story-ui 2.1.5 → 2.3.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.
Files changed (203) hide show
  1. package/.env.sample +82 -11
  2. package/README.md +130 -4
  3. package/dist/cli/deploy.d.ts +17 -0
  4. package/dist/cli/deploy.d.ts.map +1 -0
  5. package/dist/cli/deploy.js +696 -0
  6. package/dist/cli/index.d.ts +3 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +55 -2
  9. package/dist/cli/setup.d.ts +11 -0
  10. package/dist/cli/setup.d.ts.map +1 -0
  11. package/dist/cli/setup.js +437 -110
  12. package/dist/mcp-server/index.d.ts +2 -0
  13. package/dist/mcp-server/index.d.ts.map +1 -0
  14. package/dist/mcp-server/index.js +138 -6
  15. package/dist/mcp-server/mcp-stdio-server.d.ts +3 -0
  16. package/dist/mcp-server/mcp-stdio-server.d.ts.map +1 -0
  17. package/dist/mcp-server/mcp-stdio-server.js +638 -0
  18. package/dist/mcp-server/routes/claude.d.ts +3 -0
  19. package/dist/mcp-server/routes/claude.d.ts.map +1 -0
  20. package/dist/mcp-server/routes/claude.js +60 -23
  21. package/dist/mcp-server/routes/components.d.ts +4 -0
  22. package/dist/mcp-server/routes/components.d.ts.map +1 -0
  23. package/dist/mcp-server/routes/frameworks.d.ts +38 -0
  24. package/dist/mcp-server/routes/frameworks.d.ts.map +1 -0
  25. package/dist/mcp-server/routes/frameworks.js +183 -0
  26. package/dist/mcp-server/routes/generateStory.d.ts +3 -0
  27. package/dist/mcp-server/routes/generateStory.d.ts.map +1 -0
  28. package/dist/mcp-server/routes/generateStory.js +274 -115
  29. package/dist/mcp-server/routes/generateStoryStream.d.ts +12 -0
  30. package/dist/mcp-server/routes/generateStoryStream.d.ts.map +1 -0
  31. package/dist/mcp-server/routes/generateStoryStream.js +947 -0
  32. package/dist/mcp-server/routes/hybridStories.d.ts +18 -0
  33. package/dist/mcp-server/routes/hybridStories.d.ts.map +1 -0
  34. package/dist/mcp-server/routes/hybridStories.js +214 -0
  35. package/dist/mcp-server/routes/mcpRemote.d.ts +14 -0
  36. package/dist/mcp-server/routes/mcpRemote.d.ts.map +1 -0
  37. package/dist/mcp-server/routes/mcpRemote.js +489 -0
  38. package/dist/mcp-server/routes/memoryStories.d.ts +26 -0
  39. package/dist/mcp-server/routes/memoryStories.d.ts.map +1 -0
  40. package/dist/mcp-server/routes/memoryStories.js +13 -7
  41. package/dist/mcp-server/routes/providers.d.ts +89 -0
  42. package/dist/mcp-server/routes/providers.d.ts.map +1 -0
  43. package/dist/mcp-server/routes/providers.js +369 -0
  44. package/dist/mcp-server/routes/storySync.d.ts +26 -0
  45. package/dist/mcp-server/routes/storySync.d.ts.map +1 -0
  46. package/dist/mcp-server/routes/streamTypes.d.ts +110 -0
  47. package/dist/mcp-server/routes/streamTypes.d.ts.map +1 -0
  48. package/dist/mcp-server/routes/streamTypes.js +18 -0
  49. package/dist/mcp-server/sessionManager.d.ts +50 -0
  50. package/dist/mcp-server/sessionManager.d.ts.map +1 -0
  51. package/dist/mcp-server/sessionManager.js +125 -0
  52. package/dist/story-generator/componentBlacklist.d.ts +21 -0
  53. package/dist/story-generator/componentBlacklist.d.ts.map +1 -0
  54. package/dist/story-generator/componentBlacklist.js +4 -0
  55. package/dist/story-generator/componentDiscovery.d.ts +28 -0
  56. package/dist/story-generator/componentDiscovery.d.ts.map +1 -0
  57. package/dist/story-generator/componentRegistryGenerator.d.ts +49 -0
  58. package/dist/story-generator/componentRegistryGenerator.d.ts.map +1 -0
  59. package/dist/story-generator/componentRegistryGenerator.js +205 -0
  60. package/dist/story-generator/configLoader.d.ts +33 -0
  61. package/dist/story-generator/configLoader.d.ts.map +1 -0
  62. package/dist/story-generator/configLoader.js +8 -1
  63. package/dist/story-generator/considerationsLoader.d.ts +32 -0
  64. package/dist/story-generator/considerationsLoader.d.ts.map +1 -0
  65. package/dist/story-generator/considerationsLoader.js +2 -1
  66. package/dist/story-generator/documentation-sources.d.ts +28 -0
  67. package/dist/story-generator/documentation-sources.d.ts.map +1 -0
  68. package/dist/story-generator/documentationLoader.d.ts +64 -0
  69. package/dist/story-generator/documentationLoader.d.ts.map +1 -0
  70. package/dist/story-generator/documentationLoader.js +4 -3
  71. package/dist/story-generator/dynamicPackageDiscovery.d.ts +97 -0
  72. package/dist/story-generator/dynamicPackageDiscovery.d.ts.map +1 -0
  73. package/dist/story-generator/dynamicPackageDiscovery.js +31 -22
  74. package/dist/story-generator/enhancedComponentDiscovery.d.ts +125 -0
  75. package/dist/story-generator/enhancedComponentDiscovery.d.ts.map +1 -0
  76. package/dist/story-generator/enhancedComponentDiscovery.js +162 -21
  77. package/dist/story-generator/framework-adapters/angular-adapter.d.ts +40 -0
  78. package/dist/story-generator/framework-adapters/angular-adapter.d.ts.map +1 -0
  79. package/dist/story-generator/framework-adapters/angular-adapter.js +427 -0
  80. package/dist/story-generator/framework-adapters/base-adapter.d.ts +75 -0
  81. package/dist/story-generator/framework-adapters/base-adapter.d.ts.map +1 -0
  82. package/dist/story-generator/framework-adapters/base-adapter.js +147 -0
  83. package/dist/story-generator/framework-adapters/framework-detector.d.ts +55 -0
  84. package/dist/story-generator/framework-adapters/framework-detector.d.ts.map +1 -0
  85. package/dist/story-generator/framework-adapters/framework-detector.js +323 -0
  86. package/dist/story-generator/framework-adapters/index.d.ts +97 -0
  87. package/dist/story-generator/framework-adapters/index.d.ts.map +1 -0
  88. package/dist/story-generator/framework-adapters/index.js +198 -0
  89. package/dist/story-generator/framework-adapters/react-adapter.d.ts +40 -0
  90. package/dist/story-generator/framework-adapters/react-adapter.d.ts.map +1 -0
  91. package/dist/story-generator/framework-adapters/react-adapter.js +316 -0
  92. package/dist/story-generator/framework-adapters/svelte-adapter.d.ts +40 -0
  93. package/dist/story-generator/framework-adapters/svelte-adapter.d.ts.map +1 -0
  94. package/dist/story-generator/framework-adapters/svelte-adapter.js +372 -0
  95. package/dist/story-generator/framework-adapters/types.d.ts +182 -0
  96. package/dist/story-generator/framework-adapters/types.d.ts.map +1 -0
  97. package/dist/story-generator/framework-adapters/types.js +8 -0
  98. package/dist/story-generator/framework-adapters/vue-adapter.d.ts +36 -0
  99. package/dist/story-generator/framework-adapters/vue-adapter.d.ts.map +1 -0
  100. package/dist/story-generator/framework-adapters/vue-adapter.js +336 -0
  101. package/dist/story-generator/framework-adapters/web-components-adapter.d.ts +54 -0
  102. package/dist/story-generator/framework-adapters/web-components-adapter.d.ts.map +1 -0
  103. package/dist/story-generator/framework-adapters/web-components-adapter.js +387 -0
  104. package/dist/story-generator/generateStory.d.ts +7 -0
  105. package/dist/story-generator/generateStory.d.ts.map +1 -0
  106. package/dist/story-generator/gitignoreManager.d.ts +50 -0
  107. package/dist/story-generator/gitignoreManager.d.ts.map +1 -0
  108. package/dist/story-generator/gitignoreManager.js +7 -6
  109. package/dist/story-generator/imageProcessor.d.ts +80 -0
  110. package/dist/story-generator/imageProcessor.d.ts.map +1 -0
  111. package/dist/story-generator/imageProcessor.js +391 -0
  112. package/dist/story-generator/inMemoryStoryService.d.ts +89 -0
  113. package/dist/story-generator/inMemoryStoryService.d.ts.map +1 -0
  114. package/dist/story-generator/llm-providers/base-provider.d.ts +36 -0
  115. package/dist/story-generator/llm-providers/base-provider.d.ts.map +1 -0
  116. package/dist/story-generator/llm-providers/base-provider.js +135 -0
  117. package/dist/story-generator/llm-providers/claude-provider.d.ts +23 -0
  118. package/dist/story-generator/llm-providers/claude-provider.d.ts.map +1 -0
  119. package/dist/story-generator/llm-providers/claude-provider.js +414 -0
  120. package/dist/story-generator/llm-providers/gemini-provider.d.ts +24 -0
  121. package/dist/story-generator/llm-providers/gemini-provider.d.ts.map +1 -0
  122. package/dist/story-generator/llm-providers/gemini-provider.js +406 -0
  123. package/dist/story-generator/llm-providers/index.d.ts +63 -0
  124. package/dist/story-generator/llm-providers/index.d.ts.map +1 -0
  125. package/dist/story-generator/llm-providers/index.js +169 -0
  126. package/dist/story-generator/llm-providers/openai-provider.d.ts +24 -0
  127. package/dist/story-generator/llm-providers/openai-provider.d.ts.map +1 -0
  128. package/dist/story-generator/llm-providers/openai-provider.js +458 -0
  129. package/dist/story-generator/llm-providers/settings-manager.d.ts +75 -0
  130. package/dist/story-generator/llm-providers/settings-manager.d.ts.map +1 -0
  131. package/dist/story-generator/llm-providers/settings-manager.js +173 -0
  132. package/dist/story-generator/llm-providers/story-llm-service.d.ts +79 -0
  133. package/dist/story-generator/llm-providers/story-llm-service.d.ts.map +1 -0
  134. package/dist/story-generator/llm-providers/story-llm-service.js +240 -0
  135. package/dist/story-generator/llm-providers/types.d.ts +153 -0
  136. package/dist/story-generator/llm-providers/types.d.ts.map +1 -0
  137. package/dist/story-generator/llm-providers/types.js +8 -0
  138. package/dist/story-generator/logger.d.ts +14 -0
  139. package/dist/story-generator/logger.d.ts.map +1 -0
  140. package/dist/story-generator/logger.js +119 -0
  141. package/dist/story-generator/postProcessStory.d.ts +6 -0
  142. package/dist/story-generator/postProcessStory.d.ts.map +1 -0
  143. package/dist/story-generator/postProcessStory.js +8 -7
  144. package/dist/story-generator/productionGitignoreManager.d.ts +91 -0
  145. package/dist/story-generator/productionGitignoreManager.d.ts.map +1 -0
  146. package/dist/story-generator/productionGitignoreManager.js +11 -10
  147. package/dist/story-generator/promptGenerator.d.ts +48 -0
  148. package/dist/story-generator/promptGenerator.d.ts.map +1 -0
  149. package/dist/story-generator/promptGenerator.js +186 -1
  150. package/dist/story-generator/storyHistory.d.ts +44 -0
  151. package/dist/story-generator/storyHistory.d.ts.map +1 -0
  152. package/dist/story-generator/storySync.d.ts +68 -0
  153. package/dist/story-generator/storySync.d.ts.map +1 -0
  154. package/dist/story-generator/storyTracker.d.ts +48 -0
  155. package/dist/story-generator/storyTracker.d.ts.map +1 -0
  156. package/dist/story-generator/storyTracker.js +2 -1
  157. package/dist/story-generator/storyValidator.d.ts +6 -0
  158. package/dist/story-generator/storyValidator.d.ts.map +1 -0
  159. package/dist/story-generator/universalDesignSystemAdapter.d.ts +68 -0
  160. package/dist/story-generator/universalDesignSystemAdapter.d.ts.map +1 -0
  161. package/dist/story-generator/universalDesignSystemAdapter.js +141 -3
  162. package/dist/story-generator/urlRedirectService.d.ts +21 -0
  163. package/dist/story-generator/urlRedirectService.d.ts.map +1 -0
  164. package/dist/story-generator/urlRedirectService.js +140 -0
  165. package/dist/story-generator/validateStory.d.ts +19 -0
  166. package/dist/story-generator/validateStory.d.ts.map +1 -0
  167. package/dist/story-generator/validateStory.js +6 -2
  168. package/dist/story-generator/visionPrompts.d.ts +88 -0
  169. package/dist/story-generator/visionPrompts.d.ts.map +1 -0
  170. package/dist/story-generator/visionPrompts.js +462 -0
  171. package/dist/story-ui.config.d.ts +78 -0
  172. package/dist/story-ui.config.d.ts.map +1 -0
  173. package/dist/templates/StoryUI/StoryUIPanel.d.ts +4 -0
  174. package/dist/templates/StoryUI/StoryUIPanel.d.ts.map +1 -0
  175. package/dist/templates/StoryUI/StoryUIPanel.js +1874 -0
  176. package/dist/templates/StoryUI/StoryUIPanel.stories.d.ts +18 -0
  177. package/dist/templates/StoryUI/StoryUIPanel.stories.d.ts.map +1 -0
  178. package/dist/templates/StoryUI/StoryUIPanel.stories.js +37 -0
  179. package/dist/templates/StoryUI/index.d.ts +3 -0
  180. package/dist/templates/StoryUI/index.d.ts.map +1 -0
  181. package/dist/templates/StoryUI/index.js +2 -0
  182. package/package.json +35 -4
  183. package/templates/StoryUI/StoryUIPanel.tsx +1973 -388
  184. package/templates/StoryUI/index.tsx +1 -1
  185. package/templates/StoryUI/manager.tsx +264 -0
  186. package/templates/mcp-config-claude.json +11 -0
  187. package/templates/mcp-example.md +76 -0
  188. package/templates/production-app/.env.example +11 -0
  189. package/templates/production-app/index.html +66 -0
  190. package/templates/production-app/package.json +30 -0
  191. package/templates/production-app/public/favicon.svg +5 -0
  192. package/templates/production-app/src/App.tsx +1157 -0
  193. package/templates/production-app/src/LivePreviewRenderer.tsx +420 -0
  194. package/templates/production-app/src/componentRegistry.ts +315 -0
  195. package/templates/production-app/src/considerations.ts +16 -0
  196. package/templates/production-app/src/index.css +284 -0
  197. package/templates/production-app/src/main.tsx +25 -0
  198. package/templates/production-app/tsconfig.json +32 -0
  199. package/templates/production-app/tsconfig.node.json +11 -0
  200. package/templates/production-app/vite.config.ts +83 -0
  201. package/templates/react-import-rule.json +2 -2
  202. package/dist/index.js +0 -12
  203. package/dist/story-ui.config.loader.js +0 -205
@@ -1,2 +1,2 @@
1
+ export { StoryUIPanel } from './StoryUIPanel';
1
2
  export { default } from './StoryUIPanel';
2
- export { default as StoryUIPanel } from './StoryUIPanel';
@@ -0,0 +1,264 @@
1
+ /**
2
+ * Story UI Storybook Manager Addon
3
+ *
4
+ * This addon integrates with Storybook's sidebar to show generated stories.
5
+ * In Edge mode, it fetches stories from the Edge Worker and adds them to the sidebar.
6
+ */
7
+
8
+ import React, { useEffect, useState, useCallback } from 'react';
9
+ import { addons, types } from '@storybook/manager-api';
10
+ import { useStorybookApi, useChannel } from '@storybook/manager-api';
11
+ import { IconButton } from '@storybook/components';
12
+ import { styled } from '@storybook/theming';
13
+
14
+ // Addon identifier
15
+ const ADDON_ID = 'story-ui';
16
+ const PANEL_ID = `${ADDON_ID}/generated-stories`;
17
+ const TOOL_ID = `${ADDON_ID}/tool`;
18
+
19
+ // Event channels for communication between panel and manager
20
+ export const EVENTS = {
21
+ STORY_GENERATED: `${ADDON_ID}/story-generated`,
22
+ REFRESH_STORIES: `${ADDON_ID}/refresh-stories`,
23
+ SELECT_GENERATED_STORY: `${ADDON_ID}/select-generated-story`,
24
+ };
25
+
26
+ // Types
27
+ interface GeneratedStory {
28
+ id: string;
29
+ title: string;
30
+ createdAt: number;
31
+ framework?: string;
32
+ }
33
+
34
+ // Styled components
35
+ const SidebarContainer = styled.div`
36
+ padding: 10px;
37
+ `;
38
+
39
+ const SectionTitle = styled.div`
40
+ font-size: 11px;
41
+ font-weight: 700;
42
+ color: ${({ theme }) => theme.color.mediumdark};
43
+ text-transform: uppercase;
44
+ letter-spacing: 0.35em;
45
+ padding: 10px 0;
46
+ border-bottom: 1px solid ${({ theme }) => theme.appBorderColor};
47
+ margin-bottom: 8px;
48
+ display: flex;
49
+ justify-content: space-between;
50
+ align-items: center;
51
+ `;
52
+
53
+ const StoryList = styled.ul`
54
+ list-style: none;
55
+ padding: 0;
56
+ margin: 0;
57
+ `;
58
+
59
+ const StoryItem = styled.li<{ isActive?: boolean }>`
60
+ padding: 8px 12px;
61
+ cursor: pointer;
62
+ border-radius: 4px;
63
+ font-size: 13px;
64
+ color: ${({ theme, isActive }) => isActive ? theme.color.secondary : theme.color.defaultText};
65
+ background: ${({ theme, isActive }) => isActive ? theme.background.hoverable : 'transparent'};
66
+
67
+ &:hover {
68
+ background: ${({ theme }) => theme.background.hoverable};
69
+ }
70
+
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 8px;
74
+ `;
75
+
76
+ const StoryIcon = styled.span`
77
+ font-size: 14px;
78
+ `;
79
+
80
+ const EmptyState = styled.div`
81
+ padding: 20px;
82
+ text-align: center;
83
+ color: ${({ theme }) => theme.color.mediumdark};
84
+ font-size: 12px;
85
+ `;
86
+
87
+ const RefreshButton = styled.button`
88
+ background: none;
89
+ border: none;
90
+ cursor: pointer;
91
+ padding: 4px;
92
+ color: ${({ theme }) => theme.color.mediumdark};
93
+ font-size: 14px;
94
+
95
+ &:hover {
96
+ color: ${({ theme }) => theme.color.secondary};
97
+ }
98
+ `;
99
+
100
+ /**
101
+ * Get the Edge URL from environment variable.
102
+ * This must be configured via VITE_STORY_UI_EDGE_URL environment variable.
103
+ * No hardcoded URLs - each deployment must configure their own backend.
104
+ */
105
+ function getEdgeUrl(): string {
106
+ // Check for Vite env variable - this is the ONLY source for the Edge URL
107
+ if (typeof import.meta !== 'undefined' && import.meta.env?.VITE_STORY_UI_EDGE_URL) {
108
+ return import.meta.env.VITE_STORY_UI_EDGE_URL;
109
+ }
110
+
111
+ // No fallback - environment variable must be configured
112
+ return '';
113
+ }
114
+
115
+ /**
116
+ * Check if we're in Edge mode
117
+ */
118
+ function isEdgeMode(): boolean {
119
+ const edgeUrl = getEdgeUrl();
120
+ if (edgeUrl) return true;
121
+
122
+ // Check if we're on a production domain
123
+ if (typeof window !== 'undefined') {
124
+ const hostname = window.location.hostname;
125
+ return hostname !== 'localhost' && hostname !== '127.0.0.1';
126
+ }
127
+
128
+ return false;
129
+ }
130
+
131
+ /**
132
+ * Generated Stories Sidebar Component
133
+ */
134
+ const GeneratedStoriesSidebar: React.FC = () => {
135
+ const [stories, setStories] = useState<GeneratedStory[]>([]);
136
+ const [loading, setLoading] = useState(false);
137
+ const [activeStoryId, setActiveStoryId] = useState<string | null>(null);
138
+
139
+ // Listen for story generation events from the panel
140
+ useChannel({
141
+ [EVENTS.STORY_GENERATED]: (data: GeneratedStory) => {
142
+ setStories(prev => [data, ...prev.filter(s => s.id !== data.id)]);
143
+ },
144
+ [EVENTS.REFRESH_STORIES]: () => {
145
+ fetchStories();
146
+ },
147
+ });
148
+
149
+ const fetchStories = useCallback(async () => {
150
+ if (!isEdgeMode()) return;
151
+
152
+ setLoading(true);
153
+ try {
154
+ const edgeUrl = getEdgeUrl();
155
+ const response = await fetch(`${edgeUrl}/story-ui/stories`);
156
+ if (response.ok) {
157
+ const data = await response.json();
158
+ setStories(Array.isArray(data) ? data : []);
159
+ }
160
+ } catch (error) {
161
+ console.error('Failed to fetch generated stories:', error);
162
+ } finally {
163
+ setLoading(false);
164
+ }
165
+ }, []);
166
+
167
+ useEffect(() => {
168
+ fetchStories();
169
+ }, [fetchStories]);
170
+
171
+ const handleStoryClick = useCallback((story: GeneratedStory) => {
172
+ setActiveStoryId(story.id);
173
+
174
+ // Emit event for the Story UI panel to display the story
175
+ const channel = addons.getChannel();
176
+ channel.emit(EVENTS.SELECT_GENERATED_STORY, story);
177
+ }, []);
178
+
179
+ if (!isEdgeMode()) {
180
+ return (
181
+ <SidebarContainer>
182
+ <EmptyState>
183
+ Generated stories appear here in Edge mode
184
+ </EmptyState>
185
+ </SidebarContainer>
186
+ );
187
+ }
188
+
189
+ return (
190
+ <SidebarContainer>
191
+ <SectionTitle>
192
+ Generated Stories
193
+ <RefreshButton onClick={fetchStories} title="Refresh stories">
194
+ {loading ? '...' : '\u21bb'}
195
+ </RefreshButton>
196
+ </SectionTitle>
197
+
198
+ {stories.length === 0 ? (
199
+ <EmptyState>
200
+ {loading ? 'Loading...' : 'No generated stories yet'}
201
+ </EmptyState>
202
+ ) : (
203
+ <StoryList>
204
+ {stories.map((story) => (
205
+ <StoryItem
206
+ key={story.id}
207
+ isActive={activeStoryId === story.id}
208
+ onClick={() => handleStoryClick(story)}
209
+ >
210
+ <StoryIcon>&#128214;</StoryIcon>
211
+ {story.title}
212
+ </StoryItem>
213
+ ))}
214
+ </StoryList>
215
+ )}
216
+ </SidebarContainer>
217
+ );
218
+ };
219
+
220
+ /**
221
+ * Toolbar button to toggle generated stories panel
222
+ */
223
+ const GeneratedStoriesToolbar: React.FC = () => {
224
+ const api = useStorybookApi();
225
+
226
+ if (!isEdgeMode()) return null;
227
+
228
+ return (
229
+ <IconButton
230
+ key={TOOL_ID}
231
+ title="Generated Stories"
232
+ onClick={() => {
233
+ api.togglePanel(true);
234
+ api.setSelectedPanel(PANEL_ID);
235
+ }}
236
+ >
237
+ <span style={{ fontSize: '14px' }}>&#10024;</span>
238
+ </IconButton>
239
+ );
240
+ };
241
+
242
+ // Register the addon
243
+ addons.register(ADDON_ID, (api) => {
244
+ // Only register in Edge mode
245
+ if (!isEdgeMode()) return;
246
+
247
+ // Register the toolbar button
248
+ addons.add(TOOL_ID, {
249
+ type: types.TOOL,
250
+ title: 'Generated Stories',
251
+ match: ({ viewMode }) => viewMode === 'story' || viewMode === 'docs',
252
+ render: () => <GeneratedStoriesToolbar />,
253
+ });
254
+
255
+ // Register the sidebar panel
256
+ addons.add(PANEL_ID, {
257
+ type: types.PANEL,
258
+ title: 'Generated',
259
+ match: ({ viewMode }) => viewMode === 'story' || viewMode === 'docs',
260
+ render: ({ active }) => active ? <GeneratedStoriesSidebar /> : null,
261
+ });
262
+ });
263
+
264
+ export default {};
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "story-ui": {
4
+ "command": "npx",
5
+ "args": ["@tpitre/story-ui", "mcp"],
6
+ "env": {
7
+ "CLAUDE_API_KEY": "your-claude-api-key-here"
8
+ }
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,76 @@
1
+ # Story UI MCP Example
2
+
3
+ This example shows how to use Story UI with Claude Desktop via MCP.
4
+
5
+ ## Example Conversation
6
+
7
+ **You:** Use Story UI to generate a hero section with a gradient background, a main title "Welcome to Our Platform", a subtitle "Build amazing experiences", and two buttons - "Get Started" (primary) and "Learn More" (secondary).
8
+
9
+ **Claude (using Story UI MCP):** I'll help you create a hero section using Story UI. Let me generate that for you.
10
+
11
+ *[Claude would then use the generate-story tool]*
12
+
13
+ The story has been generated successfully! Here's what was created:
14
+
15
+ **Title:** Hero Section with Gradient Background
16
+ **ID:** hero-gradient-1234
17
+
18
+ The generated story includes:
19
+ - A hero section with a beautiful gradient background
20
+ - Main title: "Welcome to Our Platform"
21
+ - Subtitle: "Build amazing experiences"
22
+ - Two buttons with proper styling:
23
+ - "Get Started" button with primary variant
24
+ - "Learn More" button with secondary variant
25
+
26
+ You can now see this story in your Storybook instance under the "Generated" category.
27
+
28
+ **You:** Can you show me what components are available for building layouts?
29
+
30
+ **Claude:** Let me check what layout components are available in your design system.
31
+
32
+ *[Claude would use the list-components tool with category filter]*
33
+
34
+ I found the following layout components available:
35
+ - Grid: Flexible grid system for responsive layouts
36
+ - Container: Page container with max-width constraints
37
+ - Row: Horizontal layout component
38
+ - Column: Vertical layout component
39
+ - Stack: Stacks children vertically or horizontally with spacing
40
+ - Spacer: Adds space between components
41
+
42
+ **You:** Great! Now modify the hero section to use a Grid with two columns - put the text content on the left and add an illustration placeholder on the right.
43
+
44
+ **Claude:** I'll help you iterate on the existing hero section to add a two-column layout with the content on the left and space for an illustration on the right.
45
+
46
+ *[Claude would use generate-story again with the iteration prompt]*
47
+
48
+ The hero section has been updated! The story now features:
49
+ - A Grid component with two equal columns
50
+ - Left column: Contains the title, subtitle, and buttons
51
+ - Right column: Includes a placeholder for an illustration
52
+ - Responsive design that stacks on mobile devices
53
+
54
+ The iteration preserved your existing content while restructuring it into the requested layout.
55
+
56
+ ## Common Workflows
57
+
58
+ ### 1. Component Discovery
59
+ "What Button variants are available in my design system?"
60
+ "Show me all form-related components"
61
+ "What props does the Card component accept?"
62
+
63
+ ### 2. Story Generation
64
+ "Create a login form with email, password, and remember me checkbox"
65
+ "Build a pricing card with a featured badge"
66
+ "Generate a navigation bar with logo and menu items"
67
+
68
+ ### 3. Story Management
69
+ "List all stories I've created today"
70
+ "Show me the story with ID abc-123"
71
+ "Delete the old hero section story"
72
+
73
+ ### 4. Iterative Design
74
+ "Add a dark mode variant to the current story"
75
+ "Make the buttons larger and add icons"
76
+ "Change the color scheme to use brand colors"
@@ -0,0 +1,11 @@
1
+ # Story UI Production App Environment Variables
2
+
3
+ # Backend API URL (required for production)
4
+ # This should point to your Railway-deployed MCP server
5
+ VITE_BACKEND_URL=http://localhost:4001
6
+
7
+ # Optional: Custom app title
8
+ VITE_APP_TITLE=Story UI
9
+
10
+ # Note: When deploying to Cloudflare Pages, set these as environment variables
11
+ # in your Cloudflare dashboard or wrangler.toml
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta name="description" content="Story UI - AI-powered component generation using your design system" />
7
+ <meta name="theme-color" content="#0a0a0a" />
8
+
9
+ <title>Story UI</title>
10
+
11
+ <!-- Preload critical fonts -->
12
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
13
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
14
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fira+Code:wght@400;500&display=swap" rel="stylesheet" />
15
+
16
+ <!-- Favicon -->
17
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
18
+
19
+ <!-- Prevent flash of unstyled content -->
20
+ <style>
21
+ html {
22
+ background-color: #0a0a0a;
23
+ }
24
+ body {
25
+ margin: 0;
26
+ background-color: #0a0a0a;
27
+ }
28
+ #root {
29
+ min-height: 100vh;
30
+ background-color: #0a0a0a;
31
+ }
32
+ /* Initial loading state */
33
+ .initial-loader {
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ height: 100vh;
38
+ color: #a1a1a1;
39
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
40
+ font-size: 14px;
41
+ }
42
+ .initial-loader-spinner {
43
+ width: 24px;
44
+ height: 24px;
45
+ border: 2px solid #27272a;
46
+ border-top-color: #6366f1;
47
+ border-radius: 50%;
48
+ animation: spin 1s linear infinite;
49
+ margin-right: 12px;
50
+ }
51
+ @keyframes spin {
52
+ to { transform: rotate(360deg); }
53
+ }
54
+ </style>
55
+ </head>
56
+ <body>
57
+ <div id="root">
58
+ <!-- Initial loading state (replaced by React) -->
59
+ <div class="initial-loader">
60
+ <div class="initial-loader-spinner"></div>
61
+ <span>Loading Story UI...</span>
62
+ </div>
63
+ </div>
64
+ <script type="module" src="/src/main.tsx"></script>
65
+ </body>
66
+ </html>
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "story-ui-production-app",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Story UI Production App - AI-powered component generation using your design system",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "build": "vite build",
10
+ "preview": "vite preview",
11
+ "type-check": "tsc --noEmit"
12
+ },
13
+ "dependencies": {
14
+ "@babel/standalone": "^7.23.0",
15
+ "react": "^18.2.0",
16
+ "react-dom": "^18.2.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/babel__standalone": "^7.1.7",
20
+ "@types/node": "^20.10.0",
21
+ "@types/react": "^18.2.0",
22
+ "@types/react-dom": "^18.2.0",
23
+ "@vitejs/plugin-react": "^4.2.0",
24
+ "typescript": "^5.3.0",
25
+ "vite": "^5.0.0"
26
+ },
27
+ "engines": {
28
+ "node": ">=18.0.0"
29
+ }
30
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none">
2
+ <rect width="32" height="32" rx="8" fill="#6366f1"/>
3
+ <path d="M8 10h6v2H10v8h4v2H8V10z" fill="white"/>
4
+ <path d="M16 10h8v2h-6v2h4v2h-4v4h6v2h-8V10z" fill="white"/>
5
+ </svg>