@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.
- package/README.md +25 -72
- package/dist/cli/deploy.d.ts +0 -7
- package/dist/cli/deploy.d.ts.map +1 -1
- package/dist/cli/deploy.js +10 -421
- package/dist/cli/index.js +0 -29
- package/dist/mcp-server/index.js +20 -66
- package/dist/mcp-server/mcp-stdio-server.js +40 -110
- package/dist/mcp-server/routes/generateStory.d.ts.map +1 -1
- package/dist/mcp-server/routes/generateStory.js +46 -117
- package/dist/mcp-server/routes/generateStoryStream.d.ts.map +1 -1
- package/dist/mcp-server/routes/generateStoryStream.js +30 -72
- package/dist/mcp-server/routes/mcpRemote.d.ts +7 -3
- package/dist/mcp-server/routes/mcpRemote.d.ts.map +1 -1
- package/dist/mcp-server/routes/mcpRemote.js +353 -254
- package/dist/story-generator/generateStory.d.ts.map +1 -1
- package/dist/story-generator/generateStory.js +25 -0
- package/package.json +7 -7
- package/dist/mcp-server/routes/hybridStories.d.ts +0 -18
- package/dist/mcp-server/routes/hybridStories.d.ts.map +0 -1
- package/dist/mcp-server/routes/hybridStories.js +0 -214
- package/dist/mcp-server/routes/memoryStories.d.ts +0 -26
- package/dist/mcp-server/routes/memoryStories.d.ts.map +0 -1
- package/dist/mcp-server/routes/memoryStories.js +0 -147
- package/dist/mcp-server/routes/storySync.d.ts +0 -26
- package/dist/mcp-server/routes/storySync.d.ts.map +0 -1
- package/dist/mcp-server/routes/storySync.js +0 -147
- package/dist/mcp-server/sessionManager.d.ts +0 -50
- package/dist/mcp-server/sessionManager.d.ts.map +0 -1
- package/dist/mcp-server/sessionManager.js +0 -125
- package/dist/story-generator/inMemoryStoryService.d.ts +0 -89
- package/dist/story-generator/inMemoryStoryService.d.ts.map +0 -1
- package/dist/story-generator/inMemoryStoryService.js +0 -128
- package/dist/story-generator/productionGitignoreManager.d.ts +0 -91
- package/dist/story-generator/productionGitignoreManager.d.ts.map +0 -1
- package/dist/story-generator/productionGitignoreManager.js +0 -340
- package/dist/story-generator/storySync.d.ts +0 -68
- package/dist/story-generator/storySync.d.ts.map +0 -1
- 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 =
|
|
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
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
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
|
|
5
|
-
* remote connections from Claude Desktop
|
|
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
|
|
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
|
|
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"}
|