@contentful/experience-design-system-cli 2.32.1-dev-build-403b769.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 +1 -1
- package/dist/src/helpers/build-contentful-management-client.d.ts +7 -0
- package/dist/src/helpers/fetch-and-persist-existing-contentful-entities.d.ts +29 -0
- package/dist/src/helpers/fetch-existing-contentful-entities.d.ts +11 -0
- package/dist/src/helpers/find-nearly-matching-component.d.ts +7 -0
- package/dist/src/helpers/read-existing-contentful-entities-from-session.d.ts +7 -0
- package/dist/src/helpers/summarize-existing-contentful-entities.d.ts +50 -0
- package/dist/src/import/orchestrator.d.ts +0 -1
- package/dist/src/import/tui/WizardApp.d.ts +3 -0
- package/dist/src/index.js +483 -223
- package/dist/src/session/cache-keys.d.ts +1 -1
- package/package.json +6 -6
- package/skills/generate-components.md +27 -0
- package/skills/map-tokens.md +12 -0
- package/skills/select-components.md +11 -0
- package/dist/src/helpers/cma-client.d.ts +0 -17
- package/dist/src/helpers/fetch-existing-entities.d.ts +0 -16
|
@@ -19,4 +19,4 @@ export declare function hashFile(filePath: string): Promise<string>;
|
|
|
19
19
|
* @param model — resolved model for this run (undefined resolves to the agent's default)
|
|
20
20
|
* @param skillPathOverride — optional absolute/relative path to a custom prompt
|
|
21
21
|
*/
|
|
22
|
-
export declare function hashPromptForSkill(skill: Skill, agent: string, model: string | undefined, skillPathOverride?: string): Promise<string>;
|
|
22
|
+
export declare function hashPromptForSkill(skill: Skill, agent: string, model: string | undefined, skillPathOverride?: string, extraInputs?: string[]): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.32.1-dev-build-
|
|
3
|
+
"version": "2.32.1-dev-build-b7d2d34.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"svelte": "^5.56.4",
|
|
41
41
|
"ts-morph": "^27.0.2",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
|
-
"@contentful/experience-design-system-cli-v2": "2.32.1-dev-build-
|
|
44
|
-
"@contentful/experience-design-system-types": "2.32.1-dev-build-
|
|
43
|
+
"@contentful/experience-design-system-cli-v2": "2.32.1-dev-build-b7d2d34.0",
|
|
44
|
+
"@contentful/experience-design-system-types": "2.32.1-dev-build-b7d2d34.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"ink-testing-library": "^4.0.0",
|
|
54
54
|
"typescript-eslint": "^8.67.0",
|
|
55
55
|
"vitest": "^4.0.16",
|
|
56
|
-
"@contentful/experience-design-system-
|
|
57
|
-
"@contentful/experience-design-system-
|
|
58
|
-
"@contentful/experience-design-system-extraction": "2.32.1-dev-build-
|
|
56
|
+
"@contentful/experience-design-system-client": "2.32.1-dev-build-b7d2d34.0",
|
|
57
|
+
"@contentful/experience-design-system-generation": "2.32.1-dev-build-b7d2d34.0",
|
|
58
|
+
"@contentful/experience-design-system-extraction": "2.32.1-dev-build-b7d2d34.0"
|
|
59
59
|
},
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
@@ -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.
|
package/skills/map-tokens.md
CHANGED
|
@@ -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.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type PlainClientAPI } from 'contentful-management';
|
|
2
|
-
interface CreateCmaClientOptions {
|
|
3
|
-
cmaToken: string;
|
|
4
|
-
/**
|
|
5
|
-
* Optional CMA host override. Accepts either a full URL
|
|
6
|
-
* (`https://api.contentful.com`) or a bare hostname (`api.contentful.com`);
|
|
7
|
-
* contentful-management wants the bare form so we normalize here.
|
|
8
|
-
*/
|
|
9
|
-
host?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Build a plain contentful-management client. Single place that picks the
|
|
13
|
-
* `{ type: 'plain' }` overload so callers never have to think about it,
|
|
14
|
-
* and normalizes host into the bare-hostname shape the SDK expects.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createCmaClient(opts: CreateCmaClientOptions): PlainClientAPI;
|
|
17
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type ComponentProps, type DesignTokenProps, type PlainClientAPI } from 'contentful-management';
|
|
2
|
-
export interface ExistingEntities {
|
|
3
|
-
components: ComponentProps[];
|
|
4
|
-
tokens: DesignTokenProps[];
|
|
5
|
-
}
|
|
6
|
-
interface FetchExistingEntitiesParams {
|
|
7
|
-
spaceId: string;
|
|
8
|
-
environmentId: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Fetch all existing Components + DesignTokens for a space+env. Pagination
|
|
12
|
-
* is delegated to the SDK's `fetchAll()` helper. Caller supplies the
|
|
13
|
-
* pre-built plain client (see `createCmaClient()`).
|
|
14
|
-
*/
|
|
15
|
-
export declare function fetchExistingEntities(client: PlainClientAPI, params: FetchExistingEntitiesParams): Promise<ExistingEntities>;
|
|
16
|
-
export {};
|