@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
@@ -0,0 +1,125 @@
1
+ export class SessionManager {
2
+ constructor() {
3
+ this.sessions = new Map();
4
+ this.currentStoryId = null;
5
+ }
6
+ static getInstance() {
7
+ if (!SessionManager.instance) {
8
+ SessionManager.instance = new SessionManager();
9
+ }
10
+ return SessionManager.instance;
11
+ }
12
+ /**
13
+ * Track a newly generated story in the current session
14
+ */
15
+ trackStory(sessionId, story) {
16
+ const sessionStories = this.sessions.get(sessionId) || [];
17
+ // Extract keywords from prompt and title for smart matching
18
+ const keywords = this.extractKeywords(story.prompt + ' ' + story.title);
19
+ const sessionStory = {
20
+ ...story,
21
+ timestamp: new Date(),
22
+ keywords
23
+ };
24
+ sessionStories.push(sessionStory);
25
+ this.sessions.set(sessionId, sessionStories);
26
+ this.currentStoryId = story.id;
27
+ console.error(`[SessionManager] Tracked story: ${story.title} (${story.id}) for session ${sessionId}`);
28
+ }
29
+ /**
30
+ * Get the current story being discussed
31
+ */
32
+ getCurrentStory(sessionId) {
33
+ const stories = this.sessions.get(sessionId) || [];
34
+ if (this.currentStoryId) {
35
+ return stories.find(s => s.id === this.currentStoryId) || null;
36
+ }
37
+ // Return the most recent story if no current story is set
38
+ return stories[stories.length - 1] || null;
39
+ }
40
+ /**
41
+ * Find a story by context (keywords in the user's message)
42
+ */
43
+ findStoryByContext(sessionId, userMessage) {
44
+ const stories = this.sessions.get(sessionId) || [];
45
+ if (stories.length === 0)
46
+ return null;
47
+ const messageKeywords = this.extractKeywords(userMessage.toLowerCase());
48
+ // Score each story based on keyword matches
49
+ const scoredStories = stories.map(story => {
50
+ const score = story.keywords.filter(keyword => messageKeywords.some(msgKeyword => msgKeyword.includes(keyword) || keyword.includes(msgKeyword))).length;
51
+ return { story, score };
52
+ });
53
+ // Sort by score and recency
54
+ scoredStories.sort((a, b) => {
55
+ if (a.score !== b.score)
56
+ return b.score - a.score;
57
+ return b.story.timestamp.getTime() - a.story.timestamp.getTime();
58
+ });
59
+ // Return the best match if it has any keyword matches
60
+ if (scoredStories[0].score > 0) {
61
+ this.currentStoryId = scoredStories[0].story.id;
62
+ console.error(`[SessionManager] Found story by context: ${scoredStories[0].story.title} (score: ${scoredStories[0].score})`);
63
+ return scoredStories[0].story;
64
+ }
65
+ return null;
66
+ }
67
+ /**
68
+ * Get all stories in the current session
69
+ */
70
+ getSessionStories(sessionId) {
71
+ return this.sessions.get(sessionId) || [];
72
+ }
73
+ /**
74
+ * Set the current story being discussed
75
+ */
76
+ setCurrentStory(sessionId, storyId) {
77
+ const stories = this.sessions.get(sessionId) || [];
78
+ if (stories.some(s => s.id === storyId)) {
79
+ this.currentStoryId = storyId;
80
+ console.error(`[SessionManager] Set current story to: ${storyId}`);
81
+ }
82
+ }
83
+ /**
84
+ * Clear session data (for cleanup)
85
+ */
86
+ clearSession(sessionId) {
87
+ this.sessions.delete(sessionId);
88
+ if (this.currentStoryId) {
89
+ this.currentStoryId = null;
90
+ }
91
+ }
92
+ /**
93
+ * Extract meaningful keywords from text
94
+ */
95
+ extractKeywords(text) {
96
+ // Remove common words and extract meaningful terms
97
+ const commonWords = new Set([
98
+ 'a', 'an', 'the', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for',
99
+ 'of', 'with', 'by', 'from', 'up', 'about', 'into', 'through', 'during',
100
+ 'before', 'after', 'above', 'below', 'between', 'under', 'again', 'further',
101
+ 'then', 'once', 'create', 'make', 'generate', 'build', 'add', 'update',
102
+ 'component', 'story', 'please', 'should', 'would', 'could'
103
+ ]);
104
+ const words = text.toLowerCase()
105
+ .replace(/[^a-z0-9\s]/g, ' ')
106
+ .split(/\s+/)
107
+ .filter(word => word.length > 2 && !commonWords.has(word));
108
+ // Also extract compound terms (like "toast notification")
109
+ const phrases = [];
110
+ const importantPhrases = [
111
+ 'toast notification', 'banner notification', 'success message',
112
+ 'error message', 'warning message', 'info message',
113
+ 'dark mode', 'light mode', 'switch', 'toggle', 'button',
114
+ 'card', 'alert', 'modal', 'dialog', 'form', 'input',
115
+ 'table', 'list', 'grid', 'layout', 'navigation', 'menu'
116
+ ];
117
+ const lowerText = text.toLowerCase();
118
+ for (const phrase of importantPhrases) {
119
+ if (lowerText.includes(phrase)) {
120
+ phrases.push(phrase);
121
+ }
122
+ }
123
+ return [...new Set([...words, ...phrases])];
124
+ }
125
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Blacklist of component names that AI commonly mistakes for real components
3
+ * These are often story export names or made-up components that don't exist
4
+ */
5
+ export declare const BLACKLISTED_COMPONENTS: (string | RegExp)[];
6
+ export declare function isBlacklistedComponent(componentName: string, validComponents: Set<string>, importPath?: string): boolean;
7
+ /**
8
+ * Common icon name mistakes - maps incorrect names to correct ones
9
+ */
10
+ export declare const ICON_CORRECTIONS: Record<string, string>;
11
+ export declare function isBlacklistedIcon(iconName: string, allowedIcons: Set<string>): boolean;
12
+ export declare function validateImports(imports: string[], allowedComponents: Set<string>): {
13
+ valid: string[];
14
+ invalid: string[];
15
+ suggestions: Map<string, string[]>;
16
+ };
17
+ /**
18
+ * Get helpful error message for blacklisted component
19
+ */
20
+ export declare function getBlacklistErrorMessage(componentName: string, importPath?: string): string;
21
+ //# sourceMappingURL=componentBlacklist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentBlacklist.d.ts","sourceRoot":"","sources":["../../story-generator/componentBlacklist.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,eAAO,MAAM,sBAAsB,qBA2BlC,CAAC;AAOF,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAqCxH;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwBnD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAuBtF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACpC,CAsBA;AAkCD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAkB3F"}
@@ -80,6 +80,10 @@ export const ICON_CORRECTIONS = {
80
80
  'ForkIcon': 'RepoForkedIcon',
81
81
  'CloseIcon': 'XIcon',
82
82
  'CheckmarkIcon': 'CheckIcon',
83
+ // Ant Design icon corrections
84
+ 'ExclamationTriangleOutlined': 'ExclamationCircleOutlined',
85
+ 'WarningTriangleOutlined': 'WarningOutlined',
86
+ 'ErrorCircleOutlined': 'CloseCircleOutlined',
83
87
  'CrossIcon': 'XIcon',
84
88
  'EditIcon': 'PencilIcon',
85
89
  'DeleteIcon': 'TrashIcon',
@@ -0,0 +1,28 @@
1
+ import { StoryUIConfig } from '../story-ui.config.js';
2
+ export interface DiscoveredComponent {
3
+ name: string;
4
+ filePath: string;
5
+ props: string[];
6
+ description: string;
7
+ category: 'layout' | 'content' | 'form' | 'navigation' | 'feedback' | 'other';
8
+ slots?: string[];
9
+ examples?: string[];
10
+ __componentPath?: string;
11
+ }
12
+ /**
13
+ * Discovers components from a directory structure
14
+ */
15
+ export declare function discoverComponentsFromDirectory(componentsPath: string, componentPrefix?: string): DiscoveredComponent[];
16
+ /**
17
+ * Discovers components from custom-elements.json (Web Components)
18
+ */
19
+ export declare function discoverComponentsFromCustomElements(customElementsPath: string, componentPrefix?: string): DiscoveredComponent[];
20
+ /**
21
+ * Discovers components from package.json exports or index files
22
+ */
23
+ export declare function discoverComponentsFromPackage(packagePath: string, componentPrefix?: string): DiscoveredComponent[];
24
+ /**
25
+ * Main discovery function that tries multiple methods
26
+ */
27
+ export declare function discoverComponents(config: StoryUIConfig): DiscoveredComponent[];
28
+ //# sourceMappingURL=componentDiscovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/componentDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEvE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;IAC9E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,cAAc,EAAE,MAAM,EACtB,eAAe,GAAE,MAAW,GAC3B,mBAAmB,EAAE,CA2DvB;AAED;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,MAAM,EAC1B,eAAe,GAAE,MAAW,GAC3B,mBAAmB,EAAE,CAwCvB;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,EACnB,eAAe,GAAE,MAAW,GAC3B,mBAAmB,EAAE,CA8DvB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,mBAAmB,EAAE,CAmB/E"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Component Registry Generator
3
+ *
4
+ * This module generates a component registry at build time.
5
+ * The registry imports all discovered components from the user's component library
6
+ * and makes them available for runtime JSX compilation in the production app.
7
+ */
8
+ export interface ComponentRegistryEntry {
9
+ name: string;
10
+ importPath: string;
11
+ namedExport: boolean;
12
+ }
13
+ export interface ComponentRegistryConfig {
14
+ importPath: string;
15
+ components: ComponentRegistryEntry[];
16
+ additionalImports?: Array<{
17
+ path: string;
18
+ components: string[];
19
+ }>;
20
+ }
21
+ /**
22
+ * Generate the component registry configuration from discovered components
23
+ * Uses EnhancedComponentDiscovery for comprehensive component detection
24
+ * including external NPM packages like @mantine/core, @chakra-ui/react, etc.
25
+ */
26
+ export declare function generateRegistryConfig(): Promise<ComponentRegistryConfig>;
27
+ /**
28
+ * Synchronous version for backward compatibility
29
+ * Falls back to basic discovery if enhanced discovery fails
30
+ */
31
+ export declare function generateRegistryConfigSync(): ComponentRegistryConfig;
32
+ /**
33
+ * Generate the component registry TypeScript file content
34
+ */
35
+ export declare function generateRegistryFileContent(registryConfig: ComponentRegistryConfig): string;
36
+ /**
37
+ * Generate the component registry file and write it to disk
38
+ * Uses async EnhancedComponentDiscovery for comprehensive component detection
39
+ */
40
+ export declare function generateComponentRegistry(outputPath: string): Promise<void>;
41
+ /**
42
+ * Synchronous version for backward compatibility
43
+ */
44
+ export declare function generateComponentRegistrySync(outputPath: string): void;
45
+ /**
46
+ * Generate a minimal registry for development/testing
47
+ */
48
+ export declare function generateMinimalRegistry(importPath: string, componentNames: string[], outputPath: string): void;
49
+ //# sourceMappingURL=componentRegistryGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentRegistryGenerator.d.ts","sourceRoot":"","sources":["../../story-generator/componentRegistryGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,sBAAsB,EAAE,CAAC;IACrC,iBAAiB,CAAC,EAAE,KAAK,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;CACJ;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC,CA6D/E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,uBAAuB,CA4BpE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,uBAAuB,GAAG,MAAM,CAyD3F;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAajF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAYtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EAAE,EACxB,UAAU,EAAE,MAAM,GACjB,IAAI,CAkBN"}
@@ -0,0 +1,205 @@
1
+ /**
2
+ * Component Registry Generator
3
+ *
4
+ * This module generates a component registry at build time.
5
+ * The registry imports all discovered components from the user's component library
6
+ * and makes them available for runtime JSX compilation in the production app.
7
+ */
8
+ import fs from 'fs';
9
+ import path from 'path';
10
+ import { loadUserConfig } from './configLoader.js';
11
+ import { discoverComponents } from './componentDiscovery.js';
12
+ import { EnhancedComponentDiscovery } from './enhancedComponentDiscovery.js';
13
+ /**
14
+ * Generate the component registry configuration from discovered components
15
+ * Uses EnhancedComponentDiscovery for comprehensive component detection
16
+ * including external NPM packages like @mantine/core, @chakra-ui/react, etc.
17
+ */
18
+ export async function generateRegistryConfig() {
19
+ const config = loadUserConfig();
20
+ // Use EnhancedComponentDiscovery for better external package support
21
+ const discovery = new EnhancedComponentDiscovery(config);
22
+ const enhancedComponents = await discovery.discoverAll();
23
+ // Group components by their source/import path
24
+ const componentsByPath = new Map();
25
+ for (const comp of enhancedComponents) {
26
+ // Determine the import path for this component
27
+ let importPath = config.importPath;
28
+ // If component has a specific source path (for NPM packages), use that
29
+ if (comp.source && comp.source.type === 'npm' && comp.source.path) {
30
+ importPath = comp.source.path;
31
+ }
32
+ const existing = componentsByPath.get(importPath) || [];
33
+ if (!existing.includes(comp.name)) {
34
+ existing.push(comp.name);
35
+ }
36
+ componentsByPath.set(importPath, existing);
37
+ }
38
+ // Convert to registry entries
39
+ const entries = [];
40
+ for (const [importPath, components] of componentsByPath) {
41
+ for (const compName of components) {
42
+ entries.push({
43
+ name: compName,
44
+ importPath,
45
+ namedExport: true,
46
+ });
47
+ }
48
+ }
49
+ // Add components from additionalImports (manual overrides)
50
+ if (config.additionalImports) {
51
+ for (const additionalImport of config.additionalImports) {
52
+ for (const compName of additionalImport.components) {
53
+ // Check if not already added
54
+ if (!entries.find(e => e.name === compName && e.importPath === additionalImport.path)) {
55
+ entries.push({
56
+ name: compName,
57
+ importPath: additionalImport.path,
58
+ namedExport: true,
59
+ });
60
+ }
61
+ }
62
+ }
63
+ }
64
+ console.log(`📦 Registry config generated with ${entries.length} components from ${componentsByPath.size} source(s)`);
65
+ return {
66
+ importPath: config.importPath,
67
+ components: entries,
68
+ additionalImports: config.additionalImports,
69
+ };
70
+ }
71
+ /**
72
+ * Synchronous version for backward compatibility
73
+ * Falls back to basic discovery if enhanced discovery fails
74
+ */
75
+ export function generateRegistryConfigSync() {
76
+ const config = loadUserConfig();
77
+ const discoveredComponents = discoverComponents(config);
78
+ const entries = discoveredComponents.map((comp) => ({
79
+ name: comp.name,
80
+ importPath: config.importPath,
81
+ namedExport: true,
82
+ }));
83
+ // Add components from additionalImports
84
+ if (config.additionalImports) {
85
+ for (const additionalImport of config.additionalImports) {
86
+ for (const compName of additionalImport.components) {
87
+ entries.push({
88
+ name: compName,
89
+ importPath: additionalImport.path,
90
+ namedExport: true,
91
+ });
92
+ }
93
+ }
94
+ }
95
+ return {
96
+ importPath: config.importPath,
97
+ components: entries,
98
+ additionalImports: config.additionalImports,
99
+ };
100
+ }
101
+ /**
102
+ * Generate the component registry TypeScript file content
103
+ */
104
+ export function generateRegistryFileContent(registryConfig) {
105
+ // Group components by import path
106
+ const componentsByPath = new Map();
107
+ for (const comp of registryConfig.components) {
108
+ const existingComponents = componentsByPath.get(comp.importPath) || [];
109
+ existingComponents.push(comp.name);
110
+ componentsByPath.set(comp.importPath, existingComponents);
111
+ }
112
+ // Generate import statements
113
+ const imports = [];
114
+ const registryEntries = [];
115
+ for (const [importPath, components] of componentsByPath) {
116
+ const uniqueComponents = [...new Set(components)];
117
+ imports.push(`import { ${uniqueComponents.join(', ')} } from '${importPath}';`);
118
+ registryEntries.push(...uniqueComponents);
119
+ }
120
+ // Generate the registry file
121
+ const content = `/**
122
+ * Component Registry
123
+ *
124
+ * AUTO-GENERATED FILE - DO NOT EDIT
125
+ * This file is generated at build time by story-ui
126
+ *
127
+ * It exports all components from your component library
128
+ * for use in the live preview renderer.
129
+ */
130
+
131
+ import React from 'react';
132
+ ${imports.join('\n')}
133
+
134
+ // Component registry - maps component names to their implementations
135
+ export const componentRegistry: Record<string, React.ComponentType<any>> = {
136
+ ${registryEntries.map(name => `${name}`).join(',\n ')},
137
+ };
138
+
139
+ // List of available component names
140
+ export const availableComponents = ${JSON.stringify(registryEntries, null, 2)};
141
+
142
+ // Export React for use in compiled code
143
+ export { React };
144
+
145
+ // Helper to get a component by name
146
+ export function getComponent(name: string): React.ComponentType<any> | undefined {
147
+ return componentRegistry[name];
148
+ }
149
+
150
+ // Check if a component exists
151
+ export function hasComponent(name: string): boolean {
152
+ return name in componentRegistry;
153
+ }
154
+ `;
155
+ return content;
156
+ }
157
+ /**
158
+ * Generate the component registry file and write it to disk
159
+ * Uses async EnhancedComponentDiscovery for comprehensive component detection
160
+ */
161
+ export async function generateComponentRegistry(outputPath) {
162
+ const registryConfig = await generateRegistryConfig();
163
+ const content = generateRegistryFileContent(registryConfig);
164
+ // Ensure directory exists
165
+ const dir = path.dirname(outputPath);
166
+ if (!fs.existsSync(dir)) {
167
+ fs.mkdirSync(dir, { recursive: true });
168
+ }
169
+ fs.writeFileSync(outputPath, content, 'utf-8');
170
+ console.log(`✅ Generated component registry with ${registryConfig.components.length} components`);
171
+ console.log(` Output: ${outputPath}`);
172
+ }
173
+ /**
174
+ * Synchronous version for backward compatibility
175
+ */
176
+ export function generateComponentRegistrySync(outputPath) {
177
+ const registryConfig = generateRegistryConfigSync();
178
+ const content = generateRegistryFileContent(registryConfig);
179
+ const dir = path.dirname(outputPath);
180
+ if (!fs.existsSync(dir)) {
181
+ fs.mkdirSync(dir, { recursive: true });
182
+ }
183
+ fs.writeFileSync(outputPath, content, 'utf-8');
184
+ console.log(`✅ Generated component registry with ${registryConfig.components.length} components`);
185
+ console.log(` Output: ${outputPath}`);
186
+ }
187
+ /**
188
+ * Generate a minimal registry for development/testing
189
+ */
190
+ export function generateMinimalRegistry(importPath, componentNames, outputPath) {
191
+ const registryConfig = {
192
+ importPath,
193
+ components: componentNames.map(name => ({
194
+ name,
195
+ importPath,
196
+ namedExport: true,
197
+ })),
198
+ };
199
+ const content = generateRegistryFileContent(registryConfig);
200
+ const dir = path.dirname(outputPath);
201
+ if (!fs.existsSync(dir)) {
202
+ fs.mkdirSync(dir, { recursive: true });
203
+ }
204
+ fs.writeFileSync(outputPath, content, 'utf-8');
205
+ }
@@ -0,0 +1,33 @@
1
+ import { StoryUIConfig } from '../story-ui.config.js';
2
+ /**
3
+ * Loads Story UI configuration from the user's project
4
+ * Looks for story-ui.config.js in the current working directory
5
+ * Uses caching to prevent excessive loading
6
+ */
7
+ export declare function loadUserConfig(): StoryUIConfig;
8
+ /**
9
+ * Validates that the configuration has the necessary paths and components
10
+ */
11
+ export declare function validateConfig(config: StoryUIConfig): {
12
+ isValid: boolean;
13
+ errors: string[];
14
+ };
15
+ /**
16
+ * Analyzes existing Storybook files to detect design system patterns
17
+ */
18
+ export declare function analyzeExistingStories(projectRoot?: string): {
19
+ storyFiles: string[];
20
+ componentDirs: string[];
21
+ importPaths: string[];
22
+ componentPrefixes: string[];
23
+ layoutPatterns: string[];
24
+ };
25
+ /**
26
+ * Detects the Storybook framework being used
27
+ */
28
+ export declare function detectStorybookFramework(dependencies: Record<string, string>): string;
29
+ /**
30
+ * Auto-detects design system configuration by analyzing the project structure
31
+ */
32
+ export declare function autoDetectDesignSystem(): Partial<StoryUIConfig> | null;
33
+ //# sourceMappingURL=configLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configLoader.d.ts","sourceRoot":"","sources":["../../story-generator/configLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAuC,MAAM,uBAAuB,CAAC;AAO3F;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,aAAa,CAkG9C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAsD5F;AA0DD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,MAAsB,GAAG;IAC3E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAkGA;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWrF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAqEtE"}
@@ -25,7 +25,14 @@ export function loadUserConfig() {
25
25
  for (const configPath of configPaths) {
26
26
  if (fs.existsSync(configPath)) {
27
27
  try {
28
- console.log(`Loading Story UI config from: ${configPath}`);
28
+ // Only log to stderr when in MCP mode to avoid corrupting JSON-RPC communication
29
+ const isMcpMode = process.argv.includes('mcp') || process.env.STORY_UI_MCP_MODE === 'true';
30
+ if (isMcpMode) {
31
+ console.error(`Loading Story UI config from: ${configPath}`);
32
+ }
33
+ else {
34
+ console.log(`Loading Story UI config from: ${configPath}`);
35
+ }
29
36
  // Read and evaluate the config file
30
37
  const configContent = fs.readFileSync(configPath, 'utf-8');
31
38
  // Handle both CommonJS and ES modules
@@ -0,0 +1,32 @@
1
+ export interface AIConsiderations {
2
+ libraryName?: string;
3
+ importPath?: string;
4
+ description?: string;
5
+ corePrinciples?: string[];
6
+ componentRules?: Record<string, any>;
7
+ imports?: Record<string, any>;
8
+ patterns?: Record<string, any>;
9
+ dos?: string[];
10
+ donts?: string[];
11
+ specialConsiderations?: string[];
12
+ commonMistakes?: Array<{
13
+ issue: string;
14
+ wrong: string;
15
+ correct: string;
16
+ explanation: string;
17
+ }>;
18
+ aiInstructions?: {
19
+ general?: string[];
20
+ codeGeneration?: string[];
21
+ testing?: string[];
22
+ };
23
+ }
24
+ /**
25
+ * Loads AI considerations from a markdown or JSON file
26
+ */
27
+ export declare function loadConsiderations(considerationsPath?: string): AIConsiderations | null;
28
+ /**
29
+ * Converts considerations to prompt additions
30
+ */
31
+ export declare function considerationsToPrompt(considerations: AIConsiderations): string;
32
+ //# sourceMappingURL=considerationsLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"considerationsLoader.d.ts","sourceRoot":"","sources":["../../story-generator/considerationsLoader.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAqCvF;AA+HD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,gBAAgB,GAAG,MAAM,CA6D/E"}
@@ -1,5 +1,6 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
+ import { logger } from './logger.js';
3
4
  /**
4
5
  * Loads AI considerations from a markdown or JSON file
5
6
  */
@@ -15,7 +16,7 @@ export function loadConsiderations(considerationsPath) {
15
16
  for (const possiblePath of possiblePaths) {
16
17
  if (fs.existsSync(possiblePath)) {
17
18
  considerationsPath = possiblePath;
18
- console.log(`Found considerations file at: ${considerationsPath}`);
19
+ logger.log(`Found considerations file at: ${considerationsPath}`);
19
20
  break;
20
21
  }
21
22
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Documentation sources for design systems
3
+ * Provides fallback documentation when custom docs aren't available
4
+ */
5
+ export interface DocumentationSource {
6
+ version?: string;
7
+ url?: string;
8
+ lastUpdated?: string;
9
+ }
10
+ /**
11
+ * Pre-bundled documentation for popular design systems
12
+ * Users should provide their own documentation in story-ui-docs/ directory for best results
13
+ */
14
+ export declare const BUNDLED_DOCUMENTATION: Record<string, any>;
15
+ /**
16
+ * Get documentation for a design system
17
+ * Falls back to bundled docs if no scraped docs exist
18
+ */
19
+ export declare function getDocumentation(importPath: string): any;
20
+ /**
21
+ * Check if a component is deprecated for a given design system
22
+ */
23
+ export declare function isDeprecatedComponent(importPath: string, componentName: string): boolean;
24
+ /**
25
+ * Get replacement suggestion for a deprecated component
26
+ */
27
+ export declare function getComponentReplacement(importPath: string, componentName: string): string | null;
28
+ //# sourceMappingURL=documentation-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentation-sources.d.ts","sourceRoot":"","sources":["../../story-generator/documentation-sources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAGrD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAMxD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAGxF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhG"}
@@ -0,0 +1,64 @@
1
+ export interface DocumentationSource {
2
+ type: 'markdown' | 'json' | 'html' | 'txt';
3
+ path: string;
4
+ content: string;
5
+ category?: string;
6
+ }
7
+ export interface LoadedDocumentation {
8
+ sources: DocumentationSource[];
9
+ guidelines: string[];
10
+ tokens: Record<string, any>;
11
+ patterns: Record<string, string>;
12
+ components: Record<string, any>;
13
+ }
14
+ export declare class DocumentationLoader {
15
+ private docsDir;
16
+ private cache;
17
+ private lastModified;
18
+ constructor(projectRoot: string);
19
+ /**
20
+ * Check if documentation directory exists
21
+ */
22
+ hasDocumentation(): boolean;
23
+ /**
24
+ * Load all documentation from the directory
25
+ */
26
+ loadDocumentation(): Promise<LoadedDocumentation>;
27
+ /**
28
+ * Categorize file based on path and name
29
+ */
30
+ private categorizeFile;
31
+ /**
32
+ * Process a documentation source based on its type and category
33
+ */
34
+ private processSource;
35
+ /**
36
+ * Format documentation for AI prompt
37
+ */
38
+ formatForPrompt(docs: LoadedDocumentation): string;
39
+ }
40
+ /**
41
+ * Example directory structure:
42
+ *
43
+ * story-ui-docs/
44
+ * ├── README.md # Overview and getting started
45
+ * ├── guidelines/
46
+ * │ ├── accessibility.md # Accessibility guidelines
47
+ * │ ├── responsive-design.md # Responsive design rules
48
+ * │ └── brand-guidelines.md # Brand usage
49
+ * ├── tokens/
50
+ * │ ├── colors.json # Color tokens
51
+ * │ ├── spacing.md # Spacing system
52
+ * │ ├── typography.json # Typography tokens
53
+ * │ └── shadows.json # Shadow tokens
54
+ * ├── components/
55
+ * │ ├── button.md # Button documentation
56
+ * │ ├── form-fields.md # Form component docs
57
+ * │ └── navigation.md # Navigation patterns
58
+ * └── patterns/
59
+ * ├── forms.md # Form patterns
60
+ * ├── cards.md # Card layouts
61
+ * ├── data-tables.md # Table patterns
62
+ * └── authentication.md # Auth flow patterns
63
+ */
64
+ //# sourceMappingURL=documentationLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentationLoader.d.ts","sourceRoot":"","sources":["../../story-generator/documentationLoader.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,YAAY,CAAa;gBAErB,WAAW,EAAE,MAAM;IAK/B;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAmFvD;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,aAAa;IA2CrB;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM;CA0BnD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}