@contentful/experience-design-system-cli 2.35.1-dev-build-b8da2525.0 → 2.35.1-dev-build-5446cce7.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.
@@ -164,18 +164,11 @@ var init_render_with_goodbye = __esm({
164
164
  function isAgentName(value) {
165
165
  return AGENT_NAMES.includes(value);
166
166
  }
167
- var AGENT_NAMES, DEFAULT_AGENT_NAME, AGENT_BINARIES;
167
+ var AGENT_NAMES, AGENT_BINARIES;
168
168
  var init_agent_names = __esm({
169
169
  "packages/experience-design-system-generation/dist/src/agent-names.js"() {
170
170
  "use strict";
171
- AGENT_NAMES = [
172
- "claude",
173
- "codex",
174
- "opencode",
175
- "cursor",
176
- "copilot"
177
- ];
178
- DEFAULT_AGENT_NAME = "claude";
171
+ AGENT_NAMES = ["claude", "codex", "opencode", "cursor", "copilot"];
179
172
  AGENT_BINARIES = {
180
173
  claude: "claude",
181
174
  codex: "codex",
@@ -187,23 +180,6 @@ var init_agent_names = __esm({
187
180
  });
188
181
 
189
182
  // packages/experience-design-system-generation/dist/src/controller/helpers/validate-generation-request.js
190
- function validateGenerationRequest(request2) {
191
- if (request2 === null || typeof request2 !== "object") {
192
- throw new TypeError("createGenerationEndpoint requires a request object");
193
- }
194
- if (!isAgentName(request2.agent)) {
195
- throw new TypeError(`createGenerationEndpoint requires agent to be a valid agent name, got: ${String(request2.agent)}`);
196
- }
197
- if (typeof request2.timeoutMs !== "number" || request2.timeoutMs <= 0) {
198
- throw new TypeError("createGenerationEndpoint requires timeoutMs to be a positive number");
199
- }
200
- if (request2.promptOptions === null || typeof request2.promptOptions !== "object") {
201
- throw new TypeError("createGenerationEndpoint requires promptOptions to be an object");
202
- }
203
- if (request2.onOutput !== void 0 && typeof request2.onOutput !== "function") {
204
- throw new TypeError("createGenerationEndpoint requires onOutput to be a function when provided");
205
- }
206
- }
207
183
  var init_validate_generation_request = __esm({
208
184
  "packages/experience-design-system-generation/dist/src/controller/helpers/validate-generation-request.js"() {
209
185
  "use strict";
@@ -636,17 +612,6 @@ var init_build_prompt = __esm({
636
612
  });
637
613
 
638
614
  // packages/experience-design-system-generation/dist/src/orchestrator/execute-generation-orchestrator.js
639
- async function executeGenerationOrchestrator(request2) {
640
- const prompt = await buildPrompt(request2.promptOptions);
641
- return request2.invoker.invoke({
642
- agent: request2.agent,
643
- model: request2.model,
644
- bedrock: request2.bedrock,
645
- prompt,
646
- timeoutMs: request2.timeoutMs,
647
- onOutput: request2.onOutput
648
- });
649
- }
650
615
  var init_execute_generation_orchestrator = __esm({
651
616
  "packages/experience-design-system-generation/dist/src/orchestrator/execute-generation-orchestrator.js"() {
652
617
  "use strict";
@@ -690,12 +655,7 @@ function resolveAgentModel(agent, explicit, bedrock = false) {
690
655
  }
691
656
  function codexBedrockConfigArgs() {
692
657
  const region = process.env.AWS_REGION?.trim() || process.env.AWS_DEFAULT_REGION?.trim() || DEFAULT_CODEX_BEDROCK_REGION;
693
- return [
694
- "-c",
695
- "model_provider=amazon-bedrock",
696
- "-c",
697
- `model_providers.amazon-bedrock.region=${region}`
698
- ];
658
+ return ["-c", "model_provider=amazon-bedrock", "-c", `model_providers.amazon-bedrock.region=${region}`];
699
659
  }
700
660
  function buildAgentArgs(agent, prompt, model, promptViaStdin = false, bedrock = false) {
701
661
  const resolvedModel = resolveAgentModel(agent, model, bedrock);
@@ -706,13 +666,7 @@ function buildAgentArgs(agent, prompt, model, promptViaStdin = false, bedrock =
706
666
  return ["--print", ...modelArg, ...promptArg];
707
667
  case "codex": {
708
668
  const bedrockArgs = bedrock ? codexBedrockConfigArgs() : [];
709
- return [
710
- "exec",
711
- ...bedrockArgs,
712
- ...modelArg,
713
- "--dangerously-bypass-approvals-and-sandbox",
714
- ...promptArg
715
- ];
669
+ return ["exec", ...bedrockArgs, ...modelArg, "--dangerously-bypass-approvals-and-sandbox", ...promptArg];
716
670
  }
717
671
  case "opencode":
718
672
  return ["run", ...modelArg, ...promptArg];
@@ -732,11 +686,7 @@ var init_build_agent_args = __esm({
732
686
  BEDROCK_ENV_BY_AGENT = {
733
687
  claude: { CLAUDE_CODE_USE_BEDROCK: "1" }
734
688
  };
735
- BEDROCK_CAPABLE_AGENTS = /* @__PURE__ */ new Set([
736
- "claude",
737
- "codex",
738
- "opencode"
739
- ]);
689
+ BEDROCK_CAPABLE_AGENTS = /* @__PURE__ */ new Set(["claude", "codex", "opencode"]);
740
690
  DEFAULT_CODEX_BEDROCK_REGION = "us-east-1";
741
691
  DEFAULT_OPENCODE_MODEL = "claude-haiku-4-5";
742
692
  DEFAULT_CODEX_BEDROCK_MODEL = "openai.gpt-5.6-luna";
@@ -762,22 +712,6 @@ var init_describe_agent_failure = __esm({
762
712
  });
763
713
 
764
714
  // packages/experience-design-system-generation/dist/src/services/agent/helpers/extract-sentinel-output.js
765
- function extractSentinelOutput(stdout) {
766
- const START = "<<<EDS_OUTPUT_START>>>";
767
- const END = "<<<EDS_OUTPUT_END>>>";
768
- const startIdx = stdout.indexOf(START);
769
- const endIdx = stdout.indexOf(END);
770
- if (startIdx === -1 || endIdx === -1 || endIdx <= startIdx)
771
- return null;
772
- const secondStart = stdout.indexOf(START, startIdx + START.length);
773
- if (secondStart !== -1 && secondStart < endIdx)
774
- return "multiple";
775
- const afterStart = stdout.indexOf(END, startIdx);
776
- const secondEnd = stdout.indexOf(END, afterStart + END.length);
777
- if (secondEnd !== -1)
778
- return "multiple";
779
- return stdout.slice(startIdx + START.length, endIdx).trim();
780
- }
781
715
  var init_extract_sentinel_output = __esm({
782
716
  "packages/experience-design-system-generation/dist/src/services/agent/helpers/extract-sentinel-output.js"() {
783
717
  "use strict";
@@ -802,7 +736,7 @@ async function runAgent(options) {
802
736
  promptLen: prompt.length,
803
737
  promptHead: prompt.slice(0, 500)
804
738
  });
805
- return new Promise((resolve21) => {
739
+ return new Promise((resolve20) => {
806
740
  const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : void 0;
807
741
  const child = spawn(binary, args, {
808
742
  stdio: ["pipe", "pipe", "pipe"],
@@ -851,7 +785,7 @@ async function runAgent(options) {
851
785
  stderrLen: stderr.length,
852
786
  stderrTail: stderr.slice(-1e3)
853
787
  });
854
- resolve21(result);
788
+ resolve20(result);
855
789
  });
856
790
  });
857
791
  }
@@ -868,7 +802,7 @@ var init_run_agent = __esm({
868
802
  // packages/experience-design-system-generation/dist/src/services/agent/helpers/check-claude-auth.js
869
803
  import { spawn as spawn2 } from "node:child_process";
870
804
  function checkClaudeAuth(binary) {
871
- return new Promise((resolve21) => {
805
+ return new Promise((resolve20) => {
872
806
  const child = spawn2(binary, ["auth", "status", "--json"], {
873
807
  stdio: ["ignore", "pipe", "pipe"]
874
808
  });
@@ -878,7 +812,7 @@ function checkClaudeAuth(binary) {
878
812
  if (!done) {
879
813
  done = true;
880
814
  child.kill("SIGTERM");
881
- resolve21("unauthenticated");
815
+ resolve20("unauthenticated");
882
816
  }
883
817
  }, 5e3);
884
818
  child.stdout?.on("data", (chunk) => {
@@ -890,14 +824,14 @@ function checkClaudeAuth(binary) {
890
824
  done = true;
891
825
  clearTimeout(timer);
892
826
  if (code !== 0) {
893
- resolve21("unauthenticated");
827
+ resolve20("unauthenticated");
894
828
  return;
895
829
  }
896
830
  try {
897
831
  const status = JSON.parse(stdout);
898
- resolve21(status.loggedIn ? "ok" : "unauthenticated");
832
+ resolve20(status.loggedIn ? "ok" : "unauthenticated");
899
833
  } catch {
900
- resolve21("unauthenticated");
834
+ resolve20("unauthenticated");
901
835
  }
902
836
  });
903
837
  });
@@ -912,13 +846,13 @@ var init_check_claude_auth = __esm({
912
846
  import { spawn as spawn3 } from "node:child_process";
913
847
  async function checkAgentAuth(agent) {
914
848
  const binary = resolveAgentBinary(agent);
915
- const binaryExists2 = await new Promise((resolve21) => {
849
+ const binaryExists2 = await new Promise((resolve20) => {
916
850
  if (binary.startsWith("/")) {
917
- import("node:fs/promises").then((fs2) => fs2.access(binary).then(() => resolve21(true), () => resolve21(false)));
851
+ import("node:fs/promises").then((fs2) => fs2.access(binary).then(() => resolve20(true), () => resolve20(false)));
918
852
  return;
919
853
  }
920
854
  const child = spawn3(process.platform === "win32" ? "where" : "which", [binary], { stdio: "ignore" });
921
- child.on("close", (code) => resolve21(code === 0));
855
+ child.on("close", (code) => resolve20(code === 0));
922
856
  });
923
857
  if (!binaryExists2)
924
858
  return "not-found";
@@ -955,20 +889,6 @@ var init_local_cli_agent_invoker = __esm({
955
889
  });
956
890
 
957
891
  // packages/experience-design-system-generation/dist/src/controller/create-generation-endpoint.js
958
- function createGenerationEndpoint(options = {}) {
959
- const invoker2 = createLocalCliAgentInvoker({
960
- onDebugEvent: options.onDebugEvent
961
- });
962
- return {
963
- async run(request2) {
964
- validateGenerationRequest(request2);
965
- return executeGenerationOrchestrator({ ...request2, invoker: invoker2 });
966
- },
967
- checkAuth(agent) {
968
- return invoker2.checkAuth(agent);
969
- }
970
- };
971
- }
972
892
  var init_create_generation_endpoint = __esm({
973
893
  "packages/experience-design-system-generation/dist/src/controller/create-generation-endpoint.js"() {
974
894
  "use strict";
@@ -1128,20 +1048,8 @@ var init_parse_prop_tool_calls = __esm({
1128
1048
  "packages/experience-design-system-generation/dist/src/services/parsing/parse-prop-tool-calls.js"() {
1129
1049
  "use strict";
1130
1050
  init_read_tool_call_objects();
1131
- VALID_TOOL_NAMES = /* @__PURE__ */ new Set([
1132
- "classify_prop",
1133
- "exclude_prop",
1134
- "classify_component",
1135
- "classify_slot"
1136
- ]);
1137
- VALID_CDF_TYPES = /* @__PURE__ */ new Set([
1138
- "string",
1139
- "richtext",
1140
- "media",
1141
- "enum",
1142
- "token",
1143
- "boolean"
1144
- ]);
1051
+ VALID_TOOL_NAMES = /* @__PURE__ */ new Set(["classify_prop", "exclude_prop", "classify_component", "classify_slot"]);
1052
+ VALID_CDF_TYPES = /* @__PURE__ */ new Set(["string", "richtext", "media", "enum", "token", "boolean"]);
1145
1053
  VALID_CATEGORIES = /* @__PURE__ */ new Set(["content", "design", "state"]);
1146
1054
  }
1147
1055
  });
@@ -1249,10 +1157,7 @@ var init_parse_select_tool_calls = __esm({
1249
1157
  "use strict";
1250
1158
  init_parse_selection_slot_evidence();
1251
1159
  init_read_tool_call_objects();
1252
- VALID_SELECT_TOOL_NAMES = /* @__PURE__ */ new Set([
1253
- "select_component",
1254
- "reject_component"
1255
- ]);
1160
+ VALID_SELECT_TOOL_NAMES = /* @__PURE__ */ new Set(["select_component", "reject_component"]);
1256
1161
  }
1257
1162
  });
1258
1163
 
@@ -1368,32 +1273,6 @@ var init_progress = __esm({
1368
1273
  });
1369
1274
 
1370
1275
  // packages/experience-design-system-generation/dist/src/index.js
1371
- var src_exports = {};
1372
- __export(src_exports, {
1373
- AGENT_BINARIES: () => AGENT_BINARIES,
1374
- AGENT_NAMES: () => AGENT_NAMES,
1375
- DEFAULT_AGENT_NAME: () => DEFAULT_AGENT_NAME,
1376
- agentSupportsBedrock: () => agentSupportsBedrock,
1377
- buildArgs: () => buildAgentArgs,
1378
- buildPrompt: () => buildPrompt,
1379
- checkAgentAuth: () => checkAgentAuth,
1380
- createGenerationEndpoint: () => createGenerationEndpoint,
1381
- createLocalCliAgentInvoker: () => createLocalCliAgentInvoker,
1382
- describeAgentFailure: () => describeAgentFailure,
1383
- executeGenerationOrchestrator: () => executeGenerationOrchestrator,
1384
- extractSentinelOutput: () => extractSentinelOutput,
1385
- formatCustomPromptBanner: () => formatCustomPromptBanner,
1386
- formatGenerateProgressLine: () => formatGenerateProgressLine,
1387
- isAgentName: () => isAgentName,
1388
- parseMapTokenPropToolCallLines: () => parseMapTokenPropToolCallLines,
1389
- parseSelectToolCallLines: () => parseSelectToolCallLines,
1390
- parseTokenToolCallLines: () => parseTokenToolCallLines,
1391
- parseToolCallLines: () => parsePropToolCallLines,
1392
- resolveAgentModel: () => resolveAgentModel,
1393
- resolveBinary: () => resolveAgentBinary,
1394
- resolveSkillPath: () => resolveSkillPath,
1395
- runAgent: () => runAgent
1396
- });
1397
1276
  var init_src = __esm({
1398
1277
  "packages/experience-design-system-generation/dist/src/index.js"() {
1399
1278
  "use strict";
@@ -9676,8 +9555,11 @@ var init_debug_logger = __esm({
9676
9555
 
9677
9556
  // packages/experience-design-system-cli-legacy/src/lib/prop-bucket-debug.ts
9678
9557
  function logPropBuckets(stage, assignments) {
9679
- for (const assignment of assignments) {
9680
- getDebugLogger().event("analyze", `prop-buckets.${stage}`, { ...assignment });
9558
+ const logger = getDebugLogger();
9559
+ if (logger.enabled) {
9560
+ for (const assignment of assignments) {
9561
+ logger.event("analyze", `prop-buckets.${stage}`, { ...assignment });
9562
+ }
9681
9563
  }
9682
9564
  return JSON.stringify(assignments.length === 1 && stage === "generate" ? assignments[0] : assignments);
9683
9565
  }
@@ -10426,41 +10308,6 @@ var init_read3 = __esm({
10426
10308
  }
10427
10309
  });
10428
10310
 
10429
- // packages/experience-design-system-cli-legacy/src/session/core/components/hash-component-shape.ts
10430
- import { createHash as createHash2 } from "node:crypto";
10431
- function hashComponentShape(component) {
10432
- const payload = {
10433
- framework: component.framework,
10434
- name: component.name,
10435
- source: component.source,
10436
- props: component.props.map((p) => ({
10437
- name: p.name,
10438
- type: p.type
10439
- })),
10440
- slots: component.slots.map((s) => ({
10441
- name: s.name,
10442
- isDefault: s.isDefault
10443
- }))
10444
- };
10445
- return createHash2("sha256").update(JSON.stringify(payload)).digest("hex");
10446
- }
10447
- var init_hash_component_shape = __esm({
10448
- "packages/experience-design-system-cli-legacy/src/session/core/components/hash-component-shape.ts"() {
10449
- "use strict";
10450
- }
10451
- });
10452
-
10453
- // packages/experience-design-system-cli-legacy/src/session/core/tokens/hash-token-content.ts
10454
- import { createHash as createHash3 } from "node:crypto";
10455
- function hashTokenContent(rawTokenContent) {
10456
- return createHash3("sha256").update(rawTokenContent.trim()).digest("hex");
10457
- }
10458
- var init_hash_token_content = __esm({
10459
- "packages/experience-design-system-cli-legacy/src/session/core/tokens/hash-token-content.ts"() {
10460
- "use strict";
10461
- }
10462
- });
10463
-
10464
10311
  // packages/experience-design-system-cli-legacy/src/session/repositories/tokens/write.ts
10465
10312
  function deleteRawTokensForSession(db, sessionId2) {
10466
10313
  db.prepare("DELETE FROM raw_token_groups WHERE session_id = ?").run(sessionId2);
@@ -10624,47 +10471,17 @@ var init_replace_raw_prop_token_paths = __esm({
10624
10471
  }
10625
10472
  });
10626
10473
 
10627
- // packages/experience-design-system-cli-legacy/src/session/cache-keys.ts
10628
- var cache_keys_exports = {};
10629
- __export(cache_keys_exports, {
10630
- hashContent: () => hashContent,
10631
- hashFile: () => hashFile,
10632
- hashPromptForSkill: () => hashPromptForSkill
10633
- });
10634
- import { createHash as createHash4 } from "node:crypto";
10635
- import { readFile as readFile7 } from "node:fs/promises";
10636
- import { resolve as resolve8 } from "node:path";
10637
- function hashContent(content) {
10638
- return createHash4("sha256").update(content).digest("hex");
10639
- }
10640
- async function hashFile(filePath) {
10641
- const content = await readFile7(filePath, "utf8");
10642
- return hashContent(content);
10643
- }
10644
- async function hashPromptForSkill(skill, agent, model, skillPathOverride, extraInputs = [], skillContentOverride) {
10645
- const promptHash = skillContentOverride ? hashContent(skillContentOverride) : skillPathOverride ? await hashFile(resolve8(skillPathOverride)) : await hashFile(resolveSkillPath(skill));
10646
- const extraSegment = extraInputs.length > 0 ? `|${extraInputs.join("|")}` : "";
10647
- return hashContent(`${promptHash}|${agent}|${model ?? ""}${extraSegment}`);
10648
- }
10649
- var init_cache_keys = __esm({
10650
- "packages/experience-design-system-cli-legacy/src/session/cache-keys.ts"() {
10651
- "use strict";
10652
- init_src();
10653
- }
10654
- });
10655
-
10656
10474
  // packages/experience-design-system-cli-legacy/src/session/db.ts
10657
10475
  import { DatabaseSync } from "node:sqlite";
10658
10476
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync5 } from "node:fs";
10659
- import { readFile as readFile8 } from "node:fs/promises";
10660
- import { createHash as createHash5 } from "node:crypto";
10477
+ import { readFile as readFile7 } from "node:fs/promises";
10661
10478
  import { homedir as homedir3 } from "node:os";
10662
- import { dirname as dirname14, resolve as resolve9 } from "node:path";
10479
+ import { dirname as dirname14, resolve as resolve8 } from "node:path";
10663
10480
  function getPipelineDbPath() {
10664
10481
  if (process.env.EDS_PIPELINE_DB_PATH) {
10665
- return resolve9(process.env.EDS_PIPELINE_DB_PATH);
10482
+ return resolve8(process.env.EDS_PIPELINE_DB_PATH);
10666
10483
  }
10667
- return resolve9(homedir3(), ".contentful", "experience-design-system-cli", "pipeline.db");
10484
+ return resolve8(homedir3(), ".contentful", "experience-design-system-cli", "pipeline.db");
10668
10485
  }
10669
10486
  function openPipelineDb(dbPath) {
10670
10487
  const path = dbPath ?? getPipelineDbPath();
@@ -10717,7 +10534,6 @@ function applyDbMigrations(db) {
10717
10534
  }
10718
10535
  if (!rawPropColNames.has("dom_attribute")) {
10719
10536
  db.exec("ALTER TABLE raw_props ADD COLUMN dom_attribute INTEGER CHECK (dom_attribute IN (0, 1))");
10720
- rawPropColNames.add("dom_attribute");
10721
10537
  }
10722
10538
  const rawPropsDdl = db.prepare(`SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'raw_props'`).get();
10723
10539
  if (rawPropsDdl && !rawPropsDdl.sql.includes(`'unattached'`)) {
@@ -10799,134 +10615,8 @@ function applyDbMigrations(db) {
10799
10615
  if (!rawSlotColsForRationale.some((c2) => c2.name === "rationale")) {
10800
10616
  db.exec("ALTER TABLE raw_slots ADD COLUMN rationale TEXT");
10801
10617
  }
10802
- const hasExtractCache = db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='extract_cache'`).all();
10803
- if (hasExtractCache.length === 0) {
10804
- db.exec(`
10805
- CREATE TABLE extract_cache (
10806
- file_path TEXT NOT NULL,
10807
- file_hash TEXT NOT NULL,
10808
- cli_version TEXT NOT NULL,
10809
- created_at TEXT NOT NULL,
10810
- updated_at TEXT NOT NULL,
10811
- components_json TEXT NOT NULL,
10812
- PRIMARY KEY (file_hash, cli_version)
10813
- );
10814
- CREATE INDEX idx_extract_cache_file ON extract_cache(file_path);
10815
- `);
10816
- }
10817
- const hasSelectCache = db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='select_cache'`).all();
10818
- if (hasSelectCache.length === 0) {
10819
- db.exec(`
10820
- CREATE TABLE select_cache (
10821
- component_hash TEXT NOT NULL,
10822
- prompt_hash TEXT NOT NULL,
10823
- cli_version TEXT NOT NULL,
10824
- decision TEXT NOT NULL CHECK (decision IN ('accepted','rejected')),
10825
- reason TEXT,
10826
- created_at TEXT NOT NULL,
10827
- updated_at TEXT NOT NULL,
10828
- PRIMARY KEY (component_hash, prompt_hash, cli_version)
10829
- );
10830
- `);
10831
- }
10832
- const tables = db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='generation_cache'`).all();
10833
- if (tables.length === 0) {
10834
- db.exec(`
10835
- CREATE TABLE generation_cache (
10836
- input_hash TEXT NOT NULL,
10837
- entity_type TEXT NOT NULL CHECK (entity_type IN ('component', 'token_set', 'token_mapping')),
10838
- entity_id TEXT NOT NULL,
10839
- source_session_id TEXT NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
10840
- human_edited INTEGER NOT NULL DEFAULT 0 CHECK (human_edited IN (0, 1)),
10841
- created_at TEXT NOT NULL,
10842
- updated_at TEXT NOT NULL,
10843
- PRIMARY KEY (input_hash, entity_type, entity_id)
10844
- );
10845
- CREATE INDEX idx_generation_cache_entity ON generation_cache(entity_type, entity_id);
10846
- CREATE INDEX idx_generation_cache_session ON generation_cache(source_session_id);
10847
- `);
10848
- }
10849
- const genCacheCols = db.prepare(`PRAGMA table_info(generation_cache)`).all();
10850
- const hasPromptHash = genCacheCols.some((c2) => c2.name === "prompt_hash");
10851
- const oldPkCols = genCacheCols.filter((c2) => c2.pk > 0).map((c2) => c2.name);
10852
- const promptHashInPk = oldPkCols.includes("prompt_hash");
10853
- if (!hasPromptHash) {
10854
- db.exec(`ALTER TABLE generation_cache ADD COLUMN prompt_hash TEXT NOT NULL DEFAULT ''`);
10855
- }
10856
- if (!promptHashInPk) {
10857
- db.exec("BEGIN");
10858
- try {
10859
- db.exec(`
10860
- CREATE TABLE generation_cache__new (
10861
- input_hash TEXT NOT NULL,
10862
- entity_type TEXT NOT NULL CHECK (entity_type IN ('component', 'token_set', 'token_mapping')),
10863
- entity_id TEXT NOT NULL,
10864
- source_session_id TEXT NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
10865
- human_edited INTEGER NOT NULL DEFAULT 0 CHECK (human_edited IN (0, 1)),
10866
- created_at TEXT NOT NULL,
10867
- updated_at TEXT NOT NULL,
10868
- prompt_hash TEXT NOT NULL DEFAULT '',
10869
- PRIMARY KEY (input_hash, prompt_hash, entity_type, entity_id)
10870
- );
10871
- INSERT INTO generation_cache__new
10872
- (input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash)
10873
- SELECT input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash
10874
- FROM generation_cache;
10875
- DROP TABLE generation_cache;
10876
- ALTER TABLE generation_cache__new RENAME TO generation_cache;
10877
- CREATE INDEX IF NOT EXISTS idx_generation_cache_entity ON generation_cache(entity_type, entity_id);
10878
- CREATE INDEX IF NOT EXISTS idx_generation_cache_session ON generation_cache(source_session_id);
10879
- `);
10880
- db.exec("COMMIT");
10881
- } catch (e) {
10882
- db.exec("ROLLBACK");
10883
- throw e;
10884
- }
10885
- }
10886
- const genCacheTableSql = db.prepare(`SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'generation_cache'`).get();
10887
- const hasTokenMappingEntityType = genCacheTableSql?.sql.includes("'token_mapping'") ?? true;
10888
- if (!hasTokenMappingEntityType) {
10889
- db.exec("BEGIN");
10890
- try {
10891
- db.exec(`
10892
- CREATE TABLE generation_cache__new2 (
10893
- input_hash TEXT NOT NULL,
10894
- entity_type TEXT NOT NULL CHECK (entity_type IN ('component', 'token_set', 'token_mapping')),
10895
- entity_id TEXT NOT NULL,
10896
- source_session_id TEXT NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
10897
- human_edited INTEGER NOT NULL DEFAULT 0 CHECK (human_edited IN (0, 1)),
10898
- created_at TEXT NOT NULL,
10899
- updated_at TEXT NOT NULL,
10900
- prompt_hash TEXT NOT NULL DEFAULT '',
10901
- PRIMARY KEY (input_hash, prompt_hash, entity_type, entity_id)
10902
- );
10903
- INSERT INTO generation_cache__new2
10904
- (input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash)
10905
- SELECT input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash
10906
- FROM generation_cache;
10907
- DROP TABLE generation_cache;
10908
- ALTER TABLE generation_cache__new2 RENAME TO generation_cache;
10909
- CREATE INDEX IF NOT EXISTS idx_generation_cache_entity ON generation_cache(entity_type, entity_id);
10910
- CREATE INDEX IF NOT EXISTS idx_generation_cache_session ON generation_cache(source_session_id);
10911
- `);
10912
- db.exec("COMMIT");
10913
- } catch (e) {
10914
- db.exec("ROLLBACK");
10915
- throw e;
10916
- }
10917
- }
10918
- const hasCompositionCache = db.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='composition_cache'`).all();
10919
- if (hasCompositionCache.length === 0) {
10920
- db.exec(`
10921
- CREATE TABLE composition_cache (
10922
- input_hash TEXT NOT NULL,
10923
- cli_version TEXT NOT NULL,
10924
- agent_output TEXT NOT NULL,
10925
- created_at TEXT NOT NULL,
10926
- updated_at TEXT NOT NULL,
10927
- PRIMARY KEY (input_hash, cli_version)
10928
- );
10929
- `);
10618
+ for (const table of REMOVED_CACHE_TABLES) {
10619
+ db.exec(`DROP TABLE IF EXISTS ${table}`);
10930
10620
  }
10931
10621
  }
10932
10622
  function loadComponentReviewMetadata(db, sessionId2, componentName) {
@@ -11462,16 +11152,16 @@ function extractRelativeImportPaths(sourceText) {
11462
11152
  return [...specifiers];
11463
11153
  }
11464
11154
  async function resolveRelativeImport(specifier, fromDir) {
11465
- const basePath = resolve9(fromDir, specifier);
11155
+ const basePath = resolve8(fromDir, specifier);
11466
11156
  const candidates = [
11467
11157
  basePath,
11468
11158
  ...rewrittenSourcePaths(basePath),
11469
11159
  ...SIBLING_FILE_EXTENSIONS.map((ext) => `${basePath}${ext}`),
11470
- ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve9(basePath, `index${ext}`))
11160
+ ...SIBLING_FILE_EXTENSIONS.map((ext) => resolve8(basePath, `index${ext}`))
11471
11161
  ];
11472
11162
  for (const candidate of candidates) {
11473
11163
  try {
11474
- await readFile8(candidate, "utf8");
11164
+ await readFile7(candidate, "utf8");
11475
11165
  return candidate;
11476
11166
  } catch {
11477
11167
  }
@@ -11487,7 +11177,7 @@ async function resolveImportSpecifiers(sourceText, fromDir) {
11487
11177
  return resolvedPaths;
11488
11178
  }
11489
11179
  async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateTypeNames = []) {
11490
- const visited = /* @__PURE__ */ new Set([resolve9(sourcePath)]);
11180
+ const visited = /* @__PURE__ */ new Set([resolve8(sourcePath)]);
11491
11181
  const discovered = [];
11492
11182
  let frontier = [{ text: sourceText, dir: dirname14(sourcePath) }];
11493
11183
  for (let hop = 0; hop < MAX_SIBLING_DEPTH && discovered.length < MAX_SIBLING_CANDIDATES_EXPLORED; hop++) {
@@ -11501,7 +11191,7 @@ async function loadSiblingFiles(sourceText, sourcePath, propNames, candidateType
11501
11191
  if (discovered.length >= MAX_SIBLING_CANDIDATES_EXPLORED) break;
11502
11192
  let content;
11503
11193
  try {
11504
- content = await readFile8(resolvedPath, "utf8");
11194
+ content = await readFile7(resolvedPath, "utf8");
11505
11195
  } catch {
11506
11196
  continue;
11507
11197
  }
@@ -11538,7 +11228,7 @@ async function loadComponentSourceRef(name, sourcePath, propNames = [], propType
11538
11228
  let truncatedSiblingCount = 0;
11539
11229
  const usesNotShown = /* @__PURE__ */ new Set();
11540
11230
  try {
11541
- const rawText = await readFile8(sourcePath, "utf8");
11231
+ const rawText = await readFile7(sourcePath, "utf8");
11542
11232
  let siblingUsesNotShown;
11543
11233
  let declaredTypeNames;
11544
11234
  ({
@@ -11974,108 +11664,6 @@ function backfillUnclassifiedProps(db, sessionId2) {
11974
11664
  ).run(sessionId2, sessionId2);
11975
11665
  return Number(withCategory.changes) + Number(withoutCategory.changes);
11976
11666
  }
11977
- function computeMapTokensInputHash(db, sessionId2, componentSourceRefs = []) {
11978
- const props = db.prepare(
11979
- `SELECT rc.name AS component_name, rp.name AS prop_name, rp.cdf_token_kind, rp.default_value
11980
- FROM raw_props rp
11981
- JOIN raw_components rc ON rc.session_id = rp.session_id AND rc.component_id = rp.component_id
11982
- WHERE rp.session_id = ? AND rp.cdf_type = 'token' AND rp.cdf_category = 'design'
11983
- ORDER BY rc.name, rp.name`
11984
- ).all(sessionId2);
11985
- const tokens = db.prepare(`SELECT path, type FROM raw_tokens WHERE session_id = ? ORDER BY path`).all(sessionId2);
11986
- const defaultMappings = db.prepare("SELECT raw_name, path, source FROM raw_token_name_paths WHERE session_id = ? ORDER BY raw_name").all(sessionId2);
11987
- const payload = {
11988
- props: props.map((p) => ({
11989
- component: p.component_name,
11990
- prop: p.prop_name,
11991
- tokenKind: p.cdf_token_kind,
11992
- rawDefault: p.default_value
11993
- })),
11994
- tokens,
11995
- defaultMappings,
11996
- // The agent's evidence, not just its inputs: a comment or allowlist edit
11997
- // in a source file (or a sibling it reads) changes the correct answer
11998
- // without touching props or tokens, so it must invalidate the cache too.
11999
- sourceRefs: [...componentSourceRefs].sort((a, b) => a.component.localeCompare(b.component)).map((ref) => ({
12000
- component: ref.component,
12001
- content: ref.content,
12002
- siblingFiles: (ref.siblingFiles ?? []).map((s) => ({ path: s.path, content: s.content })).sort((a, b) => a.path.localeCompare(b.path)),
12003
- usesNotShown: [...ref.usesNotShown ?? []].sort()
12004
- }))
12005
- };
12006
- return createHash5("sha256").update(JSON.stringify(payload)).digest("hex");
12007
- }
12008
- function lookupCache(db, inputHash, entityType, entityId, promptHash = "") {
12009
- const row = db.prepare(
12010
- `SELECT input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash
12011
- FROM generation_cache
12012
- WHERE input_hash = ? AND entity_type = ? AND entity_id = ? AND prompt_hash = ?`
12013
- ).get(inputHash, entityType, entityId, promptHash);
12014
- if (!row) return null;
12015
- return {
12016
- inputHash: row.input_hash,
12017
- entityType: row.entity_type,
12018
- entityId: row.entity_id,
12019
- sourceSessionId: row.source_session_id,
12020
- humanEdited: row.human_edited === 1,
12021
- promptHash: row.prompt_hash,
12022
- createdAt: row.created_at,
12023
- updatedAt: row.updated_at
12024
- };
12025
- }
12026
- function lookupCacheByEntity(db, entityType, entityId) {
12027
- const row = db.prepare(
12028
- `SELECT input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash
12029
- FROM generation_cache
12030
- WHERE entity_type = ? AND entity_id = ?
12031
- ORDER BY updated_at DESC LIMIT 1`
12032
- ).get(entityType, entityId);
12033
- if (!row) return null;
12034
- return {
12035
- inputHash: row.input_hash,
12036
- entityType: row.entity_type,
12037
- entityId: row.entity_id,
12038
- sourceSessionId: row.source_session_id,
12039
- humanEdited: row.human_edited === 1,
12040
- promptHash: row.prompt_hash,
12041
- createdAt: row.created_at,
12042
- updatedAt: row.updated_at
12043
- };
12044
- }
12045
- function storeCache(db, inputHash, entityType, entityId, sourceSessionId, humanEdited, promptHash = "") {
12046
- storeCaches(db, [{ inputHash, entityType, entityId, sourceSessionId, humanEdited, promptHash }]);
12047
- }
12048
- function storeCaches(db, entries) {
12049
- if (entries.length === 0) return;
12050
- const now = (/* @__PURE__ */ new Date()).toISOString();
12051
- const insert = db.prepare(
12052
- `INSERT INTO generation_cache (input_hash, entity_type, entity_id, source_session_id, human_edited, created_at, updated_at, prompt_hash)
12053
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
12054
- ON CONFLICT(input_hash, prompt_hash, entity_type, entity_id) DO UPDATE SET
12055
- source_session_id = excluded.source_session_id,
12056
- human_edited = CASE WHEN generation_cache.human_edited = 1 THEN 1 ELSE excluded.human_edited END,
12057
- updated_at = excluded.updated_at`
12058
- );
12059
- db.exec("BEGIN");
12060
- try {
12061
- for (const entry of entries) {
12062
- insert.run(
12063
- entry.inputHash,
12064
- entry.entityType,
12065
- entry.entityId,
12066
- entry.sourceSessionId,
12067
- entry.humanEdited ? 1 : 0,
12068
- now,
12069
- now,
12070
- entry.promptHash ?? ""
12071
- );
12072
- }
12073
- db.exec("COMMIT");
12074
- } catch (e) {
12075
- db.exec("ROLLBACK");
12076
- throw e;
12077
- }
12078
- }
12079
11667
  function storeScannedFiles(db, sessionId2, filePaths) {
12080
11668
  db.exec("BEGIN");
12081
11669
  try {
@@ -12158,105 +11746,7 @@ function filterUnknownSlotAllowedComponents(db, sessionId2, allowedComponentName
12158
11746
  }
12159
11747
  return unknown;
12160
11748
  }
12161
- function copyComponentFromCache(db, sourceSessionId, targetSessionId, componentId, manageTransaction = true, options = {}) {
12162
- const now = (/* @__PURE__ */ new Date()).toISOString();
12163
- if (manageTransaction) db.exec("BEGIN");
12164
- try {
12165
- const srcComp = db.prepare(
12166
- `SELECT description, status, component_description_rationale, props_rationale, slots_rationale
12167
- FROM raw_components WHERE session_id = ? AND component_id = ?`
12168
- ).get(sourceSessionId, componentId);
12169
- if (srcComp) {
12170
- db.prepare(
12171
- `UPDATE raw_components
12172
- SET description = ?, status = ?, component_description_rationale = ?, props_rationale = ?, slots_rationale = ?, extracted_at = ?
12173
- WHERE session_id = ? AND component_id = ?`
12174
- ).run(
12175
- srcComp.description,
12176
- srcComp.status,
12177
- srcComp.component_description_rationale,
12178
- srcComp.props_rationale,
12179
- srcComp.slots_rationale,
12180
- now,
12181
- targetSessionId,
12182
- componentId
12183
- );
12184
- }
12185
- const srcProps = db.prepare(
12186
- `SELECT name, cdf_type, cdf_category, cdf_token_kind, required, description, default_value, rationale
12187
- FROM raw_props WHERE session_id = ? AND component_id = ?`
12188
- ).all(sourceSessionId, componentId);
12189
- for (const p of srcProps) {
12190
- db.prepare(
12191
- `UPDATE raw_props SET cdf_type = ?, cdf_category = ?, cdf_token_kind = ?, required = ?, description = ?, default_value = ?, rationale = ?
12192
- WHERE session_id = ? AND component_id = ? AND name = ?`
12193
- ).run(
12194
- p.cdf_type,
12195
- p.cdf_category,
12196
- p.cdf_token_kind,
12197
- p.required,
12198
- p.description,
12199
- p.default_value,
12200
- p.rationale,
12201
- targetSessionId,
12202
- componentId,
12203
- p.name
12204
- );
12205
- }
12206
- db.prepare(`DELETE FROM raw_prop_allowed_values WHERE session_id = ? AND component_id = ?`).run(
12207
- targetSessionId,
12208
- componentId
12209
- );
12210
- const srcAV = db.prepare(
12211
- `SELECT prop_name, position, value FROM raw_prop_allowed_values WHERE session_id = ? AND component_id = ?`
12212
- ).all(sourceSessionId, componentId);
12213
- const insertAV = db.prepare(
12214
- `INSERT INTO raw_prop_allowed_values (session_id, component_id, prop_name, position, value) VALUES (?, ?, ?, ?, ?)`
12215
- );
12216
- for (const av of srcAV) {
12217
- insertAV.run(targetSessionId, componentId, av.prop_name, av.position, av.value);
12218
- }
12219
- const srcSlots = db.prepare(`SELECT name, required, description, rationale FROM raw_slots WHERE session_id = ? AND component_id = ?`).all(sourceSessionId, componentId);
12220
- for (const s of srcSlots) {
12221
- db.prepare(
12222
- `UPDATE raw_slots SET required = ?, description = ?, rationale = ? WHERE session_id = ? AND component_id = ? AND name = ?`
12223
- ).run(s.required, s.description, s.rationale, targetSessionId, componentId, s.name);
12224
- }
12225
- db.prepare(`DELETE FROM raw_slot_allowed_components WHERE session_id = ? AND component_id = ?`).run(
12226
- targetSessionId,
12227
- componentId
12228
- );
12229
- const srcSAC = db.prepare(
12230
- `SELECT slot_name, position, allowed_component FROM raw_slot_allowed_components WHERE session_id = ? AND component_id = ?`
12231
- ).all(sourceSessionId, componentId);
12232
- const insertSAC = db.prepare(
12233
- `INSERT INTO raw_slot_allowed_components (session_id, component_id, slot_name, allowed_component, position) VALUES (?, ?, ?, ?, ?)`
12234
- );
12235
- const allowedSAC = options.allowedComponentNames ? srcSAC.filter((sac) => options.allowedComponentNames.has(sac.allowed_component)) : srcSAC;
12236
- for (const sac of allowedSAC) {
12237
- insertSAC.run(targetSessionId, componentId, sac.slot_name, sac.allowed_component, sac.position);
12238
- }
12239
- db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, targetSessionId);
12240
- if (manageTransaction) db.exec("COMMIT");
12241
- } catch (e) {
12242
- if (manageTransaction) db.exec("ROLLBACK");
12243
- throw e;
12244
- }
12245
- }
12246
- function copyComponentsFromCache(db, entries, options = {}) {
12247
- if (entries.length === 0) return;
12248
- db.exec("BEGIN");
12249
- try {
12250
- for (const entry of entries) {
12251
- copyComponentFromCache(db, entry.sourceSessionId, entry.targetSessionId, entry.componentId, false, options);
12252
- }
12253
- db.exec("COMMIT");
12254
- } catch (e) {
12255
- db.exec("ROLLBACK");
12256
- throw e;
12257
- }
12258
- }
12259
- function copyTokensFromCache(db, sourceSessionId, targetSessionId) {
11749
+ function copyTokensBetweenSessions(db, sourceSessionId, targetSessionId) {
12260
11750
  const now = (/* @__PURE__ */ new Date()).toISOString();
12261
11751
  db.exec("BEGIN");
12262
11752
  try {
@@ -12277,139 +11767,7 @@ function copyTokensFromCache(db, sourceSessionId, targetSessionId) {
12277
11767
  throw e;
12278
11768
  }
12279
11769
  }
12280
- function copyMapTokensFromCache(db, sourceSessionId, targetSessionId) {
12281
- const now = (/* @__PURE__ */ new Date()).toISOString();
12282
- let copiedCount = 0;
12283
- db.exec("BEGIN");
12284
- try {
12285
- const sourceRows = db.prepare(
12286
- `SELECT rc.name AS component_name, rptp.prop_name, rptp.source, rptp.position, rptp.path
12287
- FROM raw_prop_token_paths rptp
12288
- JOIN raw_components rc ON rc.session_id = rptp.session_id AND rc.component_id = rptp.component_id
12289
- WHERE rptp.session_id = ?
12290
- ORDER BY rc.name, rptp.prop_name, rptp.position`
12291
- ).all(sourceSessionId);
12292
- const targetComponents = db.prepare(`SELECT component_id, name FROM raw_components WHERE session_id = ?`).all(targetSessionId);
12293
- const targetIdByName = new Map(targetComponents.map((c2) => [c2.name, c2.component_id]));
12294
- const targetProps = new Set(
12295
- db.prepare(`SELECT component_id, name FROM raw_props WHERE session_id = ?`).all(targetSessionId).map((p) => `${p.component_id}::${p.name}`)
12296
- );
12297
- const insertPath = db.prepare(
12298
- `INSERT INTO raw_prop_token_paths (session_id, component_id, prop_name, source, position, path)
12299
- VALUES (?, ?, ?, ?, ?, ?)`
12300
- );
12301
- const clearedProps = /* @__PURE__ */ new Set();
12302
- const copiedProps = /* @__PURE__ */ new Set();
12303
- for (const row of sourceRows) {
12304
- const targetComponentId = targetIdByName.get(row.component_name);
12305
- if (!targetComponentId) continue;
12306
- if (!targetProps.has(`${targetComponentId}::${row.prop_name}`)) continue;
12307
- const propKey = `${targetComponentId}::${row.prop_name}`;
12308
- if (!clearedProps.has(propKey)) {
12309
- clearedProps.add(propKey);
12310
- db.prepare(`DELETE FROM raw_prop_token_paths WHERE session_id = ? AND component_id = ? AND prop_name = ?`).run(
12311
- targetSessionId,
12312
- targetComponentId,
12313
- row.prop_name
12314
- );
12315
- }
12316
- insertPath.run(targetSessionId, targetComponentId, row.prop_name, row.source, row.position, row.path);
12317
- copiedProps.add(propKey);
12318
- }
12319
- copiedCount = copiedProps.size;
12320
- db.prepare("UPDATE sessions SET updated_at = ? WHERE id = ?").run(now, targetSessionId);
12321
- db.exec("COMMIT");
12322
- } catch (e) {
12323
- db.exec("ROLLBACK");
12324
- throw e;
12325
- }
12326
- return copiedCount;
12327
- }
12328
- async function getCliCacheVersion() {
12329
- if (_cliCacheVersionCache) return _cliCacheVersionCache;
12330
- try {
12331
- const { hashContent: hashContent2 } = await Promise.resolve().then(() => (init_cache_keys(), cache_keys_exports));
12332
- const { resolveSkillPath: resolveSkillPath2 } = await Promise.resolve().then(() => (init_src(), src_exports));
12333
- const skills = ["components", "tokens", "select"];
12334
- const parts = [];
12335
- for (const s of skills) {
12336
- try {
12337
- const p = resolveSkillPath2(s);
12338
- parts.push(readFileSync5(p, "utf8"));
12339
- } catch {
12340
- parts.push(`<missing:${s}>`);
12341
- }
12342
- }
12343
- _cliCacheVersionCache = hashContent2(parts.join("\n---\n"));
12344
- return _cliCacheVersionCache;
12345
- } catch {
12346
- _cliCacheVersionCache = "fallback";
12347
- return _cliCacheVersionCache;
12348
- }
12349
- }
12350
- function storeExtractCache(db, filePath, fileHash, cliVersion2, components) {
12351
- const now = (/* @__PURE__ */ new Date()).toISOString();
12352
- const componentsJson = JSON.stringify(components);
12353
- db.prepare(
12354
- `INSERT INTO extract_cache (file_path, file_hash, cli_version, created_at, updated_at, components_json)
12355
- VALUES (?, ?, ?, ?, ?, ?)
12356
- ON CONFLICT(file_hash, cli_version) DO UPDATE SET
12357
- file_path = excluded.file_path,
12358
- updated_at = excluded.updated_at,
12359
- components_json = excluded.components_json`
12360
- ).run(filePath, fileHash, cliVersion2, now, now, componentsJson);
12361
- }
12362
- function lookupExtractCache(db, fileHash, cliVersion2) {
12363
- const row = db.prepare(
12364
- `SELECT file_path, file_hash, cli_version, created_at, updated_at, components_json
12365
- FROM extract_cache
12366
- WHERE file_hash = ? AND cli_version = ?`
12367
- ).get(fileHash, cliVersion2);
12368
- if (!row) return null;
12369
- let components = [];
12370
- try {
12371
- components = JSON.parse(row.components_json);
12372
- } catch {
12373
- return null;
12374
- }
12375
- return {
12376
- filePath: row.file_path,
12377
- fileHash: row.file_hash,
12378
- cliVersion: row.cli_version,
12379
- createdAt: row.created_at,
12380
- updatedAt: row.updated_at,
12381
- components
12382
- };
12383
- }
12384
- function storeSelectCache(db, componentHash, promptHash, cliVersion2, decision, reason) {
12385
- const now = (/* @__PURE__ */ new Date()).toISOString();
12386
- db.prepare(
12387
- `INSERT INTO select_cache (component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at)
12388
- VALUES (?, ?, ?, ?, ?, ?, ?)
12389
- ON CONFLICT(component_hash, prompt_hash, cli_version) DO UPDATE SET
12390
- decision = excluded.decision,
12391
- reason = excluded.reason,
12392
- updated_at = excluded.updated_at`
12393
- ).run(componentHash, promptHash, cliVersion2, decision, reason, now, now);
12394
- }
12395
- function lookupSelectCache(db, componentHash, promptHash, cliVersion2) {
12396
- const row = db.prepare(
12397
- `SELECT component_hash, prompt_hash, cli_version, decision, reason, created_at, updated_at
12398
- FROM select_cache
12399
- WHERE component_hash = ? AND prompt_hash = ? AND cli_version = ?`
12400
- ).get(componentHash, promptHash, cliVersion2);
12401
- if (!row) return null;
12402
- return {
12403
- componentHash: row.component_hash,
12404
- promptHash: row.prompt_hash,
12405
- cliVersion: row.cli_version,
12406
- decision: row.decision,
12407
- reason: row.reason,
12408
- createdAt: row.created_at,
12409
- updatedAt: row.updated_at
12410
- };
12411
- }
12412
- var SCHEMA, MAX_COMPONENT_SOURCE_CHARS, MAX_SIBLING_FILES, MAX_SIBLING_SNIPPET_CHARS, MAX_TYPE_DECLARING_SIBLING_CHARS, MAX_ENLARGED_SIBLINGS, MAX_SIBLING_DEPTH, MAX_SIBLING_CANDIDATES_EXPLORED, RELATIVE_IMPORT_PATTERN, SIBLING_FILE_EXTENSIONS, TS_ESM_EXTENSION_REWRITES, IDENTIFIER_PATTERN, _cliCacheVersionCache;
11770
+ var SCHEMA, REMOVED_CACHE_TABLES, MAX_COMPONENT_SOURCE_CHARS, MAX_SIBLING_FILES, MAX_SIBLING_SNIPPET_CHARS, MAX_TYPE_DECLARING_SIBLING_CHARS, MAX_ENLARGED_SIBLINGS, MAX_SIBLING_DEPTH, MAX_SIBLING_CANDIDATES_EXPLORED, RELATIVE_IMPORT_PATTERN, SIBLING_FILE_EXTENSIONS, TS_ESM_EXTENSION_REWRITES, IDENTIFIER_PATTERN;
12413
11771
  var init_db = __esm({
12414
11772
  "packages/experience-design-system-cli-legacy/src/session/db.ts"() {
12415
11773
  "use strict";
@@ -12423,8 +11781,6 @@ var init_db = __esm({
12423
11781
  init_write2();
12424
11782
  init_session_resolver();
12425
11783
  init_read3();
12426
- init_hash_component_shape();
12427
- init_hash_token_content();
12428
11784
  init_read3();
12429
11785
  init_store_dtcg_tokens();
12430
11786
  init_apply_tool_calls();
@@ -12548,17 +11904,6 @@ CREATE TABLE IF NOT EXISTS raw_tokens (
12548
11904
  FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
12549
11905
  );
12550
11906
 
12551
- CREATE TABLE IF NOT EXISTS generation_cache (
12552
- input_hash TEXT NOT NULL,
12553
- entity_type TEXT NOT NULL CHECK (entity_type IN ('component', 'token_set', 'token_mapping')),
12554
- entity_id TEXT NOT NULL,
12555
- source_session_id TEXT NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
12556
- human_edited INTEGER NOT NULL DEFAULT 0 CHECK (human_edited IN (0, 1)),
12557
- created_at TEXT NOT NULL,
12558
- updated_at TEXT NOT NULL,
12559
- PRIMARY KEY (input_hash, entity_type, entity_id)
12560
- );
12561
-
12562
11907
  CREATE TABLE IF NOT EXISTS scanned_files (
12563
11908
  session_id TEXT NOT NULL REFERENCES sessions(id) ON DELETE CASCADE,
12564
11909
  path TEXT NOT NULL,
@@ -12604,10 +11949,9 @@ CREATE INDEX IF NOT EXISTS idx_raw_props_session ON raw_props(session_id,
12604
11949
  CREATE INDEX IF NOT EXISTS idx_raw_slots_session ON raw_slots(session_id, component_id);
12605
11950
  CREATE INDEX IF NOT EXISTS idx_raw_tokens_session ON raw_tokens(session_id);
12606
11951
  CREATE INDEX IF NOT EXISTS idx_raw_token_groups_session ON raw_token_groups(session_id);
12607
- CREATE INDEX IF NOT EXISTS idx_generation_cache_entity ON generation_cache(entity_type, entity_id);
12608
- CREATE INDEX IF NOT EXISTS idx_generation_cache_session ON generation_cache(source_session_id);
12609
11952
  CREATE INDEX IF NOT EXISTS idx_scanned_files_session ON scanned_files(session_id);
12610
11953
  `;
11954
+ REMOVED_CACHE_TABLES = ["generation_cache", "extract_cache", "composition_cache", "select_cache"];
12611
11955
  MAX_COMPONENT_SOURCE_CHARS = 8e3;
12612
11956
  MAX_SIBLING_FILES = 5;
12613
11957
  MAX_SIBLING_SNIPPET_CHARS = 1200;
@@ -12624,16 +11968,15 @@ CREATE INDEX IF NOT EXISTS idx_scanned_files_session ON scanned_files(session
12624
11968
  [".cjs", [".cts", ".cjs"]]
12625
11969
  ];
12626
11970
  IDENTIFIER_PATTERN = /[A-Za-z_$][A-Za-z0-9_$]*/g;
12627
- _cliCacheVersionCache = null;
12628
11971
  }
12629
11972
  });
12630
11973
 
12631
11974
  // packages/experience-design-system-cli-legacy/src/helpers/read-existing-contentful-entities-from-session.ts
12632
- import { readFile as readFile9 } from "node:fs/promises";
11975
+ import { readFile as readFile8 } from "node:fs/promises";
12633
11976
  async function readExistingContentfulEntitiesFromSession(path) {
12634
11977
  if (!path) return void 0;
12635
11978
  try {
12636
- const raw = await readFile9(path, "utf8");
11979
+ const raw = await readFile8(path, "utf8");
12637
11980
  const parsed = JSON.parse(raw);
12638
11981
  if (!Array.isArray(parsed.components) || !Array.isArray(parsed.tokens)) return void 0;
12639
11982
  return parsed;
@@ -12757,21 +12100,21 @@ var init_resolve_session_id = __esm({
12757
12100
  });
12758
12101
 
12759
12102
  // packages/experience-design-system-cli-legacy/src/analyze/select/persistence.ts
12760
- import { access, appendFile, mkdir as mkdir2, readFile as readFile10, writeFile as writeFile2 } from "node:fs/promises";
12103
+ import { access, appendFile, mkdir as mkdir2, readFile as readFile9, writeFile as writeFile2 } from "node:fs/promises";
12761
12104
  import { homedir as homedir4 } from "node:os";
12762
- import { resolve as resolve10 } from "node:path";
12105
+ import { resolve as resolve9 } from "node:path";
12763
12106
  function getRefineArtifactsRoot() {
12764
12107
  if (process.env.EDS_REVIEW_ARTIFACTS_DIR) {
12765
- return resolve10(process.env.EDS_REVIEW_ARTIFACTS_DIR);
12108
+ return resolve9(process.env.EDS_REVIEW_ARTIFACTS_DIR);
12766
12109
  }
12767
- return resolve10(homedir4(), ".contentful", "experience-design-system-cli", "reviews");
12110
+ return resolve9(homedir4(), ".contentful", "experience-design-system-cli", "reviews");
12768
12111
  }
12769
12112
  async function getRefineSessionPaths(sessionId2, artifactsRoot) {
12770
- const sessionDir = resolve10(artifactsRoot, sessionId2);
12113
+ const sessionDir = resolve9(artifactsRoot, sessionId2);
12771
12114
  return {
12772
12115
  sessionDir,
12773
- eventsPath: resolve10(sessionDir, "events.jsonl"),
12774
- statePath: resolve10(sessionDir, "current-review-state.json")
12116
+ eventsPath: resolve9(sessionDir, "events.jsonl"),
12117
+ statePath: resolve9(sessionDir, "current-review-state.json")
12775
12118
  };
12776
12119
  }
12777
12120
  async function saveReviewState(statePath, session) {
@@ -12782,7 +12125,7 @@ async function ensureRefineSession(sessionId2, artifactsRoot, initialSnapshot) {
12782
12125
  await mkdir2(paths.sessionDir, { recursive: true });
12783
12126
  try {
12784
12127
  await access(paths.statePath);
12785
- const savedState = await readFile10(paths.statePath, "utf8");
12128
+ const savedState = await readFile9(paths.statePath, "utf8");
12786
12129
  return JSON.parse(savedState);
12787
12130
  } catch {
12788
12131
  await writeFile2(paths.statePath, JSON.stringify(initialSnapshot, null, 2), "utf8");
@@ -13267,8 +12610,8 @@ var init_path_exists = __esm({
13267
12610
  });
13268
12611
 
13269
12612
  // packages/experience-design-system-cli-legacy/src/lib/prompt-overrides.ts
13270
- import { readFile as readFile11 } from "node:fs/promises";
13271
- import { resolve as resolve11 } from "node:path";
12613
+ import { readFile as readFile10 } from "node:fs/promises";
12614
+ import { resolve as resolve10 } from "node:path";
13272
12615
  function looksLikePath(value) {
13273
12616
  if (value.includes("/") || value.includes("\\")) return true;
13274
12617
  if (value.startsWith("~")) return true;
@@ -13300,9 +12643,9 @@ function parsePromptOverrides(inputs) {
13300
12643
  }
13301
12644
  async function resolvePromptOverride(override) {
13302
12645
  if (override.kind === "text") return override.value;
13303
- const abs = resolve11(override.value);
12646
+ const abs = resolve10(override.value);
13304
12647
  try {
13305
- return await readFile11(abs, "utf8");
12648
+ return await readFile10(abs, "utf8");
13306
12649
  } catch {
13307
12650
  throw new Error(`--prompt: could not read prompt file: ${abs}`);
13308
12651
  }
@@ -13317,21 +12660,21 @@ var init_prompt_overrides = __esm({
13317
12660
 
13318
12661
  // packages/experience-design-system-cli-legacy/src/generate/command.ts
13319
12662
  import { createElement } from "react";
13320
- import { readFile as readFile12, readdir, stat } from "node:fs/promises";
13321
- import { join as join14, resolve as resolve12 } from "node:path";
12663
+ import { readFile as readFile11, readdir, stat } from "node:fs/promises";
12664
+ import { join as join14, resolve as resolve11 } from "node:path";
13322
12665
  async function assertFileExists(flag, p) {
13323
12666
  if (!await pathExists(p)) die(`Error: file not found: ${p} (from ${flag})`);
13324
12667
  }
13325
12668
  async function readFileInline(path) {
13326
12669
  if (!path) return void 0;
13327
- const resolved = resolve12(path);
12670
+ const resolved = resolve11(path);
13328
12671
  let s;
13329
12672
  try {
13330
12673
  s = await stat(resolved);
13331
12674
  } catch {
13332
12675
  return void 0;
13333
12676
  }
13334
- if (!s.isDirectory()) return readFile12(resolved, "utf8");
12677
+ if (!s.isDirectory()) return readFile11(resolved, "utf8");
13335
12678
  const files = [];
13336
12679
  async function walk(dir) {
13337
12680
  let entries;
@@ -13357,7 +12700,7 @@ async function readFileInline(path) {
13357
12700
  }
13358
12701
  await walk(resolved);
13359
12702
  if (files.length === 0) return void 0;
13360
- const parts = await Promise.all(files.map((f) => readFile12(f, "utf8").catch(() => "")));
12703
+ const parts = await Promise.all(files.map((f) => readFile11(f, "utf8").catch(() => "")));
13361
12704
  return parts.filter(Boolean).join("\n\n");
13362
12705
  }
13363
12706
  function printFallbackInstructions(options) {
@@ -13379,22 +12722,8 @@ function printFallbackInstructions(options) {
13379
12722
  lines.push(` Re-run the generate command with the agent available, or use --dry-run to inspect the prompt.`);
13380
12723
  process.stderr.write(lines.join("\n") + "\n");
13381
12724
  }
13382
- function createCachedComponentResult(componentName, warnings = []) {
13383
- return {
13384
- componentName,
13385
- classified: 0,
13386
- excluded: 0,
13387
- slots: 0,
13388
- warnings,
13389
- failed: false,
13390
- cached: true,
13391
- renamedSlotsCount: 0
13392
- };
13393
- }
13394
- function writeCachedComponentStatus(position, componentName, pinned) {
13395
- const status = pinned ? c.cyan("pinned (human-edited)") : c.green("cached");
13396
- process.stderr.write(` ${position} ${c.bold(componentName)} ${status}
13397
- `);
12725
+ function generatePropBuckets(component) {
12726
+ return logPropBuckets("generate", [bucketComponentProps(component)]);
13398
12727
  }
13399
12728
  async function showGenerateView(result) {
13400
12729
  if (process.stdout.isTTY) {
@@ -13416,29 +12745,6 @@ session=${result.sessionId}
13416
12745
  );
13417
12746
  await exitWithAnalytics(0);
13418
12747
  }
13419
- function normalizeComponentForCache(component) {
13420
- const slots = component.slots.map((slot, index, allSlots) => ({
13421
- ...slot,
13422
- name: slot.name.trim() || (allSlots.length === 1 ? "children" : `slot_${index}`)
13423
- }));
13424
- return { ...component, slots };
13425
- }
13426
- function lookupComponentCache(db, component, promptHash) {
13427
- const normalized = normalizeComponentForCache(component);
13428
- const inputHash = hashComponentShape(normalized);
13429
- const cached = lookupCache(db, inputHash, "component", component.component_id, promptHash);
13430
- if (cached) return cached;
13431
- const legacyInputHash = hashComponentShape(component);
13432
- return legacyInputHash === inputHash ? null : lookupCache(db, legacyInputHash, "component", component.component_id, promptHash);
13433
- }
13434
- function resolveComponentCache(db, component, promptHash, allowedComponentNames2) {
13435
- const cached = lookupComponentCache(db, component, promptHash);
13436
- if (cached && findUnknownSlotAllowedComponents(db, cached.sourceSessionId, allowedComponentNames2, component.component_id).length === 0) {
13437
- return { entry: cached, humanEdited: cached.humanEdited };
13438
- }
13439
- const pinned = lookupCacheByEntity(db, "component", component.component_id);
13440
- return pinned?.humanEdited && findUnknownSlotAllowedComponents(db, pinned.sourceSessionId, allowedComponentNames2, component.component_id).length === 0 ? { entry: pinned, humanEdited: true } : null;
13441
- }
13442
12748
  async function runOneComponent(options, component, index, total) {
13443
12749
  const {
13444
12750
  agent,
@@ -13448,13 +12754,10 @@ async function runOneComponent(options, component, index, total) {
13448
12754
  tokensInline,
13449
12755
  tokenMapInline,
13450
12756
  verbose,
13451
- noCache,
13452
12757
  skillPathOverride,
13453
12758
  skillContentOverride,
13454
- promptHash,
13455
12759
  existingContentfulEntities,
13456
12760
  existingTokensInline,
13457
- precomputedCachedNames,
13458
12761
  allowedComponentNames: allowedComponentNames2
13459
12762
  } = options;
13460
12763
  const pos = c.dim(`[${index + 1}/${total}]`);
@@ -13479,40 +12782,6 @@ async function runOneComponent(options, component, index, total) {
13479
12782
  allowedComponents: slot.allowedComponents.filter((name) => allowedComponentNames2.has(name))
13480
12783
  };
13481
12784
  });
13482
- const cacheComponent = normalizeComponentForCache(component);
13483
- if (!noCache && precomputedCachedNames.has(component.name)) {
13484
- writeCachedComponentStatus(pos, component.name, false);
13485
- return createCachedComponentResult(component.name);
13486
- }
13487
- if (!noCache) {
13488
- const inputHash = hashComponentShape(cacheComponent);
13489
- const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
13490
- if (resolution && !resolution.humanEdited) {
13491
- copyComponentFromCache(db, resolution.entry.sourceSessionId, sessionId2, component.component_id, true, {
13492
- allowedComponentNames: allowedComponentNames2
13493
- });
13494
- storeCache(
13495
- db,
13496
- inputHash,
13497
- "component",
13498
- component.component_id,
13499
- resolution.entry.sourceSessionId,
13500
- resolution.entry.humanEdited,
13501
- promptHash
13502
- );
13503
- writeCachedComponentStatus(pos, component.name, false);
13504
- return createCachedComponentResult(component.name);
13505
- }
13506
- if (resolution?.humanEdited) {
13507
- copyComponentFromCache(db, resolution.entry.sourceSessionId, sessionId2, component.component_id, true, {
13508
- allowedComponentNames: allowedComponentNames2
13509
- });
13510
- writeCachedComponentStatus(pos, component.name, true);
13511
- return createCachedComponentResult(`${component.name}`, [
13512
- `${component.name}: source changed but human edits preserved`
13513
- ]);
13514
- }
13515
- }
13516
12785
  const rawComponentsInline = JSON.stringify(
13517
12786
  [
13518
12787
  {
@@ -13537,7 +12806,7 @@ async function runOneComponent(options, component, index, total) {
13537
12806
  skill: "components",
13538
12807
  mode: "autonomous",
13539
12808
  rawComponentsInline,
13540
- propBucketsInline: logPropBuckets("generate", [bucketComponentProps(component)]),
12809
+ propBucketsInline: generatePropBuckets(component),
13541
12810
  tokensInline,
13542
12811
  tokenMapInline,
13543
12812
  outDir: process.cwd(),
@@ -13585,10 +12854,6 @@ ${outputBuf}`);
13585
12854
  const applied = applyToolCalls(db, sessionId2, component.component_id, component.name, calls, warnings, {
13586
12855
  allowedComponentNames: allowedComponentNames2
13587
12856
  });
13588
- if (!noCache) {
13589
- const inputHash = hashComponentShape(cacheComponent);
13590
- storeCache(db, inputHash, "component", component.component_id, sessionId2, false, promptHash);
13591
- }
13592
12857
  return {
13593
12858
  componentName: component.name,
13594
12859
  classified: applied.classified,
@@ -13640,7 +12905,7 @@ async function loadAcceptedNames(sessionId2) {
13640
12905
  try {
13641
12906
  const artifactsRoot = getRefineArtifactsRoot();
13642
12907
  const paths = await getRefineSessionPaths(sessionId2, artifactsRoot);
13643
- const raw = await readFile12(paths.statePath, "utf8");
12908
+ const raw = await readFile11(paths.statePath, "utf8");
13644
12909
  const snapshot = JSON.parse(raw);
13645
12910
  const accepted = snapshot.components.filter((c2) => c2.status === "accepted").map((c2) => c2.name);
13646
12911
  if (accepted.length === 0) return null;
@@ -13649,15 +12914,6 @@ async function loadAcceptedNames(sessionId2) {
13649
12914
  return null;
13650
12915
  }
13651
12916
  }
13652
- function parsePrecomputedCachedNames(value) {
13653
- if (!value) return /* @__PURE__ */ new Set();
13654
- try {
13655
- const parsed = JSON.parse(value);
13656
- return new Set(Array.isArray(parsed) ? parsed.filter((name) => typeof name === "string") : []);
13657
- } catch {
13658
- return /* @__PURE__ */ new Set();
13659
- }
13660
- }
13661
12917
  async function runGenerateSkill(skill, opts, verbose = false) {
13662
12918
  const savedCreds = await readExperiencesCredentials();
13663
12919
  const agentName = opts.agent ?? savedCreds.agent;
@@ -13686,8 +12942,8 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13686
12942
  }
13687
12943
  const generatePromptPath = generatePrompt === void 0 ? configuredGeneratePromptPath : void 0;
13688
12944
  if (generatePromptPath) {
13689
- if (!await pathExists(resolve12(generatePromptPath))) {
13690
- die(`Error: custom prompt path not found: ${resolve12(generatePromptPath)}`);
12945
+ if (!await pathExists(resolve11(generatePromptPath))) {
12946
+ die(`Error: custom prompt path not found: ${resolve11(generatePromptPath)}`);
13691
12947
  }
13692
12948
  if (!generatePromptPath.toLowerCase().endsWith(".md")) {
13693
12949
  process.stderr.write(
@@ -13695,7 +12951,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13695
12951
  `
13696
12952
  );
13697
12953
  }
13698
- process.stderr.write(formatCustomPromptBanner("components", resolve12(generatePromptPath)));
12954
+ process.stderr.write(formatCustomPromptBanner("components", resolve11(generatePromptPath)));
13699
12955
  }
13700
12956
  if (skill === "tokens" && !opts.rawTokens) {
13701
12957
  die("Error: --raw-tokens is required when using generate tokens");
@@ -13711,7 +12967,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13711
12967
  let existingContentfulEntities;
13712
12968
  let existingTokensInline;
13713
12969
  if (opts.existingEntitiesPath) {
13714
- existingContentfulEntities = await readExistingContentfulEntitiesFromSession(resolve12(opts.existingEntitiesPath));
12970
+ existingContentfulEntities = await readExistingContentfulEntitiesFromSession(resolve11(opts.existingEntitiesPath));
13715
12971
  if (existingContentfulEntities) {
13716
12972
  existingTokensInline = JSON.stringify(summarizeForMapTokens(existingContentfulEntities));
13717
12973
  } else {
@@ -13808,9 +13064,9 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13808
13064
  skill,
13809
13065
  mode: "autonomous",
13810
13066
  rawComponentsInline: sampleInline ?? rawTokensInline,
13811
- propBucketsInline: sampleComponent ? logPropBuckets("generate", [bucketComponentProps(sampleComponent)]) : void 0,
13067
+ propBucketsInline: sampleComponent ? generatePropBuckets(sampleComponent) : void 0,
13812
13068
  rawTokensInline: skill === "tokens" ? rawTokensInline : void 0,
13813
- rawTokensFilename: opts.rawTokens ? resolve12(opts.rawTokens).split("/").pop() : void 0,
13069
+ rawTokensFilename: opts.rawTokens ? resolve11(opts.rawTokens).split("/").pop() : void 0,
13814
13070
  tokensInline,
13815
13071
  tokenMapInline,
13816
13072
  outDir: process.cwd(),
@@ -13836,64 +13092,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13836
13092
  if (skill === "components" && allComponents && sessionId2) {
13837
13093
  const db = openPipelineDb();
13838
13094
  let componentResults;
13839
- const precomputedCachedNames = parsePrecomputedCachedNames(opts.cachedComponents);
13840
13095
  try {
13841
- const existingContentfulEntitiesHashInputs = [];
13842
- if (existingTokensInline) existingContentfulEntitiesHashInputs.push(hashContent(existingTokensInline));
13843
- const promptHash = await hashPromptForSkill(
13844
- "components",
13845
- agent,
13846
- model,
13847
- generatePromptPath,
13848
- existingContentfulEntitiesHashInputs,
13849
- generatePrompt
13850
- );
13851
- if (opts.cacheStatus) {
13852
- const cacheEnabled = opts.cache !== false && process.env.EDS_NO_CACHE !== "1";
13853
- const cachedComponents = cacheEnabled ? allComponents.flatMap((component) => {
13854
- const resolution = resolveComponentCache(db, component, promptHash, allowedComponentNames2);
13855
- return resolution ? [{ component, resolution }] : [];
13856
- }) : [];
13857
- if (cacheEnabled && opts.restoreCache) {
13858
- const restorations = [];
13859
- const rekeyed = [];
13860
- const componentStatus = db.prepare(
13861
- "SELECT status FROM raw_components WHERE session_id = ? AND component_id = ?"
13862
- );
13863
- for (const { component, resolution } of cachedComponents) {
13864
- const current = componentStatus.get(sessionId2, component.component_id);
13865
- if (current?.status === "generated") continue;
13866
- renameEmptySlots(db, sessionId2, component.component_id, component.name, component.slots.length);
13867
- restorations.push({
13868
- sourceSessionId: resolution.entry.sourceSessionId,
13869
- targetSessionId: sessionId2,
13870
- componentId: component.component_id
13871
- });
13872
- rekeyed.push({ component, cached: resolution.entry });
13873
- }
13874
- copyComponentsFromCache(db, restorations, { allowedComponentNames: allowedComponentNames2 });
13875
- storeCaches(
13876
- db,
13877
- rekeyed.map(({ component, cached }) => ({
13878
- inputHash: hashComponentShape(normalizeComponentForCache(component)),
13879
- entityType: "component",
13880
- entityId: component.component_id,
13881
- sourceSessionId: cached.sourceSessionId,
13882
- humanEdited: cached.humanEdited,
13883
- promptHash
13884
- }))
13885
- );
13886
- }
13887
- const fullyCached = cacheEnabled && cachedComponents.length === allComponents.length;
13888
- process.stdout.write(`cache-status=${fullyCached ? "hit" : "miss"}
13889
- `);
13890
- process.stdout.write(
13891
- `cache-components=${JSON.stringify(cachedComponents.map(({ component }) => component.name))}
13892
- `
13893
- );
13894
- await exitWithAnalytics(0);
13895
- return;
13896
- }
13897
13096
  componentResults = await runAllComponents(
13898
13097
  {
13899
13098
  agent,
@@ -13903,13 +13102,10 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13903
13102
  tokensInline,
13904
13103
  tokenMapInline,
13905
13104
  verbose,
13906
- noCache: opts.cache === false || process.env.EDS_NO_CACHE === "1",
13907
13105
  skillPathOverride: generatePromptPath,
13908
13106
  skillContentOverride: generatePrompt,
13909
- promptHash,
13910
13107
  existingContentfulEntities,
13911
13108
  existingTokensInline,
13912
- precomputedCachedNames,
13913
13109
  allowedComponentNames: allowedComponentNames2
13914
13110
  },
13915
13111
  allComponents
@@ -13918,8 +13114,7 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13918
13114
  db.close();
13919
13115
  }
13920
13116
  const failed = componentResults.filter((r) => r.failed);
13921
- const cachedResults = componentResults.filter((r) => r.cached);
13922
- const generated = componentResults.filter((r) => !r.failed && !r.cached);
13117
+ const generated = componentResults.filter((r) => !r.failed);
13923
13118
  const allWarnings = componentResults.flatMap((r) => r.warnings.map((w) => ` ${r.componentName}: ${w}`));
13924
13119
  if (allWarnings.length > 0) {
13925
13120
  process.stderr.write(c.yellow("Warnings:") + "\n" + allWarnings.join("\n") + "\n");
@@ -13935,21 +13130,17 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13935
13130
  const totalExcluded = generated.reduce((s, r) => s + r.excluded, 0);
13936
13131
  const totalRenamedSlots = componentResults.reduce((s, r) => s + r.renamedSlotsCount, 0);
13937
13132
  const allOk = failed.length === 0;
13938
- const cachedNote = cachedResults.length > 0 ? c.dim(` (${cachedResults.length} cached)`) : "";
13939
13133
  process.stderr.write(
13940
- (allOk ? c.green("\u2713") : c.yellow("\u26A0")) + ` ${generated.length + cachedResults.length}/${componentResults.length} components` + cachedNote + c.dim(` ${totalClassified} classified, ${totalExcluded} unattached`) + "\n"
13134
+ (allOk ? c.green("\u2713") : c.yellow("\u26A0")) + ` ${generated.length}/${componentResults.length} components` + c.dim(` ${totalClassified} classified, ${totalExcluded} unattached`) + "\n"
13941
13135
  );
13942
13136
  process.stdout.write(`renamed-slots: ${totalRenamedSlots}
13943
13137
  `);
13944
- if (generated.length === 0 && cachedResults.length === 0) {
13138
+ if (generated.length === 0) {
13945
13139
  die(
13946
13140
  `Error: all ${componentResults.length} component(s) failed to generate \u2014 see the per-component errors above.`
13947
13141
  );
13948
13142
  }
13949
13143
  } else if (skill === "tokens") {
13950
- const noCache = opts.cache === false || process.env.EDS_NO_CACHE === "1";
13951
- const tokenInputContent = rawTokensInline ?? "";
13952
- const tokenInputHash = hashTokenContent(tokenInputContent);
13953
13144
  const db = openPipelineDb();
13954
13145
  try {
13955
13146
  let resolvedSessionId = opts.session;
@@ -13976,26 +13167,11 @@ async function runGenerateSkill(skill, opts, verbose = false) {
13976
13167
  }
13977
13168
  sessionId2 = resolvedSessionId;
13978
13169
  await bindAnalyticsSessionId(resolvedSessionId);
13979
- const tokenPromptHash = await hashPromptForSkill("tokens", agent, model);
13980
- if (!noCache) {
13981
- const tokenCached = lookupCache(db, tokenInputHash, "token_set", "__tokens__", tokenPromptHash);
13982
- if (tokenCached) {
13983
- copyTokensFromCache(db, tokenCached.sourceSessionId, resolvedSessionId);
13984
- sessionId2 = resolvedSessionId;
13985
- process.stderr.write(
13986
- `Done: tokens reused from cache ${c.dim(`(source: ${tokenCached.sourceSessionId.slice(0, 12)})`)}
13987
- `
13988
- );
13989
- db.close();
13990
- await showGenerateView({ skill, agent, sessionId: sessionId2 ?? "" });
13991
- return;
13992
- }
13993
- }
13994
13170
  const prompt = await buildPrompt({
13995
13171
  skill,
13996
13172
  mode: "autonomous",
13997
13173
  rawTokensInline,
13998
- rawTokensFilename: opts.rawTokens ? resolve12(opts.rawTokens).split("/").pop() : void 0,
13174
+ rawTokensFilename: opts.rawTokens ? resolve11(opts.rawTokens).split("/").pop() : void 0,
13999
13175
  tokensInline,
14000
13176
  tokenMapInline,
14001
13177
  outDir: process.cwd()
@@ -14032,9 +13208,6 @@ ${tokenWarnings.map((w) => ` ${w}`).join("\n")}
14032
13208
  `);
14033
13209
  }
14034
13210
  applyTokenToolCalls(db, resolvedSessionId, tokenCalls, []);
14035
- if (!noCache) {
14036
- storeCache(db, tokenInputHash, "token_set", "__tokens__", resolvedSessionId, false, tokenPromptHash);
14037
- }
14038
13211
  sessionId2 = resolvedSessionId;
14039
13212
  const groupCount = tokenCalls.filter((tc) => tc.tool === "set_group").length;
14040
13213
  process.stderr.write(`Done: ${tokenCount} tokens, ${groupCount} groups stored
@@ -14046,10 +13219,7 @@ ${tokenWarnings.map((w) => ` ${w}`).join("\n")}
14046
13219
  await showGenerateView({ skill, agent, sessionId: sessionId2 ?? "" });
14047
13220
  }
14048
13221
  function addAgentFlags(cmd) {
14049
- return addAgentModelOptions(cmd).option("--verbose", "Show full agent output including reasoning text").option("--dry-run", "Print the prompt without invoking the agent").option(
14050
- "--no-cache",
14051
- "Bypass ALL fine-grained caches (extract, select, generate) and force AI re-run. Cache keys now factor in prompt content \u2014 changing the prompt file via --generate-prompt-path or --select-prompt-path will already bust the corresponding stage. Use --no-cache to force a full re-run."
14052
- );
13222
+ return addAgentModelOptions(cmd).option("--verbose", "Show full agent output including reasoning text").option("--dry-run", "Print the prompt without invoking the agent");
14053
13223
  }
14054
13224
  function registerInternalGenerateCommand(program) {
14055
13225
  const generate = program.command("__generate", { hidden: true }).description("Internal import pipeline generation command");
@@ -14065,12 +13235,6 @@ function registerInternalGenerateCommand(program) {
14065
13235
  "--existing-entities-path <path>",
14066
13236
  "Path to the .existing-entities.json file written after CMA credentials are supplied. When present, per-component prompts include a summary of the target space so classifications can align to existing prop names/tokens. Missing/malformed files are treated as no-op."
14067
13237
  );
14068
- componentsCmd.option("--cache-status", "Check whether all selected component definitions are cached");
14069
- componentsCmd.option("--restore-cache", "Restore cached component definitions into the current session");
14070
- componentsCmd.option(
14071
- "--cached-components <json>",
14072
- "Component names already restored by a prior cache-status lookup; skip per-component cache lookup"
14073
- );
14074
13238
  addAgentFlags(componentsCmd).action(async (opts) => {
14075
13239
  await runGenerateSkill("components", opts, opts.verbose ?? false);
14076
13240
  });
@@ -14098,7 +13262,6 @@ var init_command = __esm({
14098
13262
  init_agent_output();
14099
13263
  init_GenerateView();
14100
13264
  init_db();
14101
- init_cache_keys();
14102
13265
  init_read_existing_contentful_entities_from_session();
14103
13266
  init_summarize_existing_contentful_entities();
14104
13267
  init_resolve_session_id();
@@ -14814,7 +13977,7 @@ var init_user_agent = __esm({
14814
13977
  // packages/experience-design-system-cli-legacy/src/apply/api-client.ts
14815
13978
  import { parseCDFComponents } from "@contentful/experience-design-system-types";
14816
13979
  function defaultSleep(delayMs) {
14817
- return new Promise((resolve21) => setTimeout(resolve21, delayMs));
13980
+ return new Promise((resolve20) => setTimeout(resolve20, delayMs));
14818
13981
  }
14819
13982
  function isTransientStatus(status) {
14820
13983
  return status >= 500 && status <= 599;
@@ -15204,7 +14367,7 @@ ${trimmed}`;
15204
14367
  const progress = maxAttempts > 1 ? attempt / (maxAttempts - 1) : 0;
15205
14368
  const baseDelay = intervalMs + (maxIntervalMs - intervalMs) * progress;
15206
14369
  const jitter = Math.random() * baseDelay * 0.15;
15207
- await new Promise((resolve21) => setTimeout(resolve21, baseDelay + jitter));
14370
+ await new Promise((resolve20) => setTimeout(resolve20, baseDelay + jitter));
15208
14371
  }
15209
14372
  }
15210
14373
  throw new Error(`Operation ${operationId} timed out after ${maxAttempts} attempts`);
@@ -16014,7 +15177,7 @@ var init_terminal_capabilities = __esm({
16014
15177
 
16015
15178
  // packages/experience-design-system-cli-legacy/src/apply/command.ts
16016
15179
  import { createElement as createElement2 } from "react";
16017
- import { readFile as readFile13, readdir as readdir2, stat as stat2 } from "node:fs/promises";
15180
+ import { readFile as readFile12, readdir as readdir2, stat as stat2 } from "node:fs/promises";
16018
15181
  import { join as join16 } from "node:path";
16019
15182
  import {
16020
15183
  validateCDF,
@@ -16035,7 +15198,7 @@ function dieWithApiError(error) {
16035
15198
  async function readJsonFile(flag, p) {
16036
15199
  let text;
16037
15200
  try {
16038
- text = await readFile13(p, "utf8");
15201
+ text = await readFile12(p, "utf8");
16039
15202
  } catch {
16040
15203
  return await die2(`Error: file not found: ${p} (from ${flag})`);
16041
15204
  }
@@ -16089,7 +15252,7 @@ async function readTokensFromPath(flag, p) {
16089
15252
  for (const file of files.sort()) {
16090
15253
  let text;
16091
15254
  try {
16092
- text = await readFile13(file, "utf8");
15255
+ text = await readFile12(file, "utf8");
16093
15256
  } catch {
16094
15257
  continue;
16095
15258
  }
@@ -16458,11 +15621,11 @@ var init_command2 = __esm({
16458
15621
  });
16459
15622
 
16460
15623
  // packages/experience-design-system-cli-legacy/src/print/validate/validators/read-json-file.ts
16461
- import { readFile as readFile14 } from "node:fs/promises";
15624
+ import { readFile as readFile13 } from "node:fs/promises";
16462
15625
  async function readJsonFile2(filePath) {
16463
15626
  let content;
16464
15627
  try {
16465
- content = await readFile14(filePath, "utf-8");
15628
+ content = await readFile13(filePath, "utf-8");
16466
15629
  } catch (err) {
16467
15630
  return {
16468
15631
  ok: false,
@@ -16873,7 +16036,7 @@ var init_ValidateView = __esm({
16873
16036
  // packages/experience-design-system-cli-legacy/src/print/command.ts
16874
16037
  import { createElement as createElement3 } from "react";
16875
16038
  import { access as access3, mkdir as mkdir3, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
16876
- import { basename as basename5, resolve as resolve13 } from "node:path";
16039
+ import { basename as basename5, resolve as resolve12 } from "node:path";
16877
16040
  import { CDF_SCHEMA_URL } from "@contentful/experience-design-system-types";
16878
16041
  async function die3(message) {
16879
16042
  process.stderr.write(`${message}
@@ -16940,7 +16103,7 @@ function registerPrintCommand(program) {
16940
16103
  "--allow-empty",
16941
16104
  "Write an empty-but-present CDF file when no components are accepted (a subsequent push then removes ALL components from the target space). Without this, an empty accepted set is an error."
16942
16105
  ).action(async (opts) => {
16943
- const outPath = resolve13(opts.out);
16106
+ const outPath = resolve12(opts.out);
16944
16107
  await assertOutIsNotDirectory(outPath);
16945
16108
  const sessionId2 = await resolveSession(opts.session, "generate components");
16946
16109
  await bindAnalyticsSessionId(sessionId2);
@@ -16988,7 +16151,7 @@ function registerPrintCommand(program) {
16988
16151
  `
16989
16152
  );
16990
16153
  }
16991
- await mkdir3(resolve13(outPath, ".."), { recursive: true });
16154
+ await mkdir3(resolve12(outPath, ".."), { recursive: true });
16992
16155
  await writeFile3(outPath, `${JSON.stringify(cdfObj, null, 2)}
16993
16156
  `);
16994
16157
  process.stdout.write(
@@ -16997,7 +16160,7 @@ function registerPrintCommand(program) {
16997
16160
  );
16998
16161
  });
16999
16162
  print.command("tokens").description("Write generated tokens to a DTCG JSON file").option("--session <id>", "Session ID to print from (default: most recent generate tokens session)").option("--out <path>", "Output file path", "tokens.json").action(async (opts) => {
17000
- const outPath = resolve13(opts.out);
16163
+ const outPath = resolve12(opts.out);
17001
16164
  await assertOutIsNotDirectory(outPath);
17002
16165
  const sessionId2 = await resolveSession(opts.session, "generate tokens");
17003
16166
  await bindAnalyticsSessionId(sessionId2);
@@ -17012,7 +16175,7 @@ function registerPrintCommand(program) {
17012
16175
  await die3(`Error: no generated tokens in session '${sessionId2}'. Run generate tokens first.`);
17013
16176
  }
17014
16177
  const tree = rebuildDTCGTree(result.groups, result.tokens);
17015
- await mkdir3(resolve13(outPath, ".."), { recursive: true });
16178
+ await mkdir3(resolve12(outPath, ".."), { recursive: true });
17016
16179
  await writeFile3(outPath, `${JSON.stringify(tree, null, 2)}
17017
16180
  `);
17018
16181
  process.stdout.write(
@@ -17161,7 +16324,7 @@ function MapTokensView({ result, onExit }) {
17161
16324
  const timer = setTimeout(onExit, 100);
17162
16325
  return () => clearTimeout(timer);
17163
16326
  }, [onExit]);
17164
- const summary = result.cached ? "reused from cache" : `${result.applied} mapping${result.applied === 1 ? "" : "s"} applied`;
16327
+ const summary = `${result.applied} mapping${result.applied === 1 ? "" : "s"} applied`;
17165
16328
  return /* @__PURE__ */ jsx8(
17166
16329
  CommandCompletionView,
17167
16330
  {
@@ -17295,8 +16458,8 @@ var init_resolve_defaults = __esm({
17295
16458
 
17296
16459
  // packages/experience-design-system-cli-legacy/src/map-tokens/command.ts
17297
16460
  import { createElement as createElement4 } from "react";
17298
- import { readFile as readFile15 } from "node:fs/promises";
17299
- import { resolve as resolve14 } from "node:path";
16461
+ import { readFile as readFile14 } from "node:fs/promises";
16462
+ import { resolve as resolve13 } from "node:path";
17300
16463
  async function renderResult(result) {
17301
16464
  if (process.stdout.isTTY) {
17302
16465
  const { waitUntilExit } = renderWithGoodbye(
@@ -17304,12 +16467,13 @@ async function renderResult(result) {
17304
16467
  );
17305
16468
  await waitUntilExit();
17306
16469
  } else {
17307
- const summary = result.cached ? "cached" : `${result.applied} mapping(s) applied`;
17308
- process.stdout.write(`map tokens complete
16470
+ process.stdout.write(
16471
+ `map tokens complete
17309
16472
  agent: ${result.agent}
17310
16473
  session=${result.sessionId}
17311
- ${summary}
17312
- `);
16474
+ ${result.applied} mapping(s) applied
16475
+ `
16476
+ );
17313
16477
  await exitWithAnalytics(0);
17314
16478
  }
17315
16479
  }
@@ -17331,7 +16495,7 @@ async function runMapTokens(opts) {
17331
16495
  let mapPromptPath;
17332
16496
  if (mapPromptOverride?.kind === "text") mapPromptText = mapPromptOverride.value;
17333
16497
  if (mapPromptOverride?.kind === "path") {
17334
- mapPromptPath = resolve14(mapPromptOverride.value);
16498
+ mapPromptPath = resolve13(mapPromptOverride.value);
17335
16499
  try {
17336
16500
  await resolvePromptOverride(mapPromptOverride);
17337
16501
  } catch (error) {
@@ -17351,7 +16515,7 @@ async function runMapTokens(opts) {
17351
16515
  const knownTokenPaths = new Set(tokenLeaves.map((t) => t.path));
17352
16516
  const tokenMapDiagnostics = [];
17353
16517
  if (opts.tokenMap) {
17354
- const fileMappings = JSON.parse(await readFile15(opts.tokenMap, "utf8"));
16518
+ const fileMappings = JSON.parse(await readFile14(opts.tokenMap, "utf8"));
17355
16519
  const validMappings = {};
17356
16520
  for (const [rawName, path] of Object.entries(fileMappings)) {
17357
16521
  if (knownTokenPaths.has(path)) {
@@ -17429,7 +16593,7 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
17429
16593
  let existingTokensInline;
17430
16594
  if (opts.existingEntitiesPath) {
17431
16595
  const existingContentfulEntities = await readExistingContentfulEntitiesFromSession(
17432
- resolve14(opts.existingEntitiesPath)
16596
+ resolve13(opts.existingEntitiesPath)
17433
16597
  );
17434
16598
  if (existingContentfulEntities) {
17435
16599
  existingTokensInline = JSON.stringify(summarizeForMapTokens(existingContentfulEntities));
@@ -17464,30 +16628,10 @@ ${defaultDiagnostics.map((diagnostic) => ` ${diagnostic}`).join("\n")}
17464
16628
  skipAgent: "true"
17465
16629
  });
17466
16630
  updateStep(db, stepId2, "complete", { applied: "0", skipAgent: "true" });
17467
- await renderResult({ agent: resultAgent, sessionId: sessionId2, applied: 0, cached: false });
16631
+ await renderResult({ agent: resultAgent, sessionId: sessionId2, applied: 0 });
17468
16632
  return;
17469
16633
  }
17470
16634
  const agent = configuredAgent;
17471
- const noCache = opts.cache === false || process.env.EDS_NO_CACHE === "1";
17472
- const promptHash = await hashPromptForSkill(
17473
- "map-tokens",
17474
- agent,
17475
- model,
17476
- void 0,
17477
- existingTokensInline ? [hashContent(existingTokensInline)] : [],
17478
- mapPromptText
17479
- );
17480
- const inputHash = computeMapTokensInputHash(db, sessionId2, componentSourceRefs);
17481
- if (!noCache) {
17482
- const cached = lookupCache(db, inputHash, "token_mapping", "__map_tokens__", promptHash);
17483
- if (cached) {
17484
- const appliedFromCache = copyMapTokensFromCache(db, cached.sourceSessionId, sessionId2);
17485
- const stepId2 = createStep(db, sessionId2, "map tokens", { agent, model: model ?? "" });
17486
- updateStep(db, stepId2, "complete", { cached: "true", applied: String(appliedFromCache) });
17487
- await renderResult({ agent, sessionId: sessionId2, applied: appliedFromCache, cached: true });
17488
- return;
17489
- }
17490
- }
17491
16635
  const binary = resolveAgentBinary(agent);
17492
16636
  if (!await assertBinaryInPath(binary)) {
17493
16637
  die(
@@ -17507,23 +16651,20 @@ Install it, choose another agent with --agent, or use --print-prompt to run the
17507
16651
  }
17508
16652
  const { calls, warnings: parseWarnings } = parseMapTokenPropToolCallLines(result.stdout);
17509
16653
  const { applied, warnings } = applyMapTokenPropCalls(db, sessionId2, calls, parseWarnings);
17510
- if (!noCache) {
17511
- storeCache(db, inputHash, "token_mapping", "__map_tokens__", sessionId2, false, promptHash);
17512
- }
17513
16654
  updateStep(db, stepId, "complete", { applied: String(applied), warnings: String(warnings.length) });
17514
16655
  if (warnings.length > 0) {
17515
16656
  process.stderr.write(`Warnings:
17516
16657
  ${warnings.map((w) => ` ${w}`).join("\n")}
17517
16658
  `);
17518
16659
  }
17519
- await renderResult({ agent, sessionId: sessionId2, applied, cached: false });
16660
+ await renderResult({ agent, sessionId: sessionId2, applied });
17520
16661
  } finally {
17521
16662
  db.close();
17522
16663
  }
17523
16664
  }
17524
16665
  function registerMapTokensCommand(program) {
17525
16666
  const map = program.command("map", { hidden: true }).description("Suggest token restrictions for generated design-token props");
17526
- const tokensCmd = map.command("tokens").description("Invoke a coding agent to suggest $token.allowed for design-category token props").option("--session <id>", "Session ID from generate components (defaults to most recent)").option("--print-prompt", "Print the prompt without invoking the agent").option("--skip-agent", "Resolve token defaults without agentic $token.allowed inference").option("--no-cache", "Bypass the map-tokens cache and force a re-run").option(
16667
+ const tokensCmd = map.command("tokens").description("Invoke a coding agent to suggest $token.allowed for design-category token props").option("--session <id>", "Session ID from generate components (defaults to most recent)").option("--print-prompt", "Print the prompt without invoking the agent").option("--skip-agent", "Resolve token defaults without agentic $token.allowed inference").option(
17527
16668
  "--prompt <stage=value>",
17528
16669
  "Override a stage prompt (repeatable). Used here for the map-tokens stage.",
17529
16670
  (v, acc) => [...acc, v],
@@ -17543,7 +16684,6 @@ var init_command4 = __esm({
17543
16684
  init_render_with_goodbye();
17544
16685
  init_src();
17545
16686
  init_db();
17546
- init_cache_keys();
17547
16687
  init_read_existing_contentful_entities_from_session();
17548
16688
  init_summarize_existing_contentful_entities();
17549
16689
  init_command3();
@@ -17560,7 +16700,7 @@ var init_command4 = __esm({
17560
16700
  });
17561
16701
 
17562
16702
  // packages/experience-design-system-cli-legacy/src/import/path-utils.ts
17563
- import { resolve as resolve15 } from "node:path";
16703
+ import { resolve as resolve14 } from "node:path";
17564
16704
  import { homedir as homedir5 } from "node:os";
17565
16705
  function expandTilde(input) {
17566
16706
  if (input === "~" || input.startsWith("~/") || input.startsWith("~\\")) {
@@ -17574,7 +16714,7 @@ function normalizePath(input) {
17574
16714
  p = p.slice(1, -1);
17575
16715
  }
17576
16716
  p = expandTilde(p);
17577
- return resolve15(p);
16717
+ return resolve14(p);
17578
16718
  }
17579
16719
  var init_path_utils = __esm({
17580
16720
  "packages/experience-design-system-cli-legacy/src/import/path-utils.ts"() {
@@ -17799,7 +16939,7 @@ var init_save_path_resolver = __esm({
17799
16939
  });
17800
16940
 
17801
16941
  // packages/experience-design-system-cli-legacy/src/runs/store.ts
17802
- import { readFile as readFile16, writeFile as writeFile4, mkdir as mkdir4, rename } from "node:fs/promises";
16942
+ import { readFile as readFile15, writeFile as writeFile4, mkdir as mkdir4, rename } from "node:fs/promises";
17803
16943
  import { join as join20 } from "node:path";
17804
16944
  import { homedir as homedir6 } from "node:os";
17805
16945
  import { randomBytes as randomBytes2 } from "node:crypto";
@@ -17839,7 +16979,7 @@ function migrateRecord(rec) {
17839
16979
  }
17840
16980
  async function readFileMaybe() {
17841
16981
  try {
17842
- const raw = await readFile16(RUNS_PATH, "utf8");
16982
+ const raw = await readFile15(RUNS_PATH, "utf8");
17843
16983
  const parsed = JSON.parse(raw);
17844
16984
  if (!READABLE_VERSIONS.has(parsed.version)) {
17845
16985
  throw new Error(
@@ -17903,15 +17043,15 @@ var init_store = __esm({
17903
17043
  });
17904
17044
 
17905
17045
  // packages/experience-design-system-cli-legacy/src/runs/fingerprint.ts
17906
- import { createHash as createHash6 } from "node:crypto";
17907
- import { readFile as readFile17, stat as stat4 } from "node:fs/promises";
17908
- import { resolve as resolve16 } from "node:path";
17046
+ import { createHash as createHash2 } from "node:crypto";
17047
+ import { readFile as readFile16, stat as stat4 } from "node:fs/promises";
17048
+ import { resolve as resolve15 } from "node:path";
17909
17049
  function rowField(row, key) {
17910
17050
  const v = row[key];
17911
17051
  return typeof v === "string" ? v : null;
17912
17052
  }
17913
17053
  function sha256Hex(buf) {
17914
- return createHash6("sha256").update(buf).digest("hex");
17054
+ return createHash2("sha256").update(buf).digest("hex");
17915
17055
  }
17916
17056
  async function buildSourceFingerprint(opts) {
17917
17057
  const rows = opts.db.prepare("SELECT name, source_path FROM raw_components WHERE session_id = ?").all(opts.extractSessionId);
@@ -17921,7 +17061,7 @@ async function buildSourceFingerprint(opts) {
17921
17061
  const sourcePath = rowField(row, "source_path");
17922
17062
  const name = rowField(row, "name");
17923
17063
  if (!sourcePath) continue;
17924
- const abs = resolve16(sourcePath);
17064
+ const abs = resolve15(sourcePath);
17925
17065
  if (seen.has(abs)) continue;
17926
17066
  seen.add(abs);
17927
17067
  try {
@@ -17936,10 +17076,10 @@ async function buildSourceFingerprint(opts) {
17936
17076
  let rawTokensMtime = null;
17937
17077
  let rawTokensContentHash = null;
17938
17078
  if (opts.rawTokensPath) {
17939
- const abs = resolve16(opts.rawTokensPath);
17079
+ const abs = resolve15(opts.rawTokensPath);
17940
17080
  rawTokensPath = abs;
17941
17081
  try {
17942
- const [st, buf] = await Promise.all([stat4(abs), readFile17(abs)]);
17082
+ const [st, buf] = await Promise.all([stat4(abs), readFile16(abs)]);
17943
17083
  rawTokensMtime = st.mtime.toISOString();
17944
17084
  rawTokensContentHash = sha256Hex(buf);
17945
17085
  } catch {
@@ -19694,11 +18834,11 @@ var init_slot_graph = __esm({
19694
18834
  });
19695
18835
 
19696
18836
  // packages/experience-design-system-cli-legacy/src/analyze/select/parser.ts
19697
- import { createHash as createHash7 } from "node:crypto";
18837
+ import { createHash as createHash3 } from "node:crypto";
19698
18838
  import { access as access5 } from "node:fs/promises";
19699
- import { isAbsolute, relative, resolve as resolve17 } from "node:path";
18839
+ import { isAbsolute, relative, resolve as resolve16 } from "node:path";
19700
18840
  function createComponentId(name, resolvedSourcePath) {
19701
- const sourceHash = createHash7("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
18841
+ const sourceHash = createHash3("sha256").update(`${name}:${resolvedSourcePath}`).digest("hex").slice(0, 12);
19702
18842
  return `${name}-${sourceHash}`;
19703
18843
  }
19704
18844
  async function resolveComponentSourcePath(source, reviewRoot) {
@@ -19710,7 +18850,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
19710
18850
  throw new Error(`Unable to access component source at ${source}`);
19711
18851
  }
19712
18852
  }
19713
- const candidate = resolve17(reviewRoot, source);
18853
+ const candidate = resolve16(reviewRoot, source);
19714
18854
  const relativeToRoot = relative(reviewRoot, candidate);
19715
18855
  if (relativeToRoot.startsWith("..") || relativeToRoot === ".." || isAbsolute(relativeToRoot)) {
19716
18856
  throw new Error(
@@ -19725,7 +18865,7 @@ async function resolveComponentSourcePath(source, reviewRoot) {
19725
18865
  }
19726
18866
  }
19727
18867
  async function loadReviewInput(components, options = {}) {
19728
- const reviewRoot = resolve17(options.reviewRoot ?? process.cwd());
18868
+ const reviewRoot = resolve16(options.reviewRoot ?? process.cwd());
19729
18869
  const records = await Promise.all(
19730
18870
  components.map(async (component) => {
19731
18871
  let resolvedSourcePath;
@@ -19756,7 +18896,7 @@ var init_parser = __esm({
19756
18896
  });
19757
18897
 
19758
18898
  // packages/experience-design-system-cli-legacy/src/analyze/select/command.ts
19759
- import { access as access6, readFile as readFile18 } from "node:fs/promises";
18899
+ import { access as access6, readFile as readFile17 } from "node:fs/promises";
19760
18900
  async function loadAndValidateForReview(sessionId2, projectRoot) {
19761
18901
  const db = openPipelineDb();
19762
18902
  let rawComponents;
@@ -19774,7 +18914,7 @@ async function patchReviewStateWithValidationErrors(sessionId2, errors, opts = {
19774
18914
  let snapshot;
19775
18915
  try {
19776
18916
  await access6(paths.statePath);
19777
- snapshot = JSON.parse(await readFile18(paths.statePath, "utf8"));
18917
+ snapshot = JSON.parse(await readFile17(paths.statePath, "utf8"));
19778
18918
  } catch {
19779
18919
  snapshot = await loadAndValidateForReview(sessionId2, void 0);
19780
18920
  snapshot = await ensureRefineSession(sessionId2, artifactsRoot, snapshot);
@@ -19825,7 +18965,7 @@ async function rejectComponentsByName(sessionId2, names, opts = {}) {
19825
18965
  const nameSet = new Set(names);
19826
18966
  let snapshot;
19827
18967
  try {
19828
- snapshot = JSON.parse(await readFile18(paths.statePath, "utf8"));
18968
+ snapshot = JSON.parse(await readFile17(paths.statePath, "utf8"));
19829
18969
  } catch {
19830
18970
  return;
19831
18971
  }
@@ -19924,9 +19064,9 @@ function spawnGenerateChild(opts) {
19924
19064
  stderr += chunk;
19925
19065
  opts.onStderr?.(chunk);
19926
19066
  });
19927
- const donePromise = new Promise((resolve21) => {
19067
+ const donePromise = new Promise((resolve20) => {
19928
19068
  child.on("close", (code, signal) => {
19929
- resolve21({
19069
+ resolve20({
19930
19070
  exitCode: code ?? 0,
19931
19071
  signal: signal ?? null,
19932
19072
  stdout,
@@ -19934,7 +19074,7 @@ function spawnGenerateChild(opts) {
19934
19074
  });
19935
19075
  });
19936
19076
  child.on("error", (err) => {
19937
- resolve21({
19077
+ resolve20({
19938
19078
  exitCode: 1,
19939
19079
  signal: null,
19940
19080
  stdout,
@@ -28072,9 +27212,6 @@ function shouldGenerateAfterCredentialsValidated(opts) {
28072
27212
  function shouldSkipFinalReviewAfterCredentials(state) {
28073
27213
  return state.finalReviewPassed && state.generateSessionId != null;
28074
27214
  }
28075
- function resolveNoCacheForGenerate(opts) {
28076
- return opts.cliNoCache;
28077
- }
28078
27215
  function shouldBypassPreview(state) {
28079
27216
  return state.credentialsSkipped === true;
28080
27217
  }
@@ -28101,66 +27238,39 @@ var init_wizard_state_transitions = __esm({
28101
27238
  async function runSelectionAgent(options) {
28102
27239
  const db = openPipelineDb();
28103
27240
  let components;
28104
- const cachedDecisions = /* @__PURE__ */ new Map();
28105
- const cliVersion2 = await getCliCacheVersion();
28106
- const promptHash = await hashPromptForSkill(
28107
- "select",
28108
- options.agent,
28109
- options.model,
28110
- options.promptPath,
28111
- [],
28112
- options.promptText
28113
- );
28114
27241
  try {
28115
27242
  components = loadRawComponents(db, options.sessionId);
28116
- if (!options.noCache) {
28117
- for (const component of components) {
28118
- const componentHash = hashComponentShape(component);
28119
- const cached = lookupSelectCache(db, componentHash, promptHash, cliVersion2);
28120
- if (cached) {
28121
- cachedDecisions.set(component.name, {
28122
- decision: cached.decision,
28123
- reason: cached.reason
28124
- });
28125
- }
28126
- }
28127
- }
28128
27243
  } finally {
28129
27244
  db.close();
28130
27245
  }
28131
27246
  if (components.length === 0) return;
28132
- const componentsToRun = components.filter((component) => !cachedDecisions.has(component.name));
28133
- let calls = [];
28134
- if (componentsToRun.length > 0) {
28135
- const invoker2 = createLocalCliAgentInvoker({
28136
- onDebugEvent: (name, payload) => getDebugLogger().event("agent", name, payload)
28137
- });
28138
- const prompt = await buildPrompt({
28139
- skill: "select",
28140
- mode: "autonomous",
28141
- rawComponentsInline: JSON.stringify(
28142
- componentsToRun.map((component) => ({ ...component, props: component.props.map(stripPropProvenance) })),
28143
- null,
28144
- 2
28145
- ),
28146
- propBucketsInline: logPropBuckets("select", bucketComponentsProps(componentsToRun)),
28147
- outDir: process.cwd(),
28148
- ...options.promptText !== void 0 ? { skillContentOverride: options.promptText } : {},
28149
- ...options.promptText === void 0 && options.promptPath ? { skillPathOverride: options.promptPath } : {}
28150
- });
28151
- const { result } = await invokeAgentWithOutput(
28152
- invoker2,
28153
- { agent: options.agent, model: options.model, prompt, timeoutMs: DEFAULT_TIMEOUT_MS4 },
28154
- false
28155
- );
28156
- if (result.timedOut) throw new Error("selection agent timed out");
28157
- if (result.exitCode !== 0) throw new Error(`selection agent exited with code ${result.exitCode}`);
28158
- const parsed = parseSelectToolCallLines(result.stdout);
28159
- for (const warning of parsed.warnings) process.stderr.write(`Warning: selection agent: ${warning}
27247
+ const invoker2 = createLocalCliAgentInvoker({
27248
+ onDebugEvent: (name, payload) => getDebugLogger().event("agent", name, payload)
27249
+ });
27250
+ const prompt = await buildPrompt({
27251
+ skill: "select",
27252
+ mode: "autonomous",
27253
+ rawComponentsInline: JSON.stringify(
27254
+ components.map((component) => ({ ...component, props: component.props.map(stripPropProvenance) })),
27255
+ null,
27256
+ 2
27257
+ ),
27258
+ propBucketsInline: logPropBuckets("select", bucketComponentsProps(components)),
27259
+ outDir: process.cwd(),
27260
+ ...options.promptText !== void 0 ? { skillContentOverride: options.promptText } : {},
27261
+ ...options.promptText === void 0 && options.promptPath ? { skillPathOverride: options.promptPath } : {}
27262
+ });
27263
+ const { result } = await invokeAgentWithOutput(
27264
+ invoker2,
27265
+ { agent: options.agent, model: options.model, prompt, timeoutMs: DEFAULT_TIMEOUT_MS4 },
27266
+ false
27267
+ );
27268
+ if (result.timedOut) throw new Error("selection agent timed out");
27269
+ if (result.exitCode !== 0) throw new Error(`selection agent exited with code ${result.exitCode}`);
27270
+ const parsed = parseSelectToolCallLines(result.stdout);
27271
+ for (const warning of parsed.warnings) process.stderr.write(`Warning: selection agent: ${warning}
28160
27272
  `);
28161
- calls = parsed.calls;
28162
- }
28163
- const byName = new Map(calls.map((call) => [call.name, call]));
27273
+ const byName = new Map(parsed.calls.map((call) => [call.name, call]));
28164
27274
  const writeDb = openPipelineDb();
28165
27275
  try {
28166
27276
  writeDb.exec("BEGIN");
@@ -28168,27 +27278,15 @@ async function runSelectionAgent(options) {
28168
27278
  `UPDATE raw_components SET status = ?, reject_reason = ? WHERE session_id = ? AND component_id = ?`
28169
27279
  );
28170
27280
  for (const component of components) {
28171
- const cached = cachedDecisions.get(component.name);
28172
27281
  const call = byName.get(component.name);
28173
- if (!cached && !call) continue;
28174
- const rejected = cached ? cached.decision === "rejected" : call.tool === "reject_component";
28175
- const reason = cached ? cached.reason : call.reason ?? null;
27282
+ if (!call) continue;
27283
+ const rejected = call.tool === "reject_component";
28176
27284
  update.run(
28177
27285
  rejected ? "rejected" : "accepted",
28178
- rejected ? reason : null,
27286
+ rejected ? call.reason ?? null : null,
28179
27287
  options.sessionId,
28180
27288
  component.component_id
28181
27289
  );
28182
- if (!cached) {
28183
- storeSelectCache(
28184
- writeDb,
28185
- hashComponentShape(component),
28186
- promptHash,
28187
- cliVersion2,
28188
- rejected ? "rejected" : "accepted",
28189
- rejected ? reason : null
28190
- );
28191
- }
28192
27290
  }
28193
27291
  writeDb.exec("COMMIT");
28194
27292
  } catch (error) {
@@ -28209,7 +27307,6 @@ var init_run_selection_agent = __esm({
28209
27307
  init_debug_logger();
28210
27308
  init_agent_output();
28211
27309
  init_db();
28212
- init_cache_keys();
28213
27310
  DEFAULT_TIMEOUT_MS4 = Number(process.env.EDS_AGENT_TIMEOUT_MS ?? 5 * 60 * 1e3);
28214
27311
  }
28215
27312
  });
@@ -28228,7 +27325,7 @@ __export(WizardApp_exports, {
28228
27325
  });
28229
27326
  import { useEffect as useEffect15, useRef as useRef10, useState as useState23 } from "react";
28230
27327
  import { Box as Box42, Text as Text46 } from "ink";
28231
- import { join as join23, resolve as resolve18 } from "node:path";
27328
+ import { join as join23, resolve as resolve17 } from "node:path";
28232
27329
  import { appendFileSync as appendFileSync2, writeFileSync } from "node:fs";
28233
27330
  import { access as access7, stat as stat5, writeFile as writeFile6 } from "node:fs/promises";
28234
27331
  import { tmpdir } from "node:os";
@@ -28241,28 +27338,21 @@ function buildGenerateComponentsArgs(opts) {
28241
27338
  if (opts.tokensPath) args.push("--tokens", opts.tokensPath);
28242
27339
  if (opts.model) args.push("--model", opts.model);
28243
27340
  if (opts.bedrock) args.push("--bedrock");
28244
- if (opts.noCache) args.push("--no-cache");
28245
27341
  if (opts.generatePromptPath) args.push("--generate-prompt-path", opts.generatePromptPath);
28246
27342
  for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
28247
27343
  if (opts.existingEntitiesPath) args.push("--existing-entities-path", opts.existingEntitiesPath);
28248
- if (opts.restoreCache) args.push("--restore-cache");
28249
- if (opts.cachedComponents && opts.cachedComponents.length > 0) {
28250
- args.push("--cached-components", JSON.stringify(opts.cachedComponents));
28251
- }
28252
27344
  return args;
28253
27345
  }
28254
27346
  function buildGenerateTokensArgs(opts) {
28255
27347
  const args = [findCliPath(), "__generate", "tokens", "--agent", opts.agent, "--raw-tokens", opts.rawTokensPath];
28256
27348
  if (opts.model) args.push("--model", opts.model);
28257
27349
  if (opts.bedrock) args.push("--bedrock");
28258
- if (opts.noCache) args.push("--no-cache");
28259
27350
  for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
28260
27351
  return args;
28261
27352
  }
28262
27353
  function buildMapTokensArgs(opts) {
28263
27354
  const args = ["map", "tokens", "--session", opts.sessionId, "--agent", opts.agent];
28264
27355
  if (opts.model) args.push("--model", opts.model);
28265
- if (opts.noCache) args.push("--no-cache");
28266
27356
  if (opts.skipAgent) args.push("--skip-agent");
28267
27357
  for (const prompt of opts.promptOverrides ?? []) args.push("--prompt", prompt);
28268
27358
  if (opts.existingEntitiesPath) args.push("--existing-entities-path", opts.existingEntitiesPath);
@@ -28354,7 +27444,6 @@ function WizardApp({
28354
27444
  initialProjectPath,
28355
27445
  host,
28356
27446
  promptOverrides,
28357
- noCache = false,
28358
27447
  livePreview = true,
28359
27448
  generatePromptPath,
28360
27449
  skipMapTokens = false,
@@ -28379,7 +27468,6 @@ function WizardApp({
28379
27468
  });
28380
27469
  const allowEmptyDeleteAllRef = useRef10(false);
28381
27470
  const generateChildRef = useRef10(null);
28382
- const generationCachePreflightRef = useRef10(null);
28383
27471
  const selectionToReviewStartedAtRef = useRef10(null);
28384
27472
  const credentialsValidationIdRef = useRef10(0);
28385
27473
  const pendingCredentialValidationRef = useRef10(null);
@@ -28394,9 +27482,8 @@ function WizardApp({
28394
27482
  const existingEntitiesPromiseRef = useRef10(null);
28395
27483
  const generatePromiseRef = useRef10(null);
28396
27484
  const rawTokensEntryReady = !!initialRawTokensPath;
28397
- const effectiveNoCache = resolveNoCacheForGenerate({ cliNoCache: noCache });
28398
27485
  const initialStepResolved = rawTokensEntryReady ? initialProjectPath ? "path-validation" : "credentials" : initialProjectPath ? "token-input" : "welcome";
28399
- const initialOutDir = initialProjectPath ? join23(resolve18(initialProjectPath), ".contentful") : "";
27486
+ const initialOutDir = initialProjectPath ? join23(resolve17(initialProjectPath), ".contentful") : "";
28400
27487
  const [state, setState] = useState23({
28401
27488
  step: initialStepResolved,
28402
27489
  agent: initialAgent ?? "claude",
@@ -28572,14 +27659,13 @@ If you are using AWS Bedrock, run:
28572
27659
  if (!deferStep) update({ step: nextStep });
28573
27660
  return true;
28574
27661
  };
28575
- const runGenerateTokens = async (rawTokensPath, outDir, forceRegenerate = false) => {
27662
+ const runGenerateTokens = async (rawTokensPath, outDir) => {
28576
27663
  update({ tokenGenerationStatus: "running" });
28577
27664
  const tokenArgs = buildGenerateTokensArgs({
28578
27665
  rawTokensPath,
28579
27666
  agent: state.agent,
28580
27667
  ...state.agentModel ? { model: state.agentModel } : {},
28581
27668
  ...state.bedrock ? { bedrock: true } : {},
28582
- noCache: effectiveNoCache || forceRegenerate,
28583
27669
  promptOverrides
28584
27670
  });
28585
27671
  const result = await runSpawnedCli(tokenArgs);
@@ -28628,7 +27714,6 @@ If you are using AWS Bedrock, run:
28628
27714
  const timer = startWizardTimer("token-mapping", {
28629
27715
  sessionId: sessionId2,
28630
27716
  silent,
28631
- noCache: effectiveNoCache,
28632
27717
  skipAgent: skipMapTokens
28633
27718
  });
28634
27719
  let mappablePropCount = 0;
@@ -28637,7 +27722,7 @@ If you are using AWS Bedrock, run:
28637
27722
  const db = openPipelineDb();
28638
27723
  try {
28639
27724
  if (state.tokenSessionId && state.tokenSessionId !== sessionId2) {
28640
- copyTokensFromCache(db, state.tokenSessionId, sessionId2);
27725
+ copyTokensBetweenSessions(db, state.tokenSessionId, sessionId2);
28641
27726
  } else if (!state.tokenSessionId && state.tokensPath) {
28642
27727
  const tokens = await readTokensFromPath("tokens", state.tokensPath);
28643
27728
  storeDtcgTokens(db, sessionId2, [], tokens);
@@ -28677,7 +27762,6 @@ If you are using AWS Bedrock, run:
28677
27762
  sessionId: sessionId2,
28678
27763
  agent: state.agent,
28679
27764
  ...state.agentModel ? { model: state.agentModel } : {},
28680
- noCache: effectiveNoCache,
28681
27765
  skipAgent: skipMapTokens,
28682
27766
  promptOverrides,
28683
27767
  ...state.existingEntitiesPath ? { existingEntitiesPath: state.existingEntitiesPath } : {}
@@ -28757,7 +27841,7 @@ If you are using AWS Bedrock, run:
28757
27841
  return promise;
28758
27842
  };
28759
27843
  const runExtract = async (projectPath, showProgress = true) => {
28760
- const outDir = join23(resolve18(projectPath), ".contentful");
27844
+ const outDir = join23(resolve17(projectPath), ".contentful");
28761
27845
  const existingEntitiesExpected = !state.credentialsSkipped && Boolean(state.spaceId && state.environmentId && state.cmaToken && projectPath);
28762
27846
  update({
28763
27847
  ...showProgress ? { step: "extracting" } : {},
@@ -28772,7 +27856,6 @@ If you are using AWS Bedrock, run:
28772
27856
  });
28773
27857
  const existingEntitiesPromise = startExistingEntitiesFetch(projectPath, outDir);
28774
27858
  const extractArgs = [findCliPath(), "__extract", "--project", projectPath];
28775
- if (effectiveNoCache) extractArgs.push("--no-cache");
28776
27859
  let selectionPromptText;
28777
27860
  let selectionPromptPath;
28778
27861
  try {
@@ -28781,7 +27864,7 @@ If you are using AWS Bedrock, run:
28781
27864
  const selectOverride = overrides.get("select");
28782
27865
  if (selectOverride?.kind === "text") selectionPromptText = selectOverride.value;
28783
27866
  if (selectOverride?.kind === "path") {
28784
- selectionPromptPath = resolve18(selectOverride.value);
27867
+ selectionPromptPath = resolve17(selectOverride.value);
28785
27868
  await resolvePromptOverride(selectOverride);
28786
27869
  }
28787
27870
  } catch (error) {
@@ -28805,8 +27888,7 @@ If you are using AWS Bedrock, run:
28805
27888
  agent: state.agent,
28806
27889
  ...state.agentModel ? { model: state.agentModel } : {},
28807
27890
  ...selectionPromptText !== void 0 ? { promptText: selectionPromptText } : {},
28808
- ...selectionPromptPath ? { promptPath: selectionPromptPath } : {},
28809
- noCache: effectiveNoCache
27891
+ ...selectionPromptPath ? { promptPath: selectionPromptPath } : {}
28810
27892
  });
28811
27893
  })().catch((error) => {
28812
27894
  selectionError = error;
@@ -28951,136 +28033,17 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
28951
28033
  generateProgress: null
28952
28034
  }));
28953
28035
  };
28954
- const buildGenerateOptions = (extractSessionId, tokensPath, generatePromptPath2, cachedComponents) => ({
28036
+ const buildGenerateOptions = (extractSessionId, tokensPath, generatePromptPath2) => ({
28955
28037
  sessionId: extractSessionId,
28956
28038
  tokensPath,
28957
28039
  agent: state.agent,
28958
28040
  ...state.agentModel ? { model: state.agentModel } : {},
28959
28041
  ...state.bedrock ? { bedrock: true } : {},
28960
- noCache: effectiveNoCache,
28961
28042
  ...state.existingEntitiesPath ? { existingEntitiesPath: state.existingEntitiesPath } : {},
28962
28043
  ...generatePromptPath2 ? { generatePromptPath: generatePromptPath2 } : {},
28963
- promptOverrides,
28964
- ...cachedComponents && cachedComponents.length > 0 ? { cachedComponents } : {}
28044
+ promptOverrides
28965
28045
  });
28966
- const buildGenerateArgs = (extractSessionId, tokensPath, generatePromptPath2, cachedComponents) => buildGenerateProcessArgs(buildGenerateOptions(extractSessionId, tokensPath, generatePromptPath2, cachedComponents));
28967
- const buildGenerateCliArgs = (extractSessionId, tokensPath, generatePromptPath2, cachedComponents) => buildGenerateComponentsArgs(
28968
- buildGenerateOptions(extractSessionId, tokensPath, generatePromptPath2, cachedComponents)
28969
- );
28970
- const checkGenerateCache = async (extractSessionId, tokensPath) => {
28971
- const timer = startWizardTimer("generation-cache-status", {
28972
- sessionId: extractSessionId,
28973
- noCache: effectiveNoCache
28974
- });
28975
- if (effectiveNoCache) {
28976
- finishWizardTimer("generation-cache-status", timer, { status: "skipped" });
28977
- return false;
28978
- }
28979
- const result = await runCli([...buildGenerateCliArgs(extractSessionId, tokensPath), "--cache-status"]);
28980
- const hit = result.exitCode === 0 && /^cache-status=hit$/m.test(result.stdout);
28981
- finishWizardTimer("generation-cache-status", timer, {
28982
- status: hit ? "hit" : "miss",
28983
- exitCode: result.exitCode,
28984
- ...result.exitCode !== 0 ? { stderrTail: result.stderr.trim().slice(-500) } : {}
28985
- });
28986
- return hit;
28987
- };
28988
- const checkGenerateCacheComponents = async (extractSessionId, tokensPath, restoreCache = false) => {
28989
- const timer = startWizardTimer("generation-cache-components", {
28990
- sessionId: extractSessionId,
28991
- restoreCache,
28992
- noCache: effectiveNoCache
28993
- });
28994
- if (effectiveNoCache) {
28995
- finishWizardTimer("generation-cache-components", timer, { status: "skipped" });
28996
- return /* @__PURE__ */ new Set();
28997
- }
28998
- const args = [...buildGenerateCliArgs(extractSessionId, tokensPath), "--cache-status"];
28999
- if (restoreCache) args.push("--restore-cache");
29000
- const result = await runCli(args);
29001
- if (result.exitCode !== 0) {
29002
- finishWizardTimer("generation-cache-components", timer, {
29003
- status: "error",
29004
- exitCode: result.exitCode,
29005
- stderrTail: result.stderr.trim().slice(-500)
29006
- });
29007
- return /* @__PURE__ */ new Set();
29008
- }
29009
- const line = /^cache-components=(.+)$/m.exec(result.stdout)?.[1];
29010
- if (!line) {
29011
- finishWizardTimer("generation-cache-components", timer, {
29012
- status: "missing-output",
29013
- exitCode: result.exitCode,
29014
- cachedCount: 0
29015
- });
29016
- return /* @__PURE__ */ new Set();
29017
- }
29018
- try {
29019
- const names = JSON.parse(line);
29020
- const cachedNames = new Set(
29021
- Array.isArray(names) ? names.filter((name) => typeof name === "string") : []
29022
- );
29023
- finishWizardTimer("generation-cache-components", timer, {
29024
- status: "complete",
29025
- exitCode: result.exitCode,
29026
- cachedCount: cachedNames.size
29027
- });
29028
- return cachedNames;
29029
- } catch {
29030
- finishWizardTimer("generation-cache-components", timer, {
29031
- status: "invalid-output",
29032
- exitCode: result.exitCode,
29033
- cachedCount: 0
29034
- });
29035
- return /* @__PURE__ */ new Set();
29036
- }
29037
- };
29038
- useEffect15(() => {
29039
- if (state.step !== "extracting" && state.step !== "scope-gate" || !state.extractSessionId || state.existingEntitiesStatus === "running" || state.existingEntitiesStatus === "idle" || state.selectionAgentStatus !== "complete" || state.compositionPhase !== "done" || state.rawTokensPath && state.tokenGenerationStatus !== "complete" || effectiveNoCache) {
29040
- return;
29041
- }
29042
- const sessionId2 = state.extractSessionId;
29043
- if (generationCachePreflightRef.current?.sessionId === sessionId2) return;
29044
- const timer = startWizardTimer("generation-cache-preflight", { sessionId: sessionId2 });
29045
- const db = openPipelineDb();
29046
- let generatedNames = null;
29047
- try {
29048
- const rows = db.prepare("SELECT name, status FROM raw_components WHERE session_id = ?").all(sessionId2);
29049
- if (rows.length > 0 && rows.every((row) => row.status === "generated")) {
29050
- generatedNames = new Set(rows.map((row) => row.name));
29051
- }
29052
- } finally {
29053
- db.close();
29054
- }
29055
- if (generatedNames) {
29056
- generationCachePreflightRef.current = { sessionId: sessionId2, promise: Promise.resolve(generatedNames) };
29057
- finishWizardTimer("generation-cache-preflight", timer, {
29058
- status: "complete",
29059
- source: "session-db",
29060
- cachedCount: generatedNames.size
29061
- });
29062
- return;
29063
- }
29064
- const promise = checkGenerateCacheComponents(sessionId2, state.tokensPath, true);
29065
- generationCachePreflightRef.current = { sessionId: sessionId2, promise };
29066
- void promise.then((cachedNames) => {
29067
- finishWizardTimer("generation-cache-preflight", timer, {
29068
- status: "complete",
29069
- source: "cache-status",
29070
- cachedCount: cachedNames.size
29071
- });
29072
- });
29073
- }, [
29074
- state.step,
29075
- state.extractSessionId,
29076
- state.tokensPath,
29077
- state.rawTokensPath,
29078
- state.tokenGenerationStatus,
29079
- state.selectionAgentStatus,
29080
- state.compositionPhase,
29081
- state.existingEntitiesStatus,
29082
- state.existingEntitiesPath
29083
- ]);
28046
+ const buildGenerateArgs = (extractSessionId, tokensPath, generatePromptPath2) => buildGenerateProcessArgs(buildGenerateOptions(extractSessionId, tokensPath, generatePromptPath2));
29084
28047
  const startGeneratePrefetch = (extractSessionId, tokensPath) => {
29085
28048
  const args = buildGenerateArgs(extractSessionId, tokensPath);
29086
28049
  let progressCursor = null;
@@ -29135,14 +28098,13 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
29135
28098
  });
29136
28099
  return donePromise;
29137
28100
  };
29138
- const runGenerate = async (extractSessionId, tokensPath, acceptedCount, suppressScreen = false, cachedComponents = []) => {
28101
+ const runGenerate = async (extractSessionId, tokensPath, acceptedCount, suppressScreen = false) => {
29139
28102
  const timer = startWizardTimer("component-generation", {
29140
28103
  sessionId: extractSessionId,
29141
28104
  acceptedCount,
29142
- suppressScreen,
29143
- noCache: effectiveNoCache
28105
+ suppressScreen
29144
28106
  });
29145
- const args = buildGenerateArgs(extractSessionId, tokensPath, generatePromptPath, cachedComponents);
28107
+ const args = buildGenerateArgs(extractSessionId, tokensPath, generatePromptPath);
29146
28108
  let progressCursor = state.generateProgress;
29147
28109
  const { donePromise } = spawnGenerateChild({
29148
28110
  command: "node",
@@ -29212,25 +28174,6 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
29212
28174
  finishSelectionToReviewTimer("error");
29213
28175
  }
29214
28176
  };
29215
- const finishCachedGeneration = async (sessionId2, acceptedCount) => {
29216
- if (await runMapTokens2(sessionId2, true)) {
29217
- finishSelectionToReviewTimer("cached");
29218
- update(
29219
- {
29220
- acceptedCount,
29221
- autoRejectedCount: 0,
29222
- generateSessionId: sessionId2,
29223
- generatedCount: acceptedCount,
29224
- generateProgress: null,
29225
- mapTokensStatus: "complete",
29226
- step: "final-review"
29227
- },
29228
- { clearScreen: false }
29229
- );
29230
- } else {
29231
- finishSelectionToReviewTimer("error");
29232
- }
29233
- };
29234
28177
  const advanceToPushFlow = (generatedAcceptedCount) => {
29235
28178
  update({ generatedAcceptedCount });
29236
28179
  void runSaveAndPush();
@@ -29415,14 +28358,8 @@ Make sure this path contains TypeScript/React/Vue component files (.tsx, .ts, .v
29415
28358
  }
29416
28359
  }
29417
28360
  if (await runAgentAuthCheck("generating", true)) {
29418
- const cacheHit = await checkGenerateCache(sid, state.tokensPath);
29419
- if (cacheHit) {
29420
- update({ step: "generating" });
29421
- void finishCachedGeneration(sid, state.acceptedCount);
29422
- } else {
29423
- update({ step: "generating" });
29424
- void runGenerate(sid, state.tokensPath, state.acceptedCount);
29425
- }
28361
+ update({ step: "generating" });
28362
+ void runGenerate(sid, state.tokensPath, state.acceptedCount);
29426
28363
  }
29427
28364
  return;
29428
28365
  }
@@ -29786,7 +28723,7 @@ If using a custom host configuration, make sure the space exists on that host.`
29786
28723
  });
29787
28724
  return { ok: false };
29788
28725
  }
29789
- await new Promise((resolve21) => setTimeout(resolve21, SAVE_CONFIRMATION_DELAY_MS));
28726
+ await new Promise((resolve20) => setTimeout(resolve20, SAVE_CONFIRMATION_DELAY_MS));
29790
28727
  update(nextStateAfterPrint({ skipGate: opts.skipGate, componentsPath }));
29791
28728
  return { ok: true };
29792
28729
  };
@@ -29863,12 +28800,6 @@ If using a custom host configuration, make sure the space exists on that host.`
29863
28800
  tokenReuseChecked.current = true;
29864
28801
  const tokenNextStep = state.projectPath ? "path-validation" : "credentials";
29865
28802
  const existingTokensPath = join23(state.outDir, "tokens.json");
29866
- if (effectiveNoCache) {
29867
- tokenGenerationPromiseRef.current = runAgentAuthCheck(tokenNextStep).then(
29868
- (ok2) => ok2 ? runGenerateTokens(state.rawTokensPath, state.outDir) : false
29869
- );
29870
- return;
29871
- }
29872
28803
  (async () => {
29873
28804
  try {
29874
28805
  await access7(existingTokensPath);
@@ -29952,7 +28883,7 @@ If using a custom host configuration, make sure the space exists on that host.`
29952
28883
  const tokenNextStep = state.projectPath ? "path-validation" : "credentials";
29953
28884
  update({ step: tokenNextStep });
29954
28885
  if (await runAgentAuthCheck(tokenNextStep)) {
29955
- tokenGenerationPromiseRef.current = runGenerateTokens(state.rawTokensPath, state.outDir, true);
28886
+ tokenGenerationPromiseRef.current = runGenerateTokens(state.rawTokensPath, state.outDir);
29956
28887
  }
29957
28888
  },
29958
28889
  onQuit: () => process.exit(0)
@@ -30051,29 +28982,6 @@ If using a custom host configuration, make sure the space exists on that host.`
30051
28982
  acceptedCount: decisions.accepted.length,
30052
28983
  rejectedCount: decisions.rejected.length
30053
28984
  }) : null;
30054
- const preflight = generationCachePreflightRef.current;
30055
- const cachePromise = preflight?.sessionId === sessionId2 ? preflight.promise : checkGenerateCacheComponents(sessionId2, state.tokensPath, true);
30056
- if (!preflight || preflight.sessionId !== sessionId2) {
30057
- generationCachePreflightRef.current = { sessionId: sessionId2, promise: cachePromise };
30058
- }
30059
- const cacheWaitStartedAt = startWizardTimer("selection-cache-restoration-wait", {
30060
- sessionId: sessionId2,
30061
- preflight: Boolean(preflight?.sessionId === sessionId2)
30062
- });
30063
- try {
30064
- const cachedNames = await cachePromise;
30065
- finishWizardTimer("selection-cache-restoration-wait", cacheWaitStartedAt, {
30066
- status: "complete",
30067
- cachedCount: cachedNames.size
30068
- });
30069
- } catch (error) {
30070
- finishWizardTimer("selection-cache-restoration-wait", cacheWaitStartedAt, {
30071
- status: "error",
30072
- error: error instanceof Error ? error.message : String(error)
30073
- });
30074
- finishSelectionToReviewTimer("error");
30075
- throw error;
30076
- }
30077
28985
  await runScopeGate({
30078
28986
  sessionId: sessionId2,
30079
28987
  decisions,
@@ -30082,35 +28990,12 @@ If using a custom host configuration, make sure the space exists on that host.`
30082
28990
  if (shouldGenerateAfterScopeGate({ acceptedCount })) {
30083
28991
  const authPromise = runAgentAuthCheck("generating", true);
30084
28992
  if (await authPromise) {
30085
- const comparisonStartedAt = startWizardTimer("generation-cache-set-comparison", {
30086
- sessionId: sid,
30087
- acceptedCount: decisions?.accepted.length ?? 0
30088
- });
30089
- let cachedNames = await cachePromise;
30090
- const acceptedNames = decisions?.accepted ?? [];
30091
- let cacheHit = !effectiveNoCache && acceptedNames.length > 0 && acceptedNames.every((name) => cachedNames.has(name));
30092
- if (!cacheHit && !effectiveNoCache && acceptedNames.length > 0) {
30093
- cachedNames = await checkGenerateCacheComponents(sid, state.tokensPath, true);
30094
- cacheHit = acceptedNames.every((name) => cachedNames.has(name));
30095
- }
30096
- finishWizardTimer("generation-cache-set-comparison", comparisonStartedAt, {
30097
- status: "complete",
30098
- cacheHit,
30099
- cachedCount: cachedNames.size,
30100
- acceptedCount: acceptedNames.length
28993
+ update({
28994
+ step: "generating",
28995
+ generateProgress: null,
28996
+ acceptedCount
30101
28997
  });
30102
- if (cacheHit) {
30103
- void finishCachedGeneration(sid, acceptedCount);
30104
- } else {
30105
- const acceptedNameSet = new Set(acceptedNames);
30106
- const restoredCachedNames = [...cachedNames].filter((name) => acceptedNameSet.has(name));
30107
- update({
30108
- step: "generating",
30109
- generateProgress: null,
30110
- acceptedCount
30111
- });
30112
- void runGenerate(sid, state.tokensPath, acceptedCount, false, restoredCachedNames);
30113
- }
28998
+ void runGenerate(sid, state.tokensPath, acceptedCount);
30114
28999
  } else {
30115
29000
  finishSelectionToReviewTimer("error");
30116
29001
  }
@@ -30476,7 +29361,7 @@ function registerImportCommand(program) {
30476
29361
  "Override a composition, selection, token, generation, or token-mapping prompt (repeatable). value is a file path or literal text, e.g. --prompt select=./p.md",
30477
29362
  (v, acc) => [...acc, v],
30478
29363
  []
30479
- ).option("--no-cache", "Re-run all steps even if output already exists").action(async (opts) => {
29364
+ ).action(async (opts) => {
30480
29365
  const interactiveTerminalSupported = getInteractiveTerminalSupport().supported;
30481
29366
  if (opts.tokens !== void 0) {
30482
29367
  const { access: access9 } = await import("node:fs/promises");
@@ -30513,7 +29398,6 @@ function registerImportCommand(program) {
30513
29398
  ...resolvedModel ? { initialModel: resolvedModel } : {},
30514
29399
  initialProjectPath: opts.project !== "." ? normalizePath(opts.project) : void 0,
30515
29400
  ...buildCompositionForwardingOptions(opts),
30516
- noCache: opts.cache === false,
30517
29401
  skipMapTokens: false,
30518
29402
  livePreview: true,
30519
29403
  generatePromptPath: creds.generatePromptPath,
@@ -30601,7 +29485,7 @@ async function pathExists3(path) {
30601
29485
  return access8(path).then(() => true).catch(() => false);
30602
29486
  }
30603
29487
  function runSpawn(cmd, args, opts = {}) {
30604
- return new Promise((resolve21) => {
29488
+ return new Promise((resolve20) => {
30605
29489
  const child = spawn6(cmd, args, {
30606
29490
  cwd: opts.cwd,
30607
29491
  env: opts.env ?? process.env,
@@ -30613,7 +29497,7 @@ function runSpawn(cmd, args, opts = {}) {
30613
29497
  const settle = (result) => {
30614
29498
  if (settled) return;
30615
29499
  settled = true;
30616
- resolve21(result);
29500
+ resolve20(result);
30617
29501
  };
30618
29502
  child.on("error", (err) => settle({ exitCode: 1, stdout: "", stderr: err.message }));
30619
29503
  child.stdout.on("data", (d) => {
@@ -31814,13 +30698,13 @@ function PrerequisitesScreen({
31814
30698
  const driver = {
31815
30699
  ...base,
31816
30700
  emit: (event) => setEvents((current) => [...current, event]),
31817
- confirm: (question, defaultYes = true) => new Promise((resolve21) => {
30701
+ confirm: (question, defaultYes = true) => new Promise((resolve20) => {
31818
30702
  setConfirm({
31819
30703
  question,
31820
30704
  defaultYes,
31821
30705
  resolve: (answer) => {
31822
30706
  setConfirm(null);
31823
- resolve21(answer);
30707
+ resolve20(answer);
31824
30708
  }
31825
30709
  });
31826
30710
  })
@@ -31895,8 +30779,8 @@ function SetupScreen({
31895
30779
  useEffect21(() => {
31896
30780
  if (startedRef.current) return;
31897
30781
  startedRef.current = true;
31898
- const runScreen = (build) => new Promise((resolve21) => {
31899
- setScreen(build(resolve21));
30782
+ const runScreen = (build) => new Promise((resolve20) => {
30783
+ setScreen(build(resolve20));
31900
30784
  });
31901
30785
  void (async () => {
31902
30786
  const results = [];
@@ -32504,11 +31388,8 @@ var init_source_call_site_evidence = __esm({
32504
31388
  });
32505
31389
 
32506
31390
  // packages/experience-design-system-cli-legacy/src/analyze/extract-command.ts
32507
- import { mkdir as mkdir6, readdir as readdir3, readFile as readFile19, stat as stat6 } from "node:fs/promises";
32508
- import { isAbsolute as isAbsolute2, join as join27, relative as relative2, resolve as resolve19 } from "node:path";
32509
- function resolveExtractNoCache(opts) {
32510
- return opts.noCache === true || opts.cache === false;
32511
- }
31391
+ import { mkdir as mkdir6, readdir as readdir3, readFile as readFile18, stat as stat6 } from "node:fs/promises";
31392
+ import { isAbsolute as isAbsolute2, join as join27, relative as relative2, resolve as resolve18 } from "node:path";
32512
31393
  function isDenylistedNoiseFile(name) {
32513
31394
  return DENYLISTED_EXACT_FILE_NAMES.has(name) || DENYLISTED_FILE_NAME_PATTERNS.some((pattern) => pattern.test(name));
32514
31395
  }
@@ -32522,12 +31403,12 @@ async function retryDatabaseWrite(operation, attempts = 8) {
32522
31403
  } catch (error) {
32523
31404
  const message = error instanceof Error ? error.message : String(error);
32524
31405
  if (!/database is locked|database is busy/i.test(message) || attempt >= attempts) throw error;
32525
- await new Promise((resolve21) => setTimeout(resolve21, Math.min(250 * attempt, 2e3)));
31406
+ await new Promise((resolve20) => setTimeout(resolve20, Math.min(250 * attempt, 2e3)));
32526
31407
  }
32527
31408
  }
32528
31409
  }
32529
31410
  function resolveFromProjectRoot(projectRoot, inputPath) {
32530
- return isAbsolute2(inputPath) ? inputPath : resolve19(projectRoot, inputPath);
31411
+ return isAbsolute2(inputPath) ? inputPath : resolve18(projectRoot, inputPath);
32531
31412
  }
32532
31413
  async function pathExists4(path) {
32533
31414
  return Boolean(await stat6(path).catch(() => null));
@@ -32574,7 +31455,7 @@ async function readCandidateFiles(components, extraFiles = []) {
32574
31455
  await Promise.all(
32575
31456
  [...paths].map(async (p) => {
32576
31457
  try {
32577
- const content = await readFile19(p, "utf8");
31458
+ const content = await readFile18(p, "utf8");
32578
31459
  out.push({ path: p, content });
32579
31460
  } catch {
32580
31461
  }
@@ -32587,8 +31468,7 @@ function registerInternalExtractCommand(program) {
32587
31468
  "--resolve-unreachable <mode>",
32588
31469
  "Retry pass for unresolved Svelte Props types: 'auto' (default), 'always', or 'never'",
32589
31470
  "auto"
32590
- ).option("--no-cache", "Re-run extraction even when all source files are unchanged").action(async (opts) => {
32591
- const noCache = resolveExtractNoCache(opts);
31471
+ ).action(async (opts) => {
32592
31472
  const resolveUnreachable = (() => {
32593
31473
  const v = opts.resolveUnreachable ?? "auto";
32594
31474
  if (v !== "auto" && v !== "always" && v !== "never") {
@@ -32598,7 +31478,7 @@ function registerInternalExtractCommand(program) {
32598
31478
  }
32599
31479
  return v;
32600
31480
  })();
32601
- const projectRoot = resolve19(opts.project);
31481
+ const projectRoot = resolve18(opts.project);
32602
31482
  const outDir = join27(projectRoot, ".contentful");
32603
31483
  let sourceDirectory;
32604
31484
  if (opts.dir !== void 0) {
@@ -32622,50 +31502,16 @@ function registerInternalExtractCommand(program) {
32622
31502
  process.stderr.write(`progress=scan-done:${sourceFiles.length}
32623
31503
  `);
32624
31504
  }
32625
- const extractionCacheDb = openPipelineDb();
32626
- let extraction;
32627
- let extractionCacheHits = 0;
32628
- try {
32629
- const cacheVersion = await getCliCacheVersion();
32630
- const cachedByPath = /* @__PURE__ */ new Map();
32631
- if (!noCache && sourceFiles.length > 0) {
32632
- const hashes = await Promise.all(
32633
- sourceFiles.map(async (filePath) => [filePath, await hashFile(filePath)])
32634
- );
32635
- for (const [filePath, fileHash] of hashes) {
32636
- cachedByPath.set(filePath, lookupExtractCache(extractionCacheDb, fileHash, cacheVersion));
32637
- }
32638
- }
32639
- const allFilesCached = !noCache && sourceFiles.length > 0 && sourceFiles.every((filePath) => cachedByPath.get(filePath) !== null);
32640
- if (allFilesCached) {
32641
- const cachedComponents = sourceFiles.flatMap((filePath) => cachedByPath.get(filePath).components);
32642
- extractionCacheHits = sourceFiles.length;
32643
- extraction = { components: cachedComponents, warnings: [], exclusions: [] };
31505
+ const extraction = await extractComponents(
31506
+ sourceFiles,
31507
+ ({ filesProcessed, componentsFound }) => {
32644
31508
  if (!process.stdout.isTTY) {
32645
- process.stderr.write(
32646
- `progress=extract:${sourceFiles.length}/${sourceFiles.length}:${cachedComponents.length}
32647
- `
32648
- );
32649
- }
32650
- getDebugLogger().event("analyze", "extract.cache-hit", {
32651
- files: sourceFiles.length,
32652
- components: cachedComponents.length
32653
- });
32654
- } else {
32655
- extraction = await extractComponents(
32656
- sourceFiles,
32657
- ({ filesProcessed, componentsFound }) => {
32658
- if (!process.stdout.isTTY) {
32659
- process.stderr.write(`progress=extract:${filesProcessed}/${sourceFiles.length}:${componentsFound}
31509
+ process.stderr.write(`progress=extract:${filesProcessed}/${sourceFiles.length}:${componentsFound}
32660
31510
  `);
32661
- }
32662
- },
32663
- { resolveUnreachable, projectRoot }
32664
- );
32665
- }
32666
- } finally {
32667
- extractionCacheDb.close();
32668
- }
31511
+ }
31512
+ },
31513
+ { resolveUnreachable, projectRoot }
31514
+ );
32669
31515
  await mkdir6(outDir, { recursive: true });
32670
31516
  const db = openPipelineDb();
32671
31517
  const { sessionId: sessionId2 } = getOrCreateSession(db, void 0, void 0, {
@@ -32680,25 +31526,6 @@ function registerInternalExtractCommand(program) {
32680
31526
  const stepId = createStep(db, sessionId2, "analyze extract", {
32681
31527
  project: projectRoot
32682
31528
  });
32683
- if (extractionCacheHits === 0 && !noCache) {
32684
- const cacheVersion = await getCliCacheVersion();
32685
- const componentsBySourcePath = /* @__PURE__ */ new Map();
32686
- for (const component of extraction.components) {
32687
- if (!component.sourcePath) continue;
32688
- const components = componentsBySourcePath.get(component.sourcePath) ?? [];
32689
- components.push(component);
32690
- componentsBySourcePath.set(component.sourcePath, components);
32691
- }
32692
- for (const filePath of sourceFiles) {
32693
- storeExtractCache(
32694
- db,
32695
- filePath,
32696
- await hashFile(filePath),
32697
- cacheVersion,
32698
- componentsBySourcePath.get(filePath) ?? []
32699
- );
32700
- }
32701
- }
32702
31529
  const classifiedComponents = extraction.components.map(preClassifyComponent);
32703
31530
  for (const exclusion of extraction.exclusions ?? []) {
32704
31531
  getDebugLogger().event("filter", "extract.excluded", { ...exclusion });
@@ -32803,7 +31630,6 @@ var init_extract_command = __esm({
32803
31630
  "use strict";
32804
31631
  init_src2();
32805
31632
  init_db();
32806
- init_cache_keys();
32807
31633
  init_cycle_detection();
32808
31634
  init_resolve_mapping();
32809
31635
  init_manifest_doc_evidence();
@@ -32902,7 +31728,7 @@ __export(program_exports, {
32902
31728
  });
32903
31729
  import { spawn as spawn7 } from "node:child_process";
32904
31730
  import { fileURLToPath as fileURLToPath3 } from "node:url";
32905
- import { dirname as dirname18, join as join28, resolve as resolve20 } from "node:path";
31731
+ import { dirname as dirname18, join as join28, resolve as resolve19 } from "node:path";
32906
31732
  import { readFileSync as readFileSync10 } from "node:fs";
32907
31733
  import { Command } from "commander";
32908
31734
  async function runBuild(opts) {
@@ -32932,7 +31758,7 @@ function resolveBedrockFromAncestors(actionCommand) {
32932
31758
  }
32933
31759
  function registerBuildCommand(program) {
32934
31760
  program.command("build").description("Rebuild from source and re-link exo/experiences binaries to this build").helpOption(false).action(async () => {
32935
- const pkgRoot = resolve20(dirname18(fileURLToPath3(import.meta.url)), "..", "..");
31761
+ const pkgRoot = resolve19(dirname18(fileURLToPath3(import.meta.url)), "..", "..");
32936
31762
  process.stderr.write("\u2699 Building from source...\n");
32937
31763
  const { exitCode } = await runBuild({
32938
31764
  spawnFn: () => spawn7("pnpm", ["build"], { cwd: pkgRoot, stdio: "inherit" }),