@contentful/experience-design-system-generation 2.32.1-dev-build-1c12dc8.0 → 2.32.1-dev-build-b7d2d34.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-generation",
3
- "version": "2.32.1-dev-build-1c12dc8.0",
3
+ "version": "2.32.1-dev-build-b7d2d34.0",
4
4
  "description": "Agent-invocation and skill-prompt engine for the Contentful Experience Design System SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -68,6 +68,10 @@ export interface PromptOptions {
68
68
  * appropriate warning banner.
69
69
  */
70
70
  skillPathOverride?: string;
71
+ /** JSON-serialized summary of existing space Components. Callers pre-project the shape per skill. */
72
+ existingComponentsInline?: string;
73
+ /** JSON-serialized summary of existing space DesignTokens. Callers pre-project the shape per skill. */
74
+ existingTokensInline?: string;
71
75
  }
72
76
  export declare function buildPrompt(options: PromptOptions): Promise<string>;
73
77
  export declare function resolveSkillPath(skill: Skill): string;
@@ -129,8 +129,14 @@ function renderTokenCandidateSection(kind, entries) {
129
129
  return `${label}, one leaf token per line as \`path · type\`, no \`$value\`:\n${formatTokenCandidateLines(entries)}`;
130
130
  }
131
131
  function buildPreamble(options) {
132
- const { skill, rawComponentsInline, rawTokensInline, rawTokensFilename, tokensInline, tokenMapInline, generatedCdf, tokenTree, componentSourceRefs, } = options;
132
+ const { skill, rawComponentsInline, rawTokensInline, rawTokensFilename, tokensInline, tokenMapInline, generatedCdf, tokenTree, componentSourceRefs, existingComponentsInline, existingTokensInline, } = options;
133
133
  const sections = [];
134
+ if (existingComponentsInline) {
135
+ sections.push(`Existing components in the target Contentful space (JSON) — use for alignment, not as a hard filter:\n\`\`\`json\n${existingComponentsInline}\n\`\`\``);
136
+ }
137
+ if (existingTokensInline) {
138
+ sections.push(`Existing design tokens in the target Contentful space (JSON) — prefer binding to these paths over inventing new ones:\n\`\`\`json\n${existingTokensInline}\n\`\`\``);
139
+ }
134
140
  if (rawComponentsInline) {
135
141
  sections.push(`Raw component data (JSON):\n\`\`\`json\n${rawComponentsInline}\n\`\`\``);
136
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-generation",
3
- "version": "2.32.1-dev-build-1c12dc8.0",
3
+ "version": "2.32.1-dev-build-b7d2d34.0",
4
4
  "description": "Agent-invocation and skill-prompt engine for the Contentful Experience Design System SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "skills/"
23
23
  ],
24
24
  "dependencies": {
25
- "@contentful/experience-design-system-types": "2.32.1-dev-build-1c12dc8.0"
25
+ "@contentful/experience-design-system-types": "2.32.1-dev-build-b7d2d34.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tsconfig/node24": "^24.0.4",
@@ -549,3 +549,30 @@ If you are genuinely uncertain about every prop, classify each as:
549
549
  An imperfect classification is infinitely better than no classification. That is
550
550
  about **classifying a prop rather than dropping it** — it is not a licence to
551
551
  invent a `values` list. The uncertain answer is `cdf_type: "string"`, every time.
552
+
553
+ ---
554
+
555
+ ## Existing entities in the target space
556
+
557
+ The preamble may include an "Existing components in the target Contentful space" JSON block with a `likelyMatch` (a fuzzy-matched space component that likely corresponds to the codebase component you're classifying), an `otherComponents` list, and a rolled-up token summary. Use it to align your classifications with what the customer already has.
558
+
559
+ ### When `likelyMatch` is present — align prop names, categories, and slot names
560
+
561
+ Your goal is **consistency**: the customer will see the diff between what you propose and what already exists, and every unnecessary rename or category flip becomes review friction.
562
+
563
+ 1. **Prop names**: if the codebase has a prop whose meaning matches a `likelyMatch` design/content property (e.g. codebase `kind` ↔ space `variant`, codebase `text` ↔ space `label`), emit `classify_prop` with the **space's prop name** rather than the codebase name. In the `reason` field, always explain the rename explicitly, e.g. `"renamed from codebase prop 'kind' to match existing space prop 'variant'"`. If you can't confidently identify the correspondence, keep the codebase name.
564
+ 2. **Categories**: match the space's category (`design` / `content`) for equivalent props, even if you'd normally categorize differently. Note the alignment in `reason`.
565
+ 3. **Slot names**: match slot IDs / names when the shape is equivalent.
566
+ 4. **Enum values**: never invent new values to bridge a mismatch. If the codebase's enum diverges from the space's, classify against your best-effort mapping and cite the divergence in `reason` — this is a signal for human review, not a green light to rewrite the space's enum.
567
+ 5. **Never rename or realign silently.** Every classification influenced by the `likelyMatch` MUST cite it in `reason`.
568
+
569
+ ### When only `otherComponents` is present (no direct match)
570
+
571
+ Use the list to constrain slot `allowedComponents` — do not propose a slot that accepts component types the space doesn't have.
572
+
573
+ ### Token binding
574
+
575
+ The preamble's "Existing design tokens" section lists tokens (by name + DTCG type) already in the space.
576
+
577
+ 1. When classifying a `design`-category, `token`-typed prop, prefer binding to an existing token name over inventing a new one. Cite the target token in `reason`.
578
+ 2. If no existing token semantically matches, proceed with the current rules — propose a new token. The diff surfaces this for review.
@@ -88,3 +88,15 @@ Before emitting any tool calls, verify:
88
88
  3. `token_allowed` is never empty.
89
89
  4. Every emitted list includes the prop's own default token when it has one.
90
90
  5. No list was emitted on the strength of a default alone, and none targets a prop whose type is a union of variant names.
91
+
92
+ ---
93
+
94
+ ## Existing entities in the target space
95
+
96
+ The preamble may include an "Existing design tokens in the target Contentful space" JSON block listing tokens already present in the target space (by name + DTCG type).
97
+
98
+ Prefer restricting to existing tokens over proposing new ones:
99
+
100
+ 1. When the source has restriction evidence AND a candidate maps semantically to an existing token by name/type, favor the existing token in the emitted `token_allowed` list.
101
+ 2. Never emit a `token_allowed` entry that contradicts the "path exists verbatim" rule above — the existing-tokens block is guidance, not a substitute for the token path index. If a token appears in the existing-entities list but not in the token path index, do not use it.
102
+ 3. If none of the existing tokens fit and the source's evidence is specific, proceed as usual — the diff will surface the new proposal.
@@ -222,3 +222,14 @@ TextImageCard — card with rich text and background image
222
222
  SearchInput — search field with dropdown
223
223
  {"tool":"select_component","name":"SearchInput","reason":"search UI — configurable placeholder and state"}
224
224
  ```
225
+
226
+ ---
227
+
228
+ ## Existing entities in the target space
229
+
230
+ The preamble may include an "Existing components in the target Contentful space" JSON block and a rolled-up token summary. Use them as **signal, not as a filter**. Rules:
231
+
232
+ 1. Never let a name overlap force a decision. Acceptance is still driven purely by "does the codebase component render visible, authorable UI?" — a name match does not auto-accept, and a name conflict does not auto-reject.
233
+ 2. When a codebase component appears to correspond to an existing space component (name overlap, semantic overlap in the description), note it in your `reason` — e.g. `"accepted; likely maps to existing space component 'Button'"`. This surfaces the mapping for downstream review.
234
+ 3. When the space is mature (many existing components, dozens of tokens) and the codebase has thin wrappers with no visible UI difference, lean harder toward rejecting the wrappers. Extra noise in a mature space is more costly than in an empty one.
235
+ 4. When no overlap exists, the acceptance decision is unchanged from the rules above.