@carto/meridian-ds 3.0.3-alpha.cdb2a4e.260 → 3.0.3-alpha.f11fdb3.265
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 +45 -30
- package/dist/metadata.json +78 -57
- 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/DialogContent/DialogContent.d.ts +1 -0
- package/dist/types/components/Dialog/DialogContent/DialogContent.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogFooter/DialogFooter.d.ts +1 -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/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 +26 -10
- 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/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/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,13 @@ 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
|
+
|
|
14
|
+
// ai-metadata/mcp/server.ts
|
|
8
15
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
16
|
function resolveBundlePath() {
|
|
10
17
|
if (process.env.MERIDIAN_DS_METADATA) return process.env.MERIDIAN_DS_METADATA;
|
|
@@ -26,7 +33,7 @@ var VERSION = "0.0.0";
|
|
|
26
33
|
var TOOLS = [
|
|
27
34
|
{
|
|
28
35
|
name: "meridian_list_components",
|
|
29
|
-
description: "List all Meridian components with their description
|
|
36
|
+
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.",
|
|
30
37
|
inputSchema: {
|
|
31
38
|
type: "object",
|
|
32
39
|
properties: {},
|
|
@@ -35,7 +42,7 @@ var TOOLS = [
|
|
|
35
42
|
},
|
|
36
43
|
{
|
|
37
44
|
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).",
|
|
45
|
+
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). 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
46
|
inputSchema: {
|
|
40
47
|
type: "object",
|
|
41
48
|
properties: {
|
|
@@ -47,7 +54,7 @@ var TOOLS = [
|
|
|
47
54
|
},
|
|
48
55
|
{
|
|
49
56
|
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.",
|
|
57
|
+
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
58
|
inputSchema: {
|
|
52
59
|
type: "object",
|
|
53
60
|
properties: {
|
|
@@ -75,35 +82,53 @@ var find = (name) => DOCS.find((d) => d.name.toLowerCase() === String(name).toLo
|
|
|
75
82
|
var notFound = (name) => ({
|
|
76
83
|
error: `Unknown component "${name}". Available: ${DOCS.map((d) => d.name).join(", ")}`
|
|
77
84
|
});
|
|
85
|
+
function dtsFindRecipe(...names) {
|
|
86
|
+
const root = "find node_modules/@carto/meridian-ds/dist/types";
|
|
87
|
+
const clauses = names.map((n) => `-name '${n}.d.ts'`);
|
|
88
|
+
return names.length > 1 ? `${root} \\( ${clauses.join(" -o ")} \\)` : `${root} ${clauses[0]}`;
|
|
89
|
+
}
|
|
78
90
|
function familyRedirect(name) {
|
|
79
91
|
const lc = String(name).toLowerCase();
|
|
80
92
|
for (const d of DOCS) {
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
93
|
+
const part = d.curation.subComponents?.map(subName).find((s) => s.toLowerCase() === lc);
|
|
94
|
+
const variant = d.curation.variants?.map(subName).find((v) => v.toLowerCase() === lc);
|
|
95
|
+
const canonical = part ?? variant;
|
|
96
|
+
if (!canonical) continue;
|
|
97
|
+
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)}.`;
|
|
98
|
+
return { note };
|
|
88
99
|
}
|
|
89
100
|
return void 0;
|
|
90
101
|
}
|
|
91
102
|
function partitionExamples(examples) {
|
|
92
103
|
const usage = examples.filter((e) => e.isUsage);
|
|
93
104
|
const summarized = examples.filter((e) => !e.isUsage && e.summary);
|
|
94
|
-
|
|
95
|
-
if (!shown.length) shown = examples.slice(0, 1);
|
|
105
|
+
const shown = usage.length ? usage : summarized.length ? summarized : examples.slice(0, 1);
|
|
96
106
|
const inShown = new Set(shown);
|
|
97
107
|
return { shown, rest: examples.filter((e) => !inShown.has(e)) };
|
|
98
108
|
}
|
|
109
|
+
function exampleStories(examples) {
|
|
110
|
+
const { shown, rest } = partitionExamples(examples);
|
|
111
|
+
const leadId = shown[0]?.id;
|
|
112
|
+
const ordered = [
|
|
113
|
+
...shown,
|
|
114
|
+
...rest.filter((e) => e.summary),
|
|
115
|
+
...rest.filter((e) => !e.summary)
|
|
116
|
+
];
|
|
117
|
+
return ordered.map((e) => ({
|
|
118
|
+
id: e.id,
|
|
119
|
+
name: titleize(e.name),
|
|
120
|
+
...e.id === leadId ? { lead: true } : {},
|
|
121
|
+
...e.summary ? { summary: e.summary } : {}
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
99
124
|
function listComponents() {
|
|
100
125
|
return DOCS.map((d) => ({
|
|
101
126
|
name: d.name,
|
|
102
127
|
description: d.description,
|
|
103
128
|
keywords: d.curation.keywords ?? [],
|
|
104
|
-
examples: d.examples.length,
|
|
105
129
|
// Family signal: the parts a compound component is composed with, and the
|
|
106
|
-
// sibling variants chosen between —
|
|
130
|
+
// sibling variants chosen between — each as { name, description } (same shape
|
|
131
|
+
// as get_component) so an agent can pick a family member while scanning.
|
|
107
132
|
...d.curation.subComponents?.length ? { subComponents: d.curation.subComponents } : {},
|
|
108
133
|
...d.curation.variants?.length ? { variants: d.curation.variants } : {}
|
|
109
134
|
}));
|
|
@@ -111,32 +136,22 @@ function listComponents() {
|
|
|
111
136
|
function getComponent(name) {
|
|
112
137
|
const doc = find(name);
|
|
113
138
|
if (!doc) return familyRedirect(name) ?? notFound(name);
|
|
114
|
-
const parts = doc.curation.subComponents ?? [];
|
|
115
|
-
const dtsGlob =
|
|
139
|
+
const parts = (doc.curation.subComponents ?? []).map(subName);
|
|
140
|
+
const dtsGlob = dtsFindRecipe(doc.name, ...parts);
|
|
116
141
|
const compound = parts.length > 0 ? `${doc.name} is a compound component \u2014 compose it with its parts: ${parts.join(", ")}. ` : "";
|
|
117
142
|
return {
|
|
118
143
|
name: doc.name,
|
|
119
144
|
description: doc.description,
|
|
120
|
-
reminder: "Apply the session conventions when using this \u2014 call meridian_get_conventions first if you have not this session.",
|
|
121
145
|
curation: doc.curation,
|
|
122
146
|
// Own props/types/JSDoc aren't in the bundle by design; point a headless
|
|
123
147
|
// agent at the shipped .d.ts (no IDE/hover assumed) — for the root and, for a
|
|
124
148
|
// compound component, every part. Promoted inherited MUI props, when curated,
|
|
125
149
|
// are already in `curation.mui` above.
|
|
126
150
|
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
|
-
})()
|
|
151
|
+
examples: {
|
|
152
|
+
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.",
|
|
153
|
+
stories: exampleStories(doc.examples)
|
|
154
|
+
}
|
|
140
155
|
};
|
|
141
156
|
}
|
|
142
157
|
function titleize(name) {
|