@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.
Files changed (64) hide show
  1. package/dist/bin/meridian-ds-mcp.js +70 -31
  2. package/dist/metadata.json +2037 -176
  3. package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.metadata.d.ts +1 -0
  4. package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.metadata.d.ts.map +1 -1
  5. package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.stories.d.ts +3 -1
  6. package/dist/types/components/Autocomplete/Autocomplete/Autocomplete.stories.d.ts.map +1 -1
  7. package/dist/types/components/Autocomplete/Autocomplete/useAutocomplete.d.ts +1 -0
  8. package/dist/types/components/Autocomplete/Autocomplete/useAutocomplete.d.ts.map +1 -1
  9. package/dist/types/components/Autocomplete/AutocompleteList/AutocompleteList.d.ts +1 -0
  10. package/dist/types/components/Autocomplete/AutocompleteList/AutocompleteList.d.ts.map +1 -1
  11. package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.d.ts +1 -0
  12. package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.d.ts.map +1 -1
  13. package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.metadata.d.ts +22 -0
  14. package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.metadata.d.ts.map +1 -0
  15. package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.stories.d.ts +15 -0
  16. package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.stories.d.ts.map +1 -1
  17. package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.d.ts +1 -0
  18. package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.d.ts.map +1 -1
  19. package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.metadata.d.ts +22 -0
  20. package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.metadata.d.ts.map +1 -0
  21. package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.stories.d.ts +18 -0
  22. package/dist/types/components/Autocomplete/MultipleAutocomplete/MultipleAutocomplete.stories.d.ts.map +1 -1
  23. package/dist/types/components/Autocomplete/types.d.ts +3 -3
  24. package/dist/types/components/Autocomplete/utils/useAutocompleteRenderOption.d.ts +1 -0
  25. package/dist/types/components/Autocomplete/utils/useAutocompleteRenderOption.d.ts.map +1 -1
  26. package/dist/types/components/Button/Button.stories.d.ts +14 -0
  27. package/dist/types/components/Button/Button.stories.d.ts.map +1 -1
  28. package/dist/types/components/Dialog/Dialog/Dialog.metadata.d.ts.map +1 -1
  29. package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.d.ts +1 -0
  30. package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.d.ts.map +1 -1
  31. package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.metadata.d.ts +11 -0
  32. package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.metadata.d.ts.map +1 -0
  33. package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.stories.d.ts +14 -0
  34. package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.stories.d.ts.map +1 -1
  35. package/dist/types/components/Dialog/DialogContent/DialogContent.d.ts +2 -0
  36. package/dist/types/components/Dialog/DialogContent/DialogContent.d.ts.map +1 -1
  37. package/dist/types/components/Dialog/DialogFooter/DialogFooter.d.ts +2 -0
  38. package/dist/types/components/Dialog/DialogFooter/DialogFooter.d.ts.map +1 -1
  39. package/dist/types/components/Dialog/DialogHeader/DialogHeader.d.ts +1 -0
  40. package/dist/types/components/Dialog/DialogHeader/DialogHeader.d.ts.map +1 -1
  41. package/dist/types/components/Dialog/DialogPaper/DialogPaper.d.ts +1 -0
  42. package/dist/types/components/Dialog/DialogPaper/DialogPaper.d.ts.map +1 -1
  43. package/dist/types/components/Dialog/DialogStepper/DialogStepper.d.ts +1 -0
  44. package/dist/types/components/Dialog/DialogStepper/DialogStepper.d.ts.map +1 -1
  45. package/dist/types/components/Dialog/types.d.ts +27 -11
  46. package/dist/types/components/Dialog/types.d.ts.map +1 -1
  47. package/dist/types/components/IconButton/IconButton.stories.d.ts +14 -0
  48. package/dist/types/components/IconButton/IconButton.stories.d.ts.map +1 -1
  49. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts +1 -0
  50. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts.map +1 -1
  51. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.metadata.d.ts +27 -0
  52. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.metadata.d.ts.map +1 -0
  53. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts +14 -0
  54. package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts.map +1 -1
  55. package/dist/types/components/SelectField/SelectField/SelectField.metadata.d.ts +1 -0
  56. package/dist/types/components/SelectField/SelectField/SelectField.metadata.d.ts.map +1 -1
  57. package/dist/types/components/SelectField/SelectField/SelectField.stories.d.ts.map +1 -1
  58. package/dist/types/components/SelectField/types.d.ts +12 -0
  59. package/dist/types/components/SelectField/types.d.ts.map +1 -1
  60. package/dist/types/components/Tag/Tag.stories.d.ts +14 -0
  61. package/dist/types/components/Tag/Tag.stories.d.ts.map +1 -1
  62. package/dist/types/components/Typography/Typography.stories.d.ts +14 -0
  63. package/dist/types/components/Typography/Typography.stories.d.ts.map +1 -1
  64. 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, keywords, and example count, plus a family signal where relevant (`subComponents` for a compound component, `variants` for sibling components chosen between). Start here: the catalog is small, so read it and pick the component whose description/keywords match your need.",
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 isPart = d.curation.subComponents?.some((s) => s.toLowerCase() === lc);
82
- const isVariant = d.curation.variants?.some((v) => v.toLowerCase() === lc);
83
- if (!isPart && !isVariant) continue;
84
- const rel = isPart ? `a sub-component of ${d.name} (a compound component)` : `a variant of ${d.name}`;
85
- return {
86
- note: `"${name}" is ${rel} and has no standalone catalog entry. See meridian_get_examples('${d.name}') for usage/composition and meridian_get_component('${d.name}') for its curation. Read ${name}'s own props from its type declarations: find node_modules/@carto/meridian-ds/dist/types -name '${name}.d.ts'.`
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
- let shown = [...usage, ...summarized];
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 — so relationships are visible while scanning.
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 = parts.length > 0 ? `find node_modules/@carto/meridian-ds/dist/types \\( ${[doc.name, ...parts].map((n) => `-name '${n}.d.ts'`).join(" -o ")} \\)` : `find node_modules/@carto/meridian-ds/dist/types -name '${doc.name}.d.ts'`;
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
- reminder: "Apply the session conventions when using this \u2014 call meridian_get_conventions first if you have not this session.",
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
- const { shown, rest } = partitionExamples(doc.examples);
129
- const leadId = shown[0]?.id;
130
- return {
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");