@onemrvapublic/design-system-mcp-server 2.0.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +420 -0
- package/dist/component-parser.d.ts +79 -0
- package/dist/component-parser.js +646 -0
- package/dist/component-parser.js.map +1 -0
- package/dist/component-scanner.d.ts +81 -0
- package/dist/component-scanner.js +444 -0
- package/dist/component-scanner.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +999 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-shared.d.ts +141 -0
- package/dist/mcp-shared.js +519 -0
- package/dist/mcp-shared.js.map +1 -0
- package/dist/metrics.d.ts +64 -0
- package/dist/metrics.js +271 -0
- package/dist/metrics.js.map +1 -0
- package/dist/migration-rules.d.ts +29 -0
- package/dist/migration-rules.js +862 -0
- package/dist/migration-rules.js.map +1 -0
- package/dist/tool-components.d.ts +23 -0
- package/dist/tool-components.js +816 -0
- package/dist/tool-components.js.map +1 -0
- package/dist/tool-design.d.ts +41 -0
- package/dist/tool-design.js +618 -0
- package/dist/tool-design.js.map +1 -0
- package/dist/tool-migration.d.ts +5 -0
- package/dist/tool-migration.js +976 -0
- package/dist/tool-migration.js.map +1 -0
- package/dist/tool-registry.d.ts +3 -0
- package/dist/tool-registry.js +458 -0
- package/dist/tool-registry.js.map +1 -0
- package/dist/tools.d.ts +13 -0
- package/dist/tools.js +349 -0
- package/dist/tools.js.map +1 -0
- package/mcp-data/codebase.json +4809 -0
- package/mcp-data/components.json +129424 -0
- package/mcp-data/icons.json +470 -0
- package/mcp-data/icons_sorted.txt +2 -0
- package/mcp-data/mapping.json +309 -0
- package/mcp-data/styles.json +331 -0
- package/mcp-data/sync-status.json +83 -0
- package/mcp-data/tokens.json +1586 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
# Design System MCP Server
|
|
2
|
+
|
|
3
|
+
MCP server for the ONEM/RVA Design System. It supports local IDE integrations over stdio and hosted deployments over HTTP, and can run from live source or synced `mcp-data` JSON.
|
|
4
|
+
|
|
5
|
+
## MCP concept (quick overview)
|
|
6
|
+
|
|
7
|
+
MCP stands for Model Context Protocol. It is a standard way for an AI client (for example Copilot in an IDE) to call external capabilities safely.
|
|
8
|
+
|
|
9
|
+
At a high level:
|
|
10
|
+
|
|
11
|
+
1. The AI client connects to an MCP server.
|
|
12
|
+
2. The server exposes typed tools (name, description, JSON schema input).
|
|
13
|
+
3. The AI chooses a tool and sends arguments.
|
|
14
|
+
4. The server executes logic and returns structured output.
|
|
15
|
+
|
|
16
|
+
In this project, the MCP server is the bridge between AI and ONEM/RVA design-system knowledge (Angular APIs, synced Figma metadata, theme utilities, migration helpers).
|
|
17
|
+
|
|
18
|
+
## What this server does
|
|
19
|
+
|
|
20
|
+
- Lists Angular design-system components
|
|
21
|
+
- Shows APIs (inputs, outputs, methods, slots, host listeners)
|
|
22
|
+
- Generates usage examples
|
|
23
|
+
- Provides accessibility notes
|
|
24
|
+
- Exposes synced Figma data (components, tokens, styles, icons) when available
|
|
25
|
+
- Helps migration from legacy Material/custom patterns to DS components
|
|
26
|
+
|
|
27
|
+
## How this MCP server works
|
|
28
|
+
|
|
29
|
+
Runtime flow:
|
|
30
|
+
|
|
31
|
+
1. `src/index.ts` starts stdio, HTTP, or both transports.
|
|
32
|
+
2. The server selects a data mode (`auto`, `mcp-data`, or `live`).
|
|
33
|
+
3. Tool metadata is registered through `getTools()`.
|
|
34
|
+
4. Incoming MCP calls are routed to `handleToolCall()` in `src/tools.ts`.
|
|
35
|
+
5. Tool handlers read from live scanner data and/or synced JSON under `mcp-data`.
|
|
36
|
+
6. Results are returned as MCP tool responses for the AI to use in follow-up reasoning.
|
|
37
|
+
|
|
38
|
+
For migration workflows, the typical loop is:
|
|
39
|
+
|
|
40
|
+
1. Run `analyze_repo_migration` on a target repo.
|
|
41
|
+
2. Review migration findings and DS usage issues.
|
|
42
|
+
3. Use the generated Copilot fix-pack prompts file by file.
|
|
43
|
+
4. Re-run `analyze_repo_migration` until findings reach zero.
|
|
44
|
+
|
|
45
|
+
This is the core mechanism that lets Copilot move from diagnosis to concrete remediation.
|
|
46
|
+
|
|
47
|
+
## Local demo mode (use this now)
|
|
48
|
+
|
|
49
|
+
For a local demonstration, run only stdio transport and skip hosted HTTP setup.
|
|
50
|
+
|
|
51
|
+
1. Build and verify locally:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cd tools/mcp-server
|
|
55
|
+
npm install
|
|
56
|
+
npm run build
|
|
57
|
+
npm run test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
2. In your MCP client config, use stdio with either:
|
|
61
|
+
|
|
62
|
+
- published package via `npx -y @onemrvapublic/design-system-mcp-server`
|
|
63
|
+
- local build path via `node .../tools/mcp-server/dist/index.js --transport=stdio`
|
|
64
|
+
|
|
65
|
+
3. If you want fresh synced data before the demo, run from repo root:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm run sync:mcp
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
4. During the demo, do not run `start:http` and do not set `MCP_TRANSPORT=http`.
|
|
72
|
+
|
|
73
|
+
5. Optional: use the inspector for a direct local walkthrough:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
cd tools/mcp-server
|
|
77
|
+
npm run inspector
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Hosting can be enabled later by following the hosted sections in this file.
|
|
81
|
+
|
|
82
|
+
## Fast IDE setup (recommended)
|
|
83
|
+
|
|
84
|
+
If you just want this working quickly, run one command from the repository root:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm run mcp:setup
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This command builds the MCP server, detects your IDE, and writes the MCP config automatically.
|
|
91
|
+
It supports both VS Code and JetBrains IDEs.
|
|
92
|
+
|
|
93
|
+
If you are actively developing design-system components and want automatic detection, use the dev profile:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npm run mcp:setup:dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The dev profile config starts MCP with `--data-source=live --watch`.
|
|
100
|
+
|
|
101
|
+
If you want one command that both configures and starts live watch mode:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm run mcp:dev
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
If you want to force one target, run the setup script directly from the MCP
|
|
108
|
+
server package (there is no root `mcp:setup:vscode`/`mcp:setup:jetbrains` alias):
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm --prefix tools/mcp-server run setup:vscode
|
|
112
|
+
npm --prefix tools/mcp-server run setup:jetbrains
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
After running setup, restart your IDE (or reload the VS Code window).
|
|
116
|
+
|
|
117
|
+
## Best practices for invoking MCP from AI chat
|
|
118
|
+
|
|
119
|
+
The MCP server works best when prompts are explicit about scope, desired outcome, and safety constraints.
|
|
120
|
+
|
|
121
|
+
Use this structure for reliable results:
|
|
122
|
+
|
|
123
|
+
1. Target: file, folder, or component name.
|
|
124
|
+
2. Task: analyze, migrate, fix, or explain.
|
|
125
|
+
3. Constraints: what must not change (behavior, public API, styling, etc.).
|
|
126
|
+
4. Validation: run tests/lint/build and summarize diff.
|
|
127
|
+
|
|
128
|
+
Prompt template:
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Use the design-system MCP server on <target>.
|
|
132
|
+
Task: <analyze|migrate|fix|explain>.
|
|
133
|
+
Constraints: <keep behavior|no public API changes|minimal diff>.
|
|
134
|
+
Validation: <run tests/build/lint if available>.
|
|
135
|
+
Output: <apply patch + summary of what changed and why>.
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Recommended prompts developers can copy:
|
|
139
|
+
|
|
140
|
+
```text
|
|
141
|
+
Use the design-system MCP server to audit this component and fix invalid DS inputs/outputs/imports. Keep behavior unchanged and apply the patch.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
Run migration analysis on this folder, fix only high-confidence findings first, and re-run analysis until no high-confidence issues remain.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
Migrate Angular Material usage in this template to DS equivalents where safe, and leave TODO notes for risky cases.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
Validate this component against DS accessibility guidance and patch missing aria labels/roles/focus handling without changing UI behavior.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
Explain which MCP tools you used, what each found, and show the final diff summary.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Tips:
|
|
161
|
+
|
|
162
|
+
- Ask for "high-confidence fixes first" to reduce regressions.
|
|
163
|
+
- Ask for "minimal diff" for easier reviews.
|
|
164
|
+
- Ask for "show skipped/risky items" so manual follow-up is clear.
|
|
165
|
+
- Provide concrete targets (exact file paths) instead of broad repo-wide requests when starting.
|
|
166
|
+
|
|
167
|
+
## Manual setup (if you want full control)
|
|
168
|
+
|
|
169
|
+
### VS Code
|
|
170
|
+
|
|
171
|
+
1. Press `F1` and run `MCP: Open User Configuration`.
|
|
172
|
+
2. Add:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"servers": {
|
|
177
|
+
"design-system-mcp": {
|
|
178
|
+
"type": "stdio",
|
|
179
|
+
"command": "npx",
|
|
180
|
+
"args": ["-y", "@onemrvapublic/design-system-mcp-server"]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
3. Reload VS Code (`F1` -> `Developer: Reload Window`).
|
|
187
|
+
|
|
188
|
+
### Claude Desktop
|
|
189
|
+
|
|
190
|
+
Edit your config file:
|
|
191
|
+
|
|
192
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
193
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
194
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"mcpServers": {
|
|
199
|
+
"design-system-mcp": {
|
|
200
|
+
"command": "npx",
|
|
201
|
+
"args": ["-y", "@onemrvapublic/design-system-mcp-server"]
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### JetBrains
|
|
208
|
+
|
|
209
|
+
In Settings -> Tools -> AI Assistant -> Model Context Protocol (MCP), add:
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"name": "design-system-mcp",
|
|
214
|
+
"command": "npx",
|
|
215
|
+
"args": ["-y", "@onemrvapublic/design-system-mcp-server"]
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Runtime modes
|
|
220
|
+
|
|
221
|
+
- `stdio` (default): local IDE clients
|
|
222
|
+
- `http`: hosted MCP endpoint
|
|
223
|
+
- `both`: stdio + HTTP in one process
|
|
224
|
+
|
|
225
|
+
Examples (the `start:*` scripts live in the MCP server package, so run them from
|
|
226
|
+
`tools/mcp-server` or with `--prefix`):
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npx -y @onemrvapublic/design-system-mcp-server --transport=stdio
|
|
230
|
+
npm --prefix tools/mcp-server run start:http
|
|
231
|
+
npm --prefix tools/mcp-server run start:both
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Data source behavior
|
|
235
|
+
|
|
236
|
+
By default, the server uses synced `mcp-data/codebase.json` as the source of truth when it is available. This keeps answers consistent even when the MCP server is used from other repositories.
|
|
237
|
+
|
|
238
|
+
You can control this with `MCP_DATA_SOURCE`:
|
|
239
|
+
|
|
240
|
+
- `auto` (default): use synced `mcp-data` when available, otherwise use live scan
|
|
241
|
+
- `mcp-data`: force synced data only (fails fast if `codebase.json` is missing)
|
|
242
|
+
- `live`: force live scan from `DESIGN_SYSTEM_PATH`
|
|
243
|
+
|
|
244
|
+
Example:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
MCP_DATA_SOURCE=mcp-data node dist/index.js --transport=stdio
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
In synced-data mode, `rescan_components` is intentionally disabled.
|
|
251
|
+
|
|
252
|
+
For Design System developers who want automatic detection while editing components, use live watch mode:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
npm run mcp:start:live:watch
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Run this command from the repository root. It watches design-system source folders and triggers automatic rescan on file changes, so developers do not need to run `sync:mcp` after each edit.
|
|
259
|
+
|
|
260
|
+
## Hosted mode hardening (current defaults)
|
|
261
|
+
|
|
262
|
+
- HTTP startup fails closed unless `MCP_API_KEY` is set, or `MCP_ALLOW_UNAUTHENTICATED_HTTP=true` is explicitly set for trusted local networks.
|
|
263
|
+
- `GET /health` is protected by API key checks in hosted mode.
|
|
264
|
+
- Rate limiting and HTTP session caps are enabled.
|
|
265
|
+
- Legacy SSE routes are disabled by default and only enabled with `MCP_ENABLE_LEGACY_SSE=true`.
|
|
266
|
+
|
|
267
|
+
Environment variables:
|
|
268
|
+
|
|
269
|
+
- `MCP_API_KEY`
|
|
270
|
+
- `MCP_ALLOW_UNAUTHENTICATED_HTTP=true`
|
|
271
|
+
- `MCP_ENABLE_LEGACY_SSE=true`
|
|
272
|
+
- `MCP_MAX_HTTP_SESSIONS` (default `100`)
|
|
273
|
+
- `MCP_RATE_LIMIT_WINDOW_MS` (default `60000`)
|
|
274
|
+
- `MCP_RATE_LIMIT_MAX_REQUESTS` (default `300`)
|
|
275
|
+
- `MCP_TRANSPORT=stdio|http|both`
|
|
276
|
+
- `PORT` (default `3001`)
|
|
277
|
+
|
|
278
|
+
## Endpoints and what is exposed
|
|
279
|
+
|
|
280
|
+
When HTTP transport is enabled:
|
|
281
|
+
|
|
282
|
+
- `ALL /mcp` for Streamable HTTP MCP transport
|
|
283
|
+
- `GET /health` for runtime health
|
|
284
|
+
- `GET /sse` and `POST /messages` only if legacy SSE is explicitly enabled
|
|
285
|
+
|
|
286
|
+
Important: this server does not expose `README.md`, `SETUP.md`, or arbitrary files as MCP resources/endpoints. Documentation files stay in the repository only.
|
|
287
|
+
|
|
288
|
+
## Sync workflow (`sync:mcp`)
|
|
289
|
+
|
|
290
|
+
Run from the repository root:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
npm run sync:mcp
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
The sync pipeline runs codebase sync then Figma sync, and writes to `tools/mcp-server/mcp-data`.
|
|
297
|
+
|
|
298
|
+
`.env` loading is supported from:
|
|
299
|
+
|
|
300
|
+
- repository root `.env`
|
|
301
|
+
- `tools/mcp-server/.env`
|
|
302
|
+
|
|
303
|
+
Key env vars for Figma sync:
|
|
304
|
+
|
|
305
|
+
- `FIGMA_TOKEN` (required)
|
|
306
|
+
- `FIGMA_FILE_KEY` (optional, falls back to default)
|
|
307
|
+
- proxy vars such as `HTTPS_PROXY` if needed
|
|
308
|
+
|
|
309
|
+
Figma scopes:
|
|
310
|
+
|
|
311
|
+
- To read file/component/style content, the token needs file content read access.
|
|
312
|
+
- To read Variables (`tokens.json`), the token also needs Variables read access. If Variables access is missing, component/style sync can still succeed and Variables calls can return 403.
|
|
313
|
+
|
|
314
|
+
Figma sync exclusions live in `tools/mcp-server/mcp-data/mapping.json` under `figma_sync_exclusions`.
|
|
315
|
+
|
|
316
|
+
- `files` skips an entire Figma file key before the sync starts.
|
|
317
|
+
- `pages` skips named pages before page/node fetches happen.
|
|
318
|
+
- `components` skips named components before component/node fetches happen.
|
|
319
|
+
- `componentSets` skips named component sets before node fetches happen.
|
|
320
|
+
|
|
321
|
+
Page mapping still supports `figma_page_mapping` values of `_ignore` and `_docs`, which are treated as non-sync pages.
|
|
322
|
+
|
|
323
|
+
For token extraction, `figma_sync_options.tokenPages` limits the expensive deep page analysis to the pages that matter most. The default config keeps `Foundations` in that list, and `tokenPageHints` adds a name-based fallback for other token-heavy pages.
|
|
324
|
+
|
|
325
|
+
## Available MCP tools
|
|
326
|
+
|
|
327
|
+
The server registers 27 tools (see `getTools()` in `src/tool-registry.ts`).
|
|
328
|
+
|
|
329
|
+
Discovery:
|
|
330
|
+
|
|
331
|
+
- `help_friend`
|
|
332
|
+
|
|
333
|
+
Core design-system tools:
|
|
334
|
+
|
|
335
|
+
- `list_components`
|
|
336
|
+
- `get_component`
|
|
337
|
+
- `search_components`
|
|
338
|
+
- `generate_component_usage`
|
|
339
|
+
- `get_component_props`
|
|
340
|
+
- `get_accessibility_info`
|
|
341
|
+
- `list_jsonforms_renderers`
|
|
342
|
+
- `get_jsonforms_renderer`
|
|
343
|
+
- `list_theme_utilities`
|
|
344
|
+
- `get_theme_utility`
|
|
345
|
+
- `suggest_component`
|
|
346
|
+
- `audit_component`
|
|
347
|
+
- `compare_components`
|
|
348
|
+
- `get_color_palette`
|
|
349
|
+
|
|
350
|
+
Synced-data and Figma-aware tools:
|
|
351
|
+
|
|
352
|
+
- `list_icons`
|
|
353
|
+
- `get_sync_status`
|
|
354
|
+
- `list_figma_components`
|
|
355
|
+
- `get_figma_component`
|
|
356
|
+
- `list_design_tokens`
|
|
357
|
+
- `get_design_token`
|
|
358
|
+
- `explain_token_diff`
|
|
359
|
+
- `list_figma_styles`
|
|
360
|
+
|
|
361
|
+
Migration and remediation tools:
|
|
362
|
+
|
|
363
|
+
- `migrate_to_ds`
|
|
364
|
+
- `migrate_file`
|
|
365
|
+
- `analyze_repo_migration`
|
|
366
|
+
|
|
367
|
+
Admin tools:
|
|
368
|
+
|
|
369
|
+
- `rescan_components`
|
|
370
|
+
|
|
371
|
+
## Verify locally
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
cd tools/mcp-server
|
|
375
|
+
npm install
|
|
376
|
+
npm run build
|
|
377
|
+
npm run test
|
|
378
|
+
npm run inspector
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
For hosted mode smoke checks (still from `tools/mcp-server`):
|
|
382
|
+
|
|
383
|
+
1. Run `npm run start:http` without `MCP_API_KEY` and verify startup fails.
|
|
384
|
+
2. Set `MCP_API_KEY`, restart, and verify `GET /health` requires auth.
|
|
385
|
+
3. Verify `/mcp` calls succeed with valid API key.
|
|
386
|
+
|
|
387
|
+
## Architecture
|
|
388
|
+
|
|
389
|
+
- `src/index.ts`: transport bootstrap (stdio/http), auth guards, rate/session limits, health and rescan routes
|
|
390
|
+
- `src/tool-registry.ts`: `getTools()` tool metadata registry and `TOOL_NAMES`
|
|
391
|
+
- `src/component-scanner.ts`: component/jsonforms/theme scanning and rescan
|
|
392
|
+
- `src/component-parser.ts`: parser for decorators/JSDoc/API extraction
|
|
393
|
+
- `src/tools.ts`: MCP tool handlers and synced-data fallback logic
|
|
394
|
+
- `scripts/codebase-sync.ts`: codebase metadata sync
|
|
395
|
+
- `scripts/figma-sync.ts`: 3-pass Figma sync (components/layers/tokens+styles)
|
|
396
|
+
|
|
397
|
+
The server prefers live scan when source is mounted. If source is unavailable but `mcp-data` exists, it starts in synced-data-only mode.
|
|
398
|
+
|
|
399
|
+
## Known parser gaps
|
|
400
|
+
|
|
401
|
+
`src/component-parser.ts` is regex-based, not a full TypeScript AST. A few
|
|
402
|
+
component patterns are not extracted today. Authors relying on these fields
|
|
403
|
+
should be aware they can come back empty:
|
|
404
|
+
|
|
405
|
+
- Public methods declared without the `public` keyword (implicitly-public
|
|
406
|
+
methods are skipped; only `public`-prefixed methods populate `methods[]`).
|
|
407
|
+
- Query decorators that use a quoted template-reference selector, e.g.
|
|
408
|
+
`@ViewChild('ref')` / `@ViewChildren('items')` — these are not added to
|
|
409
|
+
`queryChildren[]` (type-selector queries like `@ViewChild(ChildComp)` and
|
|
410
|
+
`@ContentChild(...)` are extracted).
|
|
411
|
+
- Function-typed `@Input` types such as `(event: Event) => Promise<void>` are
|
|
412
|
+
not preserved as-is.
|
|
413
|
+
|
|
414
|
+
Related: `hasEffects` tracks Angular signal `effect()` calls, not lifecycle-hook
|
|
415
|
+
implementations (`OnInit`, `OnDestroy`, ...). These gaps are captured by the ten
|
|
416
|
+
skipped cases in `src/component-parser.comprehensive.test.ts`.
|
|
417
|
+
|
|
418
|
+
## Notes for component authors
|
|
419
|
+
|
|
420
|
+
The detailed component authoring guide (JSDoc tags, input/output docs, accessibility annotation examples) remains in `SETUP.md`.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export interface ParsedInput {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
deprecated?: string;
|
|
8
|
+
examples: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface ParsedOutput {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
deprecated?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ParsedMethod {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
params: {
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
}[];
|
|
23
|
+
returnType: string;
|
|
24
|
+
deprecated?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ParsedSlot {
|
|
27
|
+
name: string;
|
|
28
|
+
selector: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ParsedHostListener {
|
|
32
|
+
event: string;
|
|
33
|
+
methodName: string;
|
|
34
|
+
args: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface ParsedQueryChild {
|
|
37
|
+
name: string;
|
|
38
|
+
type: string;
|
|
39
|
+
queryType: 'ViewChild' | 'ContentChild' | 'ViewChildren' | 'ContentChildren';
|
|
40
|
+
required: boolean;
|
|
41
|
+
static: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface ParsedComponent {
|
|
44
|
+
selector: string;
|
|
45
|
+
description: string;
|
|
46
|
+
inputs: ParsedInput[];
|
|
47
|
+
outputs: ParsedOutput[];
|
|
48
|
+
methods: ParsedMethod[];
|
|
49
|
+
slots: ParsedSlot[];
|
|
50
|
+
hostListeners: ParsedHostListener[];
|
|
51
|
+
queryChildren: ParsedQueryChild[];
|
|
52
|
+
hasEffects: boolean;
|
|
53
|
+
standalone: boolean;
|
|
54
|
+
imports: string[];
|
|
55
|
+
accessibility: string[];
|
|
56
|
+
keywords: string[];
|
|
57
|
+
group: string;
|
|
58
|
+
themes: string[];
|
|
59
|
+
deprecated?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare class ComponentParser {
|
|
62
|
+
parse(content: string, filePath: string, htmlContent?: string): ParsedComponent | null;
|
|
63
|
+
private extractClassJSDoc;
|
|
64
|
+
private extractInputs;
|
|
65
|
+
private extractOutputs;
|
|
66
|
+
private extractNearbyPropertyJSDoc;
|
|
67
|
+
private buildInputFallbackDescription;
|
|
68
|
+
private buildOutputFallbackDescription;
|
|
69
|
+
private truncateForDescription;
|
|
70
|
+
private extractMethods;
|
|
71
|
+
private extractSlots;
|
|
72
|
+
private parsePropertyJSDoc;
|
|
73
|
+
private cleanType;
|
|
74
|
+
private inferTypeFromValue;
|
|
75
|
+
private extractHostListeners;
|
|
76
|
+
private extractQueryChildren;
|
|
77
|
+
private extractAccessibilityInfo;
|
|
78
|
+
private extractAriaFromHtml;
|
|
79
|
+
}
|