@contentful/experience-design-system-cli 2.20.2-dev-build-e7403ea.0 → 2.20.2-dev-build-67c8a28.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-cli",
3
- "version": "2.20.2-dev-build-e7403ea.0",
3
+ "version": "2.20.2-dev-build-67c8a28.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,13 +44,13 @@
44
44
  "commander": "^13.1.0",
45
45
  "ink": "^4.4.1",
46
46
  "react": "^18.3.1",
47
- "react-devtools-core": "^4.28.5",
47
+ "react-devtools-core": "^4.19.1",
48
48
  "react-dom": "^18.3.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@tsconfig/node24": "^24.0.4",
52
52
  "@types/node": "^24.0.3",
53
- "@types/react": "^18.3.31",
53
+ "@types/react": "^18.3.24",
54
54
  "eslint": "^9.39.5",
55
55
  "eslint-config-prettier": "^10.1.8",
56
56
  "eslint-plugin-prettier": "^5.5.6",
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * This module owns both shapes and the converters between them.
13
13
  */
14
- export type EdgeProvenance = 'user' | 'typed-slot' | `adapter:${string}` | 'agent';
14
+ export type EdgeProvenance = 'user' | 'typed-slot' | 'structural' | `adapter:${string}` | 'agent';
15
15
  export type CompositionEdge = {
16
16
  parent: string;
17
17
  child: string;
@@ -1,15 +1,23 @@
1
1
  /**
2
2
  * Provenance rank (spec T2). Lower number = higher trust = wins conflicts.
3
- * 1 user > 2 typed-slot > 3 adapter:* > 4 agent
3
+ * 1 user > 2 typed-slot > 3 structural > 4 adapter:* > 5 agent
4
+ *
5
+ * `structural` sits just below a declared slot contract: it's usage evidence
6
+ * (a runtime type-predicate function, a `.type === Component` identity check,
7
+ * direct JSX instantiation — see `structural-slot-evidence.ts`) rather than a
8
+ * typed generic or explicit marker, so a declared contract always overrides
9
+ * it on conflict, but it still outranks the LLM agent.
4
10
  */
5
11
  function rank(p) {
6
12
  if (p === 'user')
7
13
  return 1;
8
14
  if (p === 'typed-slot')
9
15
  return 2;
10
- if (p.startsWith('adapter:'))
16
+ if (p === 'structural')
11
17
  return 3;
12
- return 4; // agent
18
+ if (p.startsWith('adapter:'))
19
+ return 4;
20
+ return 5; // agent
13
21
  }
14
22
  /**
15
23
  * Union all edges, resolving conflicts by provenance rank. A conflict is two
@@ -10,7 +10,8 @@ export type ResolveMappingResult = {
10
10
  /**
11
11
  * Orchestrate composition-map acquisition (spec T2) and enrichment (T7).
12
12
  *
13
- * Sources by rank: user map (1) > typed-slot / "code slots" (2) > agent (4).
13
+ * Sources by rank: user map (1) > typed-slot / "code slots" (2) > structural
14
+ * usage evidence (3) > adapter-resolved / extraEdges (4) > agent (5).
14
15
  * ALL sources — including the code slots already on the incoming components —
15
16
  * are fed into one ranked merge and unioned; non-conflicting edges from every
16
17
  * source survive, and on a conflict (same parent+child, different slot) the
@@ -6,7 +6,8 @@ import { loadPrompt } from './agent-parser/load-prompt.js';
6
6
  /**
7
7
  * Orchestrate composition-map acquisition (spec T2) and enrichment (T7).
8
8
  *
9
- * Sources by rank: user map (1) > typed-slot / "code slots" (2) > agent (4).
9
+ * Sources by rank: user map (1) > typed-slot / "code slots" (2) > structural
10
+ * usage evidence (3) > adapter-resolved / extraEdges (4) > agent (5).
10
11
  * ALL sources — including the code slots already on the incoming components —
11
12
  * are fed into one ranked merge and unioned; non-conflicting edges from every
12
13
  * source survive, and on a conflict (same parent+child, different slot) the
@@ -33,18 +34,30 @@ export async function resolveMapping(input) {
33
34
  }
34
35
  }
35
36
  }
37
+ // Rank 3 — structural usage evidence (runtime type-predicate, `.type ===`
38
+ // identity check, or direct JSX nesting — see structural-slot-evidence.ts).
39
+ // Lower trust than a declared slot contract, but still code-derived, so it
40
+ // outranks the agent and suppresses a redundant agent run when it alone
41
+ // covers a parent.
42
+ for (const c of input.components) {
43
+ for (const slot of c.slots) {
44
+ for (const child of slot.structuralAllowedComponents ?? []) {
45
+ collected.push({ parent: c.name, child, slot: slot.name, provenance: 'structural' });
46
+ }
47
+ }
48
+ }
36
49
  // Rank 1 — user-provided map.
37
50
  if (input.userMap) {
38
51
  collected.push(...groupsToEdges(input.userMap, 'user'));
39
52
  }
40
- // Externally pre-resolved edges (e.g. agent-authored parser, rank 3).
53
+ // Externally pre-resolved edges (e.g. adapter-authored parser, rank 4).
41
54
  if (input.extraEdges) {
42
55
  collected.push(...input.extraEdges);
43
56
  }
44
57
  // Routing: which parents are already covered by a higher-rank source?
45
58
  const coveredParents = new Set(collected.map((e) => e.parent));
46
59
  const residueParents = input.components.map((c) => c.name).filter((n) => !coveredParents.has(n));
47
- // Rank 4 — agent. Runs when enabled AND (forced OR there is residue).
60
+ // Rank 5 — agent. Runs when enabled AND (forced OR there is residue).
48
61
  const shouldRunAgent = (input.useAgent || input.forceAgent) && (input.forceAgent || residueParents.length > 0);
49
62
  if (shouldRunAgent) {
50
63
  const prompt = input.buildPrompt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.20.2-dev-build-e7403ea.0",
3
+ "version": "2.20.2-dev-build-67c8a28.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,17 +31,17 @@
31
31
  "commander": "^13.1.0",
32
32
  "ink": "^4.4.1",
33
33
  "react": "^18.3.1",
34
- "react-devtools-core": "^4.28.5",
34
+ "react-devtools-core": "^4.19.1",
35
35
  "react-dom": "^18.3.1",
36
- "@contentful/experience-design-system-client": "2.20.2-dev-build-e7403ea.0",
37
- "@contentful/experience-design-system-generation": "2.20.2-dev-build-e7403ea.0",
38
- "@contentful/experience-design-system-extraction": "2.20.2-dev-build-e7403ea.0",
39
- "@contentful/experience-design-system-types": "2.20.2-dev-build-e7403ea.0"
36
+ "@contentful/experience-design-system-client": "2.20.2-dev-build-67c8a28.0",
37
+ "@contentful/experience-design-system-extraction": "2.20.2-dev-build-67c8a28.0",
38
+ "@contentful/experience-design-system-generation": "2.20.2-dev-build-67c8a28.0",
39
+ "@contentful/experience-design-system-types": "2.20.2-dev-build-67c8a28.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@tsconfig/node24": "^24.0.4",
43
43
  "@types/node": "^24.0.3",
44
- "@types/react": "^18.3.31",
44
+ "@types/react": "^18.3.24",
45
45
  "eslint": "^9.39.5",
46
46
  "eslint-config-prettier": "^10.1.8",
47
47
  "eslint-plugin-prettier": "^5.5.6",