@tpitre/story-ui 3.1.0 → 3.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 (38) hide show
  1. package/README.md +25 -72
  2. package/dist/cli/deploy.d.ts +0 -7
  3. package/dist/cli/deploy.d.ts.map +1 -1
  4. package/dist/cli/deploy.js +10 -421
  5. package/dist/cli/index.js +0 -29
  6. package/dist/mcp-server/index.js +20 -66
  7. package/dist/mcp-server/mcp-stdio-server.js +40 -110
  8. package/dist/mcp-server/routes/generateStory.d.ts.map +1 -1
  9. package/dist/mcp-server/routes/generateStory.js +46 -117
  10. package/dist/mcp-server/routes/generateStoryStream.d.ts.map +1 -1
  11. package/dist/mcp-server/routes/generateStoryStream.js +30 -72
  12. package/dist/mcp-server/routes/mcpRemote.d.ts +7 -3
  13. package/dist/mcp-server/routes/mcpRemote.d.ts.map +1 -1
  14. package/dist/mcp-server/routes/mcpRemote.js +353 -254
  15. package/dist/story-generator/generateStory.d.ts.map +1 -1
  16. package/dist/story-generator/generateStory.js +25 -0
  17. package/package.json +7 -7
  18. package/dist/mcp-server/routes/hybridStories.d.ts +0 -18
  19. package/dist/mcp-server/routes/hybridStories.d.ts.map +0 -1
  20. package/dist/mcp-server/routes/hybridStories.js +0 -214
  21. package/dist/mcp-server/routes/memoryStories.d.ts +0 -26
  22. package/dist/mcp-server/routes/memoryStories.d.ts.map +0 -1
  23. package/dist/mcp-server/routes/memoryStories.js +0 -147
  24. package/dist/mcp-server/routes/storySync.d.ts +0 -26
  25. package/dist/mcp-server/routes/storySync.d.ts.map +0 -1
  26. package/dist/mcp-server/routes/storySync.js +0 -147
  27. package/dist/mcp-server/sessionManager.d.ts +0 -50
  28. package/dist/mcp-server/sessionManager.d.ts.map +0 -1
  29. package/dist/mcp-server/sessionManager.js +0 -125
  30. package/dist/story-generator/inMemoryStoryService.d.ts +0 -89
  31. package/dist/story-generator/inMemoryStoryService.d.ts.map +0 -1
  32. package/dist/story-generator/inMemoryStoryService.js +0 -128
  33. package/dist/story-generator/productionGitignoreManager.d.ts +0 -91
  34. package/dist/story-generator/productionGitignoreManager.d.ts.map +0 -1
  35. package/dist/story-generator/productionGitignoreManager.js +0 -340
  36. package/dist/story-generator/storySync.d.ts +0 -68
  37. package/dist/story-generator/storySync.d.ts.map +0 -1
  38. package/dist/story-generator/storySync.js +0 -201
@@ -13,8 +13,6 @@ import { generateStory } from '../../story-generator/generateStory.js';
13
13
  import { EnhancedComponentDiscovery } from '../../story-generator/enhancedComponentDiscovery.js';
14
14
  import { buildClaudePrompt as buildFlexiblePrompt, buildFrameworkAwarePrompt, detectProjectFramework, } from '../../story-generator/promptGenerator.js';
15
15
  import { loadUserConfig, validateConfig } from '../../story-generator/configLoader.js';
16
- import { setupProductionGitignore } from '../../story-generator/productionGitignoreManager.js';
17
- import { getInMemoryStoryService } from '../../story-generator/inMemoryStoryService.js';
18
16
  import { extractAndValidateCodeBlock, createFallbackStory } from '../../story-generator/validateStory.js';
19
17
  import { isBlacklistedComponent, isBlacklistedIcon, getBlacklistErrorMessage, ICON_CORRECTIONS } from '../../story-generator/componentBlacklist.js';
20
18
  import { StoryTracker } from '../../story-generator/storyTracker.js';
@@ -406,12 +404,9 @@ export async function generateStoryFromPromptStream(req, res) {
406
404
  const components = await discovery.discoverAll();
407
405
  stream.sendProgress(currentStep, totalSteps, 'components_discovered', `Found ${components.length} components from ${config.importPath}`, { componentCount: components.length });
408
406
  // Set up environment
409
- const gitignoreManager = setupProductionGitignore(config);
410
- const storyService = getInMemoryStoryService(config);
411
- const isProduction = gitignoreManager.isProductionMode();
412
407
  const storyTracker = new StoryTracker(config);
413
408
  const historyManager = new StoryHistoryManager(process.cwd());
414
- const redirectDir = isProduction ? process.cwd() : path.dirname(config.generatedStoriesPath);
409
+ const redirectDir = path.dirname(config.generatedStoriesPath);
415
410
  const redirectService = new UrlRedirectService(redirectDir);
416
411
  // Check for previous code if update
417
412
  const isActualUpdate = isUpdate || (fileName && conversation && conversation.length > 2);
@@ -636,72 +631,35 @@ export async function generateStoryFromPromptStream(req, res) {
636
631
  stream.sendProgress(currentStep, totalSteps, 'saving', 'Saving your story...');
637
632
  // Analyze what was generated
638
633
  const analysis = analyzeGeneratedCode(fixedFileContents, prompt, config);
639
- if (isProduction) {
640
- const generatedStory = {
641
- id: storyId,
642
- title: aiTitle,
643
- description: isActualUpdate ? `Updated: ${prompt}` : prompt,
644
- content: fixedFileContents,
645
- createdAt: isActualUpdate ? new Date() : new Date(),
646
- lastAccessed: new Date(),
647
- prompt: isActualUpdate && conversation
648
- ? conversation.map((msg) => `${msg.role}: ${msg.content}`).join('\n\n')
649
- : prompt,
650
- components: extractComponentsFromContent(fixedFileContents)
651
- };
652
- storyService.storeStory(generatedStory);
653
- const mapping = {
654
- title: aiTitle,
655
- fileName: finalFileName,
656
- storyId,
657
- hash,
658
- createdAt: new Date().toISOString(),
659
- updatedAt: new Date().toISOString(),
660
- prompt
661
- };
662
- storyTracker.registerStory(mapping);
663
- historyManager.addVersion(finalFileName, prompt, fixedFileContents, parentVersionId);
664
- // Track URL redirect if needed
665
- if (isActualUpdate && oldTitle && oldStoryUrl) {
666
- const newTitleMatch = fixedFileContents.match(/title:\s*["']([^"']+)['"]/);
667
- if (newTitleMatch) {
668
- const newTitle = newTitleMatch[1];
669
- const cleanNewTitle = newTitle.replace(config.storyPrefix, '');
670
- const cleanOldTitle = oldTitle.replace(config.storyPrefix, '');
671
- const newStoryUrl = `/story/${cleanNewTitle.toLowerCase().replace(/[^a-z0-9]+/g, '-')}--primary`;
672
- if (oldStoryUrl !== newStoryUrl) {
673
- redirectService.addRedirect(oldStoryUrl, newStoryUrl, cleanOldTitle, cleanNewTitle, storyId);
674
- }
675
- }
676
- }
677
- }
678
- else {
679
- const outPath = generateStory({
680
- fileContents: fixedFileContents,
681
- fileName: finalFileName,
682
- config: config
683
- });
684
- const mapping = {
685
- title: aiTitle,
686
- fileName: finalFileName,
687
- storyId,
688
- hash,
689
- createdAt: new Date().toISOString(),
690
- updatedAt: new Date().toISOString(),
691
- prompt
692
- };
693
- storyTracker.registerStory(mapping);
694
- historyManager.addVersion(finalFileName, prompt, fixedFileContents, parentVersionId);
695
- if (isActualUpdate && oldTitle && oldStoryUrl) {
696
- const newTitleMatch = fixedFileContents.match(/title:\s*["']([^"']+)['"]/);
697
- if (newTitleMatch) {
698
- const newTitle = newTitleMatch[1];
699
- const cleanNewTitle = newTitle.replace(config.storyPrefix, '');
700
- const cleanOldTitle = oldTitle.replace(config.storyPrefix, '');
701
- const newStoryUrl = `/story/${cleanNewTitle.toLowerCase().replace(/[^a-z0-9]+/g, '-')}--primary`;
702
- if (oldStoryUrl !== newStoryUrl) {
703
- redirectService.addRedirect(oldStoryUrl, newStoryUrl, cleanOldTitle, cleanNewTitle, storyId);
704
- }
634
+ // Write story to file system
635
+ const outPath = generateStory({
636
+ fileContents: fixedFileContents,
637
+ fileName: finalFileName,
638
+ config: config
639
+ });
640
+ // Register with story tracker
641
+ const mapping = {
642
+ title: aiTitle,
643
+ fileName: finalFileName,
644
+ storyId,
645
+ hash,
646
+ createdAt: new Date().toISOString(),
647
+ updatedAt: new Date().toISOString(),
648
+ prompt
649
+ };
650
+ storyTracker.registerStory(mapping);
651
+ // Save to history
652
+ historyManager.addVersion(finalFileName, prompt, fixedFileContents, parentVersionId);
653
+ // Track URL redirect if this is an update and the title changed
654
+ if (isActualUpdate && oldTitle && oldStoryUrl) {
655
+ const newTitleMatch = fixedFileContents.match(/title:\s*["']([^"']+)['"]/);
656
+ if (newTitleMatch) {
657
+ const newTitle = newTitleMatch[1];
658
+ const cleanNewTitle = newTitle.replace(config.storyPrefix, '');
659
+ const cleanOldTitle = oldTitle.replace(config.storyPrefix, '');
660
+ const newStoryUrl = `/story/${cleanNewTitle.toLowerCase().replace(/[^a-z0-9]+/g, '-')}--primary`;
661
+ if (oldStoryUrl !== newStoryUrl) {
662
+ redirectService.addRedirect(oldStoryUrl, newStoryUrl, cleanOldTitle, cleanNewTitle, storyId);
705
663
  }
706
664
  }
707
665
  }
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * MCP Remote HTTP Transport Routes
3
3
  *
4
- * Implements the SSE transport from the MCP SDK to enable
5
- * remote connections from Claude Desktop and other MCP clients.
4
+ * Implements both Streamable HTTP (modern) and SSE (legacy) transports
5
+ * from the MCP SDK to enable remote connections from Claude Desktop
6
+ * and other MCP clients.
7
+ *
8
+ * - Streamable HTTP: Single POST endpoint at /mcp (recommended for Claude Desktop)
9
+ * - SSE: GET /sse + POST /messages (legacy, kept for backwards compatibility)
6
10
  *
7
11
  * This allows Story UI to be accessed from Claude Desktop without requiring
8
12
  * a local process - useful for cloud deployments and shared Storybook instances.
9
13
  *
10
- * Uses the SSE transport available in MCP SDK v0.5.0
14
+ * Uses MCP SDK v1.23.0+ with Streamable HTTP transport
11
15
  */
12
16
  export declare const router: import("express-serve-static-core").Router;
13
17
  export default router;
@@ -1 +1 @@
1
- {"version":3,"file":"mcpRemote.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/mcpRemote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgCH,eAAO,MAAM,MAAM,4CAAW,CAAC;AAygB/B,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"mcpRemote.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/mcpRemote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH,eAAO,MAAM,MAAM,4CAAW,CAAC;AA6mB/B,eAAe,MAAM,CAAC"}