@cobwds/mcp-server 1.19.3 → 1.23.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.
Files changed (36) hide show
  1. package/README.md +6 -15
  2. package/data/cem/custom-elements.json +10084 -6696
  3. package/data/frameworks.json +14 -0
  4. package/data/guides/form-validation.md +1 -1
  5. package/data/guides/frameworks/angular.md +184 -26
  6. package/data/guides/frameworks/react-additions.md +69 -0
  7. package/data/guides/frameworks/react.md +209 -27
  8. package/data/guides/frameworks/vue.md +356 -0
  9. package/data/tokens/tokens.css +45 -56
  10. package/data/tokens/tokens.json +39 -78
  11. package/dist/index.js +0 -0
  12. package/dist/lib/cem-parser.d.ts +12 -0
  13. package/dist/lib/cem-parser.d.ts.map +1 -1
  14. package/dist/lib/framework-snippets.d.ts +36 -0
  15. package/dist/lib/framework-snippets.d.ts.map +1 -0
  16. package/dist/lib/framework-snippets.js +55 -0
  17. package/dist/lib/framework-usage.d.ts +20 -0
  18. package/dist/lib/framework-usage.d.ts.map +1 -0
  19. package/dist/lib/framework-usage.js +50 -0
  20. package/dist/lib/frameworks-data.d.ts +19 -0
  21. package/dist/lib/frameworks-data.d.ts.map +1 -0
  22. package/dist/lib/frameworks-data.js +40 -0
  23. package/dist/resources/frameworks.d.ts +15 -0
  24. package/dist/resources/frameworks.d.ts.map +1 -0
  25. package/dist/resources/frameworks.js +104 -0
  26. package/dist/resources/guides.d.ts.map +1 -1
  27. package/dist/resources/guides.js +12 -1
  28. package/dist/resources/index.d.ts.map +1 -1
  29. package/dist/resources/index.js +2 -0
  30. package/dist/tools/component-tools.d.ts.map +1 -1
  31. package/dist/tools/component-tools.js +20 -5
  32. package/dist/tools/guide-tools.js +1 -1
  33. package/dist/tools/utility-tools.d.ts +48 -0
  34. package/dist/tools/utility-tools.d.ts.map +1 -1
  35. package/dist/tools/utility-tools.js +236 -71
  36. package/package.json +6 -4
@@ -46,78 +46,75 @@
46
46
  "$value": "#ffffff"
47
47
  },
48
48
  "red": {
49
+ "$description": "Replacing the full color scale, mainly to update hue and saturation to meet our branding color (Freedom Trail Red) but still preserving the contrast between each step as much as possible.",
49
50
  "10": {
50
- "$value": "#fbf4f4"
51
+ "$value": "#fff3f2"
51
52
  },
52
53
  "50": {
53
- "$value": "#f7eaea"
54
+ "$value": "#fee8e6"
54
55
  },
55
56
  "100": {
56
- "$value": "#f0d5d5"
57
+ "$value": "#fed1ce"
57
58
  },
58
59
  "200": {
59
- "$value": "#e4b3b3"
60
+ "$value": "#fda9a4"
60
61
  },
61
62
  "300": {
62
- "$value": "#d89191"
63
+ "$value": "#fc7e76"
63
64
  },
64
65
  "400": {
65
- "$value": "#cc6f6f"
66
+ "$value": "{primitive.color.freedom-trail-red}"
66
67
  },
67
68
  "500": {
68
- "$value": "#c04d4d"
69
+ "$value": "#e51205"
69
70
  },
70
71
  "600": {
71
- "$value": "#b52c2c"
72
+ "$value": "#c20f04"
72
73
  },
73
74
  "700": {
74
- "$value": "#932424"
75
+ "$value": "#9e0d03"
75
76
  },
76
77
  "800": {
77
- "$value": "#721c1c"
78
+ "$value": "#7c0a03"
78
79
  },
79
80
  "900": {
80
- "$value": "#511414"
81
+ "$value": "#590702"
81
82
  }
82
83
  },
83
84
  "blue": {
84
- "$description": "City of Boston blue scale. Evenly interpolated from blue.10 to Optimistic Blue (700); 800 is midpoint to Charles Blue (900).",
85
+ "$description": "Replacing the full color scale, mainly to update hue and saturation to meet our branding colors (Optimistic Blue and Charles Blue) but still preserving the contrast between each step as much as possible.",
85
86
  "10": {
86
- "$value": "#e8f4fc",
87
- "$description": "Lightest blue tint. Kept as brand light blue anchor."
87
+ "$value": "#f0f7fd"
88
88
  },
89
89
  "50": {
90
- "$value": "#cee4f4"
90
+ "$value": "#e3f0fb"
91
91
  },
92
92
  "100": {
93
- "$value": "#b4d3ec"
93
+ "$value": "#c7e1f8"
94
94
  },
95
95
  "200": {
96
- "$value": "#9ac3e4"
96
+ "$value": "#93c5f1"
97
97
  },
98
98
  "300": {
99
- "$value": "#80b2dc"
99
+ "$value": "#5fa9ea"
100
100
  },
101
101
  "400": {
102
- "$value": "#66a2d5"
102
+ "$value": "#268be3"
103
103
  },
104
104
  "500": {
105
- "$value": "#4c92cd"
105
+ "$value": "{primitive.color.optimistic-blue}"
106
106
  },
107
107
  "600": {
108
- "$value": "#3281c5"
108
+ "$value": "#145b99"
109
109
  },
110
110
  "700": {
111
- "$value": "{primitive.color.optimistic-blue}",
112
- "$description": "Primary brand blue step. Resolves to Optimistic Blue."
111
+ "$value": "#0f4575"
113
112
  },
114
113
  "800": {
115
- "$value": "#104876",
116
- "$description": "Midpoint between Optimistic Blue (700) and Charles Blue (900). USE for theme.strong."
114
+ "$value": "#0b3051"
117
115
  },
118
116
  "900": {
119
- "$value": "{primitive.color.charles-blue}",
120
- "$description": "Darkest brand blue step. Resolves to Charles Blue."
117
+ "$value": "{primitive.color.charles-blue}"
121
118
  }
122
119
  },
123
120
  "green": {
@@ -190,42 +187,6 @@
190
187
  "$value": "#463a00"
191
188
  }
192
189
  },
193
- "state-blue": {
194
- "10": {
195
- "$value": "#f7fafd"
196
- },
197
- "50": {
198
- "$value": "#eff6fb"
199
- },
200
- "100": {
201
- "$value": "#cddde9"
202
- },
203
- "200": {
204
- "$value": "#abc4d8"
205
- },
206
- "300": {
207
- "$value": "#89abc7"
208
- },
209
- "400": {
210
- "$value": "#6792b6"
211
- },
212
- "500": {
213
- "$value": "#457aa5"
214
- },
215
- "600": {
216
- "$value": "#2d618c"
217
- },
218
- "700": {
219
- "$value": "#154973"
220
- },
221
- "800": {
222
- "$value": "#0e324f"
223
- },
224
- "900": {
225
- "$value": "#081b2b"
226
- },
227
- "$description": "Default theme palette"
228
- },
229
190
  "business-teal": {
230
191
  "10": {
231
192
  "$value": "#f2f6f6"
@@ -261,7 +222,7 @@
261
222
  "$value": "#02272c"
262
223
  }
263
224
  },
264
- "health-purple": {
225
+ "purple": {
265
226
  "10": {
266
227
  "$value": "#f4f4f8"
267
228
  },
@@ -564,7 +525,7 @@
564
525
  "admin": "{primitive.color.admin-orange.10}",
565
526
  "business": "{primitive.color.business-teal.10}",
566
527
  "environment": "{primitive.color.environment-green.10}",
567
- "health": "{primitive.color.health-purple.10}",
528
+ "health": "{primitive.color.purple.10}",
568
529
  "local": "{primitive.color.local-brown.10}",
569
530
  "safety": "{primitive.color.safety-gray.10}",
570
531
  "transportation": "{primitive.color.transportation-blue.10}"
@@ -579,7 +540,7 @@
579
540
  "admin": "{primitive.color.admin-orange.50}",
580
541
  "business": "{primitive.color.business-teal.50}",
581
542
  "environment": "{primitive.color.environment-green.50}",
582
- "health": "{primitive.color.health-purple.50}",
543
+ "health": "{primitive.color.purple.50}",
583
544
  "local": "{primitive.color.local-brown.50}",
584
545
  "safety": "{primitive.color.safety-gray.50}",
585
546
  "transportation": "{primitive.color.transportation-blue.50}"
@@ -594,7 +555,7 @@
594
555
  "admin": "{primitive.color.admin-orange.100}",
595
556
  "business": "{primitive.color.business-teal.100}",
596
557
  "environment": "{primitive.color.environment-green.100}",
597
- "health": "{primitive.color.health-purple.100}",
558
+ "health": "{primitive.color.purple.100}",
598
559
  "local": "{primitive.color.local-brown.100}",
599
560
  "safety": "{primitive.color.safety-gray.100}",
600
561
  "transportation": "{primitive.color.transportation-blue.100}"
@@ -603,13 +564,13 @@
603
564
  "$description": "Light theme tint. USE for borders and light accent backgrounds."
604
565
  },
605
566
  "mid": {
606
- "$value": "{primitive.color.blue.500}",
567
+ "$value": "{primitive.color.blue.200}",
607
568
  "$extensions": {
608
569
  "mode": {
609
570
  "admin": "{primitive.color.admin-orange.500}",
610
571
  "business": "{primitive.color.business-teal.500}",
611
572
  "environment": "{primitive.color.environment-green.500}",
612
- "health": "{primitive.color.health-purple.500}",
573
+ "health": "{primitive.color.purple.500}",
613
574
  "local": "{primitive.color.local-brown.500}",
614
575
  "safety": "{primitive.color.safety-gray.500}",
615
576
  "transportation": "{primitive.color.transportation-blue.500}"
@@ -618,13 +579,13 @@
618
579
  "$description": "Mid-range theme color. USE for secondary buttons and active states."
619
580
  },
620
581
  "default": {
621
- "$value": "{primitive.color.optimistic-blue}",
582
+ "$value": "{primitive.color.blue.500}",
622
583
  "$extensions": {
623
584
  "mode": {
624
585
  "admin": "{primitive.color.admin-orange.700}",
625
586
  "business": "{primitive.color.business-teal.700}",
626
587
  "environment": "{primitive.color.environment-green.700}",
627
- "health": "{primitive.color.health-purple.700}",
588
+ "health": "{primitive.color.purple.700}",
628
589
  "local": "{primitive.color.local-brown.700}",
629
590
  "safety": "{primitive.color.safety-gray.700}",
630
591
  "transportation": "{primitive.color.transportation-blue.700}"
@@ -639,7 +600,7 @@
639
600
  "admin": "{primitive.color.admin-orange.800}",
640
601
  "business": "{primitive.color.business-teal.800}",
641
602
  "environment": "{primitive.color.environment-green.800}",
642
- "health": "{primitive.color.health-purple.800}",
603
+ "health": "{primitive.color.purple.800}",
643
604
  "local": "{primitive.color.local-brown.800}",
644
605
  "safety": "{primitive.color.safety-gray.800}",
645
606
  "transportation": "{primitive.color.transportation-blue.800}"
@@ -648,13 +609,13 @@
648
609
  "$description": "Dark theme variant. USE for hover states on primary elements."
649
610
  },
650
611
  "stronger": {
651
- "$value": "{primitive.color.charles-blue}",
612
+ "$value": "{primitive.color.blue.900}",
652
613
  "$extensions": {
653
614
  "mode": {
654
615
  "admin": "{primitive.color.admin-orange.900}",
655
616
  "business": "{primitive.color.business-teal.900}",
656
617
  "environment": "{primitive.color.environment-green.900}",
657
- "health": "{primitive.color.health-purple.900}",
618
+ "health": "{primitive.color.purple.900}",
658
619
  "local": "{primitive.color.local-brown.900}",
659
620
  "safety": "{primitive.color.safety-gray.900}",
660
621
  "transportation": "{primitive.color.transportation-blue.900}"
@@ -669,7 +630,7 @@
669
630
  "color": {
670
631
  "$type": "color",
671
632
  "accent": {
672
- "$value": "{primitive.color.freedom-trail-red}",
633
+ "$value": "{primitive.color.red.400}",
673
634
  "$description": "Accent color for highlights and emphasis (Freedom Trail Red). USE sparingly for visual interest."
674
635
  },
675
636
  "base": {
@@ -810,8 +771,8 @@
810
771
  "$description": "Active link state. USE for :active state on links."
811
772
  },
812
773
  "neutral": {
813
- "$value": "{primitive.color.neutral.900}",
814
- "$description": "Neutral link style. USE when link styling should match body text color."
774
+ "$value": "{primitive.color.blue.900}",
775
+ "$description": "Neutral link style. USE when a link should use the darkest brand blue rather than body text."
815
776
  },
816
777
  "reverse": {
817
778
  "$value": "{primitive.color.neutral.300}",
@@ -1550,4 +1511,4 @@
1550
1511
  }
1551
1512
  }
1552
1513
  }
1553
- }
1514
+ }
package/dist/index.js CHANGED
File without changes
@@ -48,6 +48,17 @@ export interface CEMExample {
48
48
  code: string;
49
49
  lang?: string;
50
50
  }
51
+ /**
52
+ * `@formControl <kind> <changeEvent> [inputEvent]` metadata, written by WS1
53
+ * on every form-control component's class JSDoc and parsed into the
54
+ * manifest by the CEM plugin. Drives the Angular `ControlValueAccessor`
55
+ * base class choice and the React/Angular snippet transformer's forms mode.
56
+ */
57
+ export interface CEMFormControl {
58
+ kind: "value" | "checked" | "files";
59
+ changeEvent: string;
60
+ inputEvent?: string;
61
+ }
51
62
  export interface CEMDeclaration {
52
63
  kind: "class";
53
64
  name: string;
@@ -65,6 +76,7 @@ export interface CEMDeclaration {
65
76
  package?: string;
66
77
  };
67
78
  examples?: CEMExample[];
79
+ formControl?: CEMFormControl;
68
80
  }
69
81
  export interface CEMModule {
70
82
  kind: "javascript-module";
@@ -1 +1 @@
1
- {"version":3,"file":"cem-parser.d.ts","sourceRoot":"","sources":["../../src/lib/cem-parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACp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AG,SAAS,CAOxE;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,IAAI,CAIjC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Framework snippet generation
3
+ *
4
+ * Turns a component's canonical HTML examples into React and Angular
5
+ * snippets using `@cobwds/codegen`'s `transformExample` — the same
6
+ * transformer the docs site and Storybook autodocs use, so an AI assistant
7
+ * asking the MCP server sees exactly the same code a developer sees on
8
+ * designsystem.ny.gov.
9
+ */
10
+ import { type CEMExample, type CEMFormControl } from "./cem-parser.js";
11
+ export type FrameworkFilter = "html" | "react" | "angular";
12
+ export interface FrameworkSnippet {
13
+ code: string;
14
+ imports: string[];
15
+ warnings: string[];
16
+ unsupported: boolean;
17
+ }
18
+ export interface ExampleWithSnippets {
19
+ title: string;
20
+ html: string;
21
+ react: FrameworkSnippet;
22
+ angular: FrameworkSnippet;
23
+ }
24
+ /**
25
+ * Builds React and Angular snippets for every HTML example on a component.
26
+ *
27
+ * When `framework` names one target explicitly, that framework's snippet
28
+ * uses its most idiomatic forms binding for a form-control component —
29
+ * React's controlled pattern (`value` + `onCob*`), Angular's
30
+ * `formControlName` (Reactive Forms). The unrequested framework, and every
31
+ * snippet when `framework` is `"html"` (the default), stays a plain
32
+ * attribute-for-attribute conversion so the default response isn't
33
+ * surprising.
34
+ */
35
+ export declare function buildExampleSnippets(examples: CEMExample[] | undefined, framework: FrameworkFilter, formControl: CEMFormControl | undefined): ExampleWithSnippets[];
36
+ //# sourceMappingURL=framework-snippets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-snippets.d.ts","sourceRoot":"","sources":["../../src/lib/framework-snippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,EAAU,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,gBAAgB,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAgBD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,UAAU,EAAE,GAAG,SAAS,EAClC,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,mBAAmB,EAAE,CA+BvB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Framework snippet generation
3
+ *
4
+ * Turns a component's canonical HTML examples into React and Angular
5
+ * snippets using `@cobwds/codegen`'s `transformExample` — the same
6
+ * transformer the docs site and Storybook autodocs use, so an AI assistant
7
+ * asking the MCP server sees exactly the same code a developer sees on
8
+ * designsystem.ny.gov.
9
+ */
10
+ import { transformExample, } from "@cobwds/codegen";
11
+ import { getCEM } from "./cem-parser.js";
12
+ function toSnippet(result) {
13
+ return {
14
+ code: result.code,
15
+ imports: result.imports,
16
+ warnings: result.warnings,
17
+ unsupported: result.unsupported,
18
+ };
19
+ }
20
+ /**
21
+ * Builds React and Angular snippets for every HTML example on a component.
22
+ *
23
+ * When `framework` names one target explicitly, that framework's snippet
24
+ * uses its most idiomatic forms binding for a form-control component —
25
+ * React's controlled pattern (`value` + `onCob*`), Angular's
26
+ * `formControlName` (Reactive Forms). The unrequested framework, and every
27
+ * snippet when `framework` is `"html"` (the default), stays a plain
28
+ * attribute-for-attribute conversion so the default response isn't
29
+ * surprising.
30
+ */
31
+ export function buildExampleSnippets(examples, framework, formControl) {
32
+ if (!examples || examples.length === 0)
33
+ return [];
34
+ const manifest = getCEM();
35
+ const reactFormsMode = framework === "react" && formControl ? "template" : "none";
36
+ const angularFormsMode = framework === "angular" && formControl ? "reactive" : "none";
37
+ return examples
38
+ .filter((example) => !example.lang || example.lang === "html")
39
+ .map((example) => ({
40
+ title: example.title,
41
+ html: example.code,
42
+ react: toSnippet(transformExample({
43
+ html: example.code,
44
+ framework: "react",
45
+ manifest,
46
+ formsMode: reactFormsMode,
47
+ })),
48
+ angular: toSnippet(transformExample({
49
+ html: example.code,
50
+ framework: "angular",
51
+ manifest,
52
+ formsMode: angularFormsMode,
53
+ })),
54
+ }));
55
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Framework usage notes
3
+ *
4
+ * Short, framework-specific guidance attached to `get_component` responses
5
+ * when the caller asks for `framework: "react"` or `"angular"` — the import
6
+ * line, the event-prop naming rule, and (when the component is a form
7
+ * control) how it binds into that framework's forms. Naming follows the
8
+ * rules in `.claude/plans/framework-support/README.md` section 4.1, reused
9
+ * here via `@cobwds/codegen` rather than re-derived.
10
+ */
11
+ import type { CEMFormControl } from "./cem-parser.js";
12
+ export interface FrameworkUsageNotes {
13
+ package: string;
14
+ import: string;
15
+ events: string;
16
+ forms?: string;
17
+ }
18
+ export declare function buildReactUsageNotes(tagName: string, className: string, formControl: CEMFormControl | undefined): FrameworkUsageNotes;
19
+ export declare function buildAngularUsageNotes(tagName: string, className: string, formControl: CEMFormControl | undefined): FrameworkUsageNotes;
20
+ //# sourceMappingURL=framework-usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-usage.d.ts","sourceRoot":"","sources":["../../src/lib/framework-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,mBAAmB,CAqBrB;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,mBAAmB,CAmBrB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Framework usage notes
3
+ *
4
+ * Short, framework-specific guidance attached to `get_component` responses
5
+ * when the caller asks for `framework: "react"` or `"angular"` — the import
6
+ * line, the event-prop naming rule, and (when the component is a form
7
+ * control) how it binds into that framework's forms. Naming follows the
8
+ * rules in `.claude/plans/framework-support/README.md` section 4.1, reused
9
+ * here via `@cobwds/codegen` rather than re-derived.
10
+ */
11
+ import { eventToAngularOutput, eventToReactProp, tagToSubpath, } from "@cobwds/codegen";
12
+ const FORM_CONTROL_LABEL = {
13
+ value: "value",
14
+ checked: "checked state",
15
+ files: "selected files",
16
+ };
17
+ export function buildReactUsageNotes(tagName, className, formControl) {
18
+ const subpath = tagToSubpath(tagName);
19
+ const changeProp = formControl
20
+ ? eventToReactProp(formControl.changeEvent)
21
+ : undefined;
22
+ const inputProp = formControl?.inputEvent !== undefined
23
+ ? eventToReactProp(formControl.inputEvent)
24
+ : undefined;
25
+ return {
26
+ package: "@cobwds/react",
27
+ import: `import { ${className} } from "@cobwds/react/${subpath}";`,
28
+ events: "Events map to onCob* props (cob-change -> onCobChange). The handler receives the typed CustomEvent, so e.detail autocompletes.",
29
+ forms: formControl
30
+ ? `Form control (${formControl.kind}). For a controlled component, bind ${formControl.kind} and update state from ${changeProp}${inputProp ? ` (or ${inputProp} for every keystroke)` : ""}; re-rendering with the same ${FORM_CONTROL_LABEL[formControl.kind]} snaps the element back to your state. See get_guide({ topic: "installation", framework: "react" }) for React Hook Form and uncontrolled-form patterns.`
31
+ : undefined,
32
+ };
33
+ }
34
+ export function buildAngularUsageNotes(tagName, className, formControl) {
35
+ const subpath = tagToSubpath(tagName);
36
+ const angularClass = `${className}Component`;
37
+ const changeOutput = formControl
38
+ ? eventToAngularOutput(formControl.changeEvent)
39
+ : undefined;
40
+ return {
41
+ package: "@cobwds/angular",
42
+ import: `import { ${angularClass} } from "@cobwds/angular/${subpath}";`,
43
+ events: `Events map to camelCase outputs (cob-change -> (nysChange)); event.detail is typed.${changeOutput
44
+ ? ` This component's change output is (${changeOutput}).`
45
+ : ""}`,
46
+ forms: formControl
47
+ ? 'Implements ControlValueAccessor: works with [(ngModel)], formControlName (Reactive Forms), and Signal Forms [formField] with no CUSTOM_ELEMENTS_SCHEMA. Add the nysControlErrors directive to let Angular own validation display instead of the component\'s own errorMessage/showError. See get_guide({ topic: "installation", framework: "angular" }).'
48
+ : undefined,
49
+ };
50
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Framework package index
3
+ *
4
+ * Reads `data/frameworks.json`, written by `scripts/sync-guides.mjs` from
5
+ * the `package.json` of each framework package (react, vue, angular). Gives
6
+ * tools and resources the published package name and version without
7
+ * hand-maintaining either.
8
+ */
9
+ export interface FrameworkPackageInfo {
10
+ packageName: string;
11
+ version: string;
12
+ }
13
+ export interface FrameworksIndex {
14
+ react: FrameworkPackageInfo;
15
+ vue: FrameworkPackageInfo;
16
+ angular: FrameworkPackageInfo;
17
+ }
18
+ export declare function getFrameworksIndex(): FrameworksIndex;
19
+ //# sourceMappingURL=frameworks-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks-data.d.ts","sourceRoot":"","sources":["../../src/lib/frameworks-data.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,oBAAoB,CAAC;IAC5B,GAAG,EAAE,oBAAoB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;CAC/B;AAiBD,wBAAgB,kBAAkB,IAAI,eAAe,CAepD"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Framework package index
3
+ *
4
+ * Reads `data/frameworks.json`, written by `scripts/sync-guides.mjs` from
5
+ * the `package.json` of each framework package (react, vue, angular). Gives
6
+ * tools and resources the published package name and version without
7
+ * hand-maintaining either.
8
+ */
9
+ import { readFileSync, existsSync } from "node:fs";
10
+ import { resolve, dirname } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ let cached = null;
14
+ function getFrameworksDataPath() {
15
+ const candidates = [
16
+ resolve(__dirname, "../../data/frameworks.json"),
17
+ resolve(process.cwd(), "data/frameworks.json"),
18
+ ];
19
+ for (const path of candidates) {
20
+ if (existsSync(path))
21
+ return path;
22
+ }
23
+ throw new Error(`data/frameworks.json not found. Searched paths:\n${candidates.join("\n")}`);
24
+ }
25
+ export function getFrameworksIndex() {
26
+ if (cached)
27
+ return cached;
28
+ try {
29
+ cached = JSON.parse(readFileSync(getFrameworksDataPath(), "utf-8"));
30
+ }
31
+ catch (error) {
32
+ console.error("Warning: Could not load data/frameworks.json:", error);
33
+ cached = {
34
+ react: { packageName: "@cobwds/react", version: "unknown" },
35
+ vue: { packageName: "@cobwds/vue", version: "unknown" },
36
+ angular: { packageName: "@cobwds/angular", version: "unknown" },
37
+ };
38
+ }
39
+ return cached;
40
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Framework Resources
3
+ *
4
+ * MCP resources for COBWDS framework packages (@cobwds/react, @cobwds/vue,
5
+ * @cobwds/angular).
6
+ *
7
+ * Resources:
8
+ * - cobwds://frameworks - Index of framework packages with version and guide URI
9
+ * - cobwds://frameworks/react - @cobwds/react guide (synced from its README)
10
+ * - cobwds://frameworks/vue - @cobwds/vue guide (synced from its README)
11
+ * - cobwds://frameworks/angular - @cobwds/angular guide (synced from its README)
12
+ */
13
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
14
+ export declare function registerFrameworkResources(server: McpServer): void;
15
+ //# sourceMappingURL=frameworks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/resources/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAezE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwGlE"}