@agiflowai/style-system 0.0.1

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.
@@ -0,0 +1,1368 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+
4
+ //#region src/server/index.d.ts
5
+
6
+ declare function createServer(themePath?: string): Server;
7
+ //#endregion
8
+ //#region src/config.d.ts
9
+ /**
10
+ * App-specific design system configuration
11
+ *
12
+ * This configuration is read from each app's project.json file
13
+ * under the "style-system" key.
14
+ */
15
+ /**
16
+ * Design system configuration schema
17
+ */
18
+ interface DesignSystemConfig {
19
+ /** Type of design system (tailwind or shadcn) */
20
+ type: 'tailwind' | 'shadcn';
21
+ /** Path to tailwind config file (optional) */
22
+ tailwindConfig?: string;
23
+ /** Path to theme provider component with default export */
24
+ themeProvider: string;
25
+ /** Path to root component for wrapping rendered components (optional) */
26
+ rootComponent?: string;
27
+ /** CSS file paths to include (optional) */
28
+ cssFiles?: string[];
29
+ /** Component library path (for shadcn) */
30
+ componentLibrary?: string;
31
+ /** Path to theme CSS file for Tailwind class extraction (optional) */
32
+ themePath?: string;
33
+ /**
34
+ * Tags that identify shared/design system components.
35
+ * Components with these tags are considered shared and reusable.
36
+ * Default: ['style-system']
37
+ */
38
+ sharedComponentTags?: string[];
39
+ }
40
+ //#endregion
41
+ //#region src/services/StoriesIndexService/types.d.ts
42
+ /**
43
+ * StoriesIndexService Types
44
+ *
45
+ * Type definitions for the StoriesIndexService service.
46
+ */
47
+ /**
48
+ * Story meta information from default export
49
+ */
50
+ interface StoryMeta {
51
+ /** Story title (e.g., "Components/Button") */
52
+ title: string;
53
+ /** Reference to the component */
54
+ component?: unknown;
55
+ /** Story tags for filtering */
56
+ tags?: string[];
57
+ /** Story parameters */
58
+ parameters?: Record<string, unknown>;
59
+ /** Arg type definitions */
60
+ argTypes?: Record<string, unknown>;
61
+ }
62
+ /**
63
+ * Component information extracted from story files
64
+ */
65
+ interface ComponentInfo {
66
+ /** Full title from meta (e.g., "Components/Button") */
67
+ title: string;
68
+ /** Absolute path to story file */
69
+ filePath: string;
70
+ /** SHA256 hash of file content for cache invalidation */
71
+ fileHash: string;
72
+ /** Tags from story meta */
73
+ tags: string[];
74
+ /** Names of exported stories */
75
+ stories: string[];
76
+ /** Full story meta object */
77
+ meta: StoryMeta;
78
+ /** Component description extracted from file header JSDoc or meta.parameters.docs.description */
79
+ description?: string;
80
+ }
81
+ //#endregion
82
+ //#region src/services/StoriesIndexService/StoriesIndexService.d.ts
83
+
84
+ /**
85
+ * StoriesIndexService handles indexing and querying Storybook story files.
86
+ *
87
+ * Provides methods for scanning story files, extracting metadata using AST parsing,
88
+ * and querying components by tags, title, or name.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const service = new StoriesIndexService();
93
+ * await service.initialize();
94
+ * const components = service.getAllComponents();
95
+ * const button = service.findComponentByName('Button');
96
+ * ```
97
+ */
98
+ /**
99
+ * Result of initialization with success/failure statistics.
100
+ */
101
+ interface InitializationResult {
102
+ /** Total number of story files found */
103
+ totalFiles: number;
104
+ /** Number of successfully indexed files */
105
+ successCount: number;
106
+ /** Number of files that failed to index */
107
+ failureCount: number;
108
+ /** List of files that failed with their error messages */
109
+ failures: Array<{
110
+ filePath: string;
111
+ error: string;
112
+ }>;
113
+ }
114
+ declare class StoriesIndexService {
115
+ private componentIndex;
116
+ private monorepoRoot;
117
+ private initialized;
118
+ /** Last initialization result for error reporting */
119
+ private lastInitResult;
120
+ /**
121
+ * Creates a new StoriesIndexService instance
122
+ */
123
+ constructor();
124
+ /**
125
+ * Initialize the index by scanning all .stories files.
126
+ * @returns Initialization result with success/failure statistics
127
+ */
128
+ initialize(): Promise<InitializationResult>;
129
+ /**
130
+ * Get the last initialization result.
131
+ * @returns Initialization result or null if not initialized
132
+ */
133
+ getLastInitResult(): InitializationResult | null;
134
+ /**
135
+ * Index a single story file using @storybook/csf-tools.
136
+ *
137
+ * Uses the official Storybook CSF parser which handles all CSF formats
138
+ * including TypeScript satisfies/as expressions.
139
+ */
140
+ private indexStoryFile;
141
+ /**
142
+ * Extract component description from file header JSDoc or meta.parameters.docs.description.
143
+ *
144
+ * Priority:
145
+ * 1. meta.parameters.docs.description.component (Storybook standard)
146
+ * 2. File header JSDoc comment (first block comment in file)
147
+ *
148
+ * @param content - Raw file content
149
+ * @param meta - Parsed meta object from csf-tools
150
+ * @returns Description string or undefined
151
+ */
152
+ private extractDescription;
153
+ /**
154
+ * Hash file content for cache invalidation
155
+ */
156
+ private hashContent;
157
+ /**
158
+ * Get all components filtered by tags
159
+ * @param tags - Optional array of tags to filter by
160
+ * @returns Array of matching components
161
+ */
162
+ getComponentsByTags(tags?: string[]): ComponentInfo[];
163
+ /**
164
+ * Get component by title
165
+ * @param title - Exact title to match (e.g., "Components/Button")
166
+ * @returns Component info or undefined
167
+ */
168
+ getComponentByTitle(title: string): ComponentInfo | undefined;
169
+ /**
170
+ * Find component by partial name match
171
+ * @param name - Partial name to search for
172
+ * @returns First matching component or undefined
173
+ */
174
+ findComponentByName(name: string): ComponentInfo | undefined;
175
+ /**
176
+ * Refresh a specific file if it has changed
177
+ * @param filePath - Absolute path to story file
178
+ * @returns True if file was updated, false if unchanged
179
+ */
180
+ refreshFile(filePath: string): Promise<boolean>;
181
+ /**
182
+ * Get all indexed components
183
+ * @returns Array of all component info objects
184
+ */
185
+ getAllComponents(): ComponentInfo[];
186
+ /**
187
+ * Clear the index (useful for testing)
188
+ */
189
+ clear(): void;
190
+ /**
191
+ * Get all unique tags from indexed components
192
+ * @returns Sorted array of unique tag names
193
+ */
194
+ getAllTags(): string[];
195
+ }
196
+ //#endregion
197
+ //#region src/services/BundlerService/types.d.ts
198
+ /**
199
+ * BundlerService Types
200
+ *
201
+ * Type definitions for the BundlerService abstraction.
202
+ * Supports multiple bundler implementations (Vite, Webpack, etc.)
203
+ * and multiple frameworks (React, Vue, etc.).
204
+ */
205
+ /**
206
+ * Options for rendering a component through the bundler.
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * const options: RenderOptions = {
211
+ * componentPath: '/path/to/Button.stories.tsx',
212
+ * storyName: 'Primary',
213
+ * appPath: 'apps/my-app',
214
+ * darkMode: true,
215
+ * };
216
+ * ```
217
+ */
218
+ interface RenderOptions$1 {
219
+ /** Absolute path to the component story file */
220
+ componentPath: string;
221
+ /** Name of the story to render */
222
+ storyName: string;
223
+ /** Optional args to pass to the story */
224
+ args?: Record<string, unknown>;
225
+ /** Path to theme provider */
226
+ themePath?: string;
227
+ /** Whether to use dark mode */
228
+ darkMode?: boolean;
229
+ /** Path to the app directory */
230
+ appPath: string;
231
+ /** CSS files to import */
232
+ cssFiles?: string[];
233
+ /** Path to root component wrapper */
234
+ rootComponent?: string;
235
+ }
236
+ /**
237
+ * Result from starting a dev server.
238
+ */
239
+ interface DevServerResult {
240
+ /** URL where the dev server is accessible */
241
+ url: string;
242
+ /** Port the server is listening on */
243
+ port: number;
244
+ }
245
+ /**
246
+ * Result from serving a component through dev server.
247
+ */
248
+ interface ServeComponentResult {
249
+ /** URL to access the rendered component */
250
+ url: string;
251
+ /** Path to the generated HTML file (optional if served from memory) */
252
+ htmlFilePath?: string;
253
+ /** The generated HTML content (optional if served from memory) */
254
+ htmlContent?: string;
255
+ }
256
+ /**
257
+ * Result from pre-rendering a component to static HTML.
258
+ */
259
+ interface PrerenderResult {
260
+ /** Path to the generated static HTML file */
261
+ htmlFilePath: string;
262
+ }
263
+ /**
264
+ * Configuration for BundlerService implementations.
265
+ */
266
+ interface BundlerServiceConfig {
267
+ /** Enable verbose logging @default false */
268
+ verbose?: boolean;
269
+ }
270
+ //#endregion
271
+ //#region src/services/BundlerService/BaseBundlerService.d.ts
272
+ /**
273
+ * Abstract base class for bundler service implementations.
274
+ *
275
+ * Subclasses must implement the abstract methods to provide
276
+ * bundler-specific (Vite, Webpack, etc.) and framework-specific
277
+ * (React, Vue, etc.) component rendering logic.
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * class MyCustomBundlerService extends BaseBundlerService {
282
+ * async startDevServer(appPath: string): Promise<DevServerResult> {
283
+ * // Custom dev server logic
284
+ * }
285
+ * // ... implement other abstract methods
286
+ * }
287
+ * ```
288
+ */
289
+ declare abstract class BaseBundlerService {
290
+ protected config: BundlerServiceConfig;
291
+ /**
292
+ * Creates a new bundler service instance.
293
+ * @param config - Service configuration options
294
+ */
295
+ constructor(config?: BundlerServiceConfig);
296
+ /**
297
+ * Get the bundler identifier for this service.
298
+ * @returns Bundler identifier string (e.g., 'vite', 'webpack')
299
+ */
300
+ abstract getBundlerId(): string;
301
+ /**
302
+ * Get the framework identifier for this service.
303
+ * @returns Framework identifier string (e.g., 'react', 'vue')
304
+ */
305
+ abstract getFrameworkId(): string;
306
+ /**
307
+ * Start a dev server for hot reload and caching.
308
+ *
309
+ * @param appPath - Absolute or relative path to the app directory
310
+ * @returns Promise resolving to server URL and port
311
+ * @throws Error if server fails to start
312
+ */
313
+ abstract startDevServer(appPath: string): Promise<DevServerResult>;
314
+ /**
315
+ * Serve a component dynamically through the dev server.
316
+ *
317
+ * @param options - Component rendering options
318
+ * @returns Promise resolving to the component URL and HTML file path
319
+ * @throws Error if dev server is not running or rendering fails
320
+ */
321
+ abstract serveComponent(options: RenderOptions$1): Promise<ServeComponentResult>;
322
+ /**
323
+ * Pre-render a component to a static HTML file.
324
+ *
325
+ * @param options - Component rendering options
326
+ * @returns Promise resolving to the HTML file path
327
+ * @throws Error if build fails
328
+ */
329
+ abstract prerenderComponent(options: RenderOptions$1): Promise<PrerenderResult>;
330
+ /**
331
+ * Check if the dev server is running.
332
+ * @returns True if server is running
333
+ */
334
+ abstract isServerRunning(): boolean;
335
+ /**
336
+ * Get the current server URL.
337
+ * @returns Server URL or null if not running
338
+ */
339
+ abstract getServerUrl(): string | null;
340
+ /**
341
+ * Get the current server port.
342
+ * @returns Server port or null if not running
343
+ */
344
+ abstract getServerPort(): number | null;
345
+ /**
346
+ * Get the current app path being served.
347
+ * @returns App path or null if not running
348
+ */
349
+ abstract getCurrentAppPath(): string | null;
350
+ /**
351
+ * Clean up server resources and reset state.
352
+ */
353
+ abstract cleanup(): Promise<void>;
354
+ }
355
+ //#endregion
356
+ //#region src/services/BundlerService/ViteReactBundlerService.d.ts
357
+ /**
358
+ * ViteReactBundlerService provides Vite + React bundling for component rendering.
359
+ *
360
+ * This is the default implementation of BaseBundlerService that uses Vite
361
+ * as the bundler and React as the framework for rendering components.
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * const service = ViteReactBundlerService.getInstance();
366
+ * await service.startDevServer('apps/my-app');
367
+ * const { url } = await service.serveComponent({
368
+ * componentPath: '/path/to/Button.stories.tsx',
369
+ * storyName: 'Primary',
370
+ * appPath: 'apps/my-app'
371
+ * });
372
+ * ```
373
+ */
374
+ declare class ViteReactBundlerService extends BaseBundlerService {
375
+ private static instance;
376
+ private server;
377
+ private monorepoRoot;
378
+ private serverUrl;
379
+ private serverPort;
380
+ private currentAppPath;
381
+ private storyConfigs;
382
+ /** Timestamps for when each story config was created, used for cleanup */
383
+ private storyConfigTimestamps;
384
+ /** Promise that resolves when server startup completes, prevents race conditions */
385
+ private serverStartPromise;
386
+ /**
387
+ * Creates a new ViteReactBundlerService instance.
388
+ * Use getInstance() for singleton access.
389
+ * @param config - Service configuration options
390
+ */
391
+ constructor(config?: BundlerServiceConfig);
392
+ /**
393
+ * Get the singleton instance of ViteReactBundlerService.
394
+ * Singleton pattern ensures only one dev server runs at a time,
395
+ * preventing port conflicts and resource duplication.
396
+ * @returns The singleton ViteReactBundlerService instance
397
+ */
398
+ static getInstance(): ViteReactBundlerService;
399
+ /**
400
+ * Reset the singleton instance.
401
+ * This is primarily used in testing to ensure a fresh instance.
402
+ * @example
403
+ * ```typescript
404
+ * afterEach(() => {
405
+ * ViteReactBundlerService.resetInstance();
406
+ * });
407
+ * ```
408
+ */
409
+ static resetInstance(): void;
410
+ /**
411
+ * Get the bundler identifier.
412
+ * @returns The bundler ID string ('vite')
413
+ */
414
+ getBundlerId(): string;
415
+ /**
416
+ * Get the framework identifier.
417
+ * @returns The framework ID string ('react')
418
+ */
419
+ getFrameworkId(): string;
420
+ /**
421
+ * Get the current server URL.
422
+ * @returns Server URL or null if not running
423
+ */
424
+ getServerUrl(): string | null;
425
+ /**
426
+ * Get the current server port.
427
+ * @returns Server port or null if not running
428
+ */
429
+ getServerPort(): number | null;
430
+ /**
431
+ * Check if the dev server is running.
432
+ * @returns True if server is running
433
+ */
434
+ isServerRunning(): boolean;
435
+ /**
436
+ * Get the current app path being served.
437
+ * @returns App path or null if not running
438
+ */
439
+ getCurrentAppPath(): string | null;
440
+ /**
441
+ * Start a Vite dev server for hot reload and caching.
442
+ * Handles concurrent calls by returning the same promise if server is already starting.
443
+ * @param appPath - Absolute or relative path to the app directory
444
+ * @returns Promise resolving to server URL and port
445
+ * @throws Error if server fails to start
446
+ */
447
+ startDevServer(appPath: string): Promise<DevServerResult>;
448
+ /**
449
+ * Internal method that performs the actual server startup.
450
+ * @param resolvedAppPath - Resolved absolute path to the app directory
451
+ * @returns Promise resolving to server URL and port
452
+ */
453
+ private doStartDevServer;
454
+ /**
455
+ * Serve a component dynamically through the dev server.
456
+ * @param options - Component rendering options
457
+ * @returns Promise resolving to the component URL and HTML file path
458
+ * @throws Error if dev server is not running or file operations fail
459
+ */
460
+ serveComponent(options: RenderOptions$1): Promise<ServeComponentResult>;
461
+ /**
462
+ * Pre-render a component to a static HTML file.
463
+ * @param options - Component rendering options
464
+ * @returns Promise resolving to the HTML file path
465
+ * @throws Error if build fails
466
+ */
467
+ prerenderComponent(options: RenderOptions$1): Promise<PrerenderResult>;
468
+ /**
469
+ * Clean up server resources and reset state.
470
+ * Closes the Vite dev server if running.
471
+ *
472
+ * Note: Errors during server close are intentionally logged but not re-thrown.
473
+ * This ensures cleanup always completes and state is reset, even if the server
474
+ * is in an unexpected state. Callers should not depend on cleanup failure detection.
475
+ */
476
+ cleanup(): Promise<void>;
477
+ /**
478
+ * Clean up stale story configs to prevent memory leaks.
479
+ * Removes configs that are older than STORY_CONFIG_MAX_AGE_MS or
480
+ * when the number of configs exceeds STORY_CONFIG_MAX_COUNT.
481
+ */
482
+ private cleanupStaleStoryConfigs;
483
+ /**
484
+ * Generate a wrapper CSS file with @source directive for Tailwind v4.
485
+ * This tells Tailwind where to scan for class names when building from .tmp directory.
486
+ * @param appPath - Absolute path to the app directory
487
+ * @param cssFiles - Array of CSS file paths to import
488
+ * @returns Generated CSS content with @source directive
489
+ */
490
+ private generateWrapperCss;
491
+ /**
492
+ * Generate the React entry file content for rendering a story.
493
+ * @param options - Build options including component path and story name
494
+ * @returns Generated TypeScript/JSX entry file content
495
+ */
496
+ private generateEntryFile;
497
+ /**
498
+ * Generate the HTML template for component preview.
499
+ * @param entryFileName - Name of the entry file to include
500
+ * @param darkMode - Whether to add dark mode class to HTML
501
+ * @returns Generated HTML template string
502
+ */
503
+ private generateHtmlTemplate;
504
+ private buildComponent;
505
+ }
506
+ //#endregion
507
+ //#region src/services/BundlerService/BundlerServiceFactory.d.ts
508
+ /**
509
+ * Default factory that creates a ViteReactBundlerService instance.
510
+ * Uses the singleton pattern to ensure only one dev server runs at a time.
511
+ *
512
+ * @returns The singleton ViteReactBundlerService instance
513
+ *
514
+ * @example
515
+ * ```typescript
516
+ * import { createDefaultBundlerService } from './BundlerServiceFactory';
517
+ *
518
+ * const bundler = createDefaultBundlerService();
519
+ * await bundler.startDevServer('apps/my-app');
520
+ * ```
521
+ */
522
+ declare function createDefaultBundlerService(): BaseBundlerService;
523
+ /**
524
+ * Get bundler service based on toolkit.yaml configuration.
525
+ *
526
+ * If a custom service is configured in toolkit.yaml under style-system.bundler.customService,
527
+ * it will be dynamically loaded. Otherwise, returns the default ViteReactBundlerService.
528
+ *
529
+ * The custom service module must:
530
+ * - Export a class that extends BaseBundlerService as default export, OR
531
+ * - Export an instance of BaseBundlerService as default export, OR
532
+ * - Export a getInstance() function that returns a BaseBundlerService
533
+ *
534
+ * @returns Promise resolving to a bundler service instance
535
+ *
536
+ * @example
537
+ * ```typescript
538
+ * // In toolkit.yaml:
539
+ * // style-system:
540
+ * // bundler:
541
+ * // customService: packages/my-app/src/bundler/CustomBundlerService.ts
542
+ *
543
+ * const bundler = await getBundlerServiceFromConfig();
544
+ * await bundler.startDevServer('apps/my-app');
545
+ * ```
546
+ */
547
+ declare function getBundlerServiceFromConfig(): Promise<BaseBundlerService>;
548
+ //#endregion
549
+ //#region src/services/ComponentRendererService/types.d.ts
550
+ /**
551
+ * Factory function type for creating bundler service instances.
552
+ * Allows users to provide custom bundler implementations.
553
+ */
554
+ type BundlerFactory = () => BaseBundlerService;
555
+ /**
556
+ * Options for rendering a component
557
+ */
558
+ interface RenderOptions {
559
+ /** The story variant name to render (e.g., 'Primary', 'Secondary') */
560
+ storyName?: string;
561
+ /** Component props/arguments to pass to the story */
562
+ args?: Record<string, unknown>;
563
+ /** Whether to render in dark mode theme */
564
+ darkMode?: boolean;
565
+ /** Viewport width in pixels */
566
+ width?: number;
567
+ /** Viewport height in pixels */
568
+ height?: number;
569
+ }
570
+ /**
571
+ * Result of component rendering
572
+ */
573
+ interface RenderResult {
574
+ /** Path to the rendered image file */
575
+ imagePath: string;
576
+ /** Generated HTML content */
577
+ html: string;
578
+ /** Component metadata */
579
+ componentInfo: ComponentInfo;
580
+ }
581
+ //#endregion
582
+ //#region src/services/ComponentRendererService/ComponentRendererService.d.ts
583
+ /**
584
+ * ComponentRendererService handles rendering React components to images.
585
+ *
586
+ * Uses BundlerService for building/serving components and ThemeService
587
+ * for theme configuration. Supports both dev server (fast) and static
588
+ * build (fallback) rendering modes.
589
+ *
590
+ * The bundler service can be customized by providing a bundlerFactory
591
+ * to support different bundlers (Vite, Webpack) and frameworks (React, Vue).
592
+ *
593
+ * @example
594
+ * ```typescript
595
+ * // Using default bundler (Vite + React)
596
+ * const service = new ComponentRendererService(designConfig, 'apps/my-app');
597
+ *
598
+ * // Using custom bundler
599
+ * const service = new ComponentRendererService(
600
+ * designConfig,
601
+ * 'apps/my-app',
602
+ * { bundlerFactory: () => new MyCustomBundlerService() }
603
+ * );
604
+ *
605
+ * const result = await service.renderComponent(componentInfo, {
606
+ * storyName: 'Primary',
607
+ * darkMode: true,
608
+ * width: 1280,
609
+ * height: 800
610
+ * });
611
+ * console.log(result.imagePath);
612
+ * ```
613
+ */
614
+ declare class ComponentRendererService {
615
+ private monorepoRoot;
616
+ private tmpDir;
617
+ private themeService;
618
+ private appPath;
619
+ private bundlerFactory;
620
+ /**
621
+ * Creates a new ComponentRendererService instance
622
+ * @param designSystemConfig - Design system configuration
623
+ * @param appPath - Path to the app directory (relative or absolute)
624
+ * @param options - Optional configuration including custom bundler factory
625
+ */
626
+ constructor(designSystemConfig: DesignSystemConfig, appPath: string, options?: {
627
+ bundlerFactory?: BundlerFactory;
628
+ });
629
+ /**
630
+ * Get the bundler service instance.
631
+ * Uses the factory to create/retrieve the bundler.
632
+ * @returns The bundler service instance
633
+ */
634
+ private getBundlerService;
635
+ /**
636
+ * Render a component to an image
637
+ * @param componentInfo - Component metadata from StoriesIndexService
638
+ * @param options - Render options (story name, args, dimensions, etc.)
639
+ * @returns Rendered image path, HTML content, and component info
640
+ * @throws Error if rendering fails
641
+ */
642
+ renderComponent(componentInfo: ComponentInfo, options?: RenderOptions): Promise<RenderResult>;
643
+ /**
644
+ * Maximum number of screenshot files to keep in temp directory.
645
+ * Prevents disk space issues on long-running servers.
646
+ */
647
+ private static readonly MAX_TEMP_FILES;
648
+ /**
649
+ * Clean up old rendered files.
650
+ * Removes files older than the specified duration and enforces a max file count.
651
+ * @param olderThanMs - Remove files older than this duration (default: 1 hour)
652
+ */
653
+ cleanup(olderThanMs?: number): Promise<void>;
654
+ /**
655
+ * Cleanup bundler server and temp files.
656
+ * Called on service shutdown.
657
+ */
658
+ dispose(): Promise<void>;
659
+ }
660
+ //#endregion
661
+ //#region src/services/ThemeService/types.d.ts
662
+ /**
663
+ * Theme metadata returned by listAvailableThemes
664
+ */
665
+ interface ThemeInfo {
666
+ /** Theme name (derived from CSS class selector or filename) */
667
+ name: string;
668
+ /** Original filename with extension */
669
+ fileName: string;
670
+ /** Absolute path to theme file */
671
+ path: string;
672
+ /** Color variables defined in theme (from CSS parsing) */
673
+ colorVariables?: Record<string, string>;
674
+ /** Legacy: color data from JSON config (deprecated, use colorVariables) */
675
+ colors?: Record<string, unknown>;
676
+ /** Number of color shades (e.g., 50-950) */
677
+ shadeCount?: number;
678
+ }
679
+ /**
680
+ * Result of listing available themes
681
+ */
682
+ interface AvailableThemesResult {
683
+ /** Array of available themes */
684
+ themes: ThemeInfo[];
685
+ /** Currently active theme name if detected */
686
+ activeTheme?: string;
687
+ /** Legacy: active brand name (deprecated, use activeTheme) */
688
+ activeBrand?: string;
689
+ /** Source of themes (css-file, json-config, custom) */
690
+ source?: 'css-file' | 'json-config' | 'custom';
691
+ }
692
+ //#endregion
693
+ //#region src/services/ThemeService/ThemeService.d.ts
694
+ /**
695
+ * ThemeService handles theme configuration and CSS generation.
696
+ *
697
+ * Provides methods for accessing theme CSS, generating theme wrappers,
698
+ * and listing available theme configurations.
699
+ *
700
+ * @example
701
+ * ```typescript
702
+ * const service = new ThemeService(designConfig);
703
+ * const cssFiles = await service.getThemeCSS();
704
+ * const themes = await service.listAvailableThemes();
705
+ * ```
706
+ */
707
+ declare class ThemeService {
708
+ private monorepoRoot;
709
+ private config;
710
+ /**
711
+ * Creates a new ThemeService instance
712
+ * @param config - Design system configuration
713
+ */
714
+ constructor(config: DesignSystemConfig);
715
+ /**
716
+ * Get design system configuration
717
+ * @returns Current design system configuration
718
+ */
719
+ getConfig(): DesignSystemConfig;
720
+ /**
721
+ * Get theme CSS imports from config or common locations
722
+ * @returns Array of absolute paths to CSS files
723
+ */
724
+ getThemeCSS(): Promise<string[]>;
725
+ /**
726
+ * Generate theme provider wrapper code
727
+ * Uses default export as specified in config
728
+ * @param componentCode - Component code to wrap
729
+ * @param darkMode - Whether to use dark mode theme
730
+ * @returns Generated wrapper code string
731
+ */
732
+ generateThemeWrapper(componentCode: string, darkMode?: boolean): string;
733
+ /**
734
+ * Get inline theme styles for SSR
735
+ * @param darkMode - Whether to use dark mode styles
736
+ * @returns Combined CSS content as string
737
+ */
738
+ getInlineStyles(darkMode?: boolean): Promise<string>;
739
+ /**
740
+ * Get Tailwind CSS classes for theming
741
+ * @param darkMode - Whether to use dark mode classes
742
+ * @returns Array of Tailwind class names
743
+ */
744
+ getTailwindClasses(darkMode?: boolean): string[];
745
+ /**
746
+ * Validate that the theme provider path exists
747
+ * @returns True if theme provider is valid
748
+ */
749
+ validateThemeProvider(): Promise<boolean>;
750
+ /**
751
+ * List all available theme configurations
752
+ * @returns Object containing themes array and active brand
753
+ * @throws Error if themes directory cannot be read
754
+ */
755
+ listAvailableThemes(): Promise<AvailableThemesResult>;
756
+ }
757
+ //#endregion
758
+ //#region src/services/CssClasses/types.d.ts
759
+ /**
760
+ * CSSClasses Service Types
761
+ *
762
+ * Shared type definitions for CSS class extraction services.
763
+ * Configuration is read from toolkit.yaml under the 'style-system' key.
764
+ */
765
+ /**
766
+ * Represents a single CSS class with its name and value
767
+ */
768
+ interface CSSClassValue {
769
+ class: string;
770
+ value: string;
771
+ }
772
+ /**
773
+ * Categories of CSS classes that can be extracted
774
+ */
775
+ type CSSClassCategory = 'colors' | 'typography' | 'spacing' | 'effects' | 'all';
776
+ /**
777
+ * Result of CSS class extraction organized by category
778
+ */
779
+ interface CSSClassesResult {
780
+ category: string;
781
+ classes: {
782
+ colors?: CSSClassValue[];
783
+ typography?: CSSClassValue[];
784
+ spacing?: CSSClassValue[];
785
+ effects?: CSSClassValue[];
786
+ sidebar?: CSSClassValue[];
787
+ icons?: CSSClassValue[];
788
+ grid?: CSSClassValue[];
789
+ animations?: CSSClassValue[];
790
+ };
791
+ totalClasses?: number;
792
+ }
793
+ /**
794
+ * CSS classes service configuration
795
+ *
796
+ * Example toolkit.yaml:
797
+ * ```yaml
798
+ * style-system:
799
+ * getCssClasses:
800
+ * customService: ./my-custom-css-service.ts
801
+ * ```
802
+ */
803
+ interface StyleSystemConfig {
804
+ /** CSS framework type (tailwind, vanilla, etc.) */
805
+ cssFramework: string;
806
+ /**
807
+ * Custom service class path for CSS extraction override.
808
+ * Path is relative to workspace root.
809
+ * The module must export a class that extends BaseCSSClassesService.
810
+ */
811
+ customServicePath?: string;
812
+ }
813
+ /**
814
+ * Default configuration values
815
+ */
816
+ declare const DEFAULT_STYLE_SYSTEM_CONFIG: StyleSystemConfig;
817
+ //#endregion
818
+ //#region src/services/CssClasses/BaseCSSClassesService.d.ts
819
+ /**
820
+ * Abstract base class for CSS class extraction services.
821
+ *
822
+ * Subclasses must implement the `extractClasses` method to provide
823
+ * framework-specific CSS class extraction logic.
824
+ *
825
+ * @example
826
+ * ```typescript
827
+ * class MyCustomCSSService extends BaseCSSClassesService {
828
+ * async extractClasses(category: CSSClassCategory, themePath: string): Promise<CSSClassesResult> {
829
+ * // Custom extraction logic
830
+ * }
831
+ * }
832
+ * ```
833
+ */
834
+ declare abstract class BaseCSSClassesService {
835
+ protected config: StyleSystemConfig;
836
+ /**
837
+ * Creates a new CSS classes service instance
838
+ * @param config - Style system configuration from toolkit.yaml
839
+ */
840
+ constructor(config: StyleSystemConfig);
841
+ /**
842
+ * Extract CSS classes from a theme file.
843
+ *
844
+ * Subclasses must implement this method to provide framework-specific
845
+ * extraction logic (e.g., Tailwind, vanilla CSS, CSS-in-JS).
846
+ *
847
+ * @param category - Category filter for CSS classes ('colors', 'typography', 'spacing', 'effects', 'all')
848
+ * @param themePath - Absolute path to the theme CSS file
849
+ * @returns Promise resolving to extracted CSS classes organized by category
850
+ * @throws Error if theme file cannot be read or parsed
851
+ */
852
+ abstract extractClasses(category: CSSClassCategory | string, themePath: string): Promise<CSSClassesResult>;
853
+ /**
854
+ * Get the CSS framework identifier for this service
855
+ * @returns Framework identifier string (e.g., 'tailwind', 'vanilla')
856
+ */
857
+ abstract getFrameworkId(): string;
858
+ /**
859
+ * Validate that the theme path exists and is readable.
860
+ * Can be overridden by subclasses for custom validation.
861
+ *
862
+ * @param themePath - Path to validate
863
+ * @throws Error if path is invalid or unreadable
864
+ */
865
+ protected validateThemePath(themePath: string): Promise<void>;
866
+ }
867
+ //#endregion
868
+ //#region src/services/CssClasses/TailwindCSSClassesService.d.ts
869
+ /**
870
+ * Tailwind CSS class extraction service.
871
+ *
872
+ * Extracts CSS classes from Tailwind theme files by parsing CSS variables
873
+ * using postcss AST and generating corresponding utility class names.
874
+ *
875
+ * @example
876
+ * ```typescript
877
+ * const service = new TailwindCSSClassesService(config);
878
+ * const result = await service.extractClasses('colors', '/path/to/theme.css');
879
+ * console.log(result.classes.colors); // Array of color utility classes
880
+ * ```
881
+ */
882
+ declare class TailwindCSSClassesService extends BaseCSSClassesService {
883
+ /**
884
+ * Creates a new TailwindCSSClassesService instance
885
+ * @param config - Style system configuration from toolkit.yaml
886
+ */
887
+ constructor(config: StyleSystemConfig);
888
+ /**
889
+ * Get the CSS framework identifier
890
+ * @returns Framework identifier string 'tailwind'
891
+ */
892
+ getFrameworkId(): string;
893
+ /**
894
+ * Extract Tailwind CSS classes from a theme file.
895
+ *
896
+ * Uses postcss to parse the CSS AST and safely extract variable declarations,
897
+ * then generates corresponding Tailwind utility classes (e.g., bg-*, text-*, border-*).
898
+ *
899
+ * Note: If an unrecognized category is passed, the method returns a result with
900
+ * empty classes object. Use valid categories: 'colors', 'typography', 'spacing', 'effects', 'all'.
901
+ *
902
+ * @param category - Category filter ('colors', 'typography', 'spacing', 'effects', 'all')
903
+ * @param themePath - Absolute path to the theme CSS file
904
+ * @returns Promise resolving to extracted CSS classes organized by category
905
+ * @throws Error if theme file cannot be read or parsed
906
+ */
907
+ extractClasses(category: CSSClassCategory | string, themePath: string): Promise<CSSClassesResult>;
908
+ /**
909
+ * Extract CSS variables with their values from theme content using postcss AST.
910
+ *
911
+ * Walks the CSS AST to find all custom property declarations (--*),
912
+ * handling multi-line values, comments, and any CSS formatting.
913
+ *
914
+ * @param themeContent - Raw CSS content from theme file
915
+ * @returns Promise resolving to Map of variable names (without --) to their values
916
+ *
917
+ * @example
918
+ * ```typescript
919
+ * // Handles standard declarations
920
+ * // --color-primary: #3b82f6;
921
+ *
922
+ * // Handles multi-line declarations
923
+ * // --shadow-lg:
924
+ * // 0 10px 15px -3px rgba(0, 0, 0, 0.1),
925
+ * // 0 4px 6px -4px rgba(0, 0, 0, 0.1);
926
+ *
927
+ * // Handles compressed CSS
928
+ * // --color-primary:#3b82f6;--color-secondary:#10b981;
929
+ * ```
930
+ */
931
+ private extractVariablesWithPostCSS;
932
+ /**
933
+ * Generate utility classes with actual values from CSS variables.
934
+ *
935
+ * Maps CSS variable naming conventions to Tailwind utility classes:
936
+ * - color-* → bg-*, text-*, border-*, ring-*
937
+ * - sidebar* → bg-*, text-*, border-*
938
+ * - text-* → text-* (typography)
939
+ * - font-* → font-* (typography)
940
+ * - space-* → p-*, m-*, gap-*
941
+ * - shadow-* → shadow-*
942
+ *
943
+ * Note: If the variables Map is empty, returns a result with empty arrays
944
+ * for all requested categories.
945
+ *
946
+ * @param variables - Map of CSS variable names to values
947
+ * @param category - Category filter for which classes to generate
948
+ * @returns CSSClassesResult with organized classes by category
949
+ *
950
+ * @example
951
+ * ```typescript
952
+ * const variables = new Map([
953
+ * ['color-primary', '#3b82f6'],
954
+ * ['shadow-md', '0 4px 6px rgba(0,0,0,0.1)']
955
+ * ]);
956
+ * const result = generateClassesFromVariables(variables, 'colors');
957
+ * // Returns:
958
+ * // {
959
+ * // category: 'colors',
960
+ * // classes: {
961
+ * // colors: [
962
+ * // { class: 'bg-primary', value: '#3b82f6' },
963
+ * // { class: 'text-primary', value: '#3b82f6' },
964
+ * // { class: 'border-primary', value: '#3b82f6' },
965
+ * // { class: 'ring-primary', value: '#3b82f6' }
966
+ * // ]
967
+ * // },
968
+ * // totalClasses: 4
969
+ * // }
970
+ * ```
971
+ */
972
+ private generateClassesFromVariables;
973
+ }
974
+ //#endregion
975
+ //#region src/services/CssClasses/CSSClassesServiceFactory.d.ts
976
+ /**
977
+ * Factory for creating CSS classes service instances.
978
+ *
979
+ * Supports built-in frameworks (tailwind) and custom service implementations
980
+ * loaded dynamically from user-specified paths.
981
+ *
982
+ * @example
983
+ * ```typescript
984
+ * const factory = new CSSClassesServiceFactory();
985
+ * const service = await factory.createService({ cssFramework: 'tailwind' });
986
+ * const classes = await service.extractClasses('colors', '/path/to/theme.css');
987
+ * ```
988
+ */
989
+ declare class CSSClassesServiceFactory {
990
+ /**
991
+ * Create a CSS classes service based on configuration.
992
+ *
993
+ * @param config - Style system configuration (defaults to tailwind)
994
+ * @returns Promise resolving to a CSS classes service instance
995
+ * @throws Error if framework is unknown or custom service cannot be loaded
996
+ */
997
+ createService(config?: Partial<StyleSystemConfig>): Promise<BaseCSSClassesService>;
998
+ /**
999
+ * Create a built-in CSS classes service based on framework identifier.
1000
+ *
1001
+ * @param config - Resolved style system configuration
1002
+ * @returns CSS classes service instance
1003
+ * @throws Error if framework is not supported
1004
+ */
1005
+ private createBuiltInService;
1006
+ /**
1007
+ * Load a custom CSS classes service from user-specified path.
1008
+ *
1009
+ * The custom service must export a class that extends BaseCSSClassesService.
1010
+ *
1011
+ * @param config - Configuration with customServicePath set
1012
+ * @returns Promise resolving to custom service instance
1013
+ * @throws Error if service cannot be loaded or is invalid
1014
+ */
1015
+ private loadCustomService;
1016
+ }
1017
+ //#endregion
1018
+ //#region src/types/index.d.ts
1019
+ /**
1020
+ * Tool definition for MCP
1021
+ */
1022
+ interface ToolDefinition {
1023
+ name: string;
1024
+ description: string;
1025
+ inputSchema: {
1026
+ type: string;
1027
+ properties: Record<string, any>;
1028
+ required?: string[];
1029
+ additionalProperties?: boolean;
1030
+ };
1031
+ }
1032
+ /**
1033
+ * Base tool interface following MCP SDK patterns
1034
+ */
1035
+ interface Tool<TInput = any> {
1036
+ getDefinition(): ToolDefinition;
1037
+ execute(input: TInput): Promise<CallToolResult>;
1038
+ }
1039
+ //#endregion
1040
+ //#region src/tools/GetCSSClassesTool.d.ts
1041
+ /**
1042
+ * Input parameters for GetCSSClassesTool
1043
+ */
1044
+ interface GetCSSClassesInput {
1045
+ category?: string;
1046
+ appPath?: string;
1047
+ }
1048
+ /**
1049
+ * MCP Tool for extracting CSS classes from theme files.
1050
+ *
1051
+ * Uses the CSSClassesServiceFactory to create the appropriate service
1052
+ * based on configuration, supporting Tailwind and custom CSS frameworks.
1053
+ *
1054
+ * @example
1055
+ * ```typescript
1056
+ * const tool = new GetCSSClassesTool();
1057
+ * const result = await tool.execute({ category: 'colors' });
1058
+ * ```
1059
+ */
1060
+ declare class GetCSSClassesTool implements Tool<GetCSSClassesInput> {
1061
+ static readonly TOOL_NAME = "get_css_classes";
1062
+ private static readonly CSS_REUSE_INSTRUCTION;
1063
+ private serviceFactory;
1064
+ private service;
1065
+ private defaultThemePath;
1066
+ /**
1067
+ * Creates a new GetCSSClassesTool instance
1068
+ * @param defaultThemePath - Default path to theme CSS file (relative to workspace root)
1069
+ */
1070
+ constructor(defaultThemePath?: string);
1071
+ /**
1072
+ * Returns the tool definition for MCP registration
1073
+ * @returns Tool definition with name, description, and input schema
1074
+ */
1075
+ getDefinition(): ToolDefinition;
1076
+ /**
1077
+ * Executes the CSS class extraction
1078
+ * @param input - Tool input parameters
1079
+ * @returns CallToolResult with extracted CSS classes or error
1080
+ */
1081
+ execute(input: GetCSSClassesInput): Promise<CallToolResult>;
1082
+ /**
1083
+ * Resolves the theme file path based on app configuration or defaults.
1084
+ *
1085
+ * Resolution strategy:
1086
+ * 1. If appPath provided, read themePath from project.json style-system config
1087
+ * 2. themePath is resolved relative to the app directory (where project.json is)
1088
+ * 3. Fall back to default theme path if not configured
1089
+ *
1090
+ * @param appPath - Optional app path to read config from
1091
+ * @returns Absolute path to the theme file
1092
+ */
1093
+ private resolveThemePath;
1094
+ }
1095
+ //#endregion
1096
+ //#region src/services/GetUiComponentService/types.d.ts
1097
+ /**
1098
+ * GetUiComponentService Types
1099
+ *
1100
+ * Type definitions for the GetUiComponentService service.
1101
+ */
1102
+ /**
1103
+ * Configuration options for GetUiComponentService.
1104
+ *
1105
+ * All options are optional. When not provided, values from
1106
+ * DEFAULT_GET_UI_COMPONENT_CONFIG are used as fallbacks.
1107
+ */
1108
+ interface GetUiComponentServiceConfig {
1109
+ /** Default story name to render if not specified @default 'Playground' */
1110
+ defaultStoryName?: string;
1111
+ /** Default dark mode setting @default true */
1112
+ defaultDarkMode?: boolean;
1113
+ /** Default viewport width @default 1280 */
1114
+ defaultWidth?: number;
1115
+ /** Default viewport height @default 800 */
1116
+ defaultHeight?: number;
1117
+ }
1118
+ /**
1119
+ * Input parameters for getting a UI component preview.
1120
+ *
1121
+ * @example
1122
+ * ```typescript
1123
+ * const input: GetUiComponentInput = {
1124
+ * componentName: 'Button',
1125
+ * appPath: './apps/my-app',
1126
+ * storyName: 'Primary',
1127
+ * darkMode: true,
1128
+ * };
1129
+ * ```
1130
+ */
1131
+ interface GetUiComponentInput {
1132
+ /** The name of the component to capture (e.g., "Button", "Card") */
1133
+ componentName: string;
1134
+ /** App path (relative or absolute) to load design system configuration from */
1135
+ appPath: string;
1136
+ /** The story name to render (e.g., "Playground", "Default") */
1137
+ storyName?: string;
1138
+ /** Whether to render the component in dark mode */
1139
+ darkMode?: boolean;
1140
+ /** CSS selector to target specific element for screenshot */
1141
+ selector?: string;
1142
+ }
1143
+ /**
1144
+ * Result returned by GetUiComponentService.getComponent().
1145
+ */
1146
+ interface GetUiComponentResult {
1147
+ /** Path to the rendered image file */
1148
+ imagePath: string;
1149
+ /** Image format */
1150
+ format: string;
1151
+ /** Dimension info */
1152
+ dimensions: string;
1153
+ /** Path to the story file */
1154
+ storyFilePath: string;
1155
+ /** Content of the story file */
1156
+ storyFileContent: string;
1157
+ /** Component title from stories index */
1158
+ componentTitle: string;
1159
+ /** Available stories for this component */
1160
+ availableStories: string[];
1161
+ /** The story that was actually rendered */
1162
+ renderedStory: string;
1163
+ }
1164
+ //#endregion
1165
+ //#region src/services/GetUiComponentService/GetUiComponentService.d.ts
1166
+ /**
1167
+ * Factory function type for creating StoriesIndexService instances.
1168
+ */
1169
+ type StoriesIndexFactory = () => StoriesIndexService;
1170
+ /**
1171
+ * Factory function type for creating ComponentRendererService instances.
1172
+ */
1173
+ type RendererFactory = (config: DesignSystemConfig, appPath: string) => ComponentRendererService;
1174
+ /**
1175
+ * GetUiComponentService handles rendering UI component previews.
1176
+ *
1177
+ * Locates components in the stories index, renders them with app-specific
1178
+ * design system configuration, and returns screenshot results.
1179
+ *
1180
+ * @example
1181
+ * ```typescript
1182
+ * const service = new GetUiComponentService();
1183
+ * const result = await service.getComponent({
1184
+ * componentName: 'Button',
1185
+ * appPath: 'apps/my-app',
1186
+ * });
1187
+ * console.log(result.imagePath);
1188
+ * ```
1189
+ */
1190
+ declare class GetUiComponentService {
1191
+ private config;
1192
+ private storiesIndexFactory;
1193
+ private rendererFactory;
1194
+ /**
1195
+ * Creates a new GetUiComponentService instance.
1196
+ * @param config - Service configuration options
1197
+ * @param storiesIndexFactory - Factory for creating StoriesIndexService (for DI/testing)
1198
+ * @param rendererFactory - Factory for creating ComponentRendererService (for DI/testing)
1199
+ */
1200
+ constructor(config?: GetUiComponentServiceConfig, storiesIndexFactory?: StoriesIndexFactory, rendererFactory?: RendererFactory);
1201
+ /**
1202
+ * Get a UI component preview image.
1203
+ *
1204
+ * @param input - Component input parameters
1205
+ * @returns Result with image path and component metadata
1206
+ * @throws Error if input validation fails, component not found, or rendering fails
1207
+ */
1208
+ getComponent(input: GetUiComponentInput): Promise<GetUiComponentResult>;
1209
+ /**
1210
+ * Resolve and validate the story name.
1211
+ *
1212
+ * @param requestedStory - The requested story name
1213
+ * @param availableStories - List of available stories for the component
1214
+ * @returns Valid story name (requested or fallback)
1215
+ */
1216
+ private resolveStoryName;
1217
+ /**
1218
+ * Read the story file content.
1219
+ *
1220
+ * @param filePath - Path to the story file
1221
+ * @returns File content or error message
1222
+ */
1223
+ private readStoryFile;
1224
+ }
1225
+ //#endregion
1226
+ //#region src/tools/GetComponentVisualTool.d.ts
1227
+ declare class GetComponentVisualTool implements Tool<GetUiComponentInput> {
1228
+ static readonly TOOL_NAME = "get_component_visual";
1229
+ private service;
1230
+ /**
1231
+ * Creates a new GetComponentVisualTool instance.
1232
+ * @param service - Optional service instance for dependency injection (useful for testing)
1233
+ */
1234
+ constructor(service?: GetUiComponentService);
1235
+ /**
1236
+ * Returns the tool definition including name, description, and input schema.
1237
+ * @returns Tool definition with JSON Schema for input validation
1238
+ */
1239
+ getDefinition(): ToolDefinition;
1240
+ /**
1241
+ * Executes the tool to get a UI component preview.
1242
+ * @param input - The input parameters for getting the component
1243
+ * @returns Promise resolving to CallToolResult with component info or error
1244
+ */
1245
+ execute(input: GetUiComponentInput): Promise<CallToolResult>;
1246
+ }
1247
+ //#endregion
1248
+ //#region src/tools/ListAppComponentsTool.d.ts
1249
+ /**
1250
+ * Input parameters for ListAppComponentsTool.
1251
+ */
1252
+ interface ListAppComponentsInput {
1253
+ appPath: string;
1254
+ cursor?: string;
1255
+ }
1256
+ /**
1257
+ * Tool to list app-specific components and package components used by an app.
1258
+ *
1259
+ * Detects app components by file path (within app directory) and resolves
1260
+ * workspace dependencies to find package components from Storybook stories.
1261
+ *
1262
+ * @example
1263
+ * ```typescript
1264
+ * const tool = new ListAppComponentsTool();
1265
+ * const result = await tool.execute({ appPath: 'apps/my-app' });
1266
+ * // Returns: { app: 'my-app', appComponents: ['Button'], packageComponents: {...}, pagination: {...} }
1267
+ * ```
1268
+ */
1269
+ declare class ListAppComponentsTool implements Tool<ListAppComponentsInput> {
1270
+ static readonly TOOL_NAME = "list_app_components";
1271
+ private static readonly COMPONENT_REUSE_INSTRUCTION;
1272
+ private service;
1273
+ constructor();
1274
+ /**
1275
+ * Gets the tool definition including name, description, and input schema.
1276
+ * @returns Tool definition for MCP registration
1277
+ */
1278
+ getDefinition(): ToolDefinition;
1279
+ /**
1280
+ * Lists app-specific and package components for a given application.
1281
+ * @param input - Object containing appPath and optional cursor for pagination
1282
+ * @returns CallToolResult with component list or error
1283
+ */
1284
+ execute(input: ListAppComponentsInput): Promise<CallToolResult>;
1285
+ }
1286
+ //#endregion
1287
+ //#region src/tools/ListThemesTool.d.ts
1288
+ /**
1289
+ * Input parameters for ListThemesTool
1290
+ */
1291
+ interface ListThemesInput {
1292
+ appPath?: string;
1293
+ }
1294
+ /**
1295
+ * Tool to list all available theme configurations.
1296
+ *
1297
+ * Reads themes from CSS files configured in the app's project.json
1298
+ * style-system config. Themes are extracted by parsing CSS class selectors
1299
+ * that contain color variable definitions.
1300
+ *
1301
+ * @example
1302
+ * ```typescript
1303
+ * const tool = new ListThemesTool();
1304
+ * const result = await tool.execute({ appPath: 'apps/my-app' });
1305
+ * // Returns: { themes: [{ name: 'slate', ... }, { name: 'blue', ... }], source: 'css-file' }
1306
+ * ```
1307
+ */
1308
+ declare class ListThemesTool implements Tool<ListThemesInput> {
1309
+ static readonly TOOL_NAME = "list_themes";
1310
+ private serviceFactory;
1311
+ constructor();
1312
+ getDefinition(): ToolDefinition;
1313
+ execute(input: ListThemesInput): Promise<CallToolResult>;
1314
+ }
1315
+ //#endregion
1316
+ //#region src/tools/ListSharedComponentsTool.d.ts
1317
+ /**
1318
+ * Input parameters for ListSharedComponentsTool
1319
+ */
1320
+ interface ListSharedComponentsInput {
1321
+ /** Optional tags to filter components by. If not provided, uses configured sharedComponentTags from toolkit.yaml */
1322
+ tags?: string[];
1323
+ /** Optional pagination cursor to fetch the next page of results */
1324
+ cursor?: string;
1325
+ }
1326
+ declare class ListSharedComponentsTool implements Tool<ListSharedComponentsInput> {
1327
+ static readonly TOOL_NAME = "list_shared_components";
1328
+ static readonly PAGE_SIZE = 50;
1329
+ private static readonly COMPONENT_REUSE_INSTRUCTION;
1330
+ /**
1331
+ * Encode pagination state into an opaque cursor string
1332
+ * @param offset - The current offset in the component list
1333
+ * @returns Base64 encoded cursor string
1334
+ */
1335
+ private encodeCursor;
1336
+ /**
1337
+ * Decode cursor string into pagination state
1338
+ * @param cursor - Base64 encoded cursor string
1339
+ * @returns Object containing the offset
1340
+ */
1341
+ private decodeCursor;
1342
+ /**
1343
+ * Gets the tool definition including name, description, and input schema.
1344
+ * @returns Tool definition for MCP registration
1345
+ */
1346
+ getDefinition(): ToolDefinition;
1347
+ /**
1348
+ * Lists shared UI components from the design system.
1349
+ * @param input - Object containing optional tags filter and cursor for pagination
1350
+ * @returns CallToolResult with component list or error
1351
+ */
1352
+ execute(input: ListSharedComponentsInput): Promise<CallToolResult>;
1353
+ }
1354
+ //#endregion
1355
+ //#region src/transports/stdio.d.ts
1356
+ /**
1357
+ * Stdio transport handler for MCP server
1358
+ * Used for command-line and direct integrations
1359
+ */
1360
+ declare class StdioTransportHandler {
1361
+ private server;
1362
+ private transport;
1363
+ constructor(server: Server);
1364
+ start(): Promise<void>;
1365
+ stop(): Promise<void>;
1366
+ }
1367
+ //#endregion
1368
+ export { BaseBundlerService, BaseCSSClassesService, type CSSClassCategory, type CSSClassValue, type CSSClassesResult, CSSClassesServiceFactory, ComponentRendererService, DEFAULT_STYLE_SYSTEM_CONFIG, GetCSSClassesTool, GetComponentVisualTool, ListAppComponentsTool, ListSharedComponentsTool, ListThemesTool, StdioTransportHandler, StoriesIndexService, type StyleSystemConfig, TailwindCSSClassesService, ThemeService, Tool, ToolDefinition, ViteReactBundlerService, createDefaultBundlerService, createServer, getBundlerServiceFromConfig };