@idealyst/mcp-server 1.0.87 → 1.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +313 -0
- package/README.md +292 -104
- package/TYPE-SYSTEM.md +397 -0
- package/dist/index.js +170 -1
- package/examples/components/Accordion.examples.tsx +147 -0
- package/examples/components/ActivityIndicator.examples.tsx +350 -0
- package/examples/components/Alert.examples.tsx +335 -0
- package/examples/components/Avatar.examples.tsx +188 -0
- package/examples/components/Badge.examples.tsx +242 -0
- package/examples/components/Breadcrumb.examples.tsx +303 -0
- package/examples/components/Button.examples.tsx +113 -0
- package/examples/components/Card.examples.tsx +131 -0
- package/examples/components/Checkbox.examples.tsx +195 -0
- package/examples/components/Chip.examples.tsx +87 -0
- package/examples/components/Dialog.examples.tsx +344 -0
- package/examples/components/Divider.examples.tsx +258 -0
- package/examples/components/Icon.examples.tsx +202 -0
- package/examples/components/Input.examples.tsx +205 -0
- package/examples/components/Menu.examples.tsx +321 -0
- package/examples/components/Popover.examples.tsx +439 -0
- package/examples/components/Progress.examples.tsx +340 -0
- package/examples/components/RadioButton.examples.tsx +443 -0
- package/examples/components/Screen.examples.tsx +347 -0
- package/examples/components/Select.examples.tsx +279 -0
- package/examples/components/Skeleton.examples.tsx +278 -0
- package/examples/components/Slider.examples.tsx +249 -0
- package/examples/components/Switch.examples.tsx +94 -0
- package/examples/components/TabBar.examples.tsx +356 -0
- package/examples/components/Text.examples.tsx +177 -0
- package/examples/components/TextArea.examples.tsx +203 -0
- package/examples/components/Tooltip.examples.tsx +318 -0
- package/examples/components/View.examples.tsx +307 -0
- package/package.json +15 -2
- package/scripts/extract-types.ts +71 -0
- package/scripts/type-extractor.ts +286 -0
- package/scripts/validate-examples.ts +142 -0
- package/src/data/components/Icon.ts +1 -1
- package/src/data/components/index.ts +2 -0
- package/src/index.ts +181 -1
- package/src/tools/get-types.ts +169 -0
- package/tsconfig.examples.json +14 -0
- package/dist/data/cli-commands.d.ts +0 -2
- package/dist/data/cli-commands.d.ts.map +0 -1
- package/dist/data/cli-commands.js +0 -100
- package/dist/data/cli-commands.js.map +0 -1
- package/dist/data/components/Accordion.d.ts +0 -15
- package/dist/data/components/Accordion.d.ts.map +0 -1
- package/dist/data/components/Accordion.js +0 -112
- package/dist/data/components/Accordion.js.map +0 -1
- package/dist/data/components/ActivityIndicator.d.ts +0 -15
- package/dist/data/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/data/components/ActivityIndicator.js +0 -82
- package/dist/data/components/ActivityIndicator.js.map +0 -1
- package/dist/data/components/Alert.d.ts +0 -15
- package/dist/data/components/Alert.d.ts.map +0 -1
- package/dist/data/components/Alert.js +0 -132
- package/dist/data/components/Alert.js.map +0 -1
- package/dist/data/components/Avatar.d.ts +0 -15
- package/dist/data/components/Avatar.d.ts.map +0 -1
- package/dist/data/components/Avatar.js +0 -93
- package/dist/data/components/Avatar.js.map +0 -1
- package/dist/data/components/Badge.d.ts +0 -15
- package/dist/data/components/Badge.d.ts.map +0 -1
- package/dist/data/components/Badge.js +0 -64
- package/dist/data/components/Badge.js.map +0 -1
- package/dist/data/components/Breadcrumb.d.ts +0 -15
- package/dist/data/components/Breadcrumb.d.ts.map +0 -1
- package/dist/data/components/Breadcrumb.js +0 -96
- package/dist/data/components/Breadcrumb.js.map +0 -1
- package/dist/data/components/Button.d.ts +0 -15
- package/dist/data/components/Button.d.ts.map +0 -1
- package/dist/data/components/Button.js +0 -87
- package/dist/data/components/Button.js.map +0 -1
- package/dist/data/components/Card.d.ts +0 -15
- package/dist/data/components/Card.d.ts.map +0 -1
- package/dist/data/components/Card.js +0 -67
- package/dist/data/components/Card.js.map +0 -1
- package/dist/data/components/Checkbox.d.ts +0 -15
- package/dist/data/components/Checkbox.d.ts.map +0 -1
- package/dist/data/components/Checkbox.js +0 -118
- package/dist/data/components/Checkbox.js.map +0 -1
- package/dist/data/components/Chip.d.ts +0 -15
- package/dist/data/components/Chip.d.ts.map +0 -1
- package/dist/data/components/Chip.js +0 -76
- package/dist/data/components/Chip.js.map +0 -1
- package/dist/data/components/Dialog.d.ts +0 -15
- package/dist/data/components/Dialog.d.ts.map +0 -1
- package/dist/data/components/Dialog.js +0 -137
- package/dist/data/components/Dialog.js.map +0 -1
- package/dist/data/components/Divider.d.ts +0 -15
- package/dist/data/components/Divider.d.ts.map +0 -1
- package/dist/data/components/Divider.js +0 -71
- package/dist/data/components/Divider.js.map +0 -1
- package/dist/data/components/Icon.d.ts +0 -15
- package/dist/data/components/Icon.d.ts.map +0 -1
- package/dist/data/components/Icon.js +0 -70
- package/dist/data/components/Icon.js.map +0 -1
- package/dist/data/components/Image.d.ts +0 -15
- package/dist/data/components/Image.d.ts.map +0 -1
- package/dist/data/components/Image.js +0 -122
- package/dist/data/components/Image.js.map +0 -1
- package/dist/data/components/Input.d.ts +0 -15
- package/dist/data/components/Input.d.ts.map +0 -1
- package/dist/data/components/Input.js +0 -109
- package/dist/data/components/Input.js.map +0 -1
- package/dist/data/components/List.d.ts +0 -15
- package/dist/data/components/List.d.ts.map +0 -1
- package/dist/data/components/List.js +0 -113
- package/dist/data/components/List.js.map +0 -1
- package/dist/data/components/Menu.d.ts +0 -15
- package/dist/data/components/Menu.d.ts.map +0 -1
- package/dist/data/components/Menu.js +0 -132
- package/dist/data/components/Menu.js.map +0 -1
- package/dist/data/components/Popover.d.ts +0 -15
- package/dist/data/components/Popover.d.ts.map +0 -1
- package/dist/data/components/Popover.js +0 -159
- package/dist/data/components/Popover.js.map +0 -1
- package/dist/data/components/Pressable.d.ts +0 -15
- package/dist/data/components/Pressable.d.ts.map +0 -1
- package/dist/data/components/Pressable.js +0 -125
- package/dist/data/components/Pressable.js.map +0 -1
- package/dist/data/components/Progress.d.ts +0 -15
- package/dist/data/components/Progress.d.ts.map +0 -1
- package/dist/data/components/Progress.js +0 -95
- package/dist/data/components/Progress.js.map +0 -1
- package/dist/data/components/RadioButton.d.ts +0 -15
- package/dist/data/components/RadioButton.d.ts.map +0 -1
- package/dist/data/components/RadioButton.js +0 -140
- package/dist/data/components/RadioButton.js.map +0 -1
- package/dist/data/components/SVGImage.d.ts +0 -15
- package/dist/data/components/SVGImage.d.ts.map +0 -1
- package/dist/data/components/SVGImage.js +0 -112
- package/dist/data/components/SVGImage.js.map +0 -1
- package/dist/data/components/Screen.d.ts +0 -15
- package/dist/data/components/Screen.d.ts.map +0 -1
- package/dist/data/components/Screen.js +0 -99
- package/dist/data/components/Screen.js.map +0 -1
- package/dist/data/components/Select.d.ts +0 -15
- package/dist/data/components/Select.d.ts.map +0 -1
- package/dist/data/components/Select.js +0 -146
- package/dist/data/components/Select.js.map +0 -1
- package/dist/data/components/Skeleton.d.ts +0 -15
- package/dist/data/components/Skeleton.d.ts.map +0 -1
- package/dist/data/components/Skeleton.js +0 -110
- package/dist/data/components/Skeleton.js.map +0 -1
- package/dist/data/components/Slider.d.ts +0 -15
- package/dist/data/components/Slider.d.ts.map +0 -1
- package/dist/data/components/Slider.js +0 -129
- package/dist/data/components/Slider.js.map +0 -1
- package/dist/data/components/Switch.d.ts +0 -15
- package/dist/data/components/Switch.d.ts.map +0 -1
- package/dist/data/components/Switch.js +0 -127
- package/dist/data/components/Switch.js.map +0 -1
- package/dist/data/components/TabBar.d.ts +0 -15
- package/dist/data/components/TabBar.d.ts.map +0 -1
- package/dist/data/components/TabBar.js +0 -145
- package/dist/data/components/TabBar.js.map +0 -1
- package/dist/data/components/Table.d.ts +0 -15
- package/dist/data/components/Table.d.ts.map +0 -1
- package/dist/data/components/Table.js +0 -151
- package/dist/data/components/Table.js.map +0 -1
- package/dist/data/components/Tabs.d.ts +0 -15
- package/dist/data/components/Tabs.d.ts.map +0 -1
- package/dist/data/components/Tabs.js +0 -150
- package/dist/data/components/Tabs.js.map +0 -1
- package/dist/data/components/Text.d.ts +0 -15
- package/dist/data/components/Text.d.ts.map +0 -1
- package/dist/data/components/Text.js +0 -85
- package/dist/data/components/Text.js.map +0 -1
- package/dist/data/components/TextArea.d.ts +0 -15
- package/dist/data/components/TextArea.d.ts.map +0 -1
- package/dist/data/components/TextArea.js +0 -155
- package/dist/data/components/TextArea.js.map +0 -1
- package/dist/data/components/Tooltip.d.ts +0 -15
- package/dist/data/components/Tooltip.d.ts.map +0 -1
- package/dist/data/components/Tooltip.js +0 -105
- package/dist/data/components/Tooltip.js.map +0 -1
- package/dist/data/components/Video.d.ts +0 -15
- package/dist/data/components/Video.d.ts.map +0 -1
- package/dist/data/components/Video.js +0 -168
- package/dist/data/components/Video.js.map +0 -1
- package/dist/data/components/View.d.ts +0 -15
- package/dist/data/components/View.d.ts.map +0 -1
- package/dist/data/components/View.js +0 -126
- package/dist/data/components/View.js.map +0 -1
- package/dist/data/components/index.d.ts +0 -37
- package/dist/data/components/index.d.ts.map +0 -1
- package/dist/data/components/index.js +0 -110
- package/dist/data/components/index.js.map +0 -1
- package/dist/data/framework-guides.d.ts +0 -2
- package/dist/data/framework-guides.d.ts.map +0 -1
- package/dist/data/framework-guides.js +0 -589
- package/dist/data/framework-guides.js.map +0 -1
- package/dist/data/icon-guide.d.ts +0 -2
- package/dist/data/icon-guide.d.ts.map +0 -1
- package/dist/data/icon-guide.js +0 -285
- package/dist/data/icon-guide.js.map +0 -1
- package/dist/data/icons.json +0 -7452
- package/dist/data/navigation-guides.d.ts +0 -2
- package/dist/data/navigation-guides.d.ts.map +0 -1
- package/dist/data/navigation-guides.js +0 -1196
- package/dist/data/navigation-guides.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# MCP Server Type-Driven Architecture
|
|
2
|
+
|
|
3
|
+
## Problem Statement
|
|
4
|
+
|
|
5
|
+
The MCP server documentation is manually maintained and has drifted from the actual TypeScript type definitions in `@idealyst/components` and `@idealyst/theme`. This causes:
|
|
6
|
+
- Incorrect prop names and values in documentation
|
|
7
|
+
- TypeScript compilation errors when using documented examples
|
|
8
|
+
- High maintenance burden to keep docs in sync
|
|
9
|
+
- Loss of developer trust
|
|
10
|
+
|
|
11
|
+
## Solution: Type-Driven Documentation System
|
|
12
|
+
|
|
13
|
+
### Architecture Overview
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
┌─────────────────────────────────────────────────────────┐
|
|
17
|
+
│ @idealyst/components & @idealyst/theme (Source of Truth)│
|
|
18
|
+
│ - Button/types.ts │
|
|
19
|
+
│ - Card/types.ts │
|
|
20
|
+
│ - theme/size.ts (Size type) │
|
|
21
|
+
│ - theme/intent.ts (Intent type) │
|
|
22
|
+
└────────────────┬────────────────────────────────────────┘
|
|
23
|
+
│
|
|
24
|
+
▼
|
|
25
|
+
┌─────────────────────────────────────────────────────────┐
|
|
26
|
+
│ Build-Time Type Extraction (packages/mcp-server/build) │
|
|
27
|
+
│ - extract-types.ts │
|
|
28
|
+
│ • Uses TypeScript Compiler API │
|
|
29
|
+
│ • Parses all component types.ts files │
|
|
30
|
+
│ • Extracts Size, Intent, Color from theme │
|
|
31
|
+
│ • Generates JSON schema │
|
|
32
|
+
│ - validate-examples.ts │
|
|
33
|
+
│ • Validates all examples against extracted types │
|
|
34
|
+
│ • Fails build if examples have type errors │
|
|
35
|
+
└────────────────┬────────────────────────────────────────┘
|
|
36
|
+
│
|
|
37
|
+
▼
|
|
38
|
+
┌─────────────────────────────────────────────────────────┐
|
|
39
|
+
│ Generated Type Definitions (auto-generated) │
|
|
40
|
+
│ - src/generated/types.json │
|
|
41
|
+
│ { │
|
|
42
|
+
│ "Button": { │
|
|
43
|
+
│ "props": { │
|
|
44
|
+
│ "type": { "type": "ButtonType", "values": [...]}│
|
|
45
|
+
│ "size": { "type": "Size", "values": ["xs",...] │
|
|
46
|
+
│ "leftIcon": { "type": "IconName | ReactNode" } │
|
|
47
|
+
│ } │
|
|
48
|
+
│ } │
|
|
49
|
+
│ } │
|
|
50
|
+
└────────────────┬────────────────────────────────────────┘
|
|
51
|
+
│
|
|
52
|
+
▼
|
|
53
|
+
┌─────────────────────────────────────────────────────────┐
|
|
54
|
+
│ MCP Server Runtime │
|
|
55
|
+
│ - New Tool: get_component_types(componentName) │
|
|
56
|
+
│ Returns: Raw TypeScript interface + extracted JSON │
|
|
57
|
+
│ │
|
|
58
|
+
│ - Enhanced Tool: get_component_docs(componentName) │
|
|
59
|
+
│ Generates docs from types.json + manual content │
|
|
60
|
+
│ │
|
|
61
|
+
│ - Validated Examples │
|
|
62
|
+
│ All examples are TypeScript-validated at build time │
|
|
63
|
+
└─────────────────────────────────────────────────────────┘
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Implementation Phases
|
|
67
|
+
|
|
68
|
+
#### Phase 1: Add Type Extraction System
|
|
69
|
+
**Files to Create:**
|
|
70
|
+
- `packages/mcp-server/scripts/extract-types.ts`
|
|
71
|
+
- `packages/mcp-server/scripts/validate-examples.ts`
|
|
72
|
+
- `packages/mcp-server/scripts/type-extractor.ts` (utility)
|
|
73
|
+
|
|
74
|
+
**What It Does:**
|
|
75
|
+
- Reads TypeScript type files from components/theme packages
|
|
76
|
+
- Extracts prop definitions, enums, types
|
|
77
|
+
- Generates `src/generated/types.json`
|
|
78
|
+
- Runs as part of MCP server build process
|
|
79
|
+
|
|
80
|
+
#### Phase 2: Add Type Export Tool
|
|
81
|
+
**File to Modify:**
|
|
82
|
+
- `packages/mcp-server/src/index.ts`
|
|
83
|
+
|
|
84
|
+
**New Tool:**
|
|
85
|
+
```typescript
|
|
86
|
+
{
|
|
87
|
+
name: "get_component_types",
|
|
88
|
+
description: "Get TypeScript type definitions for a component",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
component: { type: "string" },
|
|
93
|
+
format: {
|
|
94
|
+
type: "string",
|
|
95
|
+
enum: ["typescript", "json", "both"],
|
|
96
|
+
description: "typescript=raw .d.ts, json=parsed schema, both=combined"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Returns:**
|
|
104
|
+
```typescript
|
|
105
|
+
{
|
|
106
|
+
component: "Button",
|
|
107
|
+
typescript: `export interface ButtonProps {
|
|
108
|
+
type?: 'contained' | 'outlined' | 'text';
|
|
109
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
110
|
+
// ...
|
|
111
|
+
}`,
|
|
112
|
+
schema: {
|
|
113
|
+
props: {
|
|
114
|
+
type: { type: "ButtonType", values: ["contained", "outlined", "text"] },
|
|
115
|
+
size: { type: "Size", values: ["xs", "sm", "md", "lg", "xl"] }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Phase 3: Refactor Documentation Generation
|
|
122
|
+
**Files to Modify:**
|
|
123
|
+
- `packages/mcp-server/src/data/components/*.ts`
|
|
124
|
+
|
|
125
|
+
**New Structure:**
|
|
126
|
+
```typescript
|
|
127
|
+
// Button.ts
|
|
128
|
+
import buttonTypes from '../../generated/types.json';
|
|
129
|
+
|
|
130
|
+
export const Button = {
|
|
131
|
+
category: "form",
|
|
132
|
+
description: "Interactive button component...",
|
|
133
|
+
|
|
134
|
+
// Props are now auto-generated from types.json
|
|
135
|
+
// Manual override only for additional context
|
|
136
|
+
propsOverride: {
|
|
137
|
+
leftIcon: "Icon to display on the left. Supports icon names (e.g., 'check') or custom React elements"
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
// Types come from extracted schema
|
|
141
|
+
types: buttonTypes.Button,
|
|
142
|
+
|
|
143
|
+
features: [...],
|
|
144
|
+
bestPractices: [...],
|
|
145
|
+
|
|
146
|
+
examples: {
|
|
147
|
+
basic: `...`,
|
|
148
|
+
// Examples are validated at build time
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Phase 4: Add Validation Testing
|
|
154
|
+
**Files to Create:**
|
|
155
|
+
- `packages/mcp-server/tests/type-accuracy.test.ts`
|
|
156
|
+
- `packages/mcp-server/tests/example-validation.test.ts`
|
|
157
|
+
|
|
158
|
+
**Tests:**
|
|
159
|
+
1. Verify extracted types match source files
|
|
160
|
+
2. Validate all examples compile with TypeScript
|
|
161
|
+
3. Check that documentation prop names exist in types
|
|
162
|
+
4. Ensure enum values in docs match type definitions
|
|
163
|
+
|
|
164
|
+
### Developer Experience Improvements
|
|
165
|
+
|
|
166
|
+
#### For Component Library Developers
|
|
167
|
+
- Change types in `@idealyst/components` → Types auto-update in MCP docs
|
|
168
|
+
- Build fails if examples become invalid
|
|
169
|
+
- No manual documentation sync required
|
|
170
|
+
|
|
171
|
+
#### For AI Assistants (Claude, etc.)
|
|
172
|
+
- Can request raw TypeScript types: `get_component_types("Button", "typescript")`
|
|
173
|
+
- Can get both human docs + machine-readable schema
|
|
174
|
+
- Examples are guaranteed to be type-correct
|
|
175
|
+
|
|
176
|
+
#### For End Users
|
|
177
|
+
- Generated code works on first try
|
|
178
|
+
- No more "property doesn't exist" errors
|
|
179
|
+
- Documentation always matches reality
|
|
180
|
+
|
|
181
|
+
### Migration Strategy
|
|
182
|
+
|
|
183
|
+
#### Step 1: Extract Types (Non-Breaking)
|
|
184
|
+
Add type extraction as opt-in feature, keep current docs working
|
|
185
|
+
|
|
186
|
+
#### Step 2: Validate Examples (Breaking if invalid)
|
|
187
|
+
Add example validation, fix any broken examples
|
|
188
|
+
|
|
189
|
+
#### Step 3: Generate Props Docs (Enhancement)
|
|
190
|
+
Auto-generate prop documentation from types, merge with manual overrides
|
|
191
|
+
|
|
192
|
+
#### Step 4: Add Type Export Tool (New Feature)
|
|
193
|
+
Add new MCP tool for direct type access
|
|
194
|
+
|
|
195
|
+
### File Structure
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
packages/mcp-server/
|
|
199
|
+
├── scripts/
|
|
200
|
+
│ ├── extract-types.ts # Main extraction script
|
|
201
|
+
│ ├── validate-examples.ts # Example validation
|
|
202
|
+
│ └── type-extractor.ts # Shared utilities
|
|
203
|
+
├── src/
|
|
204
|
+
│ ├── generated/
|
|
205
|
+
│ │ ├── types.json # Auto-generated type schemas
|
|
206
|
+
│ │ └── types.d.ts # TypeScript definitions
|
|
207
|
+
│ ├── data/
|
|
208
|
+
│ │ └── components/
|
|
209
|
+
│ │ ├── Button.ts # Now references types.json
|
|
210
|
+
│ │ └── ...
|
|
211
|
+
│ ├── tools/
|
|
212
|
+
│ │ ├── get-types.ts # New type export tool
|
|
213
|
+
│ │ └── ...
|
|
214
|
+
│ └── index.ts
|
|
215
|
+
├── tests/
|
|
216
|
+
│ ├── type-accuracy.test.ts # Validation tests
|
|
217
|
+
│ └── example-validation.test.ts
|
|
218
|
+
└── package.json # Add build scripts
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Required Dependencies
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"devDependencies": {
|
|
226
|
+
"typescript": "^5.0.0",
|
|
227
|
+
"ts-morph": "^21.0.0", // TypeScript Compiler API wrapper
|
|
228
|
+
"@types/node": "^20.0.0"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Build Process
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"scripts": {
|
|
238
|
+
"extract-types": "tsx scripts/extract-types.ts",
|
|
239
|
+
"validate-examples": "tsx scripts/validate-examples.ts",
|
|
240
|
+
"prebuild": "yarn extract-types && yarn validate-examples",
|
|
241
|
+
"build": "tsc && chmod +x dist/index.js"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### CI/CD Integration
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
# .github/workflows/validate-mcp.yml
|
|
250
|
+
name: Validate MCP Documentation
|
|
251
|
+
|
|
252
|
+
on: [push, pull_request]
|
|
253
|
+
|
|
254
|
+
jobs:
|
|
255
|
+
validate:
|
|
256
|
+
runs-on: ubuntu-latest
|
|
257
|
+
steps:
|
|
258
|
+
- uses: actions/checkout@v3
|
|
259
|
+
- name: Install dependencies
|
|
260
|
+
run: yarn install
|
|
261
|
+
- name: Extract types
|
|
262
|
+
run: yarn extract-types
|
|
263
|
+
- name: Validate examples
|
|
264
|
+
run: yarn validate-examples
|
|
265
|
+
- name: Build
|
|
266
|
+
run: yarn build
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Benefits
|
|
270
|
+
|
|
271
|
+
### Accuracy
|
|
272
|
+
✅ Types are always correct (single source of truth)
|
|
273
|
+
✅ Examples are validated at build time
|
|
274
|
+
✅ No manual synchronization needed
|
|
275
|
+
|
|
276
|
+
### Developer Experience
|
|
277
|
+
✅ AI assistants can access raw TypeScript types
|
|
278
|
+
✅ Documentation is always up-to-date
|
|
279
|
+
✅ Type-correct code generation
|
|
280
|
+
|
|
281
|
+
### Maintenance
|
|
282
|
+
✅ Reduced manual work
|
|
283
|
+
✅ Automated validation prevents drift
|
|
284
|
+
✅ Clear error messages when examples break
|
|
285
|
+
|
|
286
|
+
### Scalability
|
|
287
|
+
✅ Adding new components is easier
|
|
288
|
+
✅ Type changes propagate automatically
|
|
289
|
+
✅ Multi-package support (components, navigation, theme)
|
|
290
|
+
|
|
291
|
+
## Next Steps
|
|
292
|
+
|
|
293
|
+
1. **Immediate**: Fix current documentation issues manually
|
|
294
|
+
2. **Short-term**: Implement type extraction system (Phase 1)
|
|
295
|
+
3. **Medium-term**: Add validation and type export tool (Phases 2-3)
|
|
296
|
+
4. **Long-term**: Full migration to auto-generated docs (Phase 4)
|
|
297
|
+
|
|
298
|
+
## Questions & Considerations
|
|
299
|
+
|
|
300
|
+
### Q: What about documentation that isn't in types?
|
|
301
|
+
A: Keep manual content for features, best practices, and examples. Auto-generate only the prop definitions.
|
|
302
|
+
|
|
303
|
+
### Q: How do we handle custom types that aren't exported?
|
|
304
|
+
A: Type extractor can be configured to follow type references and extract related types.
|
|
305
|
+
|
|
306
|
+
### Q: What about web vs native differences?
|
|
307
|
+
A: Extract from both `.web.tsx` and `.native.tsx` type files, mark platform-specific props.
|
|
308
|
+
|
|
309
|
+
### Q: Performance impact of type extraction?
|
|
310
|
+
A: Runs at build time only, not at runtime. No performance impact on MCP server.
|
|
311
|
+
|
|
312
|
+
### Q: What if TypeScript types are too complex to display?
|
|
313
|
+
A: Provide both raw TypeScript (for AI/tools) and simplified JSON schema (for humans).
|