@contentful/experience-design-system-cli 2.35.1-dev-build-35ec3f8d.0 → 2.35.1-dev-build-9605c7ee.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.35.1-dev-build-35ec3f8d.0",
3
+ "version": "2.35.1-dev-build-9605c7ee.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -198,6 +198,62 @@ var init_validate_generation_request = __esm({
198
198
  }
199
199
  });
200
200
 
201
+ // packages/experience-design-system-generation/dist/src/services/prompts/helpers/resolve-skill-file.js
202
+ import { existsSync } from "node:fs";
203
+ import { readFile as readFile2 } from "node:fs/promises";
204
+ import { dirname, join as join2, resolve } from "node:path";
205
+ import { fileURLToPath } from "node:url";
206
+ function resolveSkillPath(skill) {
207
+ if (!(skill in SKILL_FILES))
208
+ throw new Error(`Invalid skill: ${skill}`);
209
+ const thisDir = dirname(fileURLToPath(import.meta.url));
210
+ let dir = thisDir;
211
+ for (; ; ) {
212
+ const candidate = join2(dir, "skills");
213
+ if (existsSync(candidate))
214
+ return join2(candidate, SKILL_FILES[skill]);
215
+ const parent = resolve(dir, "..");
216
+ if (parent === dir) {
217
+ throw new Error(`skill file missing from CLI installation (could not locate skills/ directory from: ${thisDir})`);
218
+ }
219
+ dir = parent;
220
+ }
221
+ }
222
+ function formatCustomPromptBanner(skill, path) {
223
+ return `WARNING: Custom prompt active for ${skill}: ${path}
224
+ Bundled invariants (utility-wrapper rejection, description content rules) do NOT apply.
225
+ You are responsible for the prompt's correctness.
226
+ `;
227
+ }
228
+ async function readSkillFile(skill, override) {
229
+ if (override) {
230
+ const skillPath2 = resolve(override);
231
+ try {
232
+ return await readFile2(skillPath2, "utf8");
233
+ } catch {
234
+ throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
235
+ }
236
+ }
237
+ const skillPath = resolveSkillPath(skill);
238
+ try {
239
+ return await readFile2(skillPath, "utf8");
240
+ } catch {
241
+ throw new Error(`skill file missing from CLI installation \u2014 try reinstalling the CLI (looked for: ${skillPath})`);
242
+ }
243
+ }
244
+ var SKILL_FILES;
245
+ var init_resolve_skill_file = __esm({
246
+ "packages/experience-design-system-generation/dist/src/services/prompts/helpers/resolve-skill-file.js"() {
247
+ "use strict";
248
+ SKILL_FILES = {
249
+ components: "generate-components.md",
250
+ tokens: "generate-tokens.md",
251
+ select: "select-components.md",
252
+ "map-tokens": "map-tokens.md"
253
+ };
254
+ }
255
+ });
256
+
201
257
  // packages/experience-design-system-generation/dist/src/services/prompts/helpers/format-token-candidates.js
202
258
  import { flattenDTCG } from "@contentful/experience-design-system-types";
203
259
  function inferFenceLang(filename) {
@@ -282,6 +338,51 @@ var init_format_token_candidates = __esm({
282
338
  }
283
339
  });
284
340
 
341
+ // packages/experience-design-system-generation/dist/src/services/prompts/helpers/format-source-refs.js
342
+ function formatSourceRefBlock(ref) {
343
+ const mainBlock = `#### ${ref.component} (\`${ref.sourcePath}\`)
344
+ \`\`\`${inferFenceLang(ref.sourcePath)}
345
+ ${ref.content}
346
+ \`\`\``;
347
+ const siblingBlocks = (ref.siblingFiles ?? []).map((sibling) => `##### ${ref.component} \u2014 imported file \`${sibling.path}\`
348
+ \`\`\`${inferFenceLang(sibling.path)}
349
+ ${sibling.content}
350
+ \`\`\``);
351
+ const truncationNote = ref.truncatedSiblingCount && ref.truncatedSiblingCount > 0 ? [
352
+ `##### ${ref.component} \u2014 +${ref.truncatedSiblingCount} more imported file${ref.truncatedSiblingCount === 1 ? "" : "s"} not shown (evidence may be incomplete)`
353
+ ] : [];
354
+ const notShownNote = ref.usesNotShown && ref.usesNotShown.length > 0 ? [
355
+ `##### ${ref.component} \u2014 uses not shown: ${ref.usesNotShown.join(", ")}
356
+
357
+ The files above are excerpts, and each of these properties has at least one use that fell outside the excerpt budget. Treat their consumption as unknown, not absent: do not classify them \`token\` on what is shown, and do not conclude they are unread.`
358
+ ] : [];
359
+ return [mainBlock, ...siblingBlocks, ...truncationNote, ...notShownNote].join("\n\n");
360
+ }
361
+ function formatSourceRefsSection(refs, skill) {
362
+ const sections = [];
363
+ const withContent = refs.filter((ref) => ref.content != null);
364
+ const withoutContent = refs.filter((ref) => ref.content == null);
365
+ if (withContent.length > 0) {
366
+ sections.push(`### Component source references
367
+
368
+ ${withContent.map(formatSourceRefBlock).join("\n\n")}`);
369
+ }
370
+ if (withoutContent.length > 0) {
371
+ const guidance = skill === "components" ? "there is no consumption evidence for these, so `token` cannot be earned for any of their props \u2014 classify from the prop signature alone, and any prop that would otherwise be enum-versus-token is `enum` (or `string`)" : "there is no source evidence to narrow from \u2014 emit nothing for their props";
372
+ sections.push(`Component source unavailable for (JSON) \u2014 ${guidance}:
373
+ \`\`\`json
374
+ ${JSON.stringify(withoutContent.map((ref) => ({ component: ref.component, sourcePath: ref.sourcePath })))}
375
+ \`\`\``);
376
+ }
377
+ return sections;
378
+ }
379
+ var init_format_source_refs = __esm({
380
+ "packages/experience-design-system-generation/dist/src/services/prompts/helpers/format-source-refs.js"() {
381
+ "use strict";
382
+ init_format_token_candidates();
383
+ }
384
+ });
385
+
285
386
  // packages/experience-design-system-generation/dist/src/services/prompts/helpers/build-skill-preambles.js
286
387
  function buildComponentsAutonomousPreamble(inputBlock) {
287
388
  return `You are running as part of the experience-design-system-cli generate pipeline in AUTONOMOUS mode. The developer is not present to answer questions.
@@ -415,49 +516,7 @@ var init_build_skill_preambles = __esm({
415
516
  }
416
517
  });
417
518
 
418
- // packages/experience-design-system-generation/dist/src/services/prompts/build-prompt.js
419
- import { existsSync } from "node:fs";
420
- import { readFile as readFile2 } from "node:fs/promises";
421
- import { dirname, join as join2, resolve } from "node:path";
422
- import { fileURLToPath } from "node:url";
423
- function resolveSkillPath(skill) {
424
- if (!(skill in SKILL_FILES))
425
- throw new Error(`Invalid skill: ${skill}`);
426
- const thisDir = dirname(fileURLToPath(import.meta.url));
427
- let dir = thisDir;
428
- for (; ; ) {
429
- const candidate = join2(dir, "skills");
430
- if (existsSync(candidate))
431
- return join2(candidate, SKILL_FILES[skill]);
432
- const parent = resolve(dir, "..");
433
- if (parent === dir) {
434
- throw new Error(`skill file missing from CLI installation (could not locate skills/ directory from: ${thisDir})`);
435
- }
436
- dir = parent;
437
- }
438
- }
439
- function formatCustomPromptBanner(skill, path) {
440
- return `WARNING: Custom prompt active for ${skill}: ${path}
441
- Bundled invariants (utility-wrapper rejection, description content rules) do NOT apply.
442
- You are responsible for the prompt's correctness.
443
- `;
444
- }
445
- async function readSkillFile(skill, override) {
446
- if (override) {
447
- const skillPath2 = resolve(override);
448
- try {
449
- return await readFile2(skillPath2, "utf8");
450
- } catch {
451
- throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath2})`);
452
- }
453
- }
454
- const skillPath = resolveSkillPath(skill);
455
- try {
456
- return await readFile2(skillPath, "utf8");
457
- } catch {
458
- throw new Error(`skill file missing from CLI installation \u2014 try reinstalling the CLI (looked for: ${skillPath})`);
459
- }
460
- }
519
+ // packages/experience-design-system-generation/dist/src/services/prompts/helpers/build-preamble.js
461
520
  function buildPreamble(options) {
462
521
  const { skill, rawComponentsInline, rawTokensInline, rawTokensFilename, tokensInline, tokenMapInline, generatedCdf, tokenTree, componentSourceRefs, existingComponentsInline, existingTokensInline, componentAllowlistInline } = options;
463
522
  const sections = [];
@@ -513,44 +572,10 @@ ${JSON.stringify(filteredTokenProps.filtered)}
513
572
  \`\`\``);
514
573
  }
515
574
  if (tokenTree) {
516
- for (const section2 of buildTokenCandidateSections(tokenTree, filteredTokenProps)) {
517
- sections.push(section2);
518
- }
575
+ sections.push(...buildTokenCandidateSections(tokenTree, filteredTokenProps));
519
576
  }
520
577
  if (componentSourceRefs && componentSourceRefs.length > 0) {
521
- const withContent = componentSourceRefs.filter((ref) => ref.content != null);
522
- const withoutContent = componentSourceRefs.filter((ref) => ref.content == null);
523
- if (withContent.length > 0) {
524
- const blocks = withContent.map((ref) => {
525
- const mainBlock = `#### ${ref.component} (\`${ref.sourcePath}\`)
526
- \`\`\`${inferFenceLang(ref.sourcePath)}
527
- ${ref.content}
528
- \`\`\``;
529
- const siblingBlocks = (ref.siblingFiles ?? []).map((sibling) => `##### ${ref.component} \u2014 imported file \`${sibling.path}\`
530
- \`\`\`${inferFenceLang(sibling.path)}
531
- ${sibling.content}
532
- \`\`\``);
533
- const truncationNote = ref.truncatedSiblingCount && ref.truncatedSiblingCount > 0 ? [
534
- `##### ${ref.component} \u2014 +${ref.truncatedSiblingCount} more imported file${ref.truncatedSiblingCount === 1 ? "" : "s"} not shown (evidence may be incomplete)`
535
- ] : [];
536
- const notShownNote = ref.usesNotShown && ref.usesNotShown.length > 0 ? [
537
- `##### ${ref.component} \u2014 uses not shown: ${ref.usesNotShown.join(", ")}
538
-
539
- The files above are excerpts, and each of these properties has at least one use that fell outside the excerpt budget. Treat their consumption as unknown, not absent: do not classify them \`token\` on what is shown, and do not conclude they are unread.`
540
- ] : [];
541
- return [mainBlock, ...siblingBlocks, ...truncationNote, ...notShownNote].join("\n\n");
542
- });
543
- sections.push(`### Component source references
544
-
545
- ${blocks.join("\n\n")}`);
546
- }
547
- if (withoutContent.length > 0) {
548
- const guidance = skill === "components" ? "there is no consumption evidence for these, so `token` cannot be earned for any of their props \u2014 classify from the prop signature alone, and any prop that would otherwise be enum-versus-token is `enum` (or `string`)" : "there is no source evidence to narrow from \u2014 emit nothing for their props";
549
- sections.push(`Component source unavailable for (JSON) \u2014 ${guidance}:
550
- \`\`\`json
551
- ${JSON.stringify(withoutContent.map((ref) => ({ component: ref.component, sourcePath: ref.sourcePath })))}
552
- \`\`\``);
553
- }
578
+ sections.push(...formatSourceRefsSection(componentSourceRefs, skill));
554
579
  }
555
580
  const inputBlock = sections.length > 0 ? `
556
581
 
@@ -563,6 +588,16 @@ ${sections.join("\n\n")}` : "";
563
588
  return buildMapTokensAutonomousPreamble(inputBlock);
564
589
  return buildTokensAutonomousPreamble(inputBlock);
565
590
  }
591
+ var init_build_preamble = __esm({
592
+ "packages/experience-design-system-generation/dist/src/services/prompts/helpers/build-preamble.js"() {
593
+ "use strict";
594
+ init_format_token_candidates();
595
+ init_format_source_refs();
596
+ init_build_skill_preambles();
597
+ }
598
+ });
599
+
600
+ // packages/experience-design-system-generation/dist/src/services/prompts/build-prompt.js
566
601
  async function buildPrompt(options) {
567
602
  const skillContent = options.skillContentOverride ?? await readSkillFile(options.skill, options.skillPathOverride);
568
603
  const preamble = buildPreamble(options);
@@ -572,18 +607,12 @@ Skill instructions follow:
572
607
  ---
573
608
  ${skillContent}`;
574
609
  }
575
- var SKILL_FILES;
576
610
  var init_build_prompt = __esm({
577
611
  "packages/experience-design-system-generation/dist/src/services/prompts/build-prompt.js"() {
578
612
  "use strict";
579
- init_format_token_candidates();
580
- init_build_skill_preambles();
581
- SKILL_FILES = {
582
- components: "generate-components.md",
583
- tokens: "generate-tokens.md",
584
- select: "select-components.md",
585
- "map-tokens": "map-tokens.md"
586
- };
613
+ init_resolve_skill_file();
614
+ init_build_preamble();
615
+ init_resolve_skill_file();
587
616
  }
588
617
  });
589
618
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.35.1-dev-build-35ec3f8d.0",
3
+ "version": "2.35.1-dev-build-9605c7ee.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.35.1-dev-build-35ec3f8d.0",
3
+ "version": "2.35.1-dev-build-9605c7ee.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "svelte": "^5.56.4",
42
42
  "ts-morph": "^27.0.2",
43
43
  "typescript": "^5.9.3",
44
- "@contentful/experience-design-system-types": "2.35.1-dev-build-35ec3f8d.0"
44
+ "@contentful/experience-design-system-types": "2.35.1-dev-build-9605c7ee.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@tsconfig/node24": "^24.0.4",