@tekton-ui/mcp-server 0.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 (179) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +980 -0
  3. package/dist/auth/cache.d.ts +28 -0
  4. package/dist/auth/cache.d.ts.map +1 -0
  5. package/dist/auth/cache.js +48 -0
  6. package/dist/auth/cache.js.map +1 -0
  7. package/dist/auth/guard.d.ts +13 -0
  8. package/dist/auth/guard.d.ts.map +1 -0
  9. package/dist/auth/guard.js +21 -0
  10. package/dist/auth/guard.js.map +1 -0
  11. package/dist/auth/state.d.ts +32 -0
  12. package/dist/auth/state.d.ts.map +1 -0
  13. package/dist/auth/state.js +72 -0
  14. package/dist/auth/state.js.map +1 -0
  15. package/dist/auth/theme-access.d.ts +10 -0
  16. package/dist/auth/theme-access.d.ts.map +1 -0
  17. package/dist/auth/theme-access.js +24 -0
  18. package/dist/auth/theme-access.js.map +1 -0
  19. package/dist/auth/verify.d.ts +44 -0
  20. package/dist/auth/verify.d.ts.map +1 -0
  21. package/dist/auth/verify.js +77 -0
  22. package/dist/auth/verify.js.map +1 -0
  23. package/dist/cli/credentials.d.ts +29 -0
  24. package/dist/cli/credentials.d.ts.map +1 -0
  25. package/dist/cli/credentials.js +66 -0
  26. package/dist/cli/credentials.js.map +1 -0
  27. package/dist/cli/index.d.ts +7 -0
  28. package/dist/cli/index.d.ts.map +1 -0
  29. package/dist/cli/index.js +36 -0
  30. package/dist/cli/index.js.map +1 -0
  31. package/dist/cli/login.d.ts +9 -0
  32. package/dist/cli/login.d.ts.map +1 -0
  33. package/dist/cli/login.js +120 -0
  34. package/dist/cli/login.js.map +1 -0
  35. package/dist/cli/logout.d.ts +9 -0
  36. package/dist/cli/logout.d.ts.map +1 -0
  37. package/dist/cli/logout.js +18 -0
  38. package/dist/cli/logout.js.map +1 -0
  39. package/dist/cli/status.d.ts +9 -0
  40. package/dist/cli/status.d.ts.map +1 -0
  41. package/dist/cli/status.js +31 -0
  42. package/dist/cli/status.js.map +1 -0
  43. package/dist/data/component-registry.d.ts +30 -0
  44. package/dist/data/component-registry.d.ts.map +1 -0
  45. package/dist/data/component-registry.js +320 -0
  46. package/dist/data/component-registry.js.map +1 -0
  47. package/dist/data/examples/screen-examples.d.ts +38 -0
  48. package/dist/data/examples/screen-examples.d.ts.map +1 -0
  49. package/dist/data/examples/screen-examples.js +500 -0
  50. package/dist/data/examples/screen-examples.js.map +1 -0
  51. package/dist/data/hint-generator.d.ts +16 -0
  52. package/dist/data/hint-generator.d.ts.map +1 -0
  53. package/dist/data/hint-generator.js +298 -0
  54. package/dist/data/hint-generator.js.map +1 -0
  55. package/dist/data/recipe-resolver.d.ts +48 -0
  56. package/dist/data/recipe-resolver.d.ts.map +1 -0
  57. package/dist/data/recipe-resolver.js +226 -0
  58. package/dist/data/recipe-resolver.js.map +1 -0
  59. package/dist/data/template-matcher.d.ts +50 -0
  60. package/dist/data/template-matcher.d.ts.map +1 -0
  61. package/dist/data/template-matcher.js +240 -0
  62. package/dist/data/template-matcher.js.map +1 -0
  63. package/dist/generators/core-resolver.d.ts +56 -0
  64. package/dist/generators/core-resolver.d.ts.map +1 -0
  65. package/dist/generators/core-resolver.js +490 -0
  66. package/dist/generators/core-resolver.js.map +1 -0
  67. package/dist/generators/css-generator.d.ts +49 -0
  68. package/dist/generators/css-generator.d.ts.map +1 -0
  69. package/dist/generators/css-generator.js +294 -0
  70. package/dist/generators/css-generator.js.map +1 -0
  71. package/dist/generators/index.d.ts +13 -0
  72. package/dist/generators/index.d.ts.map +1 -0
  73. package/dist/generators/index.js +16 -0
  74. package/dist/generators/index.js.map +1 -0
  75. package/dist/generators/llm-generator.d.ts +96 -0
  76. package/dist/generators/llm-generator.d.ts.map +1 -0
  77. package/dist/generators/llm-generator.js +296 -0
  78. package/dist/generators/llm-generator.js.map +1 -0
  79. package/dist/index.d.ts +3 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +818 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/schemas/mcp-schemas.d.ts +4132 -0
  84. package/dist/schemas/mcp-schemas.d.ts.map +1 -0
  85. package/dist/schemas/mcp-schemas.js +946 -0
  86. package/dist/schemas/mcp-schemas.js.map +1 -0
  87. package/dist/storage/blueprint-storage.d.ts +68 -0
  88. package/dist/storage/blueprint-storage.d.ts.map +1 -0
  89. package/dist/storage/blueprint-storage.js +135 -0
  90. package/dist/storage/blueprint-storage.js.map +1 -0
  91. package/dist/storage/timestamp-manager.d.ts +32 -0
  92. package/dist/storage/timestamp-manager.d.ts.map +1 -0
  93. package/dist/storage/timestamp-manager.js +59 -0
  94. package/dist/storage/timestamp-manager.js.map +1 -0
  95. package/dist/tools/export-screen.d.ts +34 -0
  96. package/dist/tools/export-screen.d.ts.map +1 -0
  97. package/dist/tools/export-screen.js +344 -0
  98. package/dist/tools/export-screen.js.map +1 -0
  99. package/dist/tools/generate-blueprint.d.ts +15 -0
  100. package/dist/tools/generate-blueprint.d.ts.map +1 -0
  101. package/dist/tools/generate-blueprint.js +165 -0
  102. package/dist/tools/generate-blueprint.js.map +1 -0
  103. package/dist/tools/generate-screen.d.ts +13 -0
  104. package/dist/tools/generate-screen.d.ts.map +1 -0
  105. package/dist/tools/generate-screen.js +82 -0
  106. package/dist/tools/generate-screen.js.map +1 -0
  107. package/dist/tools/get-screen-generation-context.d.ts +11 -0
  108. package/dist/tools/get-screen-generation-context.d.ts.map +1 -0
  109. package/dist/tools/get-screen-generation-context.js +316 -0
  110. package/dist/tools/get-screen-generation-context.js.map +1 -0
  111. package/dist/tools/list-components.d.ts +15 -0
  112. package/dist/tools/list-components.d.ts.map +1 -0
  113. package/dist/tools/list-components.js +46 -0
  114. package/dist/tools/list-components.js.map +1 -0
  115. package/dist/tools/list-icon-libraries.d.ts +12 -0
  116. package/dist/tools/list-icon-libraries.d.ts.map +1 -0
  117. package/dist/tools/list-icon-libraries.js +48 -0
  118. package/dist/tools/list-icon-libraries.js.map +1 -0
  119. package/dist/tools/list-screen-templates.d.ts +15 -0
  120. package/dist/tools/list-screen-templates.d.ts.map +1 -0
  121. package/dist/tools/list-screen-templates.js +63 -0
  122. package/dist/tools/list-screen-templates.js.map +1 -0
  123. package/dist/tools/list-themes.d.ts +13 -0
  124. package/dist/tools/list-themes.d.ts.map +1 -0
  125. package/dist/tools/list-themes.js +42 -0
  126. package/dist/tools/list-themes.js.map +1 -0
  127. package/dist/tools/list-tokens.d.ts +13 -0
  128. package/dist/tools/list-tokens.d.ts.map +1 -0
  129. package/dist/tools/list-tokens.js +92 -0
  130. package/dist/tools/list-tokens.js.map +1 -0
  131. package/dist/tools/preview-component.d.ts +18 -0
  132. package/dist/tools/preview-component.d.ts.map +1 -0
  133. package/dist/tools/preview-component.js +178 -0
  134. package/dist/tools/preview-component.js.map +1 -0
  135. package/dist/tools/preview-icon-library.d.ts +13 -0
  136. package/dist/tools/preview-icon-library.d.ts.map +1 -0
  137. package/dist/tools/preview-icon-library.js +63 -0
  138. package/dist/tools/preview-icon-library.js.map +1 -0
  139. package/dist/tools/preview-screen-template.d.ts +18 -0
  140. package/dist/tools/preview-screen-template.d.ts.map +1 -0
  141. package/dist/tools/preview-screen-template.js +101 -0
  142. package/dist/tools/preview-screen-template.js.map +1 -0
  143. package/dist/tools/preview-theme.d.ts +15 -0
  144. package/dist/tools/preview-theme.d.ts.map +1 -0
  145. package/dist/tools/preview-theme.js +71 -0
  146. package/dist/tools/preview-theme.js.map +1 -0
  147. package/dist/tools/validate-environment.d.ts +37 -0
  148. package/dist/tools/validate-environment.d.ts.map +1 -0
  149. package/dist/tools/validate-environment.js +153 -0
  150. package/dist/tools/validate-environment.js.map +1 -0
  151. package/dist/tools/validate-screen-definition.d.ts +10 -0
  152. package/dist/tools/validate-screen-definition.d.ts.map +1 -0
  153. package/dist/tools/validate-screen-definition.js +463 -0
  154. package/dist/tools/validate-screen-definition.js.map +1 -0
  155. package/dist/tools/validate-screen.d.ts +13 -0
  156. package/dist/tools/validate-screen.d.ts.map +1 -0
  157. package/dist/tools/validate-screen.js +106 -0
  158. package/dist/tools/validate-screen.js.map +1 -0
  159. package/dist/utils/dependency-extractor.d.ts +13 -0
  160. package/dist/utils/dependency-extractor.d.ts.map +1 -0
  161. package/dist/utils/dependency-extractor.js +232 -0
  162. package/dist/utils/dependency-extractor.js.map +1 -0
  163. package/dist/utils/error-handler.d.ts +29 -0
  164. package/dist/utils/error-handler.d.ts.map +1 -0
  165. package/dist/utils/error-handler.js +48 -0
  166. package/dist/utils/error-handler.js.map +1 -0
  167. package/dist/utils/logger.d.ts +8 -0
  168. package/dist/utils/logger.d.ts.map +1 -0
  169. package/dist/utils/logger.js +14 -0
  170. package/dist/utils/logger.js.map +1 -0
  171. package/dist/utils/package-json-reader.d.ts +37 -0
  172. package/dist/utils/package-json-reader.d.ts.map +1 -0
  173. package/dist/utils/package-json-reader.js +108 -0
  174. package/dist/utils/package-json-reader.js.map +1 -0
  175. package/dist/utils/tailwind-config-reader.d.ts +23 -0
  176. package/dist/utils/tailwind-config-reader.d.ts.map +1 -0
  177. package/dist/utils/tailwind-config-reader.js +81 -0
  178. package/dist/utils/tailwind-config-reader.js.map +1 -0
  179. package/package.json +72 -0
@@ -0,0 +1,946 @@
1
+ /**
2
+ * MCP Tool Input/Output Schemas with Zod validation
3
+ * SPEC-MCP-002: U-002 Input Schema Validation
4
+ */
5
+ import { z } from 'zod';
6
+ // ============================================================================
7
+ // Generate Blueprint Tool Schemas
8
+ // ============================================================================
9
+ /**
10
+ * Layout types from @tekton-ui/core LAYOUTS
11
+ */
12
+ export const LayoutTypeSchema = z.enum([
13
+ 'single-column',
14
+ 'two-column',
15
+ 'sidebar-left',
16
+ 'sidebar-right',
17
+ 'dashboard',
18
+ 'landing',
19
+ ]);
20
+ /**
21
+ * ComponentNode schema - recursive structure from @tekton-ui/core
22
+ */
23
+ const ComponentNodeSchema = z.lazy(() => z.object({
24
+ type: z.string(),
25
+ props: z.record(z.string(), z.unknown()).optional(),
26
+ children: z.array(z.union([ComponentNodeSchema, z.string()])).optional(),
27
+ slot: z.string().optional(),
28
+ }));
29
+ /**
30
+ * Theme ID validation - alphanumeric with hyphens only (security: prevent path traversal)
31
+ * SPEC: UW-002 No Theme ID Injection
32
+ */
33
+ export const ThemeIdSchema = z
34
+ .string()
35
+ .regex(/^[a-z0-9-]+$/, 'Theme ID must contain only lowercase letters, numbers, and hyphens');
36
+ /**
37
+ * Generate Blueprint Input Schema
38
+ * SPEC: E-001 Blueprint Generation Request
39
+ * SPEC-ICON-001: Added iconLibrary parameter
40
+ */
41
+ export const GenerateBlueprintInputSchema = z.object({
42
+ description: z
43
+ .string()
44
+ .min(10, 'Description must be at least 10 characters')
45
+ .max(500, 'Description must not exceed 500 characters'),
46
+ layout: LayoutTypeSchema,
47
+ themeId: ThemeIdSchema,
48
+ iconLibrary: z
49
+ .string()
50
+ .regex(/^[a-z0-9-]+$/, 'Icon library ID must contain only lowercase letters, numbers, and hyphens')
51
+ .optional(),
52
+ componentHints: z.array(z.string()).optional(),
53
+ });
54
+ /**
55
+ * Template Recommendation Schema
56
+ * SPEC-MCP-004 Phase 3: Blueprint Generator Enhancement
57
+ */
58
+ export const TemplateRecommendationSchema = z.object({
59
+ templateId: z.string(),
60
+ templateName: z.string(),
61
+ category: z.string(),
62
+ confidence: z.number(), // 0-100
63
+ matchedKeywords: z.array(z.string()),
64
+ layoutRecommendation: z.object({
65
+ shell: z.string(),
66
+ page: z.string(),
67
+ description: z.string(),
68
+ }),
69
+ });
70
+ /**
71
+ * Generate Blueprint Output Schema (MCP JSON-RPC format - no previewUrl)
72
+ * SPEC-ICON-001: Added iconLibrary field
73
+ * SPEC-MCP-004: Added templateRecommendations field
74
+ */
75
+ export const GenerateBlueprintOutputSchema = z.object({
76
+ success: z.boolean(),
77
+ blueprint: z.optional(z.object({
78
+ id: z.string(),
79
+ name: z.string(),
80
+ themeId: z.string(),
81
+ iconLibrary: z.string(), // SPEC-ICON-001: Icon library used
82
+ layout: LayoutTypeSchema,
83
+ components: z.array(ComponentNodeSchema), // ComponentNode[] from @tekton-ui/core
84
+ timestamp: z.number(),
85
+ })),
86
+ // SPEC-MCP-004 Phase 3: Template recommendations based on description analysis
87
+ templateRecommendations: z.array(TemplateRecommendationSchema).optional(),
88
+ error: z.string().optional(),
89
+ });
90
+ // ============================================================================
91
+ // List Themes Tool Schemas (v2.1)
92
+ // ============================================================================
93
+ /**
94
+ * List Themes Input Schema
95
+ * No input required - lists all available themes
96
+ */
97
+ export const ListThemesInputSchema = z.object({});
98
+ /**
99
+ * Theme metadata schema for v2.1 themes
100
+ */
101
+ export const ThemeMetaSchema = z.object({
102
+ id: z.string(),
103
+ name: z.string(),
104
+ description: z.string().optional(),
105
+ brandTone: z.string(),
106
+ schemaVersion: z.string(),
107
+ });
108
+ /**
109
+ * List Themes Output Schema
110
+ */
111
+ export const ListThemesOutputSchema = z.object({
112
+ success: z.boolean(),
113
+ themes: z.array(ThemeMetaSchema).optional(),
114
+ count: z.number().optional(),
115
+ error: z.string().optional(),
116
+ });
117
+ // ============================================================================
118
+ // Preview Theme Tool Schemas (v2.1 Updated)
119
+ // ============================================================================
120
+ /**
121
+ * Preview Theme Input Schema
122
+ * SPEC: E-002 Theme Preview Request
123
+ */
124
+ export const PreviewThemeInputSchema = z.object({
125
+ themeId: ThemeIdSchema,
126
+ });
127
+ /**
128
+ * Preview Theme Output Schema (v2.1 - includes full theme data)
129
+ */
130
+ export const PreviewThemeOutputSchema = z.object({
131
+ success: z.boolean(),
132
+ theme: z.optional(z.object({
133
+ id: z.string(),
134
+ name: z.string(),
135
+ description: z.string().optional(),
136
+ brandTone: z.string(),
137
+ schemaVersion: z.string(),
138
+ designDNA: z
139
+ .object({
140
+ moodKeywords: z.array(z.string()),
141
+ targetEmotion: z.string(),
142
+ visualAtmosphere: z.string(),
143
+ })
144
+ .optional(),
145
+ tokens: z.object({
146
+ atomic: z.unknown(),
147
+ semantic: z.unknown(),
148
+ component: z.unknown().optional(),
149
+ recipes: z.unknown().optional(),
150
+ }),
151
+ stateLayer: z.unknown().optional(),
152
+ motion: z.unknown().optional(),
153
+ elevation: z.unknown().optional(),
154
+ typography: z.unknown().optional(),
155
+ })),
156
+ error: z.string().optional(),
157
+ });
158
+ // ============================================================================
159
+ // Export Screen Tool Schemas
160
+ // ============================================================================
161
+ /**
162
+ * Export format types
163
+ * SPEC: S-004 Export Format Compatibility
164
+ */
165
+ export const ExportFormatSchema = z.enum(['jsx', 'tsx', 'vue']);
166
+ /**
167
+ * Export Screen Input Schema (MCP JSON-RPC format - accepts blueprint object)
168
+ * SPEC: E-003 Screen Export Request
169
+ */
170
+ export const ExportScreenInputSchema = z.object({
171
+ blueprint: z.unknown(), // Blueprint from @tekton-ui/core (accept any object for flexibility)
172
+ format: ExportFormatSchema,
173
+ });
174
+ /**
175
+ * Export Screen Output Schema (MCP JSON-RPC format - no filePath)
176
+ */
177
+ export const ExportScreenOutputSchema = z.object({
178
+ success: z.boolean(),
179
+ code: z.string().optional(),
180
+ error: z.string().optional(),
181
+ });
182
+ // ============================================================================
183
+ // Hybrid Export Tool Schemas (SPEC-COMPONENT-001-D)
184
+ // ============================================================================
185
+ /**
186
+ * Export component resolution tier
187
+ * - tier1: Copy from @tekton-ui/ui (fast, deterministic)
188
+ * - tier2: Generate with LLM (flexible, customizable)
189
+ * - auto: Automatically choose based on component availability
190
+ */
191
+ export const ExportTierSchema = z.enum(['tier1', 'tier2', 'auto']);
192
+ /**
193
+ * Hybrid Export Input Schema
194
+ * SPEC-COMPONENT-001-D: Hybrid Export System
195
+ */
196
+ export const HybridExportInputSchema = z.object({
197
+ /** Blueprint or component name */
198
+ blueprint: z.unknown().optional(),
199
+ /** Single component name for direct export */
200
+ componentName: z.string().optional(),
201
+ /** Component description (for Tier 2 LLM generation) */
202
+ componentDescription: z.string().optional(),
203
+ /** Output format */
204
+ format: ExportFormatSchema,
205
+ /** Include CSS Variables */
206
+ includeCSS: z.boolean().optional().default(false),
207
+ /** Resolution tier preference */
208
+ tier: ExportTierSchema.optional().default('auto'),
209
+ /** Theme ID for CSS generation */
210
+ themeId: ThemeIdSchema.optional(),
211
+ });
212
+ /**
213
+ * Component resolution result
214
+ */
215
+ export const ComponentResolutionSchema = z.object({
216
+ componentName: z.string(),
217
+ code: z.string(),
218
+ source: z.enum(['tier1-ui', 'tier1-example', 'tier2-llm', 'tier2-mock']),
219
+ });
220
+ /**
221
+ * Hybrid Export Output Schema
222
+ * SPEC-COMPONENT-001-D: Hybrid Export System
223
+ */
224
+ export const HybridExportOutputSchema = z.object({
225
+ success: z.boolean(),
226
+ /** Screen/component code */
227
+ code: z.string().optional(),
228
+ /** CSS Variables (if includeCSS was true) */
229
+ css: z.string().optional(),
230
+ /** Component resolution details */
231
+ components: z.array(ComponentResolutionSchema).optional(),
232
+ /** Tier used for resolution */
233
+ tierUsed: ExportTierSchema.optional(),
234
+ error: z.string().optional(),
235
+ });
236
+ // ============================================================================
237
+ // Common Error Response Schema
238
+ // ============================================================================
239
+ /**
240
+ * Standardized error response format
241
+ * SPEC: U-004 Error Response Consistency
242
+ */
243
+ export const ErrorResponseSchema = z.object({
244
+ success: z.literal(false),
245
+ error: z.string(),
246
+ });
247
+ // ============================================================================
248
+ // Generate Screen Tool Schemas (SPEC-LAYOUT-002 Phase 4)
249
+ // ============================================================================
250
+ /**
251
+ * Output format for code generation
252
+ */
253
+ export const OutputFormatSchema = z.enum(['css-in-js', 'tailwind', 'react']);
254
+ /**
255
+ * CSS Framework options for CSS-in-JS format
256
+ */
257
+ export const CSSFrameworkSchema = z.enum(['styled-components', 'emotion']);
258
+ /**
259
+ * Generation options for generate_screen tool
260
+ */
261
+ export const GenerationOptionsSchema = z.object({
262
+ cssFramework: CSSFrameworkSchema.optional(),
263
+ typescript: z.boolean().optional().default(true),
264
+ prettier: z.boolean().optional().default(false),
265
+ });
266
+ /**
267
+ * Generate Screen Input Schema
268
+ * SPEC-LAYOUT-002: Generate production code from screen definition
269
+ */
270
+ export const GenerateScreenInputSchema = z.object({
271
+ screenDefinition: z.unknown(), // Accept any object - will be validated by @tekton-ui/core
272
+ outputFormat: OutputFormatSchema,
273
+ options: GenerationOptionsSchema.optional(),
274
+ });
275
+ /**
276
+ * Dependencies structure for generated code
277
+ * SPEC-MCP-005: Automatic dependency extraction and environment validation
278
+ */
279
+ export const DependenciesSchema = z.object({
280
+ external: z.array(z.string()).describe('External NPM packages required by generated code'),
281
+ internal: z.array(z.string()).describe('Internal @tekton packages'),
282
+ installCommands: z.object({
283
+ npm: z.string(),
284
+ yarn: z.string(),
285
+ pnpm: z.string(),
286
+ bun: z.string(),
287
+ }),
288
+ compatibility: z
289
+ .object({
290
+ react: z.string().optional(),
291
+ node: z.string().optional(),
292
+ })
293
+ .optional(),
294
+ notes: z.array(z.string()).optional(),
295
+ });
296
+ /**
297
+ * Generate Screen Output Schema
298
+ */
299
+ export const GenerateScreenOutputSchema = z.object({
300
+ success: z.boolean(),
301
+ code: z.string().optional(),
302
+ cssVariables: z.string().optional(),
303
+ dependencies: DependenciesSchema.optional(),
304
+ errors: z.array(z.string()).optional(),
305
+ error: z.string().optional(),
306
+ });
307
+ // ============================================================================
308
+ // Validate Screen Tool Schemas (SPEC-LAYOUT-002 Phase 4)
309
+ // ============================================================================
310
+ /**
311
+ * Validate Screen Input Schema
312
+ */
313
+ export const ValidateScreenInputSchema = z.object({
314
+ screenDefinition: z.unknown(), // Accept any object for validation
315
+ strictMode: z.boolean().optional().default(false),
316
+ });
317
+ /**
318
+ * Validation suggestion
319
+ */
320
+ export const ValidationSuggestionSchema = z.object({
321
+ field: z.string(),
322
+ message: z.string(),
323
+ suggestion: z.string().optional(),
324
+ });
325
+ /**
326
+ * Validate Screen Output Schema
327
+ */
328
+ export const ValidateScreenOutputSchema = z.object({
329
+ success: z.boolean(),
330
+ valid: z.boolean().optional(),
331
+ errors: z.array(z.string()).optional(),
332
+ warnings: z.array(z.string()).optional(),
333
+ suggestions: z.array(ValidationSuggestionSchema).optional(),
334
+ error: z.string().optional(),
335
+ });
336
+ // ============================================================================
337
+ // List Tokens Tool Schemas (SPEC-LAYOUT-002 Phase 4)
338
+ // ============================================================================
339
+ /**
340
+ * Token type filter
341
+ */
342
+ export const TokenTypeSchema = z.enum(['shell', 'page', 'section', 'all']);
343
+ /**
344
+ * List Tokens Input Schema
345
+ */
346
+ export const ListTokensInputSchema = z.object({
347
+ tokenType: TokenTypeSchema.optional().default('all'),
348
+ filter: z.string().optional(),
349
+ });
350
+ /**
351
+ * Token metadata
352
+ */
353
+ export const TokenMetadataSchema = z.object({
354
+ id: z.string(),
355
+ name: z.string().optional(),
356
+ description: z.string().optional(),
357
+ platform: z.string().optional(),
358
+ purpose: z.string().optional(),
359
+ type: z.string().optional(),
360
+ });
361
+ /**
362
+ * List Tokens Output Schema
363
+ */
364
+ export const ListTokensOutputSchema = z.object({
365
+ success: z.boolean(),
366
+ shells: z.array(TokenMetadataSchema).optional(),
367
+ pages: z.array(TokenMetadataSchema).optional(),
368
+ sections: z.array(TokenMetadataSchema).optional(),
369
+ metadata: z
370
+ .object({
371
+ total: z.number(),
372
+ filtered: z.number().optional(),
373
+ })
374
+ .optional(),
375
+ error: z.string().optional(),
376
+ });
377
+ // ============================================================================
378
+ // Icon Library Tool Schemas (SPEC-ICON-001)
379
+ // ============================================================================
380
+ /**
381
+ * Icon Library ID validation - alphanumeric with hyphens only
382
+ * SPEC-ICON-001: UW-001 No Icon Library ID Injection
383
+ */
384
+ export const IconLibraryIdSchema = z
385
+ .string()
386
+ .regex(/^[a-z0-9-]+$/, 'Icon library ID must contain only lowercase letters, numbers, and hyphens');
387
+ /**
388
+ * List Icon Libraries Input Schema
389
+ * No input required - lists all available icon libraries
390
+ */
391
+ export const ListIconLibrariesInputSchema = z.object({});
392
+ /**
393
+ * Icon library metadata schema
394
+ */
395
+ export const IconLibraryMetaSchema = z.object({
396
+ id: z.string(),
397
+ name: z.string(),
398
+ description: z.string(),
399
+ version: z.string(),
400
+ license: z.string(),
401
+ totalIcons: z.number(),
402
+ categories: z.array(z.string()),
403
+ });
404
+ /**
405
+ * List Icon Libraries Output Schema
406
+ */
407
+ export const ListIconLibrariesOutputSchema = z.object({
408
+ success: z.boolean(),
409
+ libraries: z.array(IconLibraryMetaSchema).optional(),
410
+ count: z.number().optional(),
411
+ error: z.string().optional(),
412
+ });
413
+ /**
414
+ * Preview Icon Library Input Schema
415
+ */
416
+ export const PreviewIconLibraryInputSchema = z.object({
417
+ libraryId: IconLibraryIdSchema,
418
+ });
419
+ /**
420
+ * Icon size mapping schema
421
+ */
422
+ export const IconSizeMappingSchema = z.object({
423
+ xs: z.number().optional(),
424
+ sm: z.number(),
425
+ md: z.number(),
426
+ lg: z.number(),
427
+ xl: z.number().optional(),
428
+ });
429
+ /**
430
+ * Framework config schema
431
+ */
432
+ export const IconFrameworkConfigSchema = z.object({
433
+ packageName: z.string(),
434
+ importStatement: z.string(),
435
+ componentPattern: z.string(),
436
+ variants: z.record(z.string()).optional(),
437
+ });
438
+ /**
439
+ * Preview Icon Library Output Schema
440
+ */
441
+ export const PreviewIconLibraryOutputSchema = z.object({
442
+ success: z.boolean(),
443
+ library: z.optional(z.object({
444
+ id: z.string(),
445
+ name: z.string(),
446
+ description: z.string(),
447
+ version: z.string(),
448
+ license: z.string(),
449
+ website: z.string(),
450
+ totalIcons: z.number(),
451
+ categories: z.array(z.string()),
452
+ sizeMapping: IconSizeMappingSchema,
453
+ frameworks: z.object({
454
+ react: IconFrameworkConfigSchema,
455
+ vue: IconFrameworkConfigSchema,
456
+ }),
457
+ defaultVariant: z.string().optional(),
458
+ iconSample: z.array(z.string()).optional(),
459
+ })),
460
+ error: z.string().optional(),
461
+ });
462
+ // ============================================================================
463
+ // Component Discovery Tool Schemas (SPEC-MCP-003)
464
+ // ============================================================================
465
+ /**
466
+ * Component category types
467
+ * SPEC-MCP-003: Component tier system
468
+ */
469
+ export const ComponentCategorySchema = z.enum(['core', 'complex', 'advanced']);
470
+ /**
471
+ * List Components Input Schema
472
+ * SPEC-MCP-003: [TAG-MCP003-006]
473
+ */
474
+ export const ListComponentsInputSchema = z.object({
475
+ category: z.enum(['core', 'complex', 'advanced', 'all']).optional().default('all'),
476
+ search: z.string().optional(),
477
+ });
478
+ /**
479
+ * Component metadata schema
480
+ */
481
+ export const ComponentMetaSchema = z.object({
482
+ id: z.string(),
483
+ name: z.string(),
484
+ category: ComponentCategorySchema,
485
+ description: z.string(),
486
+ variantsCount: z.number(),
487
+ hasSubComponents: z.boolean(),
488
+ tier: z.number(),
489
+ });
490
+ /**
491
+ * List Components Output Schema
492
+ */
493
+ export const ListComponentsOutputSchema = z.object({
494
+ success: z.boolean(),
495
+ components: z.array(ComponentMetaSchema).optional(),
496
+ count: z.number().optional(),
497
+ categories: z
498
+ .object({
499
+ core: z.number(),
500
+ complex: z.number(),
501
+ advanced: z.number(),
502
+ })
503
+ .optional(),
504
+ error: z.string().optional(),
505
+ });
506
+ /**
507
+ * Preview Component Input Schema
508
+ * SPEC-MCP-003: [TAG-MCP003-007]
509
+ */
510
+ export const PreviewComponentInputSchema = z.object({
511
+ componentId: z.string().regex(/^[a-z-]+$/, 'Component ID must be lowercase with hyphens'),
512
+ includeExamples: z.boolean().optional(),
513
+ includeDependencies: z.boolean().optional(),
514
+ });
515
+ /**
516
+ * Prop definition schema
517
+ */
518
+ export const PropDefinitionSchema = z.object({
519
+ name: z.string(),
520
+ type: z.string(),
521
+ required: z.boolean(),
522
+ defaultValue: z.string().optional(),
523
+ description: z.string().optional(),
524
+ });
525
+ /**
526
+ * Variant schema
527
+ */
528
+ export const VariantSchema = z.object({
529
+ name: z.string(),
530
+ value: z.string(),
531
+ description: z.string().optional(),
532
+ });
533
+ /**
534
+ * Usage example schema
535
+ */
536
+ export const UsageExampleSchema = z.object({
537
+ title: z.string(),
538
+ code: z.string(),
539
+ description: z.string().optional(),
540
+ });
541
+ /**
542
+ * Preview Component Output Schema
543
+ */
544
+ export const PreviewComponentOutputSchema = z.object({
545
+ success: z.boolean(),
546
+ component: z
547
+ .object({
548
+ id: z.string(),
549
+ name: z.string(),
550
+ category: ComponentCategorySchema,
551
+ description: z.string(),
552
+ tier: z.number(),
553
+ props: z.array(PropDefinitionSchema),
554
+ variants: z.array(VariantSchema).optional(),
555
+ subComponents: z.array(z.string()).optional(),
556
+ importStatement: z.string(),
557
+ dependencies: z
558
+ .object({
559
+ internal: z.array(z.string()),
560
+ external: z.array(z.string()),
561
+ })
562
+ .optional(),
563
+ examples: z.array(UsageExampleSchema).optional(),
564
+ accessibility: z.string().optional(),
565
+ })
566
+ .optional(),
567
+ error: z.string().optional(),
568
+ });
569
+ // ============================================================================
570
+ // Screen Template Discovery Tool Schemas (SPEC-MCP-003)
571
+ // ============================================================================
572
+ /**
573
+ * Template category types
574
+ */
575
+ export const TemplateCategorySchema = z.enum([
576
+ 'auth',
577
+ 'dashboard',
578
+ 'form',
579
+ 'marketing',
580
+ 'feedback',
581
+ ]);
582
+ /**
583
+ * List Screen Templates Input Schema
584
+ * SPEC-MCP-003: [TAG-MCP003-008]
585
+ */
586
+ export const ListScreenTemplatesInputSchema = z.object({
587
+ category: z
588
+ .enum(['auth', 'dashboard', 'form', 'marketing', 'feedback', 'all'])
589
+ .optional()
590
+ .default('all'),
591
+ search: z.string().optional(),
592
+ });
593
+ /**
594
+ * Template layout type schema
595
+ */
596
+ export const TemplateLayoutTypeSchema = z.enum(['centered', 'sidebar', 'full']);
597
+ /**
598
+ * Template metadata schema
599
+ */
600
+ export const TemplateMetaSchema = z.object({
601
+ id: z.string(),
602
+ name: z.string(),
603
+ category: TemplateCategorySchema,
604
+ description: z.string(),
605
+ requiredComponentsCount: z.number(),
606
+ layoutType: TemplateLayoutTypeSchema,
607
+ version: z.string(),
608
+ tags: z.array(z.string()).optional(),
609
+ });
610
+ /**
611
+ * List Screen Templates Output Schema
612
+ */
613
+ export const ListScreenTemplatesOutputSchema = z.object({
614
+ success: z.boolean(),
615
+ templates: z.array(TemplateMetaSchema).optional(),
616
+ count: z.number().optional(),
617
+ categories: z
618
+ .object({
619
+ auth: z.number(),
620
+ dashboard: z.number(),
621
+ form: z.number(),
622
+ marketing: z.number(),
623
+ feedback: z.number(),
624
+ })
625
+ .optional(),
626
+ error: z.string().optional(),
627
+ });
628
+ /**
629
+ * Preview Screen Template Input Schema
630
+ * SPEC-MCP-003: [TAG-MCP003-009]
631
+ */
632
+ export const PreviewScreenTemplateInputSchema = z.object({
633
+ templateId: z.string().regex(/^[a-z]+\.[a-z-]+$/, 'Template ID must be in format category.name'),
634
+ includeLayoutTokens: z.boolean().optional(),
635
+ });
636
+ /**
637
+ * Skeleton schema
638
+ */
639
+ export const SkeletonSchema = z.object({
640
+ shell: z.string(),
641
+ page: z.string(),
642
+ sections: z.array(z.object({
643
+ id: z.string(),
644
+ name: z.string(),
645
+ slot: z.string(),
646
+ required: z.boolean(),
647
+ })),
648
+ });
649
+ /**
650
+ * Customization schema
651
+ */
652
+ export const CustomizationSchema = z.object({
653
+ texts: z.array(z.string()),
654
+ optional: z.array(z.string()),
655
+ slots: z.array(z.string()),
656
+ });
657
+ /**
658
+ * Responsive layout schema
659
+ */
660
+ export const ResponsiveLayoutSchema = z.object({
661
+ mobile: z.object({
662
+ padding: z.string(),
663
+ gap: z.string(),
664
+ columns: z.number(),
665
+ }),
666
+ tablet: z.object({
667
+ padding: z.string(),
668
+ gap: z.string(),
669
+ columns: z.number(),
670
+ }),
671
+ desktop: z.object({
672
+ padding: z.string(),
673
+ gap: z.string(),
674
+ columns: z.number(),
675
+ }),
676
+ });
677
+ /**
678
+ * Preview Screen Template Output Schema
679
+ */
680
+ export const PreviewScreenTemplateOutputSchema = z.object({
681
+ success: z.boolean(),
682
+ template: z
683
+ .object({
684
+ id: z.string(),
685
+ name: z.string(),
686
+ category: TemplateCategorySchema,
687
+ description: z.string(),
688
+ version: z.string(),
689
+ skeleton: SkeletonSchema,
690
+ layout: z.object({
691
+ type: TemplateLayoutTypeSchema,
692
+ responsive: ResponsiveLayoutSchema.optional(),
693
+ }),
694
+ customizable: CustomizationSchema,
695
+ requiredComponents: z.array(z.string()),
696
+ importStatement: z.string(),
697
+ exampleProps: z
698
+ .object({
699
+ texts: z.record(z.string()).optional(),
700
+ options: z.record(z.boolean()).optional(),
701
+ slots: z.array(z.string()).optional(),
702
+ })
703
+ .optional(),
704
+ created: z.string(),
705
+ updated: z.string(),
706
+ tags: z.array(z.string()).optional(),
707
+ })
708
+ .optional(),
709
+ error: z.string().optional(),
710
+ });
711
+ // ============================================================================
712
+ // Get Screen Generation Context Tool Schemas (SPEC-MCP-004 Phase 3.5)
713
+ // ============================================================================
714
+ /**
715
+ * Get Screen Generation Context Input Schema
716
+ * SPEC-MCP-004 Phase 3.5: Provides coding agents with complete context for screen generation
717
+ */
718
+ export const GetScreenGenerationContextInputSchema = z.object({
719
+ description: z
720
+ .string()
721
+ .min(5, 'Description must be at least 5 characters')
722
+ .max(1000, 'Description must not exceed 1000 characters'),
723
+ themeId: ThemeIdSchema.optional(),
724
+ includeExamples: z.boolean().optional().default(true),
725
+ });
726
+ /**
727
+ * Template match result for generation context
728
+ */
729
+ export const ContextTemplateMatchSchema = z.object({
730
+ templateId: z.string(),
731
+ templateName: z.string(),
732
+ category: z.string(),
733
+ confidence: z.number(),
734
+ matchedKeywords: z.array(z.string()),
735
+ skeleton: SkeletonSchema.optional(),
736
+ requiredComponents: z.array(z.string()).optional(),
737
+ });
738
+ /**
739
+ * Component info for generation context
740
+ */
741
+ export const ContextComponentInfoSchema = z.object({
742
+ id: z.string(),
743
+ name: z.string(),
744
+ category: ComponentCategorySchema,
745
+ description: z.string(),
746
+ importStatement: z.string(),
747
+ props: z.array(PropDefinitionSchema),
748
+ variants: z.array(VariantSchema).optional(),
749
+ });
750
+ /**
751
+ * Screen definition schema for validation and examples
752
+ */
753
+ export const ScreenDefinitionSchema = z.object({
754
+ id: z.string().regex(/^[a-z0-9-]+$/, 'Screen ID must be lowercase alphanumeric with hyphens'),
755
+ name: z.string().optional(),
756
+ description: z.string().optional(),
757
+ shell: z
758
+ .string()
759
+ .regex(/^shell\.[a-z]+\.[a-z-]+$/, 'Shell token must be in format shell.platform.name'),
760
+ page: z.string().regex(/^page\.[a-z-]+$/, 'Page token must be in format page.name'),
761
+ themeId: ThemeIdSchema.optional(),
762
+ sections: z.array(z.object({
763
+ id: z.string(),
764
+ pattern: z
765
+ .string()
766
+ .regex(/^section\.[a-z0-9-]+$/, 'Section pattern must be in format section.name'),
767
+ slot: z.string().optional(),
768
+ components: z.array(z.object({
769
+ type: z.string(),
770
+ props: z.record(z.unknown()).optional(),
771
+ children: z.union([z.string(), z.array(z.unknown())]).optional(),
772
+ })),
773
+ })),
774
+ metadata: z
775
+ .object({
776
+ version: z.string().optional(),
777
+ author: z.string().optional(),
778
+ created: z.string().optional(),
779
+ updated: z.string().optional(),
780
+ })
781
+ .optional(),
782
+ });
783
+ /**
784
+ * Example screen definition with description
785
+ */
786
+ export const ScreenExampleSchema = z.object({
787
+ name: z.string(),
788
+ description: z.string(),
789
+ definition: ScreenDefinitionSchema,
790
+ });
791
+ /**
792
+ * Theme recipe info for generation context
793
+ */
794
+ export const ThemeRecipeInfoSchema = z.object({
795
+ componentType: z.string(),
796
+ variants: z.array(z.string()),
797
+ defaultClassName: z.string().optional(),
798
+ });
799
+ /**
800
+ * Generation hint for coding agents
801
+ */
802
+ export const GenerationHintSchema = z.object({
803
+ category: z.enum(['layout', 'component', 'styling', 'accessibility', 'best-practice']),
804
+ priority: z.enum(['high', 'medium', 'low']),
805
+ message: z.string(),
806
+ example: z.string().optional(),
807
+ });
808
+ /**
809
+ * Workflow Step Schema
810
+ * SPEC-MCP-004 Phase 5: E2E workflow guide for agents
811
+ */
812
+ export const WorkflowStepSchema = z.object({
813
+ step: z.number(),
814
+ action: z.string(),
815
+ tool: z.string().optional(),
816
+ description: z.string(),
817
+ example: z.string().optional(),
818
+ });
819
+ /**
820
+ * Workflow Guide Schema
821
+ * Provides step-by-step guidance for agents to generate screens
822
+ */
823
+ export const WorkflowGuideSchema = z.object({
824
+ title: z.string(),
825
+ description: z.string(),
826
+ steps: z.array(WorkflowStepSchema),
827
+ notes: z.array(z.string()).optional(),
828
+ });
829
+ /**
830
+ * Get Screen Generation Context Output Schema
831
+ */
832
+ export const GetScreenGenerationContextOutputSchema = z.object({
833
+ success: z.boolean(),
834
+ templateMatch: ContextTemplateMatchSchema.optional(),
835
+ components: z.array(ContextComponentInfoSchema).optional(),
836
+ schema: z
837
+ .object({
838
+ screenDefinition: z.unknown(), // JSON Schema representation
839
+ description: z.string(),
840
+ })
841
+ .optional(),
842
+ examples: z.array(ScreenExampleSchema).optional(),
843
+ themeRecipes: z.array(ThemeRecipeInfoSchema).optional(),
844
+ hints: z.array(GenerationHintSchema).optional(),
845
+ workflow: WorkflowGuideSchema.optional(),
846
+ error: z.string().optional(),
847
+ });
848
+ // ============================================================================
849
+ // Validate Screen Definition Tool Schemas (SPEC-MCP-004 Phase 3.5)
850
+ // ============================================================================
851
+ /**
852
+ * Validate Screen Definition Input Schema
853
+ * SPEC-MCP-004 Phase 3.5: Validates screen definitions with helpful feedback
854
+ */
855
+ export const ValidateScreenDefinitionInputSchema = z.object({
856
+ definition: z.unknown(), // Accept any object for validation
857
+ strict: z.boolean().optional().default(true),
858
+ });
859
+ /**
860
+ * Validation error with path and suggestion
861
+ */
862
+ export const ValidationErrorSchema = z.object({
863
+ path: z.string(),
864
+ code: z.string(),
865
+ message: z.string(),
866
+ expected: z.string().optional(),
867
+ received: z.string().optional(),
868
+ suggestion: z.string().optional(),
869
+ });
870
+ /**
871
+ * Validation warning (non-blocking)
872
+ */
873
+ export const ValidationWarningSchema = z.object({
874
+ path: z.string(),
875
+ code: z.string(),
876
+ message: z.string(),
877
+ recommendation: z.string().optional(),
878
+ });
879
+ /**
880
+ * Improvement suggestion
881
+ */
882
+ export const ImprovementSuggestionSchema = z.object({
883
+ category: z.enum(['accessibility', 'performance', 'maintainability', 'consistency']),
884
+ message: z.string(),
885
+ affectedPath: z.string().optional(),
886
+ suggestedChange: z.string().optional(),
887
+ });
888
+ /**
889
+ * Validate Screen Definition Output Schema
890
+ */
891
+ export const ValidateScreenDefinitionOutputSchema = z.object({
892
+ success: z.boolean(),
893
+ valid: z.boolean().optional(),
894
+ errors: z.array(ValidationErrorSchema).optional(),
895
+ warnings: z.array(ValidationWarningSchema).optional(),
896
+ suggestions: z.array(ImprovementSuggestionSchema).optional(),
897
+ error: z.string().optional(),
898
+ });
899
+ // ============================================================================
900
+ // Validate Environment Tool Schemas (SPEC-MCP-005 Phase 2)
901
+ // ============================================================================
902
+ /**
903
+ * Validate Environment Input Schema
904
+ * SPEC-MCP-005 Phase 2: Check user's environment for missing dependencies
905
+ */
906
+ export const ValidateEnvironmentInputSchema = z.object({
907
+ projectPath: z.string().describe('Path to package.json or project root'),
908
+ requiredPackages: z
909
+ .array(z.string())
910
+ .describe('Packages to validate (from generate_screen.dependencies.external)'),
911
+ checkTailwind: z
912
+ .boolean()
913
+ .optional()
914
+ .default(true)
915
+ .describe('Also validate Tailwind CSS configuration for @tekton-ui/ui compatibility'),
916
+ });
917
+ /**
918
+ * Validate Environment Output Schema
919
+ */
920
+ export const ValidateEnvironmentOutputSchema = z.object({
921
+ success: z.boolean(),
922
+ installed: z.record(z.string()).optional().describe('Packages already installed with versions'),
923
+ missing: z.array(z.string()).optional().describe('Packages that need to be installed'),
924
+ installCommands: z
925
+ .object({
926
+ npm: z.string(),
927
+ yarn: z.string(),
928
+ pnpm: z.string(),
929
+ bun: z.string(),
930
+ })
931
+ .optional(),
932
+ warnings: z.array(z.string()).optional().describe('Version conflicts or compatibility issues'),
933
+ tailwind: z
934
+ .object({
935
+ configFound: z.boolean(),
936
+ configPath: z.string().optional(),
937
+ hasUiContentPath: z.boolean(),
938
+ hasAnimatePlugin: z.boolean(),
939
+ issues: z.array(z.string()),
940
+ fixes: z.array(z.string()),
941
+ })
942
+ .optional()
943
+ .describe('Tailwind CSS configuration validation for @tekton-ui/ui compatibility'),
944
+ error: z.string().optional(),
945
+ });
946
+ //# sourceMappingURL=mcp-schemas.js.map