@contentful/experience-design-system-generation 2.28.1-dev-build-33dbed8.0 → 2.28.1-dev-build-a917752.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/agent-runner.d.ts +2 -0
- package/dist/src/agent-runner.js +11 -5
- package/package.json +2 -2
- package/skills/generate-components.md +34 -10
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-generation",
|
|
3
|
-
"version": "2.28.1-dev-build-
|
|
3
|
+
"version": "2.28.1-dev-build-a917752.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",
|
|
@@ -86,6 +86,8 @@ export interface ParsedTokenToolCalls {
|
|
|
86
86
|
export interface ParsedToolCalls {
|
|
87
87
|
calls: ToolCall[];
|
|
88
88
|
warnings: string[];
|
|
89
|
+
/** True when a line was lost outright (unparseable, or no `tool` field) — a retry signal, distinct from a parsed-but-rejected call. */
|
|
90
|
+
hadDroppedLine: boolean;
|
|
89
91
|
}
|
|
90
92
|
export declare function parseToolCallLines(stdout: string): ParsedToolCalls;
|
|
91
93
|
export declare function parseTokenToolCallLines(stdout: string): ParsedTokenToolCalls;
|
package/dist/src/agent-runner.js
CHANGED
|
@@ -26,12 +26,13 @@ function findJsonObjectEnd(line) {
|
|
|
26
26
|
return -1;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Reads an agent's stdout into
|
|
30
|
-
*
|
|
29
|
+
* Reads an agent's stdout into tool-call objects; non-`{` lines are prose.
|
|
30
|
+
* `hadDroppedLine` is true only when a line is lost outright, not rejected later.
|
|
31
31
|
*/
|
|
32
32
|
function readToolCallObjects(stdout) {
|
|
33
33
|
const objects = [];
|
|
34
34
|
const warnings = [];
|
|
35
|
+
let hadDroppedLine = false;
|
|
35
36
|
for (const raw of stdout.split('\n')) {
|
|
36
37
|
const line = raw.trim();
|
|
37
38
|
if (!line.startsWith('{'))
|
|
@@ -39,6 +40,7 @@ function readToolCallObjects(stdout) {
|
|
|
39
40
|
const end = findJsonObjectEnd(line);
|
|
40
41
|
if (end === -1) {
|
|
41
42
|
warnings.push(`unparseable line: ${line.slice(0, 120)}`);
|
|
43
|
+
hadDroppedLine = true;
|
|
42
44
|
continue;
|
|
43
45
|
}
|
|
44
46
|
let parsed;
|
|
@@ -47,6 +49,7 @@ function readToolCallObjects(stdout) {
|
|
|
47
49
|
}
|
|
48
50
|
catch {
|
|
49
51
|
warnings.push(`unparseable line: ${line.slice(0, 120)}`);
|
|
52
|
+
hadDroppedLine = true;
|
|
50
53
|
continue;
|
|
51
54
|
}
|
|
52
55
|
const trailing = line.slice(end + 1);
|
|
@@ -56,8 +59,11 @@ function readToolCallObjects(stdout) {
|
|
|
56
59
|
if (typeof parsed === 'object' && parsed !== null && 'tool' in parsed) {
|
|
57
60
|
objects.push(parsed);
|
|
58
61
|
}
|
|
62
|
+
else {
|
|
63
|
+
hadDroppedLine = true;
|
|
64
|
+
}
|
|
59
65
|
}
|
|
60
|
-
return { objects, warnings };
|
|
66
|
+
return { objects, warnings, hadDroppedLine };
|
|
61
67
|
}
|
|
62
68
|
export function parseSelectToolCallLines(stdout) {
|
|
63
69
|
const calls = [];
|
|
@@ -93,7 +99,7 @@ const VALID_CDF_TYPES = new Set(['string', 'richtext', 'media', 'enum', 'token',
|
|
|
93
99
|
const VALID_CATEGORIES = new Set(['content', 'design', 'state']);
|
|
94
100
|
export function parseToolCallLines(stdout) {
|
|
95
101
|
const calls = [];
|
|
96
|
-
const { objects, warnings } = readToolCallObjects(stdout);
|
|
102
|
+
const { objects, warnings, hadDroppedLine } = readToolCallObjects(stdout);
|
|
97
103
|
for (const rec of objects) {
|
|
98
104
|
if (!VALID_TOOL_NAMES.has(rec.tool)) {
|
|
99
105
|
warnings.push(`unknown tool: ${String(rec.tool)}`);
|
|
@@ -181,7 +187,7 @@ export function parseToolCallLines(stdout) {
|
|
|
181
187
|
calls.push(call);
|
|
182
188
|
}
|
|
183
189
|
}
|
|
184
|
-
return { calls, warnings };
|
|
190
|
+
return { calls, warnings, hadDroppedLine };
|
|
185
191
|
}
|
|
186
192
|
export function parseTokenToolCallLines(stdout) {
|
|
187
193
|
const calls = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-generation",
|
|
3
|
-
"version": "2.28.1-dev-build-
|
|
3
|
+
"version": "2.28.1-dev-build-a917752.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.28.1-dev-build-
|
|
25
|
+
"@contentful/experience-design-system-types": "2.28.1-dev-build-a917752.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -91,7 +91,7 @@ Emit one JSON object per line. The CLI parses lines starting with `{`. Lines not
|
|
|
91
91
|
- Every prop in the input must produce exactly one call: `classify_prop` OR `exclude_prop`.
|
|
92
92
|
- Every slot must produce exactly one `classify_slot` call.
|
|
93
93
|
- Emit `classify_component` once at the start (required). The `description` field is **required** — always provide a brief description of the component's purpose.
|
|
94
|
-
- `values` is required for `cdf_type: "enum"` — must be a non-empty string array of the variant names the prop accepts.
|
|
94
|
+
- `values` is required for `cdf_type: "enum"` — must be a non-empty string array of the variant names the prop accepts. **There is no legal `enum` with a guessed list.** If the value set is shown to you anywhere in the material below — the type's own declaration, an `allowedValues` list on the raw prop, a variant/lookup map, a default, a sibling excerpt — copy it and emit `enum`. If it is shown nowhere, emit `cdf_type: "string"` and leave `values` off. `string` is an unrestricted enum: the author can still pass the real value. A guessed list silently rejects it.
|
|
95
95
|
- **Do NOT include `values` for `cdf_type: "token"`.** The two property types carry different kinds of list. An `enum` prop's list holds *variant names* the component accepts (`"primary"`, `"secondary"`). A `token` prop's list holds *design token paths* (`"color.brand.primary"`), produced by the separate token-mapping step (`$token.allowed`) — never by you. Emitting `values` on a token prop makes the definition invalid.
|
|
96
96
|
- `token_kind` is required for `cdf_type: "token"` — must be a DTCG `$type` string, e.g. `"color"`.
|
|
97
97
|
- `required` must be a JSON boolean (`true`/`false`), not a string.
|
|
@@ -364,7 +364,7 @@ as enum so the author picks "primary" and the component receives "primary".
|
|
|
364
364
|
|
|
365
365
|
---
|
|
366
366
|
|
|
367
|
-
## Category
|
|
367
|
+
## Category and required corrections
|
|
368
368
|
|
|
369
369
|
The pre-classified `category` is wrong in predictable ways. Correct silently (document in `description`):
|
|
370
370
|
|
|
@@ -375,6 +375,11 @@ The pre-classified `category` is wrong in predictable ways. Correct silently (do
|
|
|
375
375
|
|
|
376
376
|
> **Key question for category**: "Who fills this in?" — A content editor fills in `content`. A designer configures `design`. Neither fills in `state` — it comes from routing, runtime behavior, or component infrastructure.
|
|
377
377
|
|
|
378
|
+
**`required` is also a hint, and it is also wrong.** Verify it against the declaration:
|
|
379
|
+
- A prop with a default value — a `$default`, a destructure default, or a `defaultVariants` entry — is **never** `required: true`. The two together are incoherent.
|
|
380
|
+
- A prop declared `foo?:` is `required: false`, whatever the hint says.
|
|
381
|
+
- Props reached through `VariantProps<typeof x>` or a Radix/`ComponentPropsWithoutRef` base are optional unless the component's own interface redeclares them as required.
|
|
382
|
+
|
|
378
383
|
---
|
|
379
384
|
|
|
380
385
|
## Slot classification
|
|
@@ -462,14 +467,30 @@ footer is supplementary and optional
|
|
|
462
467
|
{"tool":"classify_slot","slot":"footer","required":false,"description":"Optional footer area for actions or metadata","rationale":"Footer is a supplementary region typically used for actions or metadata. Optional because most cards do not need one and the card renders correctly without it."}
|
|
463
468
|
```
|
|
464
469
|
|
|
465
|
-
### Named type (HeadingSize, ButtonVariant, etc.)
|
|
470
|
+
### Named type (HeadingSize, ButtonVariant, etc.) — do NOT infer the values
|
|
471
|
+
|
|
472
|
+
When a prop has a named TypeScript type that is not inlined as a union literal,
|
|
473
|
+
the value set is whatever that type's declaration says. A type *name* is not
|
|
474
|
+
evidence of its members: `HeadingSize` could be `h1`–`h6`, `sm|md|lg`, or
|
|
475
|
+
`s|m|l|xl`. Guessing picks one design system's vocabulary and is wrong more
|
|
476
|
+
often than it is right, and a wrong name matches no style rule — the author's
|
|
477
|
+
setting silently does nothing.
|
|
478
|
+
|
|
479
|
+
So: look for the declaration in the source shown. If it is there, copy it. If it
|
|
480
|
+
is not, **emit `string`** — `string` is an unrestricted enum, so the author stays
|
|
481
|
+
unrestricted but correct.
|
|
466
482
|
|
|
467
|
-
|
|
483
|
+
Members visible in the source shown — copy them, do not paraphrase:
|
|
484
|
+
```
|
|
485
|
+
titleSize has type HeadingSize; HeadingSize is declared in the excerpt as 'sm' | 'md' | 'lg'
|
|
486
|
+
{"tool":"classify_prop","prop":"titleSize","cdf_type":"enum","cdf_category":"design","required":false,"values":["sm","md","lg"],"description":"Heading size","reason":"Copied from the HeadingSize declaration shown in the excerpt."}
|
|
487
|
+
```
|
|
468
488
|
|
|
489
|
+
Members NOT visible in the source shown — degrade to `string`:
|
|
469
490
|
```
|
|
470
|
-
titleSize has type HeadingSize
|
|
471
|
-
|
|
472
|
-
{"tool":"classify_prop","prop":"titleSize","cdf_type":"
|
|
491
|
+
titleSize has type HeadingSize; HeadingSize is not declared anywhere in the source shown
|
|
492
|
+
no evidence for its members, so no values list — string, not a guess
|
|
493
|
+
{"tool":"classify_prop","prop":"titleSize","cdf_type":"string","cdf_category":"design","required":false,"description":"Heading size","reason":"HeadingSize is not declared in the source shown, so its members cannot be cited. Emitted as string rather than inventing a value list."}
|
|
473
494
|
```
|
|
474
495
|
|
|
475
496
|
### href prop
|
|
@@ -495,7 +516,7 @@ Before emitting any tool calls, verify:
|
|
|
495
516
|
1. Every prop in the input has exactly one `classify_prop` or `exclude_prop` call
|
|
496
517
|
2. Every slot has exactly one `classify_slot` call
|
|
497
518
|
3. `classify_component` is emitted exactly once
|
|
498
|
-
4. Every `cdf_type: "enum"` has a non-empty `values` array
|
|
519
|
+
4. Every `cdf_type: "enum"` has a non-empty `values` array taken from the material shown. A prop whose value set was shown nowhere is `cdf_type: "string"` with no `values` — never an `enum` with a plausible-looking list, and never an `exclude_prop`.
|
|
499
520
|
5. Every `cdf_type: "token"` has `token_kind` (or a warning in `description` if lookup failed) and does **not** have `values` set
|
|
500
521
|
6. No `cdf_type: "link"` — all href/url props use `string`
|
|
501
522
|
7. `required` values are JSON booleans, not strings
|
|
@@ -507,7 +528,8 @@ Before emitting any tool calls, verify:
|
|
|
507
528
|
13. `rationale.description` follows the same "Description content rules" as `description` — no internal initiative names (`INTEG-*`, `EDSI`, `DSI`, `M1`, `M2`, wave/phase references, etc.).
|
|
508
529
|
14. Every `cdf_type: "token"` prop cites a line that interpolates its value into a style **and** a token reference at that use (Q2 yes, Q3 yes), and carries no `values`. If you cannot cite both, it is `enum` or `string`; if you can, it is `token` — its type annotation is not a reason to emit `string`.
|
|
509
530
|
15. Every prop whose values are friendly names is `enum` with a non-empty `values` array, even when each name resolves to a design token internally; every prop for which Q1–Q3 could not be answered was emitted as `enum` (or `string`) with the ambiguity stated in `reason`, and no answerable prop was called ambiguous.
|
|
510
|
-
16. Every `enum`'s `values` array is copied from evidence in the
|
|
531
|
+
16. Every `enum`'s `values` array is copied from evidence in the material shown — a type declaration, an `allowedValues` list on the raw prop, a variant or lookup map, a default, in the component's own file or in any sibling excerpt — and none of it was invented. Where the value set appears nowhere, the prop is `cdf_type: "string"`, with the reason recorded in `reason`. Do not drop a prop merely because you could not enumerate its values.
|
|
532
|
+
17. No prop has `required: true` alongside a default value (`$default`, a destructure default, or a `defaultVariants` entry) — the two are incoherent. A prop declared `foo?:`, or reached through `VariantProps<typeof x>` or a Radix/`ComponentPropsWithoutRef` base without its own required redeclaration, is `required: false`.
|
|
511
533
|
|
|
512
534
|
After the run completes, the developer can validate the pipeline output with:
|
|
513
535
|
|
|
@@ -528,4 +550,6 @@ properties — this is never acceptable.
|
|
|
528
550
|
If you are genuinely uncertain about every prop, classify each as:
|
|
529
551
|
{"tool":"classify_prop","prop":"<name>","cdf_type":"string","cdf_category":"content","required":false,"description":"Uncertain classification — review recommended"}
|
|
530
552
|
|
|
531
|
-
An imperfect classification is infinitely better than no classification.
|
|
553
|
+
An imperfect classification is infinitely better than no classification. That is
|
|
554
|
+
about **classifying a prop rather than dropping it** — it is not a licence to
|
|
555
|
+
invent a `values` list. The uncertain answer is `cdf_type: "string"`, every time.
|