@contentful/experience-design-system-cli 2.26.5-dev-build-e549301.0 → 2.26.5-dev-build-00663c7.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/index.js +6 -48
- package/dist/src/session/db.d.ts +0 -1
- package/package.json +5 -5
- package/skills/generate-components.md +3 -3
package/dist/package.json
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -118,16 +118,6 @@ function parseToolCallLines(stdout) {
|
|
|
118
118
|
if (typeof rec.reason === "string")
|
|
119
119
|
call.reason = rec.reason;
|
|
120
120
|
calls.push(call);
|
|
121
|
-
} else if (tool === "exclude_prop") {
|
|
122
|
-
if (typeof rec.prop !== "string" || !rec.prop) {
|
|
123
|
-
warnings.push("exclude_prop missing prop name \u2014 skipped");
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
calls.push({
|
|
127
|
-
tool: "exclude_prop",
|
|
128
|
-
prop: rec.prop,
|
|
129
|
-
reason: typeof rec.reason === "string" ? rec.reason : ""
|
|
130
|
-
});
|
|
131
121
|
} else if (tool === "classify_component") {
|
|
132
122
|
const call = { tool: "classify_component" };
|
|
133
123
|
if (typeof rec.description === "string")
|
|
@@ -383,7 +373,7 @@ var init_agent_runner = __esm({
|
|
|
383
373
|
"use strict";
|
|
384
374
|
init_agent_names();
|
|
385
375
|
VALID_SELECT_TOOL_NAMES = /* @__PURE__ */ new Set(["select_component", "reject_component"]);
|
|
386
|
-
VALID_TOOL_NAMES = /* @__PURE__ */ new Set(["classify_prop", "
|
|
376
|
+
VALID_TOOL_NAMES = /* @__PURE__ */ new Set(["classify_prop", "classify_component", "classify_slot"]);
|
|
387
377
|
VALID_TOKEN_TOOL_NAMES = /* @__PURE__ */ new Set(["set_token", "set_group"]);
|
|
388
378
|
VALID_CDF_TYPES = /* @__PURE__ */ new Set(["string", "richtext", "media", "enum", "token", "boolean"]);
|
|
389
379
|
VALID_CATEGORIES = /* @__PURE__ */ new Set(["content", "design", "state"]);
|
|
@@ -564,7 +554,7 @@ The three tool calls you may emit are:
|
|
|
564
554
|
|
|
565
555
|
Rules:
|
|
566
556
|
- Emit exactly one JSON object per line. No multi-line JSON. No markdown fences around the lines.
|
|
567
|
-
- Every prop in the input must have exactly one classify_prop call.
|
|
557
|
+
- Every prop in the input must have exactly one classify_prop call.
|
|
568
558
|
- Every slot in the input must have exactly one classify_slot call.
|
|
569
559
|
- Valid cdf_type values: string, richtext, media, enum, token, boolean
|
|
570
560
|
- Valid cdf_category values: content, design, state
|
|
@@ -8730,19 +8720,11 @@ function applyToolCalls(db, sessionId2, componentId, componentName, calls, incom
|
|
|
8730
8720
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
8731
8721
|
const warnings = [...incomingWarnings];
|
|
8732
8722
|
let classified = 0;
|
|
8733
|
-
let excluded = 0;
|
|
8734
8723
|
let slots = 0;
|
|
8735
8724
|
const updateProp = db.prepare(
|
|
8736
8725
|
`UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?, required = ?, description = ?, rationale = ?
|
|
8737
8726
|
WHERE session_id = ? AND component_id = ? AND name = ?`
|
|
8738
8727
|
);
|
|
8739
|
-
const getRawPropType = db.prepare(
|
|
8740
|
-
`SELECT type FROM raw_props WHERE session_id = ? AND component_id = ? AND name = ?`
|
|
8741
|
-
);
|
|
8742
|
-
const clearProp = db.prepare(
|
|
8743
|
-
`UPDATE raw_props SET cdf_type = ?, cdf_category = 'state', cdf_token_kind = NULL, required = 0, description = ?, rationale = ?
|
|
8744
|
-
WHERE session_id = ? AND component_id = ? AND name = ?`
|
|
8745
|
-
);
|
|
8746
8728
|
const deleteAllowedValues = db.prepare(
|
|
8747
8729
|
`DELETE FROM raw_prop_allowed_values WHERE session_id = ? AND component_id = ? AND prop_name = ?`
|
|
8748
8730
|
);
|
|
@@ -8819,18 +8801,6 @@ function applyToolCalls(db, sessionId2, componentId, componentName, calls, incom
|
|
|
8819
8801
|
).run(storedDefault, sessionId2, componentId, call.prop);
|
|
8820
8802
|
}
|
|
8821
8803
|
classified++;
|
|
8822
|
-
} else if (call.tool === "exclude_prop") {
|
|
8823
|
-
const rawProp = getRawPropType.get(sessionId2, componentId, call.prop);
|
|
8824
|
-
const fallbackType = rawProp?.type === "boolean" ? "boolean" : "string";
|
|
8825
|
-
clearProp.run(
|
|
8826
|
-
fallbackType,
|
|
8827
|
-
"Not exposed for content or design editing.",
|
|
8828
|
-
call.reason || null,
|
|
8829
|
-
sessionId2,
|
|
8830
|
-
componentId,
|
|
8831
|
-
call.prop
|
|
8832
|
-
);
|
|
8833
|
-
excluded++;
|
|
8834
8804
|
} else if (call.tool === "classify_slot") {
|
|
8835
8805
|
const slotRequired = call.required !== void 0 ? call.required ? 1 : 0 : 1;
|
|
8836
8806
|
const slotChanges = updateSlot.run(
|
|
@@ -8870,7 +8840,7 @@ function applyToolCalls(db, sessionId2, componentId, componentName, calls, incom
|
|
|
8870
8840
|
db.exec("ROLLBACK");
|
|
8871
8841
|
throw e;
|
|
8872
8842
|
}
|
|
8873
|
-
return { classified,
|
|
8843
|
+
return { classified, slots, warnings };
|
|
8874
8844
|
}
|
|
8875
8845
|
function getOrCreateSession(db, sessionFlag, sessionName, _hints) {
|
|
8876
8846
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -9345,9 +9315,8 @@ function loadCDFComponents(db, sessionId2) {
|
|
|
9345
9315
|
).all(sessionId2);
|
|
9346
9316
|
if (components.length === 0) return [];
|
|
9347
9317
|
const props = db.prepare(
|
|
9348
|
-
//
|
|
9349
|
-
//
|
|
9350
|
-
// persisted before that change.
|
|
9318
|
+
// Guards against stale rows in session DBs persisted before props
|
|
9319
|
+
// were guaranteed to always be classified into content/design/state.
|
|
9351
9320
|
`SELECT component_id, name, required, default_value, description,
|
|
9352
9321
|
cdf_type, cdf_category, cdf_token_kind, position
|
|
9353
9322
|
FROM raw_props
|
|
@@ -28499,11 +28468,6 @@ function formatToolCall(obj) {
|
|
|
28499
28468
|
const cat = String(obj["cdf_category"] ?? "");
|
|
28500
28469
|
return ` ${c.green("+")} ${prop} ${c.dim(`${type} ${cat}`)}`;
|
|
28501
28470
|
}
|
|
28502
|
-
case "exclude_prop": {
|
|
28503
|
-
const prop = String(obj["prop"] ?? "");
|
|
28504
|
-
const reason = typeof obj["reason"] === "string" ? obj["reason"] : "";
|
|
28505
|
-
return ` ${c.dim("\u2013")} ${prop} ${c.dim(reason)}`;
|
|
28506
|
-
}
|
|
28507
28471
|
case "classify_slot": {
|
|
28508
28472
|
const slot = String(obj["slot"] ?? "");
|
|
28509
28473
|
const desc = typeof obj["description"] === "string" ? obj["description"] : "";
|
|
@@ -31009,7 +30973,6 @@ async function runOneComponent(agent, model, db, sessionId2, component, tokensIn
|
|
|
31009
30973
|
return {
|
|
31010
30974
|
componentName: component.name,
|
|
31011
30975
|
classified: 0,
|
|
31012
|
-
excluded: 0,
|
|
31013
30976
|
slots: 0,
|
|
31014
30977
|
warnings: [],
|
|
31015
30978
|
failed: false,
|
|
@@ -31025,7 +30988,6 @@ async function runOneComponent(agent, model, db, sessionId2, component, tokensIn
|
|
|
31025
30988
|
return {
|
|
31026
30989
|
componentName: component.name,
|
|
31027
30990
|
classified: 0,
|
|
31028
|
-
excluded: 0,
|
|
31029
30991
|
slots: 0,
|
|
31030
30992
|
warnings: [`${component.name}: source changed but human edits preserved`],
|
|
31031
30993
|
failed: false,
|
|
@@ -31094,7 +31056,6 @@ ${outputBuf}`);
|
|
|
31094
31056
|
return {
|
|
31095
31057
|
componentName: component.name,
|
|
31096
31058
|
classified: 0,
|
|
31097
|
-
excluded: 0,
|
|
31098
31059
|
slots: 0,
|
|
31099
31060
|
warnings: [],
|
|
31100
31061
|
failed: true,
|
|
@@ -31119,7 +31080,6 @@ ${outputBuf}`);
|
|
|
31119
31080
|
return {
|
|
31120
31081
|
componentName: component.name,
|
|
31121
31082
|
classified: applied.classified,
|
|
31122
|
-
excluded: applied.excluded,
|
|
31123
31083
|
slots: applied.slots,
|
|
31124
31084
|
warnings: applied.warnings,
|
|
31125
31085
|
failed: false,
|
|
@@ -31129,7 +31089,6 @@ ${outputBuf}`);
|
|
|
31129
31089
|
return {
|
|
31130
31090
|
componentName: component.name,
|
|
31131
31091
|
classified: 0,
|
|
31132
|
-
excluded: 0,
|
|
31133
31092
|
slots: 0,
|
|
31134
31093
|
warnings: [],
|
|
31135
31094
|
failed: true,
|
|
@@ -31355,12 +31314,11 @@ async function runGenerateSkill(skill, opts, verbose = false) {
|
|
|
31355
31314
|
}
|
|
31356
31315
|
}
|
|
31357
31316
|
const totalClassified = generated.reduce((s, r) => s + r.classified, 0);
|
|
31358
|
-
const totalExcluded = generated.reduce((s, r) => s + r.excluded, 0);
|
|
31359
31317
|
const totalRenamedSlots = componentResults.reduce((s, r) => s + r.renamedSlotsCount, 0);
|
|
31360
31318
|
const allOk = failed.length === 0;
|
|
31361
31319
|
const cachedNote = cachedResults.length > 0 ? c.dim(` (${cachedResults.length} cached)`) : "";
|
|
31362
31320
|
process.stderr.write(
|
|
31363
|
-
(allOk ? c.green("\u2713") : c.yellow("\u26A0")) + ` ${generated.length + cachedResults.length}/${componentResults.length} components` + cachedNote + c.dim(` ${totalClassified} classified
|
|
31321
|
+
(allOk ? c.green("\u2713") : c.yellow("\u26A0")) + ` ${generated.length + cachedResults.length}/${componentResults.length} components` + cachedNote + c.dim(` ${totalClassified} classified`) + "\n"
|
|
31364
31322
|
);
|
|
31365
31323
|
process.stdout.write(`renamed-slots: ${totalRenamedSlots}
|
|
31366
31324
|
`);
|
package/dist/src/session/db.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-cli",
|
|
3
|
-
"version": "2.26.5-dev-build-
|
|
3
|
+
"version": "2.26.5-dev-build-00663c7.0",
|
|
4
4
|
"description": "Contentful Experiences design system import CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"svelte": "^5.56.4",
|
|
40
40
|
"ts-morph": "^27.0.2",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
|
-
"@contentful/experience-design-system-types": "2.26.5-dev-build-
|
|
42
|
+
"@contentful/experience-design-system-types": "2.26.5-dev-build-00663c7.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@tsconfig/node24": "^24.0.4",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"ink-testing-library": "^4.0.0",
|
|
52
52
|
"typescript-eslint": "^8.67.0",
|
|
53
53
|
"vitest": "^4.0.16",
|
|
54
|
-
"@contentful/experience-design-system-
|
|
55
|
-
"@contentful/experience-design-system-
|
|
56
|
-
"@contentful/experience-design-system-generation": "2.26.5-dev-build-
|
|
54
|
+
"@contentful/experience-design-system-client": "2.26.5-dev-build-00663c7.0",
|
|
55
|
+
"@contentful/experience-design-system-extraction": "2.26.5-dev-build-00663c7.0",
|
|
56
|
+
"@contentful/experience-design-system-generation": "2.26.5-dev-build-00663c7.0"
|
|
57
57
|
},
|
|
58
58
|
"repository": {
|
|
59
59
|
"type": "git",
|
|
@@ -66,7 +66,7 @@ It is correct approximately 80% of the time for simple props. You should:
|
|
|
66
66
|
|
|
67
67
|
## Target schema
|
|
68
68
|
|
|
69
|
-
The CLI assembles your output into CDF (Component Definition Format), a JSON schema with `$schema: "https://contentful.com/schemas/cdf/v1"`. Each component you classify produces a CDF component entry (`$type: "component"`) in the pipeline database. Properties carry `$category` (`content`, `design`, or `state`) and a `$type`.
|
|
69
|
+
The CLI assembles your output into CDF (Component Definition Format), a JSON schema with `$schema: "https://contentful.com/schemas/cdf/v1"`. Each component you classify produces a CDF component entry (`$type: "component"`) in the pipeline database. Properties carry `$category` (`content`, `design`, or `state`) and a `$type`. You do not produce this JSON directly — emit tool calls and the CLI writes the DB columns.
|
|
70
70
|
|
|
71
71
|
## Output protocol
|
|
72
72
|
|
|
@@ -82,7 +82,7 @@ Emit one JSON object per line. The CLI parses lines starting with `{`. Lines not
|
|
|
82
82
|
{"tool":"classify_slot","slot":"<slotName>","required":<bool>,"allowed_components":["ComponentName"],"description":"<short customer-facing description>","rationale":"<why this slot was kept / its role>"}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Every prop — including framework internals, DOM/accessibility pass-through, and props with no clean flat representation — must produce a `classify_prop` call. Props that are not marketer-configurable are classified with `cdf_category: "state"`: they still ship in the CDF (visible in review, editable if someone wants to override the category), but stay unattached from the content/design editing surfaces by default. See "Valid cdf_category values" below for exactly what falls into `state`.
|
|
86
86
|
|
|
87
87
|
**Rules:**
|
|
88
88
|
- Emit exactly one JSON object per line. No multi-line JSON.
|
|
@@ -135,7 +135,7 @@ Exactly **6** valid types:
|
|
|
135
135
|
|---|---|
|
|
136
136
|
| `content` | Data the component *displays* — what a copywriter or editor fills in: text, labels, headings, body copy, rich text, images, media, URLs, link targets, counts, locale |
|
|
137
137
|
| `design` | Values that control *how the component looks* — what a designer sets: color, size (sm/md/lg), variant (primary/secondary/ghost), layout orientation, alignment, background, visual toggles (imageOnLeft, enableEffect), design tokens |
|
|
138
|
-
| `state` | Two groups, both unattached from the content/design editing surfaces by default: (1) runtime behavioral or interactive flags — disabled, loading, expanded, isOpen, isSearchVisible, preview, identifiers used for analytics/tracking (componentId, sectionKey, componentName); (2) props that aren't marketer-configurable at all — framework internals, DOM/accessibility pass-through, callbacks, refs, and any type with no clean flat representation.
|
|
138
|
+
| `state` | Two groups, both unattached from the content/design editing surfaces by default: (1) runtime behavioral or interactive flags — disabled, loading, expanded, isOpen, isSearchVisible, preview, identifiers used for analytics/tracking (componentId, sectionKey, componentName); (2) props that aren't marketer-configurable at all — framework internals, DOM/accessibility pass-through, callbacks, refs, and any type with no clean flat representation. |
|
|
139
139
|
|
|
140
140
|
The pre-classified `category` in the raw input is a starting point — correct it when it is wrong. Contentful uses this category to decide where the property appears in the editor UI, so accuracy matters.
|
|
141
141
|
|