@carto/meridian-ds 3.0.3-alpha.cdb2a4e.260 → 3.0.3-alpha.dd2ac14.266
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/dist/bin/meridian-ds-mcp.js +70 -31
- package/dist/metadata.json +2037 -176
- package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.metadata.d.ts +1 -0
- package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.metadata.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.stories.d.ts +3 -1
- package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.stories.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/Autocomplete/useAutocomplete.d.ts +1 -0
- package/dist/types/components/Autocomplete/Autocomplete/useAutocomplete.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/AutocompleteList/AutocompleteList.d.ts +1 -0
- package/dist/types/components/Autocomplete/AutocompleteList/AutocompleteList.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.d.ts +1 -0
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.metadata.d.ts +22 -0
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.metadata.d.ts.map +1 -0
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.stories.d.ts +15 -0
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.stories.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.d.ts +1 -0
- package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.metadata.d.ts +22 -0
- package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.metadata.d.ts.map +1 -0
- package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.stories.d.ts +18 -0
- package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.stories.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/types.d.ts +3 -3
- package/dist/types/components/Autocomplete/utils/useAutocompleteRenderOption.d.ts +1 -0
- package/dist/types/components/Autocomplete/utils/useAutocompleteRenderOption.d.ts.map +1 -1
- package/dist/types/components/Button/Button.stories.d.ts +14 -0
- package/dist/types/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/Dialog/Dialog.metadata.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.d.ts +1 -0
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.metadata.d.ts +11 -0
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.metadata.d.ts.map +1 -0
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.stories.d.ts +14 -0
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogContent/DialogContent.d.ts +2 -0
- package/dist/types/components/Dialog/DialogContent/DialogContent.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogFooter/DialogFooter.d.ts +2 -0
- package/dist/types/components/Dialog/DialogFooter/DialogFooter.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.d.ts +1 -0
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogPaper/DialogPaper.d.ts +1 -0
- package/dist/types/components/Dialog/DialogPaper/DialogPaper.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogStepper/DialogStepper.d.ts +1 -0
- package/dist/types/components/Dialog/DialogStepper/DialogStepper.d.ts.map +1 -1
- package/dist/types/components/Dialog/types.d.ts +27 -11
- package/dist/types/components/Dialog/types.d.ts.map +1 -1
- package/dist/types/components/IconButton/IconButton.stories.d.ts +14 -0
- package/dist/types/components/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts +1 -0
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts.map +1 -1
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.metadata.d.ts +27 -0
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.metadata.d.ts.map +1 -0
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts +14 -0
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts.map +1 -1
- package/dist/types/components/SelectField/SelectField/SelectField.metadata.d.ts +1 -0
- package/dist/types/components/SelectField/SelectField/SelectField.metadata.d.ts.map +1 -1
- package/dist/types/components/SelectField/SelectField/SelectField.stories.d.ts.map +1 -1
- package/dist/types/components/SelectField/types.d.ts +12 -0
- package/dist/types/components/SelectField/types.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.stories.d.ts +14 -0
- package/dist/types/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/components/Typography/Typography.stories.d.ts +14 -0
- package/dist/types/components/Typography/Typography.stories.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,16 @@ import * as fs from "fs";
|
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import { createRequire } from "module";
|
|
8
|
+
|
|
9
|
+
// ai-metadata/types.ts
|
|
10
|
+
function subName(s) {
|
|
11
|
+
return typeof s === "string" ? s : s.name;
|
|
12
|
+
}
|
|
13
|
+
function relatedName(e) {
|
|
14
|
+
return typeof e === "string" ? e : e.name;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// ai-metadata/mcp/server.ts
|
|
8
18
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
19
|
function resolveBundlePath() {
|
|
10
20
|
if (process.env.MERIDIAN_DS_METADATA) return process.env.MERIDIAN_DS_METADATA;
|
|
@@ -26,7 +36,7 @@ var VERSION = "0.0.0";
|
|
|
26
36
|
var TOOLS = [
|
|
27
37
|
{
|
|
28
38
|
name: "meridian_list_components",
|
|
29
|
-
description: "List all Meridian components with their description
|
|
39
|
+
description: "List all Meridian components with their description and keywords, plus a family signal where relevant (`subComponents` for a compound component, `variants` for sibling components chosen between \u2014 each with a one-line description). Start here: the catalog is small, so read it and pick the component whose description/keywords match your need. Rows flagged `documented: false` are listed-but-not-yet-curated \u2014 they exist and have examples, but get_component carries no when-to-use/decisionTree/prop guidance for them.",
|
|
30
40
|
inputSchema: {
|
|
31
41
|
type: "object",
|
|
32
42
|
properties: {},
|
|
@@ -35,7 +45,7 @@ var TOOLS = [
|
|
|
35
45
|
},
|
|
36
46
|
{
|
|
37
47
|
name: "meridian_get_component",
|
|
38
|
-
description: "Curation for one component: when to use it, its decisionTree (when to reach for a different component), any limitations (capabilities it lacks vs. similar components \u2014 check before downgrading from one), and the high-value inherited MUI props (curation.mui, some with an aiHint). Own props, types, and JSDoc are NOT here \u2014 read the shipped .d.ts (the propTypes field gives the exact command).",
|
|
48
|
+
description: "Curation for one component: when to use it, its decisionTree (when to reach for a different component), any limitations (capabilities it lacks vs. similar components \u2014 check before downgrading from one), and the high-value inherited MUI props (curation.mui, some with an aiHint). Own props, types, and JSDoc are NOT here \u2014 read the shipped .d.ts (the propTypes field gives the exact command). For a not-yet-curated component (`documented: false`) it returns the examples + .d.ts pointer + a note instead of curation. Sub-components and variants (`DialogHeader`, `MultipleAutocomplete`, \u2026) have no standalone catalog entry \u2014 `meridian_get_component`/`meridian_get_examples` on them return a pointer to the parent (check its `curation.subComponents`/`curation.variants`).",
|
|
39
49
|
inputSchema: {
|
|
40
50
|
type: "object",
|
|
41
51
|
properties: {
|
|
@@ -47,7 +57,7 @@ var TOOLS = [
|
|
|
47
57
|
},
|
|
48
58
|
{
|
|
49
59
|
name: "meridian_get_examples",
|
|
50
|
-
description: "Real, copy-able example code (per Storybook story, with imports), shipped in the package. With no storyId: the lead usage story and the notable stories in full, plus an 'Other Stories' list (name + id) of the rest. Pass a storyId (from that list or meridian_get_component) to get just that story's full code.",
|
|
60
|
+
description: "Real, copy-able example code (per Storybook story, with imports), shipped in the package. With no storyId: the lead usage story and the notable stories in full, plus an 'Other Stories' list (name + id) of the rest. Pass a storyId (from that list or meridian_get_component) to get just that story's full code. Sub-components and variants (`DialogHeader`, `MultipleAutocomplete`, \u2026) have no standalone catalog entry \u2014 `meridian_get_component`/`meridian_get_examples` on them return a pointer to the parent (check its `curation.subComponents`/`curation.variants`).",
|
|
51
61
|
inputSchema: {
|
|
52
62
|
type: "object",
|
|
53
63
|
properties: {
|
|
@@ -75,68 +85,95 @@ var find = (name) => DOCS.find((d) => d.name.toLowerCase() === String(name).toLo
|
|
|
75
85
|
var notFound = (name) => ({
|
|
76
86
|
error: `Unknown component "${name}". Available: ${DOCS.map((d) => d.name).join(", ")}`
|
|
77
87
|
});
|
|
88
|
+
function dtsFindRecipe(...names) {
|
|
89
|
+
const root = "find node_modules/@carto/meridian-ds/dist/types";
|
|
90
|
+
const clauses = names.map((n) => `-name '${n}.d.ts'`);
|
|
91
|
+
return names.length > 1 ? `${root} \\( ${clauses.join(" -o ")} \\)` : `${root} ${clauses[0]}`;
|
|
92
|
+
}
|
|
78
93
|
function familyRedirect(name) {
|
|
79
94
|
const lc = String(name).toLowerCase();
|
|
80
95
|
for (const d of DOCS) {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
96
|
+
const part = d.curation.subComponents?.map(subName).find((s) => s.toLowerCase() === lc);
|
|
97
|
+
const variant = d.curation.variants?.map(subName).find((v) => v.toLowerCase() === lc);
|
|
98
|
+
const canonical = part ?? variant;
|
|
99
|
+
if (!canonical) continue;
|
|
100
|
+
const note = part ? `"${canonical}" is a sub-component of ${d.name} (a compound component) \u2014 it has no standalone catalog entry. See meridian_get_examples('${d.name}') for how it's composed, and read its own props from its type declarations: ${dtsFindRecipe(canonical)}.` : `"${canonical}" is a variant of ${d.name} \u2014 a full component in its own right, not yet individually documented in this catalog. For now use meridian_get_component('${d.name}') / meridian_get_examples('${d.name}'), and read ${canonical}'s own props from its type declarations: ${dtsFindRecipe(canonical)}.`;
|
|
101
|
+
return { note };
|
|
88
102
|
}
|
|
89
103
|
return void 0;
|
|
90
104
|
}
|
|
91
105
|
function partitionExamples(examples) {
|
|
92
106
|
const usage = examples.filter((e) => e.isUsage);
|
|
93
107
|
const summarized = examples.filter((e) => !e.isUsage && e.summary);
|
|
94
|
-
|
|
95
|
-
if (!shown.length) shown = examples.slice(0, 1);
|
|
108
|
+
const shown = usage.length ? usage : summarized.length ? summarized : examples.slice(0, 1);
|
|
96
109
|
const inShown = new Set(shown);
|
|
97
110
|
return { shown, rest: examples.filter((e) => !inShown.has(e)) };
|
|
98
111
|
}
|
|
112
|
+
function exampleStories(examples) {
|
|
113
|
+
const { shown, rest } = partitionExamples(examples);
|
|
114
|
+
const leadId = shown[0]?.id;
|
|
115
|
+
const ordered = [
|
|
116
|
+
...shown,
|
|
117
|
+
...rest.filter((e) => e.summary),
|
|
118
|
+
...rest.filter((e) => !e.summary)
|
|
119
|
+
];
|
|
120
|
+
return ordered.map((e) => ({
|
|
121
|
+
id: e.id,
|
|
122
|
+
name: titleize(e.name),
|
|
123
|
+
...e.id === leadId ? { lead: true } : {},
|
|
124
|
+
...e.summary ? { summary: e.summary } : {}
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
99
127
|
function listComponents() {
|
|
100
128
|
return DOCS.map((d) => ({
|
|
101
129
|
name: d.name,
|
|
102
130
|
description: d.description,
|
|
131
|
+
// LISTED-only components (no metadata file): flagged so an agent knows
|
|
132
|
+
// get_component won't carry when-to-use/decisionTree/mui guidance for them —
|
|
133
|
+
// examples + the .d.ts are still available. Documented rows omit the flag.
|
|
134
|
+
...d.documented ? {} : { documented: false },
|
|
103
135
|
keywords: d.curation.keywords ?? [],
|
|
104
|
-
examples: d.examples.length,
|
|
105
136
|
// Family signal: the parts a compound component is composed with, and the
|
|
106
|
-
// sibling variants chosen between —
|
|
137
|
+
// sibling variants chosen between — each as { name, description } (same shape
|
|
138
|
+
// as get_component) so an agent can pick a family member while scanning.
|
|
107
139
|
...d.curation.subComponents?.length ? { subComponents: d.curation.subComponents } : {},
|
|
108
|
-
...d.curation.variants?.length ? { variants: d.curation.variants } : {}
|
|
140
|
+
...d.curation.variants?.length ? { variants: d.curation.variants } : {},
|
|
141
|
+
// Existence signal for the public hooks/utils/constants that ship with this
|
|
142
|
+
// component — compact here (name + kind); get_component carries the full
|
|
143
|
+
// { description, import } so an agent can act on them.
|
|
144
|
+
...d.curation.relatedExports?.length ? {
|
|
145
|
+
relatedExports: d.curation.relatedExports.map((e) => ({
|
|
146
|
+
name: relatedName(e),
|
|
147
|
+
...typeof e === "object" && e.kind ? { kind: e.kind } : {}
|
|
148
|
+
}))
|
|
149
|
+
} : {}
|
|
109
150
|
}));
|
|
110
151
|
}
|
|
111
152
|
function getComponent(name) {
|
|
112
153
|
const doc = find(name);
|
|
113
154
|
if (!doc) return familyRedirect(name) ?? notFound(name);
|
|
114
|
-
const parts = doc.curation.subComponents ?? [];
|
|
115
|
-
const dtsGlob =
|
|
155
|
+
const parts = (doc.curation.subComponents ?? []).map(subName);
|
|
156
|
+
const dtsGlob = dtsFindRecipe(doc.name, ...parts);
|
|
116
157
|
const compound = parts.length > 0 ? `${doc.name} is a compound component \u2014 compose it with its parts: ${parts.join(", ")}. ` : "";
|
|
117
158
|
return {
|
|
118
159
|
name: doc.name,
|
|
119
160
|
description: doc.description,
|
|
120
|
-
|
|
161
|
+
documented: doc.documented,
|
|
162
|
+
// A LISTED-only component has no curated guidance — be explicit so the agent
|
|
163
|
+
// leans on the examples + .d.ts rather than assuming the curation is just empty.
|
|
164
|
+
...doc.documented ? {} : {
|
|
165
|
+
note: "Not yet curated: no when-to-use / decisionTree / keywords / promoted-prop guidance for this component. Use the examples below and its type declarations \u2014 and still prefer it over a bare MUI equivalent."
|
|
166
|
+
},
|
|
121
167
|
curation: doc.curation,
|
|
122
168
|
// Own props/types/JSDoc aren't in the bundle by design; point a headless
|
|
123
169
|
// agent at the shipped .d.ts (no IDE/hover assumed) — for the root and, for a
|
|
124
170
|
// compound component, every part. Promoted inherited MUI props, when curated,
|
|
125
171
|
// are already in `curation.mui` above.
|
|
126
172
|
propTypes: `${compound}Own props, exact types, and JSDoc are not in this payload \u2014 they ship as TypeScript declarations. Read them from the installed package: \`${dtsGlob}\`. Import from '@carto/meridian-ds/components'.`,
|
|
127
|
-
examples:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
note: "Stories are ordered by copy-value; the flagged lead is the starting point. Call meridian_get_examples(name) for the lead and the summarized stories in full plus an index of the rest; pass a storyId for any specific one.",
|
|
132
|
-
stories: [...shown, ...rest].map((e) => ({
|
|
133
|
-
id: e.id,
|
|
134
|
-
name: titleize(e.name),
|
|
135
|
-
...e.id === leadId ? { lead: true } : {},
|
|
136
|
-
...e.summary ? { summary: e.summary } : {}
|
|
137
|
-
}))
|
|
138
|
-
};
|
|
139
|
-
})()
|
|
173
|
+
examples: {
|
|
174
|
+
note: "Stories are ordered by copy-value; the flagged lead is the starting point. Call meridian_get_examples(name) for the lead in full plus an index of the rest; pass a storyId for any specific one.",
|
|
175
|
+
stories: exampleStories(doc.examples)
|
|
176
|
+
}
|
|
140
177
|
};
|
|
141
178
|
}
|
|
142
179
|
function titleize(name) {
|
|
@@ -223,6 +260,8 @@ Flow:
|
|
|
223
260
|
3. meridian_get_component(name) \u2014 when to use it, its decisionTree (conditions that point to a different component), and the high-value inherited MUI props worth knowing (curation.mui; some carry an aiHint). It also returns the example story ids.
|
|
224
261
|
4. meridian_get_examples(name[, storyId]) \u2014 real, copy-able example code. With no storyId: the lead usage story and the notable stories in full plus a list of the rest; pass a storyId for one story's full code.
|
|
225
262
|
|
|
263
|
+
Two tiers of components: most are fully CURATED, but some are LISTED only (flagged "documented": false in list_components / get_component) \u2014 they exist and have examples (use them), but carry no curated when-to-use / decisionTree / promoted-prop guidance yet. For a listed component, lean on get_examples + the .d.ts, and still prefer it over a bare MUI equivalent.
|
|
264
|
+
|
|
226
265
|
Exact own props, types, and JSDoc are NOT served here \u2014 they ship as TypeScript declarations in the installed package. Read them with: find node_modules/@carto/meridian-ds/dist/types -name '<Component>.d.ts'. Import the component from '@carto/meridian-ds/components'. Prefer a Meridian component over a bare MUI one whenever one exists.`;
|
|
227
266
|
function send(msg) {
|
|
228
267
|
process.stdout.write(JSON.stringify(msg) + "\n");
|