@carto/meridian-ds 3.0.3-alpha.cdb2a4e.260 → 3.0.3-alpha.d1bb4a1.264
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 +33 -19
- package/dist/metadata.json +76 -55
- 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,24 +82,27 @@ 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
|
}
|
|
@@ -101,9 +111,9 @@ function listComponents() {
|
|
|
101
111
|
name: d.name,
|
|
102
112
|
description: d.description,
|
|
103
113
|
keywords: d.curation.keywords ?? [],
|
|
104
|
-
examples: d.examples.length,
|
|
105
114
|
// Family signal: the parts a compound component is composed with, and the
|
|
106
|
-
// sibling variants chosen between —
|
|
115
|
+
// sibling variants chosen between — each as { name, description } (same shape
|
|
116
|
+
// as get_component) so an agent can pick a family member while scanning.
|
|
107
117
|
...d.curation.subComponents?.length ? { subComponents: d.curation.subComponents } : {},
|
|
108
118
|
...d.curation.variants?.length ? { variants: d.curation.variants } : {}
|
|
109
119
|
}));
|
|
@@ -111,13 +121,12 @@ function listComponents() {
|
|
|
111
121
|
function getComponent(name) {
|
|
112
122
|
const doc = find(name);
|
|
113
123
|
if (!doc) return familyRedirect(name) ?? notFound(name);
|
|
114
|
-
const parts = doc.curation.subComponents ?? [];
|
|
115
|
-
const dtsGlob =
|
|
124
|
+
const parts = (doc.curation.subComponents ?? []).map(subName);
|
|
125
|
+
const dtsGlob = dtsFindRecipe(doc.name, ...parts);
|
|
116
126
|
const compound = parts.length > 0 ? `${doc.name} is a compound component \u2014 compose it with its parts: ${parts.join(", ")}. ` : "";
|
|
117
127
|
return {
|
|
118
128
|
name: doc.name,
|
|
119
129
|
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
130
|
curation: doc.curation,
|
|
122
131
|
// Own props/types/JSDoc aren't in the bundle by design; point a headless
|
|
123
132
|
// agent at the shipped .d.ts (no IDE/hover assumed) — for the root and, for a
|
|
@@ -127,9 +136,14 @@ function getComponent(name) {
|
|
|
127
136
|
examples: (() => {
|
|
128
137
|
const { shown, rest } = partitionExamples(doc.examples);
|
|
129
138
|
const leadId = shown[0]?.id;
|
|
139
|
+
const ordered = [
|
|
140
|
+
...shown,
|
|
141
|
+
...rest.filter((e) => e.summary),
|
|
142
|
+
...rest.filter((e) => !e.summary)
|
|
143
|
+
];
|
|
130
144
|
return {
|
|
131
|
-
note: "Stories are ordered by copy-value; the flagged lead is the starting point. Call meridian_get_examples(name) for the lead
|
|
132
|
-
stories:
|
|
145
|
+
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.",
|
|
146
|
+
stories: ordered.map((e) => ({
|
|
133
147
|
id: e.id,
|
|
134
148
|
name: titleize(e.name),
|
|
135
149
|
...e.id === leadId ? { lead: true } : {},
|