@contentful/experience-design-system-cli 2.37.1-dev-build-1c5cd11a.0 → 2.37.1-dev-build-a1707be5.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/app.js CHANGED
@@ -14772,7 +14772,7 @@ async function runMapTokens(request) {
14772
14772
  }
14773
14773
  const agent = request.agent;
14774
14774
  const noCache = request.cache === false || process.env["EDS_NO_CACHE"] === "1";
14775
- const promptHash = await hashPromptForSkill("map-tokens", agent, request.model, void 0, request.existingEntitiesInline ? [hashContent(request.existingEntitiesInline)] : [], request.skillContentOverride);
14775
+ const promptHash = await hashPromptForSkill("map-tokens", agent, request.model, request.skillPathOverride, request.existingEntitiesInline ? [hashContent(request.existingEntitiesInline)] : [], request.skillContentOverride);
14776
14776
  const inputHash = computeMapTokensInputHash(db, sessionId, componentSourceRefs);
14777
14777
  if (!noCache) {
14778
14778
  const cached = lookupCache(db, inputHash, "token_mapping", "__map_tokens__", promptHash);
@@ -16241,6 +16241,37 @@ init_build_prompt();
16241
16241
  init_describe_agent_failure();
16242
16242
  init_invoke_agent_with_output();
16243
16243
  init_parse_tool_calls();
16244
+
16245
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-cached-component-result.js
16246
+ function buildCachedComponentResult(componentName, warnings = []) {
16247
+ return {
16248
+ componentName,
16249
+ classified: 0,
16250
+ excluded: 0,
16251
+ slots: 0,
16252
+ warnings,
16253
+ failed: false,
16254
+ cached: true,
16255
+ renamedSlotsCount: 0
16256
+ };
16257
+ }
16258
+
16259
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-failed-component-result.js
16260
+ function buildFailedComponentResult(componentName, error, renamedSlotsCount) {
16261
+ return {
16262
+ componentName,
16263
+ classified: 0,
16264
+ excluded: 0,
16265
+ slots: 0,
16266
+ warnings: [],
16267
+ failed: true,
16268
+ error,
16269
+ cached: false,
16270
+ renamedSlotsCount
16271
+ };
16272
+ }
16273
+
16274
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
16244
16275
  var DEFAULT_TIMEOUT_MS4 = Number(process.env["EDS_AGENT_TIMEOUT_MS"] ?? 5 * 60 * 1e3);
16245
16276
  var RETRY_BACKOFF_MS = Number(process.env["EDS_RETRY_BACKOFF_MS"] ?? 5e3);
16246
16277
  async function runOneGenerateComponent(options, component, index, total) {
@@ -16263,7 +16294,7 @@ async function runOneGenerateComponent(options, component, index, total) {
16263
16294
  const cacheComponent = normalizeComponentForCache(component);
16264
16295
  if (!noCache && precomputedCachedNames.has(component.name)) {
16265
16296
  onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
16266
- return cachedResult(component.name);
16297
+ return buildCachedComponentResult(component.name);
16267
16298
  }
16268
16299
  if (!noCache) {
16269
16300
  const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
@@ -16273,14 +16304,16 @@ async function runOneGenerateComponent(options, component, index, total) {
16273
16304
  });
16274
16305
  storeCache(db, hashComponentShape(cacheComponent), "component", component.component_id, resolution.entry.sourceSessionId, resolution.entry.humanEdited, promptHash);
16275
16306
  onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
16276
- return cachedResult(component.name);
16307
+ return buildCachedComponentResult(component.name);
16277
16308
  }
16278
16309
  if (resolution?.humanEdited) {
16279
16310
  copyComponentFromCache(db, resolution.entry.sourceSessionId, sessionId, component.component_id, true, {
16280
16311
  allowedComponentNames: allowedComponentNames2
16281
16312
  });
16282
16313
  onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: true });
16283
- return cachedResult(component.name, [`${component.name}: source changed but human edits preserved`]);
16314
+ return buildCachedComponentResult(component.name, [
16315
+ `${component.name}: source changed but human edits preserved`
16316
+ ]);
16284
16317
  }
16285
16318
  }
16286
16319
  const rawComponentsInline = JSON.stringify([
@@ -16319,7 +16352,7 @@ async function runOneGenerateComponent(options, component, index, total) {
16319
16352
  if (result.timedOut) {
16320
16353
  const error = `timed out after ${DEFAULT_TIMEOUT_MS4 / 6e4} minutes`;
16321
16354
  onProgress?.({ kind: "component:failed", index, total, name: component.name, error });
16322
- return failed(component.name, error, renames.length);
16355
+ return buildFailedComponentResult(component.name, error, renames.length);
16323
16356
  }
16324
16357
  if (result.exitCode !== 0) {
16325
16358
  lastError = describeAgentFailure(result);
@@ -16358,32 +16391,7 @@ async function runOneGenerateComponent(options, component, index, total) {
16358
16391
  };
16359
16392
  }
16360
16393
  onProgress?.({ kind: "component:failed", index, total, name: component.name, error: lastError });
16361
- return failed(component.name, lastError, renames.length);
16362
- }
16363
- function cachedResult(componentName, warnings = []) {
16364
- return {
16365
- componentName,
16366
- classified: 0,
16367
- excluded: 0,
16368
- slots: 0,
16369
- warnings,
16370
- failed: false,
16371
- cached: true,
16372
- renamedSlotsCount: 0
16373
- };
16374
- }
16375
- function failed(componentName, error, renamedSlotsCount) {
16376
- return {
16377
- componentName,
16378
- classified: 0,
16379
- excluded: 0,
16380
- slots: 0,
16381
- warnings: [],
16382
- failed: true,
16383
- error,
16384
- cached: false,
16385
- renamedSlotsCount
16386
- };
16394
+ return buildFailedComponentResult(component.name, lastError, renames.length);
16387
16395
  }
16388
16396
 
16389
16397
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-with-pool.js
@@ -16402,6 +16410,36 @@ async function runWithPool(items, concurrency, worker) {
16402
16410
 
16403
16411
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js
16404
16412
  init_cache_keys();
16413
+
16414
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js
16415
+ function restoreCachedComponents(db, sessionId, cachedComponents, promptHash, allowedComponentNames2) {
16416
+ const restorations = [];
16417
+ const rekeyed = [];
16418
+ const componentStatus = db.prepare("SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?");
16419
+ for (const { component, resolution } of cachedComponents) {
16420
+ const current = componentStatus.get(sessionId, component.component_id);
16421
+ if (current?.status === "generated")
16422
+ continue;
16423
+ renameEmptySlots(db, sessionId, component.component_id, component.name, component.slots.length);
16424
+ restorations.push({
16425
+ sourceSessionId: resolution.entry.sourceSessionId,
16426
+ targetSessionId: sessionId,
16427
+ componentId: component.component_id
16428
+ });
16429
+ rekeyed.push({ component, cached: resolution.entry });
16430
+ }
16431
+ copyComponentsFromCache(db, restorations, { allowedComponentNames: allowedComponentNames2 });
16432
+ storeCaches(db, rekeyed.map(({ component, cached }) => ({
16433
+ inputHash: hashComponentShape(normalizeComponentForCache(component)),
16434
+ entityType: "component",
16435
+ entityId: component.component_id,
16436
+ sourceSessionId: cached.sourceSessionId,
16437
+ humanEdited: cached.humanEdited,
16438
+ promptHash
16439
+ })));
16440
+ }
16441
+
16442
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js
16405
16443
  async function checkGenerateComponentsCache(request) {
16406
16444
  if (request.noCache) {
16407
16445
  return { sessionId: request.sessionId, cachedComponentNames: [], fullyCached: false, cacheDisabled: true };
@@ -16426,8 +16464,9 @@ async function checkGenerateComponentsCache(request) {
16426
16464
  const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
16427
16465
  return resolution ? [{ component, resolution }] : [];
16428
16466
  });
16429
- if (request.restoreCache)
16430
- restoreCached(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
16467
+ if (request.restoreCache) {
16468
+ restoreCachedComponents(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
16469
+ }
16431
16470
  return {
16432
16471
  sessionId: request.sessionId,
16433
16472
  cachedComponentNames: cachedComponents.map(({ component }) => component.name),
@@ -16438,42 +16477,17 @@ async function checkGenerateComponentsCache(request) {
16438
16477
  db.close();
16439
16478
  }
16440
16479
  }
16441
- function restoreCached(db, sessionId, cachedComponents, promptHash, allowedComponentNames2) {
16442
- const restorations = [];
16443
- const rekeyed = [];
16444
- const componentStatus = db.prepare("SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?");
16445
- for (const { component, resolution } of cachedComponents) {
16446
- const current = componentStatus.get(sessionId, component.component_id);
16447
- if (current?.status === "generated")
16448
- continue;
16449
- renameEmptySlots(db, sessionId, component.component_id, component.name, component.slots.length);
16450
- restorations.push({
16451
- sourceSessionId: resolution.entry.sourceSessionId,
16452
- targetSessionId: sessionId,
16453
- componentId: component.component_id
16454
- });
16455
- rekeyed.push({ component, cached: resolution.entry });
16456
- }
16457
- copyComponentsFromCache(db, restorations, { allowedComponentNames: allowedComponentNames2 });
16458
- storeCaches(db, rekeyed.map(({ component, cached }) => ({
16459
- inputHash: hashComponentShape(normalizeComponentForCache(component)),
16460
- entityType: "component",
16461
- entityId: component.component_id,
16462
- sourceSessionId: cached.sourceSessionId,
16463
- humanEdited: cached.humanEdited,
16464
- promptHash
16465
- })));
16466
- }
16467
16480
 
16468
16481
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/run-generate-components-session.js
16469
16482
  var DEFAULT_COMPONENT_CONCURRENCY = Number(process.env["EDS_GENERATE_CONCURRENCY"] ?? 10);
16470
16483
  async function runGenerateComponentsSession(request) {
16471
16484
  const prompt = await resolveGeneratePrompt(request.promptOverrides);
16485
+ const effectiveSkillPath = prompt.path ?? request.skillPath;
16472
16486
  const existingEntities = await readExistingEntities(request);
16473
16487
  const existingTokensInline = existingEntities ? JSON.stringify(summarizeForMapTokens({ entities: existingEntities })) : void 0;
16474
16488
  const existingTokensHash = existingTokensInline ? [hashContent(existingTokensInline)] : [];
16475
16489
  const agent = request.agent;
16476
- const promptHash = await hashPromptForSkill("components", agent, request.agentModel, prompt.path, existingTokensHash, prompt.text);
16490
+ const promptHash = await hashPromptForSkill("components", agent, request.agentModel, effectiveSkillPath, existingTokensHash, prompt.text);
16477
16491
  const db = openPipelineDb();
16478
16492
  try {
16479
16493
  const acceptedNames = await loadAcceptedNames(request.sessionId);
@@ -16500,7 +16514,7 @@ async function runGenerateComponentsSession(request) {
16500
16514
  tokenMapInline: request.tokenMapInline,
16501
16515
  verbose: request.verbose ?? false,
16502
16516
  noCache: request.noCache,
16503
- skillPathOverride: prompt.path,
16517
+ skillPathOverride: effectiveSkillPath,
16504
16518
  skillContentOverride: prompt.text,
16505
16519
  promptHash,
16506
16520
  existingContentfulEntities: existingEntities,
@@ -20400,6 +20414,8 @@ async function saveDecisions(input) {
20400
20414
  }
20401
20415
 
20402
20416
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts
20417
+ var COMPONENTS_SKILL_PATH = findSkillPath("generate-components.md");
20418
+ var MAP_TOKENS_SKILL_PATH = findSkillPath("map-tokens.md");
20403
20419
  var realDeps3 = {
20404
20420
  checkAgentAuth,
20405
20421
  saveDecisions,
@@ -20434,6 +20450,7 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
20434
20450
  agent: input.agent,
20435
20451
  ...input.agentModel ? { agentModel: input.agentModel } : {},
20436
20452
  promptOverrides: appendGeneratePromptOverride(input),
20453
+ skillPath: COMPONENTS_SKILL_PATH,
20437
20454
  noCache: input.noCache,
20438
20455
  existingEntitiesPath: input.existingEntitiesPath,
20439
20456
  precomputedCachedNames: new Set(handedOverNames),
@@ -20463,6 +20480,7 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
20463
20480
  agent: input.agent,
20464
20481
  ...input.agentModel ? { model: input.agentModel } : {},
20465
20482
  cache: !input.noCache,
20483
+ skillPathOverride: MAP_TOKENS_SKILL_PATH,
20466
20484
  ...mapTokensOptions
20467
20485
  });
20468
20486
  } catch (error) {
@@ -20875,8 +20893,8 @@ function missingNote(missingNames) {
20875
20893
  Note: ${plural2(missingNames.length, "component name")} from the server (${missingNames.join(", ")}) ${verb} not match anything in this session \u2014 they cannot be edited or skipped from here.`;
20876
20894
  }
20877
20895
  function contextText(errors, missingNames) {
20878
- const failed2 = failedComponentNames(errors);
20879
- return `${plural2(failed2.length, "component")} failed server validation. Edit their definitions in the review TUI, or skip them and retry preview without them.${missingNote(missingNames)}`;
20896
+ const failed = failedComponentNames(errors);
20897
+ return `${plural2(failed.length, "component")} failed server validation. Edit their definitions in the review TUI, or skip them and retry preview without them.${missingNote(missingNames)}`;
20880
20898
  }
20881
20899
  function skipLabel(matchedNames) {
20882
20900
  if (matchedNames.length === 0) return "No matching components to skip";
@@ -27388,19 +27406,19 @@ function resultOf(operation, preview) {
27388
27406
  const items = operation.items ?? [];
27389
27407
  if (items.length > 0) {
27390
27408
  const count = (entityType, action) => items.filter((i) => i.entityType === entityType && i.action === action && i.status === "succeeded").length;
27391
- const failed2 = (entityType) => items.filter((i) => i.entityType === entityType && i.status === "failed").length;
27409
+ const failed = (entityType) => items.filter((i) => i.entityType === entityType && i.status === "failed").length;
27392
27410
  return {
27393
27411
  componentTypes: {
27394
27412
  created: count("ComponentType", "create"),
27395
27413
  updated: count("ComponentType", "update"),
27396
27414
  removed: count("ComponentType", "delete"),
27397
- failed: failed2("ComponentType")
27415
+ failed: failed("ComponentType")
27398
27416
  },
27399
27417
  designTokens: {
27400
27418
  created: count("DesignToken", "create"),
27401
27419
  updated: count("DesignToken", "update"),
27402
27420
  removed: count("DesignToken", "delete"),
27403
- failed: failed2("DesignToken")
27421
+ failed: failed("DesignToken")
27404
27422
  },
27405
27423
  summary: operation.summary,
27406
27424
  failures: items.filter((item) => item.status === "failed").map((item) => ({
package/dist/index.js CHANGED
@@ -16593,7 +16593,7 @@ async function runMapTokens(request) {
16593
16593
  }
16594
16594
  const agent = request.agent;
16595
16595
  const noCache = request.cache === false || process.env["EDS_NO_CACHE"] === "1";
16596
- const promptHash = await hashPromptForSkill("map-tokens", agent, request.model, void 0, request.existingEntitiesInline ? [hashContent(request.existingEntitiesInline)] : [], request.skillContentOverride);
16596
+ const promptHash = await hashPromptForSkill("map-tokens", agent, request.model, request.skillPathOverride, request.existingEntitiesInline ? [hashContent(request.existingEntitiesInline)] : [], request.skillContentOverride);
16597
16597
  const inputHash = computeMapTokensInputHash(db, sessionId, componentSourceRefs);
16598
16598
  if (!noCache) {
16599
16599
  const cached = lookupCache(db, inputHash, "token_mapping", "__map_tokens__", promptHash);
@@ -19204,6 +19204,45 @@ var init_resolve_generate_prompt = __esm({
19204
19204
  }
19205
19205
  });
19206
19206
 
19207
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-cached-component-result.js
19208
+ function buildCachedComponentResult(componentName, warnings = []) {
19209
+ return {
19210
+ componentName,
19211
+ classified: 0,
19212
+ excluded: 0,
19213
+ slots: 0,
19214
+ warnings,
19215
+ failed: false,
19216
+ cached: true,
19217
+ renamedSlotsCount: 0
19218
+ };
19219
+ }
19220
+ var init_build_cached_component_result = __esm({
19221
+ "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-cached-component-result.js"() {
19222
+ "use strict";
19223
+ }
19224
+ });
19225
+
19226
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-failed-component-result.js
19227
+ function buildFailedComponentResult(componentName, error, renamedSlotsCount) {
19228
+ return {
19229
+ componentName,
19230
+ classified: 0,
19231
+ excluded: 0,
19232
+ slots: 0,
19233
+ warnings: [],
19234
+ failed: true,
19235
+ error,
19236
+ cached: false,
19237
+ renamedSlotsCount
19238
+ };
19239
+ }
19240
+ var init_build_failed_component_result = __esm({
19241
+ "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-failed-component-result.js"() {
19242
+ "use strict";
19243
+ }
19244
+ });
19245
+
19207
19246
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
19208
19247
  async function runOneGenerateComponent(options, component, index, total) {
19209
19248
  const { db, sessionId, invoker, agent, model, tokensInline, tokenMapInline, verbose, noCache, skillPathOverride, skillContentOverride, promptHash, existingContentfulEntities, existingTokensInline, precomputedCachedNames, allowedComponentNames: allowedComponentNames2, onProgress } = options;
@@ -19225,7 +19264,7 @@ async function runOneGenerateComponent(options, component, index, total) {
19225
19264
  const cacheComponent = normalizeComponentForCache(component);
19226
19265
  if (!noCache && precomputedCachedNames.has(component.name)) {
19227
19266
  onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
19228
- return cachedResult(component.name);
19267
+ return buildCachedComponentResult(component.name);
19229
19268
  }
19230
19269
  if (!noCache) {
19231
19270
  const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
@@ -19235,14 +19274,16 @@ async function runOneGenerateComponent(options, component, index, total) {
19235
19274
  });
19236
19275
  storeCache(db, hashComponentShape(cacheComponent), "component", component.component_id, resolution.entry.sourceSessionId, resolution.entry.humanEdited, promptHash);
19237
19276
  onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: false });
19238
- return cachedResult(component.name);
19277
+ return buildCachedComponentResult(component.name);
19239
19278
  }
19240
19279
  if (resolution?.humanEdited) {
19241
19280
  copyComponentFromCache(db, resolution.entry.sourceSessionId, sessionId, component.component_id, true, {
19242
19281
  allowedComponentNames: allowedComponentNames2
19243
19282
  });
19244
19283
  onProgress?.({ kind: "component:cached", index, total, name: component.name, pinned: true });
19245
- return cachedResult(component.name, [`${component.name}: source changed but human edits preserved`]);
19284
+ return buildCachedComponentResult(component.name, [
19285
+ `${component.name}: source changed but human edits preserved`
19286
+ ]);
19246
19287
  }
19247
19288
  }
19248
19289
  const rawComponentsInline = JSON.stringify([
@@ -19281,7 +19322,7 @@ async function runOneGenerateComponent(options, component, index, total) {
19281
19322
  if (result.timedOut) {
19282
19323
  const error = `timed out after ${DEFAULT_TIMEOUT_MS4 / 6e4} minutes`;
19283
19324
  onProgress?.({ kind: "component:failed", index, total, name: component.name, error });
19284
- return failed(component.name, error, renames.length);
19325
+ return buildFailedComponentResult(component.name, error, renames.length);
19285
19326
  }
19286
19327
  if (result.exitCode !== 0) {
19287
19328
  lastError = describeAgentFailure(result);
@@ -19320,32 +19361,7 @@ async function runOneGenerateComponent(options, component, index, total) {
19320
19361
  };
19321
19362
  }
19322
19363
  onProgress?.({ kind: "component:failed", index, total, name: component.name, error: lastError });
19323
- return failed(component.name, lastError, renames.length);
19324
- }
19325
- function cachedResult(componentName, warnings = []) {
19326
- return {
19327
- componentName,
19328
- classified: 0,
19329
- excluded: 0,
19330
- slots: 0,
19331
- warnings,
19332
- failed: false,
19333
- cached: true,
19334
- renamedSlotsCount: 0
19335
- };
19336
- }
19337
- function failed(componentName, error, renamedSlotsCount) {
19338
- return {
19339
- componentName,
19340
- classified: 0,
19341
- excluded: 0,
19342
- slots: 0,
19343
- warnings: [],
19344
- failed: true,
19345
- error,
19346
- cached: false,
19347
- renamedSlotsCount
19348
- };
19364
+ return buildFailedComponentResult(component.name, lastError, renames.length);
19349
19365
  }
19350
19366
  var DEFAULT_TIMEOUT_MS4, RETRY_BACKOFF_MS;
19351
19367
  var init_run_one_generate_component = __esm({
@@ -19359,6 +19375,8 @@ var init_run_one_generate_component = __esm({
19359
19375
  init_normalize_component_for_cache();
19360
19376
  init_resolve_component_cache();
19361
19377
  init_summarize_for_generate();
19378
+ init_build_cached_component_result();
19379
+ init_build_failed_component_result();
19362
19380
  DEFAULT_TIMEOUT_MS4 = Number(process.env["EDS_AGENT_TIMEOUT_MS"] ?? 5 * 60 * 1e3);
19363
19381
  RETRY_BACKOFF_MS = Number(process.env["EDS_RETRY_BACKOFF_MS"] ?? 5e3);
19364
19382
  }
@@ -19383,6 +19401,41 @@ var init_run_with_pool = __esm({
19383
19401
  }
19384
19402
  });
19385
19403
 
19404
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js
19405
+ function restoreCachedComponents(db, sessionId, cachedComponents, promptHash, allowedComponentNames2) {
19406
+ const restorations = [];
19407
+ const rekeyed = [];
19408
+ const componentStatus = db.prepare("SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?");
19409
+ for (const { component, resolution } of cachedComponents) {
19410
+ const current = componentStatus.get(sessionId, component.component_id);
19411
+ if (current?.status === "generated")
19412
+ continue;
19413
+ renameEmptySlots(db, sessionId, component.component_id, component.name, component.slots.length);
19414
+ restorations.push({
19415
+ sourceSessionId: resolution.entry.sourceSessionId,
19416
+ targetSessionId: sessionId,
19417
+ componentId: component.component_id
19418
+ });
19419
+ rekeyed.push({ component, cached: resolution.entry });
19420
+ }
19421
+ copyComponentsFromCache(db, restorations, { allowedComponentNames: allowedComponentNames2 });
19422
+ storeCaches(db, rekeyed.map(({ component, cached }) => ({
19423
+ inputHash: hashComponentShape(normalizeComponentForCache(component)),
19424
+ entityType: "component",
19425
+ entityId: component.component_id,
19426
+ sourceSessionId: cached.sourceSessionId,
19427
+ humanEdited: cached.humanEdited,
19428
+ promptHash
19429
+ })));
19430
+ }
19431
+ var init_restore_cached_components = __esm({
19432
+ "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js"() {
19433
+ "use strict";
19434
+ init_db();
19435
+ init_normalize_component_for_cache();
19436
+ }
19437
+ });
19438
+
19386
19439
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js
19387
19440
  async function checkGenerateComponentsCache(request) {
19388
19441
  if (request.noCache) {
@@ -19408,8 +19461,9 @@ async function checkGenerateComponentsCache(request) {
19408
19461
  const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
19409
19462
  return resolution ? [{ component, resolution }] : [];
19410
19463
  });
19411
- if (request.restoreCache)
19412
- restoreCached(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
19464
+ if (request.restoreCache) {
19465
+ restoreCachedComponents(db, request.sessionId, cachedComponents, promptHash, allowedComponentNames2);
19466
+ }
19413
19467
  return {
19414
19468
  sessionId: request.sessionId,
19415
19469
  cachedComponentNames: cachedComponents.map(({ component }) => component.name),
@@ -19420,54 +19474,29 @@ async function checkGenerateComponentsCache(request) {
19420
19474
  db.close();
19421
19475
  }
19422
19476
  }
19423
- function restoreCached(db, sessionId, cachedComponents, promptHash, allowedComponentNames2) {
19424
- const restorations = [];
19425
- const rekeyed = [];
19426
- const componentStatus = db.prepare("SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?");
19427
- for (const { component, resolution } of cachedComponents) {
19428
- const current = componentStatus.get(sessionId, component.component_id);
19429
- if (current?.status === "generated")
19430
- continue;
19431
- renameEmptySlots(db, sessionId, component.component_id, component.name, component.slots.length);
19432
- restorations.push({
19433
- sourceSessionId: resolution.entry.sourceSessionId,
19434
- targetSessionId: sessionId,
19435
- componentId: component.component_id
19436
- });
19437
- rekeyed.push({ component, cached: resolution.entry });
19438
- }
19439
- copyComponentsFromCache(db, restorations, { allowedComponentNames: allowedComponentNames2 });
19440
- storeCaches(db, rekeyed.map(({ component, cached }) => ({
19441
- inputHash: hashComponentShape(normalizeComponentForCache(component)),
19442
- entityType: "component",
19443
- entityId: component.component_id,
19444
- sourceSessionId: cached.sourceSessionId,
19445
- humanEdited: cached.humanEdited,
19446
- promptHash
19447
- })));
19448
- }
19449
19477
  var init_check_generate_components_cache = __esm({
19450
19478
  "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js"() {
19451
19479
  "use strict";
19452
19480
  init_summarize_for_map_tokens();
19453
19481
  init_resolve_component_cache();
19454
- init_normalize_component_for_cache();
19455
19482
  init_db();
19456
19483
  init_cache_keys();
19457
19484
  init_src();
19458
19485
  init_read_existing_entities();
19459
19486
  init_resolve_generate_prompt();
19487
+ init_restore_cached_components();
19460
19488
  }
19461
19489
  });
19462
19490
 
19463
19491
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/run-generate-components-session.js
19464
19492
  async function runGenerateComponentsSession(request) {
19465
19493
  const prompt = await resolveGeneratePrompt(request.promptOverrides);
19494
+ const effectiveSkillPath = prompt.path ?? request.skillPath;
19466
19495
  const existingEntities = await readExistingEntities(request);
19467
19496
  const existingTokensInline = existingEntities ? JSON.stringify(summarizeForMapTokens({ entities: existingEntities })) : void 0;
19468
19497
  const existingTokensHash = existingTokensInline ? [hashContent(existingTokensInline)] : [];
19469
19498
  const agent = request.agent;
19470
- const promptHash = await hashPromptForSkill("components", agent, request.agentModel, prompt.path, existingTokensHash, prompt.text);
19499
+ const promptHash = await hashPromptForSkill("components", agent, request.agentModel, effectiveSkillPath, existingTokensHash, prompt.text);
19471
19500
  const db = openPipelineDb();
19472
19501
  try {
19473
19502
  const acceptedNames = await loadAcceptedNames(request.sessionId);
@@ -19494,7 +19523,7 @@ async function runGenerateComponentsSession(request) {
19494
19523
  tokenMapInline: request.tokenMapInline,
19495
19524
  verbose: request.verbose ?? false,
19496
19525
  noCache: request.noCache,
19497
- skillPathOverride: prompt.path,
19526
+ skillPathOverride: effectiveSkillPath,
19498
19527
  skillContentOverride: prompt.text,
19499
19528
  promptHash,
19500
19529
  existingContentfulEntities: existingEntities,
@@ -24038,6 +24067,7 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
24038
24067
  agent: input.agent,
24039
24068
  ...input.agentModel ? { agentModel: input.agentModel } : {},
24040
24069
  promptOverrides: appendGeneratePromptOverride(input),
24070
+ skillPath: COMPONENTS_SKILL_PATH,
24041
24071
  noCache: input.noCache,
24042
24072
  existingEntitiesPath: input.existingEntitiesPath,
24043
24073
  precomputedCachedNames: new Set(handedOverNames),
@@ -24067,6 +24097,7 @@ async function runGeneration(input, onProgress, deps = realDeps3) {
24067
24097
  agent: input.agent,
24068
24098
  ...input.agentModel ? { model: input.agentModel } : {},
24069
24099
  cache: !input.noCache,
24100
+ skillPathOverride: MAP_TOKENS_SKILL_PATH,
24070
24101
  ...mapTokensOptions
24071
24102
  });
24072
24103
  } catch (error) {
@@ -24118,14 +24149,17 @@ function applyProgressEvent2(event, previous, total) {
24118
24149
  }
24119
24150
  return previous;
24120
24151
  }
24121
- var realDeps3, fail2, errorMessage3;
24152
+ var COMPONENTS_SKILL_PATH, MAP_TOKENS_SKILL_PATH, realDeps3, fail2, errorMessage3;
24122
24153
  var init_run2 = __esm({
24123
24154
  "packages/experience-design-system-cli/src/tui/import/steps/08-generation/run.ts"() {
24124
24155
  "use strict";
24125
24156
  init_src4();
24157
+ init_find_skill_path();
24126
24158
  init_logic9();
24127
24159
  init_map_tokens();
24128
24160
  init_save_decisions();
24161
+ COMPONENTS_SKILL_PATH = findSkillPath("generate-components.md");
24162
+ MAP_TOKENS_SKILL_PATH = findSkillPath("map-tokens.md");
24129
24163
  realDeps3 = {
24130
24164
  checkAgentAuth,
24131
24165
  saveDecisions,
@@ -24604,8 +24638,8 @@ function missingNote(missingNames) {
24604
24638
  Note: ${plural2(missingNames.length, "component name")} from the server (${missingNames.join(", ")}) ${verb} not match anything in this session \u2014 they cannot be edited or skipped from here.`;
24605
24639
  }
24606
24640
  function contextText(errors, missingNames) {
24607
- const failed2 = failedComponentNames(errors);
24608
- return `${plural2(failed2.length, "component")} failed server validation. Edit their definitions in the review TUI, or skip them and retry preview without them.${missingNote(missingNames)}`;
24641
+ const failed = failedComponentNames(errors);
24642
+ return `${plural2(failed.length, "component")} failed server validation. Edit their definitions in the review TUI, or skip them and retry preview without them.${missingNote(missingNames)}`;
24609
24643
  }
24610
24644
  function skipLabel(matchedNames) {
24611
24645
  if (matchedNames.length === 0) return "No matching components to skip";
@@ -31546,19 +31580,19 @@ function resultOf(operation, preview) {
31546
31580
  const items = operation.items ?? [];
31547
31581
  if (items.length > 0) {
31548
31582
  const count = (entityType, action) => items.filter((i) => i.entityType === entityType && i.action === action && i.status === "succeeded").length;
31549
- const failed2 = (entityType) => items.filter((i) => i.entityType === entityType && i.status === "failed").length;
31583
+ const failed = (entityType) => items.filter((i) => i.entityType === entityType && i.status === "failed").length;
31550
31584
  return {
31551
31585
  componentTypes: {
31552
31586
  created: count("ComponentType", "create"),
31553
31587
  updated: count("ComponentType", "update"),
31554
31588
  removed: count("ComponentType", "delete"),
31555
- failed: failed2("ComponentType")
31589
+ failed: failed("ComponentType")
31556
31590
  },
31557
31591
  designTokens: {
31558
31592
  created: count("DesignToken", "create"),
31559
31593
  updated: count("DesignToken", "update"),
31560
31594
  removed: count("DesignToken", "delete"),
31561
- failed: failed2("DesignToken")
31595
+ failed: failed("DesignToken")
31562
31596
  },
31563
31597
  summary: operation.summary,
31564
31598
  failures: items.filter((item) => item.status === "failed").map((item) => ({
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-1c5cd11a.0",
3
+ "version": "2.37.1-dev-build-a1707be5.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -7,11 +7,4 @@ export interface CacheCheckInput {
7
7
  existingEntitiesPath: string | null;
8
8
  noCache: boolean;
9
9
  }
10
- /**
11
- * Runs the generation cache check in-process while the scope gate is open.
12
- * Restores cached CDF entries into the pipeline database as a side-effect so
13
- * the generate run that follows can skip them. A failed check is
14
- * indistinguishable from "nothing cached", as in legacy. INTEG-5050 tracks
15
- * surfacing it.
16
- */
17
10
  export declare function checkGenerationCache(input: CacheCheckInput): Promise<string[]>;
@@ -1,22 +1,18 @@
1
1
  import type { GenerationProgress } from './types.js';
2
2
  export declare function initialProgress(): GenerationProgress;
3
- /** Token mapping runs only when there is something to map and tokens to map it from. */
4
3
  export declare function shouldRunMapTokens(counts: {
5
4
  mappablePropCount: number;
6
5
  rawTokenCount: number;
7
6
  }): boolean;
8
- /** "5 components accepted." or, with some left out, "5 components accepted, 2 excluded due to validation errors." */
9
7
  export declare function formatAcceptanceSummary(counts: {
10
8
  accepted: number;
11
9
  autoRejected: number;
12
10
  }): string;
13
- /** The screen's description: what was accepted, what is happening to it, and whether the tokens are used. */
14
11
  export declare function describeGeneration(input: {
15
12
  acceptedCount: number;
16
13
  agent: string;
17
14
  hasTokens: boolean;
18
15
  }): string;
19
- /** The rows the generating screen shows for this progress. */
20
16
  export declare function progressRows(progress: GenerationProgress, agent: string): Array<{
21
17
  text: string;
22
18
  complete: boolean;
@@ -9,14 +9,4 @@ export interface GenerationDeps {
9
9
  runMapTokens: typeof runMapTokens;
10
10
  prepareMapTokens: typeof prepareMapTokens;
11
11
  }
12
- /**
13
- * The whole stage, in the order the wizard ran it:
14
- * 1. Wait for the cache check that ran while the scope gate was open, then save the decisions. Both write to the
15
- * pipeline database and the cache has to be restored first. With nothing accepted the stage ends here.
16
- * 2. Generate the accepted components in-process. The orchestrator handles per-component cache lookup, so the names
17
- * from the cache check are forwarded as `precomputedCachedNames` to skip a redundant lookup.
18
- * 3. Map tokens onto the generated session. Skipped when there is nothing to map.
19
- * A failed token mapping after a successful generation is an error to show. It neither retries nor throws away what was
20
- * generated.
21
- */
22
12
  export declare function runGeneration(input: GenerationInput, onProgress: (progress: GenerationProgress) => void, deps?: GenerationDeps): Promise<GenerationResult>;
@@ -24452,6 +24452,20 @@ var init_resolve_generate_prompt = __esm({
24452
24452
  }
24453
24453
  });
24454
24454
 
24455
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-cached-component-result.js
24456
+ var init_build_cached_component_result = __esm({
24457
+ "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-cached-component-result.js"() {
24458
+ "use strict";
24459
+ }
24460
+ });
24461
+
24462
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-failed-component-result.js
24463
+ var init_build_failed_component_result = __esm({
24464
+ "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/build-failed-component-result.js"() {
24465
+ "use strict";
24466
+ }
24467
+ });
24468
+
24455
24469
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/run-one-generate-component.js
24456
24470
  var DEFAULT_TIMEOUT_MS6, RETRY_BACKOFF_MS2;
24457
24471
  var init_run_one_generate_component = __esm({
@@ -24465,6 +24479,8 @@ var init_run_one_generate_component = __esm({
24465
24479
  init_normalize_component_for_cache();
24466
24480
  init_resolve_component_cache();
24467
24481
  init_summarize_for_generate();
24482
+ init_build_cached_component_result();
24483
+ init_build_failed_component_result();
24468
24484
  DEFAULT_TIMEOUT_MS6 = Number(process.env["EDS_AGENT_TIMEOUT_MS"] ?? 5 * 60 * 1e3);
24469
24485
  RETRY_BACKOFF_MS2 = Number(process.env["EDS_RETRY_BACKOFF_MS"] ?? 5e3);
24470
24486
  }
@@ -24477,18 +24493,27 @@ var init_run_with_pool = __esm({
24477
24493
  }
24478
24494
  });
24479
24495
 
24496
+ // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js
24497
+ var init_restore_cached_components = __esm({
24498
+ "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/helpers/restore-cached-components.js"() {
24499
+ "use strict";
24500
+ init_db2();
24501
+ init_normalize_component_for_cache();
24502
+ }
24503
+ });
24504
+
24480
24505
  // packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js
24481
24506
  var init_check_generate_components_cache = __esm({
24482
24507
  "packages/experience-design-system-backend-pipeline/dist/src/orchestrators/run-generate-components-session/check-generate-components-cache.js"() {
24483
24508
  "use strict";
24484
24509
  init_summarize_for_map_tokens();
24485
24510
  init_resolve_component_cache();
24486
- init_normalize_component_for_cache();
24487
24511
  init_db2();
24488
24512
  init_cache_keys2();
24489
24513
  init_src3();
24490
24514
  init_read_existing_entities();
24491
24515
  init_resolve_generate_prompt();
24516
+ init_restore_cached_components();
24492
24517
  }
24493
24518
  });
24494
24519
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-1c5cd11a.0",
3
+ "version": "2.37.1-dev-build-a1707be5.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.37.1-dev-build-1c5cd11a.0",
3
+ "version": "2.37.1-dev-build-a1707be5.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,8 +45,8 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-1c5cd11a.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-1c5cd11a.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-a1707be5.0",
49
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-a1707be5.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",