@idealyst/mcp-server 1.0.87 → 1.0.88

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 (205) hide show
  1. package/ARCHITECTURE.md +313 -0
  2. package/README.md +292 -104
  3. package/TYPE-SYSTEM.md +397 -0
  4. package/dist/index.js +170 -1
  5. package/examples/components/Accordion.examples.tsx +147 -0
  6. package/examples/components/ActivityIndicator.examples.tsx +350 -0
  7. package/examples/components/Alert.examples.tsx +335 -0
  8. package/examples/components/Avatar.examples.tsx +188 -0
  9. package/examples/components/Badge.examples.tsx +242 -0
  10. package/examples/components/Breadcrumb.examples.tsx +303 -0
  11. package/examples/components/Button.examples.tsx +113 -0
  12. package/examples/components/Card.examples.tsx +131 -0
  13. package/examples/components/Checkbox.examples.tsx +195 -0
  14. package/examples/components/Chip.examples.tsx +87 -0
  15. package/examples/components/Dialog.examples.tsx +344 -0
  16. package/examples/components/Divider.examples.tsx +258 -0
  17. package/examples/components/Icon.examples.tsx +202 -0
  18. package/examples/components/Input.examples.tsx +205 -0
  19. package/examples/components/Menu.examples.tsx +321 -0
  20. package/examples/components/Popover.examples.tsx +439 -0
  21. package/examples/components/Progress.examples.tsx +340 -0
  22. package/examples/components/RadioButton.examples.tsx +443 -0
  23. package/examples/components/Screen.examples.tsx +347 -0
  24. package/examples/components/Select.examples.tsx +279 -0
  25. package/examples/components/Skeleton.examples.tsx +278 -0
  26. package/examples/components/Slider.examples.tsx +249 -0
  27. package/examples/components/Switch.examples.tsx +94 -0
  28. package/examples/components/TabBar.examples.tsx +356 -0
  29. package/examples/components/Text.examples.tsx +177 -0
  30. package/examples/components/TextArea.examples.tsx +203 -0
  31. package/examples/components/Tooltip.examples.tsx +318 -0
  32. package/examples/components/View.examples.tsx +307 -0
  33. package/package.json +15 -2
  34. package/scripts/extract-types.ts +71 -0
  35. package/scripts/type-extractor.ts +286 -0
  36. package/scripts/validate-examples.ts +142 -0
  37. package/src/data/components/Icon.ts +1 -1
  38. package/src/data/components/index.ts +2 -0
  39. package/src/index.ts +181 -1
  40. package/src/tools/get-types.ts +169 -0
  41. package/tsconfig.examples.json +14 -0
  42. package/dist/data/cli-commands.d.ts +0 -2
  43. package/dist/data/cli-commands.d.ts.map +0 -1
  44. package/dist/data/cli-commands.js +0 -100
  45. package/dist/data/cli-commands.js.map +0 -1
  46. package/dist/data/components/Accordion.d.ts +0 -15
  47. package/dist/data/components/Accordion.d.ts.map +0 -1
  48. package/dist/data/components/Accordion.js +0 -112
  49. package/dist/data/components/Accordion.js.map +0 -1
  50. package/dist/data/components/ActivityIndicator.d.ts +0 -15
  51. package/dist/data/components/ActivityIndicator.d.ts.map +0 -1
  52. package/dist/data/components/ActivityIndicator.js +0 -82
  53. package/dist/data/components/ActivityIndicator.js.map +0 -1
  54. package/dist/data/components/Alert.d.ts +0 -15
  55. package/dist/data/components/Alert.d.ts.map +0 -1
  56. package/dist/data/components/Alert.js +0 -132
  57. package/dist/data/components/Alert.js.map +0 -1
  58. package/dist/data/components/Avatar.d.ts +0 -15
  59. package/dist/data/components/Avatar.d.ts.map +0 -1
  60. package/dist/data/components/Avatar.js +0 -93
  61. package/dist/data/components/Avatar.js.map +0 -1
  62. package/dist/data/components/Badge.d.ts +0 -15
  63. package/dist/data/components/Badge.d.ts.map +0 -1
  64. package/dist/data/components/Badge.js +0 -64
  65. package/dist/data/components/Badge.js.map +0 -1
  66. package/dist/data/components/Breadcrumb.d.ts +0 -15
  67. package/dist/data/components/Breadcrumb.d.ts.map +0 -1
  68. package/dist/data/components/Breadcrumb.js +0 -96
  69. package/dist/data/components/Breadcrumb.js.map +0 -1
  70. package/dist/data/components/Button.d.ts +0 -15
  71. package/dist/data/components/Button.d.ts.map +0 -1
  72. package/dist/data/components/Button.js +0 -87
  73. package/dist/data/components/Button.js.map +0 -1
  74. package/dist/data/components/Card.d.ts +0 -15
  75. package/dist/data/components/Card.d.ts.map +0 -1
  76. package/dist/data/components/Card.js +0 -67
  77. package/dist/data/components/Card.js.map +0 -1
  78. package/dist/data/components/Checkbox.d.ts +0 -15
  79. package/dist/data/components/Checkbox.d.ts.map +0 -1
  80. package/dist/data/components/Checkbox.js +0 -118
  81. package/dist/data/components/Checkbox.js.map +0 -1
  82. package/dist/data/components/Chip.d.ts +0 -15
  83. package/dist/data/components/Chip.d.ts.map +0 -1
  84. package/dist/data/components/Chip.js +0 -76
  85. package/dist/data/components/Chip.js.map +0 -1
  86. package/dist/data/components/Dialog.d.ts +0 -15
  87. package/dist/data/components/Dialog.d.ts.map +0 -1
  88. package/dist/data/components/Dialog.js +0 -137
  89. package/dist/data/components/Dialog.js.map +0 -1
  90. package/dist/data/components/Divider.d.ts +0 -15
  91. package/dist/data/components/Divider.d.ts.map +0 -1
  92. package/dist/data/components/Divider.js +0 -71
  93. package/dist/data/components/Divider.js.map +0 -1
  94. package/dist/data/components/Icon.d.ts +0 -15
  95. package/dist/data/components/Icon.d.ts.map +0 -1
  96. package/dist/data/components/Icon.js +0 -70
  97. package/dist/data/components/Icon.js.map +0 -1
  98. package/dist/data/components/Image.d.ts +0 -15
  99. package/dist/data/components/Image.d.ts.map +0 -1
  100. package/dist/data/components/Image.js +0 -122
  101. package/dist/data/components/Image.js.map +0 -1
  102. package/dist/data/components/Input.d.ts +0 -15
  103. package/dist/data/components/Input.d.ts.map +0 -1
  104. package/dist/data/components/Input.js +0 -109
  105. package/dist/data/components/Input.js.map +0 -1
  106. package/dist/data/components/List.d.ts +0 -15
  107. package/dist/data/components/List.d.ts.map +0 -1
  108. package/dist/data/components/List.js +0 -113
  109. package/dist/data/components/List.js.map +0 -1
  110. package/dist/data/components/Menu.d.ts +0 -15
  111. package/dist/data/components/Menu.d.ts.map +0 -1
  112. package/dist/data/components/Menu.js +0 -132
  113. package/dist/data/components/Menu.js.map +0 -1
  114. package/dist/data/components/Popover.d.ts +0 -15
  115. package/dist/data/components/Popover.d.ts.map +0 -1
  116. package/dist/data/components/Popover.js +0 -159
  117. package/dist/data/components/Popover.js.map +0 -1
  118. package/dist/data/components/Pressable.d.ts +0 -15
  119. package/dist/data/components/Pressable.d.ts.map +0 -1
  120. package/dist/data/components/Pressable.js +0 -125
  121. package/dist/data/components/Pressable.js.map +0 -1
  122. package/dist/data/components/Progress.d.ts +0 -15
  123. package/dist/data/components/Progress.d.ts.map +0 -1
  124. package/dist/data/components/Progress.js +0 -95
  125. package/dist/data/components/Progress.js.map +0 -1
  126. package/dist/data/components/RadioButton.d.ts +0 -15
  127. package/dist/data/components/RadioButton.d.ts.map +0 -1
  128. package/dist/data/components/RadioButton.js +0 -140
  129. package/dist/data/components/RadioButton.js.map +0 -1
  130. package/dist/data/components/SVGImage.d.ts +0 -15
  131. package/dist/data/components/SVGImage.d.ts.map +0 -1
  132. package/dist/data/components/SVGImage.js +0 -112
  133. package/dist/data/components/SVGImage.js.map +0 -1
  134. package/dist/data/components/Screen.d.ts +0 -15
  135. package/dist/data/components/Screen.d.ts.map +0 -1
  136. package/dist/data/components/Screen.js +0 -99
  137. package/dist/data/components/Screen.js.map +0 -1
  138. package/dist/data/components/Select.d.ts +0 -15
  139. package/dist/data/components/Select.d.ts.map +0 -1
  140. package/dist/data/components/Select.js +0 -146
  141. package/dist/data/components/Select.js.map +0 -1
  142. package/dist/data/components/Skeleton.d.ts +0 -15
  143. package/dist/data/components/Skeleton.d.ts.map +0 -1
  144. package/dist/data/components/Skeleton.js +0 -110
  145. package/dist/data/components/Skeleton.js.map +0 -1
  146. package/dist/data/components/Slider.d.ts +0 -15
  147. package/dist/data/components/Slider.d.ts.map +0 -1
  148. package/dist/data/components/Slider.js +0 -129
  149. package/dist/data/components/Slider.js.map +0 -1
  150. package/dist/data/components/Switch.d.ts +0 -15
  151. package/dist/data/components/Switch.d.ts.map +0 -1
  152. package/dist/data/components/Switch.js +0 -127
  153. package/dist/data/components/Switch.js.map +0 -1
  154. package/dist/data/components/TabBar.d.ts +0 -15
  155. package/dist/data/components/TabBar.d.ts.map +0 -1
  156. package/dist/data/components/TabBar.js +0 -145
  157. package/dist/data/components/TabBar.js.map +0 -1
  158. package/dist/data/components/Table.d.ts +0 -15
  159. package/dist/data/components/Table.d.ts.map +0 -1
  160. package/dist/data/components/Table.js +0 -151
  161. package/dist/data/components/Table.js.map +0 -1
  162. package/dist/data/components/Tabs.d.ts +0 -15
  163. package/dist/data/components/Tabs.d.ts.map +0 -1
  164. package/dist/data/components/Tabs.js +0 -150
  165. package/dist/data/components/Tabs.js.map +0 -1
  166. package/dist/data/components/Text.d.ts +0 -15
  167. package/dist/data/components/Text.d.ts.map +0 -1
  168. package/dist/data/components/Text.js +0 -85
  169. package/dist/data/components/Text.js.map +0 -1
  170. package/dist/data/components/TextArea.d.ts +0 -15
  171. package/dist/data/components/TextArea.d.ts.map +0 -1
  172. package/dist/data/components/TextArea.js +0 -155
  173. package/dist/data/components/TextArea.js.map +0 -1
  174. package/dist/data/components/Tooltip.d.ts +0 -15
  175. package/dist/data/components/Tooltip.d.ts.map +0 -1
  176. package/dist/data/components/Tooltip.js +0 -105
  177. package/dist/data/components/Tooltip.js.map +0 -1
  178. package/dist/data/components/Video.d.ts +0 -15
  179. package/dist/data/components/Video.d.ts.map +0 -1
  180. package/dist/data/components/Video.js +0 -168
  181. package/dist/data/components/Video.js.map +0 -1
  182. package/dist/data/components/View.d.ts +0 -15
  183. package/dist/data/components/View.d.ts.map +0 -1
  184. package/dist/data/components/View.js +0 -126
  185. package/dist/data/components/View.js.map +0 -1
  186. package/dist/data/components/index.d.ts +0 -37
  187. package/dist/data/components/index.d.ts.map +0 -1
  188. package/dist/data/components/index.js +0 -110
  189. package/dist/data/components/index.js.map +0 -1
  190. package/dist/data/framework-guides.d.ts +0 -2
  191. package/dist/data/framework-guides.d.ts.map +0 -1
  192. package/dist/data/framework-guides.js +0 -589
  193. package/dist/data/framework-guides.js.map +0 -1
  194. package/dist/data/icon-guide.d.ts +0 -2
  195. package/dist/data/icon-guide.d.ts.map +0 -1
  196. package/dist/data/icon-guide.js +0 -285
  197. package/dist/data/icon-guide.js.map +0 -1
  198. package/dist/data/icons.json +0 -7452
  199. package/dist/data/navigation-guides.d.ts +0 -2
  200. package/dist/data/navigation-guides.d.ts.map +0 -1
  201. package/dist/data/navigation-guides.js +0 -1196
  202. package/dist/data/navigation-guides.js.map +0 -1
  203. package/dist/index.d.ts +0 -3
  204. package/dist/index.d.ts.map +0 -1
  205. package/dist/index.js.map +0 -1
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env tsx
2
+
3
+ /**
4
+ * Validate Examples Script
5
+ *
6
+ * Validates all example TypeScript files against the actual component types
7
+ * to ensure they are type-correct and will compile.
8
+ */
9
+
10
+ import { Project, Diagnostic } from 'ts-morph';
11
+ import * as path from 'path';
12
+ import * as fs from 'fs';
13
+ import chalk from 'chalk';
14
+ import { fileURLToPath } from 'url';
15
+
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = path.dirname(__filename);
18
+
19
+ interface ValidationResult {
20
+ file: string;
21
+ success: boolean;
22
+ errors: string[];
23
+ }
24
+
25
+ async function main() {
26
+ console.log('🔍 Validating TypeScript examples...\n');
27
+
28
+ const project = new Project({
29
+ tsConfigFilePath: path.join(__dirname, '../tsconfig.examples.json'),
30
+ });
31
+
32
+ const examplesDir = path.join(__dirname, '../examples');
33
+
34
+ if (!fs.existsSync(examplesDir)) {
35
+ console.log(chalk.yellow('⚠️ No examples directory found. Skipping validation.'));
36
+ process.exit(0);
37
+ }
38
+
39
+ // Find all example files
40
+ const exampleFiles = findExampleFiles(examplesDir);
41
+
42
+ if (exampleFiles.length === 0) {
43
+ console.log(chalk.yellow('⚠️ No example files found. Skipping validation.'));
44
+ process.exit(0);
45
+ }
46
+
47
+ console.log(`Found ${exampleFiles.length} example files\n`);
48
+
49
+ // Add all example files to the project
50
+ for (const filePath of exampleFiles) {
51
+ project.addSourceFileAtPath(filePath);
52
+ }
53
+
54
+ // Get diagnostics (type errors)
55
+ const diagnostics = project.getPreEmitDiagnostics();
56
+
57
+ const results: ValidationResult[] = [];
58
+
59
+ // Group diagnostics by file
60
+ const diagnosticsByFile = new Map<string, Diagnostic[]>();
61
+ for (const diagnostic of diagnostics) {
62
+ const sourceFile = diagnostic.getSourceFile();
63
+ if (sourceFile) {
64
+ const filePath = sourceFile.getFilePath();
65
+ if (!diagnosticsByFile.has(filePath)) {
66
+ diagnosticsByFile.set(filePath, []);
67
+ }
68
+ diagnosticsByFile.get(filePath)!.push(diagnostic);
69
+ }
70
+ }
71
+
72
+ // Create results for each file
73
+ for (const filePath of exampleFiles) {
74
+ const relativePath = path.relative(process.cwd(), filePath);
75
+ const fileDiagnostics = diagnosticsByFile.get(filePath) || [];
76
+
77
+ const errors = fileDiagnostics.map(diagnostic => {
78
+ const message = diagnostic.getMessageText();
79
+ const line = diagnostic.getLineNumber();
80
+ return `Line ${line}: ${typeof message === 'string' ? message : message.getMessageText()}`;
81
+ });
82
+
83
+ results.push({
84
+ file: relativePath,
85
+ success: errors.length === 0,
86
+ errors,
87
+ });
88
+ }
89
+
90
+ // Print results
91
+ let hasErrors = false;
92
+
93
+ for (const result of results) {
94
+ if (result.success) {
95
+ console.log(chalk.green('✅'), result.file);
96
+ } else {
97
+ hasErrors = true;
98
+ console.log(chalk.red('❌'), result.file);
99
+ for (const error of result.errors) {
100
+ console.log(chalk.red(' '), error);
101
+ }
102
+ console.log();
103
+ }
104
+ }
105
+
106
+ console.log('\n📊 Summary:');
107
+ const successCount = results.filter(r => r.success).length;
108
+ const failCount = results.filter(r => !r.success).length;
109
+
110
+ console.log(` ${chalk.green('✅ Passed:')} ${successCount}`);
111
+ console.log(` ${chalk.red('❌ Failed:')} ${failCount}`);
112
+
113
+ if (hasErrors) {
114
+ console.log(chalk.red('\n❌ Validation failed. Please fix the type errors above.'));
115
+ process.exit(1);
116
+ } else {
117
+ console.log(chalk.green('\n✅ All examples are type-correct!'));
118
+ }
119
+ }
120
+
121
+ function findExampleFiles(dir: string): string[] {
122
+ const files: string[] = [];
123
+
124
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
125
+
126
+ for (const entry of entries) {
127
+ const fullPath = path.join(dir, entry.name);
128
+
129
+ if (entry.isDirectory()) {
130
+ files.push(...findExampleFiles(fullPath));
131
+ } else if (entry.name.endsWith('.tsx') || entry.name.endsWith('.ts')) {
132
+ files.push(fullPath);
133
+ }
134
+ }
135
+
136
+ return files;
137
+ }
138
+
139
+ main().catch(error => {
140
+ console.error(chalk.red('❌ Validation script failed:'), error);
141
+ process.exit(1);
142
+ });
@@ -2,7 +2,7 @@ export const Icon = {
2
2
  category: "display",
3
3
  description: "Material Design icon display component with size and color variants",
4
4
  props: `
5
- - \`name\`: IconName | `mdi:${IconName}` - The name of the icon to display
5
+ - \`name\`: IconName | 'mdi:\${IconName}' - The name of the icon to display
6
6
  - \`size\`: IconSizeVariant - The size variant of the icon
7
7
  - \`color\`: Color - Predefined color variant based on theme
8
8
  - \`intent\`: Intent - Intent variant for the icon
@@ -28,6 +28,7 @@ export { SVGImage } from './SVGImage.js';
28
28
  export { Switch } from './Switch.js';
29
29
  export { TabBar } from './TabBar.js';
30
30
  export { Table } from './Table.js';
31
+ export { Tabs } from './Tabs.js';
31
32
  export { Text } from './Text.js';
32
33
  export { TextArea } from './TextArea.js';
33
34
  export { Tooltip } from './Tooltip.js';
@@ -64,6 +65,7 @@ import { SVGImage } from './SVGImage.js';
64
65
  import { Switch } from './Switch.js';
65
66
  import { TabBar } from './TabBar.js';
66
67
  import { Table } from './Table.js';
68
+ import { Tabs } from './Tabs.js';
67
69
  import { Text } from './Text.js';
68
70
  import { TextArea } from './TextArea.js';
69
71
  import { Tooltip } from './Tooltip.js';
package/src/index.ts CHANGED
@@ -14,11 +14,18 @@ import { frameworkGuides } from "./data/framework-guides.js";
14
14
  import { navigationGuides } from "./data/navigation-guides.js";
15
15
  import { iconGuide } from "./data/icon-guide.js";
16
16
  import iconsData from "./data/icons.json" with { type: "json" };
17
+ import {
18
+ getComponentTypes,
19
+ getThemeTypes,
20
+ getNavigationTypes,
21
+ getAvailableComponents,
22
+ getComponentExamples,
23
+ } from "./tools/get-types.js";
17
24
 
18
25
  const server = new Server(
19
26
  {
20
27
  name: "@idealyst/mcp-server",
21
- version: "1.0.87",
28
+ version: "1.0.88",
22
29
  },
23
30
  {
24
31
  capabilities: {
@@ -122,6 +129,67 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
122
129
  required: ["query"],
123
130
  },
124
131
  },
132
+ {
133
+ name: "get_component_types",
134
+ description: "Get TypeScript type definitions for a specific component directly from the source. Returns the actual TypeScript interface and/or JSON schema.",
135
+ inputSchema: {
136
+ type: "object",
137
+ properties: {
138
+ component: {
139
+ type: "string",
140
+ description: "The name of the component (e.g., 'Button', 'Card', 'Input')",
141
+ },
142
+ format: {
143
+ type: "string",
144
+ description: "Output format: 'typescript' for raw TypeScript definitions, 'json' for parsed schema, 'both' for combined output (default: 'both')",
145
+ enum: ["typescript", "json", "both"],
146
+ },
147
+ },
148
+ required: ["component"],
149
+ },
150
+ },
151
+ {
152
+ name: "get_theme_types",
153
+ description: "Get TypeScript type definitions for theme types (Size, Intent, Color, etc.) directly from @idealyst/theme",
154
+ inputSchema: {
155
+ type: "object",
156
+ properties: {
157
+ format: {
158
+ type: "string",
159
+ description: "Output format: 'typescript', 'json', or 'both' (default: 'both')",
160
+ enum: ["typescript", "json", "both"],
161
+ },
162
+ },
163
+ },
164
+ },
165
+ {
166
+ name: "get_navigation_types",
167
+ description: "Get TypeScript type definitions for navigation types directly from @idealyst/navigation",
168
+ inputSchema: {
169
+ type: "object",
170
+ properties: {
171
+ format: {
172
+ type: "string",
173
+ description: "Output format: 'typescript', 'json', or 'both' (default: 'both')",
174
+ enum: ["typescript", "json", "both"],
175
+ },
176
+ },
177
+ },
178
+ },
179
+ {
180
+ name: "get_component_examples_ts",
181
+ description: "Get validated TypeScript example code for a component. These examples are type-checked and guaranteed to compile.",
182
+ inputSchema: {
183
+ type: "object",
184
+ properties: {
185
+ component: {
186
+ type: "string",
187
+ description: "The name of the component (e.g., 'Button', 'Card')",
188
+ },
189
+ },
190
+ required: ["component"],
191
+ },
192
+ },
125
193
  ],
126
194
  };
127
195
  });
@@ -353,6 +421,118 @@ ${command.examples.map((ex: string) => `\`\`\`bash\n${ex}\n\`\`\``).join("\n\n")
353
421
  };
354
422
  }
355
423
 
424
+ case "get_component_types": {
425
+ const componentName = args?.component as string;
426
+ const format = (args?.format as 'typescript' | 'json' | 'both') || 'both';
427
+
428
+ try {
429
+ const result = getComponentTypes(componentName, format);
430
+ return {
431
+ content: [
432
+ {
433
+ type: "text",
434
+ text: JSON.stringify(result, null, 2),
435
+ },
436
+ ],
437
+ };
438
+ } catch (error) {
439
+ return {
440
+ content: [
441
+ {
442
+ type: "text",
443
+ text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
444
+ },
445
+ ],
446
+ };
447
+ }
448
+ }
449
+
450
+ case "get_theme_types": {
451
+ const format = (args?.format as 'typescript' | 'json' | 'both') || 'both';
452
+
453
+ try {
454
+ const result = getThemeTypes(format);
455
+ return {
456
+ content: [
457
+ {
458
+ type: "text",
459
+ text: JSON.stringify(result, null, 2),
460
+ },
461
+ ],
462
+ };
463
+ } catch (error) {
464
+ return {
465
+ content: [
466
+ {
467
+ type: "text",
468
+ text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
469
+ },
470
+ ],
471
+ };
472
+ }
473
+ }
474
+
475
+ case "get_navigation_types": {
476
+ const format = (args?.format as 'typescript' | 'json' | 'both') || 'both';
477
+
478
+ try {
479
+ const result = getNavigationTypes(format);
480
+ return {
481
+ content: [
482
+ {
483
+ type: "text",
484
+ text: JSON.stringify(result, null, 2),
485
+ },
486
+ ],
487
+ };
488
+ } catch (error) {
489
+ return {
490
+ content: [
491
+ {
492
+ type: "text",
493
+ text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
494
+ },
495
+ ],
496
+ };
497
+ }
498
+ }
499
+
500
+ case "get_component_examples_ts": {
501
+ const componentName = args?.component as string;
502
+
503
+ try {
504
+ const examples = getComponentExamples(componentName);
505
+ if (!examples) {
506
+ return {
507
+ content: [
508
+ {
509
+ type: "text",
510
+ text: `No TypeScript examples found for component "${componentName}". Available components with examples: ${getAvailableComponents().join(', ')}`,
511
+ },
512
+ ],
513
+ };
514
+ }
515
+
516
+ return {
517
+ content: [
518
+ {
519
+ type: "text",
520
+ text: examples,
521
+ },
522
+ ],
523
+ };
524
+ } catch (error) {
525
+ return {
526
+ content: [
527
+ {
528
+ type: "text",
529
+ text: `Error: ${error instanceof Error ? error.message : 'Unknown error'}`,
530
+ },
531
+ ],
532
+ };
533
+ }
534
+ }
535
+
356
536
  default:
357
537
  return {
358
538
  content: [
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Get Types Tool
3
+ *
4
+ * Returns TypeScript type definitions for Idealyst components, theme, and navigation.
5
+ */
6
+
7
+ import * as fs from 'fs';
8
+ import * as path from 'path';
9
+ import { fileURLToPath } from 'url';
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ interface TypesData {
15
+ version: string;
16
+ extractedAt: string;
17
+ components: Record<string, any>;
18
+ theme: Record<string, any>;
19
+ navigation: Record<string, any>;
20
+ }
21
+
22
+ let cachedTypes: TypesData | null = null;
23
+
24
+ /**
25
+ * Load extracted types from JSON file
26
+ */
27
+ function loadTypes(): TypesData {
28
+ if (cachedTypes) {
29
+ return cachedTypes;
30
+ }
31
+
32
+ const typesPath = path.join(__dirname, '../generated/types.json');
33
+
34
+ if (!fs.existsSync(typesPath)) {
35
+ throw new Error(
36
+ 'Types file not found. Please run "yarn extract-types" to generate type definitions.'
37
+ );
38
+ }
39
+
40
+ const content = fs.readFileSync(typesPath, 'utf-8');
41
+ cachedTypes = JSON.parse(content);
42
+
43
+ return cachedTypes!;
44
+ }
45
+
46
+ /**
47
+ * Get component types by name
48
+ */
49
+ export function getComponentTypes(componentName: string, format: 'typescript' | 'json' | 'both' = 'both') {
50
+ const types = loadTypes();
51
+ const component = types.components[componentName];
52
+
53
+ if (!component) {
54
+ throw new Error(
55
+ `Component "${componentName}" not found. Available components: ${Object.keys(types.components).join(', ')}`
56
+ );
57
+ }
58
+
59
+ const result: any = {
60
+ component: componentName,
61
+ };
62
+
63
+ if (format === 'typescript' || format === 'both') {
64
+ result.typescript = formatTypeScriptOutput(component);
65
+ }
66
+
67
+ if (format === 'json' || format === 'both') {
68
+ result.schema = {
69
+ propsInterface: component.propsInterface,
70
+ props: component.props,
71
+ relatedTypes: component.relatedTypes,
72
+ };
73
+ }
74
+
75
+ return result;
76
+ }
77
+
78
+ /**
79
+ * Get theme types
80
+ */
81
+ export function getThemeTypes(format: 'typescript' | 'json' | 'both' = 'both') {
82
+ const types = loadTypes();
83
+
84
+ const result: any = {
85
+ name: 'Theme Types',
86
+ };
87
+
88
+ if (format === 'typescript' || format === 'both') {
89
+ const tsOutput = Object.entries(types.theme)
90
+ .map(([name, info]: [string, any]) => info.definition)
91
+ .join('\n\n');
92
+ result.typescript = tsOutput;
93
+ }
94
+
95
+ if (format === 'json' || format === 'both') {
96
+ result.schema = types.theme;
97
+ }
98
+
99
+ return result;
100
+ }
101
+
102
+ /**
103
+ * Get navigation types
104
+ */
105
+ export function getNavigationTypes(format: 'typescript' | 'json' | 'both' = 'both') {
106
+ const types = loadTypes();
107
+
108
+ const result: any = {
109
+ name: 'Navigation Types',
110
+ };
111
+
112
+ if (format === 'typescript' || format === 'both') {
113
+ const tsOutput = Object.entries(types.navigation)
114
+ .map(([name, definition]) => definition)
115
+ .join('\n\n');
116
+ result.typescript = tsOutput;
117
+ }
118
+
119
+ if (format === 'json' || format === 'both') {
120
+ result.schema = types.navigation;
121
+ }
122
+
123
+ return result;
124
+ }
125
+
126
+ /**
127
+ * Format TypeScript output for better readability
128
+ */
129
+ function formatTypeScriptOutput(component: any): string {
130
+ const sections: string[] = [];
131
+
132
+ // Main props interface
133
+ sections.push(`// ${component.propsInterface}`);
134
+ sections.push(component.typeDefinition);
135
+
136
+ // Related types
137
+ if (Object.keys(component.relatedTypes).length > 0) {
138
+ sections.push('\n// Related Types');
139
+ for (const [name, definition] of Object.entries(component.relatedTypes)) {
140
+ sections.push(definition as string);
141
+ }
142
+ }
143
+
144
+ return sections.join('\n\n');
145
+ }
146
+
147
+ /**
148
+ * Get list of all available components
149
+ */
150
+ export function getAvailableComponents() {
151
+ const types = loadTypes();
152
+ return Object.keys(types.components);
153
+ }
154
+
155
+ /**
156
+ * Get examples for a component
157
+ */
158
+ export function getComponentExamples(componentName: string): string | null {
159
+ const examplesPath = path.join(
160
+ __dirname,
161
+ `../../examples/components/${componentName}.examples.tsx`
162
+ );
163
+
164
+ if (!fs.existsSync(examplesPath)) {
165
+ return null;
166
+ }
167
+
168
+ return fs.readFileSync(examplesPath, 'utf-8');
169
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "jsx": "react",
5
+ "noEmit": true,
6
+ "skipLibCheck": true,
7
+ "esModuleInterop": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "resolveJsonModule": true
10
+ },
11
+ "include": [
12
+ "examples/**/*"
13
+ ]
14
+ }
@@ -1,2 +0,0 @@
1
- export declare const cliCommands: Record<string, any>;
2
- //# sourceMappingURL=cli-commands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-commands.d.ts","sourceRoot":"","sources":["../../src/data/cli-commands.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAsG3C,CAAC"}
@@ -1,100 +0,0 @@
1
- export const cliCommands = {
2
- init: {
3
- description: "Initialize a new Idealyst workspace with monorepo structure",
4
- usage: "idealyst init <workspace-name> [options]",
5
- options: [
6
- {
7
- flag: "workspace-name",
8
- description: "Name for the new workspace (required)",
9
- },
10
- {
11
- flag: "--git",
12
- description: "Initialize git repository (default: true)",
13
- },
14
- {
15
- flag: "--install",
16
- description: "Install dependencies after creation (default: true)",
17
- },
18
- ],
19
- examples: [
20
- "idealyst init my-app",
21
- "idealyst init my-company-workspace --no-git",
22
- ],
23
- },
24
- create: {
25
- description: "Create a new package within the Idealyst workspace",
26
- usage: "idealyst create <name> --type <type> [options]",
27
- options: [
28
- {
29
- flag: "name",
30
- description: "Name for the new package (required)",
31
- },
32
- {
33
- flag: "--type",
34
- description: "Package type: web | native | api | database | shared (required)",
35
- },
36
- {
37
- flag: "--app-name",
38
- description: "Display name for native app (required for native type)",
39
- },
40
- {
41
- flag: "--with-trpc",
42
- description: "Include tRPC setup (for web/native)",
43
- },
44
- {
45
- flag: "--no-trpc",
46
- description: "Exclude tRPC setup (for web/native)",
47
- },
48
- ],
49
- examples: [
50
- "idealyst create web --type web --with-trpc",
51
- "idealyst create mobile --type native --app-name \"My App\" --with-trpc",
52
- "idealyst create api --type api",
53
- "idealyst create database --type database",
54
- "idealyst create shared --type shared",
55
- ],
56
- },
57
- dev: {
58
- description: "Start development server for a package",
59
- usage: "cd packages/<name> && yarn dev",
60
- options: [
61
- {
62
- flag: "--port",
63
- description: "Port number for dev server (web only)",
64
- },
65
- ],
66
- examples: [
67
- "cd packages/web && yarn dev",
68
- "cd packages/native && yarn dev",
69
- ],
70
- },
71
- build: {
72
- description: "Build a package for production",
73
- usage: "cd packages/<name> && yarn build",
74
- options: [],
75
- examples: [
76
- "cd packages/web && yarn build",
77
- "cd packages/api && yarn build",
78
- ],
79
- },
80
- test: {
81
- description: "Run tests for packages",
82
- usage: "yarn test [options]",
83
- options: [
84
- {
85
- flag: "--watch",
86
- description: "Run tests in watch mode",
87
- },
88
- {
89
- flag: "--coverage",
90
- description: "Generate coverage report",
91
- },
92
- ],
93
- examples: [
94
- "yarn test",
95
- "yarn test:watch",
96
- "yarn test:coverage",
97
- ],
98
- },
99
- };
100
- //# sourceMappingURL=cli-commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-commands.js","sourceRoot":"","sources":["../../src/data/cli-commands.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAwB;IAC9C,IAAI,EAAE;QACJ,WAAW,EAAE,6DAA6D;QAC1E,KAAK,EAAE,0CAA0C;QACjD,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,uCAAuC;aACrD;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,2CAA2C;aACzD;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,qDAAqD;aACnE;SACF;QACD,QAAQ,EAAE;YACR,sBAAsB;YACtB,6CAA6C;SAC9C;KACF;IAED,MAAM,EAAE;QACN,WAAW,EAAE,oDAAoD;QACjE,KAAK,EAAE,gDAAgD;QACvD,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,qCAAqC;aACnD;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;aAC/E;YACD;gBACE,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,wDAAwD;aACtE;YACD;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,qCAAqC;aACnD;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,qCAAqC;aACnD;SACF;QACD,QAAQ,EAAE;YACR,4CAA4C;YAC5C,wEAAwE;YACxE,gCAAgC;YAChC,0CAA0C;YAC1C,sCAAsC;SACvC;KACF;IAED,GAAG,EAAE;QACH,WAAW,EAAE,wCAAwC;QACrD,KAAK,EAAE,gCAAgC;QACvC,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uCAAuC;aACrD;SACF;QACD,QAAQ,EAAE;YACR,6BAA6B;YAC7B,gCAAgC;SACjC;KACF;IAED,KAAK,EAAE;QACL,WAAW,EAAE,gCAAgC;QAC7C,KAAK,EAAE,kCAAkC;QACzC,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE;YACR,+BAA+B;YAC/B,+BAA+B;SAChC;KACF;IAED,IAAI,EAAE;QACJ,WAAW,EAAE,wBAAwB;QACrC,KAAK,EAAE,qBAAqB;QAC5B,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,yBAAyB;aACvC;YACD;gBACE,IAAI,EAAE,YAAY;gBAClB,WAAW,EAAE,0BAA0B;aACxC;SACF;QACD,QAAQ,EAAE;YACR,WAAW;YACX,iBAAiB;YACjB,oBAAoB;SACrB;KACF;CACF,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const Accordion: {
2
- category: string;
3
- description: string;
4
- props: string;
5
- features: string[];
6
- bestPractices: string[];
7
- usage: string;
8
- examples: {
9
- basic: string;
10
- variants: string;
11
- "with-icons": string;
12
- interactive: string;
13
- };
14
- };
15
- //# sourceMappingURL=Accordion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/data/components/Accordion.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAiHrB,CAAC"}